diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-12-04 10:59:32 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-04-08 00:16:39 -0400 |
commit | 47ece9645f288d46420d64dab90a182bde87bbbb (patch) | |
tree | c4ec1d52e69f894abafb785327a2f72bf23ed938 /drivers/hwmon | |
parent | 5c25d954d37b7c18606d7ef99122424552b86ef2 (diff) |
hwmon: (nct6775) Add support for fan debounce module parameter
If set, fan debounce is enabled when loading the driver.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/nct6775.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index fea6ed7a0044..ffb56bb8c27d 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -72,6 +72,10 @@ static unsigned short force_id; | |||
72 | module_param(force_id, ushort, 0); | 72 | module_param(force_id, ushort, 0); |
73 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 73 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
74 | 74 | ||
75 | static unsigned short fan_debounce; | ||
76 | module_param(fan_debounce, ushort, 0); | ||
77 | MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); | ||
78 | |||
75 | #define DRVNAME "nct6775" | 79 | #define DRVNAME "nct6775" |
76 | 80 | ||
77 | /* | 81 | /* |
@@ -183,6 +187,8 @@ static const u16 NCT6775_REG_IN[] = { | |||
183 | #define NCT6775_REG_FANDIV1 0x506 | 187 | #define NCT6775_REG_FANDIV1 0x506 |
184 | #define NCT6775_REG_FANDIV2 0x507 | 188 | #define NCT6775_REG_FANDIV2 0x507 |
185 | 189 | ||
190 | #define NCT6775_REG_CR_FAN_DEBOUNCE 0xf0 | ||
191 | |||
186 | static const u16 NCT6775_REG_ALARM[NUM_REG_ALARM] = { 0x459, 0x45A, 0x45B }; | 192 | static const u16 NCT6775_REG_ALARM[NUM_REG_ALARM] = { 0x459, 0x45A, 0x45B }; |
187 | 193 | ||
188 | /* 0..15 voltages, 16..23 fans, 24..31 temperatures */ | 194 | /* 0..15 voltages, 16..23 fans, 24..31 temperatures */ |
@@ -2110,6 +2116,28 @@ static int nct6775_probe(struct platform_device *pdev) | |||
2110 | */ | 2116 | */ |
2111 | superio_select(sio_data->sioreg, NCT6775_LD_VID); | 2117 | superio_select(sio_data->sioreg, NCT6775_LD_VID); |
2112 | data->vid = superio_inb(sio_data->sioreg, 0xe3); | 2118 | data->vid = superio_inb(sio_data->sioreg, 0xe3); |
2119 | |||
2120 | if (fan_debounce) { | ||
2121 | u8 tmp; | ||
2122 | |||
2123 | superio_select(sio_data->sioreg, NCT6775_LD_HWM); | ||
2124 | tmp = superio_inb(sio_data->sioreg, | ||
2125 | NCT6775_REG_CR_FAN_DEBOUNCE); | ||
2126 | switch (data->kind) { | ||
2127 | case nct6775: | ||
2128 | tmp |= 0x1e; | ||
2129 | break; | ||
2130 | case nct6776: | ||
2131 | case nct6779: | ||
2132 | tmp |= 0x3e; | ||
2133 | break; | ||
2134 | } | ||
2135 | superio_outb(sio_data->sioreg, NCT6775_REG_CR_FAN_DEBOUNCE, | ||
2136 | tmp); | ||
2137 | dev_info(&pdev->dev, "Enabled fan debounce for chip %s\n", | ||
2138 | data->name); | ||
2139 | } | ||
2140 | |||
2113 | superio_exit(sio_data->sioreg); | 2141 | superio_exit(sio_data->sioreg); |
2114 | 2142 | ||
2115 | err = device_create_file(dev, &dev_attr_cpu0_vid); | 2143 | err = device_create_file(dev, &dev_attr_cpu0_vid); |