aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2013-03-13 16:40:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-03-17 18:46:55 -0400
commitbb916ebbeabd18f7dc3c661275d2c9d343f4fa85 (patch)
treecf0b32107d855fe11b27b8eeab2b5ed38791a8d8 /drivers/iio
parentf2f7a449707eade5d6876d48d48ddc79dd77d75f (diff)
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')
-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 {
85 85
86struct exynos_adc { 86struct exynos_adc {
87 void __iomem *regs; 87 void __iomem *regs;
88 void __iomem *enable_reg;
88 struct clk *clk; 89 struct clk *clk;
89 unsigned int irq; 90 unsigned int irq;
90 struct regulator *vdd; 91 struct regulator *vdd;
@@ -269,13 +270,19 @@ static int exynos_adc_probe(struct platform_device *pdev)
269 info = iio_priv(indio_dev); 270 info = iio_priv(indio_dev);
270 271
271 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 272 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
272
273 info->regs = devm_request_and_ioremap(&pdev->dev, mem); 273 info->regs = devm_request_and_ioremap(&pdev->dev, mem);
274 if (!info->regs) { 274 if (!info->regs) {
275 ret = -ENOMEM; 275 ret = -ENOMEM;
276 goto err_iio; 276 goto err_iio;
277 } 277 }
278 278
279 mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
280 info->enable_reg = devm_request_and_ioremap(&pdev->dev, mem);
281 if (!info->enable_reg) {
282 ret = -ENOMEM;
283 goto err_iio;
284 }
285
279 irq = platform_get_irq(pdev, 0); 286 irq = platform_get_irq(pdev, 0);
280 if (irq < 0) { 287 if (irq < 0) {
281 dev_err(&pdev->dev, "no irq resource?\n"); 288 dev_err(&pdev->dev, "no irq resource?\n");
@@ -295,6 +302,8 @@ static int exynos_adc_probe(struct platform_device *pdev)
295 goto err_iio; 302 goto err_iio;
296 } 303 }
297 304
305 writel(1, info->enable_reg);
306
298 info->clk = devm_clk_get(&pdev->dev, "adc"); 307 info->clk = devm_clk_get(&pdev->dev, "adc");
299 if (IS_ERR(info->clk)) { 308 if (IS_ERR(info->clk)) {
300 dev_err(&pdev->dev, "failed getting clock, err = %ld\n", 309 dev_err(&pdev->dev, "failed getting clock, err = %ld\n",
@@ -370,6 +379,7 @@ static int exynos_adc_remove(struct platform_device *pdev)
370 exynos_adc_remove_devices); 379 exynos_adc_remove_devices);
371 regulator_disable(info->vdd); 380 regulator_disable(info->vdd);
372 clk_disable_unprepare(info->clk); 381 clk_disable_unprepare(info->clk);
382 writel(0, info->enable_reg);
373 iio_device_unregister(indio_dev); 383 iio_device_unregister(indio_dev);
374 free_irq(info->irq, info); 384 free_irq(info->irq, info);
375 iio_device_free(indio_dev); 385 iio_device_free(indio_dev);
@@ -395,6 +405,7 @@ static int exynos_adc_suspend(struct device *dev)
395 } 405 }
396 406
397 clk_disable_unprepare(info->clk); 407 clk_disable_unprepare(info->clk);
408 writel(0, info->enable_reg);
398 regulator_disable(info->vdd); 409 regulator_disable(info->vdd);
399 410
400 return 0; 411 return 0;
@@ -410,6 +421,7 @@ static int exynos_adc_resume(struct device *dev)
410 if (ret) 421 if (ret)
411 return ret; 422 return ret;
412 423
424 writel(1, info->enable_reg);
413 clk_prepare_enable(info->clk); 425 clk_prepare_enable(info->clk);
414 426
415 exynos_adc_hw_init(info); 427 exynos_adc_hw_init(info);