diff options
| -rw-r--r-- | drivers/hwmon/w83793.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index ee35af93b574..ed3c019b78c7 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c | |||
| @@ -1024,10 +1024,9 @@ static struct sensor_device_attribute_2 w83793_vid[] = { | |||
| 1024 | SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), | 1024 | SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), |
| 1025 | SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), | 1025 | SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), |
| 1026 | }; | 1026 | }; |
| 1027 | static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm); | ||
| 1027 | 1028 | ||
| 1028 | static struct sensor_device_attribute_2 sda_single_files[] = { | 1029 | static struct sensor_device_attribute_2 sda_single_files[] = { |
| 1029 | SENSOR_ATTR_2(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm, | ||
| 1030 | NOT_USED, NOT_USED), | ||
| 1031 | SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, | 1030 | SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, |
| 1032 | store_chassis_clear, ALARM_STATUS, 30), | 1031 | store_chassis_clear, ALARM_STATUS, 30), |
| 1033 | SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, | 1032 | SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, |
| @@ -1080,6 +1079,7 @@ static int w83793_detach_client(struct i2c_client *client) | |||
| 1080 | 1079 | ||
| 1081 | for (i = 0; i < ARRAY_SIZE(w83793_vid); i++) | 1080 | for (i = 0; i < ARRAY_SIZE(w83793_vid); i++) |
| 1082 | device_remove_file(dev, &w83793_vid[i].dev_attr); | 1081 | device_remove_file(dev, &w83793_vid[i].dev_attr); |
| 1082 | device_remove_file(dev, &dev_attr_vrm); | ||
| 1083 | 1083 | ||
| 1084 | for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++) | 1084 | for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++) |
| 1085 | device_remove_file(dev, &w83793_left_fan[i].dev_attr); | 1085 | device_remove_file(dev, &w83793_left_fan[i].dev_attr); |
| @@ -1282,7 +1282,6 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1282 | /* Initialize the chip */ | 1282 | /* Initialize the chip */ |
| 1283 | w83793_init_client(client); | 1283 | w83793_init_client(client); |
| 1284 | 1284 | ||
| 1285 | data->vrm = vid_which_vrm(); | ||
| 1286 | /* | 1285 | /* |
| 1287 | Only fan 1-5 has their own input pins, | 1286 | Only fan 1-5 has their own input pins, |
| 1288 | Pwm 1-3 has their own pins | 1287 | Pwm 1-3 has their own pins |
| @@ -1293,7 +1292,9 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1293 | val = w83793_read_value(client, W83793_REG_FANIN_CTRL); | 1292 | val = w83793_read_value(client, W83793_REG_FANIN_CTRL); |
| 1294 | 1293 | ||
| 1295 | /* check the function of pins 49-56 */ | 1294 | /* check the function of pins 49-56 */ |
| 1296 | if (!(tmp & 0x80)) { | 1295 | if (tmp & 0x80) { |
| 1296 | data->has_vid |= 0x2; /* has VIDB */ | ||
| 1297 | } else { | ||
| 1297 | data->has_pwm |= 0x18; /* pwm 4,5 */ | 1298 | data->has_pwm |= 0x18; /* pwm 4,5 */ |
| 1298 | if (val & 0x01) { /* fan 6 */ | 1299 | if (val & 0x01) { /* fan 6 */ |
| 1299 | data->has_fan |= 0x20; | 1300 | data->has_fan |= 0x20; |
| @@ -1309,13 +1310,15 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1309 | } | 1310 | } |
| 1310 | } | 1311 | } |
| 1311 | 1312 | ||
| 1313 | /* check the function of pins 37-40 */ | ||
| 1314 | if (!(tmp & 0x29)) | ||
| 1315 | data->has_vid |= 0x1; /* has VIDA */ | ||
| 1312 | if (0x08 == (tmp & 0x0c)) { | 1316 | if (0x08 == (tmp & 0x0c)) { |
| 1313 | if (val & 0x08) /* fan 9 */ | 1317 | if (val & 0x08) /* fan 9 */ |
| 1314 | data->has_fan |= 0x100; | 1318 | data->has_fan |= 0x100; |
| 1315 | if (val & 0x10) /* fan 10 */ | 1319 | if (val & 0x10) /* fan 10 */ |
| 1316 | data->has_fan |= 0x200; | 1320 | data->has_fan |= 0x200; |
| 1317 | } | 1321 | } |
| 1318 | |||
| 1319 | if (0x20 == (tmp & 0x30)) { | 1322 | if (0x20 == (tmp & 0x30)) { |
| 1320 | if (val & 0x20) /* fan 11 */ | 1323 | if (val & 0x20) /* fan 11 */ |
| 1321 | data->has_fan |= 0x400; | 1324 | data->has_fan |= 0x400; |
| @@ -1359,13 +1362,6 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1359 | if (tmp & 0x02) | 1362 | if (tmp & 0x02) |
| 1360 | data->has_temp |= 0x20; | 1363 | data->has_temp |= 0x20; |
| 1361 | 1364 | ||
| 1362 | /* Detect the VID usage and ignore unused input */ | ||
| 1363 | tmp = w83793_read_value(client, W83793_REG_MFC); | ||
| 1364 | if (!(tmp & 0x29)) | ||
| 1365 | data->has_vid |= 0x1; /* has VIDA */ | ||
| 1366 | if (tmp & 0x80) | ||
| 1367 | data->has_vid |= 0x2; /* has VIDB */ | ||
| 1368 | |||
| 1369 | /* Register sysfs hooks */ | 1365 | /* Register sysfs hooks */ |
| 1370 | for (i = 0; i < ARRAY_SIZE(w83793_sensor_attr_2); i++) { | 1366 | for (i = 0; i < ARRAY_SIZE(w83793_sensor_attr_2); i++) { |
| 1371 | err = device_create_file(dev, | 1367 | err = device_create_file(dev, |
| @@ -1381,6 +1377,12 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1381 | if (err) | 1377 | if (err) |
| 1382 | goto exit_remove; | 1378 | goto exit_remove; |
| 1383 | } | 1379 | } |
| 1380 | if (data->has_vid) { | ||
| 1381 | data->vrm = vid_which_vrm(); | ||
| 1382 | err = device_create_file(dev, &dev_attr_vrm); | ||
| 1383 | if (err) | ||
| 1384 | goto exit_remove; | ||
| 1385 | } | ||
| 1384 | 1386 | ||
| 1385 | for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { | 1387 | for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { |
| 1386 | err = device_create_file(dev, &sda_single_files[i].dev_attr); | 1388 | err = device_create_file(dev, &sda_single_files[i].dev_attr); |
