Skip to content

Commit f8024c4

Browse files
committed
Merge branch 'at91-4.14-trunk/adc' into linux-4.14-at91
2 parents 2042779 + e5a69c1 commit f8024c4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/iio/adc/at91_adc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)