From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: (adm1031) Add sysfs files for
Date: Thu, 17 Sep 2009 11:32:05 +0000 [thread overview]
Message-ID: <20090917133205.5f137e4f@hyperion.delvare> (raw)
In-Reply-To: <20090630183918.GA3322@ovro.caltech.edu>
On Mon, 14 Sep 2009 22:48:46 +0200, Jean Delvare wrote:
> Hi Ira,
>
> On Tue, 30 Jun 2009 11:39:18 -0700, Ira Snyder wrote:
> > The ADM1030/ADM1031 chips have temperature offset registers, for both the
> > local and remote temperature sensors. Following the example set forth in
> > the LM90/ADM1032 driver, expose the offset registers to userspace.
> >
> > Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
> > ---
> >
> > I have tested this with an adm1031 chip, and I see the offsets as
> > expected. I do not have any other compatible chips to test with, however
> > I read the adm1030 datasheet, and everything should work fine.
> >
> > On the adm1031, the datasheet claims the offset registers can be used to
> > add/subtract 15 degC from the temperature reading. I have found that it
> > is actually possible to add 15 degC and subtract 16 degC. Following the
> > data sheet, I clamped the value to +- 15 degC, just in case other chips
> > are not compatible.
> >
> > drivers/hwmon/adm1031.c | 40 ++++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 40 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
> > index 7894418..5690595 100644
> > --- a/drivers/hwmon/adm1031.c
> > +++ b/drivers/hwmon/adm1031.c
> > @@ -145,6 +147,10 @@ adm1031_write_value(struct i2c_client *client, u8 reg, unsigned int value)
> >
> > #define TEMP_FROM_REG_EXT(val, ext) (TEMP_FROM_REG(val) + (ext) * 125)
> >
> > +#define TEMP_OFFSET_TO_REG(val) (TEMP_TO_REG(val) & 0x8f)
> > +#define TEMP_OFFSET_FROM_REG(val) TEMP_FROM_REG((val) < 0 ? \
> > + (val) | 0x70 : (val))
>
> This is not how I read the datasheet for negative offsets. The ADM1030
> datasheet says that -1°C would be coded 0x81, while your implementation
> would decode 0x81 to -15°C. But I admit the datasheet isn't too clear
> either... Did you test your code with negative offsets and found that
> it works OK?
Oh well, I've tested your patch on my ADM1031 evaluation board and it
seems to work just fine. So, consider it applied.
Thanks,
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2009-09-17 11:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 18:39 [lm-sensors] [PATCH] hwmon: (adm1031) Add sysfs files for Ira Snyder
2009-09-14 20:48 ` Jean Delvare
2009-09-17 11:32 ` Jean Delvare [this message]
2010-03-31 7:32 ` Jean Delvare
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=20090917133205.5f137e4f@hyperion.delvare \
--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.