From dc8835e31fcde254b6d6f617e85762b4f5228fa3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 13 Mar 2004 18:29:26 +0000 Subject: [PATCH] Add ALi M5879 detection. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2353 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 43 +++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 43d78ba2..10990d80 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -804,7 +804,8 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect ipmi_smic_detect via8231_isa_detect lm85_detect smartbatt_detect adm1026_detect w83l785ts_detect lm83_detect lm90_detect saa1064_detect w83l784r_detect mozart_detect max6650_detect - fscher_detect adm1029_detect adm1031_detect max6900_detect); + fscher_detect adm1029_detect adm1031_detect max6900_detect + m5879_detect); # This is a list of all recognized chips. # Each entry must have the following fields: @@ -1264,6 +1265,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect i2c_addrs => [0x73], i2c_detect => sub { fscher_detect @_ }, }, + { + name => "ALi M5879", + driver => "to-be-written", + i2c_addrs => [0x2c..0x2d], + i2c_detect => sub { m5879_detect @_}, + } , { name => "Philips Semiconductors SAA1064", driver => "saa1064", @@ -2595,7 +2602,7 @@ sub mtp008_detect # $_[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, (7) if detected. +# Returns: undef if not detected, (6) if detected. # Registers used: # 0x40: Configuration # 0x48: Full I2C Address @@ -2612,7 +2619,7 @@ sub lm78_detect return unless ($chip == 0 and ($reg == 0x00 or $reg == 0x20)) or ($chip == 1 and $reg == 0x40) or ($chip == 2 and ($reg & 0xfe) == 0xc0); - return (7); + return (6); } # $_[0]: Chip to detect (0 = LM78, 1 = LM78-J, 2 = LM79) @@ -3733,6 +3740,36 @@ sub fscher_detect return (8); } +# $_[0]: A reference to the file descriptor to access this chip. +# We may assume an i2c_set_slave_addr was already done. +# $_[1]: Address +# Returns: undef if not detected, (7) if detected. +# Registers used: +# 0x3F: Revision ID +# 0x48: Address +# 0x4A, 0x4B, 0x4F, 0x57, 0x58: Reserved bits. +# We do not use 0x49's reserved bits on purpose. The register is named +# "VID4/Device ID" so it is doubtful bits 7-1 are really unused. +sub m5879_detect +{ + my ($file, $addr) = @_; + + return + unless i2c_smbus_read_byte_data($file, 0x3F) == 0x01; + + return + unless i2c_smbus_read_byte_data($file, 0x48) == $addr; + + return + unless (i2c_smbus_read_byte_data($file, 0x4A) & 0x06) == 0 + and (i2c_smbus_read_byte_data($file, 0x4B) & 0xFC) == 0 + and (i2c_smbus_read_byte_data($file, 0x4F) & 0xFC) == 0 + and (i2c_smbus_read_byte_data($file, 0x57) & 0xFE) == 0 + and (i2c_smbus_read_byte_data($file, 0x58) & 0xEF) == 0; + + return (7); +} + # $_[0]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. # $_[1]: Address