mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: adi-axi-adc: fix ad7606_bus_reg_read()
@ 2025-05-30 19:09 David Lechner
  2025-05-30 19:14 ` David Lechner
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2025-05-30 19:09 UTC (permalink / raw)
  To: Michael Hennerich, Jonathan Cameron, Angelo Dureghello, Guillaume Stols
  Cc: linux-iio, linux-kernel, stable, David Lechner

Mask the value read before returning it. The value read over the
parallel bus via the AXI ADC IP block contains both the address and
the data, but callers expect val to only contain the data.

Cc: stable@vger.kernel.org
Fixes: 79c47485e438 ("iio: adc: adi-axi-adc: add support for AD7606 register writing")
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/adi-axi-adc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
index cf942c043457ccea49207c3900153ee371b3774f..d4759a98b4062bc25ea088e3868806e82db03e8d 100644
--- a/drivers/iio/adc/adi-axi-adc.c
+++ b/drivers/iio/adc/adi-axi-adc.c
@@ -457,6 +457,9 @@ static int ad7606_bus_reg_read(struct iio_backend *back, u32 reg, u32 *val)
 	axi_adc_raw_write(back, addr);
 	axi_adc_raw_read(back, val);
 
+	/* Register value is 8 bits. Remove address bits. */
+	*val &= 0xFF;
+
 	/* Write 0x0 on the bus to get back to ADC mode */
 	axi_adc_raw_write(back, 0);
 

---
base-commit: 7cdfbc0113d087348b8e65dd79276d0f57b89a10
change-id: 20250530-iio-adc-adi-axi-adc-fix-ad7606_bus_reg_read-f2bbb503db8b

Best regards,
-- 
David Lechner <dlechner@baylibre.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-30 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-30 19:09 [PATCH] iio: adc: adi-axi-adc: fix ad7606_bus_reg_read() David Lechner
2025-05-30 19:14 ` David Lechner
2025-05-30 21:50   ` David Lechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®