Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 162612
b: refs/heads/master
c: 5cfaf33
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare committed Sep 15, 2009
1 parent a611ca7 commit d13ac0c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: afc31875fa5774dbc117f8c62034d77390156edc
refs/heads/master: 5cfaf338134605ce8d9272b9c16605bc920d25be
32 changes: 32 additions & 0 deletions trunk/drivers/hwmon/lm85.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ I2C_CLIENT_INSMOD_7(lm85b, lm85c, adm1027, adt7463, adt7468, emc6d100,
#define LM85_VERSTEP_GENERIC2 0x70
#define LM85_VERSTEP_LM85C 0x60
#define LM85_VERSTEP_LM85B 0x62
#define LM85_VERSTEP_LM96000_1 0x68
#define LM85_VERSTEP_LM96000_2 0x69
#define LM85_VERSTEP_ADM1027 0x60
#define LM85_VERSTEP_ADT7463 0x62
#define LM85_VERSTEP_ADT7463C 0x6A
Expand Down Expand Up @@ -1133,6 +1135,26 @@ static void lm85_init_client(struct i2c_client *client)
dev_warn(&client->dev, "Device is not ready\n");
}

static int lm85_is_fake(struct i2c_client *client)
{
/*
* Differenciate between real LM96000 and Winbond WPCD377I. The latter
* emulate the former except that it has no hardware monitoring function
* so the readings are always 0.
*/
int i;
u8 in_temp, fan;

for (i = 0; i < 8; i++) {
in_temp = i2c_smbus_read_byte_data(client, 0x20 + i);
fan = i2c_smbus_read_byte_data(client, 0x28 + i);
if (in_temp != 0x00 || fan != 0xff)
return 0;
}

return 1;
}

/* Return 0 if detection is successful, -ENODEV otherwise */
static int lm85_detect(struct i2c_client *client, int kind,
struct i2c_board_info *info)
Expand Down Expand Up @@ -1173,6 +1195,16 @@ static int lm85_detect(struct i2c_client *client, int kind,
case LM85_VERSTEP_LM85B:
kind = lm85b;
break;
case LM85_VERSTEP_LM96000_1:
case LM85_VERSTEP_LM96000_2:
/* Check for Winbond WPCD377I */
if (lm85_is_fake(client)) {
dev_dbg(&adapter->dev,
"Found Winbond WPCD377I, "
"ignoring\n");
return -ENODEV;
}
break;
}
} else if (company == LM85_COMPANY_ANALOG_DEV) {
switch (verstep) {
Expand Down

0 comments on commit d13ac0c

Please sign in to comment.