[PATCH v3 4/5] iio: adc: ad7173: Clear append status bit

Dumitru Ceclan via B4 Relay posted 5 patches 1 year, 6 months ago
[PATCH v3 4/5] iio: adc: ad7173: Clear append status bit
Posted by Dumitru Ceclan via B4 Relay 1 year, 6 months ago
From: Dumitru Ceclan <dumitru.ceclan@analog.com>

The previous value of the append status bit was not cleared before
setting the new value. This caused the bit to remain set after enabling
buffered mode for multiple channels and not permit further buffered
reads from a single channel after the fact.

Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver")
Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
---
 drivers/iio/adc/ad7173.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c
index eb512878c30e..e66a137a76be 100644
--- a/drivers/iio/adc/ad7173.c
+++ b/drivers/iio/adc/ad7173.c
@@ -543,6 +543,7 @@ static int ad7173_append_status(struct ad_sigma_delta *sd, bool append)
 	unsigned int interface_mode = st->interface_mode;
 	int ret;
 
+	interface_mode &= ~AD7173_INTERFACE_DATA_STAT;
 	interface_mode |= AD7173_INTERFACE_DATA_STAT_EN(append);
 	ret = ad_sd_write_reg(&st->sd, AD7173_REG_INTERFACE_MODE, 2, interface_mode);
 	if (ret)

-- 
2.43.0
Re: [PATCH v3 4/5] iio: adc: ad7173: Clear append status bit
Posted by Jonathan Cameron 1 year, 6 months ago
On Thu, 30 May 2024 15:07:52 +0300
Dumitru Ceclan via B4 Relay <devnull+dumitru.ceclan.analog.com@kernel.org> wrote:

> From: Dumitru Ceclan <dumitru.ceclan@analog.com>
> 
> The previous value of the append status bit was not cleared before
> setting the new value. This caused the bit to remain set after enabling
> buffered mode for multiple channels and not permit further buffered
> reads from a single channel after the fact.
> 
> Fixes: 8eb903272f75 ("iio: adc: ad7173: add AD7173 driver")
> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
Applied to the fixes-togreg branch of iio.git.

> ---
>  drivers/iio/adc/ad7173.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c
> index eb512878c30e..e66a137a76be 100644
> --- a/drivers/iio/adc/ad7173.c
> +++ b/drivers/iio/adc/ad7173.c
> @@ -543,6 +543,7 @@ static int ad7173_append_status(struct ad_sigma_delta *sd, bool append)
>  	unsigned int interface_mode = st->interface_mode;
>  	int ret;
>  
> +	interface_mode &= ~AD7173_INTERFACE_DATA_STAT;
>  	interface_mode |= AD7173_INTERFACE_DATA_STAT_EN(append);
>  	ret = ad_sd_write_reg(&st->sd, AD7173_REG_INTERFACE_MODE, 2, interface_mode);
>  	if (ret)
>