Skip to content

Commit

Permalink
hwmon: (lm90) Make SA56004 detection more robust
Browse files Browse the repository at this point in the history
With a device ID register value of 0, the SA56004 detection is rather
weak. Check several other register too to confirm the detection, as we
do for other supported devices.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Stijn Devriendt <sdevrien@cisco.com>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Stijn Devriendt <sdevrien@cisco.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
  • Loading branch information
Jean Delvare authored and Guenter Roeck committed Jul 29, 2011
1 parent a095f68 commit 6d101c5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,8 +1283,19 @@ static int lm90_detect(struct i2c_client *new_client,
}
}
} else
if (man_id == 0xA1) { /* NXP Semiconductor/Philips */
if (chip_id == 0x00 && address >= 0x48 && address <= 0x4F) {
if (address >= 0x48 && address <= 0x4F
&& man_id == 0xA1) { /* NXP Semiconductor/Philips */
int reg_config2;

reg_config2 = i2c_smbus_read_byte_data(new_client,
LM90_REG_R_CONFIG2);
if (reg_config2 < 0)
return -ENODEV;

if (chip_id == 0x00
&& (reg_config1 & 0x2A) == 0x00
&& (reg_config2 & 0xFE) == 0x00
&& reg_convrate <= 0x09) {
name = "sa56004";
}
}
Expand Down

0 comments on commit 6d101c5

Please sign in to comment.