Commit da95fdc3 authored by Jonathan Bakker's avatar Jonathan Bakker Committed by Greg Kroah-Hartman

power: supply: max17040: Correct voltage reading

[ Upstream commit 0383024f ]

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.pdfSigned-off-by: default avatarJonathan Bakker <xc-racer2@live.ca>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 318af724
...@@ -109,7 +109,7 @@ static void max17040_get_vcell(struct i2c_client *client) ...@@ -109,7 +109,7 @@ static void max17040_get_vcell(struct i2c_client *client)
vcell = max17040_read_reg(client, MAX17040_VCELL); vcell = max17040_read_reg(client, MAX17040_VCELL);
chip->vcell = vcell; chip->vcell = (vcell >> 4) * 1250;
} }
static void max17040_get_soc(struct i2c_client *client) static void max17040_get_soc(struct i2c_client *client)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment