From d3383e4082eab24b34742707dbc1e4f19df1b1a6 Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sun, 19 Mar 2000 22:06:54 +0000 Subject: [PATCH] (mds) add ADM1025 detection. No driver. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@784 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index da780012..e17b8cdd 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -243,7 +243,7 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); ); use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect - lm80_detect w83781d_detect w83781d_alias_detect + lm80_detect w83781d_detect w83781d_alias_detect adm1025_detect w83781d_isa_detect gl518sm_detect gl520sm_detect adm9240_detect adm1021_detect sis5595_isa_detect eeprom_detect via686a_isa_detect adm1022_detect ltc1710_detect gl525sm_detect ddcmonitor_detect); @@ -400,6 +400,12 @@ use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect i2c_addrs => [0x2c..0x2f], i2c_detect => sub { adm9240_detect 2, @_ } }, + { + name => "Analog Devices ADM1025", +# driver => "xxxxxxx", + i2c_addrs => [0x2c..0x2f], + i2c_detect => sub { adm1025_detect 0, @_ } + }, { name => "Analog Devices ADM1021", driver => "adm1021", @@ -1622,6 +1628,28 @@ sub adm1022_detect return (8); } +# $_[0]: Chip to detect (0 = ADM1025) +# $_[1]: A reference to the file descriptor to access this chip. +# We may assume an i2c_set_slave_addr was already done. +# $_[2]: Address +# Returns: undef if not detected, (8) if detected. +# Registers used: +# 0x3e: Company ID +# 0x3f: Revision +# 0x40: Configuration +# Note: Detection overrules a previous LM78 or ADM9240 detection +sub adm1025_detect +{ + my $reg; + my ($chip, $file,$addr) = @_; + $reg = i2c_smbus_read_byte_data($file,0x3e); + return unless ($chip == 0 and $reg == 0x41); + return unless (i2c_smbus_read_byte_data($file,0x40) & 0x80) == 0x00; + return unless (i2c_smbus_read_byte_data($file,0x3f) & 0xc0) == 0x20; + + return (8); +} + # $_[0]: Chip to detect # (0 = ADM1021, 1 = MAX1617, 2 = MAX1617A, 3 = THMC10, 4 = LM84, 5 = GL523) # $_[1]: A reference to the file descriptor to access this chip.