diff options
author | Jonathan Bakker <xc-racer2@live.ca> | 2020-05-04 15:12:58 -0700 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2020-05-10 22:00:02 +0200 |
commit | 0383024f811aa469df258039807810fc3793a105 (patch) | |
tree | 4756bbf2ec63ec01fcddf03c8b6ce24ac373fce2 /drivers/power | |
parent | 29e9eff40f5edc2e5de63b28e700e82ed2b6b95c (diff) |
power: supply: max17040: Correct voltage reading
According to the datasheet available at (1), the bottom four
bits are always zero and the actual voltage is 1.25x this value
in mV. Since the kernel API specifies that voltages should be in
uV, it should report 1250x the shifted value.
1) https://datasheets.maximintegrated.com/en/ds/MAX17040-MAX17041.pdf
Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/max17040_battery.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 8a1f0ee493aa..48aa44665e2f 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -126,7 +126,7 @@ static void max17040_get_vcell(struct i2c_client *client) vcell = max17040_read_reg(client, MAX17040_VCELL); - chip->vcell = vcell; + chip->vcell = (vcell >> 4) * 1250; } static void max17040_get_soc(struct i2c_client *client) |