diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 22:15:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 22:15:38 -0500 |
commit | d7511ec8115487ccea2ce93bf58d5e5cd2c1c0a3 (patch) | |
tree | e428f9438a563f1fa77479e9c9c4ef8b2e451a8b /drivers/hwmon/dme1737.c | |
parent | 0b61a2ba5dfd1620731e717d686e6ade657fd975 (diff) | |
parent | e84542f5db655d1ce7b4890832f0e5d19aae965d (diff) |
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6: (59 commits)
hwmon: (lm80) Add individual alarm files
hwmon: (lm80) De-macro the sysfs callbacks
hwmon: (lm80) Various cleanups
hwmon: (w83627hf) Refactor beep enable handling
hwmon: (w83627hf) Add individual alarm and beep files
hwmon: (w83627hf) Enable VBAT monitoring
hwmon: (w83627ehf) The W83627DHG has 8 VID pins
hwmon: (asb100) Add individual alarm files
hwmon: (asb100) De-macro the sysfs callbacks
hwmon: (asb100) Various cleanups
hwmon: VRM is not written to registers
hwmon: (dme1737) fix Super-IO device ID override
hwmon: (dme1737) fix divide-by-0
hwmon: (abituguru3) Add AUX4 fan input for Abit IP35 Pro
hwmon: Add support for Texas Instruments/Burr-Brown ADS7828
hwmon: (adm9240) Add individual alarm files
hwmon: (lm77) Add individual alarm files
hwmon: Discard useless I2C driver IDs
hwmon: (lm85) Make the pwmN_enable files writable
hwmon: (lm85) Return standard values in pwmN_enable
...
Diffstat (limited to 'drivers/hwmon/dme1737.c')
-rw-r--r-- | drivers/hwmon/dme1737.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index a878c98e252e..ddddd9f34c19 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -44,6 +44,10 @@ static int force_start; | |||
44 | module_param(force_start, bool, 0); | 44 | module_param(force_start, bool, 0); |
45 | MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs"); | 45 | MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs"); |
46 | 46 | ||
47 | static unsigned short force_id; | ||
48 | module_param(force_id, ushort, 0); | ||
49 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | ||
50 | |||
47 | /* Addresses to scan */ | 51 | /* Addresses to scan */ |
48 | static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; | 52 | static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; |
49 | 53 | ||
@@ -279,14 +283,21 @@ static inline int TEMP_HYST_TO_REG(int val, int ix, int reg) | |||
279 | /* Fan input RPM */ | 283 | /* Fan input RPM */ |
280 | static inline int FAN_FROM_REG(int reg, int tpc) | 284 | static inline int FAN_FROM_REG(int reg, int tpc) |
281 | { | 285 | { |
282 | return (reg == 0 || reg == 0xffff) ? 0 : | 286 | if (tpc) { |
283 | (tpc == 0) ? 90000 * 60 / reg : tpc * reg; | 287 | return tpc * reg; |
288 | } else { | ||
289 | return (reg == 0 || reg == 0xffff) ? 0 : 90000 * 60 / reg; | ||
290 | } | ||
284 | } | 291 | } |
285 | 292 | ||
286 | static inline int FAN_TO_REG(int val, int tpc) | 293 | static inline int FAN_TO_REG(int val, int tpc) |
287 | { | 294 | { |
288 | return SENSORS_LIMIT((tpc == 0) ? 90000 * 60 / val : val / tpc, | 295 | if (tpc) { |
289 | 0, 0xffff); | 296 | return SENSORS_LIMIT(val / tpc, 0, 0xffff); |
297 | } else { | ||
298 | return (val <= 0) ? 0xffff : | ||
299 | SENSORS_LIMIT(90000 * 60 / val, 0, 0xfffe); | ||
300 | } | ||
290 | } | 301 | } |
291 | 302 | ||
292 | /* Fan TPC (tach pulse count) | 303 | /* Fan TPC (tach pulse count) |
@@ -2019,7 +2030,7 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data) | |||
2019 | 2030 | ||
2020 | /* Check device ID | 2031 | /* Check device ID |
2021 | * The DME1737 can return either 0x78 or 0x77 as its device ID. */ | 2032 | * The DME1737 can return either 0x78 or 0x77 as its device ID. */ |
2022 | reg = dme1737_sio_inb(sio_cip, 0x20); | 2033 | reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20); |
2023 | if (!(reg == 0x77 || reg == 0x78)) { | 2034 | if (!(reg == 0x77 || reg == 0x78)) { |
2024 | err = -ENODEV; | 2035 | err = -ENODEV; |
2025 | goto exit; | 2036 | goto exit; |
@@ -2191,7 +2202,7 @@ static int __init dme1737_isa_detect(int sio_cip, unsigned short *addr) | |||
2191 | /* Check device ID | 2202 | /* Check device ID |
2192 | * We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and | 2203 | * We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and |
2193 | * SCH3116 (0x7f). */ | 2204 | * SCH3116 (0x7f). */ |
2194 | reg = dme1737_sio_inb(sio_cip, 0x20); | 2205 | reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20); |
2195 | if (!(reg == 0x7c || reg == 0x7d || reg == 0x7f)) { | 2206 | if (!(reg == 0x7c || reg == 0x7d || reg == 0x7f)) { |
2196 | err = -ENODEV; | 2207 | err = -ENODEV; |
2197 | goto exit; | 2208 | goto exit; |