diff options
Diffstat (limited to 'drivers/hwmon/lm92.c')
-rw-r--r-- | drivers/hwmon/lm92.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index b2e00c5a7eec..7c31e6205f85 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c | |||
@@ -54,9 +54,6 @@ | |||
54 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, | 54 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, |
55 | I2C_CLIENT_END }; | 55 | I2C_CLIENT_END }; |
56 | 56 | ||
57 | /* Insmod parameters */ | ||
58 | I2C_CLIENT_INSMOD_1(lm92); | ||
59 | |||
60 | /* The LM92 registers */ | 57 | /* The LM92 registers */ |
61 | #define LM92_REG_CONFIG 0x01 /* 8-bit, RW */ | 58 | #define LM92_REG_CONFIG 0x01 /* 8-bit, RW */ |
62 | #define LM92_REG_TEMP 0x00 /* 16-bit, RO */ | 59 | #define LM92_REG_TEMP 0x00 /* 16-bit, RO */ |
@@ -319,35 +316,26 @@ static const struct attribute_group lm92_group = { | |||
319 | }; | 316 | }; |
320 | 317 | ||
321 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 318 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
322 | static int lm92_detect(struct i2c_client *new_client, int kind, | 319 | static int lm92_detect(struct i2c_client *new_client, |
323 | struct i2c_board_info *info) | 320 | struct i2c_board_info *info) |
324 | { | 321 | { |
325 | struct i2c_adapter *adapter = new_client->adapter; | 322 | struct i2c_adapter *adapter = new_client->adapter; |
323 | u8 config; | ||
324 | u16 man_id; | ||
326 | 325 | ||
327 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | 326 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
328 | | I2C_FUNC_SMBUS_WORD_DATA)) | 327 | | I2C_FUNC_SMBUS_WORD_DATA)) |
329 | return -ENODEV; | 328 | return -ENODEV; |
330 | 329 | ||
331 | /* A negative kind means that the driver was loaded with no force | 330 | config = i2c_smbus_read_byte_data(new_client, LM92_REG_CONFIG); |
332 | parameter (default), so we must identify the chip. */ | 331 | man_id = i2c_smbus_read_word_data(new_client, LM92_REG_MAN_ID); |
333 | if (kind < 0) { | 332 | |
334 | u8 config = i2c_smbus_read_byte_data(new_client, | 333 | if ((config & 0xe0) == 0x00 && man_id == 0x0180) |
335 | LM92_REG_CONFIG); | 334 | pr_info("lm92: Found National Semiconductor LM92 chip\n"); |
336 | u16 man_id = i2c_smbus_read_word_data(new_client, | 335 | else if (max6635_check(new_client)) |
337 | LM92_REG_MAN_ID); | 336 | pr_info("lm92: Found Maxim MAX6635 chip\n"); |
338 | 337 | else | |
339 | if ((config & 0xe0) == 0x00 | 338 | return -ENODEV; |
340 | && man_id == 0x0180) { | ||
341 | pr_info("lm92: Found National Semiconductor LM92 chip\n"); | ||
342 | kind = lm92; | ||
343 | } else | ||
344 | if (max6635_check(new_client)) { | ||
345 | pr_info("lm92: Found Maxim MAX6635 chip\n"); | ||
346 | kind = lm92; /* No separate prefix */ | ||
347 | } | ||
348 | else | ||
349 | return -ENODEV; | ||
350 | } | ||
351 | 339 | ||
352 | strlcpy(info->type, "lm92", I2C_NAME_SIZE); | 340 | strlcpy(info->type, "lm92", I2C_NAME_SIZE); |
353 | 341 | ||
@@ -410,7 +398,7 @@ static int lm92_remove(struct i2c_client *client) | |||
410 | */ | 398 | */ |
411 | 399 | ||
412 | static const struct i2c_device_id lm92_id[] = { | 400 | static const struct i2c_device_id lm92_id[] = { |
413 | { "lm92", lm92 }, | 401 | { "lm92", 0 }, |
414 | /* max6635 could be added here */ | 402 | /* max6635 could be added here */ |
415 | { } | 403 | { } |
416 | }; | 404 | }; |
@@ -425,7 +413,7 @@ static struct i2c_driver lm92_driver = { | |||
425 | .remove = lm92_remove, | 413 | .remove = lm92_remove, |
426 | .id_table = lm92_id, | 414 | .id_table = lm92_id, |
427 | .detect = lm92_detect, | 415 | .detect = lm92_detect, |
428 | .address_data = &addr_data, | 416 | .address_list = normal_i2c, |
429 | }; | 417 | }; |
430 | 418 | ||
431 | static int __init sensors_lm92_init(void) | 419 | static int __init sensors_lm92_init(void) |