Skip to content

Commit 44263f5

Browse files
committed
power: supply: generic-adc-battery: fix unit scaling
power-supply properties are reported in µV, µA and µW. The IIO API provides mV, mA, mW, so the values need to be multiplied by 1000. Fixes: e60fea7 ("power: battery: Generic battery driver using IIO") Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
1 parent 93297ef commit 44263f5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/power/supply/generic-adc-battery.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ static int read_channel(struct gab *adc_bat, enum power_supply_property psp,
136136
result);
137137
if (ret < 0)
138138
pr_err("read channel error\n");
139+
else
140+
*result *= 1000;
141+
139142
return ret;
140143
}
141144

0 commit comments

Comments
 (0)