aboutsummaryrefslogtreecommitdiff
path: root/drivers/w1/slaves/w1_ds2408.c
diff options
context:
space:
mode:
authorJean-Francois Dagenais <jeff.dagenais@gmail.com>2013-03-15 14:20:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-15 12:15:02 -0700
commitaceca2854498de7384ee7b44d8eb7820fd4c7f16 (patch)
treee48272e0dbb1e32ba947fbf9e6df6adea8860a26 /drivers/w1/slaves/w1_ds2408.c
parent96dd86fa588169b745a71aedf2070e80f4943623 (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/w1_ds2408.c')
-rw-r--r--drivers/w1/slaves/w1_ds2408.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/w1/slaves/w1_ds2408.c b/drivers/w1/slaves/w1_ds2408.c
index 441ad3a3b58..25a5168ab52 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(
w1_write_block(sl->master, w1_buf, 3);
readBack = w1_read_8(sl->master);
+
+ if (readBack != W1_F29_SUCCESS_CONFIRM_BYTE) {
+ if (w1_reset_resume_command(sl->master))
+ goto error;
+ /* try again, the slave is ready for a command */
+ continue;
+ }
+
+#ifdef CONFIG_W1_SLAVE_DS2408_READBACK
/* here the master could read another byte which
would be the PIO reg (the actual pin logic state)
since in this driver we don't know which pins are
@@ -186,11 +195,6 @@ static ssize_t w1_f29_write_output(
if (w1_reset_resume_command(sl->master))
goto error;
- if (readBack != 0xAA) {
- /* try again, the slave is ready for a command */
- continue;
- }
-
/* go read back the output latches */
/* (the direct effect of the write above) */
w1_buf[0] = W1_F29_FUNC_READ_PIO_REGS;
@@ -198,7 +202,9 @@ static ssize_t w1_f29_write_output(
w1_buf[2] = 0;
w1_write_block(sl->master, w1_buf, 3);
/* read the result of the READ_PIO_REGS command */
- if (w1_read_8(sl->master) == *buf) {
+ if (w1_read_8(sl->master) == *buf)
+#endif
+ {
/* success! */
mutex_unlock(&sl->master->bus_mutex);
dev_dbg(&sl->dev,