aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-05-25 14:43:32 -0400
committerJean Delvare <khali@endymion.delvare>2011-05-25 14:43:32 -0400
commit67b670ff04cdff1c9584ecdb22e297956664c9b5 (patch)
treec7715376d73ac1dfbdbe9a1f1fe0710ddd344308
parent7d0333653840b0c692f55f1aaaa71d626fb00870 (diff)
hwmon: (max6650) Drop device detection
MAX6650 device detection is unreliable, we got reports of false positives. We now have many ways to let users instantiate the devices explicitly, so unreliable detection should be dropped. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: "Hans J. Koch" <hjk@hansjkoch.de> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
-rw-r--r--Documentation/hwmon/max66509
-rw-r--r--drivers/hwmon/max6650.c44
2 files changed, 8 insertions, 45 deletions
diff --git a/Documentation/hwmon/max6650 b/Documentation/hwmon/max6650
index c565650fcfc6..b26fef5f950e 100644
--- a/Documentation/hwmon/max6650
+++ b/Documentation/hwmon/max6650
@@ -4,7 +4,7 @@ Kernel driver max6650
4Supported chips: 4Supported chips:
5 * Maxim 6650 / 6651 5 * Maxim 6650 / 6651
6 Prefix: 'max6650' 6 Prefix: 'max6650'
7 Addresses scanned: I2C 0x1b, 0x1f, 0x48, 0x4b 7 Addresses scanned: none
8 Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf 8 Datasheet: http://pdfserv.maxim-ic.com/en/ds/MAX6650-MAX6651.pdf
9 9
10Authors: 10Authors:
@@ -36,6 +36,13 @@ fan1_div rw sets the speed range the inputs can handle. Legal
36 values are 1, 2, 4, and 8. Use lower values for 36 values are 1, 2, 4, and 8. Use lower values for
37 faster fans. 37 faster fans.
38 38
39Usage notes
40-----------
41
42This driver does not auto-detect devices. You will have to instantiate the
43devices explicitly. Please see Documentation/i2c/instantiating-devices for
44details.
45
39Module parameters 46Module parameters
40----------------- 47-----------------
41 48
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 9a11532ecae8..cced18626174 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -41,13 +41,6 @@
41#include <linux/err.h> 41#include <linux/err.h>
42 42
43/* 43/*
44 * Addresses to scan. There are four disjoint possibilities, by pin config.
45 */
46
47static const unsigned short normal_i2c[] = {0x1b, 0x1f, 0x48, 0x4b,
48 I2C_CLIENT_END};
49
50/*
51 * Insmod parameters 44 * Insmod parameters
52 */ 45 */
53 46
@@ -114,8 +107,6 @@ module_param(clock, int, S_IRUGO);
114 107
115static int max6650_probe(struct i2c_client *client, 108static int max6650_probe(struct i2c_client *client,
116 const struct i2c_device_id *id); 109 const struct i2c_device_id *id);
117static int max6650_detect(struct i2c_client *client,
118 struct i2c_board_info *info);
119static int max6650_init_client(struct i2c_client *client); 110static int max6650_init_client(struct i2c_client *client);
120static int max6650_remove(struct i2c_client *client); 111static int max6650_remove(struct i2c_client *client);
121static struct max6650_data *max6650_update_device(struct device *dev); 112static struct max6650_data *max6650_update_device(struct device *dev);
@@ -131,15 +122,12 @@ static const struct i2c_device_id max6650_id[] = {
131MODULE_DEVICE_TABLE(i2c, max6650_id); 122MODULE_DEVICE_TABLE(i2c, max6650_id);
132 123
133static struct i2c_driver max6650_driver = { 124static struct i2c_driver max6650_driver = {
134 .class = I2C_CLASS_HWMON,
135 .driver = { 125 .driver = {
136 .name = "max6650", 126 .name = "max6650",
137 }, 127 },
138 .probe = max6650_probe, 128 .probe = max6650_probe,
139 .remove = max6650_remove, 129 .remove = max6650_remove,
140 .id_table = max6650_id, 130 .id_table = max6650_id,
141 .detect = max6650_detect,
142 .address_list = normal_i2c,
143}; 131};
144 132
145/* 133/*
@@ -525,38 +513,6 @@ static struct attribute_group max6650_attr_grp = {
525 * Real code 513 * Real code
526 */ 514 */
527 515
528/* Return 0 if detection is successful, -ENODEV otherwise */
529static int max6650_detect(struct i2c_client *client,
530 struct i2c_board_info *info)
531{
532 struct i2c_adapter *adapter = client->adapter;
533 int address = client->addr;
534
535 dev_dbg(&adapter->dev, "max6650_detect called\n");
536
537 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
538 dev_dbg(&adapter->dev, "max6650: I2C bus doesn't support "
539 "byte read mode, skipping.\n");
540 return -ENODEV;
541 }
542
543 if (((i2c_smbus_read_byte_data(client, MAX6650_REG_CONFIG) & 0xC0)
544 ||(i2c_smbus_read_byte_data(client, MAX6650_REG_GPIO_STAT) & 0xE0)
545 ||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM_EN) & 0xE0)
546 ||(i2c_smbus_read_byte_data(client, MAX6650_REG_ALARM) & 0xE0)
547 ||(i2c_smbus_read_byte_data(client, MAX6650_REG_COUNT) & 0xFC))) {
548 dev_dbg(&adapter->dev,
549 "max6650: detection failed at 0x%02x.\n", address);
550 return -ENODEV;
551 }
552
553 dev_info(&adapter->dev, "max6650: chip found at 0x%02x.\n", address);
554
555 strlcpy(info->type, "max6650", I2C_NAME_SIZE);
556
557 return 0;
558}
559
560static int max6650_probe(struct i2c_client *client, 516static int max6650_probe(struct i2c_client *client,
561 const struct i2c_device_id *id) 517 const struct i2c_device_id *id)
562{ 518{