[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <90226114-646c-4af7-bd38-361ac383699f@baylibre.com>
Date: Fri, 30 May 2025 14:14:32 -0500
From: David Lechner <dlechner@...libre.com>
To: Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Angelo Dureghello <adureghello@...libre.com>,
Guillaume Stols <gstols@...libre.com>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] iio: adc: adi-axi-adc: fix ad7606_bus_reg_read()
On 5/30/25 2:09 PM, David Lechner wrote:
> 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@...r.kernel.org
> Fixes: 79c47485e438 ("iio: adc: adi-axi-adc: add support for AD7606 register writing")
> Signed-off-by: David Lechner <dlechner@...libre.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;
I just found out that there is ADI_AXI_REG_VALUE_MASK we can use
here instead of 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,
Powered by blists - more mailing lists