summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-27 09:11:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-27 09:11:25 +0200
commit1c816bad41fea5470e8077ae4e661f3f9b5ada64 (patch)
tree5e923d12b6284a711d66efee822ca48f95ebf1af /drivers/iio/adc
parentb0fe8f7b9b5adea2c85c72bba46e20fb21522769 (diff)
parentc02ed2e75ef4c74e41e421acb4ef1494671585e8 (diff)
downloadop-kernel-dev-1c816bad41fea5470e8077ae4e661f3f9b5ada64.zip
op-kernel-dev-1c816bad41fea5470e8077ae4e661f3f9b5ada64.tar.gz
Merge 4.11-rc4 into staging-next
We need the IIO fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index ad9dec3..4282cec 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -169,7 +169,9 @@ static irqreturn_t tiadc_irq_h(int irq, void *private)
{
struct iio_dev *indio_dev = private;
struct tiadc_device *adc_dev = iio_priv(indio_dev);
- unsigned int status, config;
+ unsigned int status, config, adc_fsm;
+ unsigned short count = 0;
+
status = tiadc_readl(adc_dev, REG_IRQSTATUS);
/*
@@ -183,6 +185,15 @@ static irqreturn_t tiadc_irq_h(int irq, void *private)
tiadc_writel(adc_dev, REG_CTRL, config);
tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
| IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
+
+ /* wait for idle state.
+ * ADC needs to finish the current conversion
+ * before disabling the module
+ */
+ do {
+ adc_fsm = tiadc_readl(adc_dev, REG_ADCFSM);
+ } while (adc_fsm != 0x10 && count++ < 100);
+
tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
return IRQ_HANDLED;
} else if (status & IRQENB_FIFO1THRES) {
OpenPOWER on IntegriCloud