aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r--drivers/hwmon/it87.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index a3749cb0f181..0ffe84d190bb 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -124,6 +124,8 @@ superio_exit(void)
124#define IT87_BASE_REG 0x60 124#define IT87_BASE_REG 0x60
125 125
126/* Logical device 7 registers (IT8712F and later) */ 126/* Logical device 7 registers (IT8712F and later) */
127#define IT87_SIO_GPIO3_REG 0x27
128#define IT87_SIO_GPIO5_REG 0x29
127#define IT87_SIO_PINX2_REG 0x2c /* Pin selection */ 129#define IT87_SIO_PINX2_REG 0x2c /* Pin selection */
128#define IT87_SIO_VID_REG 0xfc /* VID value */ 130#define IT87_SIO_VID_REG 0xfc /* VID value */
129 131
@@ -244,7 +246,9 @@ struct it87_sio_data {
244 /* Values read from Super-I/O config space */ 246 /* Values read from Super-I/O config space */
245 u8 revision; 247 u8 revision;
246 u8 vid_value; 248 u8 vid_value;
247 /* Values set based on DMI strings */ 249 /* Features skipped based on config or DMI */
250 u8 skip_vid;
251 u8 skip_fan;
248 u8 skip_pwm; 252 u8 skip_pwm;
249}; 253};
250 254
@@ -1028,11 +1032,35 @@ static int __init it87_find(unsigned short *address,
1028 chip_type, *address, sio_data->revision); 1032 chip_type, *address, sio_data->revision);
1029 1033
1030 /* Read GPIO config and VID value from LDN 7 (GPIO) */ 1034 /* Read GPIO config and VID value from LDN 7 (GPIO) */
1031 if (sio_data->type != it87) { 1035 if (sio_data->type == it87) {
1036 /* The IT8705F doesn't have VID pins at all */
1037 sio_data->skip_vid = 1;
1038 } else {
1032 int reg; 1039 int reg;
1033 1040
1034 superio_select(GPIO); 1041 superio_select(GPIO);
1035 if (sio_data->type == it8718 || sio_data->type == it8720) 1042 /* We need at least 4 VID pins */
1043 reg = superio_inb(IT87_SIO_GPIO3_REG);
1044 if (reg & 0x0f) {
1045 pr_info("it87: VID is disabled (pins used for GPIO)\n");
1046 sio_data->skip_vid = 1;
1047 }
1048
1049 /* Check if fan3 is there or not */
1050 if (reg & (1 << 6))
1051 sio_data->skip_pwm |= (1 << 2);
1052 if (reg & (1 << 7))
1053 sio_data->skip_fan |= (1 << 2);
1054
1055 /* Check if fan2 is there or not */
1056 reg = superio_inb(IT87_SIO_GPIO5_REG);
1057 if (reg & (1 << 1))
1058 sio_data->skip_pwm |= (1 << 1);
1059 if (reg & (1 << 2))
1060 sio_data->skip_fan |= (1 << 1);
1061
1062 if ((sio_data->type == it8718 || sio_data->type == it8720)
1063 && !(sio_data->skip_vid))
1036 sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); 1064 sio_data->vid_value = superio_inb(IT87_SIO_VID_REG);
1037 1065
1038 reg = superio_inb(IT87_SIO_PINX2_REG); 1066 reg = superio_inb(IT87_SIO_PINX2_REG);
@@ -1236,8 +1264,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
1236 } 1264 }
1237 } 1265 }
1238 1266
1239 if (data->type == it8712 || data->type == it8716 1267 if (!sio_data->skip_vid) {
1240 || data->type == it8718 || data->type == it8720) {
1241 data->vrm = vid_which_vrm(); 1268 data->vrm = vid_which_vrm();
1242 /* VID reading from Super-I/O config space if available */ 1269 /* VID reading from Super-I/O config space if available */
1243 data->vid = sio_data->vid_value; 1270 data->vid = sio_data->vid_value;
@@ -1355,8 +1382,10 @@ static int __devinit it87_check_pwm(struct device *dev)
1355/* Called when we have found a new IT87. */ 1382/* Called when we have found a new IT87. */
1356static void __devinit it87_init_device(struct platform_device *pdev) 1383static void __devinit it87_init_device(struct platform_device *pdev)
1357{ 1384{
1385 struct it87_sio_data *sio_data = pdev->dev.platform_data;
1358 struct it87_data *data = platform_get_drvdata(pdev); 1386 struct it87_data *data = platform_get_drvdata(pdev);
1359 int tmp, i; 1387 int tmp, i;
1388 u8 mask;
1360 1389
1361 /* initialize to sane defaults: 1390 /* initialize to sane defaults:
1362 * - if the chip is in manual pwm mode, this will be overwritten with 1391 * - if the chip is in manual pwm mode, this will be overwritten with
@@ -1402,10 +1431,11 @@ static void __devinit it87_init_device(struct platform_device *pdev)
1402 } 1431 }
1403 1432
1404 /* Check if tachometers are reset manually or by some reason */ 1433 /* Check if tachometers are reset manually or by some reason */
1434 mask = 0x70 & ~(sio_data->skip_fan << 4);
1405 data->fan_main_ctrl = it87_read_value(data, IT87_REG_FAN_MAIN_CTRL); 1435 data->fan_main_ctrl = it87_read_value(data, IT87_REG_FAN_MAIN_CTRL);
1406 if ((data->fan_main_ctrl & 0x70) == 0) { 1436 if ((data->fan_main_ctrl & mask) == 0) {
1407 /* Enable all fan tachometers */ 1437 /* Enable all fan tachometers */
1408 data->fan_main_ctrl |= 0x70; 1438 data->fan_main_ctrl |= mask;
1409 it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, data->fan_main_ctrl); 1439 it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, data->fan_main_ctrl);
1410 } 1440 }
1411 data->has_fan = (data->fan_main_ctrl >> 4) & 0x07; 1441 data->has_fan = (data->fan_main_ctrl >> 4) & 0x07;
@@ -1428,6 +1458,9 @@ static void __devinit it87_init_device(struct platform_device *pdev)
1428 } 1458 }
1429 } 1459 }
1430 1460
1461 /* Fan input pins may be used for alternative functions */
1462 data->has_fan &= ~sio_data->skip_fan;
1463
1431 /* Set current fan mode registers and the default settings for the 1464 /* Set current fan mode registers and the default settings for the
1432 * other mode registers */ 1465 * other mode registers */
1433 for (i = 0; i < 3; i++) { 1466 for (i = 0; i < 3; i++) {