aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm63.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-05-27 13:58:38 -0400
committerJean Delvare <khali@linux-fr.org>2010-05-27 13:58:38 -0400
commit10f2ed31aae11040dfd64cee10c47db79b4b4647 (patch)
treebae22e065d19fba90db1f25c976166d742dd086e /drivers/hwmon/lm63.c
parent70dd6beac02f43a5099fcf5fddf68cfee0cbf479 (diff)
hwmon: (lm63) Add basic support for LM64
The LM64 appears to be an LM63 with added GPIO lines. Add support for the hwmon functionality - GPIO can be added at some later stage if someone has a need for them. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm63.c')
-rw-r--r--drivers/hwmon/lm63.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index bf81aff7051d..776aeb3019d2 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -53,7 +53,7 @@
53 * Address is fully defined internally and cannot be changed. 53 * Address is fully defined internally and cannot be changed.
54 */ 54 */
55 55
56static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; 56static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END };
57 57
58/* 58/*
59 * The LM63 registers 59 * The LM63 registers
@@ -131,12 +131,15 @@ static struct lm63_data *lm63_update_device(struct device *dev);
131static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info); 131static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info);
132static void lm63_init_client(struct i2c_client *client); 132static void lm63_init_client(struct i2c_client *client);
133 133
134enum chips { lm63, lm64 };
135
134/* 136/*
135 * Driver data (common to all clients) 137 * Driver data (common to all clients)
136 */ 138 */
137 139
138static const struct i2c_device_id lm63_id[] = { 140static const struct i2c_device_id lm63_id[] = {
139 { "lm63", 0 }, 141 { "lm63", lm63 },
142 { "lm64", lm64 },
140 { } 143 { }
141}; 144};
142MODULE_DEVICE_TABLE(i2c, lm63_id); 145MODULE_DEVICE_TABLE(i2c, lm63_id);
@@ -422,6 +425,7 @@ static int lm63_detect(struct i2c_client *new_client,
422 struct i2c_adapter *adapter = new_client->adapter; 425 struct i2c_adapter *adapter = new_client->adapter;
423 u8 man_id, chip_id, reg_config1, reg_config2; 426 u8 man_id, chip_id, reg_config1, reg_config2;
424 u8 reg_alert_status, reg_alert_mask; 427 u8 reg_alert_status, reg_alert_mask;
428 int address = new_client->addr;
425 429
426 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 430 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
427 return -ENODEV; 431 return -ENODEV;
@@ -439,7 +443,6 @@ static int lm63_detect(struct i2c_client *new_client,
439 LM63_REG_ALERT_MASK); 443 LM63_REG_ALERT_MASK);
440 444
441 if (man_id != 0x01 /* National Semiconductor */ 445 if (man_id != 0x01 /* National Semiconductor */
442 || chip_id != 0x41 /* LM63 */
443 || (reg_config1 & 0x18) != 0x00 446 || (reg_config1 & 0x18) != 0x00
444 || (reg_config2 & 0xF8) != 0x00 447 || (reg_config2 & 0xF8) != 0x00
445 || (reg_alert_status & 0x20) != 0x00 448 || (reg_alert_status & 0x20) != 0x00
@@ -450,7 +453,12 @@ static int lm63_detect(struct i2c_client *new_client,
450 return -ENODEV; 453 return -ENODEV;
451 } 454 }
452 455
453 strlcpy(info->type, "lm63", I2C_NAME_SIZE); 456 if (chip_id == 0x41 && address == 0x4c)
457 strlcpy(info->type, "lm63", I2C_NAME_SIZE);
458 else if (chip_id == 0x51 && (address == 0x18 || address == 0x4e))
459 strlcpy(info->type, "lm64", I2C_NAME_SIZE);
460 else
461 return -ENODEV;
454 462
455 return 0; 463 return 0;
456} 464}