diff options
-rw-r--r-- | Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt | 4 | ||||
-rw-r--r-- | drivers/iio/adc/exynos_adc.c | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt index f68637861b05..05e9d95ede5c 100644 --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt | |||
@@ -15,7 +15,7 @@ Required properties: | |||
15 | Must be "samsung,exynos-adc-v2" for | 15 | Must be "samsung,exynos-adc-v2" for |
16 | future controllers. | 16 | future controllers. |
17 | - reg: Contains ADC register address range (base address and | 17 | - reg: Contains ADC register address range (base address and |
18 | length). | 18 | length) and the address of the phy enable register. |
19 | - interrupts: Contains the interrupt information for the timer. The | 19 | - interrupts: Contains the interrupt information for the timer. The |
20 | format is being dependent on which interrupt controller | 20 | format is being dependent on which interrupt controller |
21 | the Samsung device uses. | 21 | the Samsung device uses. |
@@ -27,7 +27,7 @@ Example: adding device info in dtsi file | |||
27 | 27 | ||
28 | adc: adc@12D10000 { | 28 | adc: adc@12D10000 { |
29 | compatible = "samsung,exynos-adc-v1"; | 29 | compatible = "samsung,exynos-adc-v1"; |
30 | reg = <0x12D10000 0x100>; | 30 | reg = <0x12D10000 0x100>, <0x10040718 0x4>; |
31 | interrupts = <0 106 0>; | 31 | interrupts = <0 106 0>; |
32 | #io-channel-cells = <1>; | 32 | #io-channel-cells = <1>; |
33 | io-channel-ranges; | 33 | io-channel-ranges; |
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 | ||
86 | struct exynos_adc { | 86 | struct 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); |