diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-06-24 05:21:02 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2007-07-19 14:22:18 -0400 |
commit | da667365befb2846485b82c4e6c57729dd513fd2 (patch) | |
tree | c0aca26e0641661a59357b3cba5526e0c225dd99 /drivers/hwmon/w83627ehf.c | |
parent | d3130f0e30745b406af233897a27834eb5285f45 (diff) |
hwmon/w83627ehf: Export the thermal sensor types
Add support for the w83627ehf thermal sensor types. I made them read-only,
as the BIOS is supposed to set them up properly. This information makes it
easier to find out which temperature channel corresponds to the CPU.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index e87fcf87a6e2..a78d3c2623ba 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -272,6 +272,7 @@ struct w83627ehf_data { | |||
272 | u8 fan_min[5]; | 272 | u8 fan_min[5]; |
273 | u8 fan_div[5]; | 273 | u8 fan_div[5]; |
274 | u8 has_fan; /* some fan inputs can be disabled */ | 274 | u8 has_fan; /* some fan inputs can be disabled */ |
275 | u8 temp_type[3]; | ||
275 | s8 temp1; | 276 | s8 temp1; |
276 | s8 temp1_max; | 277 | s8 temp1_max; |
277 | s8 temp1_max_hyst; | 278 | s8 temp1_max_hyst; |
@@ -846,6 +847,15 @@ store_##reg(struct device *dev, struct device_attribute *attr, \ | |||
846 | store_temp_reg(OVER, temp_max); | 847 | store_temp_reg(OVER, temp_max); |
847 | store_temp_reg(HYST, temp_max_hyst); | 848 | store_temp_reg(HYST, temp_max_hyst); |
848 | 849 | ||
850 | static ssize_t | ||
851 | show_temp_type(struct device *dev, struct device_attribute *attr, char *buf) | ||
852 | { | ||
853 | struct w83627ehf_data *data = w83627ehf_update_device(dev); | ||
854 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
855 | int nr = sensor_attr->index; | ||
856 | return sprintf(buf, "%d\n", (int)data->temp_type[nr]); | ||
857 | } | ||
858 | |||
849 | static struct sensor_device_attribute sda_temp[] = { | 859 | static struct sensor_device_attribute sda_temp[] = { |
850 | SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0), | 860 | SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0), |
851 | SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0), | 861 | SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0), |
@@ -865,6 +875,9 @@ static struct sensor_device_attribute sda_temp[] = { | |||
865 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), | 875 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), |
866 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), | 876 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), |
867 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), | 877 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), |
878 | SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), | ||
879 | SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), | ||
880 | SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), | ||
868 | }; | 881 | }; |
869 | 882 | ||
870 | #define show_pwm_reg(reg) \ | 883 | #define show_pwm_reg(reg) \ |
@@ -1188,7 +1201,7 @@ static void w83627ehf_device_remove_files(struct device *dev) | |||
1188 | static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) | 1201 | static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) |
1189 | { | 1202 | { |
1190 | int i; | 1203 | int i; |
1191 | u8 tmp; | 1204 | u8 tmp, diode; |
1192 | 1205 | ||
1193 | /* Start monitoring is needed */ | 1206 | /* Start monitoring is needed */ |
1194 | tmp = w83627ehf_read_value(data, W83627EHF_REG_CONFIG); | 1207 | tmp = w83627ehf_read_value(data, W83627EHF_REG_CONFIG); |
@@ -1210,6 +1223,15 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) | |||
1210 | tmp = w83627ehf_read_value(data, W83627EHF_REG_VBAT); | 1223 | tmp = w83627ehf_read_value(data, W83627EHF_REG_VBAT); |
1211 | if (!(tmp & 0x01)) | 1224 | if (!(tmp & 0x01)) |
1212 | w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01); | 1225 | w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01); |
1226 | |||
1227 | /* Get thermal sensor types */ | ||
1228 | diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); | ||
1229 | for (i = 0; i < 3; i++) { | ||
1230 | if ((tmp & (0x02 << i))) | ||
1231 | data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 2; | ||
1232 | else | ||
1233 | data->temp_type[i] = 4; /* thermistor */ | ||
1234 | } | ||
1213 | } | 1235 | } |
1214 | 1236 | ||
1215 | static int __devinit w83627ehf_probe(struct platform_device *pdev) | 1237 | static int __devinit w83627ehf_probe(struct platform_device *pdev) |