[lm-sensors] [PATCH v3 7/7] hwmon: (w83627ehf) Use 16 bit fan count registers if supported

Andrew Lutomirski luto at mit.edu
Sat Feb 12 05:08:54 CET 2011


On Fri, Feb 11, 2011 at 10:45 PM, Guenter Roeck
<guenter.roeck at ericsson.com> wrote:
> On Fri, Feb 11, 2011 at 10:09:23PM -0500, Andrew Lutomirski wrote:
>> On Fri, Feb 11, 2011 at 12:20 PM, Guenter Roeck
>> <guenter.roeck at ericsson.com> wrote:
>> > Some of the chips supported by this driver have 13 bit or 16 bit fan count
>> > registers. This patch improves support for those registers, specifically for
>> > NCT6775F. With the changes in this patch, fan speed is reported correctly even
>> > if the fan divider is set to a low value, which results in a fan speed reading
>> > above 0xff.
>>
>> I'm not convinced this works.  I have an NCT6775F (or at least the
>> driver says I do) and, with fan2_min = 0 or 100, I get fan2_div = 128.
>>  If I set fan2_min=1000, I get fan2_div = 8 but fan2_input reads 0.
>> Presumably a low divider should have worked if I really had 16 bits to
>> play with.
>>
> Yes, you are right. Can you dump the raw contents of the registers at 0x28..0x2a
> as well as 0x630..0x637 ?

[13561.120768] w83627ehf: Found NCT6775F chip at 0x290
[13561.121084] Reg 0028 = 45
[13561.121097] Reg 0029 = 4c
[13561.121108] Reg 002a = 00
[13561.121119] Reg 003f = 00
[13561.121147] Reg 0630 = 0045
[13561.121166] Reg 0631 = 4500
[13561.121186] Reg 0632 = 004c
[13561.121205] Reg 0633 = 4c00
[13561.121225] Reg 0634 = 0000
[13561.121244] Reg 0635 = 0000
[13561.121263] Reg 0636 = 0000
[13561.121283] Reg 0637 = 0000

>
> According to the datasheet, register 0x28 and 0x631 should match, 0x29 should
> match 0x633, 0x2a should match 0x635, and 0x3f should match 0x637.

Doesn't look like it.  You might be off by one, or maybe there's an
endianness issue.

FWIW, here's the code I used:

	int regs_to_dump[] = {0x28, 0x29, 0x2a, 0x3f, 0x630, 0x631,
			      0x632, 0x633, 0x634, 0x635, 0x636, 0x637};
	for (i = 0; i < sizeof(regs_to_dump) / sizeof(regs_to_dump[0]); i++)
	{
		unsigned int val;
		val = w83627ehf_read_value(data, regs_to_dump[i]);
		if (is_word_sized(regs_to_dump[i])) {
			printk(KERN_ERR "Reg %04x = %04x\n",
			       regs_to_dump[i], val);
		} else {
			printk(KERN_ERR "Reg %04x = %02x\n",
			       regs_to_dump[i], val);
		}
	}

--Andy




More information about the lm-sensors mailing list