diff mbox series

iio: ad_sigma_delta: select channel when reading register

Message ID 20190319104700.28357-1-alexandru.ardelean@analog.com (mailing list archive)
State New, archived
Headers show
Series iio: ad_sigma_delta: select channel when reading register | expand

Commit Message

Alexandru Ardelean March 19, 2019, 10:47 a.m. UTC
From: Dragos Bogdan <dragos.bogdan@analog.com>

The desired channel has to be selected in order to correctly fill the
buffer with the corresponding data.
The `ad_sd_write_reg()` already does this, but for the
`ad_sd_read_reg_raw()` this was omitted.

Fixes: af3008485ea03 ("iio:adc: Add common code for ADI Sigma Delta devices")
Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/adc/ad_sigma_delta.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jonathan Cameron March 24, 2019, 5:51 p.m. UTC | #1
On Tue, 19 Mar 2019 12:47:00 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> From: Dragos Bogdan <dragos.bogdan@analog.com>
> 
> The desired channel has to be selected in order to correctly fill the
> buffer with the corresponding data.
> The `ad_sd_write_reg()` already does this, but for the
> `ad_sd_read_reg_raw()` this was omitted.
> 
> Fixes: af3008485ea03 ("iio:adc: Add common code for ADI Sigma Delta devices")
> Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad_sigma_delta.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
> index ff5f2da2e1b1..54d9978b2740 100644
> --- a/drivers/iio/adc/ad_sigma_delta.c
> +++ b/drivers/iio/adc/ad_sigma_delta.c
> @@ -121,6 +121,7 @@ static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta,
>  	if (sigma_delta->info->has_registers) {
>  		data[0] = reg << sigma_delta->info->addr_shift;
>  		data[0] |= sigma_delta->info->read_mask;
> +		data[0] |= sigma_delta->comm;
>  		spi_message_add_tail(&t[0], &m);
>  	}
>  	spi_message_add_tail(&t[1], &m);
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
index ff5f2da2e1b1..54d9978b2740 100644
--- a/drivers/iio/adc/ad_sigma_delta.c
+++ b/drivers/iio/adc/ad_sigma_delta.c
@@ -121,6 +121,7 @@  static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta,
 	if (sigma_delta->info->has_registers) {
 		data[0] = reg << sigma_delta->info->addr_shift;
 		data[0] |= sigma_delta->info->read_mask;
+		data[0] |= sigma_delta->comm;
 		spi_message_add_tail(&t[0], &m);
 	}
 	spi_message_add_tail(&t[1], &m);