All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] exynos-gsc: Remove PM_RUNTIME dependency
@ 2014-07-21  4:54 Shaik Ameer Basha
  2014-07-21 13:10 ` Sylwester Nawrocki
  2014-07-22  5:01 ` Sachin Kamat
  0 siblings, 2 replies; 4+ messages in thread
From: Shaik Ameer Basha @ 2014-07-21  4:54 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, pawel, shaik.samsung, joshi, Shaik Ameer Basha

1] Currently Gscaler clock is enabled only inside pm_runtime callbacks.
   If PM_RUNTIME is disabled, driver hangs. This patch removes the
   PM_RUNTIME dependency by keeping the clock enable/disable functions
   in m2m start/stop streaming callbacks.

2] For Exynos5420/5800, Gscaler clock has to be Turned ON before powering
   on/off the Gscaler power domain. This dependency is taken care by
   this patch at driver level.

Signed-off-by: Shaik Ameer Basha <shaik.ameer@samsung.com>
---
 drivers/media/platform/exynos-gsc/gsc-core.c |   10 ++--------
 drivers/media/platform/exynos-gsc/gsc-m2m.c  |   13 +++++++++++++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index 9d0cc04..39c0953 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1132,23 +1132,17 @@ static int gsc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, gsc);
 	pm_runtime_enable(dev);
-	ret = pm_runtime_get_sync(&pdev->dev);
-	if (ret < 0)
-		goto err_m2m;
 
 	/* Initialize continious memory allocator */
 	gsc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
 	if (IS_ERR(gsc->alloc_ctx)) {
 		ret = PTR_ERR(gsc->alloc_ctx);
-		goto err_pm;
+		goto err_m2m;
 	}
 
 	dev_dbg(dev, "gsc-%d registered successfully\n", gsc->id);
-
-	pm_runtime_put(dev);
 	return 0;
-err_pm:
-	pm_runtime_put(dev);
+
 err_m2m:
 	gsc_unregister_m2m_device(gsc);
 err_v4l2:
diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index e434f1f0..a98462c 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -60,19 +60,32 @@ static void __gsc_m2m_job_abort(struct gsc_ctx *ctx)
 static int gsc_m2m_start_streaming(struct vb2_queue *q, unsigned int count)
 {
 	struct gsc_ctx *ctx = q->drv_priv;
+	struct gsc_dev *gsc = ctx->gsc_dev;
 	int ret;
 
+	ret = clk_enable(gsc->clock);
+	if (ret)
+		return ret;
+
 	ret = pm_runtime_get_sync(&ctx->gsc_dev->pdev->dev);
+
+	if (!pm_runtime_enabled(&gsc->pdev->dev)) {
+		gsc_hw_set_sw_reset(gsc);
+		gsc_wait_reset(gsc);
+	}
+
 	return ret > 0 ? 0 : ret;
 }
 
 static void gsc_m2m_stop_streaming(struct vb2_queue *q)
 {
 	struct gsc_ctx *ctx = q->drv_priv;
+	struct gsc_dev *gsc = ctx->gsc_dev;
 
 	__gsc_m2m_job_abort(ctx);
 
 	pm_runtime_put(&ctx->gsc_dev->pdev->dev);
+	clk_disable(gsc->clock);
 }
 
 void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-23  3:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-21  4:54 [PATCH] [media] exynos-gsc: Remove PM_RUNTIME dependency Shaik Ameer Basha
2014-07-21 13:10 ` Sylwester Nawrocki
2014-07-22  5:01 ` Sachin Kamat
2014-07-23  3:25   ` Shaik Ameer Basha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.