aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83627ehf.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 20a9332959bb..e64b42058b21 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -303,6 +303,9 @@ struct w83627ehf_data {
303 303
304 u8 vid; 304 u8 vid;
305 u8 vrm; 305 u8 vrm;
306
307 u8 temp3_disable;
308 u8 in6_skip;
306}; 309};
307 310
308struct w83627ehf_sio_data { 311struct w83627ehf_sio_data {
@@ -871,25 +874,37 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
871 return sprintf(buf, "%d\n", (int)data->temp_type[nr]); 874 return sprintf(buf, "%d\n", (int)data->temp_type[nr]);
872} 875}
873 876
874static struct sensor_device_attribute sda_temp[] = { 877static struct sensor_device_attribute sda_temp_input[] = {
875 SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0), 878 SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0),
876 SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0), 879 SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0),
877 SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 1), 880 SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 1),
881};
882
883static struct sensor_device_attribute sda_temp_max[] = {
878 SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1_max, 884 SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1_max,
879 store_temp1_max, 0), 885 store_temp1_max, 0),
880 SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max, 886 SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max,
881 store_temp_max, 0), 887 store_temp_max, 0),
882 SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max, 888 SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max,
883 store_temp_max, 1), 889 store_temp_max, 1),
890};
891
892static struct sensor_device_attribute sda_temp_max_hyst[] = {
884 SENSOR_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1_max_hyst, 893 SENSOR_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1_max_hyst,
885 store_temp1_max_hyst, 0), 894 store_temp1_max_hyst, 0),
886 SENSOR_ATTR(temp2_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst, 895 SENSOR_ATTR(temp2_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst,
887 store_temp_max_hyst, 0), 896 store_temp_max_hyst, 0),
888 SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst, 897 SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst,
889 store_temp_max_hyst, 1), 898 store_temp_max_hyst, 1),
899};
900
901static struct sensor_device_attribute sda_temp_alarm[] = {
890 SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), 902 SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4),
891 SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), 903 SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5),
892 SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), 904 SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13),
905};
906
907static struct sensor_device_attribute sda_temp_type[] = {
893 SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), 908 SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0),
894 SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), 909 SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1),
895 SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), 910 SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2),
@@ -1186,6 +1201,8 @@ static void w83627ehf_device_remove_files(struct device *dev)
1186 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) 1201 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++)
1187 device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr); 1202 device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr);
1188 for (i = 0; i < data->in_num; i++) { 1203 for (i = 0; i < data->in_num; i++) {
1204 if ((i == 6) && data->in6_skip)
1205 continue;
1189 device_remove_file(dev, &sda_in_input[i].dev_attr); 1206 device_remove_file(dev, &sda_in_input[i].dev_attr);
1190 device_remove_file(dev, &sda_in_alarm[i].dev_attr); 1207 device_remove_file(dev, &sda_in_alarm[i].dev_attr);
1191 device_remove_file(dev, &sda_in_min[i].dev_attr); 1208 device_remove_file(dev, &sda_in_min[i].dev_attr);
@@ -1204,8 +1221,15 @@ static void w83627ehf_device_remove_files(struct device *dev)
1204 device_remove_file(dev, &sda_target_temp[i].dev_attr); 1221 device_remove_file(dev, &sda_target_temp[i].dev_attr);
1205 device_remove_file(dev, &sda_tolerance[i].dev_attr); 1222 device_remove_file(dev, &sda_tolerance[i].dev_attr);
1206 } 1223 }
1207 for (i = 0; i < ARRAY_SIZE(sda_temp); i++) 1224 for (i = 0; i < 3; i++) {
1208 device_remove_file(dev, &sda_temp[i].dev_attr); 1225 if ((i == 2) && data->temp3_disable)
1226 continue;
1227 device_remove_file(dev, &sda_temp_input[i].dev_attr);
1228 device_remove_file(dev, &sda_temp_max[i].dev_attr);
1229 device_remove_file(dev, &sda_temp_max_hyst[i].dev_attr);
1230 device_remove_file(dev, &sda_temp_alarm[i].dev_attr);
1231 device_remove_file(dev, &sda_temp_type[i].dev_attr);
1232 }
1209 1233
1210 device_remove_file(dev, &dev_attr_name); 1234 device_remove_file(dev, &dev_attr_name);
1211 device_remove_file(dev, &dev_attr_cpu0_vid); 1235 device_remove_file(dev, &dev_attr_cpu0_vid);
@@ -1227,6 +1251,8 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data)
1227 for (i = 0; i < 2; i++) { 1251 for (i = 0; i < 2; i++) {
1228 tmp = w83627ehf_read_value(data, 1252 tmp = w83627ehf_read_value(data,
1229 W83627EHF_REG_TEMP_CONFIG[i]); 1253 W83627EHF_REG_TEMP_CONFIG[i]);
1254 if ((i == 1) && data->temp3_disable)
1255 continue;
1230 if (tmp & 0x01) 1256 if (tmp & 0x01)
1231 w83627ehf_write_value(data, 1257 w83627ehf_write_value(data,
1232 W83627EHF_REG_TEMP_CONFIG[i], 1258 W83627EHF_REG_TEMP_CONFIG[i],
@@ -1282,6 +1308,13 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1282 /* 667HG has 3 pwms */ 1308 /* 667HG has 3 pwms */
1283 data->pwm_num = (sio_data->kind == w83667hg) ? 3 : 4; 1309 data->pwm_num = (sio_data->kind == w83667hg) ? 3 : 4;
1284 1310
1311 /* Check temp3 configuration bit for 667HG */
1312 if (sio_data->kind == w83667hg) {
1313 data->temp3_disable = w83627ehf_read_value(data,
1314 W83627EHF_REG_TEMP_CONFIG[1]) & 0x01;
1315 data->in6_skip = !data->temp3_disable;
1316 }
1317
1285 /* Initialize the chip */ 1318 /* Initialize the chip */
1286 w83627ehf_init_device(data); 1319 w83627ehf_init_device(data);
1287 1320
@@ -1378,7 +1411,9 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1378 goto exit_remove; 1411 goto exit_remove;
1379 } 1412 }
1380 1413
1381 for (i = 0; i < data->in_num; i++) 1414 for (i = 0; i < data->in_num; i++) {
1415 if ((i == 6) && data->in6_skip)
1416 continue;
1382 if ((err = device_create_file(dev, &sda_in_input[i].dev_attr)) 1417 if ((err = device_create_file(dev, &sda_in_input[i].dev_attr))
1383 || (err = device_create_file(dev, 1418 || (err = device_create_file(dev,
1384 &sda_in_alarm[i].dev_attr)) 1419 &sda_in_alarm[i].dev_attr))
@@ -1387,6 +1422,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1387 || (err = device_create_file(dev, 1422 || (err = device_create_file(dev,
1388 &sda_in_max[i].dev_attr))) 1423 &sda_in_max[i].dev_attr)))
1389 goto exit_remove; 1424 goto exit_remove;
1425 }
1390 1426
1391 for (i = 0; i < 5; i++) { 1427 for (i = 0; i < 5; i++) {
1392 if (data->has_fan & (1 << i)) { 1428 if (data->has_fan & (1 << i)) {
@@ -1414,9 +1450,21 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1414 } 1450 }
1415 } 1451 }
1416 1452
1417 for (i = 0; i < ARRAY_SIZE(sda_temp); i++) 1453 for (i = 0; i < 3; i++) {
1418 if ((err = device_create_file(dev, &sda_temp[i].dev_attr))) 1454 if ((i == 2) && data->temp3_disable)
1455 continue;
1456 if ((err = device_create_file(dev,
1457 &sda_temp_input[i].dev_attr))
1458 || (err = device_create_file(dev,
1459 &sda_temp_max[i].dev_attr))
1460 || (err = device_create_file(dev,
1461 &sda_temp_max_hyst[i].dev_attr))
1462 || (err = device_create_file(dev,
1463 &sda_temp_alarm[i].dev_attr))
1464 || (err = device_create_file(dev,
1465 &sda_temp_type[i].dev_attr)))
1419 goto exit_remove; 1466 goto exit_remove;
1467 }
1420 1468
1421 err = device_create_file(dev, &dev_attr_name); 1469 err = device_create_file(dev, &dev_attr_name);
1422 if (err) 1470 if (err)