[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250408-ad3552r-fix-bus-read-v1-2-37add66aeb08@baylibre.com>
Date: Tue, 08 Apr 2025 22:49:01 +0200
From: Angelo Dureghello <adureghello@...libre.com>
To: Nuno Sa <nuno.sa@...log.com>, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
Andy Shevchenko <andy@...nel.org>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Angelo Dureghello <adureghello@...libre.com>
Subject: [PATCH 2/2] iio: dac: adi-axi-dac: fix bus read
From: Angelo Dureghello <adureghello@...libre.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@...libre.com>
---
drivers/iio/dac/adi-axi-dac.c | 4 ++++
1 file changed, 4 insertions(+)
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);
}
--
2.49.0
Powered by blists - more mailing lists