]> git.sur5r.net Git - groeck-it87/commitdiff
Fix up fan / pwm detection for IT8625/IT8665
authorGuenter Roeck <linux@roeck-us.net>
Fri, 19 Jan 2018 20:30:24 +0000 (12:30 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 19 Jan 2018 21:31:01 +0000 (13:31 -0800)
Hope it is correct this time around.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
it87.c

diff --git a/it87.c b/it87.c
index 6a30e99ad72bb56ae6d673cfb5a625e738691d80..d82bd5fcbc2b8f94c62d36f269d369ea6ad3b871 100644 (file)
--- a/it87.c
+++ b/it87.c
@@ -3440,15 +3440,9 @@ static int __init it87_find(int sioaddr, unsigned short *address,
                reg2d = superio_inb(sioaddr, IT87_SIO_PINX4_REG);
                regd3 = superio_inb(sioaddr, IT87_SIO_GPIO9_REG);
 
-               /* Check for pwm2, fan2 */
+               /* Check for pwm2 */
                if (reg29 & BIT(1))
                        sio_data->skip_pwm |= BIT(1);
-               /*
-                * Note: Table 6-1 in datasheet claims that FAN_TAC2
-                * would be enabled with 29h[2]=0.
-                */
-               if (reg2d & BIT(4))
-                       sio_data->skip_fan |= BIT(1);
 
                /* Check for pwm3, fan3 */
                if (reg27 & BIT(6))
@@ -3456,28 +3450,38 @@ static int __init it87_find(int sioaddr, unsigned short *address,
                if (reg27 & BIT(7))
                        sio_data->skip_fan |= BIT(2);
 
-               /* Check for pwm4, fan4, pwm5, fan5 */
+               /* Check for fan2, pwm4, fan4, pwm5, fan5 */
                if (sio_data->type == it8625) {
                        int reg25 = superio_inb(sioaddr, IT87_SIO_GPIO1_REG);
 
+                       if (reg29 & BIT(2))
+                               sio_data->skip_fan |= BIT(1);
                        if (reg25 & BIT(6))
                                sio_data->skip_fan |= BIT(3);
                        if (reg25 & BIT(5))
                                sio_data->skip_pwm |= BIT(3);
                        if (reg27 & BIT(3))
                                sio_data->skip_pwm |= BIT(4);
-                       if (reg27 & BIT(1))
+                       if (!(reg27 & BIT(1)))
                                sio_data->skip_fan |= BIT(4);
                } else {
                        int reg26 = superio_inb(sioaddr, IT87_SIO_GPIO2_REG);
 
+                       if (reg2d & BIT(4))
+                               sio_data->skip_fan |= BIT(1);
                        if (regd3 & BIT(2))
                                sio_data->skip_pwm |= BIT(3);
                        if (regd3 & BIT(3))
                                sio_data->skip_fan |= BIT(3);
                        if (reg26 & BIT(5))
                                sio_data->skip_pwm |= BIT(4);
-                       if (reg26 & BIT(4))
+                       /*
+                        * Table 6-1 in datasheet claims that FAN_TAC5 would
+                        * be enabled with 26h[4]=0. This contradicts with the
+                        * information in section 8.3.9 and with feedback from
+                        * users.
+                        */
+                       if (!(reg26 & BIT(4)))
                                sio_data->skip_fan |= BIT(4);
                }