aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-09-15 11:18:14 -0400
committerJean Delvare <khali@linux-fr.org>2009-09-15 11:18:14 -0400
commit5cfaf338134605ce8d9272b9c16605bc920d25be (patch)
tree405140965ec9aec82cb5f180afa6aefdc4413632 /drivers/hwmon
parentafc31875fa5774dbc117f8c62034d77390156edc (diff)
hwmon: (lm85) Don't bind to Winbond/Nuvoton WPCD377I
The Winbond/Nuvoton WPCD377I is the reduced version of a Super-I/O which emulates the National Semiconductor LM96000 hardware monitoring chips, but without the hardware monitoring part. Instead of plain disabling the emulation, the vendor left the emulated chip visible, but all monitored values are always zero. This is rather confusing for the users. So detect this case and refuse to bind to such fake chips. This fixes lm-sensors ticket #2182: http://www.lm-sensors.org/ticket/2182 Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm85.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index b251d8674b41..6c53d987de10 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -75,6 +75,8 @@ I2C_CLIENT_INSMOD_7(lm85b, lm85c, adm1027, adt7463, adt7468, emc6d100,
75#define LM85_VERSTEP_GENERIC2 0x70 75#define LM85_VERSTEP_GENERIC2 0x70
76#define LM85_VERSTEP_LM85C 0x60 76#define LM85_VERSTEP_LM85C 0x60
77#define LM85_VERSTEP_LM85B 0x62 77#define LM85_VERSTEP_LM85B 0x62
78#define LM85_VERSTEP_LM96000_1 0x68
79#define LM85_VERSTEP_LM96000_2 0x69
78#define LM85_VERSTEP_ADM1027 0x60 80#define LM85_VERSTEP_ADM1027 0x60
79#define LM85_VERSTEP_ADT7463 0x62 81#define LM85_VERSTEP_ADT7463 0x62
80#define LM85_VERSTEP_ADT7463C 0x6A 82#define LM85_VERSTEP_ADT7463C 0x6A
@@ -1133,6 +1135,26 @@ static void lm85_init_client(struct i2c_client *client)
1133 dev_warn(&client->dev, "Device is not ready\n"); 1135 dev_warn(&client->dev, "Device is not ready\n");
1134} 1136}
1135 1137
1138static int lm85_is_fake(struct i2c_client *client)
1139{
1140 /*
1141 * Differenciate between real LM96000 and Winbond WPCD377I. The latter
1142 * emulate the former except that it has no hardware monitoring function
1143 * so the readings are always 0.
1144 */
1145 int i;
1146 u8 in_temp, fan;
1147
1148 for (i = 0; i < 8; i++) {
1149 in_temp = i2c_smbus_read_byte_data(client, 0x20 + i);
1150 fan = i2c_smbus_read_byte_data(client, 0x28 + i);
1151 if (in_temp != 0x00 || fan != 0xff)
1152 return 0;
1153 }
1154
1155 return 1;
1156}
1157
1136/* Return 0 if detection is successful, -ENODEV otherwise */ 1158/* Return 0 if detection is successful, -ENODEV otherwise */
1137static int lm85_detect(struct i2c_client *client, int kind, 1159static int lm85_detect(struct i2c_client *client, int kind,
1138 struct i2c_board_info *info) 1160 struct i2c_board_info *info)
@@ -1173,6 +1195,16 @@ static int lm85_detect(struct i2c_client *client, int kind,
1173 case LM85_VERSTEP_LM85B: 1195 case LM85_VERSTEP_LM85B:
1174 kind = lm85b; 1196 kind = lm85b;
1175 break; 1197 break;
1198 case LM85_VERSTEP_LM96000_1:
1199 case LM85_VERSTEP_LM96000_2:
1200 /* Check for Winbond WPCD377I */
1201 if (lm85_is_fake(client)) {
1202 dev_dbg(&adapter->dev,
1203 "Found Winbond WPCD377I, "
1204 "ignoring\n");
1205 return -ENODEV;
1206 }
1207 break;
1176 } 1208 }
1177 } else if (company == LM85_COMPANY_ANALOG_DEV) { 1209 } else if (company == LM85_COMPANY_ANALOG_DEV) {
1178 switch (verstep) { 1210 switch (verstep) {