aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Coulson <rob.coulson@gmail.com>2013-05-23 12:22:22 -0400
committerGuenter Roeck <linux@roeck-us.net>2013-06-27 13:29:02 -0400
commited7c34e89d1e9d07f787a51571be0b96ae93d678 (patch)
tree9ed1edda458a6aa57f23ab07e68c042fbb69b63b
parent79c1cc1c90c0ccaddd20965ea19205c54addd5f7 (diff)
hwmon: (ds1621) Remove detect function
Due to a lack of device and vendor identification registers, the Dallas/Maxim DS16xx devices cannot be uniquely detected, sometimes resulting in false positives. Therefore, the detect function is being removed in favor of explicit device instantiation. Signed-off-by: Robert Coulson <rob.coulson@gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--Documentation/hwmon/ds162125
-rw-r--r--drivers/hwmon/ds1621.c48
2 files changed, 12 insertions, 61 deletions
diff --git a/Documentation/hwmon/ds1621 b/Documentation/hwmon/ds1621
index 1ebaa2485770..83780660f5b1 100644
--- a/Documentation/hwmon/ds1621
+++ b/Documentation/hwmon/ds1621
@@ -4,24 +4,22 @@ Kernel driver ds1621
4Supported chips: 4Supported chips:
5 * Dallas Semiconductor / Maxim Integrated DS1621 5 * Dallas Semiconductor / Maxim Integrated DS1621
6 Prefix: 'ds1621' 6 Prefix: 'ds1621'
7 Addresses scanned: I2C 0x48 - 0x4f 7 Addresses scanned: none
8 Datasheet: Publicly available from www.maximintegrated.com 8 Datasheet: Publicly available from www.maximintegrated.com
9 9
10 * Dallas Semiconductor DS1625 10 * Dallas Semiconductor DS1625
11 Prefix: 11 Prefix: 'ds1625'
12 'ds1621' - if binding via _detect function 12 Addresses scanned: none
13 'ds1625' - explicit instantiation
14 Addresses scanned: I2C 0x48 - 0x4f
15 Datasheet: Publicly available from www.datasheetarchive.com 13 Datasheet: Publicly available from www.datasheetarchive.com
16 14
17 * Maxim Integrated DS1631 15 * Maxim Integrated DS1631
18 Prefix: 'ds1631' 16 Prefix: 'ds1631'
19 Addresses scanned: I2C 0x48 - 0x4f 17 Addresses scanned: none
20 Datasheet: Publicly available from www.maximintegrated.com 18 Datasheet: Publicly available from www.maximintegrated.com
21 19
22 * Maxim Integrated DS1721 20 * Maxim Integrated DS1721
23 Prefix: 'ds1721' 21 Prefix: 'ds1721'
24 Addresses scanned: I2C 0x48 - 0x4f 22 Addresses scanned: none
25 Datasheet: Publicly available from www.maximintegrated.com 23 Datasheet: Publicly available from www.maximintegrated.com
26 24
27Authors: 25Authors:
@@ -77,12 +75,13 @@ The DS1625 is pin compatible and functionally equivalent with the DS1621,
77but the DS1621 is meant to replace it. The DS1631 and DS1721 are also 75but the DS1621 is meant to replace it. The DS1631 and DS1721 are also
78pin compatible with the DS1621, but provide multi-resolution support. 76pin compatible with the DS1621, but provide multi-resolution support.
79 77
80Since there is no version register, there is no unique identification 78Since there is no version or vendor identification register, there is
81for these devices. In addition, the DS1631 and DS1721 will emulate a 79no unique identification for these devices. Therefore, explicit device
82DS1621 device, if not explicitly instantiated (why? because the detect 80instantiation is required for correct device identification and functionality.
83function compares the temperature register values bits and checks for a 81
849-bit resolution). Therefore, for correct device identification and 82And, for correct identification and operation, each device must be
85functionality, explicit device instantiation is required. 83explicitly instantiated, one device per address, in this address
84range: 0x48..0x4f.
86 85
87The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0 86The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0
88degree Celsius over a -10 to +85 degree range, a minimum/maximum alarm 87degree Celsius over a -10 to +85 degree range, a minimum/maximum alarm
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 98adf77fdc84..8e940ad9cb36 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -46,10 +46,6 @@
46#include <linux/sysfs.h> 46#include <linux/sysfs.h>
47#include <linux/kernel.h> 47#include <linux/kernel.h>
48 48
49/* Addresses to scan */
50static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
51 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
52
53/* Supported devices */ 49/* Supported devices */
54enum chips { ds1621, ds1625, ds1631, ds1721 }; 50enum chips { ds1621, ds1625, ds1631, ds1721 };
55 51
@@ -358,48 +354,6 @@ static const struct attribute_group ds1621_group = {
358 .is_visible = ds1621_attribute_visible 354 .is_visible = ds1621_attribute_visible
359}; 355};
360 356
361
362/* Return 0 if detection is successful, -ENODEV otherwise */
363static int ds1621_detect(struct i2c_client *client,
364 struct i2c_board_info *info)
365{
366 struct i2c_adapter *adapter = client->adapter;
367 int conf, temp;
368 int i;
369
370 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
371 | I2C_FUNC_SMBUS_WORD_DATA
372 | I2C_FUNC_SMBUS_WRITE_BYTE))
373 return -ENODEV;
374
375 /*
376 * Now, we do the remaining detection. It is lousy.
377 *
378 * The NVB bit should be low if no EEPROM write has been requested
379 * during the latest 10ms, which is highly improbable in our case.
380 */
381 conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
382 if (conf < 0 || conf & DS1621_REG_CONFIG_NVB)
383 return -ENODEV;
384 /*
385 * The ds1621 & ds1625 use 9-bit resolution, so the 7 lowest bits
386 * of the temperature should always be 0 (NOTE: The other chips
387 * have multi-resolution support, so if they have 9-bit resolution
388 * configured and the min/max temperature values set accordingly,
389 * then if not explicitly instantiated, they *will* appear as and
390 * emulate a ds1621 device).
391 */
392 for (i = 0; i < ARRAY_SIZE(DS1621_REG_TEMP); i++) {
393 temp = i2c_smbus_read_word_data(client, DS1621_REG_TEMP[i]);
394 if (temp < 0 || (temp & 0x7f00))
395 return -ENODEV;
396 }
397
398 strlcpy(info->type, "ds1621", I2C_NAME_SIZE);
399
400 return 0;
401}
402
403static int ds1621_probe(struct i2c_client *client, 357static int ds1621_probe(struct i2c_client *client,
404 const struct i2c_device_id *id) 358 const struct i2c_device_id *id)
405{ 359{
@@ -465,8 +419,6 @@ static struct i2c_driver ds1621_driver = {
465 .probe = ds1621_probe, 419 .probe = ds1621_probe,
466 .remove = ds1621_remove, 420 .remove = ds1621_remove,
467 .id_table = ds1621_id, 421 .id_table = ds1621_id,
468 .detect = ds1621_detect,
469 .address_list = normal_i2c,
470}; 422};
471 423
472module_i2c_driver(ds1621_driver); 424module_i2c_driver(ds1621_driver);