lsb in emc6d102 and adm1027
The attached patches add support for reading the lsb from the emc6d102 and change how they are read from the adm1027.
The lm85_update_device function decodes the LSBs to temp_ext and in_ext. This strategy was suggested by Philip Pokorny.
The patch also changes some macros to use the SCALE macro. I think that they become more readable this way.
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emc6d102-sensors.patch
Type: text/x-diff
Size: 3048 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050320/5216c415/emc6d102-sensors.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emc6d102-kernel.patch
Type: text/x-diff
Size: 7526 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050320/5216c415/emc6d102-kernel.bin
Em Mon 21 Mar 2005 04:40, Philip Pokorny escreveu:
Quoted 11 lines
This doesn't look right. The
lm85_read_value()function generally only returns an 8-bit value. In some cases it returns 16 bits but those are exceptions, and you haven't added the EMC6D102 registers to that exception list.So how can you shift ext4, ext3, ext1, etc right 8 bits and have a value with any meaning?
Perhaps you meant to shift by only 4 bits to get the high nibble? :v)
Yes, you are wright. What a embarrassing error....
A corrected patch is attached. Thanks.
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emc6d102-kernel.patch
Type: text/x-diff
Size: 7526 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050321/a408e4f3/emc6d102-kernel.bin
Quoted 7 lines · Rafael ?vila de Esp?ndola
The attached patches add support for reading the lsb from the emc6d102 and change how they are read from the adm1027.
The
lm85_update_devicefunction decodes the LSBs totemp_extandin_ext. This strategy was suggested by Philip Pokorny.
Thank you for the cred.
Quoted 23 lines
Index:
drivers/i2c/chips/lm85.c
=================================>---drivers/i2c/chips/lm85.c(revision 26738)
+++drivers/i2c/chips/lm85.c(working copy)(quoted diff) +16
-0@@ -1411,6 +1443,28 @@ /* More alarm bits */ data->alarms |> lm85_read_value(client, EMC6D100_REG_ALARM3) << 16; + } else if (data->type = emc6d102 ) { + /* Have to read LSB bits after the MSB ones because + the reading of the MSB bits has frozen the + LSBs (backward from the ADM1027). + */ + int ext1 = lm85_read_value(client, + EMC6D102_REG_EXTEND_ADC1); + int ext2 = lm85_read_value(client, + EMC6D102_REG_EXTEND_ADC2); + int ext3 = lm85_read_value(client, + EMC6D102_REG_EXTEND_ADC3); + int ext4 = lm85_read_value(client, + EMC6D102_REG_EXTEND_ADC4); + data->in_ext[0] = ext3 & 0x0f; + data->in_ext[1] = ext4 & 0x0f; + data->in_ext[2] = (ext4 >> 8) & 0x0f;
Review line 1470
Quoted 10 lines
(quoted diff) +6
-0+ data->in_ext[3] = (ext3 >> 8) & 0x0f; + data->in_ext[4] = (ext2 >> 8) & 0x0f; + + data->temp_ext[0] = ext1 & 0x0f; + data->temp_ext[1] = ext2 & 0x0f; + data->temp_ext[2] = (ext1 >> 8) & 0x0f; } data->last_reading = jiffies ;
This doesn't look right. The lm85_read_value() function generally only returns an 8-bit value. In some cases it returns 16 bits but those are exceptions, and you haven't added the EMC6D102 registers to that exception list.
So how can you shift ext4, ext3, ext1, etc right 8 bits and have a value with any meaning?
Perhaps you meant to shift by only 4 bits to get the high nibble?
:v)
Greg KH
AppliedQuoted 10 lines · Rafael ?vila de Esp?ndola
Em Mon 21 Mar 2005 04:40, Philip Pokorny escreveu:
Quoted 9 lines
This doesn't look right. The
lm85_read_value()function generally only returns an 8-bit value. In some cases it returns 16 bits but those are exceptions, and you haven't added the EMC6D102 registers to that exception list.So how can you shift ext4, ext3, ext1, etc right 8 bits and have a value with any meaning?
Quoted 6 lines
Quoted 2 lines
Perhaps you meant to shift by only 4 bits to get the high nibble? :v)
Yes, you are wright. What a embarrassing error....
A corrected patch is attached. Thanks.
Applied, thanks.
greg k-h