diff mbox series

[2/2] iio: dac: adi-axi-dac: fix bus read

Message ID 20250408-ad3552r-fix-bus-read-v1-2-37add66aeb08@baylibre.com (mailing list archive)
State Changes Requested
Headers show
Series iio: dac: adi-axi-dac: fix for wrong bus read | expand

Commit Message

Angelo Dureghello April 8, 2025, 8:49 p.m. UTC
From: Angelo Dureghello <adureghello@baylibre.com>

Fix bus read function.

Testing the driver, on a random basis, wrong reads was detected, mainly
by a wrong DAC chip ID read at first boot.
Before reading the expected value from the regmap, need always to wait
for busy flag to be cleared.

Fixes: e61d7178429a ("iio: dac: adi-axi-dac: extend features")
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
---
 drivers/iio/dac/adi-axi-dac.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c
index 91557aa6797a3478de3607e5733c162d7745a3b2..de959ab116e26f98385d5f5c259d6d1e01a448d9 100644
--- a/drivers/iio/dac/adi-axi-dac.c
+++ b/drivers/iio/dac/adi-axi-dac.c
@@ -780,6 +780,10 @@  static int axi_dac_bus_reg_read(struct iio_backend *back, u32 reg, u32 *val,
 	if (ret)
 		return ret;
 
+	ret = axi_dac_wait_bus_free(st);
+	if (ret)
+		return ret;
+
 	return regmap_read(st->regmap, AXI_DAC_CUSTOM_RD_REG, val);
 }