diff options
| -rw-r--r-- | drivers/hwmon/lm85.c | 32 |
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 | ||
| 1138 | static 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 */ |
| 1137 | static int lm85_detect(struct i2c_client *client, int kind, | 1159 | static 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) { |
