mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
hwmon: (lm75) Strengthen detect function
A chip returning 0x00 in all registers is erroneously detected as LM75. Check hysteresis and temperature limit registers and abort if both are 0 to reduce the likelyhood for this to happen. Reviewed-by: Rob Coulson <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
This commit is contained in:
parent
b95579cd87
commit
4ad40cc568
1 changed files with 6 additions and 0 deletions
|
|
@ -415,6 +415,12 @@ static int lm75_detect(struct i2c_client *new_client,
|
|||
|| i2c_smbus_read_byte_data(new_client, 7) != os)
|
||||
return -ENODEV;
|
||||
}
|
||||
/*
|
||||
* It is very unlikely that this is a LM75 if both
|
||||
* hysteresis and temperature limit registers are 0.
|
||||
*/
|
||||
if (hyst == 0 && os == 0)
|
||||
return -ENODEV;
|
||||
|
||||
/* Addresses cycling */
|
||||
for (i = 8; i <= 248; i += 40) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue