summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorJonathan Bakker <xc-racer2@live.ca>2020-05-04 15:12:58 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-01 13:17:59 +0200
commite3d47125a42ce0f67fdb0bcc104aa6e7a040028b (patch)
tree87a123b2fe764918deacaea95b0be8379ccef33a /drivers/power
parent44a3faa00887122295e5b48044bdd53b292db400 (diff)
downloadlinux-e3d47125a42ce0f67fdb0bcc104aa6e7a040028b.tar.gz
linux-e3d47125a42ce0f67fdb0bcc104aa6e7a040028b.tar.bz2
linux-e3d47125a42ce0f67fdb0bcc104aa6e7a040028b.zip
power: supply: max17040: Correct voltage reading
[ Upstream commit 0383024f811aa469df258039807810fc3793a105 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/max17040_battery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index 62499018e68b..2e845045a3fc 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -105,7 +105,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)