aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm95241.c
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2011-07-05 16:31:48 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-07-28 03:17:35 -0400
commit8c1d04192e2ef1e6d38e9d5e9c500e5330d20339 (patch)
tree06bd055abad6db6660f7a52bc03a6086a8f15391 /drivers/hwmon/lm95241.c
parentfffd80ccc1e6c7e5f13741e17a7d80582ae21fcc (diff)
hwmon: (lm95241) Add support for LM95231
LM95231 is fully compatible to LM95241; only necessary change is to add chip detection. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm95241.c')
-rw-r--r--drivers/hwmon/lm95241.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
index d3b464b74ced..513901d592a9 100644
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -74,8 +74,9 @@ static const unsigned short normal_i2c[] = {
74#define TT_OFF 0 74#define TT_OFF 0
75#define TT_ON 1 75#define TT_ON 1
76#define TT_MASK 7 76#define TT_MASK 7
77#define MANUFACTURER_ID 0x01 77#define NATSEMI_MAN_ID 0x01
78#define DEFAULT_REVISION 0xA4 78#define LM95231_CHIP_ID 0xA1
79#define LM95241_CHIP_ID 0xA4
79 80
80static const u8 lm95241_reg_address[] = { 81static const u8 lm95241_reg_address[] = {
81 LM95241_REG_R_LOCAL_TEMPH, 82 LM95241_REG_R_LOCAL_TEMPH,
@@ -338,20 +339,25 @@ static int lm95241_detect(struct i2c_client *new_client,
338 struct i2c_board_info *info) 339 struct i2c_board_info *info)
339{ 340{
340 struct i2c_adapter *adapter = new_client->adapter; 341 struct i2c_adapter *adapter = new_client->adapter;
341 int address = new_client->addr;
342 const char *name; 342 const char *name;
343 int mfg_id, chip_id;
343 344
344 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 345 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
345 return -ENODEV; 346 return -ENODEV;
346 347
347 if ((i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID) 348 mfg_id = i2c_smbus_read_byte_data(new_client, LM95241_REG_R_MAN_ID);
348 == MANUFACTURER_ID) 349 if (mfg_id != NATSEMI_MAN_ID)
349 && (i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID) 350 return -ENODEV;
350 == DEFAULT_REVISION)) { 351
351 name = DEVNAME; 352 chip_id = i2c_smbus_read_byte_data(new_client, LM95241_REG_R_CHIP_ID);
352 } else { 353 switch (chip_id) {
353 dev_dbg(&adapter->dev, "LM95241 detection failed at 0x%02x\n", 354 case LM95231_CHIP_ID:
354 address); 355 name = "lm95231";
356 break;
357 case LM95241_CHIP_ID:
358 name = "lm95241";
359 break;
360 default:
355 return -ENODEV; 361 return -ENODEV;
356 } 362 }
357 363
@@ -431,7 +437,8 @@ static int lm95241_remove(struct i2c_client *client)
431 437
432/* Driver data (common to all clients) */ 438/* Driver data (common to all clients) */
433static const struct i2c_device_id lm95241_id[] = { 439static const struct i2c_device_id lm95241_id[] = {
434 { DEVNAME, 0 }, 440 { "lm95231", 0 },
441 { "lm95241", 0 },
435 { } 442 { }
436}; 443};
437MODULE_DEVICE_TABLE(i2c, lm95241_id); 444MODULE_DEVICE_TABLE(i2c, lm95241_id);