diff options
author | Octavian Purdila <octavian.purdila@intel.com> | 2015-03-02 14:03:05 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-03-07 14:17:07 -0500 |
commit | 70dddeee8945a0e62525a278ae7b91778f82f765 (patch) | |
tree | f286fe21ec087a95cf3c285604f3114a1aaa24af /drivers/iio/adc | |
parent | abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 (diff) |
iio: fix drivers that check buffer->scan_mask
If the in-kernel push interface is used we may have a different masks
on the device buffer and the kernel buffer and in this case the device
should generate data for the reunion of the buffers, which is
available at indio_dev->active_scan_mask.
Compiled tested only except for bmc150-accel which was tested at
runtime with the hardware.
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/at91_adc.c | 5 | ||||
-rw-r--r-- | drivers/iio/adc/ti_am335x_adc.c | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index ff61ae55dd3f..8a0eb4a04fb5 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | |||
544 | { | 544 | { |
545 | struct iio_dev *idev = iio_trigger_get_drvdata(trig); | 545 | struct iio_dev *idev = iio_trigger_get_drvdata(trig); |
546 | struct at91_adc_state *st = iio_priv(idev); | 546 | struct at91_adc_state *st = iio_priv(idev); |
547 | struct iio_buffer *buffer = idev->buffer; | ||
548 | struct at91_adc_reg_desc *reg = st->registers; | 547 | struct at91_adc_reg_desc *reg = st->registers; |
549 | u32 status = at91_adc_readl(st, reg->trigger_register); | 548 | u32 status = at91_adc_readl(st, reg->trigger_register); |
550 | int value; | 549 | int value; |
@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | |||
564 | at91_adc_writel(st, reg->trigger_register, | 563 | at91_adc_writel(st, reg->trigger_register, |
565 | status | value); | 564 | status | value); |
566 | 565 | ||
567 | for_each_set_bit(bit, buffer->scan_mask, | 566 | for_each_set_bit(bit, idev->active_scan_mask, |
568 | st->num_channels) { | 567 | st->num_channels) { |
569 | struct iio_chan_spec const *chan = idev->channels + bit; | 568 | struct iio_chan_spec const *chan = idev->channels + bit; |
570 | at91_adc_writel(st, AT91_ADC_CHER, | 569 | at91_adc_writel(st, AT91_ADC_CHER, |
@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | |||
579 | at91_adc_writel(st, reg->trigger_register, | 578 | at91_adc_writel(st, reg->trigger_register, |
580 | status & ~value); | 579 | status & ~value); |
581 | 580 | ||
582 | for_each_set_bit(bit, buffer->scan_mask, | 581 | for_each_set_bit(bit, idev->active_scan_mask, |
583 | st->num_channels) { | 582 | st->num_channels) { |
584 | struct iio_chan_spec const *chan = idev->channels + bit; | 583 | struct iio_chan_spec const *chan = idev->channels + bit; |
585 | at91_adc_writel(st, AT91_ADC_CHDR, | 584 | at91_adc_writel(st, AT91_ADC_CHDR, |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 2e5cc4409f78..a0e7161f040c 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -188,12 +188,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev) | |||
188 | static int tiadc_buffer_postenable(struct iio_dev *indio_dev) | 188 | static int tiadc_buffer_postenable(struct iio_dev *indio_dev) |
189 | { | 189 | { |
190 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 190 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
191 | struct iio_buffer *buffer = indio_dev->buffer; | ||
192 | unsigned int enb = 0; | 191 | unsigned int enb = 0; |
193 | u8 bit; | 192 | u8 bit; |
194 | 193 | ||
195 | tiadc_step_config(indio_dev); | 194 | tiadc_step_config(indio_dev); |
196 | for_each_set_bit(bit, buffer->scan_mask, adc_dev->channels) | 195 | for_each_set_bit(bit, indio_dev->active_scan_mask, adc_dev->channels) |
197 | enb |= (get_adc_step_bit(adc_dev, bit) << 1); | 196 | enb |= (get_adc_step_bit(adc_dev, bit) << 1); |
198 | adc_dev->buffer_en_ch_steps = enb; | 197 | adc_dev->buffer_en_ch_steps = enb; |
199 | 198 | ||