aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gl518sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/gl518sm.c')
-rw-r--r--drivers/hwmon/gl518sm.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
index 7820df45d77a..1d69458aa0b6 100644
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -488,36 +488,21 @@ static int gl518_detect(struct i2c_client *client, int kind,
488 struct i2c_board_info *info) 488 struct i2c_board_info *info)
489{ 489{
490 struct i2c_adapter *adapter = client->adapter; 490 struct i2c_adapter *adapter = client->adapter;
491 int i; 491 int rev;
492 492
493 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | 493 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
494 I2C_FUNC_SMBUS_WORD_DATA)) 494 I2C_FUNC_SMBUS_WORD_DATA))
495 return -ENODEV; 495 return -ENODEV;
496 496
497 /* Now, we do the remaining detection. */ 497 /* Now, we do the remaining detection. */
498 498 if ((gl518_read_value(client, GL518_REG_CHIP_ID) != 0x80)
499 if (kind < 0) { 499 || (gl518_read_value(client, GL518_REG_CONF) & 0x80))
500 if ((gl518_read_value(client, GL518_REG_CHIP_ID) != 0x80) 500 return -ENODEV;
501 || (gl518_read_value(client, GL518_REG_CONF) & 0x80))
502 return -ENODEV;
503 }
504 501
505 /* Determine the chip type. */ 502 /* Determine the chip type. */
506 if (kind <= 0) { 503 rev = gl518_read_value(client, GL518_REG_REVISION);
507 i = gl518_read_value(client, GL518_REG_REVISION); 504 if (rev != 0x00 && rev != 0x80)
508 if (i == 0x00) { 505 return -ENODEV;
509 kind = gl518sm_r00;
510 } else if (i == 0x80) {
511 kind = gl518sm_r80;
512 } else {
513 if (kind <= 0)
514 dev_info(&adapter->dev,
515 "Ignoring 'force' parameter for unknown "
516 "chip at adapter %d, address 0x%02x\n",
517 i2c_adapter_id(adapter), client->addr);
518 return -ENODEV;
519 }
520 }
521 506
522 strlcpy(info->type, "gl518sm", I2C_NAME_SIZE); 507 strlcpy(info->type, "gl518sm", I2C_NAME_SIZE);
523 508