mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-30 22:05:11 +00:00
sensors-detect: Add TMP42x chip detection
This patch adds detection for TI's TMP421, TMP422 and TMP423 chips to sensors-detect. Only the manufactory ID and the device ID is used for detection. I hope this is reliable enough. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5754 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -7,6 +7,7 @@ SVN-HEAD
|
||||
sensors-detect: Refer to tmp401 driver if TMP411 is detected
|
||||
Clean up the discovery of i2c adapters
|
||||
Report unsupported Access Bus adapters
|
||||
Add detection for TI's TMP421, TMP422 and TMP423 chips
|
||||
|
||||
3.1.1 (2009-06-21)
|
||||
isadump: Use geteuid instead of getuid so that setuid bit works
|
||||
|
@@ -907,6 +907,21 @@ use vars qw(@i2c_adapter_names);
|
||||
driver => "tmp401",
|
||||
i2c_addrs => [0x4c..0x4e],
|
||||
i2c_detect => sub { lm90_detect(@_, 10); },
|
||||
}, {
|
||||
name => "Texas Instruments TMP421",
|
||||
driver => "tmp421",
|
||||
i2c_addrs => [0x2a, 0x4c..0x4f], # 0x1c-0x1f not probed.
|
||||
i2c_detect => sub { tmp42x_detect(@_, 0); },
|
||||
}, {
|
||||
name => "Texas Instruments TMP422",
|
||||
driver => "tmp421",
|
||||
i2c_addrs => [0x4c..0x4f],
|
||||
i2c_detect => sub { tmp42x_detect(@_, 1); },
|
||||
}, {
|
||||
name => "Texas Instruments TMP423",
|
||||
driver => "tmp421",
|
||||
i2c_addrs => [0x4c, 0x4d],
|
||||
i2c_detect => sub { tmp42x_detect(@_, 2); },
|
||||
}, {
|
||||
name => "National Semiconductor LM95231",
|
||||
driver => "to-be-written",
|
||||
@@ -3906,6 +3921,26 @@ sub lm90_detect
|
||||
return;
|
||||
}
|
||||
|
||||
# Chip to detect: 0 = TMP421, 1 = TMP422, 2 = TMP423
|
||||
# Registers used:
|
||||
# 0xfe: Manufactorer ID
|
||||
# 0xff: Device ID
|
||||
sub tmp42x_detect()
|
||||
{
|
||||
my ($file, $addr, $chip) = @_;
|
||||
|
||||
my $mid = i2c_smbus_read_byte_data($file, 0xfe);
|
||||
my $cid = i2c_smbus_read_byte_data($file, 0xff);
|
||||
|
||||
return if ($mid != 0x55);
|
||||
|
||||
return 6 if ($chip == 0 && $cid == 0x21); # TMP421
|
||||
return 6 if ($chip == 1 && $cid == 0x22); # TMP422
|
||||
return 6 if ($chip == 2 && $cid == 0x23); # TMP423
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Registers used:
|
||||
# 0x03: Configuration (no low nibble, returns the previous low nibble)
|
||||
# 0x04: Conversion rate
|
||||
|
Reference in New Issue
Block a user