aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Coulson <rob.coulson@gmail.com>2013-06-10 21:46:02 -0400
committerGuenter Roeck <linux@roeck-us.net>2013-06-27 13:30:43 -0400
commit260f81ffc1b9f09dde355caa09e4b312756666f0 (patch)
tree46d929b1f8e1834a06007bdeaee4ad9d68e0bb82
parent2ec2819623521c28de3ab5d6e1f096542d032246 (diff)
hwmon: (ds1621) Add DS1731 chip support to ds1621 driver
These changes add DS1731 chip support to the ds1621 driver, Kconfig, and documentation. Signed-off-by: Robert Coulson <rob.coulson@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--Documentation/hwmon/ds162131
-rw-r--r--drivers/hwmon/Kconfig1
-rw-r--r--drivers/hwmon/ds1621.c12
3 files changed, 26 insertions, 18 deletions
diff --git a/Documentation/hwmon/ds1621 b/Documentation/hwmon/ds1621
index 83780660f5b1..c0817f7934e4 100644
--- a/Documentation/hwmon/ds1621
+++ b/Documentation/hwmon/ds1621
@@ -22,6 +22,11 @@ Supported chips:
22 Addresses scanned: none 22 Addresses scanned: none
23 Datasheet: Publicly available from www.maximintegrated.com 23 Datasheet: Publicly available from www.maximintegrated.com
24 24
25 * Maxim Integrated DS1731
26 Prefix: 'ds1731'
27 Addresses scanned: none
28 Datasheet: Publicly available from www.maximintegrated.com
29
25Authors: 30Authors:
26 Christian W. Zuckschwerdt <zany@triq.net> 31 Christian W. Zuckschwerdt <zany@triq.net>
27 valuable contributions by Jan M. Sendler <sendler@sendler.de> 32 valuable contributions by Jan M. Sendler <sendler@sendler.de>
@@ -72,8 +77,8 @@ Temperature conversion of the DS1621 takes up to 1000ms; internal access to
72non-volatile registers may last for 10ms or below. 77non-volatile registers may last for 10ms or below.
73 78
74The DS1625 is pin compatible and functionally equivalent with the DS1621, 79The DS1625 is pin compatible and functionally equivalent with the DS1621,
75but the DS1621 is meant to replace it. The DS1631 and DS1721 are also 80but the DS1621 is meant to replace it. The DS1631, DS1721, and DS1731 are
76pin compatible with the DS1621, but provide multi-resolution support. 81also pin compatible with the DS1621, but provide multi-resolution support.
77 82
78Since there is no version or vendor identification register, there is 83Since there is no version or vendor identification register, there is
79no unique identification for these devices. Therefore, explicit device 84no unique identification for these devices. Therefore, explicit device
@@ -84,26 +89,26 @@ explicitly instantiated, one device per address, in this address
84range: 0x48..0x4f. 89range: 0x48..0x4f.
85 90
86The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0 91The DS1721 is pin compatible with the DS1621, has an accuracy of +/- 1.0
87degree Celsius over a -10 to +85 degree range, a minimum/maximum alarm 92degree Celsius (from -10 to +85 degrees), a minimum/maximum alarm default
88default setting of 75 and 80 degrees respectively, and a maximum conversion 93setting of 75 and 80 degrees, and a maximum conversion time of 750ms.
89time of 750ms.
90 94
91In addition, the DS1721 supports four resolution settings from 9 to 12 bits 95In addition, the DS1721 supports four resolution settings from 9 to 12 bits
92(defined in degrees C per LSB: 0.5, 0.25, 0.125, and 0.0625, respectifully), 96(defined in degrees C per LSB: 0.5, 0.25, 0.125, and 0.0625, respectively),
93that are set at device power on to the highest resolution: 12-bits. 97that are set at device power on to the highest resolution: 12-bits.
94 98
95One additional note about the ds1721 is that although the data sheet says 99One additional note about the ds1721 is that although the data sheet says
96the temperature flags (THF and TLF) are used internally, these flags do 100the temperature flags (THF and TLF) are used internally, these flags do
97get set and cleared as the actual temperature crosses the min or max settings. 101get set and cleared as the actual temperature crosses the min or max settings.
98 102
99The DS1631 is also pin compatible with the DS1621 and feature compatible with 103The DS1631 and DS1731 are pin compatible with the DS1621 and feature compatible
100the DS1721, however the DS1631 accuracy is +/- 0.5 degree Celsius over the 104with the DS1721. However, the DS1631 accuracy is +/- 0.5 degree Celsius (from 0
101same range. 105to +70 degrees), while the DS1731 accuracy is +/-1 degree Celsius (from -10 to
106+85 degrees).
102 107
103Changing the DS1631/1721 resolution mode affects the conversion time and can be 108The resolution mode for the DS1631, DS1721, or DS1731 can be changed from
104done from userspace, via the device 'update_interval' sysfs attribute. This 109userspace, via the device 'update_interval' sysfs attribute. This attribute
105attribute will normalize range of input values to the device maximum resolution 110will normalize the range of input values to the device maximum resolution
106values defined in the datasheet as such: 111values defined in the datasheet as follows:
107 112
108Resolution Conversion Time Input Range 113Resolution Conversion Time Input Range
109 (C/LSB) (msec) (msec) 114 (C/LSB) (msec) (msec)
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 4f713705d373..683c769a8fca 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -357,6 +357,7 @@ config SENSORS_DS1621
357 - Dallas Semiconductor DS1625 357 - Dallas Semiconductor DS1625
358 - Maxim Integrated DS1631 358 - Maxim Integrated DS1631
359 - Maxim Integrated DS1721 359 - Maxim Integrated DS1721
360 - Maxim Integrated DS1731
360 361
361 This driver can also be built as a module. If so, the module 362 This driver can also be built as a module. If so, the module
362 will be called ds1621. 363 will be called ds1621.
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 8e940ad9cb36..591758bb629f 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -10,8 +10,8 @@
10 * resolution, a thermal alarm output (Tout), and user-defined minimum 10 * resolution, a thermal alarm output (Tout), and user-defined minimum
11 * and maximum temperature thresholds (TH and TL). 11 * and maximum temperature thresholds (TH and TL).
12 * 12 *
13 * The DS1625, DS1631, and DS1721 are pin compatible with the DS1621 and 13 * The DS1625, DS1631, DS1721, and DS1731 are pin compatible with the DS1621
14 * similar in operation, with slight variations as noted in the device 14 * and similar in operation, with slight variations as noted in the device
15 * datasheets (please refer to www.maximintegrated.com for specific 15 * datasheets (please refer to www.maximintegrated.com for specific
16 * device information). 16 * device information).
17 * 17 *
@@ -47,7 +47,7 @@
47#include <linux/kernel.h> 47#include <linux/kernel.h>
48 48
49/* Supported devices */ 49/* Supported devices */
50enum chips { ds1621, ds1625, ds1631, ds1721 }; 50enum chips { ds1621, ds1625, ds1631, ds1721, ds1731 };
51 51
52/* Insmod parameters */ 52/* Insmod parameters */
53static int polarity = -1; 53static int polarity = -1;
@@ -65,7 +65,7 @@ MODULE_PARM_DESC(polarity, "Output's polarity: 0 = active high, 1 = active low")
65 * 7 6 5 4 3 2 1 0 65 * 7 6 5 4 3 2 1 0
66 * |Done|THF |TLF |NVB | 1 | 0 |POL |1SHOT| 66 * |Done|THF |TLF |NVB | 1 | 0 |POL |1SHOT|
67 * 67 *
68 * - DS1631: 68 * - DS1631, DS1731:
69 * 7 6 5 4 3 2 1 0 69 * 7 6 5 4 3 2 1 0
70 * |Done|THF |TLF |NVB | R1 | R0 |POL |1SHOT| 70 * |Done|THF |TLF |NVB | R1 | R0 |POL |1SHOT|
71 * 71 *
@@ -140,7 +140,7 @@ static inline int DS1621_TEMP_FROM_REG(u16 reg)
140 * TEMP: 0.001C/bit (-55C to +125C) 140 * TEMP: 0.001C/bit (-55C to +125C)
141 * REG: 141 * REG:
142 * - 1621, 1625: 0.5C/bit 142 * - 1621, 1625: 0.5C/bit
143 * - 1631, 1721: 0.0625C/bit 143 * - 1631, 1721, 1731: 0.0625C/bit
144 * Assume highest resolution and let the bits fall where they may.. 144 * Assume highest resolution and let the bits fall where they may..
145 */ 145 */
146static inline u16 DS1621_TEMP_TO_REG(long temp) 146static inline u16 DS1621_TEMP_TO_REG(long temp)
@@ -176,6 +176,7 @@ static void ds1621_init_client(struct i2c_client *client)
176 break; 176 break;
177 case ds1631: 177 case ds1631:
178 case ds1721: 178 case ds1721:
179 case ds1731:
179 resol = (new_conf & DS1621_REG_CONFIG_RESOL) >> 180 resol = (new_conf & DS1621_REG_CONFIG_RESOL) >>
180 DS1621_REG_CONFIG_RESOL_SHIFT; 181 DS1621_REG_CONFIG_RESOL_SHIFT;
181 data->update_interval = ds1721_convrates[resol]; 182 data->update_interval = ds1721_convrates[resol];
@@ -406,6 +407,7 @@ static const struct i2c_device_id ds1621_id[] = {
406 { "ds1625", ds1625 }, 407 { "ds1625", ds1625 },
407 { "ds1631", ds1631 }, 408 { "ds1631", ds1631 },
408 { "ds1721", ds1721 }, 409 { "ds1721", ds1721 },
410 { "ds1731", ds1731 },
409 { } 411 { }
410}; 412};
411MODULE_DEVICE_TABLE(i2c, ds1621_id); 413MODULE_DEVICE_TABLE(i2c, ds1621_id);