[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1377696872-32069-2-git-send-email-m.krawczuk@partner.samsung.com>
Date: Wed, 28 Aug 2013 15:34:28 +0200
From: Mateusz Krawczuk <m.krawczuk@...tner.samsung.com>
To: kyungmin.park@...sung.com
Cc: t.stanislaws@...sung.com, m.chehab@...sung.com,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, rob.herring@...xeda.com,
pawel.moll@....com, mark.rutland@....com, swarren@...dotorg.org,
ian.campbell@...rix.com, rob@...dley.net, mturquette@...aro.org,
tomasz.figa@...il.com, kgene.kim@...sung.com,
thomas.abraham@...aro.org, s.nawrocki@...sung.com,
devicetree@...r.kernel.org, linux-doc@...r.kernel.org,
linux@....linux.org.uk, ben-linux@...ff.org,
linux-samsung-soc@...r.kernel.org,
Mateusz Krawczuk <m.krawczuk@...tner.samsung.com>
Subject: [PATCH v2 1/5] media: s5p-tv: Restore vpll clock rate
Restore vpll clock rate if start stream fail or stream is off.
Signed-off-by: Mateusz Krawczuk <m.krawczuk@...tner.samsung.com>
---
drivers/media/platform/s5p-tv/sdo_drv.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c
index 0afa90f..b919008 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -55,6 +55,8 @@ struct sdo_device {
struct clk *dacphy;
/** clock for control of VPLL */
struct clk *fout_vpll;
+ /** vpll rate before sdo stream was on */
+ int vpll_rate;
/** regulator for SDO IP power */
struct regulator *vdac;
/** regulator for SDO plug detection */
@@ -193,17 +195,34 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
static int sdo_streamon(struct sdo_device *sdev)
{
+ int ret;
+
/* set proper clock for Timing Generator */
- clk_set_rate(sdev->fout_vpll, 54000000);
+ sdev->vpll_rate = clk_get_rate(sdev->fout_vpll);
+ ret = clk_set_rate(sdev->fout_vpll, 54000000);
+ if (ret < 0) {
+ dev_err(sdev->dev,
+ "%s: Failed to set vpll rate!\n", __func__);
+ return ret;
+ }
dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
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);
+ ret = clk_prepare_enable(sdev->dacphy);
+ if (ret < 0) {
+ dev_err(sdev->dev,
+ "%s: Failed to prepare and enable clock !\n", __func__);
+ goto fail;
+ }
/* enable DAC */
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
sdo_reg_debug(sdev);
return 0;
+fail:
+ sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON);
+ clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
+ return ret;
}
static int sdo_streamoff(struct sdo_device *sdev)
@@ -220,6 +239,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
}
if (tries == 0)
dev_err(sdev->dev, "failed to stop streaming\n");
+ clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
return tries ? 0 : -EIO;
}
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists