diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-11-09 15:15:06 +0000 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-01-08 10:55:40 -0800 |
commit | dcdea2614ab9b7864a3ae620419d04e0cc4a65cc (patch) | |
tree | 703762912f3898ecb3dc61639207974bb7377f38 /drivers/hwmon/applesmc.c | |
parent | 9792dadfce22ae1518c88577ac743a3077a85084 (diff) | |
download | kernel_samsung_tuna-dcdea2614ab9b7864a3ae620419d04e0cc4a65cc.zip kernel_samsung_tuna-dcdea2614ab9b7864a3ae620419d04e0cc4a65cc.tar.gz kernel_samsung_tuna-dcdea2614ab9b7864a3ae620419d04e0cc4a65cc.tar.bz2 |
hwmon: (applesmc) Handle new temperature format
The recent Macbooks have temperature registers of a new type.
This patch adds the logic to handle them.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/applesmc.c')
-rw-r--r-- | drivers/hwmon/applesmc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 03c24b7..1d7f8af 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -734,13 +734,19 @@ static ssize_t applesmc_show_temperature(struct device *dev, entry = applesmc_get_entry_by_index(index); if (IS_ERR(entry)) return PTR_ERR(entry); + if (entry->len > 2) + return -EINVAL; - ret = applesmc_read_entry(entry, buffer, 2); + ret = applesmc_read_entry(entry, buffer, entry->len); if (ret) return ret; - temp = buffer[0]*1000; - temp += (buffer[1] >> 6) * 250; + if (entry->len == 2) { + temp = buffer[0] * 1000; + temp += (buffer[1] >> 6) * 250; + } else { + temp = buffer[0] * 4000; + } return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", temp); } |