[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220130204557.15662-6-hdegoede@redhat.com>
Date: Sun, 30 Jan 2022 21:45:42 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: "Rafael J . Wysocki" <rafael@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Mark Gross <markgross@...nel.org>,
Andy Shevchenko <andy@...nel.org>,
Wolfram Sang <wsa@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Sebastian Reichel <sre@...nel.org>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Ard Biesheuvel <ardb@...nel.org>
Cc: Hans de Goede <hdegoede@...hat.com>, Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org, Yauhen Kharuzhy <jekhor@...il.com>,
Tsuchiya Yuto <kitakar@...il.com>,
Fabio Aiuto <fabioaiuto83@...il.com>,
platform-driver-x86@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org
Subject: [PATCH v4 05/20] power: supply: bq25890: Add support to skip reset at probe() / remove()
On most x86/ACPI devices the firmware already fully initializes
the bq25890 charger at boot, in this case it is best to not reset
it at probe() time.
At support for a new "linux,skip-reset" boolean property to support this.
So far this new property is only used on x86/ACPI (non devicetree) devs,
IOW it is not used in actual devicetree files. The devicetree-bindings
maintainers have requested properties like these to not be added to the
devicetree-bindings, so the new property is deliberately not added
to the existing devicetree-bindings.
Signed-off-by: Hans de Goede <hdegoede@...hat.com>
---
Changes in v2:
- New patch in v2 of this series, together with the "linux,read-back-settings"
patch, this patch replaces the "ti,skip-init" patch from v1
---
drivers/power/supply/bq25890_charger.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index eaf0400b632f..cd80d748df92 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -110,6 +110,7 @@ struct bq25890_device {
struct regmap *rmap;
struct regmap_field *rmap_fields[F_MAX_FIELDS];
+ bool skip_reset;
enum bq25890_chip_version chip_version;
struct bq25890_init_data init_data;
struct bq25890_state state;
@@ -739,10 +740,12 @@ static int bq25890_hw_init(struct bq25890_device *bq)
{
int ret;
- ret = bq25890_chip_reset(bq);
- if (ret < 0) {
- dev_dbg(bq->dev, "Reset failed %d\n", ret);
- return ret;
+ if (!bq->skip_reset) {
+ ret = bq25890_chip_reset(bq);
+ if (ret < 0) {
+ dev_dbg(bq->dev, "Reset failed %d\n", ret);
+ return ret;
+ }
}
/* disable watchdog */
@@ -977,6 +980,8 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
int ret;
struct bq25890_init_data *init = &bq->init_data;
+ bq->skip_reset = device_property_read_bool(bq->dev, "linux,skip-reset");
+
ret = bq25890_fw_read_u32_props(bq);
if (ret < 0)
return ret;
@@ -1089,8 +1094,10 @@ static int bq25890_remove(struct i2c_client *client)
if (!IS_ERR_OR_NULL(bq->usb_phy))
usb_unregister_notifier(bq->usb_phy, &bq->usb_nb);
- /* reset all registers to default values */
- bq25890_chip_reset(bq);
+ if (!bq->skip_reset) {
+ /* reset all registers to default values */
+ bq25890_chip_reset(bq);
+ }
return 0;
}
--
2.33.1
Powered by blists - more mailing lists