diff options
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r-- | drivers/hwmon/it87.c | 47 |
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) #define IT87_BASE_REG 0x60 /* Logical device 7 registers (IT8712F and later) */ +#define IT87_SIO_GPIO3_REG 0x27 +#define IT87_SIO_GPIO5_REG 0x29 #define IT87_SIO_PINX2_REG 0x2c /* Pin selection */ #define IT87_SIO_VID_REG 0xfc /* VID value */ @@ -244,7 +246,9 @@ struct it87_sio_data { /* Values read from Super-I/O config space */ u8 revision; u8 vid_value; - /* Values set based on DMI strings */ + /* Features skipped based on config or DMI */ + u8 skip_vid; + u8 skip_fan; u8 skip_pwm; }; @@ -1028,11 +1032,35 @@ static int __init it87_find(unsigned short *address, chip_type, *address, sio_data->revision); /* Read GPIO config and VID value from LDN 7 (GPIO) */ - if (sio_data->type != it87) { + if (sio_data->type == it87) { + /* The IT8705F doesn't have VID pins at all */ + sio_data->skip_vid = 1; + } else { int reg; superio_select(GPIO); - if (sio_data->type == it8718 || sio_data->type == it8720) + /* We need at least 4 VID pins */ + reg = superio_inb(IT87_SIO_GPIO3_REG); + if (reg & 0x0f) { + pr_info("it87: VID is disabled (pins used for GPIO)\n"); + sio_data->skip_vid = 1; + } + + /* Check if fan3 is there or not */ + if (reg & (1 << 6)) + sio_data->skip_pwm |= (1 << 2); + if (reg & (1 << 7)) + sio_data->skip_fan |= (1 << 2); + + /* Check if fan2 is there or not */ + reg = superio_inb(IT87_SIO_GPIO5_REG); + if (reg & (1 << 1)) + sio_data->skip_pwm |= (1 << 1); + if (reg & (1 << 2)) + sio_data->skip_fan |= (1 << 1); + + if ((sio_data->type == it8718 || sio_data->type == it8720) + && !(sio_data->skip_vid)) sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); reg = superio_inb(IT87_SIO_PINX2_REG); @@ -1236,8 +1264,7 @@ static int __devinit it87_probe(struct platform_device *pdev) } } - if (data->type == it8712 || data->type == it8716 - || data->type == it8718 || data->type == it8720) { + if (!sio_data->skip_vid) { data->vrm = vid_which_vrm(); /* VID reading from Super-I/O config space if available */ data->vid = sio_data->vid_value; @@ -1355,8 +1382,10 @@ static int __devinit it87_check_pwm(struct device *dev) /* Called when we have found a new IT87. */ static void __devinit it87_init_device(struct platform_device *pdev) { + struct it87_sio_data *sio_data = pdev->dev.platform_data; struct it87_data *data = platform_get_drvdata(pdev); int tmp, i; + u8 mask; /* initialize to sane defaults: * - 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) } /* Check if tachometers are reset manually or by some reason */ + mask = 0x70 & ~(sio_data->skip_fan << 4); data->fan_main_ctrl = it87_read_value(data, IT87_REG_FAN_MAIN_CTRL); - if ((data->fan_main_ctrl & 0x70) == 0) { + if ((data->fan_main_ctrl & mask) == 0) { /* Enable all fan tachometers */ - data->fan_main_ctrl |= 0x70; + data->fan_main_ctrl |= mask; it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, data->fan_main_ctrl); } data->has_fan = (data->fan_main_ctrl >> 4) & 0x07; @@ -1428,6 +1458,9 @@ static void __devinit it87_init_device(struct platform_device *pdev) } } + /* Fan input pins may be used for alternative functions */ + data->has_fan &= ~sio_data->skip_fan; + /* Set current fan mode registers and the default settings for the * other mode registers */ for (i = 0; i < 3; i++) { |