summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/exynos_adc.c
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2013-03-13 20:40:00 +0000
committerJonathan Cameron <jic23@kernel.org>2013-03-17 22:46:55 +0000
commitbb916ebbeabd18f7dc3c661275d2c9d343f4fa85 (patch)
treecf0b32107d855fe11b27b8eeab2b5ed38791a8d8 /drivers/iio/adc/exynos_adc.c
parentf2f7a449707eade5d6876d48d48ddc79dd77d75f (diff)
downloadlinux-bb916ebbeabd18f7dc3c661275d2c9d343f4fa85.tar.bz2
iio: adc: Add dt support for turning on the phy in exynos-adc
Without this change the exynos adc controller needed to have its phy enabled in some out-of-driver C code. Add support for specifying the phy enable register by listing it in the reg list. Signed-off-by: Doug Anderson <dianders@chromium.org> Tested-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc/exynos_adc.c')
-rw-r--r--drivers/iio/adc/exynos_adc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 6e968ae48c8a..4a8a9a34228f 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -85,6 +85,7 @@ enum adc_version {
struct exynos_adc {
void __iomem *regs;
+ void __iomem *enable_reg;
struct clk *clk;
unsigned int irq;
struct regulator *vdd;
@@ -269,13 +270,19 @@ static int exynos_adc_probe(struct platform_device *pdev)
info = iio_priv(indio_dev);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
info->regs = devm_request_and_ioremap(&pdev->dev, mem);
if (!info->regs) {
ret = -ENOMEM;
goto err_iio;
}
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ info->enable_reg = devm_request_and_ioremap(&pdev->dev, mem);
+ if (!info->enable_reg) {
+ ret = -ENOMEM;
+ goto err_iio;
+ }
+
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no irq resource?\n");
@@ -295,6 +302,8 @@ static int exynos_adc_probe(struct platform_device *pdev)
goto err_iio;
}
+ writel(1, info->enable_reg);
+
info->clk = devm_clk_get(&pdev->dev, "adc");
if (IS_ERR(info->clk)) {
dev_err(&pdev->dev, "failed getting clock, err = %ld\n",
@@ -370,6 +379,7 @@ static int exynos_adc_remove(struct platform_device *pdev)
exynos_adc_remove_devices);
regulator_disable(info->vdd);
clk_disable_unprepare(info->clk);
+ writel(0, info->enable_reg);
iio_device_unregister(indio_dev);
free_irq(info->irq, info);
iio_device_free(indio_dev);
@@ -395,6 +405,7 @@ static int exynos_adc_suspend(struct device *dev)
}
clk_disable_unprepare(info->clk);
+ writel(0, info->enable_reg);
regulator_disable(info->vdd);
return 0;
@@ -410,6 +421,7 @@ static int exynos_adc_resume(struct device *dev)
if (ret)
return ret;
+ writel(1, info->enable_reg);
clk_prepare_enable(info->clk);
exynos_adc_hw_init(info);