diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-09 19:53:11 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-09 19:53:11 -0800 |
commit | f71eaf68406cfee91b6a96bcdf7ce33dc78829c5 (patch) | |
tree | 92a1663ae15d521f25849d28ebb4dfad10567892 /drivers/hwmon/it87.c | |
parent | 78f1ae193d1662c22cfebb916e788e1ca896c0fe (diff) | |
parent | 54fe4671aa5853ca88da72d67e969a3d8de6dcf6 (diff) |
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: (41 commits)
hwmon: (adt7475) Add VID support for the ADT7476
hwmon: (adt7475) Add an entry in MAINTAINERS
hwmon: (adt7475) Add support for the ADT7476
hwmon: (adt7475) Voltage attenuators can be bypassed
hwmon: (adt7475) Print device information on probe
hwmon: (adt7475) Handle alternative pin functions
hwmon: (adt7475) Move sysfs files removal to a separate function
hwmon: (adt7475) Add support for the ADT7490
hwmon: (adt7475) Improve device detection
hwmon: (adt7475) Add missing static marker
hwmon: (adt7475) Rework voltage inputs handling
hwmon: (adt7475) Implement pwm_use_point2_pwm_at_crit
hwmon: (adt7475) New documentation
hwmon: (adt7475) Add support for the ADT7473
hwmon: (f71882fg) Add support for the f71889fg (version 2)
hwmon: (f71882fg) Fix sysfs file removal
hwmon: (f71882fg) Cleanup sysfs attr creation 2/2
hwmon: (f71882fg) Cleanup sysfs attr creation 1/2
hwmon: (thmc50) Stop using I2C_CLIENT_MODULE_PARM
hwmon: Add Freescale MC13783 ADC driver
...
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 a3749cb0f18..0ffe84d190b 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++) { |