iio: ad_sigma_delta: select channel when reading register [Linux 3.16.72]

This Linux kernel change "iio: ad_sigma_delta: select channel when reading register" is included in the Linux 3.16.72 release. This change is authored by Dragos Bogdan <dragos.bogdan [at] analog.com> on Tue Mar 19 12:47:00 2019 +0200. The commit for this change in Linux stable tree is 48960a3 (patch) which is from upstream commit fccfb9c. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream fccfb9c.

iio: ad_sigma_delta: select channel when reading register

commit fccfb9ce70ed4ea7a145f77b86de62e38178517f upstream.

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[email protected]>
Signed-off-by: Alexandru Ardelean <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Signed-off-by: Ben Hutchings <[email protected]>

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 dbcea79..3837cbd 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);

Leave a Reply

Your email address will not be published. Required fields are marked *