]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: ad_sigma_delta: select channel when reading register
authorDragos Bogdan <dragos.bogdan@analog.com>
Tue, 19 Mar 2019 10:47:00 +0000 (12:47 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Aug 2019 11:38:53 +0000 (12:38 +0100)
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.bogdan@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/iio/adc/ad_sigma_delta.c

index dbcea7941059c0129dc97630ceb096d4836d62cf..3837cbdaf1004884c7d853019a45f05d20db122c 100644 (file)
@@ -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);