Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 363103
b: refs/heads/master
c: aceca28
h: refs/heads/master
i:
  363101: 3e33a85
  363099: 76663eb
  363095: e61f328
  363087: 2aae9f9
  363071: 8d30774
v: v3
  • Loading branch information
Jean-Francois Dagenais authored and Greg Kroah-Hartman committed Mar 15, 2013
1 parent 5bbbdea commit bfe0f87
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 96dd86fa588169b745a71aedf2070e80f4943623
refs/heads/master: aceca2854498de7384ee7b44d8eb7820fd4c7f16
10 changes: 10 additions & 0 deletions trunk/drivers/w1/slaves/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ config W1_SLAVE_DS2408
Say Y here if you want to use a 1-wire
DS2408 8-Channel Addressable Switch device support

config W1_SLAVE_DS2408_READBACK
bool "Read-back values written to DS2408's output register"
depends on W1_SLAVE_DS2408
default y
help
Enabling this will cause the driver to read back the values written
to the chip's output register in order to detect errors.

This is slower but useful when debugging chips and/or busses.

config W1_SLAVE_DS2413
tristate "Dual Channel Addressable Switch 0x3a family support (DS2413)"
help
Expand Down
18 changes: 12 additions & 6 deletions trunk/drivers/w1/slaves/w1_ds2408.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -186,19 +195,16 @@ 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;
w1_buf[1] = W1_F29_REG_OUTPUT_LATCH_STATE;
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,
Expand Down

0 comments on commit bfe0f87

Please sign in to comment.