aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tmp421.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-04-12 19:12:06 -0400
committerGuenter Roeck <linux@roeck-us.net>2014-08-04 10:01:38 -0400
commit05c77ab240fdcba3886913235e37b43e3223e9ee (patch)
tree90f8051576d893426fc216e1addc18bd7088e9ab /drivers/hwmon/tmp421.c
parenta63ee9d83b960199ae111ff4e2413fbe328d32fe (diff)
hwmon: (tmp421) Add support for TMP441 and TMP442
TMP441 and TMP442 are compatible to TMP421 and TMP422. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'drivers/hwmon/tmp421.c')
-rw-r--r--drivers/hwmon/tmp421.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 9438c1bd5d59..2ae383f737b4 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -21,7 +21,7 @@
21 21
22/* 22/*
23 * Driver for the Texas Instruments TMP421 SMBus temperature sensor IC. 23 * Driver for the Texas Instruments TMP421 SMBus temperature sensor IC.
24 * Supported models: TMP421, TMP422, TMP423 24 * Supported models: TMP421, TMP422, TMP423, TMP441, TMP442
25 */ 25 */
26 26
27#include <linux/module.h> 27#include <linux/module.h>
@@ -39,7 +39,7 @@
39static const unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f, 39static const unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f,
40 I2C_CLIENT_END }; 40 I2C_CLIENT_END };
41 41
42enum chips { tmp421, tmp422, tmp423 }; 42enum chips { tmp421, tmp422, tmp423, tmp441, tmp442 };
43 43
44/* The TMP421 registers */ 44/* The TMP421 registers */
45#define TMP421_STATUS_REG 0x08 45#define TMP421_STATUS_REG 0x08
@@ -60,11 +60,15 @@ static const u8 TMP421_TEMP_LSB[4] = { 0x10, 0x11, 0x12, 0x13 };
60#define TMP421_DEVICE_ID 0x21 60#define TMP421_DEVICE_ID 0x21
61#define TMP422_DEVICE_ID 0x22 61#define TMP422_DEVICE_ID 0x22
62#define TMP423_DEVICE_ID 0x23 62#define TMP423_DEVICE_ID 0x23
63#define TMP441_DEVICE_ID 0x41
64#define TMP442_DEVICE_ID 0x42
63 65
64static const struct i2c_device_id tmp421_id[] = { 66static const struct i2c_device_id tmp421_id[] = {
65 { "tmp421", 2 }, 67 { "tmp421", 2 },
66 { "tmp422", 3 }, 68 { "tmp422", 3 },
67 { "tmp423", 4 }, 69 { "tmp423", 4 },
70 { "tmp441", 2 },
71 { "tmp442", 3 },
68 { } 72 { }
69}; 73};
70MODULE_DEVICE_TABLE(i2c, tmp421_id); 74MODULE_DEVICE_TABLE(i2c, tmp421_id);
@@ -235,7 +239,8 @@ static int tmp421_detect(struct i2c_client *client,
235{ 239{
236 enum chips kind; 240 enum chips kind;
237 struct i2c_adapter *adapter = client->adapter; 241 struct i2c_adapter *adapter = client->adapter;
238 const char *names[] = { "TMP421", "TMP422", "TMP423" }; 242 const char * const names[] = { "TMP421", "TMP422", "TMP423",
243 "TMP441", "TMP442" };
239 int addr = client->addr; 244 int addr = client->addr;
240 u8 reg; 245 u8 reg;
241 246
@@ -269,6 +274,14 @@ static int tmp421_detect(struct i2c_client *client,
269 return -ENODEV; 274 return -ENODEV;
270 kind = tmp423; 275 kind = tmp423;
271 break; 276 break;
277 case TMP441_DEVICE_ID:
278 kind = tmp441;
279 break;
280 case TMP442_DEVICE_ID:
281 if (addr != 0x4c && addr != 0x4d)
282 return -ENODEV;
283 kind = tmp442;
284 break;
272 default: 285 default:
273 return -ENODEV; 286 return -ENODEV;
274 } 287 }
@@ -319,5 +332,5 @@ static struct i2c_driver tmp421_driver = {
319module_i2c_driver(tmp421_driver); 332module_i2c_driver(tmp421_driver);
320 333
321MODULE_AUTHOR("Andre Prendel <andre.prendel@gmx.de>"); 334MODULE_AUTHOR("Andre Prendel <andre.prendel@gmx.de>");
322MODULE_DESCRIPTION("Texas Instruments TMP421/422/423 temperature sensor driver"); 335MODULE_DESCRIPTION("Texas Instruments TMP421/422/423/441/442 temperature sensor driver");
323MODULE_LICENSE("GPL"); 336MODULE_LICENSE("GPL");