diff options
author | stigge@antcom.de <stigge@antcom.de> | 2011-01-29 11:04:01 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-03-15 01:36:25 -0400 |
commit | 177f3b920cf6d1ab6d97f0978f866a8a711918e6 (patch) | |
tree | 6cd6aca172680d1627f8f1728f5a0d3e4c17e99b | |
parent | a5b79d62f2e6d1b0d44bcdafce46f47bf355b9fe (diff) |
hwmon: (max6639) Set reasonable default PWM frequency
This patch initializes register CONFIG3 to a reasonable default PWM frequency
of 25kHz, to prevent audible sound in fan.
Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
-rw-r--r-- | drivers/hwmon/max6639.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index 40fd878e53dc..f20d9978ee78 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c | |||
@@ -64,9 +64,12 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END }; | |||
64 | #define MAX6639_GCONFIG_POR 0x40 | 64 | #define MAX6639_GCONFIG_POR 0x40 |
65 | #define MAX6639_GCONFIG_DISABLE_TIMEOUT 0x20 | 65 | #define MAX6639_GCONFIG_DISABLE_TIMEOUT 0x20 |
66 | #define MAX6639_GCONFIG_CH2_LOCAL 0x10 | 66 | #define MAX6639_GCONFIG_CH2_LOCAL 0x10 |
67 | #define MAX6639_GCONFIG_PWM_FREQ_HI 0x08 | ||
67 | 68 | ||
68 | #define MAX6639_FAN_CONFIG1_PWM 0x80 | 69 | #define MAX6639_FAN_CONFIG1_PWM 0x80 |
69 | 70 | ||
71 | #define MAX6639_FAN_CONFIG3_THERM_FULL_SPEED 0x40 | ||
72 | |||
70 | static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 }; | 73 | static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 }; |
71 | 74 | ||
72 | #define FAN_FROM_REG(val, div, rpm_range) ((val) == 0 ? -1 : \ | 75 | #define FAN_FROM_REG(val, div, rpm_range) ((val) == 0 ? -1 : \ |
@@ -430,7 +433,7 @@ static int max6639_init_client(struct i2c_client *client) | |||
430 | int rpm_range = 1; /* default: 4000 RPM */ | 433 | int rpm_range = 1; /* default: 4000 RPM */ |
431 | int err = 0; | 434 | int err = 0; |
432 | 435 | ||
433 | /* Reset chip to default values */ | 436 | /* Reset chip to default values, see below for GCONFIG setup */ |
434 | err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, | 437 | err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, |
435 | MAX6639_GCONFIG_POR); | 438 | MAX6639_GCONFIG_POR); |
436 | if (err) | 439 | if (err) |
@@ -472,6 +475,16 @@ static int max6639_init_client(struct i2c_client *client) | |||
472 | if (err) | 475 | if (err) |
473 | goto exit; | 476 | goto exit; |
474 | 477 | ||
478 | /* | ||
479 | * /THERM full speed enable, | ||
480 | * PWM frequency 25kHz, see also GCONFIG below | ||
481 | */ | ||
482 | err = i2c_smbus_write_byte_data(client, | ||
483 | MAX6639_REG_FAN_CONFIG3(i), | ||
484 | MAX6639_FAN_CONFIG3_THERM_FULL_SPEED | 0x03); | ||
485 | if (err) | ||
486 | goto exit; | ||
487 | |||
475 | /* Max. temp. 80C/90C/100C */ | 488 | /* Max. temp. 80C/90C/100C */ |
476 | data->temp_therm[i] = 80; | 489 | data->temp_therm[i] = 80; |
477 | data->temp_alert[i] = 90; | 490 | data->temp_alert[i] = 90; |
@@ -500,7 +513,8 @@ static int max6639_init_client(struct i2c_client *client) | |||
500 | } | 513 | } |
501 | /* Start monitoring */ | 514 | /* Start monitoring */ |
502 | err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, | 515 | err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, |
503 | MAX6639_GCONFIG_DISABLE_TIMEOUT | MAX6639_GCONFIG_CH2_LOCAL); | 516 | MAX6639_GCONFIG_DISABLE_TIMEOUT | MAX6639_GCONFIG_CH2_LOCAL | |
517 | MAX6639_GCONFIG_PWM_FREQ_HI); | ||
504 | exit: | 518 | exit: |
505 | return err; | 519 | return err; |
506 | } | 520 | } |