aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1031.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/hwmon/adm1031.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/hwmon/adm1031.c')
-rw-r--r--drivers/hwmon/adm1031.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 56905955352c..1644b92e7cc4 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -64,8 +64,7 @@
64/* Addresses to scan */ 64/* Addresses to scan */
65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
66 66
67/* Insmod parameters */ 67enum chips { adm1030, adm1031 };
68I2C_CLIENT_INSMOD_2(adm1030, adm1031);
69 68
70typedef u8 auto_chan_table_t[8][2]; 69typedef u8 auto_chan_table_t[8][2];
71 70
@@ -102,7 +101,7 @@ struct adm1031_data {
102 101
103static int adm1031_probe(struct i2c_client *client, 102static int adm1031_probe(struct i2c_client *client,
104 const struct i2c_device_id *id); 103 const struct i2c_device_id *id);
105static int adm1031_detect(struct i2c_client *client, int kind, 104static int adm1031_detect(struct i2c_client *client,
106 struct i2c_board_info *info); 105 struct i2c_board_info *info);
107static void adm1031_init_client(struct i2c_client *client); 106static void adm1031_init_client(struct i2c_client *client);
108static int adm1031_remove(struct i2c_client *client); 107static int adm1031_remove(struct i2c_client *client);
@@ -125,7 +124,7 @@ static struct i2c_driver adm1031_driver = {
125 .remove = adm1031_remove, 124 .remove = adm1031_remove,
126 .id_table = adm1031_id, 125 .id_table = adm1031_id,
127 .detect = adm1031_detect, 126 .detect = adm1031_detect,
128 .address_data = &addr_data, 127 .address_list = normal_i2c,
129}; 128};
130 129
131static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg) 130static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg)
@@ -813,35 +812,23 @@ static const struct attribute_group adm1031_group_opt = {
813}; 812};
814 813
815/* Return 0 if detection is successful, -ENODEV otherwise */ 814/* Return 0 if detection is successful, -ENODEV otherwise */
816static int adm1031_detect(struct i2c_client *client, int kind, 815static int adm1031_detect(struct i2c_client *client,
817 struct i2c_board_info *info) 816 struct i2c_board_info *info)
818{ 817{
819 struct i2c_adapter *adapter = client->adapter; 818 struct i2c_adapter *adapter = client->adapter;
820 const char *name = ""; 819 const char *name;
820 int id, co;
821 821
822 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 822 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
823 return -ENODEV; 823 return -ENODEV;
824 824
825 if (kind < 0) { 825 id = i2c_smbus_read_byte_data(client, 0x3d);
826 int id, co; 826 co = i2c_smbus_read_byte_data(client, 0x3e);
827 id = i2c_smbus_read_byte_data(client, 0x3d);
828 co = i2c_smbus_read_byte_data(client, 0x3e);
829 827
830 if (!((id == 0x31 || id == 0x30) && co == 0x41)) 828 if (!((id == 0x31 || id == 0x30) && co == 0x41))
831 return -ENODEV; 829 return -ENODEV;
832 kind = (id == 0x30) ? adm1030 : adm1031; 830 name = (id == 0x30) ? "adm1030" : "adm1031";
833 }
834
835 if (kind <= 0)
836 kind = adm1031;
837 831
838 /* Given the detected chip type, set the chip name and the
839 * auto fan control helper table. */
840 if (kind == adm1030) {
841 name = "adm1030";
842 } else if (kind == adm1031) {
843 name = "adm1031";
844 }
845 strlcpy(info->type, name, I2C_NAME_SIZE); 832 strlcpy(info->type, name, I2C_NAME_SIZE);
846 833
847 return 0; 834 return 0;