aboutsummaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorHans de Goede2022-11-28 10:28:53 +0100
committerSebastian Reichel2023-01-03 00:04:26 +0100
commitdee0df8496c1d13afd1bb447d284e1a76eb8e83e (patch)
tree6d1a1509b86c4a7b2d76aa84a564c883cf17d795 /drivers/power
parent4413f9e9138fe4c50db80596635a1f7f1e8bfa6a (diff)
power: supply: bq25890: Always take HiZ mode into account for ADC rate
The code to check if F_CONV_RATE has been set, or if a manual ADC conversion needs to be triggered, as well as the code to set the initial F_CONV_RATE value at probe both where not taking HiZ mode into account. Add checks for this. Reviewed-by: Marek Vasut <marex@denx.de> 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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 0d188c0d94ff..9b3a173b316a 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -467,7 +467,7 @@ static void bq25890_update_state(struct bq25890_device *bq,
/* update state in case we lost an interrupt */
__bq25890_handle_irq(bq);
*state = bq->state;
- do_adc_conv = !state->online && bq25890_is_adc_property(psp);
+ do_adc_conv = (!state->online || state->hiz) && bq25890_is_adc_property(psp);
if (do_adc_conv)
bq25890_field_write(bq, F_CONV_START, 1);
mutex_unlock(&bq->lock);
@@ -956,7 +956,7 @@ 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_field_write(bq, F_CONV_RATE, bq->state.online && !bq->state.hiz);
if (ret < 0) {
dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
return ret;