linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare
@ 2012-10-17 11:11 Sachin Kamat
  2012-10-17 11:11 ` [PATCH 2/8] [media] s5p-g2d: " Sachin Kamat
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches

Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
as required by the common clock framework.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/s5p-fimc/fimc-core.c    |   10 +++++-----
 drivers/media/platform/s5p-fimc/fimc-lite.c    |    4 ++--
 drivers/media/platform/s5p-fimc/fimc-mdevice.c |    4 ++--
 drivers/media/platform/s5p-fimc/mipi-csis.c    |   10 +++++-----
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c
index 8d0d2b9..92308ba 100644
--- a/drivers/media/platform/s5p-fimc/fimc-core.c
+++ b/drivers/media/platform/s5p-fimc/fimc-core.c
@@ -827,7 +827,7 @@ static int fimc_clk_get(struct fimc_dev *fimc)
 		fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
 		if (IS_ERR(fimc->clock[i]))
 			goto err;
-		ret = clk_prepare(fimc->clock[i]);
+		ret = clk_prepare_enable(fimc->clock[i]);
 		if (ret < 0) {
 			clk_put(fimc->clock[i]);
 			fimc->clock[i] = NULL;
@@ -925,7 +925,7 @@ static int fimc_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 	clk_set_rate(fimc->clock[CLK_BUS], drv_data->lclk_frequency);
-	clk_enable(fimc->clock[CLK_BUS]);
+	clk_prepare_enable(fimc->clock[CLK_BUS]);
 
 	ret = devm_request_irq(&pdev->dev, res->start, fimc_irq_handler,
 			       0, dev_name(&pdev->dev), fimc);
@@ -970,7 +970,7 @@ static int fimc_runtime_resume(struct device *dev)
 	dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state);
 
 	/* Enable clocks and perform basic initalization */
-	clk_enable(fimc->clock[CLK_GATE]);
+	clk_prepare_enable(fimc->clock[CLK_GATE]);
 	fimc_hw_reset(fimc);
 
 	/* Resume the capture or mem-to-mem device */
@@ -990,7 +990,7 @@ static int fimc_runtime_suspend(struct device *dev)
 	else
 		ret = fimc_m2m_suspend(fimc);
 	if (!ret)
-		clk_disable(fimc->clock[CLK_GATE]);
+		clk_disable_unprepare(fimc->clock[CLK_GATE]);
 
 	dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state);
 	return ret;
@@ -1045,7 +1045,7 @@ static int __devexit fimc_remove(struct platform_device *pdev)
 	fimc_unregister_capture_subdev(fimc);
 	vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
 
-	clk_disable(fimc->clock[CLK_BUS]);
+	clk_disable_unprepare(fimc->clock[CLK_BUS]);
 	fimc_clk_put(fimc);
 
 	dev_info(&pdev->dev, "driver unloaded\n");
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index 70bcf39..4a12847 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -1479,7 +1479,7 @@ static int fimc_lite_runtime_resume(struct device *dev)
 {
 	struct fimc_lite *fimc = dev_get_drvdata(dev);
 
-	clk_enable(fimc->clock);
+	clk_prepare_enable(fimc->clock);
 	return 0;
 }
 
@@ -1487,7 +1487,7 @@ static int fimc_lite_runtime_suspend(struct device *dev)
 {
 	struct fimc_lite *fimc = dev_get_drvdata(dev);
 
-	clk_disable(fimc->clock);
+	clk_disable_unprepare(fimc->clock);
 	return 0;
 }
 
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index 61fab00..e1f7cbe 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -779,7 +779,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
 		if (camclk->use_count++ == 0) {
 			clk_set_rate(camclk->clock, pdata->clk_frequency);
 			camclk->frequency = pdata->clk_frequency;
-			ret = clk_enable(camclk->clock);
+			ret = clk_prepare_enable(camclk->clock);
 			dbg("Enabled camclk %d: f: %lu", pdata->clk_id,
 			    clk_get_rate(camclk->clock));
 		}
@@ -790,7 +790,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
 		return 0;
 
 	if (--camclk->use_count == 0) {
-		clk_disable(camclk->clock);
+		clk_disable_unprepare(camclk->clock);
 		dbg("Disabled camclk %d", pdata->clk_id);
 	}
 	return ret;
diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c
index 4c961b1..f02c95b 100644
--- a/drivers/media/platform/s5p-fimc/mipi-csis.c
+++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
@@ -710,7 +710,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
 	if (ret)
 		goto e_clkput;
 
-	clk_enable(state->clock[CSIS_CLK_MUX]);
+	clk_prepare_enable(state->clock[CSIS_CLK_MUX]);
 	if (pdata->clk_rate)
 		clk_set_rate(state->clock[CSIS_CLK_MUX], pdata->clk_rate);
 	else
@@ -754,7 +754,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
 e_regput:
 	regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
 e_clkput:
-	clk_disable(state->clock[CSIS_CLK_MUX]);
+	clk_disable_unprepare(state->clock[CSIS_CLK_MUX]);
 	s5pcsis_clk_put(state);
 	return ret;
 }
@@ -779,7 +779,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
 					     state->supplies);
 		if (ret)
 			goto unlock;
-		clk_disable(state->clock[CSIS_CLK_GATE]);
+		clk_disable_unprepare(state->clock[CSIS_CLK_GATE]);
 		state->flags &= ~ST_POWERED;
 		if (!runtime)
 			state->flags |= ST_SUSPENDED;
@@ -816,7 +816,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime)
 					       state->supplies);
 			goto unlock;
 		}
-		clk_enable(state->clock[CSIS_CLK_GATE]);
+		clk_prepare_enable(state->clock[CSIS_CLK_GATE]);
 	}
 	if (state->flags & ST_STREAMING)
 		s5pcsis_start_stream(state);
@@ -858,7 +858,7 @@ static int __devexit s5pcsis_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 	s5pcsis_pm_suspend(&pdev->dev, false);
-	clk_disable(state->clock[CSIS_CLK_MUX]);
+	clk_disable_unprepare(state->clock[CSIS_CLK_MUX]);
 	pm_runtime_set_suspended(&pdev->dev);
 	s5pcsis_clk_put(state);
 	regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
-- 
1.7.4.1


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

* [PATCH 2/8] [media] s5p-g2d: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:32   ` Sylwester Nawrocki
  2012-10-17 11:11 ` [PATCH 3/8] [media] s5p-mfc: " Sachin Kamat
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches, Kamil Debski

Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
as required by the common clock framework.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kamil Debski <k.debski@samsung.com>
---
 drivers/media/platform/s5p-g2d/g2d.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c
index 1bfbc32..adecd25 100644
--- a/drivers/media/platform/s5p-g2d/g2d.c
+++ b/drivers/media/platform/s5p-g2d/g2d.c
@@ -589,7 +589,7 @@ static void device_run(void *prv)
 	src = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
 	dst = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
 
-	clk_enable(dev->gate);
+	clk_prepare_enable(dev->gate);
 	g2d_reset(dev);
 
 	spin_lock_irqsave(&dev->ctrl_lock, flags);
@@ -619,7 +619,7 @@ static irqreturn_t g2d_isr(int irq, void *prv)
 	struct vb2_buffer *src, *dst;
 
 	g2d_clear_int(dev);
-	clk_disable(dev->gate);
+	clk_disable_unprepare(dev->gate);
 
 	BUG_ON(ctx == NULL);
 
-- 
1.7.4.1


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

* [PATCH 3/8] [media] s5p-mfc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
  2012-10-17 11:11 ` [PATCH 2/8] [media] s5p-g2d: " Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:36   ` Sylwester Nawrocki
  2012-10-20  9:36   ` Sylwester Nawrocki
  2012-10-17 11:11 ` [PATCH 4/8] [media] s5p-tv: " Sachin Kamat
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches, Kamil Debski

Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
as required by the common clock framework.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kamil Debski <k.debski@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
index 367db75..f7c5c5a 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
@@ -100,7 +100,7 @@ int s5p_mfc_clock_on(void)
 	atomic_inc(&clk_ref);
 	mfc_debug(3, "+ %d", atomic_read(&clk_ref));
 #endif
-	ret = clk_enable(pm->clock_gate);
+	ret = clk_prepare_enable(pm->clock_gate);
 	return ret;
 }
 
@@ -110,7 +110,7 @@ void s5p_mfc_clock_off(void)
 	atomic_dec(&clk_ref);
 	mfc_debug(3, "- %d", atomic_read(&clk_ref));
 #endif
-	clk_disable(pm->clock_gate);
+	clk_disable_unprepare(pm->clock_gate);
 }
 
 int s5p_mfc_power_on(void)
-- 
1.7.4.1


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

* [PATCH 4/8] [media] s5p-tv: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
  2012-10-17 11:11 ` [PATCH 2/8] [media] s5p-g2d: " Sachin Kamat
  2012-10-17 11:11 ` [PATCH 3/8] [media] s5p-mfc: " Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:39   ` Sylwester Nawrocki
  2012-10-17 11:11 ` [PATCH 5/8] [media] exynos-gsc: " Sachin Kamat
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches, Tomasz Stanislawski

Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
as required by the common clock framework.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
 drivers/media/platform/s5p-tv/hdmi_drv.c  |   20 ++++++++++----------
 drivers/media/platform/s5p-tv/mixer_drv.c |   12 ++++++------
 drivers/media/platform/s5p-tv/sdo_drv.c   |   12 ++++++------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 8a9cf43..497e8ab 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -542,9 +542,9 @@ static int hdmi_streamon(struct hdmi_device *hdev)
 	}
 
 	/* hdmiphy clock is used for HDMI in streaming mode */
-	clk_disable(res->sclk_hdmi);
+	clk_disable_unprepare(res->sclk_hdmi);
 	clk_set_parent(res->sclk_hdmi, res->sclk_hdmiphy);
-	clk_enable(res->sclk_hdmi);
+	clk_prepare_enable(res->sclk_hdmi);
 
 	/* enable HDMI and timing generator */
 	hdmi_write_mask(hdev, HDMI_CON_0, ~0, HDMI_EN);
@@ -564,9 +564,9 @@ static int hdmi_streamoff(struct hdmi_device *hdev)
 	hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_EN);
 
 	/* pixel(vpll) clock is used for HDMI in config mode */
-	clk_disable(res->sclk_hdmi);
+	clk_disable_unprepare(res->sclk_hdmi);
 	clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
-	clk_enable(res->sclk_hdmi);
+	clk_prepare_enable(res->sclk_hdmi);
 
 	v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 0);
 	v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0);
@@ -591,19 +591,19 @@ static void hdmi_resource_poweron(struct hdmi_resources *res)
 	/* turn HDMI power on */
 	regulator_bulk_enable(res->regul_count, res->regul_bulk);
 	/* power-on hdmi physical interface */
-	clk_enable(res->hdmiphy);
+	clk_prepare_enable(res->hdmiphy);
 	/* use VPP as parent clock; HDMIPHY is not working yet */
 	clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
 	/* turn clocks on */
-	clk_enable(res->sclk_hdmi);
+	clk_prepare_enable(res->sclk_hdmi);
 }
 
 static void hdmi_resource_poweroff(struct hdmi_resources *res)
 {
 	/* turn clocks off */
-	clk_disable(res->sclk_hdmi);
+	clk_disable_unprepare(res->sclk_hdmi);
 	/* power-off hdmiphy */
-	clk_disable(res->hdmiphy);
+	clk_disable_unprepare(res->hdmiphy);
 	/* turn HDMI power off */
 	regulator_bulk_disable(res->regul_count, res->regul_bulk);
 }
@@ -947,7 +947,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
 		}
 	}
 
-	clk_enable(hdmi_dev->res.hdmi);
+	clk_prepare_enable(hdmi_dev->res.hdmi);
 
 	pm_runtime_enable(dev);
 
@@ -986,7 +986,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev)
 	struct hdmi_device *hdmi_dev = sd_to_hdmi_dev(sd);
 
 	pm_runtime_disable(dev);
-	clk_disable(hdmi_dev->res.hdmi);
+	clk_disable_unprepare(hdmi_dev->res.hdmi);
 	v4l2_device_unregister(&hdmi_dev->v4l2_dev);
 	disable_irq(hdmi_dev->irq);
 	hdmi_resources_cleanup(hdmi_dev);
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c
index ca0f297..dea0520 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -339,9 +339,9 @@ static int mxr_runtime_resume(struct device *dev)
 	mxr_dbg(mdev, "resume - start\n");
 	mutex_lock(&mdev->mutex);
 	/* turn clocks on */
-	clk_enable(res->mixer);
-	clk_enable(res->vp);
-	clk_enable(res->sclk_mixer);
+	clk_prepare_enable(res->mixer);
+	clk_prepare_enable(res->vp);
+	clk_prepare_enable(res->sclk_mixer);
 	/* apply default configuration */
 	mxr_reg_reset(mdev);
 	mxr_dbg(mdev, "resume - finished\n");
@@ -357,9 +357,9 @@ static int mxr_runtime_suspend(struct device *dev)
 	mxr_dbg(mdev, "suspend - start\n");
 	mutex_lock(&mdev->mutex);
 	/* turn clocks off */
-	clk_disable(res->sclk_mixer);
-	clk_disable(res->vp);
-	clk_disable(res->mixer);
+	clk_disable_unprepare(res->sclk_mixer);
+	clk_disable_unprepare(res->vp);
+	clk_disable_unprepare(res->mixer);
 	mutex_unlock(&mdev->mutex);
 	mxr_dbg(mdev, "suspend - finished\n");
 	return 0;
diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c
index ad68bbe..21d213a 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -199,7 +199,7 @@ static int sdo_streamon(struct sdo_device *sdev)
 	clk_get_rate(sdev->fout_vpll));
 	/* enable clock in SDO */
 	sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
-	clk_enable(sdev->dacphy);
+	clk_prepare_enable(sdev->dacphy);
 	/* enable DAC */
 	sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
 	sdo_reg_debug(sdev);
@@ -211,7 +211,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
 	int tries;
 
 	sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC);
-	clk_disable(sdev->dacphy);
+	clk_disable_unprepare(sdev->dacphy);
 	sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
 	for (tries = 100; tries; --tries) {
 		if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY)
@@ -254,7 +254,7 @@ static int sdo_runtime_suspend(struct device *dev)
 	dev_info(dev, "suspend\n");
 	regulator_disable(sdev->vdet);
 	regulator_disable(sdev->vdac);
-	clk_disable(sdev->sclk_dac);
+	clk_disable_unprepare(sdev->sclk_dac);
 	return 0;
 }
 
@@ -264,7 +264,7 @@ static int sdo_runtime_resume(struct device *dev)
 	struct sdo_device *sdev = sd_to_sdev(sd);
 
 	dev_info(dev, "resume\n");
-	clk_enable(sdev->sclk_dac);
+	clk_prepare_enable(sdev->sclk_dac);
 	regulator_enable(sdev->vdac);
 	regulator_enable(sdev->vdet);
 
@@ -386,7 +386,7 @@ static int __devinit sdo_probe(struct platform_device *pdev)
 	}
 
 	/* enable gate for dac clock, because mixer uses it */
-	clk_enable(sdev->dac);
+	clk_prepare_enable(sdev->dac);
 
 	/* configure power management */
 	pm_runtime_enable(dev);
@@ -425,7 +425,7 @@ static int __devexit sdo_remove(struct platform_device *pdev)
 	struct sdo_device *sdev = sd_to_sdev(sd);
 
 	pm_runtime_disable(&pdev->dev);
-	clk_disable(sdev->dac);
+	clk_disable_unprepare(sdev->dac);
 	clk_put(sdev->fout_vpll);
 	clk_put(sdev->dacphy);
 	clk_put(sdev->dac);
-- 
1.7.4.1


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

* [PATCH 5/8] [media] exynos-gsc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
                   ` (2 preceding siblings ...)
  2012-10-17 11:11 ` [PATCH 4/8] [media] s5p-tv: " Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:54   ` Sylwester Nawrocki
  2012-10-17 11:11 ` [PATCH 6/8] [media] exynos-gsc: Fix compilation warning Sachin Kamat
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches

Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
as required by the common clock framework.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/exynos-gsc/gsc-core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index bfec9e6..d11668b 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1009,7 +1009,7 @@ static int gsc_clk_get(struct gsc_dev *gsc)
 	if (IS_ERR(gsc->clock))
 		goto err_print;
 
-	ret = clk_prepare(gsc->clock);
+	ret = clk_prepare_enable(gsc->clock);
 	if (ret < 0) {
 		clk_put(gsc->clock);
 		gsc->clock = NULL;
@@ -1186,7 +1186,7 @@ static int gsc_runtime_suspend(struct device *dev)
 
 	ret = gsc_m2m_suspend(gsc);
 	if (!ret)
-		clk_disable(gsc->clock);
+		clk_disable_unprepare(gsc->clock);
 
 	pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
 	return ret;
-- 
1.7.4.1


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

* [PATCH 6/8] [media] exynos-gsc: Fix compilation warning
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
                   ` (3 preceding siblings ...)
  2012-10-17 11:11 ` [PATCH 5/8] [media] exynos-gsc: " Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:55   ` Sylwester Nawrocki
  2012-10-17 11:11 ` [PATCH 7/8] [media] s5p-mfc: Make 'clk_ref' static in s5p_mfc_pm.c Sachin Kamat
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches

Used type casting to avoid the following compilation warning:

drivers/media/platform/exynos-gsc/gsc-core.c:983:37: warning:
incorrect type in assignment (different modifiers)
drivers/media/platform/exynos-gsc/gsc-core.c:983:37:
expected struct gsc_driverdata *driver_data
drivers/media/platform/exynos-gsc/gsc-core.c:983:37:
got void const *data

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/exynos-gsc/gsc-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index d11668b..9b86ef6 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -980,7 +980,7 @@ static void *gsc_get_drv_data(struct platform_device *pdev)
 		match = of_match_node(of_match_ptr(exynos_gsc_match),
 					pdev->dev.of_node);
 		if (match)
-			driver_data =  match->data;
+			driver_data = (struct gsc_driverdata *)match->data;
 	} else {
 		driver_data = (struct gsc_driverdata *)
 			platform_get_device_id(pdev)->driver_data;
-- 
1.7.4.1


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

* [PATCH 7/8] [media] s5p-mfc: Make 'clk_ref' static in s5p_mfc_pm.c
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
                   ` (4 preceding siblings ...)
  2012-10-17 11:11 ` [PATCH 6/8] [media] exynos-gsc: Fix compilation warning Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:56   ` Sylwester Nawrocki
  2012-10-17 11:11 ` [PATCH 8/8] [media] s5p-fimc: Make 'fimc_pipeline_s_stream' function static Sachin Kamat
  2012-10-17 14:33 ` [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sylwester Nawrocki
  7 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches, Kamil Debski

Fixes the following sparse warning:
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:31:10: warning:
symbol 'clk_ref' was not declared. Should it be static?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kamil Debski <k.debski@samsung.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
index f7c5c5a..19c46fb 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
@@ -28,7 +28,7 @@ static struct s5p_mfc_pm *pm;
 static struct s5p_mfc_dev *p_dev;
 
 #ifdef CLK_DEBUG
-atomic_t clk_ref;
+static atomic_t clk_ref;
 #endif
 
 int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
-- 
1.7.4.1


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

* [PATCH 8/8] [media] s5p-fimc: Make 'fimc_pipeline_s_stream' function static
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
                   ` (5 preceding siblings ...)
  2012-10-17 11:11 ` [PATCH 7/8] [media] s5p-mfc: Make 'clk_ref' static in s5p_mfc_pm.c Sachin Kamat
@ 2012-10-17 11:11 ` Sachin Kamat
  2012-10-20  9:57   ` Sylwester Nawrocki
  2012-10-17 14:33 ` [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sylwester Nawrocki
  7 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 11:11 UTC (permalink / raw)
  To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches

Fixes the following sparse warning:
drivers/media/platform/s5p-fimc/fimc-mdevice.c:216:5: warning:
symbol 'fimc_pipeline_s_stream' was not declared. Should it be static?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/media/platform/s5p-fimc/fimc-mdevice.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index e1f7cbe..0cd05b2 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -213,7 +213,7 @@ static int fimc_pipeline_close(struct fimc_pipeline *p)
  * @pipeline: video pipeline structure
  * @on: passed as the s_stream call argument
  */
-int fimc_pipeline_s_stream(struct fimc_pipeline *p, bool on)
+static int fimc_pipeline_s_stream(struct fimc_pipeline *p, bool on)
 {
 	int i, ret;
 
-- 
1.7.4.1


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

* Re: [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
                   ` (6 preceding siblings ...)
  2012-10-17 11:11 ` [PATCH 8/8] [media] s5p-fimc: Make 'fimc_pipeline_s_stream' function static Sachin Kamat
@ 2012-10-17 14:33 ` Sylwester Nawrocki
  2012-10-17 15:35   ` Sachin Kamat
  7 siblings, 1 reply; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-17 14:33 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: linux-media, patches, 'linux-arm-kernel', Turquette, Mike,
	linux-samsung-soc, Tomasz Figa

Hi Sachin,

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
> as required by the common clock framework.

I think this statement is misleading. In my understanding it is not the 
common clock framework requirement to use clk_{enable/disable}_prepare 
in place of clk_enable/disable. The requirement is to call clk_prepare 
before first clk_enable call and to call clk_unprepare after clk_disable
and before clk_put. 

You need to be careful with those replacements, since the clk *_(un)prepare
functions may sleep, i.e. they must not be called from atomic context.

Most of the s5p-* drivers have already added support for clk_(un)prepare.
Thus most of your changes in this patch are not needed. I seem to have only 
missed fimc-mdevice.c, other modules are already reworked

$ git grep -5  clk_prepare  -- drivers/media/platform/s5p-fimc
drivers/media/platform/s5p-fimc/fimc-core.c-
drivers/media/platform/s5p-fimc/fimc-core.c-    for (i = 0; i < MAX_FIMC_CLOCKS; i++) {
drivers/media/platform/s5p-fimc/fimc-core.c-            fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
drivers/media/platform/s5p-fimc/fimc-core.c-            if (IS_ERR(fimc->clock[i]))
drivers/media/platform/s5p-fimc/fimc-core.c-                    goto err;
drivers/media/platform/s5p-fimc/fimc-core.c:            ret = clk_prepare(fimc->clock[i]);
drivers/media/platform/s5p-fimc/fimc-core.c-            if (ret < 0) {
drivers/media/platform/s5p-fimc/fimc-core.c-                    clk_put(fimc->clock[i]);
drivers/media/platform/s5p-fimc/fimc-core.c-                    fimc->clock[i] = NULL;
drivers/media/platform/s5p-fimc/fimc-core.c-                    goto err;
drivers/media/platform/s5p-fimc/fimc-core.c-            }
--
drivers/media/platform/s5p-fimc/fimc-lite.c-
drivers/media/platform/s5p-fimc/fimc-lite.c-    fimc->clock = clk_get(&fimc->pdev->dev, FLITE_CLK_NAME);
drivers/media/platform/s5p-fimc/fimc-lite.c-    if (IS_ERR(fimc->clock))
drivers/media/platform/s5p-fimc/fimc-lite.c-            return PTR_ERR(fimc->clock);
drivers/media/platform/s5p-fimc/fimc-lite.c-
drivers/media/platform/s5p-fimc/fimc-lite.c:    ret = clk_prepare(fimc->clock);
drivers/media/platform/s5p-fimc/fimc-lite.c-    if (ret < 0) {
drivers/media/platform/s5p-fimc/fimc-lite.c-            clk_put(fimc->clock);
drivers/media/platform/s5p-fimc/fimc-lite.c-            fimc->clock = NULL;
drivers/media/platform/s5p-fimc/fimc-lite.c-    }
drivers/media/platform/s5p-fimc/fimc-lite.c-    return ret;
--
drivers/media/platform/s5p-fimc/mipi-csis.c-
drivers/media/platform/s5p-fimc/mipi-csis.c-    for (i = 0; i < NUM_CSIS_CLOCKS; i++) {
drivers/media/platform/s5p-fimc/mipi-csis.c-            state->clock[i] = clk_get(dev, csi_clock_name[i]);
drivers/media/platform/s5p-fimc/mipi-csis.c-            if (IS_ERR(state->clock[i]))
drivers/media/platform/s5p-fimc/mipi-csis.c-                    goto err;
drivers/media/platform/s5p-fimc/mipi-csis.c:            ret = clk_prepare(state->clock[i]);
drivers/media/platform/s5p-fimc/mipi-csis.c-            if (ret < 0) {
drivers/media/platform/s5p-fimc/mipi-csis.c-                    clk_put(state->clock[i]);
drivers/media/platform/s5p-fimc/mipi-csis.c-                    state->clock[i] = NULL;
drivers/media/platform/s5p-fimc/mipi-csis.c-                    goto err;
drivers/media/platform/s5p-fimc/mipi-csis.c-            }

I would prefer you have added the required changes at fimc_md_get_clocks() 
and fimc_md_put_clocks() functions.

Please make sure you don't add those clk_(un)prepare calls where it is
net needed.

$ git grep "clk_prepare\|clk_unprepare"  -- drivers/media/platform/s5p-*
drivers/media/platform/s5p-fimc/fimc-core.c:            clk_unprepare(fimc->clock[i]);
drivers/media/platform/s5p-fimc/fimc-core.c:            ret = clk_prepare(fimc->clock[i]);
drivers/media/platform/s5p-fimc/fimc-lite.c:    clk_unprepare(fimc->clock);
drivers/media/platform/s5p-fimc/fimc-lite.c:    ret = clk_prepare(fimc->clock);
drivers/media/platform/s5p-fimc/mipi-csis.c:            clk_unprepare(state->clock[i]);
drivers/media/platform/s5p-fimc/mipi-csis.c:            ret = clk_prepare(state->clock[i]);
drivers/media/platform/s5p-g2d/g2d.c:   ret = clk_prepare(dev->clk);
drivers/media/platform/s5p-g2d/g2d.c:   ret = clk_prepare(dev->gate);
drivers/media/platform/s5p-g2d/g2d.c:   clk_unprepare(dev->gate);
drivers/media/platform/s5p-g2d/g2d.c:   clk_unprepare(dev->clk);
drivers/media/platform/s5p-g2d/g2d.c:   clk_unprepare(dev->gate);
drivers/media/platform/s5p-g2d/g2d.c:   clk_unprepare(dev->clk);
drivers/media/platform/s5p-jpeg/jpeg-core.c:    clk_prepare_enable(jpeg->clk);
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:    ret = clk_prepare(pm->clock_gate);
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:    ret = clk_prepare(pm->clock);
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:    clk_unprepare(pm->clock_gate);
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:    clk_unprepare(pm->clock_gate);
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:    clk_unprepare(pm->clock);


> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/media/platform/s5p-fimc/fimc-core.c    |   10 +++++-----
>  drivers/media/platform/s5p-fimc/fimc-lite.c    |    4 ++--
>  drivers/media/platform/s5p-fimc/fimc-mdevice.c |    4 ++--
>  drivers/media/platform/s5p-fimc/mipi-csis.c    |   10 +++++-----
>  4 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c
> index 8d0d2b9..92308ba 100644
> --- a/drivers/media/platform/s5p-fimc/fimc-core.c
> +++ b/drivers/media/platform/s5p-fimc/fimc-core.c
> @@ -827,7 +827,7 @@ static int fimc_clk_get(struct fimc_dev *fimc)
>  		fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
>  		if (IS_ERR(fimc->clock[i]))
>  			goto err;
> -		ret = clk_prepare(fimc->clock[i]);
> +		ret = clk_prepare_enable(fimc->clock[i]);
>  		if (ret < 0) {
>  			clk_put(fimc->clock[i]);
>  			fimc->clock[i] = NULL;
> @@ -925,7 +925,7 @@ static int fimc_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  	clk_set_rate(fimc->clock[CLK_BUS], drv_data->lclk_frequency);
> -	clk_enable(fimc->clock[CLK_BUS]);
> +	clk_prepare_enable(fimc->clock[CLK_BUS]);
>  
>  	ret = devm_request_irq(&pdev->dev, res->start, fimc_irq_handler,
>  			       0, dev_name(&pdev->dev), fimc);
> @@ -970,7 +970,7 @@ static int fimc_runtime_resume(struct device *dev)
>  	dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state);
>  
>  	/* Enable clocks and perform basic initalization */
> -	clk_enable(fimc->clock[CLK_GATE]);
> +	clk_prepare_enable(fimc->clock[CLK_GATE]);
>  	fimc_hw_reset(fimc);
>  
>  	/* Resume the capture or mem-to-mem device */
> @@ -990,7 +990,7 @@ static int fimc_runtime_suspend(struct device *dev)
>  	else
>  		ret = fimc_m2m_suspend(fimc);
>  	if (!ret)
> -		clk_disable(fimc->clock[CLK_GATE]);
> +		clk_disable_unprepare(fimc->clock[CLK_GATE]);
>  
>  	dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state);
>  	return ret;
> @@ -1045,7 +1045,7 @@ static int __devexit fimc_remove(struct platform_device *pdev)
>  	fimc_unregister_capture_subdev(fimc);
>  	vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
>  
> -	clk_disable(fimc->clock[CLK_BUS]);
> +	clk_disable_unprepare(fimc->clock[CLK_BUS]);
>  	fimc_clk_put(fimc);
>  
>  	dev_info(&pdev->dev, "driver unloaded\n");
> diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
> index 70bcf39..4a12847 100644
> --- a/drivers/media/platform/s5p-fimc/fimc-lite.c
> +++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
> @@ -1479,7 +1479,7 @@ static int fimc_lite_runtime_resume(struct device *dev)
>  {
>  	struct fimc_lite *fimc = dev_get_drvdata(dev);
>  
> -	clk_enable(fimc->clock);
> +	clk_prepare_enable(fimc->clock);
>  	return 0;
>  }
>  
> @@ -1487,7 +1487,7 @@ static int fimc_lite_runtime_suspend(struct device *dev)
>  {
>  	struct fimc_lite *fimc = dev_get_drvdata(dev);
>  
> -	clk_disable(fimc->clock);
> +	clk_disable_unprepare(fimc->clock);
>  	return 0;
>  }
>  
> diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> index 61fab00..e1f7cbe 100644
> --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> @@ -779,7 +779,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
>  		if (camclk->use_count++ == 0) {
>  			clk_set_rate(camclk->clock, pdata->clk_frequency);
>  			camclk->frequency = pdata->clk_frequency;
> -			ret = clk_enable(camclk->clock);
> +			ret = clk_prepare_enable(camclk->clock);
>  			dbg("Enabled camclk %d: f: %lu", pdata->clk_id,
>  			    clk_get_rate(camclk->clock));
>  		}
> @@ -790,7 +790,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
>  		return 0;
>  
>  	if (--camclk->use_count == 0) {
> -		clk_disable(camclk->clock);
> +		clk_disable_unprepare(camclk->clock);
>  		dbg("Disabled camclk %d", pdata->clk_id);
>  	}
>  	return ret;
> diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c
> index 4c961b1..f02c95b 100644
> --- a/drivers/media/platform/s5p-fimc/mipi-csis.c
> +++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
> @@ -710,7 +710,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto e_clkput;
>  
> -	clk_enable(state->clock[CSIS_CLK_MUX]);
> +	clk_prepare_enable(state->clock[CSIS_CLK_MUX]);
>  	if (pdata->clk_rate)
>  		clk_set_rate(state->clock[CSIS_CLK_MUX], pdata->clk_rate);
>  	else
> @@ -754,7 +754,7 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
>  e_regput:
>  	regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
>  e_clkput:
> -	clk_disable(state->clock[CSIS_CLK_MUX]);
> +	clk_disable_unprepare(state->clock[CSIS_CLK_MUX]);
>  	s5pcsis_clk_put(state);
>  	return ret;
>  }
> @@ -779,7 +779,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool runtime)
>  					     state->supplies);
>  		if (ret)
>  			goto unlock;
> -		clk_disable(state->clock[CSIS_CLK_GATE]);
> +		clk_disable_unprepare(state->clock[CSIS_CLK_GATE]);
>  		state->flags &= ~ST_POWERED;
>  		if (!runtime)
>  			state->flags |= ST_SUSPENDED;
> @@ -816,7 +816,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime)
>  					       state->supplies);
>  			goto unlock;
>  		}
> -		clk_enable(state->clock[CSIS_CLK_GATE]);
> +		clk_prepare_enable(state->clock[CSIS_CLK_GATE]);
>  	}
>  	if (state->flags & ST_STREAMING)
>  		s5pcsis_start_stream(state);
> @@ -858,7 +858,7 @@ static int __devexit s5pcsis_remove(struct platform_device *pdev)
>  
>  	pm_runtime_disable(&pdev->dev);
>  	s5pcsis_pm_suspend(&pdev->dev, false);
> -	clk_disable(state->clock[CSIS_CLK_MUX]);
> +	clk_disable_unprepare(state->clock[CSIS_CLK_MUX]);
>  	pm_runtime_set_suspended(&pdev->dev);
>  	s5pcsis_clk_put(state);
>  	regulator_bulk_free(CSIS_NUM_SUPPLIES, state->supplies);
> 

--
Thanks,
Sylwester

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

* Re: [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 14:33 ` [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sylwester Nawrocki
@ 2012-10-17 15:35   ` Sachin Kamat
  2012-10-17 15:57     ` Sylwester Nawrocki
  0 siblings, 1 reply; 20+ messages in thread
From: Sachin Kamat @ 2012-10-17 15:35 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, patches, linux-arm-kernel, Turquette, Mike,
	linux-samsung-soc, Tomasz Figa

Hi Sylwester,

Thanks for the review.

On 17 October 2012 20:03, Sylwester Nawrocki <s.nawrocki@samsung.com> wrote:
> Hi Sachin,
>
> On 10/17/2012 01:11 PM, Sachin Kamat wrote:
>> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
>> as required by the common clock framework.

>
> You need to be careful with those replacements, since the clk *_(un)prepare
> functions may sleep, i.e. they must not be called from atomic context.

OK.

>
> Most of the s5p-* drivers have already added support for clk_(un)prepare.
> Thus most of your changes in this patch are not needed. I seem to have only
> missed fimc-mdevice.c, other modules are already reworked

I did not find these changes in your tree. Please let me know the
branch where these changes are available.

>
> $ git grep -5  clk_prepare  -- drivers/media/platform/s5p-fimc
> drivers/media/platform/s5p-fimc/fimc-core.c-
> drivers/media/platform/s5p-fimc/fimc-core.c-    for (i = 0; i < MAX_FIMC_CLOCKS; i++) {
> drivers/media/platform/s5p-fimc/fimc-core.c-            fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
> drivers/media/platform/s5p-fimc/fimc-core.c-            if (IS_ERR(fimc->clock[i]))

>> I would prefer you have added the required changes at fimc_md_get_clocks()
> and fimc_md_put_clocks() functions.

Ok. I will check this.
>

-- 
With warm regards,
Sachin

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

* Re: [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 15:35   ` Sachin Kamat
@ 2012-10-17 15:57     ` Sylwester Nawrocki
  2012-10-18 14:44       ` Sachin Kamat
  0 siblings, 1 reply; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-17 15:57 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: linux-media, patches, linux-arm-kernel, Turquette, Mike,
	linux-samsung-soc, Tomasz Figa

On 10/17/2012 05:35 PM, Sachin Kamat wrote:
>> Most of the s5p-* drivers have already added support for clk_(un)prepare.
>> Thus most of your changes in this patch are not needed. I seem to have only
>> missed fimc-mdevice.c, other modules are already reworked
> 
> I did not find these changes in your tree. Please let me know the
> branch where these changes are available.

Are in Linus' tree, for quite long already, commits:

11a37c709797cc56f48905e68a3099b79cf08850
[media] s5p-g2d: Added support for clk_prepare

bd7d8888e99d67f778f4ee272346322c0b9cb378
[media] s5p-fimc: convert to clk_prepare()/clk_unprepare()

eb732518e0db585376f95256b18b2149240e3ad3
[media] s5p-mfc: Added support for clk_prepare

Please note there was the media drivers reorganization recently, e.g.
drivers/media/video/s5p-* changed to drivers/media/platform/s5p-*.

>> $ git grep -5  clk_prepare  -- drivers/media/platform/s5p-fimc
>> drivers/media/platform/s5p-fimc/fimc-core.c-
>> drivers/media/platform/s5p-fimc/fimc-core.c-    for (i = 0; i < MAX_FIMC_CLOCKS; i++) {
>> drivers/media/platform/s5p-fimc/fimc-core.c-            fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
>> drivers/media/platform/s5p-fimc/fimc-core.c-            if (IS_ERR(fimc->clock[i]))
> 
>>> I would prefer you have added the required changes at fimc_md_get_clocks()
>> and fimc_md_put_clocks() functions.
> 
> Ok. I will check this.

Thanks.

--
Regards,
Sylwester

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

* Re: [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 15:57     ` Sylwester Nawrocki
@ 2012-10-18 14:44       ` Sachin Kamat
  0 siblings, 0 replies; 20+ messages in thread
From: Sachin Kamat @ 2012-10-18 14:44 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: linux-media, patches, linux-arm-kernel, Turquette, Mike,
	linux-samsung-soc, Tomasz Figa

On 17 October 2012 21:27, Sylwester Nawrocki <s.nawrocki@samsung.com> wrote:
> On 10/17/2012 05:35 PM, Sachin Kamat wrote:
>>> Most of the s5p-* drivers have already added support for clk_(un)prepare.
>>> Thus most of your changes in this patch are not needed. I seem to have only
>>> missed fimc-mdevice.c, other modules are already reworked
>>
>> I did not find these changes in your tree. Please let me know the
>> branch where these changes are available.
>
> Are in Linus' tree, for quite long already, commits:
>
> 11a37c709797cc56f48905e68a3099b79cf08850
> [media] s5p-g2d: Added support for clk_prepare
>
> bd7d8888e99d67f778f4ee272346322c0b9cb378
> [media] s5p-fimc: convert to clk_prepare()/clk_unprepare()
>
> eb732518e0db585376f95256b18b2149240e3ad3
> [media] s5p-mfc: Added support for clk_prepare

Oh I see.. I dunno how i missed to notice this..


>
> Please note there was the media drivers reorganization recently, e.g.
> drivers/media/video/s5p-* changed to drivers/media/platform/s5p-*.

Right. I am aware of that.

>
>>> $ git grep -5  clk_prepare  -- drivers/media/platform/s5p-fimc
>>> drivers/media/platform/s5p-fimc/fimc-core.c-
>>> drivers/media/platform/s5p-fimc/fimc-core.c-    for (i = 0; i < MAX_FIMC_CLOCKS; i++) {
>>> drivers/media/platform/s5p-fimc/fimc-core.c-            fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
>>> drivers/media/platform/s5p-fimc/fimc-core.c-            if (IS_ERR(fimc->clock[i]))
>>
>>>> I would prefer you have added the required changes at fimc_md_get_clocks()
>>> and fimc_md_put_clocks() functions.
>>
>> Ok. I will check this.
>
> Thanks.
>
> --
> Regards,
> Sylwester

Thanks Sylwester.


-- 
With warm regards,
Sachin

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

* Re: [PATCH 2/8] [media] s5p-g2d: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 ` [PATCH 2/8] [media] s5p-g2d: " Sachin Kamat
@ 2012-10-20  9:32   ` Sylwester Nawrocki
  0 siblings, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:32 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches, Kamil Debski

Hi Sachin,

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
> as required by the common clock framework.
> 
> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
> Cc: Kamil Debski<k.debski@samsung.com>

As we discussed previously, this patch is not needed. clk_prepare/unprepare
are done in this driver's probe() and remove() callbacks.

Thanks,
Sylwester

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

* Re: [PATCH 3/8] [media] s5p-mfc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 ` [PATCH 3/8] [media] s5p-mfc: " Sachin Kamat
@ 2012-10-20  9:36   ` Sylwester Nawrocki
  2012-10-20  9:36   ` Sylwester Nawrocki
  1 sibling, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:36 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches, Kamil Debski

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
> as required by the common clock framework.

Similarly as in case of s5p-g2d driver, there is no need for this change.

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

* Re: [PATCH 3/8] [media] s5p-mfc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 ` [PATCH 3/8] [media] s5p-mfc: " Sachin Kamat
  2012-10-20  9:36   ` Sylwester Nawrocki
@ 2012-10-20  9:36   ` Sylwester Nawrocki
  1 sibling, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:36 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches, Kamil Debski

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
> as required by the common clock framework.

Similarly as in case of s5p-g2d driver, there is no need for this change.

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

* Re: [PATCH 4/8] [media] s5p-tv: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 ` [PATCH 4/8] [media] s5p-tv: " Sachin Kamat
@ 2012-10-20  9:39   ` Sylwester Nawrocki
  0 siblings, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:39 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches, Tomasz Stanislawski

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
> as required by the common clock framework.
> 
> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
> Cc: Tomasz Stanislawski<t.stanislaws@samsung.com>

Could you add clocks (un)prepare calls at the functions where the clocks
are acquired/released instead ? I think it results in slightly less overhead
this way.

--
Thanks,
Sylwester

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

* Re: [PATCH 5/8] [media] exynos-gsc: Use clk_prepare_enable and clk_disable_unprepare
  2012-10-17 11:11 ` [PATCH 5/8] [media] exynos-gsc: " Sachin Kamat
@ 2012-10-20  9:54   ` Sylwester Nawrocki
  0 siblings, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:54 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
> as required by the common clock framework.
> 
> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
> ---
>   drivers/media/platform/exynos-gsc/gsc-core.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
> index bfec9e6..d11668b 100644
> --- a/drivers/media/platform/exynos-gsc/gsc-core.c
> +++ b/drivers/media/platform/exynos-gsc/gsc-core.c
> @@ -1009,7 +1009,7 @@ static int gsc_clk_get(struct gsc_dev *gsc)
>   	if (IS_ERR(gsc->clock))
>   		goto err_print;
> 
> -	ret = clk_prepare(gsc->clock);
> +	ret = clk_prepare_enable(gsc->clock);

This is not right, gsc->clock is being enabled somewhere else.
And as you can see this driver has already taken care of preparing/
unpreparing the clock.

>   	if (ret<  0) {
>   		clk_put(gsc->clock);
>   		gsc->clock = NULL;
> @@ -1186,7 +1186,7 @@ static int gsc_runtime_suspend(struct device *dev)
> 
>   	ret = gsc_m2m_suspend(gsc);
>   	if (!ret)
> -		clk_disable(gsc->clock);
> +		clk_disable_unprepare(gsc->clock);

No, that will result in unbalanced clk_prepare/unprepare. Please
don't do that.
 
> 
>   	pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
>   	return ret;

This driver should already inter-work fine with the common clock
framework, just look how it handles the clock:

# git grep -n -7 clk_ -- exynos-gsc

exynos-gsc/gsc-core.c:993:static void gsc_clk_put(struct gsc_dev *gsc)
exynos-gsc/gsc-core.c-994-{
exynos-gsc/gsc-core.c-995-	if (IS_ERR_OR_NULL(gsc->clock))
exynos-gsc/gsc-core.c-996-		return;
exynos-gsc/gsc-core.c-997-
exynos-gsc/gsc-core.c:998:	clk_unprepare(gsc->clock);
exynos-gsc/gsc-core.c:999:	clk_put(gsc->clock);
exynos-gsc/gsc-core.c-1000-	gsc->clock = NULL;
exynos-gsc/gsc-core.c-1001-}
exynos-gsc/gsc-core.c-1002-
exynos-gsc/gsc-core.c:1003:static int gsc_clk_get(struct gsc_dev *gsc)
exynos-gsc/gsc-core.c-1004-{
exynos-gsc/gsc-core.c-1005-	int ret;
exynos-gsc/gsc-core.c-1006-
exynos-gsc/gsc-core.c:1007:	dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n");
exynos-gsc/gsc-core.c-1008-
exynos-gsc/gsc-core.c:1009:	gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
exynos-gsc/gsc-core.c-1010-	if (IS_ERR(gsc->clock))
exynos-gsc/gsc-core.c-1011-		goto err_print;
exynos-gsc/gsc-core.c-1012-
exynos-gsc/gsc-core.c:1013:	ret = clk_prepare(gsc->clock);
exynos-gsc/gsc-core.c-1014-	if (ret < 0) {
exynos-gsc/gsc-core.c:1015:		clk_put(gsc->clock);
exynos-gsc/gsc-core.c-1016-		gsc->clock = NULL;
exynos-gsc/gsc-core.c-1017-		goto err;
exynos-gsc/gsc-core.c-1018-	}
exynos-gsc/gsc-core.c-1019-
exynos-gsc/gsc-core.c-1020-	return 0;
exynos-gsc/gsc-core.c-1021-
exynos-gsc/gsc-core.c-1022-err:
exynos-gsc/gsc-core.c-1023-	dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
exynos-gsc/gsc-core.c-1024-					GSC_CLOCK_GATE_NAME);
exynos-gsc/gsc-core.c:1025:	gsc_clk_put(gsc);
exynos-gsc/gsc-core.c-1026-err_print:
exynos-gsc/gsc-core.c-1027-	dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
exynos-gsc/gsc-core.c-1028-					GSC_CLOCK_GATE_NAME);
exynos-gsc/gsc-core.c-1029-	return -ENXIO;
exynos-gsc/gsc-core.c-1030-}
--
exynos-gsc/gsc-core.c-1105-
exynos-gsc/gsc-core.c-1106-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
exynos-gsc/gsc-core.c-1107-	if (!res) {
exynos-gsc/gsc-core.c-1108-		dev_err(dev, "failed to get IRQ resource\n");
exynos-gsc/gsc-core.c-1109-		return -ENXIO;
exynos-gsc/gsc-core.c-1110-	}
exynos-gsc/gsc-core.c-1111-
exynos-gsc/gsc-core.c:1112:	ret = gsc_clk_get(gsc);
exynos-gsc/gsc-core.c-1113-	if (ret)
exynos-gsc/gsc-core.c-1114-		return ret;
--
exynos-gsc/gsc-core.c-1142-	pm_runtime_put(dev);
exynos-gsc/gsc-core.c-1143-	return 0;
exynos-gsc/gsc-core.c-1144-err_pm:
exynos-gsc/gsc-core.c-1145-	pm_runtime_put(dev);
exynos-gsc/gsc-core.c-1146-err_m2m:
exynos-gsc/gsc-core.c-1147-	gsc_unregister_m2m_device(gsc);
exynos-gsc/gsc-core.c-1148-err_clk:
exynos-gsc/gsc-core.c:1149:	gsc_clk_put(gsc);
exynos-gsc/gsc-core.c-1150-	return ret;
exynos-gsc/gsc-core.c-1151-}
--
exynos-gsc/gsc-core.c-1166-static int gsc_runtime_resume(struct device *dev)
exynos-gsc/gsc-core.c-1167-{
exynos-gsc/gsc-core.c-1168-	struct gsc_dev *gsc = dev_get_drvdata(dev);
exynos-gsc/gsc-core.c-1169-	int ret = 0;
exynos-gsc/gsc-core.c-1170-
exynos-gsc/gsc-core.c-1171-	pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
exynos-gsc/gsc-core.c-1172-
exynos-gsc/gsc-core.c:1173:	ret = clk_enable(gsc->clock);
exynos-gsc/gsc-core.c-1174-	if (ret)
exynos-gsc/gsc-core.c-1175-		return ret;
exynos-gsc/gsc-core.c-1176-
exynos-gsc/gsc-core.c-1177-	gsc_hw_set_sw_reset(gsc);
exynos-gsc/gsc-core.c-1178-	gsc_wait_reset(gsc);
exynos-gsc/gsc-core.c-1179-
exynos-gsc/gsc-core.c-1180-	return gsc_m2m_resume(gsc);
--
exynos-gsc/gsc-core.c-1183-static int gsc_runtime_suspend(struct device *dev)
exynos-gsc/gsc-core.c-1184-{
exynos-gsc/gsc-core.c-1185-	struct gsc_dev *gsc = dev_get_drvdata(dev);
exynos-gsc/gsc-core.c-1186-	int ret = 0;
exynos-gsc/gsc-core.c-1187-
exynos-gsc/gsc-core.c-1188-	ret = gsc_m2m_suspend(gsc);
exynos-gsc/gsc-core.c-1189-	if (!ret)
exynos-gsc/gsc-core.c:1190:		clk_disable(gsc->clock);
exynos-gsc/gsc-core.c-1191-
exynos-gsc/gsc-core.c-1192-	pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
exynos-gsc/gsc-core.c-1193-	return ret;
exynos-gsc/gsc-core.c-1194-}

--
Regards,
Sylwester

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

* Re: [PATCH 6/8] [media] exynos-gsc: Fix compilation warning
  2012-10-17 11:11 ` [PATCH 6/8] [media] exynos-gsc: Fix compilation warning Sachin Kamat
@ 2012-10-20  9:55   ` Sylwester Nawrocki
  0 siblings, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:55 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Used type casting to avoid the following compilation warning:
>
> drivers/media/platform/exynos-gsc/gsc-core.c:983:37: warning:
> incorrect type in assignment (different modifiers)
> drivers/media/platform/exynos-gsc/gsc-core.c:983:37:
> expected struct gsc_driverdata *driver_data
> drivers/media/platform/exynos-gsc/gsc-core.c:983:37:
> got void const *data

Applied to my tree, thanks.

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

* Re: [PATCH 7/8] [media] s5p-mfc: Make 'clk_ref' static in s5p_mfc_pm.c
  2012-10-17 11:11 ` [PATCH 7/8] [media] s5p-mfc: Make 'clk_ref' static in s5p_mfc_pm.c Sachin Kamat
@ 2012-10-20  9:56   ` Sylwester Nawrocki
  0 siblings, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:56 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches, Kamil Debski

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Fixes the following sparse warning:
> drivers/media/platform/s5p-mfc/s5p_mfc_pm.c:31:10: warning:
> symbol 'clk_ref' was not declared. Should it be static?

Applied, thanks.

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

* Re: [PATCH 8/8] [media] s5p-fimc: Make 'fimc_pipeline_s_stream' function static
  2012-10-17 11:11 ` [PATCH 8/8] [media] s5p-fimc: Make 'fimc_pipeline_s_stream' function static Sachin Kamat
@ 2012-10-20  9:57   ` Sylwester Nawrocki
  0 siblings, 0 replies; 20+ messages in thread
From: Sylwester Nawrocki @ 2012-10-20  9:57 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-media, s.nawrocki, patches

On 10/17/2012 01:11 PM, Sachin Kamat wrote:
> Fixes the following sparse warning:
> drivers/media/platform/s5p-fimc/fimc-mdevice.c:216:5: warning:
> symbol 'fimc_pipeline_s_stream' was not declared. Should it be static?

Thanks Sachin, I've add it to my tree.

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

end of thread, other threads:[~2012-10-20  9:57 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17 11:11 [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sachin Kamat
2012-10-17 11:11 ` [PATCH 2/8] [media] s5p-g2d: " Sachin Kamat
2012-10-20  9:32   ` Sylwester Nawrocki
2012-10-17 11:11 ` [PATCH 3/8] [media] s5p-mfc: " Sachin Kamat
2012-10-20  9:36   ` Sylwester Nawrocki
2012-10-20  9:36   ` Sylwester Nawrocki
2012-10-17 11:11 ` [PATCH 4/8] [media] s5p-tv: " Sachin Kamat
2012-10-20  9:39   ` Sylwester Nawrocki
2012-10-17 11:11 ` [PATCH 5/8] [media] exynos-gsc: " Sachin Kamat
2012-10-20  9:54   ` Sylwester Nawrocki
2012-10-17 11:11 ` [PATCH 6/8] [media] exynos-gsc: Fix compilation warning Sachin Kamat
2012-10-20  9:55   ` Sylwester Nawrocki
2012-10-17 11:11 ` [PATCH 7/8] [media] s5p-mfc: Make 'clk_ref' static in s5p_mfc_pm.c Sachin Kamat
2012-10-20  9:56   ` Sylwester Nawrocki
2012-10-17 11:11 ` [PATCH 8/8] [media] s5p-fimc: Make 'fimc_pipeline_s_stream' function static Sachin Kamat
2012-10-20  9:57   ` Sylwester Nawrocki
2012-10-17 14:33 ` [PATCH 1/8] [media] s5p-fimc: Use clk_prepare_enable and clk_disable_unprepare Sylwester Nawrocki
2012-10-17 15:35   ` Sachin Kamat
2012-10-17 15:57     ` Sylwester Nawrocki
2012-10-18 14:44       ` Sachin Kamat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).