* [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
@ 2011-05-26 9:27 Per Dalén
2011-05-26 13:55 ` Guenter Roeck
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Per Dalén @ 2011-05-26 9:27 UTC (permalink / raw)
To: lm-sensors
Changed according to the suggestions from Guenter Roeck:
* Check the manufacturer ID directly. Fastens the test if it's not a
Maxim chip.
* Read the other non-existing registers after the manufacturer ID.
---
This patch adds detection of MAX6642 to sensors-detect.
Signed-off-by: Per Dalen <per.dalen@appeartv.com>
---
--- prog/detect/sensors-detect (revision 5975)
+++ prog/detect/sensors-detect (working copy)
@@ -848,6 +848,11 @@
i2c_addrs => [0x2c, 0x2e, 0x2f],
i2c_detect => sub { max6639_detect(@_); },
}, {
+ name => "Maxim MAX6642",
+ driver => "max6642",
+ i2c_addrs => [0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f],
+ i2c_detect => sub { max6642_detect(@_); },
+ }, {
name => "Maxim MAX6655/MAX6656",
driver => "max6655",
i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
@@ -5779,6 +5784,36 @@
return 6;
}
+# Chip to detect: MAX6642
+# Registers used:
+# 0x02: Status register
+# 0x03: Configuration register
+# 0xfe: Manufacturer ID
+# 0x04,0x06,0xff: No registers
+# We use the 0x04,0x06 and 0xff addresses (unused) to improve the
reliability.
+# These are not real registers and will always return the last returned
value.
+# This isn't documented.
+sub max6642_detect
+{
+ my ($file, $addr) = @_;
+ my ($man_id, $conf, $status);
+
+ $man_id = i2c_smbus_read_byte_data($file, 0xfe, NO_CACHE);
+ return unless $man_id = 0x4d; # Maxim
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
+ $status = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE);
+ $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE);
+
+ # Bit 5, 3, 1 and 0 should be zero
+ return unless ($status & 0x2b) = 0x00;
+ # The 4 lower bits should be zero
+ return unless ($conf & 0x0f) = 0x00;
+
+ return 6;
+}
+
sub max6655_detect
{
my ($file, $addr) = @_;
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
@ 2011-05-26 13:55 ` Guenter Roeck
2011-05-26 14:06 ` Jean Delvare
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2011-05-26 13:55 UTC (permalink / raw)
To: lm-sensors
On Thu, May 26, 2011 at 05:27:27AM -0400, Per Dalén wrote:
> Changed according to the suggestions from Guenter Roeck:
>
> * Check the manufacturer ID directly. Fastens the test if it's not a
> Maxim chip.
> * Read the other non-existing registers after the manufacturer ID.
>
> ---
>
> This patch adds detection of MAX6642 to sensors-detect.
>
> Signed-off-by: Per Dalen <per.dalen@appeartv.com>
Looks good to me. Jean, any comments, especially regarding the detection strength ?
If not I'll apply it.
Thanks,
Guenter
> ---
>
> --- prog/detect/sensors-detect (revision 5975)
> +++ prog/detect/sensors-detect (working copy)
> @@ -848,6 +848,11 @@
> i2c_addrs => [0x2c, 0x2e, 0x2f],
> i2c_detect => sub { max6639_detect(@_); },
> }, {
> + name => "Maxim MAX6642",
> + driver => "max6642",
> + i2c_addrs => [0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f],
> + i2c_detect => sub { max6642_detect(@_); },
> + }, {
> name => "Maxim MAX6655/MAX6656",
> driver => "max6655",
> i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
> @@ -5779,6 +5784,36 @@
> return 6;
> }
>
> +# Chip to detect: MAX6642
> +# Registers used:
> +# 0x02: Status register
> +# 0x03: Configuration register
> +# 0xfe: Manufacturer ID
> +# 0x04,0x06,0xff: No registers
> +# We use the 0x04,0x06 and 0xff addresses (unused) to improve the
> reliability.
> +# These are not real registers and will always return the last returned
> value.
> +# This isn't documented.
> +sub max6642_detect
> +{
> + my ($file, $addr) = @_;
> + my ($man_id, $conf, $status);
> +
> + $man_id = i2c_smbus_read_byte_data($file, 0xfe, NO_CACHE);
> + return unless $man_id = 0x4d; # Maxim
> + return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
> + return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
> + return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
> + $status = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE);
> + $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE);
> +
> + # Bit 5, 3, 1 and 0 should be zero
> + return unless ($status & 0x2b) = 0x00;
> + # The 4 lower bits should be zero
> + return unless ($conf & 0x0f) = 0x00;
> +
> + return 6;
> +}
> +
> sub max6655_detect
> {
> my ($file, $addr) = @_;
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
2011-05-26 13:55 ` Guenter Roeck
@ 2011-05-26 14:06 ` Jean Delvare
2011-05-26 19:33 ` Jean Delvare
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2011-05-26 14:06 UTC (permalink / raw)
To: lm-sensors
On Thu, 26 May 2011 06:55:02 -0700, Guenter Roeck wrote:
> On Thu, May 26, 2011 at 05:27:27AM -0400, Per Dalén wrote:
> > Changed according to the suggestions from Guenter Roeck:
> >
> > * Check the manufacturer ID directly. Fastens the test if it's not a
> > Maxim chip.
> > * Read the other non-existing registers after the manufacturer ID.
> >
> > ---
> >
> > This patch adds detection of MAX6642 to sensors-detect.
> >
> > Signed-off-by: Per Dalen <per.dalen@appeartv.com>
>
> Looks good to me. Jean, any comments, especially regarding the detection strength ?
> If not I'll apply it.
Busy at work right now, will take a look in the evening.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
2011-05-26 13:55 ` Guenter Roeck
2011-05-26 14:06 ` Jean Delvare
@ 2011-05-26 19:33 ` Jean Delvare
2011-05-27 8:08 ` Per Dalén
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2011-05-26 19:33 UTC (permalink / raw)
To: lm-sensors
Hi Per,
On Thu, 26 May 2011 11:27:27 +0200, Per Dalén wrote:
> Changed according to the suggestions from Guenter Roeck:
>
> * Check the manufacturer ID directly. Fastens the test if it's not a
> Maxim chip.
> * Read the other non-existing registers after the manufacturer ID.
THis is better but I'm not completely happy yet.
> This patch adds detection of MAX6642 to sensors-detect.
>
> Signed-off-by: Per Dalen <per.dalen@appeartv.com>
> ---
>
> --- prog/detect/sensors-detect (revision 5975)
> +++ prog/detect/sensors-detect (working copy)
> @@ -848,6 +848,11 @@
> i2c_addrs => [0x2c, 0x2e, 0x2f],
> i2c_detect => sub { max6639_detect(@_); },
> }, {
> + name => "Maxim MAX6642",
> + driver => "max6642",
> + i2c_addrs => [0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f],
Better written: [0x48..0x4f]
> + i2c_detect => sub { max6642_detect(@_); },
> + }, {
> name => "Maxim MAX6655/MAX6656",
> driver => "max6655",
> i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
> @@ -5779,6 +5784,36 @@
> return 6;
> }
>
> +# Chip to detect: MAX6642
> +# Registers used:
> +# 0x02: Status register
> +# 0x03: Configuration register
> +# 0xfe: Manufacturer ID
> +# 0x04,0x06,0xff: No registers
> +# We use the 0x04,0x06 and 0xff addresses (unused) to improve the
Space after comma please.
> reliability.
Please disable line wrapping in your e-mail client before sending patches.
> +# These are not real registers and will always return the last returned
> value.
> +# This isn't documented.
> +sub max6642_detect
> +{
> + my ($file, $addr) = @_;
> + my ($man_id, $conf, $status);
> +
> + $man_id = i2c_smbus_read_byte_data($file, 0xfe, NO_CACHE);
> + return unless $man_id = 0x4d; # Maxim
> + return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
> + return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
> + return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
> + $status = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE);
At this point you should check the unused status bits immediately (so
that you can exit if they don't meet the expectations.) Then you should
read non-registers 0x04, 0x06 and 0xff again. This is the only reliable
way to make sure that there are no registers at these addresses. It is
perfectly possible (though unlikely) that a given chip does have values
0x4d for all of registers 0x04, 0x06, 0xfe and 0xff.
See max6657_detect() for an example.
> + $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE);
NO_CACHE is not needed here, as this register 0x03 does exist. Only use
NO_CACHE when you really need it, it's expensive!
> +
> + # Bit 5, 3, 1 and 0 should be zero
> + return unless ($status & 0x2b) = 0x00;
> + # The 4 lower bits should be zero
> + return unless ($conf & 0x0f) = 0x00;
> +
> + return 6;
> +}
> +
> sub max6655_detect
> {
> my ($file, $addr) = @_;
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (2 preceding siblings ...)
2011-05-26 19:33 ` Jean Delvare
@ 2011-05-27 8:08 ` Per Dalén
2011-06-01 8:02 ` Per Dalén
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Per Dalén @ 2011-05-27 8:08 UTC (permalink / raw)
To: lm-sensors
On 05/26/2011 09:33 PM, Jean Delvare wrote:
> Hi Per,
Hi Jean,
I'll fix the sensors-detect and MAX6642 driver during (or right after)
the weekend in the way you suggest. Thanks for the tips.
>
> On Thu, 26 May 2011 11:27:27 +0200, Per Dalén wrote:
>> Changed according to the suggestions from Guenter Roeck:
>>
>> * Check the manufacturer ID directly. Fastens the test if it's not a
>> Maxim chip.
>> * Read the other non-existing registers after the manufacturer ID.
>
> THis is better but I'm not completely happy yet.
>
>> This patch adds detection of MAX6642 to sensors-detect.
>>
>> Signed-off-by: Per Dalen <per.dalen@appeartv.com>
>> ---
>>
>> --- prog/detect/sensors-detect (revision 5975)
>> +++ prog/detect/sensors-detect (working copy)
>> @@ -848,6 +848,11 @@
>> i2c_addrs => [0x2c, 0x2e, 0x2f],
>> i2c_detect => sub { max6639_detect(@_); },
>> }, {
>> + name => "Maxim MAX6642",
>> + driver => "max6642",
>> + i2c_addrs => [0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f],
>
> Better written: [0x48..0x4f]
>
>> + i2c_detect => sub { max6642_detect(@_); },
>> + }, {
>> name => "Maxim MAX6655/MAX6656",
>> driver => "max6655",
>> i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
>> @@ -5779,6 +5784,36 @@
>> return 6;
>> }
>>
>> +# Chip to detect: MAX6642
>> +# Registers used:
>> +# 0x02: Status register
>> +# 0x03: Configuration register
>> +# 0xfe: Manufacturer ID
>> +# 0x04,0x06,0xff: No registers
>> +# We use the 0x04,0x06 and 0xff addresses (unused) to improve the
>
> Space after comma please.
>
>> reliability.
>
> Please disable line wrapping in your e-mail client before sending patches.
>
>> +# These are not real registers and will always return the last returned
>> value.
>> +# This isn't documented.
>> +sub max6642_detect
>> +{
>> + my ($file, $addr) = @_;
>> + my ($man_id, $conf, $status);
>> +
>> + $man_id = i2c_smbus_read_byte_data($file, 0xfe, NO_CACHE);
>> + return unless $man_id = 0x4d; # Maxim
>> + return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
>> + return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
>> + return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
>> + $status = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE);
>
> At this point you should check the unused status bits immediately (so
> that you can exit if they don't meet the expectations.) Then you should
> read non-registers 0x04, 0x06 and 0xff again. This is the only reliable
> way to make sure that there are no registers at these addresses. It is
> perfectly possible (though unlikely) that a given chip does have values
> 0x4d for all of registers 0x04, 0x06, 0xfe and 0xff.
>
> See max6657_detect() for an example.
>
>> + $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE);
>
> NO_CACHE is not needed here, as this register 0x03 does exist. Only use
> NO_CACHE when you really need it, it's expensive!
>
>> +
>> + # Bit 5, 3, 1 and 0 should be zero
>> + return unless ($status & 0x2b) = 0x00;
>> + # The 4 lower bits should be zero
>> + return unless ($conf & 0x0f) = 0x00;
>> +
>> + return 6;
>> +}
>> +
>> sub max6655_detect
>> {
>> my ($file, $addr) = @_;
>
>
BR
Per
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (3 preceding siblings ...)
2011-05-27 8:08 ` Per Dalén
@ 2011-06-01 8:02 ` Per Dalén
2011-06-01 10:13 ` Jean Delvare
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Per Dalén @ 2011-06-01 8:02 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1: Type: text/plain, Size: 3569 bytes --]
Hi,
Here's the new patch for sensors-detect.
Changed according to the suggestions from Jean Delvare:
* Check the manufacturer ID directly. Fastens the test if it's not a
Maxim chip.
* Read the other non-existing registers after the manufacturer ID.
* Read the other non-existing registers after the status.
* Removed NO_CACHE from manufacturer ID, Status and Configuration registers.
BR
Per
On 05/26/2011 09:33 PM, Jean Delvare wrote:
> Hi Per,
>
> On Thu, 26 May 2011 11:27:27 +0200, Per Dalén wrote:
>> Changed according to the suggestions from Guenter Roeck:
>>
>> * Check the manufacturer ID directly. Fastens the test if it's not a
>> Maxim chip.
>> * Read the other non-existing registers after the manufacturer ID.
>
> THis is better but I'm not completely happy yet.
>
>> This patch adds detection of MAX6642 to sensors-detect.
>>
>> Signed-off-by: Per Dalen <per.dalen@appeartv.com>
>> ---
>>
>> --- prog/detect/sensors-detect (revision 5975)
>> +++ prog/detect/sensors-detect (working copy)
>> @@ -848,6 +848,11 @@
>> i2c_addrs => [0x2c, 0x2e, 0x2f],
>> i2c_detect => sub { max6639_detect(@_); },
>> }, {
>> + name => "Maxim MAX6642",
>> + driver => "max6642",
>> + i2c_addrs => [0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f],
>
> Better written: [0x48..0x4f]
>
>> + i2c_detect => sub { max6642_detect(@_); },
>> + }, {
>> name => "Maxim MAX6655/MAX6656",
>> driver => "max6655",
>> i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
>> @@ -5779,6 +5784,36 @@
>> return 6;
>> }
>>
>> +# Chip to detect: MAX6642
>> +# Registers used:
>> +# 0x02: Status register
>> +# 0x03: Configuration register
>> +# 0xfe: Manufacturer ID
>> +# 0x04,0x06,0xff: No registers
>> +# We use the 0x04,0x06 and 0xff addresses (unused) to improve the
>
> Space after comma please.
>
>> reliability.
>
> Please disable line wrapping in your e-mail client before sending patches.
>
>> +# These are not real registers and will always return the last returned
>> value.
>> +# This isn't documented.
>> +sub max6642_detect
>> +{
>> + my ($file, $addr) = @_;
>> + my ($man_id, $conf, $status);
>> +
>> + $man_id = i2c_smbus_read_byte_data($file, 0xfe, NO_CACHE);
>> + return unless $man_id == 0x4d; # Maxim
>> + return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
>> + return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
>> + return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
>> + $status = i2c_smbus_read_byte_data($file, 0x02, NO_CACHE);
>
> At this point you should check the unused status bits immediately (so
> that you can exit if they don't meet the expectations.) Then you should
> read non-registers 0x04, 0x06 and 0xff again. This is the only reliable
> way to make sure that there are no registers at these addresses. It is
> perfectly possible (though unlikely) that a given chip does have values
> 0x4d for all of registers 0x04, 0x06, 0xfe and 0xff.
>
> See max6657_detect() for an example.
>
>> + $conf = i2c_smbus_read_byte_data($file, 0x03, NO_CACHE);
>
> NO_CACHE is not needed here, as this register 0x03 does exist. Only use
> NO_CACHE when you really need it, it's expensive!
>
>> +
>> + # Bit 5, 3, 1 and 0 should be zero
>> + return unless ($status & 0x2b) == 0x00;
>> + # The 4 lower bits should be zero
>> + return unless ($conf & 0x0f) == 0x00;
>> +
>> + return 6;
>> +}
>> +
>> sub max6655_detect
>> {
>> my ($file, $addr) = @_;
>
>
[-- Attachment #2: 0001-hwmon-sensors_detect-Add-detection-of-MAX6642.patch --]
[-- Type: text/plain, Size: 1995 bytes --]
This patch adds detection of MAX6642 to sensors-detect.
Signed-off-by: Per Dalen <per.dalen@appeartv.com>
---
Index: prog/detect/sensors-detect
===================================================================
--- prog/detect/sensors-detect (revision 5977)
+++ prog/detect/sensors-detect (working copy)
@@ -848,6 +848,11 @@
i2c_addrs => [0x2c, 0x2e, 0x2f],
i2c_detect => sub { max6639_detect(@_); },
}, {
+ name => "Maxim MAX6642",
+ driver => "max6642",
+ i2c_addrs => [0x48..0x4f],
+ i2c_detect => sub { max6642_detect(@_); },
+ }, {
name => "Maxim MAX6655/MAX6656",
driver => "max6655",
i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e],
@@ -5789,6 +5794,40 @@
return 6;
}
+# Chip to detect: MAX6642
+# Registers used:
+# 0x02: Status register
+# 0x03: Configuration register
+# 0xfe: Manufacturer ID
+# 0x04, 0x06, 0xff: No registers
+# We use the 0x04,0x06 and 0xff addresses (unused) to improve the reliability.
+# These are not real registers and will always return the last returned value.
+# This isn't documented.
+sub max6642_detect
+{
+ my ($file, $addr) = @_;
+ my ($man_id, $conf, $status);
+
+ $man_id = i2c_smbus_read_byte_data($file, 0xfe);
+ return unless $man_id == 0x4d; # Maxim
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $man_id;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $man_id;
+
+ $status = i2c_smbus_read_byte_data($file, 0x02);
+ # Bit 5, 3, 1 and 0 should be zero
+ return unless ($status & 0x2b) == 0x00;
+ return if i2c_smbus_read_byte_data($file, 0x04, NO_CACHE) != $status;
+ return if i2c_smbus_read_byte_data($file, 0x06, NO_CACHE) != $status;
+ return if i2c_smbus_read_byte_data($file, 0xff, NO_CACHE) != $status;
+
+ $conf = i2c_smbus_read_byte_data($file, 0x03);
+ # The 4 lower bits should be zero
+ return unless ($conf & 0x0f) == 0x00;
+
+ return 6;
+}
+
sub max6655_detect
{
my ($file, $addr) = @_;
[-- Attachment #3: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (4 preceding siblings ...)
2011-06-01 8:02 ` Per Dalén
@ 2011-06-01 10:13 ` Jean Delvare
2011-06-01 16:21 ` Guenter Roeck
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2011-06-01 10:13 UTC (permalink / raw)
To: lm-sensors
On Wed, 01 Jun 2011 10:02:25 +0200, Per Dalén wrote:
> Hi,
>
> Here's the new patch for sensors-detect.
>
> Changed according to the suggestions from Jean Delvare:
>
> * Check the manufacturer ID directly. Fastens the test if it's not a
> Maxim chip.
> * Read the other non-existing registers after the manufacturer ID.
> * Read the other non-existing registers after the status.
> * Removed NO_CACHE from manufacturer ID, Status and Configuration registers.
Looks good, except that maybe I'd go for a confidence value of only 5,
not 6, due to the lack of proper device ID register.
Guenter, please apply.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (5 preceding siblings ...)
2011-06-01 10:13 ` Jean Delvare
@ 2011-06-01 16:21 ` Guenter Roeck
2014-01-26 19:02 ` [lm-sensors] [PATCH v2] sensors-detect: Add detection of TI ADC128D818 Guenter Roeck
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2011-06-01 16:21 UTC (permalink / raw)
To: lm-sensors
On Wed, 2011-06-01 at 06:13 -0400, Jean Delvare wrote:
> On Wed, 01 Jun 2011 10:02:25 +0200, Per Dalén wrote:
> > Hi,
> >
> > Here's the new patch for sensors-detect.
> >
> > Changed according to the suggestions from Jean Delvare:
> >
> > * Check the manufacturer ID directly. Fastens the test if it's not a
> > Maxim chip.
> > * Read the other non-existing registers after the manufacturer ID.
> > * Read the other non-existing registers after the status.
> > * Removed NO_CACHE from manufacturer ID, Status and Configuration registers.
>
> Looks good, except that maybe I'd go for a confidence value of only 5,
> not 6, due to the lack of proper device ID register.
>
> Guenter, please apply.
>
Applied.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* [lm-sensors] [PATCH v2] sensors-detect: Add detection of TI ADC128D818
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (6 preceding siblings ...)
2011-06-01 16:21 ` Guenter Roeck
@ 2014-01-26 19:02 ` Guenter Roeck
2014-01-26 20:15 ` Jean Delvare
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2014-01-26 19:02 UTC (permalink / raw)
To: lm-sensors
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Use separate function to detect ADC128D818.
Fix register addresses
Check additional registers
Fix typo in lm80 detection (ok, I am lazy ;-)
CHANGES | 3 +++
prog/detect/sensors-detect | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/CHANGES b/CHANGES
index e1347a6..970dd67 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
lm-sensors CHANGES file
-----------------------
+SVN HEAD
+ sensors-detect: Add detection of ADC128D818
+
3.3.5 "Happy Birthday Beddy" (2014-01-22)
libsensors: Improve documentation of two functions
Increase MAX_SENSORS_PER_TYPE to 33
diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
index a2093f3..cfab2df 100755
--- a/prog/detect/sensors-detect
+++ b/prog/detect/sensors-detect
@@ -547,6 +547,11 @@ use vars qw(@i2c_adapter_names);
i2c_addrs => [0x28..0x2f],
i2c_detect => sub { lm80_detect(@_, 1); },
}, {
+ name => "TI / National Semiconductor ADC128D818",
+ driver => "adc128d818",
+ i2c_addrs => [0x1d, 0x1e, 0x1f, 0x2d, 0x2e, 0x2f],
+ i2c_detect => sub { adc128d818_detect(@_); },
+ }, {
name => "National Semiconductor LM85",
driver => "lm85",
i2c_addrs => [0x2c..0x2e],
@@ -4437,7 +4442,7 @@ sub lm92_detect
# Registers used:
# 0x00: Configuration register
# 0x02: Interrupt state register
-# 0x07: Converstion rate register (LM96080 only)
+# 0x07: Conversion rate register (LM96080 only)
# 0x2a-0x3d: Limits registers (LM80 only)
# 0x3e: Manufacturer's ID register (LM96080 only)
# 0x3f: Stepping/die revision ID register (LM96080 only)
@@ -4502,6 +4507,32 @@ sub lm80_detect
}
# Registers used:
+# 0x00: Configuration register
+# 0x07: Conversion rate register
+# 0x09: Oneshot register
+# 0x0a: Shutdown register
+# 0x0b: Advanced Configuration register
+# 0x0c: Busy Status register
+# 0x3e: Manufacturer's ID register
+# 0x3f: Stepping/die revision ID register
+sub adc128d818_detect
+{
+ my ($file, $addr) = @_;
+
+ return if i2c_smbus_read_byte_data($file, 0x3e) != 0x01;
+ return if i2c_smbus_read_byte_data($file, 0x3f) != 0x09;
+
+ return if (i2c_smbus_read_byte_data($file, 0x00) & 0xf4) != 0;
+ return if (i2c_smbus_read_byte_data($file, 0x07) & 0xfe) != 0;
+ return if (i2c_smbus_read_byte_data($file, 0x09) & 0xfe) != 0;
+ return if (i2c_smbus_read_byte_data($file, 0x0a) & 0xfe) != 0;
+ return if (i2c_smbus_read_byte_data($file, 0x0b) & 0xf8) != 0;
+ return if (i2c_smbus_read_byte_data($file, 0x0c) & 0xfc) != 0;
+
+ return 7;
+}
+
+# Registers used:
# 0x02: Status 1
# 0x03: Configuration
# 0x04: Company ID of LM84
--
1.7.9.7
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of TI ADC128D818
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (7 preceding siblings ...)
2014-01-26 19:02 ` [lm-sensors] [PATCH v2] sensors-detect: Add detection of TI ADC128D818 Guenter Roeck
@ 2014-01-26 20:15 ` Jean Delvare
2014-06-26 13:28 ` [lm-sensors] [PATCH v2] sensors-detect: Add detection of NCT7802Y Guenter Roeck
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2014-01-26 20:15 UTC (permalink / raw)
To: lm-sensors
On Sun, 26 Jan 2014 11:02:44 -0800, Guenter Roeck wrote:
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Use separate function to detect ADC128D818.
> Fix register addresses
> Check additional registers
> Fix typo in lm80 detection (ok, I am lazy ;-)
>
> CHANGES | 3 +++
> prog/detect/sensors-detect | 33 ++++++++++++++++++++++++++++++++-
> 2 files changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/CHANGES b/CHANGES
> index e1347a6..970dd67 100644
> --- a/CHANGES
> +++ b/CHANGES
> @@ -1,6 +1,9 @@
> lm-sensors CHANGES file
> -----------------------
>
> +SVN HEAD
> + sensors-detect: Add detection of ADC128D818
> +
> 3.3.5 "Happy Birthday Beddy" (2014-01-22)
> libsensors: Improve documentation of two functions
> Increase MAX_SENSORS_PER_TYPE to 33
> diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
> index a2093f3..cfab2df 100755
> --- a/prog/detect/sensors-detect
> +++ b/prog/detect/sensors-detect
> @@ -547,6 +547,11 @@ use vars qw(@i2c_adapter_names);
> i2c_addrs => [0x28..0x2f],
> i2c_detect => sub { lm80_detect(@_, 1); },
> }, {
> + name => "TI / National Semiconductor ADC128D818",
> + driver => "adc128d818",
> + i2c_addrs => [0x1d, 0x1e, 0x1f, 0x2d, 0x2e, 0x2f],
> + i2c_detect => sub { adc128d818_detect(@_); },
> + }, {
> name => "National Semiconductor LM85",
> driver => "lm85",
> i2c_addrs => [0x2c..0x2e],
> @@ -4437,7 +4442,7 @@ sub lm92_detect
> # Registers used:
> # 0x00: Configuration register
> # 0x02: Interrupt state register
> -# 0x07: Converstion rate register (LM96080 only)
> +# 0x07: Conversion rate register (LM96080 only)
> # 0x2a-0x3d: Limits registers (LM80 only)
> # 0x3e: Manufacturer's ID register (LM96080 only)
> # 0x3f: Stepping/die revision ID register (LM96080 only)
> @@ -4502,6 +4507,32 @@ sub lm80_detect
> }
>
> # Registers used:
> +# 0x00: Configuration register
> +# 0x07: Conversion rate register
> +# 0x09: Oneshot register
> +# 0x0a: Shutdown register
> +# 0x0b: Advanced Configuration register
> +# 0x0c: Busy Status register
> +# 0x3e: Manufacturer's ID register
> +# 0x3f: Stepping/die revision ID register
> +sub adc128d818_detect
> +{
> + my ($file, $addr) = @_;
> +
> + return if i2c_smbus_read_byte_data($file, 0x3e) != 0x01;
> + return if i2c_smbus_read_byte_data($file, 0x3f) != 0x09;
> +
> + return if (i2c_smbus_read_byte_data($file, 0x00) & 0xf4) != 0;
> + return if (i2c_smbus_read_byte_data($file, 0x07) & 0xfe) != 0;
> + return if (i2c_smbus_read_byte_data($file, 0x09) & 0xfe) != 0;
> + return if (i2c_smbus_read_byte_data($file, 0x0a) & 0xfe) != 0;
> + return if (i2c_smbus_read_byte_data($file, 0x0b) & 0xf8) != 0;
> + return if (i2c_smbus_read_byte_data($file, 0x0c) & 0xfc) != 0;
> +
> + return 7;
> +}
> +
> +# Registers used:
> # 0x02: Status 1
> # 0x03: Configuration
> # 0x04: Company ID of LM84
Looks good to me, please commit.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* [lm-sensors] [PATCH v2] sensors-detect: Add detection of NCT7802Y
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (8 preceding siblings ...)
2014-01-26 20:15 ` Jean Delvare
@ 2014-06-26 13:28 ` Guenter Roeck
2014-06-26 13:55 ` Jean Delvare
2014-06-26 15:11 ` Guenter Roeck
11 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2014-06-26 13:28 UTC (permalink / raw)
To: lm-sensors
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Don't attempt to detect chip if register bank 1 is selected.
Document all used registers.
CHANGES | 1 +
prog/detect/sensors-detect | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/CHANGES b/CHANGES
index 3390942..a16e7be 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ SVN HEAD
Add detection of ITE IT8620E and IT8623E
Add detection of TMP441, TMP442, LM95233, LM95234,
and LM95235
+ Add detection of NCT7802Y
3.3.5 "Happy Birthday Beddy" (2014-01-22)
libsensors: Improve documentation of two functions
diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
index 1208f4d..719c6dc 100755
--- a/prog/detect/sensors-detect
+++ b/prog/detect/sensors-detect
@@ -733,6 +733,11 @@ use vars qw(@i2c_adapter_names);
i2c_addrs => [0x2c..0x2f],
i2c_detect => sub { w83795_detect(@_); },
}, {
+ name => "Nuvoton NCT7802Y",
+ driver => "to-be-written",
+ i2c_addrs => [0x28..0x2f],
+ i2c_detect => sub { nct7802_detect(@_); },
+ }, {
name => "Winbond W83627HF",
driver => "use-isa-instead",
i2c_addrs => [0x28..0x2f],
@@ -5483,6 +5488,47 @@ sub w83795_detect
}
# Registers used:
+# 0x00: Bank selection (Bank 0, 1)
+# 0x05: Temperature readout register LSB (Bank 0)
+# 0x08: PECI temperature readout register LSB (Bank 0)
+# 0x0f: Voltage readout register LSB (Bank 0)
+# 0xfd: Vendor ID (Bank 0)
+# 0xfe: Device ID (Bank 0)
+# 0xff: Device Revision (Bank 0)
+#
+# Note that identification registers are not accessible in bank 1,
+# and there is no usable other means to identify the chip if bank 1
+# is selected. Only detect chip if bank 0 is selected.
+sub nct7802_detect
+{
+ my ($bank, $reg);
+ my ($file, $addr) = @_;
+
+ $bank = i2c_smbus_read_byte_data($file, 0x00);
+ return unless $bank = 0x00;
+
+ $reg = i2c_smbus_read_byte_data($file, 0xfd);
+ return unless $reg = 0x50;
+
+ $reg = i2c_smbus_read_byte_data($file, 0xfe);
+ return unless $reg = 0xc3;
+
+ $reg = i2c_smbus_read_byte_data($file, 0xff);
+ return unless ($reg & 0xf0) = 0x20;
+
+ $reg = i2c_smbus_read_byte_data($file, 0x05);
+ return unless ($reg & 0x1f) = 0x00;
+
+ $reg = i2c_smbus_read_byte_data($file, 0x08);
+ return unless ($reg & 0x3f) = 0x00;
+
+ $reg = i2c_smbus_read_byte_data($file, 0x0f);
+ return unless ($reg & 0x3f) = 0x00;
+
+ return 8;
+}
+
+# Registers used:
# 0x48: Full I2C Address
# 0x4e: Vendor ID byte selection
# 0x4f: Vendor ID
--
1.9.1
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of NCT7802Y
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (9 preceding siblings ...)
2014-06-26 13:28 ` [lm-sensors] [PATCH v2] sensors-detect: Add detection of NCT7802Y Guenter Roeck
@ 2014-06-26 13:55 ` Jean Delvare
2014-06-26 15:11 ` Guenter Roeck
11 siblings, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2014-06-26 13:55 UTC (permalink / raw)
To: lm-sensors
On Thu, 26 Jun 2014 06:28:14 -0700, Guenter Roeck wrote:
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Don't attempt to detect chip if register bank 1 is selected.
> Document all used registers.
>
> CHANGES | 1 +
> prog/detect/sensors-detect | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 47 insertions(+)
>
> diff --git a/CHANGES b/CHANGES
> index 3390942..a16e7be 100644
> --- a/CHANGES
> +++ b/CHANGES
> @@ -13,6 +13,7 @@ SVN HEAD
> Add detection of ITE IT8620E and IT8623E
> Add detection of TMP441, TMP442, LM95233, LM95234,
> and LM95235
> + Add detection of NCT7802Y
>
> 3.3.5 "Happy Birthday Beddy" (2014-01-22)
> libsensors: Improve documentation of two functions
> diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect
> index 1208f4d..719c6dc 100755
> --- a/prog/detect/sensors-detect
> +++ b/prog/detect/sensors-detect
> @@ -733,6 +733,11 @@ use vars qw(@i2c_adapter_names);
> i2c_addrs => [0x2c..0x2f],
> i2c_detect => sub { w83795_detect(@_); },
> }, {
> + name => "Nuvoton NCT7802Y",
> + driver => "to-be-written",
> + i2c_addrs => [0x28..0x2f],
> + i2c_detect => sub { nct7802_detect(@_); },
> + }, {
> name => "Winbond W83627HF",
> driver => "use-isa-instead",
> i2c_addrs => [0x28..0x2f],
> @@ -5483,6 +5488,47 @@ sub w83795_detect
> }
>
> # Registers used:
> +# 0x00: Bank selection (Bank 0, 1)
Not sure the "(Bank 0, 1)" makes much sense any longer.
Looks good otherwise, feel free to commit.
> +# 0x05: Temperature readout register LSB (Bank 0)
> +# 0x08: PECI temperature readout register LSB (Bank 0)
> +# 0x0f: Voltage readout register LSB (Bank 0)
> +# 0xfd: Vendor ID (Bank 0)
> +# 0xfe: Device ID (Bank 0)
> +# 0xff: Device Revision (Bank 0)
> +#
> +# Note that identification registers are not accessible in bank 1,
> +# and there is no usable other means to identify the chip if bank 1
> +# is selected. Only detect chip if bank 0 is selected.
> +sub nct7802_detect
> +{
> + my ($bank, $reg);
> + my ($file, $addr) = @_;
> +
> + $bank = i2c_smbus_read_byte_data($file, 0x00);
> + return unless $bank = 0x00;
> +
> + $reg = i2c_smbus_read_byte_data($file, 0xfd);
> + return unless $reg = 0x50;
> +
> + $reg = i2c_smbus_read_byte_data($file, 0xfe);
> + return unless $reg = 0xc3;
> +
> + $reg = i2c_smbus_read_byte_data($file, 0xff);
> + return unless ($reg & 0xf0) = 0x20;
> +
> + $reg = i2c_smbus_read_byte_data($file, 0x05);
> + return unless ($reg & 0x1f) = 0x00;
> +
> + $reg = i2c_smbus_read_byte_data($file, 0x08);
> + return unless ($reg & 0x3f) = 0x00;
> +
> + $reg = i2c_smbus_read_byte_data($file, 0x0f);
> + return unless ($reg & 0x3f) = 0x00;
> +
> + return 8;
> +}
> +
> +# Registers used:
> # 0x48: Full I2C Address
> # 0x4e: Vendor ID byte selection
> # 0x4f: Vendor ID
--
Jean Delvare
SUSE L3 Support
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [lm-sensors] [PATCH v2] sensors-detect: Add detection of NCT7802Y
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
` (10 preceding siblings ...)
2014-06-26 13:55 ` Jean Delvare
@ 2014-06-26 15:11 ` Guenter Roeck
11 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2014-06-26 15:11 UTC (permalink / raw)
To: lm-sensors
On 06/26/2014 06:55 AM, Jean Delvare wrote:
> On Thu, 26 Jun 2014 06:28:14 -0700, Guenter Roeck wrote:
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> v2: Don't attempt to detect chip if register bank 1 is selected.
>> Document all used registers.
...
>>
>> # Registers used:
>> +# 0x00: Bank selection (Bank 0, 1)
>
> Not sure the "(Bank 0, 1)" makes much sense any longer.
>
On the other side, it doesn't hurt, so I left it in.
> Looks good otherwise, feel free to commit.
>
Thanks!
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-06-26 15:11 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-26 9:27 [lm-sensors] [PATCH v2] sensors-detect: Add detection of MAX6642 Per Dalén
2011-05-26 13:55 ` Guenter Roeck
2011-05-26 14:06 ` Jean Delvare
2011-05-26 19:33 ` Jean Delvare
2011-05-27 8:08 ` Per Dalén
2011-06-01 8:02 ` Per Dalén
2011-06-01 10:13 ` Jean Delvare
2011-06-01 16:21 ` Guenter Roeck
2014-01-26 19:02 ` [lm-sensors] [PATCH v2] sensors-detect: Add detection of TI ADC128D818 Guenter Roeck
2014-01-26 20:15 ` Jean Delvare
2014-06-26 13:28 ` [lm-sensors] [PATCH v2] sensors-detect: Add detection of NCT7802Y Guenter Roeck
2014-06-26 13:55 ` Jean Delvare
2014-06-26 15:11 ` Guenter Roeck
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.