diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2013-04-02 08:41:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-14 19:07:15 -0400 |
commit | 407ccc65bfd2899ed008c4f8900f23ac15f75f9f (patch) | |
tree | e1141d57865cae9072413db1ca57ed6c3357d2b9 | |
parent | 3778d05036cc7ddd983ae2451da579af00acdac2 (diff) |
[media] davinci: vpif: add pm_runtime support
Add pm_runtime support to the TI Davinci VPIF driver.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/davinci/vpif.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 3bc4db8f0f27..ea82a8bd2803 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | ||
27 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/pm_runtime.h> | ||
28 | #include <linux/v4l2-dv-timings.h> | 28 | #include <linux/v4l2-dv-timings.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
@@ -46,8 +46,6 @@ spinlock_t vpif_lock; | |||
46 | void __iomem *vpif_base; | 46 | void __iomem *vpif_base; |
47 | EXPORT_SYMBOL_GPL(vpif_base); | 47 | EXPORT_SYMBOL_GPL(vpif_base); |
48 | 48 | ||
49 | struct clk *vpif_clk; | ||
50 | |||
51 | /** | 49 | /** |
52 | * vpif_ch_params: video standard configuration parameters for vpif | 50 | * vpif_ch_params: video standard configuration parameters for vpif |
53 | * The table must include all presets from supported subdevices. | 51 | * The table must include all presets from supported subdevices. |
@@ -443,19 +441,13 @@ static int vpif_probe(struct platform_device *pdev) | |||
443 | goto fail; | 441 | goto fail; |
444 | } | 442 | } |
445 | 443 | ||
446 | vpif_clk = clk_get(&pdev->dev, "vpif"); | 444 | pm_runtime_enable(&pdev->dev); |
447 | if (IS_ERR(vpif_clk)) { | 445 | pm_runtime_get(&pdev->dev); |
448 | status = PTR_ERR(vpif_clk); | ||
449 | goto clk_fail; | ||
450 | } | ||
451 | clk_prepare_enable(vpif_clk); | ||
452 | 446 | ||
453 | spin_lock_init(&vpif_lock); | 447 | spin_lock_init(&vpif_lock); |
454 | dev_info(&pdev->dev, "vpif probe success\n"); | 448 | dev_info(&pdev->dev, "vpif probe success\n"); |
455 | return 0; | 449 | return 0; |
456 | 450 | ||
457 | clk_fail: | ||
458 | iounmap(vpif_base); | ||
459 | fail: | 451 | fail: |
460 | release_mem_region(res->start, res_len); | 452 | release_mem_region(res->start, res_len); |
461 | return status; | 453 | return status; |
@@ -463,11 +455,7 @@ fail: | |||
463 | 455 | ||
464 | static int vpif_remove(struct platform_device *pdev) | 456 | static int vpif_remove(struct platform_device *pdev) |
465 | { | 457 | { |
466 | if (vpif_clk) { | 458 | pm_runtime_disable(&pdev->dev); |
467 | clk_disable_unprepare(vpif_clk); | ||
468 | clk_put(vpif_clk); | ||
469 | } | ||
470 | |||
471 | iounmap(vpif_base); | 459 | iounmap(vpif_base); |
472 | release_mem_region(res->start, res_len); | 460 | release_mem_region(res->start, res_len); |
473 | return 0; | 461 | return 0; |
@@ -476,13 +464,13 @@ static int vpif_remove(struct platform_device *pdev) | |||
476 | #ifdef CONFIG_PM | 464 | #ifdef CONFIG_PM |
477 | static int vpif_suspend(struct device *dev) | 465 | static int vpif_suspend(struct device *dev) |
478 | { | 466 | { |
479 | clk_disable_unprepare(vpif_clk); | 467 | pm_runtime_put(dev); |
480 | return 0; | 468 | return 0; |
481 | } | 469 | } |
482 | 470 | ||
483 | static int vpif_resume(struct device *dev) | 471 | static int vpif_resume(struct device *dev) |
484 | { | 472 | { |
485 | clk_prepare_enable(vpif_clk); | 473 | pm_runtime_get(dev); |
486 | return 0; | 474 | return 0; |
487 | } | 475 | } |
488 | 476 | ||