From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] Add MAX6650 support
Date: Fri, 16 Mar 2007 19:17:17 +0000 [thread overview]
Message-ID: <20070316201717.db788a9f.khali@linux-fr.org> (raw)
In-Reply-To: <200701171359.46334.hjk@linutronix.de>
Hi Hans-J?rgen,
Thanks for the quick update.
On Fri, 16 Mar 2007 17:44:32 +0100, Hans-J?rgen Koch wrote:
> > I don't understand. For one thing, if you know how to turn the fan off,
> > then you could do it when fan1_target is set to 0, it's just a matter
> > of adding a few more lines of code. For another, fan1_target is related
> > to the closed loop mode (pwm1_enable=2) while the fan off mode would
> > generally be implemented as part of the open loop mode: pwm1_enable=1
> > and pwm1=0. But I see that you don't have a pwm1 file, so... How does
> > the open loop mode work at all?
>
> Open loop mode just sets the ouput voltage according to a DAC value (0..255).
> If someone needs a defined speed, he's supposed to do the regulator in
> software. It is not influenced by the speed register used in closed loop
> mode. I added a pwm1 file to read/write that DAC value. After doing that, I
> noticed the fan can be brought to full/zero speed by setting pwm1 to 0 or
> 255, respectively. That's OK for me.
> For pwm1_enable, I only use the well defined values now: 0=off, 1=open loop,
> 2=closed loop. If I find the chip in "full on" mode at load time, I change
> mode to open loop and set it to full speed. I hope this always works and
> won't set somebodies board on fire :-)
>
> BTW, meanwhile I'm a bit confused about what pwm1_enable=0 means. Is it "fan
> off" or "PWM off, fan full on"? At the moment, I implemented "fan off", but I
> can easily change that. The other way round would be slightly simpler.
pwm1_enable=0 means fan full on, so you'll have to update your code and
documentation a bit, sorry.
You should not need to change anything at module load time.
> /* fan_voltage: 5=5V fan, 12\x12V fan, 0=don't change */
> static int fan_voltage = 0;
> /* prescaler: Possible values are 1,2,4,8,16, or 0 for don't change */
> static int prescaler = 0;
The trick is to _not_ initialize these variables at all. The compiler
will put them in a special section and will zero them all at once
automatically.
> static int max6650_attach_adapter(struct i2c_adapter *adapter)
> {
> if (!(adapter->class & I2C_CLASS_HWMON)) {
> dev_err(&adapter->dev,
> "FATAL: max6650_attach_adapter class HWMON not set\n");
> return 0;
> }
>
> return i2c_probe(adapter, &addr_data, max6650_detect);
> }
Please make it a dev_dbg(). There are more than one I2C bus on most
systems, and usually only one with I2C_CLASS_HWMON set, on purpose. You
don't want to generate an error message in the logs for every other I2C
bus.
> if ((kind < 0)&&
> ( (i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG) & 0xC0)
> ||(i2c_smbus_read_byte_data(client, MAX6650_REG_GPIO_STAT) & 0xE0)
> ||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM_EN) & 0xE0)
> ||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM) & 0xE0)
> ||(i2c_smbus_read_byte_data(client, MAX6650_REG_COUNT) & 0xFC)))
> {
> dev_dbg(&adapter->dev,
> "max6650: detection failed at 0x%02x.\n", address);
> goto err_free;
> }
Opening curly brace is misplaced.
> static const u8 tach_reg[] > {
> MAX6650_REG_TACH0,
> MAX6650_REG_TACH1,
> MAX6650_REG_TACH2,
> MAX6650_REG_TACH3,
> };
And same here.
Other than that I am very happy with this latest version. Great job!
Thanks for your patience, I know it's always a bit frustrating when
your code works well enough for yourself and you are still told to make
many changes before it is acceptable upstream.
Can you please test the user-space support now? I suspect that we need
to update libsensors at least to match the name change of the "speed"
file. We're about to release lm_sensors 2.10.3 (in a few days now) and
I'd like it to support your new driver properly.
Thanks,
--
Jean Delvare
next prev parent reply other threads:[~2007-03-16 19:17 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-17 12:59 [lm-sensors] [PATCH] Add MAX6650 support Hans-Jürgen Koch
2007-01-22 8:36 ` Jean Delvare
2007-02-11 15:44 ` corentin.labbe
2007-02-11 16:22 ` Hans-Jürgen Koch
2007-02-12 13:48 ` Hans-Jürgen Koch
2007-02-27 15:21 ` [lm-sensors] " Matej Kenda
2007-02-27 15:35 ` [lm-sensors] " Jean Delvare
2007-02-27 16:17 ` Hans-Jürgen Koch
2007-02-27 16:29 ` Matej Kenda
2007-02-27 17:03 ` Matej Kenda
2007-02-27 17:13 ` Hans-Jürgen Koch
2007-02-27 18:07 ` Jean Delvare
2007-02-27 19:58 ` Hans-Jürgen Koch
2007-02-28 11:44 ` Hans-Jürgen Koch
2007-02-28 15:57 ` Matej Kenda
2007-02-28 16:08 ` Hans-Jürgen Koch
2007-03-01 7:15 ` Jean Delvare
2007-03-01 7:34 ` Jean Delvare
2007-03-01 10:11 ` Hans-Jürgen Koch
2007-03-01 17:34 ` corentin.labbe
2007-03-02 11:32 ` Jean Delvare
2007-03-05 11:34 ` Hans-Jürgen Koch
2007-03-11 14:40 ` Jean Delvare
2007-03-11 15:21 ` Jean Delvare
2007-03-11 21:08 ` Hans-Jürgen Koch
2007-03-12 13:50 ` Jean Delvare
2007-03-12 14:44 ` Hans-Jürgen Koch
2007-03-12 16:49 ` Jean Delvare
2007-03-13 13:25 ` Hans-Jürgen Koch
2007-03-15 20:10 ` Jean Delvare
2007-03-16 16:44 ` Hans-Jürgen Koch
2007-03-16 19:17 ` Jean Delvare [this message]
2007-03-16 21:07 ` Hans-Jürgen Koch
2007-03-16 21:19 ` Hans-Jürgen Koch
2007-03-16 21:19 ` Thomas Gleixner
2007-03-16 21:33 ` Thomas Gleixner
2007-03-17 13:39 ` Jean Delvare
2007-03-17 14:23 ` Hans-Jürgen Koch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070316201717.db788a9f.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.