aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adt7475.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-09 14:36:02 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-09 14:36:02 -0500
commitb180d0508475c5c55085839d22f454c69379eacc (patch)
tree7c1dfe50aca689ff985a3cba16dd373669b7e894 /drivers/hwmon/adt7475.c
parent7669896f499e1bce5cfb38f2685ff583ecdb24dd (diff)
hwmon: (adt7475) Add support for the ADT7473
Add support for the ADT7473 to the adt7475 driver, and mark the adt7473 driver for removal. The ADT7473 and ADT7475 chips are almost the same chip and essentially compatible, so there's no point in having separate drivers for them. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jordan Crouse <jordan@cosmicpenguin.net> Cc: "Darrick J. Wong" <djwong@us.ibm.com>
Diffstat (limited to 'drivers/hwmon/adt7475.c')
-rw-r--r--drivers/hwmon/adt7475.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 41d3e38f9ce1..fba2f016e4d8 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -113,11 +113,12 @@
113#define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx)) 113#define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx))
114#define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx)) 114#define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx))
115 115
116static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; 116static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
117 117
118I2C_CLIENT_INSMOD_1(adt7475); 118I2C_CLIENT_INSMOD_2(adt7473, adt7475);
119 119
120static const struct i2c_device_id adt7475_id[] = { 120static const struct i2c_device_id adt7475_id[] = {
121 { "adt7473", adt7473 },
121 { "adt7475", adt7475 }, 122 { "adt7475", adt7475 },
122 { } 123 { }
123}; 124};
@@ -970,19 +971,27 @@ static int adt7475_detect(struct i2c_client *client, int kind,
970 struct i2c_board_info *info) 971 struct i2c_board_info *info)
971{ 972{
972 struct i2c_adapter *adapter = client->adapter; 973 struct i2c_adapter *adapter = client->adapter;
974 int vendid, devid;
975 const char *name;
973 976
974 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 977 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
975 return -ENODEV; 978 return -ENODEV;
976 979
977 if (adt7475_read(REG_VENDID) != 0x41 || 980 vendid = adt7475_read(REG_VENDID);
978 adt7475_read(REG_DEVID) != 0x75) { 981 devid = adt7475_read(REG_DEVID);
979 dev_err(&adapter->dev, 982
980 "Couldn't detect a adt7475 part at 0x%02x\n", 983 if (vendid == 0x41 && devid == 0x73)
981 (unsigned int)client->addr); 984 name = "adt7473";
985 else if (vendid == 0x41 && devid == 0x75 && client->addr == 0x2e)
986 name = "adt7475";
987 else {
988 dev_dbg(&adapter->dev,
989 "Couldn't detect an ADT7473 or ADT7475 part at "
990 "0x%02x\n", (unsigned int)client->addr);
982 return -ENODEV; 991 return -ENODEV;
983 } 992 }
984 993
985 strlcpy(info->type, adt7475_id[0].name, I2C_NAME_SIZE); 994 strlcpy(info->type, name, I2C_NAME_SIZE);
986 995
987 return 0; 996 return 0;
988} 997}