diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index b7b97326..39719c02 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -35,7 +35,7 @@ static unsigned int normal_isa[] = {SENSORS_ISA_END}; static unsigned int normal_isa_range[] = {SENSORS_ISA_END}; /* Insmod parameters */ -SENSORS_INSMOD_2(adm1021,max1617); +SENSORS_INSMOD_3(adm1021,max1617,max1617a); /* adm1021 constants specified below */ @@ -44,8 +44,9 @@ SENSORS_INSMOD_2(adm1021,max1617); #define ADM1021_REG_TEMP 0x00 #define ADM1021_REG_REMOTE_TEMP 0x01 #define ADM1021_REG_STATUS 0x02 -#define ADM1021_REG_DEVICE_ID 0x0FE /* should always read 0x41 */ -#define ADM1021_REG_DIE_CODE 0x0FF +#define ADM1021_REG_MAN_ID 0x0FE /* should always read 0x41 */ +#define ADM1021_REG_DEV_ID 0x0FF /* ADM1021 */ +#define ADM1021_REG_DIE_CODE 0x0FF /* MAX1617A */ /* These use different addresses for reading/writing */ #define ADM1021_REG_CONFIG_R 0x03 #define ADM1021_REG_CONFIG_W 0x09 @@ -211,9 +212,12 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) /* Determine the chip type. */ if (kind <= 0) { - i = adm1021_read_value(new_client,ADM1021_REG_DEVICE_ID); + i = adm1021_read_value(new_client,ADM1021_REG_MAN_ID); if (i == 0x41) kind = max1617; + else if ((i== 0x4d) && + (adm1021_read_value(new_client,ADM1021_REG_DEV_ID) == 0x01)) + kind = max1617a; else kind = adm1021; } @@ -221,6 +225,9 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) if (kind == max1617) { type_name = "max1617"; client_name = "MAX1617 chip"; + } else if (kind == max1617a) { + type_name = "max1617a"; + client_name = "MAX1617A chip"; } else if (kind == adm1021) { type_name = "adm1021"; client_name = "ADM1021 chip"; diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index bd0118f7..e89ae46b 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -219,6 +219,12 @@ use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], i2c_detect => sub { adm1021_detect 1, @_ }, }, + { + name => "Maxim MAX1617A", + driver => "adm1021", + i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], + i2c_detect => sub { adm1021_detect 2, @_ }, + }, { name => "Silicon Integrated Systems SIS5595", driver => "sis5595", @@ -1311,7 +1317,7 @@ sub adm9240_detect return (8); } -# $_[0]: Chip to detect (0 = ADM1021, 1 = MAX1617) +# $_[0]: Chip to detect (0 = ADM1021, 1 = MAX1617, 2 = MAX1617A) # $_[1]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. # $_[2]: Address @@ -1326,13 +1332,15 @@ sub adm1021_detect my $reg; my ($chip, $file,$addr) = @_; return if $chip == 0 and i2c_smbus_read_byte_data($file,0xfe) != 0x41; + return if $chip == 2 and i2c_smbus_read_byte_data($file,0xfe) != 0x4d and + i2c_smbus_read_byte_data($file,0xff) != 0x01; # The remaining things are flaky at best. Perhaps something can be done # with the fact that some registers are unreadable? return if (i2c_smbus_read_byte_data($file,0x02) & 0x03) != 0; - if ($chip == 0) { - return (6); - } else { + if ($chip == 1) { return (3); + } else { + return (6); } }