diff options
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 170 |
1 files changed, 125 insertions, 45 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index feae743ba991..e64b42058b21 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -36,6 +36,7 @@ | |||
36 | w83627ehf 10 5 4 3 0x8850 0x88 0x5ca3 | 36 | w83627ehf 10 5 4 3 0x8850 0x88 0x5ca3 |
37 | 0x8860 0xa1 | 37 | 0x8860 0xa1 |
38 | w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3 | 38 | w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3 |
39 | w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3 | ||
39 | */ | 40 | */ |
40 | 41 | ||
41 | #include <linux/module.h> | 42 | #include <linux/module.h> |
@@ -52,12 +53,13 @@ | |||
52 | #include <asm/io.h> | 53 | #include <asm/io.h> |
53 | #include "lm75.h" | 54 | #include "lm75.h" |
54 | 55 | ||
55 | enum kinds { w83627ehf, w83627dhg }; | 56 | enum kinds { w83627ehf, w83627dhg, w83667hg }; |
56 | 57 | ||
57 | /* used to set data->name = w83627ehf_device_names[data->sio_kind] */ | 58 | /* used to set data->name = w83627ehf_device_names[data->sio_kind] */ |
58 | static const char * w83627ehf_device_names[] = { | 59 | static const char * w83627ehf_device_names[] = { |
59 | "w83627ehf", | 60 | "w83627ehf", |
60 | "w83627dhg", | 61 | "w83627dhg", |
62 | "w83667hg", | ||
61 | }; | 63 | }; |
62 | 64 | ||
63 | static unsigned short force_id; | 65 | static unsigned short force_id; |
@@ -71,6 +73,7 @@ MODULE_PARM_DESC(force_id, "Override the detected device ID"); | |||
71 | */ | 73 | */ |
72 | 74 | ||
73 | #define W83627EHF_LD_HWM 0x0b | 75 | #define W83627EHF_LD_HWM 0x0b |
76 | #define W83667HG_LD_VID 0x0d | ||
74 | 77 | ||
75 | #define SIO_REG_LDSEL 0x07 /* Logical device select */ | 78 | #define SIO_REG_LDSEL 0x07 /* Logical device select */ |
76 | #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ | 79 | #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ |
@@ -83,6 +86,7 @@ MODULE_PARM_DESC(force_id, "Override the detected device ID"); | |||
83 | #define SIO_W83627EHF_ID 0x8850 | 86 | #define SIO_W83627EHF_ID 0x8850 |
84 | #define SIO_W83627EHG_ID 0x8860 | 87 | #define SIO_W83627EHG_ID 0x8860 |
85 | #define SIO_W83627DHG_ID 0xa020 | 88 | #define SIO_W83627DHG_ID 0xa020 |
89 | #define SIO_W83667HG_ID 0xa510 | ||
86 | #define SIO_ID_MASK 0xFFF0 | 90 | #define SIO_ID_MASK 0xFFF0 |
87 | 91 | ||
88 | static inline void | 92 | static inline void |
@@ -289,6 +293,7 @@ struct w83627ehf_data { | |||
289 | u8 pwm_mode[4]; /* 0->DC variable voltage, 1->PWM variable duty cycle */ | 293 | u8 pwm_mode[4]; /* 0->DC variable voltage, 1->PWM variable duty cycle */ |
290 | u8 pwm_enable[4]; /* 1->manual | 294 | u8 pwm_enable[4]; /* 1->manual |
291 | 2->thermal cruise (also called SmartFan I) */ | 295 | 2->thermal cruise (also called SmartFan I) */ |
296 | u8 pwm_num; /* number of pwm */ | ||
292 | u8 pwm[4]; | 297 | u8 pwm[4]; |
293 | u8 target_temp[4]; | 298 | u8 target_temp[4]; |
294 | u8 tolerance[4]; | 299 | u8 tolerance[4]; |
@@ -298,6 +303,9 @@ struct w83627ehf_data { | |||
298 | 303 | ||
299 | u8 vid; | 304 | u8 vid; |
300 | u8 vrm; | 305 | u8 vrm; |
306 | |||
307 | u8 temp3_disable; | ||
308 | u8 in6_skip; | ||
301 | }; | 309 | }; |
302 | 310 | ||
303 | struct w83627ehf_sio_data { | 311 | struct w83627ehf_sio_data { |
@@ -866,25 +874,37 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf) | |||
866 | return sprintf(buf, "%d\n", (int)data->temp_type[nr]); | 874 | return sprintf(buf, "%d\n", (int)data->temp_type[nr]); |
867 | } | 875 | } |
868 | 876 | ||
869 | static struct sensor_device_attribute sda_temp[] = { | 877 | static struct sensor_device_attribute sda_temp_input[] = { |
870 | SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0), | 878 | SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0), |
871 | SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0), | 879 | SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0), |
872 | SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 1), | 880 | SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 1), |
881 | }; | ||
882 | |||
883 | static struct sensor_device_attribute sda_temp_max[] = { | ||
873 | SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1_max, | 884 | SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1_max, |
874 | store_temp1_max, 0), | 885 | store_temp1_max, 0), |
875 | SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max, | 886 | SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max, |
876 | store_temp_max, 0), | 887 | store_temp_max, 0), |
877 | SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max, | 888 | SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max, |
878 | store_temp_max, 1), | 889 | store_temp_max, 1), |
890 | }; | ||
891 | |||
892 | static struct sensor_device_attribute sda_temp_max_hyst[] = { | ||
879 | 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, |
880 | store_temp1_max_hyst, 0), | 894 | store_temp1_max_hyst, 0), |
881 | 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, |
882 | store_temp_max_hyst, 0), | 896 | store_temp_max_hyst, 0), |
883 | 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, |
884 | store_temp_max_hyst, 1), | 898 | store_temp_max_hyst, 1), |
899 | }; | ||
900 | |||
901 | static struct sensor_device_attribute sda_temp_alarm[] = { | ||
885 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), | 902 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4), |
886 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), | 903 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5), |
887 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), | 904 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13), |
905 | }; | ||
906 | |||
907 | static struct sensor_device_attribute sda_temp_type[] = { | ||
888 | SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), | 908 | SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), |
889 | SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), | 909 | SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), |
890 | SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), | 910 | SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), |
@@ -1181,6 +1201,8 @@ static void w83627ehf_device_remove_files(struct device *dev) | |||
1181 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) | 1201 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) |
1182 | device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr); | 1202 | device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr); |
1183 | 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; | ||
1184 | device_remove_file(dev, &sda_in_input[i].dev_attr); | 1206 | device_remove_file(dev, &sda_in_input[i].dev_attr); |
1185 | device_remove_file(dev, &sda_in_alarm[i].dev_attr); | 1207 | device_remove_file(dev, &sda_in_alarm[i].dev_attr); |
1186 | device_remove_file(dev, &sda_in_min[i].dev_attr); | 1208 | device_remove_file(dev, &sda_in_min[i].dev_attr); |
@@ -1192,15 +1214,22 @@ static void w83627ehf_device_remove_files(struct device *dev) | |||
1192 | device_remove_file(dev, &sda_fan_div[i].dev_attr); | 1214 | device_remove_file(dev, &sda_fan_div[i].dev_attr); |
1193 | device_remove_file(dev, &sda_fan_min[i].dev_attr); | 1215 | device_remove_file(dev, &sda_fan_min[i].dev_attr); |
1194 | } | 1216 | } |
1195 | for (i = 0; i < 4; i++) { | 1217 | for (i = 0; i < data->pwm_num; i++) { |
1196 | device_remove_file(dev, &sda_pwm[i].dev_attr); | 1218 | device_remove_file(dev, &sda_pwm[i].dev_attr); |
1197 | device_remove_file(dev, &sda_pwm_mode[i].dev_attr); | 1219 | device_remove_file(dev, &sda_pwm_mode[i].dev_attr); |
1198 | device_remove_file(dev, &sda_pwm_enable[i].dev_attr); | 1220 | device_remove_file(dev, &sda_pwm_enable[i].dev_attr); |
1199 | device_remove_file(dev, &sda_target_temp[i].dev_attr); | 1221 | device_remove_file(dev, &sda_target_temp[i].dev_attr); |
1200 | device_remove_file(dev, &sda_tolerance[i].dev_attr); | 1222 | device_remove_file(dev, &sda_tolerance[i].dev_attr); |
1201 | } | 1223 | } |
1202 | for (i = 0; i < ARRAY_SIZE(sda_temp); i++) | 1224 | for (i = 0; i < 3; i++) { |
1203 | 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 | } | ||
1204 | 1233 | ||
1205 | device_remove_file(dev, &dev_attr_name); | 1234 | device_remove_file(dev, &dev_attr_name); |
1206 | device_remove_file(dev, &dev_attr_cpu0_vid); | 1235 | device_remove_file(dev, &dev_attr_cpu0_vid); |
@@ -1222,6 +1251,8 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) | |||
1222 | for (i = 0; i < 2; i++) { | 1251 | for (i = 0; i < 2; i++) { |
1223 | tmp = w83627ehf_read_value(data, | 1252 | tmp = w83627ehf_read_value(data, |
1224 | W83627EHF_REG_TEMP_CONFIG[i]); | 1253 | W83627EHF_REG_TEMP_CONFIG[i]); |
1254 | if ((i == 1) && data->temp3_disable) | ||
1255 | continue; | ||
1225 | if (tmp & 0x01) | 1256 | if (tmp & 0x01) |
1226 | w83627ehf_write_value(data, | 1257 | w83627ehf_write_value(data, |
1227 | W83627EHF_REG_TEMP_CONFIG[i], | 1258 | W83627EHF_REG_TEMP_CONFIG[i], |
@@ -1272,8 +1303,17 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1272 | data->name = w83627ehf_device_names[sio_data->kind]; | 1303 | data->name = w83627ehf_device_names[sio_data->kind]; |
1273 | platform_set_drvdata(pdev, data); | 1304 | platform_set_drvdata(pdev, data); |
1274 | 1305 | ||
1275 | /* 627EHG and 627EHF have 10 voltage inputs; DHG has 9 */ | 1306 | /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */ |
1276 | data->in_num = (sio_data->kind == w83627dhg) ? 9 : 10; | 1307 | data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9; |
1308 | /* 667HG has 3 pwms */ | ||
1309 | data->pwm_num = (sio_data->kind == w83667hg) ? 3 : 4; | ||
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 | } | ||
1277 | 1317 | ||
1278 | /* Initialize the chip */ | 1318 | /* Initialize the chip */ |
1279 | w83627ehf_init_device(data); | 1319 | w83627ehf_init_device(data); |
@@ -1281,44 +1321,64 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1281 | data->vrm = vid_which_vrm(); | 1321 | data->vrm = vid_which_vrm(); |
1282 | superio_enter(sio_data->sioreg); | 1322 | superio_enter(sio_data->sioreg); |
1283 | /* Read VID value */ | 1323 | /* Read VID value */ |
1284 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); | 1324 | if (sio_data->kind == w83667hg) { |
1285 | if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) { | 1325 | /* W83667HG has different pins for VID input and output, so |
1286 | /* Set VID input sensibility if needed. In theory the BIOS | 1326 | we can get the VID input values directly at logical device D |
1287 | should have set it, but in practice it's not always the | 1327 | 0xe3. */ |
1288 | case. We only do it for the W83627EHF/EHG because the | 1328 | superio_select(sio_data->sioreg, W83667HG_LD_VID); |
1289 | W83627DHG is more complex in this respect. */ | 1329 | data->vid = superio_inb(sio_data->sioreg, 0xe3); |
1290 | if (sio_data->kind == w83627ehf) { | ||
1291 | en_vrm10 = superio_inb(sio_data->sioreg, | ||
1292 | SIO_REG_EN_VRM10); | ||
1293 | if ((en_vrm10 & 0x08) && data->vrm == 90) { | ||
1294 | dev_warn(dev, "Setting VID input voltage to " | ||
1295 | "TTL\n"); | ||
1296 | superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10, | ||
1297 | en_vrm10 & ~0x08); | ||
1298 | } else if (!(en_vrm10 & 0x08) && data->vrm == 100) { | ||
1299 | dev_warn(dev, "Setting VID input voltage to " | ||
1300 | "VRM10\n"); | ||
1301 | superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10, | ||
1302 | en_vrm10 | 0x08); | ||
1303 | } | ||
1304 | } | ||
1305 | |||
1306 | data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA); | ||
1307 | if (sio_data->kind == w83627ehf) /* 6 VID pins only */ | ||
1308 | data->vid &= 0x3f; | ||
1309 | |||
1310 | err = device_create_file(dev, &dev_attr_cpu0_vid); | 1330 | err = device_create_file(dev, &dev_attr_cpu0_vid); |
1311 | if (err) | 1331 | if (err) |
1312 | goto exit_release; | 1332 | goto exit_release; |
1313 | } else { | 1333 | } else { |
1314 | dev_info(dev, "VID pins in output mode, CPU VID not " | 1334 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); |
1315 | "available\n"); | 1335 | if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) { |
1336 | /* Set VID input sensibility if needed. In theory the | ||
1337 | BIOS should have set it, but in practice it's not | ||
1338 | always the case. We only do it for the W83627EHF/EHG | ||
1339 | because the W83627DHG is more complex in this | ||
1340 | respect. */ | ||
1341 | if (sio_data->kind == w83627ehf) { | ||
1342 | en_vrm10 = superio_inb(sio_data->sioreg, | ||
1343 | SIO_REG_EN_VRM10); | ||
1344 | if ((en_vrm10 & 0x08) && data->vrm == 90) { | ||
1345 | dev_warn(dev, "Setting VID input " | ||
1346 | "voltage to TTL\n"); | ||
1347 | superio_outb(sio_data->sioreg, | ||
1348 | SIO_REG_EN_VRM10, | ||
1349 | en_vrm10 & ~0x08); | ||
1350 | } else if (!(en_vrm10 & 0x08) | ||
1351 | && data->vrm == 100) { | ||
1352 | dev_warn(dev, "Setting VID input " | ||
1353 | "voltage to VRM10\n"); | ||
1354 | superio_outb(sio_data->sioreg, | ||
1355 | SIO_REG_EN_VRM10, | ||
1356 | en_vrm10 | 0x08); | ||
1357 | } | ||
1358 | } | ||
1359 | |||
1360 | data->vid = superio_inb(sio_data->sioreg, | ||
1361 | SIO_REG_VID_DATA); | ||
1362 | if (sio_data->kind == w83627ehf) /* 6 VID pins only */ | ||
1363 | data->vid &= 0x3f; | ||
1364 | |||
1365 | err = device_create_file(dev, &dev_attr_cpu0_vid); | ||
1366 | if (err) | ||
1367 | goto exit_release; | ||
1368 | } else { | ||
1369 | dev_info(dev, "VID pins in output mode, CPU VID not " | ||
1370 | "available\n"); | ||
1371 | } | ||
1316 | } | 1372 | } |
1317 | 1373 | ||
1318 | /* fan4 and fan5 share some pins with the GPIO and serial flash */ | 1374 | /* fan4 and fan5 share some pins with the GPIO and serial flash */ |
1319 | 1375 | if (sio_data->kind == w83667hg) { | |
1320 | fan5pin = superio_inb(sio_data->sioreg, 0x24) & 0x2; | 1376 | fan5pin = superio_inb(sio_data->sioreg, 0x27) & 0x20; |
1321 | fan4pin = superio_inb(sio_data->sioreg, 0x29) & 0x6; | 1377 | fan4pin = superio_inb(sio_data->sioreg, 0x27) & 0x40; |
1378 | } else { | ||
1379 | fan5pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x02); | ||
1380 | fan4pin = !(superio_inb(sio_data->sioreg, 0x29) & 0x06); | ||
1381 | } | ||
1322 | superio_exit(sio_data->sioreg); | 1382 | superio_exit(sio_data->sioreg); |
1323 | 1383 | ||
1324 | /* It looks like fan4 and fan5 pins can be alternatively used | 1384 | /* It looks like fan4 and fan5 pins can be alternatively used |
@@ -1329,9 +1389,9 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1329 | 1389 | ||
1330 | data->has_fan = 0x07; /* fan1, fan2 and fan3 */ | 1390 | data->has_fan = 0x07; /* fan1, fan2 and fan3 */ |
1331 | i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1); | 1391 | i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1); |
1332 | if ((i & (1 << 2)) && (!fan4pin)) | 1392 | if ((i & (1 << 2)) && fan4pin) |
1333 | data->has_fan |= (1 << 3); | 1393 | data->has_fan |= (1 << 3); |
1334 | if (!(i & (1 << 1)) && (!fan5pin)) | 1394 | if (!(i & (1 << 1)) && fan5pin) |
1335 | data->has_fan |= (1 << 4); | 1395 | data->has_fan |= (1 << 4); |
1336 | 1396 | ||
1337 | /* Read fan clock dividers immediately */ | 1397 | /* Read fan clock dividers immediately */ |
@@ -1344,14 +1404,16 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1344 | goto exit_remove; | 1404 | goto exit_remove; |
1345 | 1405 | ||
1346 | /* if fan4 is enabled create the sf3 files for it */ | 1406 | /* if fan4 is enabled create the sf3 files for it */ |
1347 | if (data->has_fan & (1 << 3)) | 1407 | if ((data->has_fan & (1 << 3)) && data->pwm_num >= 4) |
1348 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) { | 1408 | for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) { |
1349 | if ((err = device_create_file(dev, | 1409 | if ((err = device_create_file(dev, |
1350 | &sda_sf3_arrays_fan4[i].dev_attr))) | 1410 | &sda_sf3_arrays_fan4[i].dev_attr))) |
1351 | goto exit_remove; | 1411 | goto exit_remove; |
1352 | } | 1412 | } |
1353 | 1413 | ||
1354 | 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; | ||
1355 | 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)) |
1356 | || (err = device_create_file(dev, | 1418 | || (err = device_create_file(dev, |
1357 | &sda_in_alarm[i].dev_attr)) | 1419 | &sda_in_alarm[i].dev_attr)) |
@@ -1360,6 +1422,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1360 | || (err = device_create_file(dev, | 1422 | || (err = device_create_file(dev, |
1361 | &sda_in_max[i].dev_attr))) | 1423 | &sda_in_max[i].dev_attr))) |
1362 | goto exit_remove; | 1424 | goto exit_remove; |
1425 | } | ||
1363 | 1426 | ||
1364 | for (i = 0; i < 5; i++) { | 1427 | for (i = 0; i < 5; i++) { |
1365 | if (data->has_fan & (1 << i)) { | 1428 | if (data->has_fan & (1 << i)) { |
@@ -1372,7 +1435,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1372 | || (err = device_create_file(dev, | 1435 | || (err = device_create_file(dev, |
1373 | &sda_fan_min[i].dev_attr))) | 1436 | &sda_fan_min[i].dev_attr))) |
1374 | goto exit_remove; | 1437 | goto exit_remove; |
1375 | if (i < 4 && /* w83627ehf only has 4 pwm */ | 1438 | if (i < data->pwm_num && |
1376 | ((err = device_create_file(dev, | 1439 | ((err = device_create_file(dev, |
1377 | &sda_pwm[i].dev_attr)) | 1440 | &sda_pwm[i].dev_attr)) |
1378 | || (err = device_create_file(dev, | 1441 | || (err = device_create_file(dev, |
@@ -1387,9 +1450,21 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1387 | } | 1450 | } |
1388 | } | 1451 | } |
1389 | 1452 | ||
1390 | for (i = 0; i < ARRAY_SIZE(sda_temp); i++) | 1453 | for (i = 0; i < 3; i++) { |
1391 | 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))) | ||
1392 | goto exit_remove; | 1466 | goto exit_remove; |
1467 | } | ||
1393 | 1468 | ||
1394 | err = device_create_file(dev, &dev_attr_name); | 1469 | err = device_create_file(dev, &dev_attr_name); |
1395 | if (err) | 1470 | if (err) |
@@ -1442,6 +1517,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | |||
1442 | static const char __initdata sio_name_W83627EHF[] = "W83627EHF"; | 1517 | static const char __initdata sio_name_W83627EHF[] = "W83627EHF"; |
1443 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; | 1518 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; |
1444 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; | 1519 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; |
1520 | static const char __initdata sio_name_W83667HG[] = "W83667HG"; | ||
1445 | 1521 | ||
1446 | u16 val; | 1522 | u16 val; |
1447 | const char *sio_name; | 1523 | const char *sio_name; |
@@ -1466,6 +1542,10 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | |||
1466 | sio_data->kind = w83627dhg; | 1542 | sio_data->kind = w83627dhg; |
1467 | sio_name = sio_name_W83627DHG; | 1543 | sio_name = sio_name_W83627DHG; |
1468 | break; | 1544 | break; |
1545 | case SIO_W83667HG_ID: | ||
1546 | sio_data->kind = w83667hg; | ||
1547 | sio_name = sio_name_W83667HG; | ||
1548 | break; | ||
1469 | default: | 1549 | default: |
1470 | if (val != 0xffff) | 1550 | if (val != 0xffff) |
1471 | pr_debug(DRVNAME ": unsupported chip ID: 0x%04x\n", | 1551 | pr_debug(DRVNAME ": unsupported chip ID: 0x%04x\n", |