diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index 2dc1cea3..a472c790 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -228,10 +228,12 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, /* Now, we do the remaining detection. */ if (kind < 0) { - if ( - (adm1021_read_value(new_client, ADM1021_REG_STATUS) & - 0x03) != 0x00) - goto error1; + if ((adm1021_read_value(new_client, ADM1021_REG_STATUS) & 0x03) != 0x00 + || (adm1021_read_value(new_client, ADM1021_REG_CONFIG_R) & 0x3F) != 0x00 + || (adm1021_read_value(new_client, ADM1021_REG_CONV_RATE_R) & 0xF8) != 0x00) { + err = -ENODEV; + goto error1; + } } /* Determine the chip type. */ @@ -239,7 +241,7 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, if (kind <= 0) { i = adm1021_read_value(new_client, ADM1021_REG_MAN_ID); if (i == 0x41) - if ((adm1021_read_value (new_client, ADM1021_REG_DEV_ID) & 0x0F0) == 0x030) + if ((adm1021_read_value (new_client, ADM1021_REG_DEV_ID) & 0xF0) == 0x30) kind = adm1023; else kind = adm1021; @@ -251,13 +253,14 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, (adm1021_read_value (new_client, ADM1021_REG_DEV_ID) == 0x01)) kind = max1617a; - /* LM84 Mfr ID in a different place */ - else - if (adm1021_read_value - (new_client, ADM1021_REG_CONV_RATE_R) == 0x00) - kind = lm84; else if (i == 0x54) kind = mc1066; + /* LM84 Mfr ID in a different place, and it has more unused bits */ + else if (adm1021_read_value(new_client, ADM1021_REG_CONV_RATE_R) == 0x00 + && (kind == 0 /* skip extra detection */ + || ((adm1021_read_value(new_client, ADM1021_REG_CONFIG_R) & 0x7F) == 0x00 + && (adm1021_read_value(new_client, ADM1021_REG_STATUS) & 0xAB) == 0x00))) + kind = lm84; else kind = max1617; } @@ -286,12 +289,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, } else if (kind == mc1066) { type_name = "mc1066"; client_name = "MC1066 chip"; - } else { -#ifdef DEBUG - printk("adm1021.o: Internal error: unknown kind (%d)?!?", - kind); -#endif - goto error1; } /* Fill in the remaining client fields and put it into the global list */ @@ -316,7 +313,8 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, data->sysctl_id = i; /* Initialize the ADM1021 chip */ - adm1021_init_client(new_client); + if (kind != lm84) + adm1021_init_client(new_client); return 0; error4: