Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hans de Goede and committed by
Sebastian Reichel
dee0df84 4413f9e9

+2 -2
+2 -2
drivers/power/supply/bq25890_charger.c
··· 467 467 /* update state in case we lost an interrupt */ 468 468 __bq25890_handle_irq(bq); 469 469 *state = bq->state; 470 - do_adc_conv = !state->online && bq25890_is_adc_property(psp); 470 + do_adc_conv = (!state->online || state->hiz) && bq25890_is_adc_property(psp); 471 471 if (do_adc_conv) 472 472 bq25890_field_write(bq, F_CONV_START, 1); 473 473 mutex_unlock(&bq->lock); ··· 956 956 } 957 957 958 958 /* Configure ADC for continuous conversions when charging */ 959 - ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online); 959 + ret = bq25890_field_write(bq, F_CONV_RATE, bq->state.online && !bq->state.hiz); 960 960 if (ret < 0) { 961 961 dev_dbg(bq->dev, "Config ADC failed %d\n", ret); 962 962 return ret;