diff options
author | Jean-Francois Dagenais <jeff.dagenais@gmail.com> | 2013-03-15 14:20:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-15 15:15:02 -0400 |
commit | aceca2854498de7384ee7b44d8eb7820fd4c7f16 (patch) | |
tree | e48272e0dbb1e32ba947fbf9e6df6adea8860a26 /drivers/w1/slaves | |
parent | 96dd86fa588169b745a71aedf2070e80f4943623 (diff) |
w1: ds2408: make value read-back check a Kconfig option
De-activating this reading back will effectively half the time required
for a write to the output register.
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1/slaves')
-rw-r--r-- | drivers/w1/slaves/Kconfig | 10 | ||||
-rw-r--r-- | drivers/w1/slaves/w1_ds2408.c | 18 |
2 files changed, 22 insertions, 6 deletions
diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig index 762561fbabbf..5e6a3c9e510b 100644 --- a/drivers/w1/slaves/Kconfig +++ b/drivers/w1/slaves/Kconfig | |||
@@ -22,6 +22,16 @@ config W1_SLAVE_DS2408 | |||
22 | Say Y here if you want to use a 1-wire | 22 | Say Y here if you want to use a 1-wire |
23 | DS2408 8-Channel Addressable Switch device support | 23 | DS2408 8-Channel Addressable Switch device support |
24 | 24 | ||
25 | config W1_SLAVE_DS2408_READBACK | ||
26 | bool "Read-back values written to DS2408's output register" | ||
27 | depends on W1_SLAVE_DS2408 | ||
28 | default y | ||
29 | help | ||
30 | Enabling this will cause the driver to read back the values written | ||
31 | to the chip's output register in order to detect errors. | ||
32 | |||
33 | This is slower but useful when debugging chips and/or busses. | ||
34 | |||
25 | config W1_SLAVE_DS2413 | 35 | config W1_SLAVE_DS2413 |
26 | tristate "Dual Channel Addressable Switch 0x3a family support (DS2413)" | 36 | tristate "Dual Channel Addressable Switch 0x3a family support (DS2413)" |
27 | help | 37 | help |
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c index 441ad3a3b586..25a5168ab522 100644 --- a/drivers/w1/slaves/w1_ds2408.c +++ b/drivers/w1/slaves/w1_ds2408.c | |||
@@ -178,6 +178,15 @@ static ssize_t w1_f29_write_output( | |||
178 | w1_write_block(sl->master, w1_buf, 3); | 178 | w1_write_block(sl->master, w1_buf, 3); |
179 | 179 | ||
180 | readBack = w1_read_8(sl->master); | 180 | readBack = w1_read_8(sl->master); |
181 | |||
182 | if (readBack != W1_F29_SUCCESS_CONFIRM_BYTE) { | ||
183 | if (w1_reset_resume_command(sl->master)) | ||
184 | goto error; | ||
185 | /* try again, the slave is ready for a command */ | ||
186 | continue; | ||
187 | } | ||
188 | |||
189 | #ifdef CONFIG_W1_SLAVE_DS2408_READBACK | ||
181 | /* here the master could read another byte which | 190 | /* here the master could read another byte which |
182 | would be the PIO reg (the actual pin logic state) | 191 | would be the PIO reg (the actual pin logic state) |
183 | since in this driver we don't know which pins are | 192 | since in this driver we don't know which pins are |
@@ -186,11 +195,6 @@ static ssize_t w1_f29_write_output( | |||
186 | if (w1_reset_resume_command(sl->master)) | 195 | if (w1_reset_resume_command(sl->master)) |
187 | goto error; | 196 | goto error; |
188 | 197 | ||
189 | if (readBack != 0xAA) { | ||
190 | /* try again, the slave is ready for a command */ | ||
191 | continue; | ||
192 | } | ||
193 | |||
194 | /* go read back the output latches */ | 198 | /* go read back the output latches */ |
195 | /* (the direct effect of the write above) */ | 199 | /* (the direct effect of the write above) */ |
196 | w1_buf[0] = W1_F29_FUNC_READ_PIO_REGS; | 200 | w1_buf[0] = W1_F29_FUNC_READ_PIO_REGS; |
@@ -198,7 +202,9 @@ static ssize_t w1_f29_write_output( | |||
198 | w1_buf[2] = 0; | 202 | w1_buf[2] = 0; |
199 | w1_write_block(sl->master, w1_buf, 3); | 203 | w1_write_block(sl->master, w1_buf, 3); |
200 | /* read the result of the READ_PIO_REGS command */ | 204 | /* read the result of the READ_PIO_REGS command */ |
201 | if (w1_read_8(sl->master) == *buf) { | 205 | if (w1_read_8(sl->master) == *buf) |
206 | #endif | ||
207 | { | ||
202 | /* success! */ | 208 | /* success! */ |
203 | mutex_unlock(&sl->master->bus_mutex); | 209 | mutex_unlock(&sl->master->bus_mutex); |
204 | dev_dbg(&sl->dev, | 210 | dev_dbg(&sl->dev, |