summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/davinci/vpif.c
diff options
context:
space:
mode:
authorManjunath Hadli <manjunath.hadli@ti.com>2012-04-13 04:51:13 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 19:08:34 -0300
commit31415d0ef304f26edcba4d3ae106606b83f3c22e (patch)
treecc365024c357904712f9469f1c2566065e2077ed /drivers/media/video/davinci/vpif.c
parent3d5946dcfd4d221126f3f190c5ca4ea41c20f138 (diff)
downloadblackbird-op-linux-31415d0ef304f26edcba4d3ae106606b83f3c22e.tar.gz
blackbird-op-linux-31415d0ef304f26edcba4d3ae106606b83f3c22e.zip
[media] davinci: vpif: Add suspend/resume callbacks to vpif driver
add clock enable and disable in probe and remove functions. Probe will succeed only if the device clock is provided instead of assuming that the clock is always enabled. VPIF clock has to be dealt with during suspend and resume. Implement power management callbacks to VPIF driver to disable/enable clock on suspend/resume respectively. Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com> Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/davinci/vpif.c')
-rw-r--r--drivers/media/video/davinci/vpif.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/media/video/davinci/vpif.c b/drivers/media/video/davinci/vpif.c
index 8c4ff14377ad..b3637aff8fee 100644
--- a/drivers/media/video/davinci/vpif.c
+++ b/drivers/media/video/davinci/vpif.c
@@ -23,6 +23,8 @@
#include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/err.h>
#include <mach/hardware.h>
#include "vpif.h"
@@ -40,6 +42,7 @@ static struct resource *res;
spinlock_t vpif_lock;
void __iomem *vpif_base;
+struct clk *vpif_clk;
/**
* ch_params: video standard configuration parameters for vpif
@@ -434,10 +437,19 @@ static int __init vpif_probe(struct platform_device *pdev)
goto fail;
}
+ vpif_clk = clk_get(&pdev->dev, "vpif");
+ if (IS_ERR(vpif_clk)) {
+ status = PTR_ERR(vpif_clk);
+ goto clk_fail;
+ }
+ clk_enable(vpif_clk);
+
spin_lock_init(&vpif_lock);
dev_info(&pdev->dev, "vpif probe success\n");
return 0;
+clk_fail:
+ iounmap(vpif_base);
fail:
release_mem_region(res->start, res_len);
return status;
@@ -445,15 +457,44 @@ fail:
static int __devexit vpif_remove(struct platform_device *pdev)
{
+ if (vpif_clk) {
+ clk_disable(vpif_clk);
+ clk_put(vpif_clk);
+ }
+
iounmap(vpif_base);
release_mem_region(res->start, res_len);
return 0;
}
+#ifdef CONFIG_PM
+static int vpif_suspend(struct device *dev)
+{
+ clk_disable(vpif_clk);
+ return 0;
+}
+
+static int vpif_resume(struct device *dev)
+{
+ clk_enable(vpif_clk);
+ return 0;
+}
+
+static const struct dev_pm_ops vpif_pm = {
+ .suspend = vpif_suspend,
+ .resume = vpif_resume,
+};
+
+#define vpif_pm_ops (&vpif_pm)
+#else
+#define vpif_pm_ops NULL
+#endif
+
static struct platform_driver vpif_driver = {
.driver = {
.name = "vpif",
.owner = THIS_MODULE,
+ .pm = vpif_pm_ops,
},
.remove = __devexit_p(vpif_remove),
.probe = vpif_probe,
OpenPOWER on IntegriCloud