* [lm-sensors] [PATCH] max6639.c: Set reasonable default PWM frequency
@ 2011-01-29 16:04 stigge
2011-01-30 0:19 ` [lm-sensors] [PATCH] max6639.c: Set reasonable default PWM Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: stigge @ 2011-01-29 16:04 UTC (permalink / raw)
To: lm-sensors
max6639.c: 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>
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
index 40fd878..f20d997 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 };
#define MAX6639_GCONFIG_POR 0x40
#define MAX6639_GCONFIG_DISABLE_TIMEOUT 0x20
#define MAX6639_GCONFIG_CH2_LOCAL 0x10
+#define MAX6639_GCONFIG_PWM_FREQ_HI 0x08
#define MAX6639_FAN_CONFIG1_PWM 0x80
+#define MAX6639_FAN_CONFIG3_THERM_FULL_SPEED 0x40
+
static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };
#define FAN_FROM_REG(val, div, rpm_range) ((val) = 0 ? -1 : \
@@ -430,7 +433,7 @@ static int max6639_init_client(struct i2c_client *client)
int rpm_range = 1; /* default: 4000 RPM */
int err = 0;
- /* Reset chip to default values */
+ /* Reset chip to default values, see below for GCONFIG setup */
err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG,
MAX6639_GCONFIG_POR);
if (err)
@@ -472,6 +475,16 @@ static int max6639_init_client(struct i2c_client *client)
if (err)
goto exit;
+ /*
+ * /THERM full speed enable,
+ * PWM frequency 25kHz, see also GCONFIG below
+ */
+ err = i2c_smbus_write_byte_data(client,
+ MAX6639_REG_FAN_CONFIG3(i),
+ MAX6639_FAN_CONFIG3_THERM_FULL_SPEED | 0x03);
+ if (err)
+ goto exit;
+
/* Max. temp. 80C/90C/100C */
data->temp_therm[i] = 80;
data->temp_alert[i] = 90;
@@ -500,7 +513,8 @@ static int max6639_init_client(struct i2c_client *client)
}
/* Start monitoring */
err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG,
- MAX6639_GCONFIG_DISABLE_TIMEOUT | MAX6639_GCONFIG_CH2_LOCAL);
+ MAX6639_GCONFIG_DISABLE_TIMEOUT | MAX6639_GCONFIG_CH2_LOCAL |
+ MAX6639_GCONFIG_PWM_FREQ_HI);
exit:
return err;
}
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [lm-sensors] [PATCH] max6639.c: Set reasonable default PWM
2011-01-29 16:04 [lm-sensors] [PATCH] max6639.c: Set reasonable default PWM frequency stigge
@ 2011-01-30 0:19 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2011-01-30 0:19 UTC (permalink / raw)
To: lm-sensors
On Sat, Jan 29, 2011 at 11:04:01AM -0500, stigge@antcom.de wrote:
> max6639.c: 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>
>
Applied.
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-30 0:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-29 16:04 [lm-sensors] [PATCH] max6639.c: Set reasonable default PWM frequency stigge
2011-01-30 0:19 ` [lm-sensors] [PATCH] max6639.c: Set reasonable default PWM Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.