File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -248,12 +248,14 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
248248 struct iio_poll_func * pf = p ;
249249 struct iio_dev * idev = pf -> indio_dev ;
250250 struct at91_adc_state * st = iio_priv (idev );
251+ struct iio_chan_spec * chan ;
251252 int i , j = 0 ;
252253
253254 for (i = 0 ; i < idev -> masklength ; i ++ ) {
254255 if (!test_bit (i , idev -> active_scan_mask ))
255256 continue ;
256- st -> buffer [j ] = at91_adc_readl (st , AT91_ADC_CHAN (st , i ));
257+ chan = idev -> channels + i ;
258+ st -> buffer [j ] = at91_adc_readl (st , AT91_ADC_CHAN (st , chan -> channel ));
257259 j ++ ;
258260 }
259261
@@ -712,6 +714,11 @@ static int at91_adc_read_raw(struct iio_dev *idev,
712714 at91_adc_writel (st , AT91_ADC_CHDR ,
713715 AT91_ADC_CH (chan -> channel ));
714716 at91_adc_writel (st , AT91_ADC_IDR , BIT (chan -> channel ));
717+ /*
718+ * we need to ack the DRDY irq, otherwise it will be
719+ * left pending and irq handler will be confused
720+ */
721+ at91_adc_readl (st , AT91_ADC_LCDR );
715722
716723 st -> last_value = 0 ;
717724 st -> done = false;
You can’t perform that action at this time.
0 commit comments