diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-05-27 19:17:19 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2015-06-01 01:58:36 -0400 |
commit | e892b75ff579a0c07b633f2e234aeecf78a93a37 (patch) | |
tree | 65b43204fc0e584c0a8c402e9afdb7c46b01c0ef | |
parent | ea33a5e7718aa0bd2fa82ff44489ec19badf70f0 (diff) |
hwmon: (atxp1) Drop auto-detection
Auto-detection for this chip is highly unreliable, and one of its
I2C addresses can also be used by EEPROMs, increasing the risk for
false positives even more. Drop auto-detection entirely to remove
the risk.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/atxp1.c | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 78edc56b59e5..f2f2f2fc755a 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
@@ -11,6 +11,10 @@ | |||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | ||
15 | * The ATXP1 can reside on I2C addresses 0x37 or 0x4e. The chip is | ||
16 | * not auto-detected by the driver and must be instantiated explicitly. | ||
17 | * See Documentation/i2c/instantiating-devices for more information. | ||
14 | */ | 18 | */ |
15 | 19 | ||
16 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
@@ -38,8 +42,6 @@ MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); | |||
38 | #define ATXP1_VIDMASK 0x1f | 42 | #define ATXP1_VIDMASK 0x1f |
39 | #define ATXP1_GPIO1MASK 0x0f | 43 | #define ATXP1_GPIO1MASK 0x0f |
40 | 44 | ||
41 | static const unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END }; | ||
42 | |||
43 | struct atxp1_data { | 45 | struct atxp1_data { |
44 | struct i2c_client *client; | 46 | struct i2c_client *client; |
45 | struct mutex update_lock; | 47 | struct mutex update_lock; |
@@ -254,48 +256,6 @@ static struct attribute *atxp1_attrs[] = { | |||
254 | }; | 256 | }; |
255 | ATTRIBUTE_GROUPS(atxp1); | 257 | ATTRIBUTE_GROUPS(atxp1); |
256 | 258 | ||
257 | /* Return 0 if detection is successful, -ENODEV otherwise */ | ||
258 | static int atxp1_detect(struct i2c_client *new_client, | ||
259 | struct i2c_board_info *info) | ||
260 | { | ||
261 | struct i2c_adapter *adapter = new_client->adapter; | ||
262 | |||
263 | u8 temp; | ||
264 | |||
265 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
266 | return -ENODEV; | ||
267 | |||
268 | /* Detect ATXP1, checking if vendor ID registers are all zero */ | ||
269 | if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) && | ||
270 | (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) && | ||
271 | (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) && | ||
272 | (i2c_smbus_read_byte_data(new_client, 0xff) == 0))) | ||
273 | return -ENODEV; | ||
274 | |||
275 | /* | ||
276 | * No vendor ID, now checking if registers 0x10,0x11 (non-existent) | ||
277 | * showing the same as register 0x00 | ||
278 | */ | ||
279 | temp = i2c_smbus_read_byte_data(new_client, 0x00); | ||
280 | |||
281 | if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) && | ||
282 | (i2c_smbus_read_byte_data(new_client, 0x11) == temp))) | ||
283 | return -ENODEV; | ||
284 | |||
285 | /* Get VRM */ | ||
286 | temp = vid_which_vrm(); | ||
287 | |||
288 | if ((temp != 90) && (temp != 91)) { | ||
289 | dev_err(&adapter->dev, "atxp1: Not supporting VRM %d.%d\n", | ||
290 | temp / 10, temp % 10); | ||
291 | return -ENODEV; | ||
292 | } | ||
293 | |||
294 | strlcpy(info->type, "atxp1", I2C_NAME_SIZE); | ||
295 | |||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | static int atxp1_probe(struct i2c_client *client, | 259 | static int atxp1_probe(struct i2c_client *client, |
300 | const struct i2c_device_id *id) | 260 | const struct i2c_device_id *id) |
301 | { | 261 | { |
@@ -309,6 +269,11 @@ static int atxp1_probe(struct i2c_client *client, | |||
309 | 269 | ||
310 | /* Get VRM */ | 270 | /* Get VRM */ |
311 | data->vrm = vid_which_vrm(); | 271 | data->vrm = vid_which_vrm(); |
272 | if (data->vrm != 90 && data->vrm != 91) { | ||
273 | dev_err(dev, "atxp1: Not supporting VRM %d.%d\n", | ||
274 | data->vrm / 10, data->vrm % 10); | ||
275 | return -ENODEV; | ||
276 | } | ||
312 | 277 | ||
313 | data->client = client; | 278 | data->client = client; |
314 | mutex_init(&data->update_lock); | 279 | mutex_init(&data->update_lock); |
@@ -337,8 +302,6 @@ static struct i2c_driver atxp1_driver = { | |||
337 | }, | 302 | }, |
338 | .probe = atxp1_probe, | 303 | .probe = atxp1_probe, |
339 | .id_table = atxp1_id, | 304 | .id_table = atxp1_id, |
340 | .detect = atxp1_detect, | ||
341 | .address_list = normal_i2c, | ||
342 | }; | 305 | }; |
343 | 306 | ||
344 | module_i2c_driver(atxp1_driver); | 307 | module_i2c_driver(atxp1_driver); |