From: Guenter Roeck <guenter.roeck@ericsson.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: (w83627ehf) Fix documentation of
Date: Sun, 06 Nov 2011 16:01:22 +0000 [thread overview]
Message-ID: <20111106160122.GB25483@ericsson.com> (raw)
In-Reply-To: <20111101111936.416dd882@endymion.delvare>
On Sat, Nov 05, 2011 at 09:57:14AM -0400, Jean Delvare wrote:
> On Tue, 1 Nov 2011 06:57:36 -0700, Guenter Roeck wrote:
> > On Tue, Nov 01, 2011 at 06:19:36AM -0400, Jean Delvare wrote:
> > > The NCT6775F and NCT6776F have specific temperature sensor resolutions
> > > for sensors above 3.
> > >
> > > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > > Cc: Guenter Roeck <guenter.roeck@ericsson.com>
> > > ---
> > > Guenter, did I get it right?
> > >
> > Did I add the 0.0 degrees note ? Brr.
>
> I've done worse...
>
> > Anyway, it is kind of correct. temp7 to temp9 resolution is 0.5 degrees C, but the code
> > only reads full degrees because it was too complicated to merge the lowest bit.
>
> It is indeed different from the other values but I wouldn't call it
> terribly complicated. My only worry is related to the integrity of the
> reading, i.e. how can we guarantee that the MSB and the LSB belong to
> the same measurement. I would hope that the chip latches the LSB when
> the MSB is read, but I don't see any mention of this in the datasheet.
> The problem isn't limited to temp7 to temp9, BTW, other 9-bit
> temperature inputs are affected too.
>
> Would the following (untested) be OK with you?
>
> ---
> drivers/hwmon/w83627ehf.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> --- linux-3.2-rc0.orig/drivers/hwmon/w83627ehf.c 2011-11-05 12:42:03.000000000 +0100
> +++ linux-3.2-rc0/drivers/hwmon/w83627ehf.c 2011-11-05 14:48:33.000000000 +0100
> @@ -260,6 +260,7 @@ static const u16 NCT6775_REG_TEMP_OVER[]
> = { 0x39, 0x155, 0x255, 0, 0, 0, 0x672, 0x677, 0x67C };
> static const u16 NCT6775_REG_TEMP_SOURCE[]
> = { 0x621, 0x622, 0x623, 0x100, 0x200, 0x300, 0x624, 0x625, 0x626 };
> +#define NCT6775_REG_TEMP_LSB 0x62E
>
> static const char *const w83667hg_b_temp_label[] = {
> "SYSTIN",
> @@ -888,6 +889,17 @@ static struct w83627ehf_data *w83627ehf_
> = w83627ehf_read_temp(data,
> data->reg_temp_hyst[i]);
> }
> + /* LSB of temp7-9 are stored in the same register */
> + if (data->have_temp & (0x7 << 6)) {
> + u8 reg = w83627ehf_read_value(data,
> + NCT6775_REG_TEMP_LSB);
> +
> + for (i = 0; i < 3; i++) {
> + if (data->have_temp & (1 << (6 + i)))
> + data->temp[6 + i]
> + |= (reg << (7 - i)) & 0x80;
> + }
> + }
>
> data->alarms = w83627ehf_read_value(data,
> W83627EHF_REG_ALARM1) |
>
Looks good to me. I'll test it on my system to be sure, and let you know.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
prev parent reply other threads:[~2011-11-06 16:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 10:19 [lm-sensors] [PATCH] hwmon: (w83627ehf) Fix documentation of Jean Delvare
2011-11-01 13:57 ` Guenter Roeck
2011-11-05 13:57 ` Jean Delvare
2011-11-06 16:01 ` Guenter Roeck [this message]
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=20111106160122.GB25483@ericsson.com \
--to=guenter.roeck@ericsson.com \
--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.