]>
Commit | Line | Data |
---|---|---|
0a67671d GKH |
1 | From ed54ffbe554f0902689fd6d1712bbacbacd11376 Mon Sep 17 00:00:00 2001 |
2 | From: Lubomir Rintel <lkundrak@v3.sk> | |
3 | Date: Fri, 16 Nov 2018 17:23:47 +0100 | |
4 | Subject: power: supply: olpc_battery: correct the temperature units | |
5 | ||
6 | From: Lubomir Rintel <lkundrak@v3.sk> | |
7 | ||
8 | commit ed54ffbe554f0902689fd6d1712bbacbacd11376 upstream. | |
9 | ||
10 | According to [1] and [2], the temperature values are in tenths of degree | |
11 | Celsius. Exposing the Celsius value makes the battery appear on fire: | |
12 | ||
13 | $ upower -i /org/freedesktop/UPower/devices/battery_olpc_battery | |
14 | ... | |
15 | temperature: 236.9 degrees C | |
16 | ||
17 | Tested on OLPC XO-1 and OLPC XO-1.75 laptops. | |
18 | ||
19 | [1] include/linux/power_supply.h | |
20 | [2] Documentation/power/power_supply_class.txt | |
21 | ||
22 | Fixes: fb972873a767 ("[BATTERY] One Laptop Per Child power/battery driver") | |
23 | Cc: stable@vger.kernel.org | |
24 | Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> | |
25 | Acked-by: Pavel Machek <pavel@ucw.cz> | |
26 | Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> | |
27 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
28 | ||
29 | --- | |
30 | drivers/power/olpc_battery.c | 4 ++-- | |
31 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
32 | ||
33 | --- a/drivers/power/olpc_battery.c | |
34 | +++ b/drivers/power/olpc_battery.c | |
35 | @@ -427,14 +427,14 @@ static int olpc_bat_get_property(struct | |
36 | if (ret) | |
37 | return ret; | |
38 | ||
39 | - val->intval = (s16)be16_to_cpu(ec_word) * 100 / 256; | |
40 | + val->intval = (s16)be16_to_cpu(ec_word) * 10 / 256; | |
41 | break; | |
42 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: | |
43 | ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2); | |
44 | if (ret) | |
45 | return ret; | |
46 | ||
47 | - val->intval = (int)be16_to_cpu(ec_word) * 100 / 256; | |
48 | + val->intval = (int)be16_to_cpu(ec_word) * 10 / 256; | |
49 | break; | |
50 | case POWER_SUPPLY_PROP_CHARGE_COUNTER: | |
51 | ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2); |