|
@@ -55,6 +55,8 @@ struct sdo_device {
|
|
struct clk *dacphy;
|
|
struct clk *dacphy;
|
|
/** clock for control of VPLL */
|
|
/** clock for control of VPLL */
|
|
struct clk *fout_vpll;
|
|
struct clk *fout_vpll;
|
|
|
|
+ /** vpll rate before sdo stream was on */
|
|
|
|
+ unsigned long vpll_rate;
|
|
/** regulator for SDO IP power */
|
|
/** regulator for SDO IP power */
|
|
struct regulator *vdac;
|
|
struct regulator *vdac;
|
|
/** regulator for SDO plug detection */
|
|
/** regulator for SDO plug detection */
|
|
@@ -193,17 +195,33 @@ static int sdo_s_power(struct v4l2_subdev *sd, int on)
|
|
|
|
|
|
static int sdo_streamon(struct sdo_device *sdev)
|
|
static int sdo_streamon(struct sdo_device *sdev)
|
|
{
|
|
{
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
/* set proper clock for Timing Generator */
|
|
/* 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, "Failed to set vpll rate\n");
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
|
|
dev_info(sdev->dev, "fout_vpll.rate = %lu\n",
|
|
clk_get_rate(sdev->fout_vpll));
|
|
clk_get_rate(sdev->fout_vpll));
|
|
/* enable clock in SDO */
|
|
/* enable clock in SDO */
|
|
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
|
|
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON);
|
|
- clk_enable(sdev->dacphy);
|
|
|
|
|
|
+ ret = clk_enable(sdev->dacphy);
|
|
|
|
+ if (ret < 0) {
|
|
|
|
+ dev_err(sdev->dev, "clk_enable(dacphy) failed\n");
|
|
|
|
+ goto fail;
|
|
|
|
+ }
|
|
/* enable DAC */
|
|
/* enable DAC */
|
|
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
|
|
sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC);
|
|
sdo_reg_debug(sdev);
|
|
sdo_reg_debug(sdev);
|
|
return 0;
|
|
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)
|
|
static int sdo_streamoff(struct sdo_device *sdev)
|
|
@@ -220,6 +238,7 @@ static int sdo_streamoff(struct sdo_device *sdev)
|
|
}
|
|
}
|
|
if (tries == 0)
|
|
if (tries == 0)
|
|
dev_err(sdev->dev, "failed to stop streaming\n");
|
|
dev_err(sdev->dev, "failed to stop streaming\n");
|
|
|
|
+ clk_set_rate(sdev->fout_vpll, sdev->vpll_rate);
|
|
return tries ? 0 : -EIO;
|
|
return tries ? 0 : -EIO;
|
|
}
|
|
}
|
|
|
|
|