aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83627ehf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r--drivers/hwmon/w83627ehf.c24
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, \
846store_temp_reg(OVER, temp_max); 847store_temp_reg(OVER, temp_max);
847store_temp_reg(HYST, temp_max_hyst); 848store_temp_reg(HYST, temp_max_hyst);
848 849
850static ssize_t
851show_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
849static struct sensor_device_attribute sda_temp[] = { 859static 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)
1188static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) 1201static 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
1215static int __devinit w83627ehf_probe(struct platform_device *pdev) 1237static int __devinit w83627ehf_probe(struct platform_device *pdev)