From 622eac03d340651e6710ad5b7088a5c1b6a77e38 Mon Sep 17 00:00:00 2001 From: Changki Kim Date: Wed, 27 Apr 2016 13:57:57 +0900 Subject: [PATCH] [COMMON] iio: exynos_adc: Insert enable_irq/disable_irq If interrupt is handled after clock is disable, external abort on non-linefetch is occurred. This patch disable interrupt before disable clock and enable interrupt after enable clock to avoid external abort. Change-Id: I028bd20ecd768ee3d2820249ab64dd1aae6b132e Signed-off-by: Eunki Kim Signed-off-by: Changki Kim Signed-off-by: Kyungwoo Kang --- drivers/iio/adc/exynos_adc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index b06bbd06069e..cafb117270f5 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -417,6 +417,9 @@ static void exynos_adc_v2_exit_hw(struct exynos_adc *info) con = readl(ADC_V2_CON1(info->regs)); con &= ~ADC_CON_EN_START; writel(con, ADC_V2_CON1(info->regs)); + + /* Disable interrupts */ + writel(0, ADC_V2_INT_EN(info->regs)); } static void exynos_adc_v2_clear_irq(struct exynos_adc *info) @@ -551,6 +554,10 @@ static int exynos_read_raw(struct iio_dev *indio_dev, if (ret) goto err_unlock; + enable_irq(info->irq); + if (info->data->init_hw) + info->data->init_hw(info); + /* Select the channel to be used and Trigger conversion */ if (info->data->start_conv) info->data->start_conv(info, chan->address); @@ -559,8 +566,6 @@ static int exynos_read_raw(struct iio_dev *indio_dev, EXYNOS_ADC_TIMEOUT); if (timeout == 0) { dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n"); - if (info->data->init_hw) - info->data->init_hw(info); ret = -ETIMEDOUT; } else { *val = info->value; @@ -568,6 +573,7 @@ static int exynos_read_raw(struct iio_dev *indio_dev, ret = IIO_VAL_INT; } + disable_irq(info->irq); exynos_adc_disable_access(info); err_unlock: mutex_unlock(&indio_dev->mlock); @@ -899,6 +905,7 @@ static int exynos_adc_probe(struct platform_device *pdev) goto err_disable_clk; } + disable_irq(info->irq); exynos_adc_disable_access(info); ret = iio_device_register(indio_dev); if (ret) -- 2.20.1