diff options
| author | Corentin Chary <corentin.chary@gmail.com> | 2011-07-01 05:34:36 -0400 |
|---|---|---|
| committer | Matthew Garrett <mjg@redhat.com> | 2011-08-05 14:46:00 -0400 |
| commit | 6118b8adb50c23714d5be089965082bbbb48d831 (patch) | |
| tree | 879b67364770980827d8202b064e1612ef79e816 | |
| parent | 79ec1172c29ed521f1652b0b44dceb84ba115541 (diff) | |
asus-wmi: add thermal sensor
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
| -rw-r--r-- | drivers/platform/x86/asus-wmi.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index e60385df4af2..d01f767c7b69 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <linux/debugfs.h> | 44 | #include <linux/debugfs.h> |
| 45 | #include <linux/seq_file.h> | 45 | #include <linux/seq_file.h> |
| 46 | #include <linux/platform_device.h> | 46 | #include <linux/platform_device.h> |
| 47 | #include <linux/thermal.h> | ||
| 47 | #include <acpi/acpi_bus.h> | 48 | #include <acpi/acpi_bus.h> |
| 48 | #include <acpi/acpi_drivers.h> | 49 | #include <acpi/acpi_drivers.h> |
| 49 | 50 | ||
| @@ -930,7 +931,26 @@ static ssize_t asus_hwmon_pwm1(struct device *dev, | |||
| 930 | return sprintf(buf, "%d\n", value); | 931 | return sprintf(buf, "%d\n", value); |
| 931 | } | 932 | } |
| 932 | 933 | ||
| 934 | static ssize_t asus_hwmon_temp1(struct device *dev, | ||
| 935 | struct device_attribute *attr, | ||
| 936 | char *buf) | ||
| 937 | { | ||
| 938 | struct asus_wmi *asus = dev_get_drvdata(dev); | ||
| 939 | u32 value; | ||
| 940 | int err; | ||
| 941 | |||
| 942 | err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_THERMAL_CTRL, &value); | ||
| 943 | |||
| 944 | if (err < 0) | ||
| 945 | return err; | ||
| 946 | |||
| 947 | value = KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000; | ||
| 948 | |||
| 949 | return sprintf(buf, "%d\n", value); | ||
| 950 | } | ||
| 951 | |||
| 933 | static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO, asus_hwmon_pwm1, NULL, 0); | 952 | static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO, asus_hwmon_pwm1, NULL, 0); |
| 953 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL, 0); | ||
| 934 | 954 | ||
| 935 | static ssize_t | 955 | static ssize_t |
| 936 | show_name(struct device *dev, struct device_attribute *attr, char *buf) | 956 | show_name(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -941,6 +961,7 @@ static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); | |||
| 941 | 961 | ||
| 942 | static struct attribute *hwmon_attributes[] = { | 962 | static struct attribute *hwmon_attributes[] = { |
| 943 | &sensor_dev_attr_pwm1.dev_attr.attr, | 963 | &sensor_dev_attr_pwm1.dev_attr.attr, |
| 964 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
| 944 | &sensor_dev_attr_name.dev_attr.attr, | 965 | &sensor_dev_attr_name.dev_attr.attr, |
| 945 | NULL | 966 | NULL |
| 946 | }; | 967 | }; |
