From a312cc6da1dd71c0fa47870c3c408a8e4f6da920 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 15 Dec 2009 16:53:00 +0000 Subject: [PATCH] Add detection for Texas Instruments AMC6821. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5811 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/detect/sensors-detect | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGES b/CHANGES index 3a0c3795..a8feee06 100644 --- a/CHANGES +++ b/CHANGES @@ -41,6 +41,7 @@ SVN-HEAD More known revisions for the ADT7476 Add detection for Nuvoton W83L771AWG/ASG Add detection for VIA Nano + Add detection for Texas Instruments AMC6821 sysconfig-lm_sensors-convert: Fix exit code 3.1.1 (2009-06-21) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 63291fe3..fdca68aa 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -937,6 +937,11 @@ use vars qw(@i2c_adapter_names); driver => "tmp421", i2c_addrs => [0x4c, 0x4d], i2c_detect => sub { tmp42x_detect(@_, 2); }, + }, { + name => "Texas Instruments AMC6821", + driver => "amc6821", + i2c_addrs => [0x18..0x1a, 0x2c..0x2e, 0x4c..0x4e], + i2c_detect => sub { amc6821_detect(@_); }, }, { name => "National Semiconductor LM95231", driver => "to-be-written", @@ -4047,6 +4052,22 @@ sub tmp42x_detect() return; } +# Registers used: +# 0x3d: Device ID +# 0x3e: Company ID +sub amc6821_detect() +{ + my ($file, $addr) = @_; + + my $dev_id = i2c_smbus_read_byte_data($file, 0x3d); + my $comp_id = i2c_smbus_read_byte_data($file, 0x3e); + + return if ($comp_id != 0x49); # Texas Instruments + return 5 if ($dev_id == 0x21); # AMC6821 + + return; +} + # Registers used: # 0x03: Configuration (no low nibble, returns the previous low nibble) # 0x04: Conversion rate