diff options
Diffstat (limited to 'drivers/hwmon/ads7828.c')
-rw-r--r-- | drivers/hwmon/ads7828.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index 5c39b4af1b23..aac85f3aed50 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c | |||
@@ -47,10 +47,7 @@ | |||
47 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, | 47 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, |
48 | I2C_CLIENT_END }; | 48 | I2C_CLIENT_END }; |
49 | 49 | ||
50 | /* Insmod parameters */ | 50 | /* Module parameters */ |
51 | I2C_CLIENT_INSMOD_1(ads7828); | ||
52 | |||
53 | /* Other module parameters */ | ||
54 | static int se_input = 1; /* Default is SE, 0 == diff */ | 51 | static int se_input = 1; /* Default is SE, 0 == diff */ |
55 | static int int_vref = 1; /* Default is internal ref ON */ | 52 | static int int_vref = 1; /* Default is internal ref ON */ |
56 | static int vref_mv = ADS7828_INT_VREF_MV; /* set if vref != 2.5V */ | 53 | static int vref_mv = ADS7828_INT_VREF_MV; /* set if vref != 2.5V */ |
@@ -72,7 +69,7 @@ struct ads7828_data { | |||
72 | }; | 69 | }; |
73 | 70 | ||
74 | /* Function declaration - necessary due to function dependencies */ | 71 | /* Function declaration - necessary due to function dependencies */ |
75 | static int ads7828_detect(struct i2c_client *client, int kind, | 72 | static int ads7828_detect(struct i2c_client *client, |
76 | struct i2c_board_info *info); | 73 | struct i2c_board_info *info); |
77 | static int ads7828_probe(struct i2c_client *client, | 74 | static int ads7828_probe(struct i2c_client *client, |
78 | const struct i2c_device_id *id); | 75 | const struct i2c_device_id *id); |
@@ -168,7 +165,7 @@ static int ads7828_remove(struct i2c_client *client) | |||
168 | } | 165 | } |
169 | 166 | ||
170 | static const struct i2c_device_id ads7828_id[] = { | 167 | static const struct i2c_device_id ads7828_id[] = { |
171 | { "ads7828", ads7828 }, | 168 | { "ads7828", 0 }, |
172 | { } | 169 | { } |
173 | }; | 170 | }; |
174 | MODULE_DEVICE_TABLE(i2c, ads7828_id); | 171 | MODULE_DEVICE_TABLE(i2c, ads7828_id); |
@@ -183,14 +180,15 @@ static struct i2c_driver ads7828_driver = { | |||
183 | .remove = ads7828_remove, | 180 | .remove = ads7828_remove, |
184 | .id_table = ads7828_id, | 181 | .id_table = ads7828_id, |
185 | .detect = ads7828_detect, | 182 | .detect = ads7828_detect, |
186 | .address_data = &addr_data, | 183 | .address_list = normal_i2c, |
187 | }; | 184 | }; |
188 | 185 | ||
189 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 186 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
190 | static int ads7828_detect(struct i2c_client *client, int kind, | 187 | static int ads7828_detect(struct i2c_client *client, |
191 | struct i2c_board_info *info) | 188 | struct i2c_board_info *info) |
192 | { | 189 | { |
193 | struct i2c_adapter *adapter = client->adapter; | 190 | struct i2c_adapter *adapter = client->adapter; |
191 | int ch; | ||
194 | 192 | ||
195 | /* Check we have a valid client */ | 193 | /* Check we have a valid client */ |
196 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) | 194 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) |
@@ -202,20 +200,17 @@ static int ads7828_detect(struct i2c_client *client, int kind, | |||
202 | - Read from the 8 channel addresses | 200 | - Read from the 8 channel addresses |
203 | - Check the top 4 bits of each result are not set (12 data bits) | 201 | - Check the top 4 bits of each result are not set (12 data bits) |
204 | */ | 202 | */ |
205 | if (kind < 0) { | 203 | for (ch = 0; ch < ADS7828_NCH; ch++) { |
206 | int ch; | 204 | u16 in_data; |
207 | for (ch = 0; ch < ADS7828_NCH; ch++) { | 205 | u8 cmd = channel_cmd_byte(ch); |
208 | u16 in_data; | 206 | in_data = ads7828_read_value(client, cmd); |
209 | u8 cmd = channel_cmd_byte(ch); | 207 | if (in_data & 0xF000) { |
210 | in_data = ads7828_read_value(client, cmd); | 208 | pr_debug("%s : Doesn't look like an ads7828 device\n", |
211 | if (in_data & 0xF000) { | 209 | __func__); |
212 | printk(KERN_DEBUG | 210 | return -ENODEV; |
213 | "%s : Doesn't look like an ads7828 device\n", | ||
214 | __func__); | ||
215 | return -ENODEV; | ||
216 | } | ||
217 | } | 211 | } |
218 | } | 212 | } |
213 | |||
219 | strlcpy(info->type, "ads7828", I2C_NAME_SIZE); | 214 | strlcpy(info->type, "ads7828", I2C_NAME_SIZE); |
220 | 215 | ||
221 | return 0; | 216 | return 0; |