Commit ed7c34e8 authored by Robert Coulson's avatar Robert Coulson Committed by Guenter Roeck

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: default avatarRobert Coulson <rob.coulson@gmail.com>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 79c1cc1c
...@@ -4,24 +4,22 @@ Kernel driver ds1621 ...@@ -4,24 +4,22 @@ Kernel driver ds1621
Supported chips: Supported chips:
* Dallas Semiconductor / Maxim Integrated DS1621 * Dallas Semiconductor / Maxim Integrated DS1621
Prefix: 'ds1621' Prefix: 'ds1621'
Addresses scanned: I2C 0x48 - 0x4f Addresses scanned: none
Datasheet: Publicly available from www.maximintegrated.com Datasheet: Publicly available from www.maximintegrated.com
* Dallas Semiconductor DS1625 * Dallas Semiconductor DS1625
Prefix: Prefix: 'ds1625'
'ds1621' - if binding via _detect function Addresses scanned: none
'ds1625' - explicit instantiation
Addresses scanned: I2C 0x48 - 0x4f
Datasheet: Publicly available from www.datasheetarchive.com Datasheet: Publicly available from www.datasheetarchive.com
* Maxim Integrated DS1631 * Maxim Integrated DS1631
Prefix: 'ds1631' Prefix: 'ds1631'
Addresses scanned: I2C 0x48 - 0x4f Addresses scanned: none
Datasheet: Publicly available from www.maximintegrated.com Datasheet: Publicly available from www.maximintegrated.com
* Maxim Integrated DS1721 * Maxim Integrated DS1721
Prefix: 'ds1721' Prefix: 'ds1721'
Addresses scanned: I2C 0x48 - 0x4f Addresses scanned: none
Datasheet: Publicly available from www.maximintegrated.com Datasheet: Publicly available from www.maximintegrated.com
Authors: Authors:
...@@ -77,12 +75,13 @@ The DS1625 is pin compatible and functionally equivalent with the DS1621, ...@@ -77,12 +75,13 @@ The DS1625 is pin compatible and functionally equivalent with the DS1621,
but the DS1621 is meant to replace it. The DS1631 and DS1721 are also but the DS1621 is meant to replace it. The DS1631 and DS1721 are also
pin compatible with the DS1621, but provide multi-resolution support. pin compatible with the DS1621, but provide multi-resolution support.
Since there is no version register, there is no unique identification Since there is no version or vendor identification register, there is
for these devices. In addition, the DS1631 and DS1721 will emulate a no unique identification for these devices. Therefore, explicit device
DS1621 device, if not explicitly instantiated (why? because the detect instantiation is required for correct device identification and functionality.
function compares the temperature register values bits and checks for a
9-bit resolution). Therefore, for correct device identification and And, for correct identification and operation, each device must be
functionality, explicit device instantiation is required. explicitly instantiated, one device per address, in this address
range: 0x48..0x4f.
The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0 The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0
degree Celsius over a -10 to +85 degree range, a minimum/maximum alarm degree Celsius over a -10 to +85 degree range, a minimum/maximum alarm
......
...@@ -46,10 +46,6 @@ ...@@ -46,10 +46,6 @@
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/kernel.h> #include <linux/kernel.h>
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
/* Supported devices */ /* Supported devices */
enum chips { ds1621, ds1625, ds1631, ds1721 }; enum chips { ds1621, ds1625, ds1631, ds1721 };
...@@ -358,48 +354,6 @@ static const struct attribute_group ds1621_group = { ...@@ -358,48 +354,6 @@ static const struct attribute_group ds1621_group = {
.is_visible = ds1621_attribute_visible .is_visible = ds1621_attribute_visible
}; };
/* Return 0 if detection is successful, -ENODEV otherwise */
static int ds1621_detect(struct i2c_client *client,
struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;
int conf, temp;
int i;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
| I2C_FUNC_SMBUS_WORD_DATA
| I2C_FUNC_SMBUS_WRITE_BYTE))
return -ENODEV;
/*
* Now, we do the remaining detection. It is lousy.
*
* The NVB bit should be low if no EEPROM write has been requested
* during the latest 10ms, which is highly improbable in our case.
*/
conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
if (conf < 0 || conf & DS1621_REG_CONFIG_NVB)
return -ENODEV;
/*
* The ds1621 & ds1625 use 9-bit resolution, so the 7 lowest bits
* of the temperature should always be 0 (NOTE: The other chips
* have multi-resolution support, so if they have 9-bit resolution
* configured and the min/max temperature values set accordingly,
* then if not explicitly instantiated, they *will* appear as and
* emulate a ds1621 device).
*/
for (i = 0; i < ARRAY_SIZE(DS1621_REG_TEMP); i++) {
temp = i2c_smbus_read_word_data(client, DS1621_REG_TEMP[i]);
if (temp < 0 || (temp & 0x7f00))
return -ENODEV;
}
strlcpy(info->type, "ds1621", I2C_NAME_SIZE);
return 0;
}
static int ds1621_probe(struct i2c_client *client, static int ds1621_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -465,8 +419,6 @@ static struct i2c_driver ds1621_driver = { ...@@ -465,8 +419,6 @@ static struct i2c_driver ds1621_driver = {
.probe = ds1621_probe, .probe = ds1621_probe,
.remove = ds1621_remove, .remove = ds1621_remove,
.id_table = ds1621_id, .id_table = ds1621_id,
.detect = ds1621_detect,
.address_list = normal_i2c,
}; };
module_i2c_driver(ds1621_driver); module_i2c_driver(ds1621_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment