Skip to content

Commit

Permalink
iio: adc: ad7124: fix chip ID mismatch
Browse files Browse the repository at this point in the history
commit 96f9ab0 upstream.

The ad7124_soft_reset() function has the assumption that the chip will
assert the "power-on reset" bit in the STATUS register after a software
reset without any delay. The POR bit =0 is used to check if the chip
initialization is done.

A chip ID mismatch probe error appears intermittently when the probe
continues too soon and the ID register does not contain the expected
value.

Fix by adding a 200us delay after the software reset command is issued.

Fixes: b3af341 ("iio: adc: Add ad7124 support")
Signed-off-by: Dumitru Ceclan <[email protected]>
Reviewed-by: Nuno Sa <[email protected]>
Link: https://patch.msgid.link/[email protected]
Cc: <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ceclandumitru authored and gregkh committed Sep 12, 2024
1 parent 6e4bf8e commit 76a160c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/iio/adc/ad7124.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ static int ad7124_soft_reset(struct ad7124_state *st)
if (ret < 0)
return ret;

fsleep(200);
timeout = 100;
do {
ret = ad_sd_read_reg(&st->sd, AD7124_STATUS, 1, &readval);
Expand Down

0 comments on commit 76a160c

Please sign in to comment.