Ignore:
Timestamp:
Apr 21, 2017, 4:28:29 AM (2 months ago)
Author:
brainslayer
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.18/drivers/iio/adc/ti_am335x_adc.c

    r25370 r31885  
    123123        struct iio_dev *indio_dev = private;
    124124        struct tiadc_device *adc_dev = iio_priv(indio_dev);
    125         unsigned int status, config;
     125        unsigned int status, config, adc_fsm;
     126        unsigned short count = 0;
     127
    126128        status = tiadc_readl(adc_dev, REG_IRQSTATUS);
    127129
     
    137139                tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
    138140                                | IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
     141
     142                /* wait for idle state.
     143                 * ADC needs to finish the current conversion
     144                 * before disabling the module
     145                 */
     146                do {
     147                        adc_fsm = tiadc_readl(adc_dev, REG_ADCFSM);
     148                } while (adc_fsm != 0x10 && count++ < 100);
     149
    139150                tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
    140151                return IRQ_HANDLED;
Note: See TracChangeset for help on using the changeset viewer.