hwmon: (w83627ehf) Fix number of fans for NCT6776F
Guenter Roeck
maintainerPATCH v2 1/1 hwmon: (w83627ehf) Fix number of fans for NCT6776F
NCT6776F can select fan input pins for fans 3 to 5 with a secondary set of chip register bits. Check that second set of bits in addition to the first set to detect if fans 3..5 are monitored.
---
v2: GPIO pins 90..92 have higher priority than pin 3..5, so check for those first.
Added some blank lines to improve readability
CC, can you test this version ? It is in the "testing" branch of the github repository.
drivers/hwmon/w83627ehf.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
drivers/hwmon/w83627ehf.c +20 -3
@@ -1931,9 +1931,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, fan4min =0 ; fan5pin =0 ; }else if (sio_data->kind = nct6776) { - fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); - fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); - fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); +bool gpok =superio_inb (sio_data->sioreg,0x27 ) &0x80 ; + +superio_select (sio_data->sioreg,W83627EHF_LD_HWM ); + regval =superio_inb (sio_data->sioreg,SIO_REG_ENABLE ); + +if (regval &0x80 ) + fan3pin = gpok; +else + fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); + +if (regval &0x40 ) + fan4pin = gpok; +else + fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); + +if (regval &0x20 ) + fan5pin = gpok; +else + fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); + fan4min = fan4pin; }else if (sio_data->kind = w83667hg || sio_data->kind = w83667hg_b) { fan3pin =1 ;
Signature · 7 lines
1.7.5.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 40 lines · Guenter Roeck
NCT6776F can select fan input pins for fans 3 to 5 with a secondary set of chip register bits. Check that second set of bits in addition to the first set to detect if fans 3..5 are monitored.
Reported-by C. Comren <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: GPIO pins 90..92 have higher priority than pin 3..5, so check for those first.
Added some blank lines to improve readabilityCC, can you test this version ? It is in the "testing" branch of the github repository.
drivers/hwmon/w83627ehf.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)drivers/hwmon/w83627ehf.c +13
-3@@ -1931,9 +1931,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, fan4min =0 ; fan5pin =0 ; }else if (sio_data->kind = nct6776) { - fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); - fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); - fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); +bool gpok =superio_inb (sio_data->sioreg,0x27 ) &0x80 ; + +superio_select (sio_data->sioreg,W83627EHF_LD_HWM ); + regval =superio_inb (sio_data->sioreg,SIO_REG_ENABLE ); + +if (regval &0x80 ) + fan3pin = gpok; +else + fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); + +if (regval &0x40 ) + fan4pin = gpok; +else
drivers/hwmon/w83627ehf.c w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, · line 1956
Quoted 10 lines
drivers/hwmon/w83627ehf.c +7
-0+ fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); + +if (regval &0x20 ) + fan5pin = gpok; +else + fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); + fan4min = fan4pin; }else if (sio_data->kind = w83667hg || sio_data->kind = w83667hg_b) { fan3pin =1 ;
Looks OK.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 54 lines · Jean Delvare
Quoted 40 lines · Guenter Roeck
NCT6776F can select fan input pins for fans 3 to 5 with a secondary set of chip register bits. Check that second set of bits in addition to the first set to detect if fans 3..5 are monitored.
Reported-by C. Comren <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
v2: GPIO pins 90..92 have higher priority than pin 3..5, so check for those first.
Added some blank lines to improve readabilityCC, can you test this version ? It is in the "testing" branch of the github repository.
drivers/hwmon/w83627ehf.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)drivers/hwmon/w83627ehf.c +13
-3@@ -1931,9 +1931,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, fan4min =0 ; fan5pin =0 ; }else if (sio_data->kind = nct6776) { - fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); - fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); - fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); +bool gpok =superio_inb (sio_data->sioreg,0x27 ) &0x80 ; + +superio_select (sio_data->sioreg,W83627EHF_LD_HWM ); + regval =superio_inb (sio_data->sioreg,SIO_REG_ENABLE ); + +if (regval &0x80 ) + fan3pin = gpok; +else + fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); + +if (regval &0x40 ) + fan4pin = gpok; +else drivers/hwmon/w83627ehf.c w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, · line 1956
Quoted 10 lines
drivers/hwmon/w83627ehf.c +7
-0+ fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); + +if (regval &0x20 ) + fan5pin = gpok; +else + fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); + fan4min = fan4pin; }else if (sio_data->kind = w83667hg || sio_data->kind = w83667hg_b) { fan3pin =1 ;Looks OK.
Quoted 2 lines
Acked-by Jean Delvare <[email protected]>
Thanks. I've applied it to my tree. Hopefully we can get some test coverage before I send it off to Linus.
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors