From: Guenter Roeck <guenter.roeck@ericsson.com>
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH v2] sensors-detect: Add code to detect emc1023,
Date: Sat, 22 Jan 2011 17:14:37 +0000 [thread overview]
Message-ID: <20110122171437.GA21444@ericsson.com> (raw)
This patch adds support for emc1023, emc1043, emc1053, and emc1063 to sensors-detect.
It is based on the emc1023 detection code written by Anish Patel, but supports additional chips
and is at the same time more restrictive.
v2: Use capitals for device names, simplify revision number validation
--
Index: prog/detect/sensors-detect
=================================--- prog/detect/sensors-detect (revision 5907)
+++ prog/detect/sensors-detect (working copy)
@@ -1195,6 +1195,26 @@
i2c_addrs => [0x2f],
i2c_detect => sub { fintek_detect(@_, 7); },
}, {
+ name => "SMSC EMC1023",
+ driver => "to-be-written", # emc1023
+ i2c_addrs => [0x48, 0x49, 0x4c, 0x4d],
+ i2c_detect => sub { emc1023_detect(@_, 0); },
+ }, {
+ name => "SMSC EMC1043",
+ driver => "to-be-written", # emc1023
+ i2c_addrs => [0x48, 0x49, 0x4c, 0x4d],
+ i2c_detect => sub { emc1023_detect(@_, 1); },
+ }, {
+ name => "SMSC EMC1053",
+ driver => "to-be-written", # emc1023
+ i2c_addrs => [0x48, 0x49, 0x4c, 0x4d],
+ i2c_detect => sub { emc1023_detect(@_, 2); },
+ }, {
+ name => "SMSC EMC1063",
+ driver => "to-be-written", # emc1023
+ i2c_addrs => [0x48, 0x49, 0x4c, 0x4d],
+ i2c_detect => sub { emc1023_detect(@_, 3); },
+ }, {
name => "SMSC EMC1403",
driver => "emc1403",
i2c_addrs => [0x18, 0x2a, 0x4c, 0x4d],
@@ -5372,6 +5392,48 @@
return 7;
}
+# Chips to detect: 0 = EMC1023, 1 = EMC1043, 2 = EMC1053, 3 = EMC1063
+# Registers used:
+# 0xed: Device ID register
+# 0xfe: Vendor ID register
+# 0xff: Revision register
+sub emc1023_detect
+{
+ my ($file, $addr, $chip) = @_;
+ my $dev_id = i2c_smbus_read_byte_data($file, 0xed);
+ my $man_id = i2c_smbus_read_byte_data($file, 0xfe);
+ my $rev = i2c_smbus_read_byte_data($file, 0xff);
+
+ return unless $man_id = 0x5d; # SMSC
+ return unless $rev <= 1;
+
+ if ($chip = 0) {
+ return if ($addr = 0x4c) && ($dev_id != 0x04); # EMC1023-1
+ return if ($addr = 0x4d) && ($dev_id != 0x05); # EMC1023-2
+ return if ($addr = 0x48) && ($dev_id != 0x06); # EMC1023-3
+ return if ($addr = 0x49) && ($dev_id != 0x07); # EMC1023-4
+ } elsif ($chip = 1) {
+ if ($addr = 0x4c) { # EMC1043-1, EMC1043-5
+ return unless ($dev_id = 0x0c) || ($dev_id = 0x2c);
+ }
+ return if ($addr = 0x4d) && ($dev_id != 0x0d); # EMC1043-2
+ return if ($addr = 0x48) && ($dev_id != 0x0e); # EMC1043-3
+ return if ($addr = 0x49) && ($dev_id != 0x0f); # EMC1043-4
+ } elsif ($chip = 2) {
+ return if ($addr = 0x4c) && ($dev_id != 0x3c); # EMC1053-1
+ return if ($addr = 0x4d) && ($dev_id != 0x3d); # EMC1053-2
+ return if ($addr = 0x48) && ($dev_id != 0x3e); # EMC1053-3
+ return if ($addr = 0x49) && ($dev_id != 0x3f); # EMC1053-4
+ } elsif ($chip = 3) {
+ return if ($addr = 0x4c) && ($dev_id != 0x30); # EMC1063-1
+ return if ($addr = 0x4d) && ($dev_id != 0x31); # EMC1063-2
+ return if ($addr = 0x48) && ($dev_id != 0x32); # EMC1063-3
+ return if ($addr = 0x49) && ($dev_id != 0x33); # EMC1063-4
+ }
+
+ return 7;
+}
+
# Chip to detect: 0 = EMC1403, 1 = EMC1404, 2 = EMC2103, 3 = EMC1423
# Registers used:
# 0xfd: Device ID register
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next reply other threads:[~2011-01-22 17:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 17:14 Guenter Roeck [this message]
2011-01-22 17:51 ` [lm-sensors] [PATCH v2] sensors-detect: Add code to detect Jean Delvare
2011-07-10 16:28 ` [lm-sensors] [PATCH v2] sensors-detect: Add code to detect LM95245 Guenter Roeck
2011-07-10 18:26 ` [lm-sensors] [PATCH v2] sensors-detect: Add code to detect Jean Delvare
2011-07-10 19:20 ` Guenter Roeck
2014-12-07 0:25 ` [lm-sensors] [PATCH v2] sensors-detect: Add code to detect TMP435 Guenter Roeck
2014-12-08 10:40 ` Jean Delvare
2014-12-08 14:11 ` Guenter Roeck
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=20110122171437.GA21444@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.