diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-01-17 15:48:20 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-01-18 15:22:54 -0500 |
commit | c7bf71c517abfc3b15970d67910e0f62e0522939 (patch) | |
tree | 7c426f987ba9c338a81456e551f3a868e2ac27ac /drivers/hwmon/lm93.c | |
parent | a25cecce88194b2edf38b8c3b1665e9318eb2d22 (diff) |
hwmon: (lm93) Add support for LM94
This patch adds basic support for LM94 to the LM93 driver. LM94 specific
sensors and features are not supported.
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm93.c')
-rw-r--r-- | drivers/hwmon/lm93.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c index c9ed14eba5a6..3b43df418613 100644 --- a/drivers/hwmon/lm93.c +++ b/drivers/hwmon/lm93.c | |||
@@ -135,6 +135,11 @@ | |||
135 | #define LM93_MFR_ID 0x73 | 135 | #define LM93_MFR_ID 0x73 |
136 | #define LM93_MFR_ID_PROTOTYPE 0x72 | 136 | #define LM93_MFR_ID_PROTOTYPE 0x72 |
137 | 137 | ||
138 | /* LM94 REGISTER VALUES */ | ||
139 | #define LM94_MFR_ID_2 0x7a | ||
140 | #define LM94_MFR_ID 0x79 | ||
141 | #define LM94_MFR_ID_PROTOTYPE 0x78 | ||
142 | |||
138 | /* SMBus capabilities */ | 143 | /* SMBus capabilities */ |
139 | #define LM93_SMBUS_FUNC_FULL (I2C_FUNC_SMBUS_BYTE_DATA | \ | 144 | #define LM93_SMBUS_FUNC_FULL (I2C_FUNC_SMBUS_BYTE_DATA | \ |
140 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA) | 145 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA) |
@@ -2504,6 +2509,7 @@ static int lm93_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
2504 | { | 2509 | { |
2505 | struct i2c_adapter *adapter = client->adapter; | 2510 | struct i2c_adapter *adapter = client->adapter; |
2506 | int mfr, ver; | 2511 | int mfr, ver; |
2512 | const char *name; | ||
2507 | 2513 | ||
2508 | if (!i2c_check_functionality(adapter, LM93_SMBUS_FUNC_MIN)) | 2514 | if (!i2c_check_functionality(adapter, LM93_SMBUS_FUNC_MIN)) |
2509 | return -ENODEV; | 2515 | return -ENODEV; |
@@ -2517,13 +2523,23 @@ static int lm93_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
2517 | } | 2523 | } |
2518 | 2524 | ||
2519 | ver = lm93_read_byte(client, LM93_REG_VER); | 2525 | ver = lm93_read_byte(client, LM93_REG_VER); |
2520 | if (ver != LM93_MFR_ID && ver != LM93_MFR_ID_PROTOTYPE) { | 2526 | switch (ver) { |
2527 | case LM93_MFR_ID: | ||
2528 | case LM93_MFR_ID_PROTOTYPE: | ||
2529 | name = "lm93"; | ||
2530 | break; | ||
2531 | case LM94_MFR_ID_2: | ||
2532 | case LM94_MFR_ID: | ||
2533 | case LM94_MFR_ID_PROTOTYPE: | ||
2534 | name = "lm94"; | ||
2535 | break; | ||
2536 | default: | ||
2521 | dev_dbg(&adapter->dev, | 2537 | dev_dbg(&adapter->dev, |
2522 | "detect failed, bad version id 0x%02x!\n", ver); | 2538 | "detect failed, bad version id 0x%02x!\n", ver); |
2523 | return -ENODEV; | 2539 | return -ENODEV; |
2524 | } | 2540 | } |
2525 | 2541 | ||
2526 | strlcpy(info->type, "lm93", I2C_NAME_SIZE); | 2542 | strlcpy(info->type, name, I2C_NAME_SIZE); |
2527 | dev_dbg(&adapter->dev,"loading %s at %d,0x%02x\n", | 2543 | dev_dbg(&adapter->dev,"loading %s at %d,0x%02x\n", |
2528 | client->name, i2c_adapter_id(client->adapter), | 2544 | client->name, i2c_adapter_id(client->adapter), |
2529 | client->addr); | 2545 | client->addr); |
@@ -2602,6 +2618,7 @@ static int lm93_remove(struct i2c_client *client) | |||
2602 | 2618 | ||
2603 | static const struct i2c_device_id lm93_id[] = { | 2619 | static const struct i2c_device_id lm93_id[] = { |
2604 | { "lm93", 0 }, | 2620 | { "lm93", 0 }, |
2621 | { "lm94", 0 }, | ||
2605 | { } | 2622 | { } |
2606 | }; | 2623 | }; |
2607 | MODULE_DEVICE_TABLE(i2c, lm93_id); | 2624 | MODULE_DEVICE_TABLE(i2c, lm93_id); |