]> Git Repo - linux.git/commitdiff
power: supply: bq25890: Fix initial setting of the F_CONV_RATE field
authorHans de Goede <[email protected]>
Sat, 30 Oct 2021 18:28:04 +0000 (20:28 +0200)
committerSebastian Reichel <[email protected]>
Tue, 2 Nov 2021 15:48:47 +0000 (16:48 +0100)
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 <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
drivers/power/supply/bq25890_charger.c

index 42d82bee9727968d6f8245e3688e3d77cebcf162..34ec186a2e9abca1d6fa2290c9c87cf07436088e 100644 (file)
@@ -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;
        }
 
This page took 0.058006 seconds and 4 git commands to generate.