Skip to content

Commit

Permalink
power: supply: bq25890: Add support to read back the settings from th…
Browse files Browse the repository at this point in the history
…e chip

On most x86/ACPI devices there is no devicetree to supply the necessary
init-data. Instead the firmware already fully initializes the bq25890
charger at boot. To support this, add support for reading back the
settings from the chip through a new "linux,read-back-settings" boolean.

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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
  • Loading branch information
Hans de Goede authored and Sebastian Reichel committed Feb 1, 2022
1 parent 7e3b8e3 commit 40428bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/power/supply/bq25890_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct bq25890_device {
struct regmap_field *rmap_fields[F_MAX_FIELDS];

bool skip_reset;
bool read_back_init_data;
enum bq25890_chip_version chip_version;
struct bq25890_init_data init_data;
struct bq25890_state state;
Expand Down Expand Up @@ -696,7 +697,7 @@ static int bq25890_chip_reset(struct bq25890_device *bq)

static int bq25890_rw_init_data(struct bq25890_device *bq)
{
bool write = true;
bool write = !bq->read_back_init_data;
int ret;
int i;

Expand Down Expand Up @@ -981,6 +982,10 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
struct bq25890_init_data *init = &bq->init_data;

bq->skip_reset = device_property_read_bool(bq->dev, "linux,skip-reset");
bq->read_back_init_data = device_property_read_bool(bq->dev,
"linux,read-back-settings");
if (bq->read_back_init_data)
return 0;

ret = bq25890_fw_read_u32_props(bq);
if (ret < 0)
Expand Down

0 comments on commit 40428bd

Please sign in to comment.