From 3fb3c13ccdf6caeec15f66dd86bda93eb1b5b334 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 24 Jan 2007 07:29:10 +0000 Subject: [PATCH] sensors-detect: Add detection of the Maxim MAX6655/MAX6656. Patch from Olexiy Avramchenko. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4305 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ prog/detect/sensors-detect | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGES b/CHANGES index b6f26bcb..dc44b16c 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,8 @@ lm_sensors CHANGES file SVN HEAD Program sensors-detect: Only probe relevant I2C addresses Drop ARP-capable device detection + Add Maxim MAX6655/MAX6656 detection + (Olexiy Avramchenko) 2.10.2 (20070115) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 1919eb88..2c43a85c 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1143,6 +1143,12 @@ use vars qw(@pci_adapters_sis5595 @pci_adapters_sis645 @pci_adapters_sis96x); i2c_addrs => [0x1b,0x1f,0x48,0x4b], i2c_detect => sub { max6650_detect(0, @_); }, }, + { + name => "Maxim MAX6655/MAX6656", + driver => "max6655", + i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], + i2c_detect => sub { max6655_detect(0, @_); }, + }, { name => "TI THMC10", driver => "adm1021", @@ -5211,6 +5217,23 @@ sub max6650_detect return 4; } +# $_[0]: Chip to detect. Always zero. +# $_[1]: A reference to the file descriptor to access this chip. +# $_[2]: Address. +# +# Returns: undef if not detected, 4 if detected. +sub max6655_detect +{ + my ($chip, $file, $addr) = @_; + + # checking RDID (Device ID) + return unless i2c_smbus_read_byte_data($file, 0xfe) == 0x0a; + # checking RDRV (Manufacturer ID) + return unless i2c_smbus_read_byte_data($file, 0xff) == 0x4d; + + return 4; +} + # $_[0]: Chip to detect (0 = VT1211) # $_[1]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done.