Commit 41a92a89 authored by Lucas Denefle's avatar Lucas Denefle Committed by Greg Kroah-Hartman

w1: w1_therm: fixes w1_seq for ds28ea00 sensors

w1_seq was failing due to several devices responding to the
CHAIN_DONE at the same time. Now properly selects the current
device in the chain with MATCH_ROM. Also acknowledgment was
read twice.
Signed-off-by: default avatarLucas Denefle <lucas.denefle@converge.io>
Link: https://lore.kernel.org/r/20220223113558.232750-1-lucas.denefle@converge.ioSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 085a8844
...@@ -2089,16 +2089,20 @@ static ssize_t w1_seq_show(struct device *device, ...@@ -2089,16 +2089,20 @@ static ssize_t w1_seq_show(struct device *device,
if (sl->reg_num.id == reg_num->id) if (sl->reg_num.id == reg_num->id)
seq = i; seq = i;
if (w1_reset_bus(sl->master))
goto error;
/* Put the device into chain DONE state */
w1_write_8(sl->master, W1_MATCH_ROM);
w1_write_block(sl->master, (u8 *)&rn, 8);
w1_write_8(sl->master, W1_42_CHAIN); w1_write_8(sl->master, W1_42_CHAIN);
w1_write_8(sl->master, W1_42_CHAIN_DONE); w1_write_8(sl->master, W1_42_CHAIN_DONE);
w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); w1_write_8(sl->master, W1_42_CHAIN_DONE_INV);
w1_read_block(sl->master, &ack, sizeof(ack));
/* check for acknowledgment */ /* check for acknowledgment */
ack = w1_read_8(sl->master); ack = w1_read_8(sl->master);
if (ack != W1_42_SUCCESS_CONFIRM_BYTE) if (ack != W1_42_SUCCESS_CONFIRM_BYTE)
goto error; goto error;
} }
/* Exit from CHAIN state */ /* Exit from CHAIN state */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment