diff options
author | Ian Dobson <i.dobson@planet-ian.com> | 2011-03-07 17:21:12 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-03-15 01:39:19 -0400 |
commit | d42e869acf0da4502c452b786dee35f0ecf4cbc8 (patch) | |
tree | e737f36e9328d1ce776176bfb643eebdf1fefc3d /drivers | |
parent | 2dd59c26e9336db676956589320f1bc71dc1b2e7 (diff) |
hwmon: (w83627ehf) Add fan debounce support for NCT6775F and NCT6776F
NCT6776F and NCT6775F support debouncing the fan RPM signal. This can
help improve the stability of th RPM signal for some fans (Arctic cooling
fans for example).
This patch adds a module parameter fan_debounce, which when set to 1 enables
debounce for all fans that the chip supports.
Signed-off-by: Ian Dobson <i.dobson@planet-ian.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 460292bad74a..d18031944960 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -79,6 +79,10 @@ static unsigned short force_id; | |||
79 | module_param(force_id, ushort, 0); | 79 | module_param(force_id, ushort, 0); |
80 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 80 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
81 | 81 | ||
82 | static unsigned short fan_debounce; | ||
83 | module_param(fan_debounce, ushort, 0); | ||
84 | MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); | ||
85 | |||
82 | #define DRVNAME "w83627ehf" | 86 | #define DRVNAME "w83627ehf" |
83 | 87 | ||
84 | /* | 88 | /* |
@@ -187,6 +191,7 @@ static const u16 W83627EHF_REG_TEMP_CONFIG[] = { 0, 0x152, 0x252, 0 }; | |||
187 | /* NCT6775F has its own fan divider registers */ | 191 | /* NCT6775F has its own fan divider registers */ |
188 | #define NCT6775_REG_FANDIV1 0x506 | 192 | #define NCT6775_REG_FANDIV1 0x506 |
189 | #define NCT6775_REG_FANDIV2 0x507 | 193 | #define NCT6775_REG_FANDIV2 0x507 |
194 | #define NCT6775_REG_FAN_DEBOUNCE 0xf0 | ||
190 | 195 | ||
191 | #define W83627EHF_REG_ALARM1 0x459 | 196 | #define W83627EHF_REG_ALARM1 0x459 |
192 | #define W83627EHF_REG_ALARM2 0x45A | 197 | #define W83627EHF_REG_ALARM2 0x45A |
@@ -2089,6 +2094,22 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2089 | fan5pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x02); | 2094 | fan5pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x02); |
2090 | fan4min = fan4pin; | 2095 | fan4min = fan4pin; |
2091 | } | 2096 | } |
2097 | |||
2098 | if (fan_debounce && | ||
2099 | (sio_data->kind == nct6775 || sio_data->kind == nct6776)) { | ||
2100 | u8 tmp; | ||
2101 | |||
2102 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); | ||
2103 | tmp = superio_inb(sio_data->sioreg, NCT6775_REG_FAN_DEBOUNCE); | ||
2104 | if (sio_data->kind == nct6776) | ||
2105 | superio_outb(sio_data->sioreg, NCT6775_REG_FAN_DEBOUNCE, | ||
2106 | 0x3e | tmp); | ||
2107 | else | ||
2108 | superio_outb(sio_data->sioreg, NCT6775_REG_FAN_DEBOUNCE, | ||
2109 | 0x1e | tmp); | ||
2110 | pr_info("Enabled fan debounce for chip %s\n", data->name); | ||
2111 | } | ||
2112 | |||
2092 | superio_exit(sio_data->sioreg); | 2113 | superio_exit(sio_data->sioreg); |
2093 | 2114 | ||
2094 | /* It looks like fan4 and fan5 pins can be alternatively used | 2115 | /* It looks like fan4 and fan5 pins can be alternatively used |