Skip to content

Commit 29e5507

Browse files
Michael Arndtgregkh
authored andcommitted
w1: w1_therm: Add force-pullup option for "broken" sensors
Signed-off-by: Michael Arndt <michael@scriptkiller.de> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9c95bb6 commit 29e5507

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

‎Documentation/w1/slaves/w1_therm‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@ currently supported. The driver also doesn't support reduced
3434
precision (which would also reduce the conversion time).
3535

3636
The module parameter strong_pullup can be set to 0 to disable the
37-
strong pullup or 1 to enable. If enabled the 5V strong pullup will be
38-
enabled when the conversion is taking place provided the master driver
39-
must support the strong pullup (or it falls back to a pullup
37+
strong pullup, 1 to enable autodetection or 2 to force strong pullup.
38+
In case of autodetection, the driver will use the "READ POWER SUPPLY"
39+
command to check if there are pariste powered devices on the bus.
40+
If so, it will activate the master's strong pullup.
41+
In case the detection of parasite devices using this command fails
42+
(seems to be the case with some DS18S20) the strong pullup can
43+
be force-enabled.
44+
If the strong pullup is enabled, the master's strong pullup will be
45+
driven when the conversion is taking place, provided the master driver
46+
does support the strong pullup (or it falls back to a pullup
4047
resistor). The DS18b20 temperature sensor specification lists a
4148
maximum current draw of 1.5mA and that a 5k pullup resistor is not
4249
sufficient. The strong pullup is designed to provide the additional

‎drivers/w1/slaves/w1_therm.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, temperature famil
4141
* If it was disabled a parasite powered device might not get the require
4242
* current to do a temperature conversion. If it is enabled parasite powered
4343
* devices have a better chance of getting the current required.
44+
* In case the parasite power-detection is not working (seems to be the case
45+
* for some DS18S20) the strong pullup can also be forced, regardless of the
46+
* power state of the devices.
47+
*
48+
* Summary of options:
49+
* - strong_pullup = 0 Disable strong pullup completely
50+
* - strong_pullup = 1 Enable automatic strong pullup detection
51+
* - strong_pullup = 2 Force strong pullup
4452
*/
4553
static int w1_strong_pullup = 1;
4654
module_param_named(strong_pullup, w1_strong_pullup, int, 0);
@@ -197,7 +205,8 @@ static ssize_t w1_therm_read(struct device *device,
197205
continue;
198206

199207
/* 750ms strong pullup (or delay) after the convert */
200-
if (!external_power && w1_strong_pullup)
208+
if (w1_strong_pullup == 2 ||
209+
(!external_power && w1_strong_pullup))
201210
w1_next_pullup(dev, tm);
202211

203212
w1_write_8(dev, W1_CONVERT_TEMP);

0 commit comments

Comments
 (0)