summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2021-10-30 20:28:04 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2021-11-02 16:48:47 +0100
commit22ad4f99f63fc892412cde5a45d43b2288a60b88 (patch)
treec914901c9fde67c97d7092e4ff1a6462333da947 /drivers/power
parentd01363da53ebd1920a9676ea12e5c1168e292346 (diff)
power: supply: bq25890: Fix initial setting of the F_CONV_RATE field
The code doing the initial setting of the F_CONV_RATE field based on the bq->state.online flag. In order for this to work properly, this must be done after the initial bq25890_get_chip_state() call. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/bq25890_charger.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 42d82bee9727..34ec186a2e9a 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -682,16 +682,16 @@ static int bq25890_hw_init(struct bq25890_device *bq)
}
}
- /* Configure ADC for continuous conversions when charging */
- ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
+ ret = bq25890_get_chip_state(bq, &bq->state);
if (ret < 0) {
- dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
+ dev_dbg(bq->dev, "Get state failed %d\n", ret);
return ret;
}
- ret = bq25890_get_chip_state(bq, &bq->state);
+ /* Configure ADC for continuous conversions when charging */
+ ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
if (ret < 0) {
- dev_dbg(bq->dev, "Get state failed %d\n", ret);
+ dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
return ret;
}