diff options
author | Mariusz Bialonczyk <manio@skyboo.net> | 2016-03-29 12:41:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-01 17:04:19 -0400 |
commit | f704938c0ef1e3224e66b16d5b358f02cd351240 (patch) | |
tree | 4b3b7aad0c8d20bea8a682162ee66f2ae2525c36 /drivers/w1 | |
parent | a8ab316ab12501908cc355fee6aff7065609f4e2 (diff) |
w1: enable active pullup for DS2482 by default
This commit enables the active pullup (APU bit) by default for
the DS2482 1-Wire master.
>From the DS2482 datasheet:
"The APU bit controls whether an active pullup (controlled slew-rate
transistor) or a passive pullup (Rwpu resistor) will be used to drive
a 1-Wire line from low to high. When APU = 0, active pullup is disabled
(resistor mode). Active Pullup should always be selected unless there is
only a single slave on the 1-Wire line."
According to the module author, Ben Gardner:
"It doesn't look like active pullup would cause any hurt if there
is only a single slave."
And my tests with multiple and single slaves on 1-Wire bus
confirms that.
This active pullup can be manually disabled using the introduced
module parameter:
active_pullup = 0
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r-- | drivers/w1/masters/ds2482.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c index b05e8fefbabd..2e30db1b1a43 100644 --- a/drivers/w1/masters/ds2482.c +++ b/drivers/w1/masters/ds2482.c | |||
@@ -24,6 +24,19 @@ | |||
24 | #include "../w1_int.h" | 24 | #include "../w1_int.h" |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Allow the active pullup to be disabled, default is enabled. | ||
28 | * | ||
29 | * Note from the DS2482 datasheet: | ||
30 | * The APU bit controls whether an active pullup (controlled slew-rate | ||
31 | * transistor) or a passive pullup (Rwpu resistor) will be used to drive | ||
32 | * a 1-Wire line from low to high. When APU = 0, active pullup is disabled | ||
33 | * (resistor mode). Active Pullup should always be selected unless there is | ||
34 | * only a single slave on the 1-Wire line. | ||
35 | */ | ||
36 | static int ds2482_active_pullup = 1; | ||
37 | module_param_named(active_pullup, ds2482_active_pullup, int, 0644); | ||
38 | |||
39 | /** | ||
27 | * The DS2482 registers - there are 3 registers that are addressed by a read | 40 | * The DS2482 registers - there are 3 registers that are addressed by a read |
28 | * pointer. The read pointer is set by the last command executed. | 41 | * pointer. The read pointer is set by the last command executed. |
29 | * | 42 | * |
@@ -138,6 +151,9 @@ struct ds2482_data { | |||
138 | */ | 151 | */ |
139 | static inline u8 ds2482_calculate_config(u8 conf) | 152 | static inline u8 ds2482_calculate_config(u8 conf) |
140 | { | 153 | { |
154 | if (ds2482_active_pullup) | ||
155 | conf |= DS2482_REG_CFG_APU; | ||
156 | |||
141 | return conf | ((~conf & 0x0f) << 4); | 157 | return conf | ((~conf & 0x0f) << 4); |
142 | } | 158 | } |
143 | 159 | ||
@@ -546,6 +562,8 @@ static int ds2482_remove(struct i2c_client *client) | |||
546 | 562 | ||
547 | module_i2c_driver(ds2482_driver); | 563 | module_i2c_driver(ds2482_driver); |
548 | 564 | ||
565 | MODULE_PARM_DESC(active_pullup, "Active pullup (apply to all buses): " \ | ||
566 | "0-disable, 1-enable (default)"); | ||
549 | MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>"); | 567 | MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>"); |
550 | MODULE_DESCRIPTION("DS2482 driver"); | 568 | MODULE_DESCRIPTION("DS2482 driver"); |
551 | MODULE_LICENSE("GPL"); | 569 | MODULE_LICENSE("GPL"); |