diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/hwmon/lm63.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/hwmon/lm63.c')
-rw-r--r-- | drivers/hwmon/lm63.c | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 3195a265f0e9..bf81aff7051d 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -56,12 +56,6 @@ | |||
56 | static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; | 56 | static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Insmod parameters | ||
60 | */ | ||
61 | |||
62 | I2C_CLIENT_INSMOD_1(lm63); | ||
63 | |||
64 | /* | ||
65 | * The LM63 registers | 59 | * The LM63 registers |
66 | */ | 60 | */ |
67 | 61 | ||
@@ -134,8 +128,7 @@ static int lm63_remove(struct i2c_client *client); | |||
134 | 128 | ||
135 | static struct lm63_data *lm63_update_device(struct device *dev); | 129 | static struct lm63_data *lm63_update_device(struct device *dev); |
136 | 130 | ||
137 | static int lm63_detect(struct i2c_client *client, int kind, | 131 | static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info); |
138 | struct i2c_board_info *info); | ||
139 | static void lm63_init_client(struct i2c_client *client); | 132 | static void lm63_init_client(struct i2c_client *client); |
140 | 133 | ||
141 | /* | 134 | /* |
@@ -143,7 +136,7 @@ static void lm63_init_client(struct i2c_client *client); | |||
143 | */ | 136 | */ |
144 | 137 | ||
145 | static const struct i2c_device_id lm63_id[] = { | 138 | static const struct i2c_device_id lm63_id[] = { |
146 | { "lm63", lm63 }, | 139 | { "lm63", 0 }, |
147 | { } | 140 | { } |
148 | }; | 141 | }; |
149 | MODULE_DEVICE_TABLE(i2c, lm63_id); | 142 | MODULE_DEVICE_TABLE(i2c, lm63_id); |
@@ -157,7 +150,7 @@ static struct i2c_driver lm63_driver = { | |||
157 | .remove = lm63_remove, | 150 | .remove = lm63_remove, |
158 | .id_table = lm63_id, | 151 | .id_table = lm63_id, |
159 | .detect = lm63_detect, | 152 | .detect = lm63_detect, |
160 | .address_data = &addr_data, | 153 | .address_list = normal_i2c, |
161 | }; | 154 | }; |
162 | 155 | ||
163 | /* | 156 | /* |
@@ -423,44 +416,38 @@ static const struct attribute_group lm63_group_fan1 = { | |||
423 | */ | 416 | */ |
424 | 417 | ||
425 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 418 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
426 | static int lm63_detect(struct i2c_client *new_client, int kind, | 419 | static int lm63_detect(struct i2c_client *new_client, |
427 | struct i2c_board_info *info) | 420 | struct i2c_board_info *info) |
428 | { | 421 | { |
429 | struct i2c_adapter *adapter = new_client->adapter; | 422 | struct i2c_adapter *adapter = new_client->adapter; |
423 | u8 man_id, chip_id, reg_config1, reg_config2; | ||
424 | u8 reg_alert_status, reg_alert_mask; | ||
430 | 425 | ||
431 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 426 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
432 | return -ENODEV; | 427 | return -ENODEV; |
433 | 428 | ||
434 | if (kind < 0) { /* must identify */ | 429 | man_id = i2c_smbus_read_byte_data(new_client, LM63_REG_MAN_ID); |
435 | u8 man_id, chip_id, reg_config1, reg_config2; | 430 | chip_id = i2c_smbus_read_byte_data(new_client, LM63_REG_CHIP_ID); |
436 | u8 reg_alert_status, reg_alert_mask; | 431 | |
437 | 432 | reg_config1 = i2c_smbus_read_byte_data(new_client, | |
438 | man_id = i2c_smbus_read_byte_data(new_client, | 433 | LM63_REG_CONFIG1); |
439 | LM63_REG_MAN_ID); | 434 | reg_config2 = i2c_smbus_read_byte_data(new_client, |
440 | chip_id = i2c_smbus_read_byte_data(new_client, | 435 | LM63_REG_CONFIG2); |
441 | LM63_REG_CHIP_ID); | 436 | reg_alert_status = i2c_smbus_read_byte_data(new_client, |
442 | reg_config1 = i2c_smbus_read_byte_data(new_client, | 437 | LM63_REG_ALERT_STATUS); |
443 | LM63_REG_CONFIG1); | 438 | reg_alert_mask = i2c_smbus_read_byte_data(new_client, |
444 | reg_config2 = i2c_smbus_read_byte_data(new_client, | 439 | LM63_REG_ALERT_MASK); |
445 | LM63_REG_CONFIG2); | 440 | |
446 | reg_alert_status = i2c_smbus_read_byte_data(new_client, | 441 | if (man_id != 0x01 /* National Semiconductor */ |
447 | LM63_REG_ALERT_STATUS); | 442 | || chip_id != 0x41 /* LM63 */ |
448 | reg_alert_mask = i2c_smbus_read_byte_data(new_client, | 443 | || (reg_config1 & 0x18) != 0x00 |
449 | LM63_REG_ALERT_MASK); | 444 | || (reg_config2 & 0xF8) != 0x00 |
450 | 445 | || (reg_alert_status & 0x20) != 0x00 | |
451 | if (man_id == 0x01 /* National Semiconductor */ | 446 | || (reg_alert_mask & 0xA4) != 0xA4) { |
452 | && chip_id == 0x41 /* LM63 */ | 447 | dev_dbg(&adapter->dev, |
453 | && (reg_config1 & 0x18) == 0x00 | 448 | "Unsupported chip (man_id=0x%02X, chip_id=0x%02X)\n", |
454 | && (reg_config2 & 0xF8) == 0x00 | 449 | man_id, chip_id); |
455 | && (reg_alert_status & 0x20) == 0x00 | 450 | return -ENODEV; |
456 | && (reg_alert_mask & 0xA4) == 0xA4) { | ||
457 | kind = lm63; | ||
458 | } else { /* failed */ | ||
459 | dev_dbg(&adapter->dev, "Unsupported chip " | ||
460 | "(man_id=0x%02X, chip_id=0x%02X).\n", | ||
461 | man_id, chip_id); | ||
462 | return -ENODEV; | ||
463 | } | ||
464 | } | 451 | } |
465 | 452 | ||
466 | strlcpy(info->type, "lm63", I2C_NAME_SIZE); | 453 | strlcpy(info->type, "lm63", I2C_NAME_SIZE); |