Commit da667365befb2846485b82c4e6c57729dd513fd2
Committed by
Mark M. Hoffman
1 parent
d3130f0e30
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 23 additions and 1 deletions Side-by-side Diff
drivers/hwmon/w83627ehf.c
... | ... | @@ -272,6 +272,7 @@ |
272 | 272 | u8 fan_min[5]; |
273 | 273 | u8 fan_div[5]; |
274 | 274 | u8 has_fan; /* some fan inputs can be disabled */ |
275 | + u8 temp_type[3]; | |
275 | 276 | s8 temp1; |
276 | 277 | s8 temp1_max; |
277 | 278 | s8 temp1_max_hyst; |
... | ... | @@ -846,6 +847,15 @@ |
846 | 847 | store_temp_reg(OVER, temp_max); |
847 | 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 | 859 | static struct sensor_device_attribute sda_temp[] = { |
850 | 860 | SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0), |
851 | 861 | SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0), |
... | ... | @@ -865,6 +875,9 @@ |
865 | 875 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), |
866 | 876 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), |
867 | 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 | 883 | #define show_pwm_reg(reg) \ |
... | ... | @@ -1188,7 +1201,7 @@ |
1188 | 1201 | static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) |
1189 | 1202 | { |
1190 | 1203 | int i; |
1191 | - u8 tmp; | |
1204 | + u8 tmp, diode; | |
1192 | 1205 | |
1193 | 1206 | /* Start monitoring is needed */ |
1194 | 1207 | tmp = w83627ehf_read_value(data, W83627EHF_REG_CONFIG); |
... | ... | @@ -1210,6 +1223,15 @@ |
1210 | 1223 | tmp = w83627ehf_read_value(data, W83627EHF_REG_VBAT); |
1211 | 1224 | if (!(tmp & 0x01)) |
1212 | 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 | 1237 | static int __devinit w83627ehf_probe(struct platform_device *pdev) |