Commit dde5953f authored by Ladislav Michl's avatar Ladislav Michl Committed by Sebastian Reichel

power: supply: ltc2941-battery-gauge: Fix temperature units

Temperature is measured in tenths of degree Celsius.

Fixes: 085bc24d ("Add LTC2941/LTC2943 Battery Gauge Driver")
Signed-off-by: default avatarLadislav Michl <ladis@linux-mips.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent 7928b2cb
...@@ -317,15 +317,15 @@ static int ltc294x_get_temperature(const struct ltc294x_info *info, int *val) ...@@ -317,15 +317,15 @@ static int ltc294x_get_temperature(const struct ltc294x_info *info, int *val)
if (info->id == LTC2942_ID) { if (info->id == LTC2942_ID) {
reg = LTC2942_REG_TEMPERATURE_MSB; reg = LTC2942_REG_TEMPERATURE_MSB;
value = 60000; /* Full-scale is 600 Kelvin */ value = 6000; /* Full-scale is 600 Kelvin */
} else { } else {
reg = LTC2943_REG_TEMPERATURE_MSB; reg = LTC2943_REG_TEMPERATURE_MSB;
value = 51000; /* Full-scale is 510 Kelvin */ value = 5100; /* Full-scale is 510 Kelvin */
} }
ret = ltc294x_read_regs(info->client, reg, &datar[0], 2); ret = ltc294x_read_regs(info->client, reg, &datar[0], 2);
value *= (datar[0] << 8) | datar[1]; value *= (datar[0] << 8) | datar[1];
/* Convert to centidegrees */ /* Convert to tenths of degree Celsius */
*val = value / 0xFFFF - 27215; *val = value / 0xFFFF - 2722;
return ret; return ret;
} }
......
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