Thread (60 messages) 60 messages, 6 authors, 2013-06-07

Re: [PATCH 14/32] OMAPDSS: DSI: cleanup regulator init

From: Archit Taneja <hidden>
Date: 2013-06-07 06:50:21
Also in: linux-omap

On Thursday 30 May 2013 03:04 PM, Tomi Valkeinen wrote:
quoted hunk ↗ jump to hunk
Separate the regulator initialization code to its own function, removing
duplicate code.

Signed-off-by: Tomi Valkeinen <redacted>
---
  drivers/video/omap2/dss/dsi.c | 82 ++++++++++++++++---------------------------
  1 file changed, 31 insertions(+), 51 deletions(-)
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index bdddd0d..37ca980 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1114,6 +1114,30 @@ void dsi_runtime_put(struct platform_device *dsidev)
  	WARN_ON(r < 0 && r != -ENOSYS);
  }

+static int dsi_regulator_init(struct platform_device *dsidev)
+{
+	struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+	struct regulator *vdds_dsi;
+
+	if (dsi->vdds_dsi_reg != NULL)
+		return 0;
+
+	vdds_dsi = regulator_get(&dsi->pdev->dev, "vdds_dsi");
+
+	/* DT HACK: try VCXIO to make omapdss work for o4 sdp/panda */
+	if (IS_ERR(vdds_dsi))
+		vdds_dsi = regulator_get(&dsi->pdev->dev, "VCXIO");
+
We could use devm_ versions here too right?

Archit
quoted hunk ↗ jump to hunk
+	if (IS_ERR(vdds_dsi)) {
+		DSSERR("can't get VDDS_DSI regulator\n");
+		return PTR_ERR(vdds_dsi);
+	}
+
+	dsi->vdds_dsi_reg = vdds_dsi;
+
+	return 0;
+}
+
  /* source clock for DSI PLL. this could also be PCLKFREE */
  static inline void dsi_enable_pll_clock(struct platform_device *dsidev,
  		bool enable)
@@ -1592,22 +1616,9 @@ int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk,
  	 */
  	enable_hsclk = enable_hsdiv = true;

-	if (dsi->vdds_dsi_reg = NULL) {
-		struct regulator *vdds_dsi;
-
-		vdds_dsi = regulator_get(&dsi->pdev->dev, "vdds_dsi");
-
-		/* DT HACK: try VCXIO to make omapdss work for o4 sdp/panda */
-		if (IS_ERR(vdds_dsi))
-			vdds_dsi = regulator_get(&dsi->pdev->dev, "VCXIO");
-
-		if (IS_ERR(vdds_dsi)) {
-			DSSERR("can't get VDDS_DSI regulator\n");
-			return PTR_ERR(vdds_dsi);
-		}
-
-		dsi->vdds_dsi_reg = vdds_dsi;
-	}
+	r = dsi_regulator_init(dsidev);
+	if (r)
+		return r;

  	dsi_enable_pll_clock(dsidev, 1);
  	/*
@@ -5225,34 +5236,6 @@ static enum omap_channel dsi_get_channel(int module_id)
  	}
  }

-static int dsi_init_display(struct omap_dss_device *dssdev)
-{
-	struct platform_device *dsidev > -			dsi_get_dsidev_from_id(dssdev->phy.dsi.module);
-	struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
-
-	DSSDBG("DSI init\n");
-
-	if (dsi->vdds_dsi_reg = NULL) {
-		struct regulator *vdds_dsi;
-
-		vdds_dsi = regulator_get(&dsi->pdev->dev, "vdds_dsi");
-
-		/* DT HACK: try VCXIO to make omapdss work for o4 sdp/panda */
-		if (IS_ERR(vdds_dsi))
-			vdds_dsi = regulator_get(&dsi->pdev->dev, "VCXIO");
-
-		if (IS_ERR(vdds_dsi)) {
-			DSSERR("can't get VDDS_DSI regulator\n");
-			return PTR_ERR(vdds_dsi);
-		}
-
-		dsi->vdds_dsi_reg = vdds_dsi;
-	}
-
-	return 0;
-}
-
  int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
  {
  	struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -5410,19 +5393,16 @@ static int dsi_probe_pdata(struct platform_device *dsidev)
  	if (!plat_dssdev)
  		return 0;

+	r = dsi_regulator_init(dsidev);
+	if (r)
+		return r;
+
  	dssdev = dss_alloc_and_init_device(&dsidev->dev);
  	if (!dssdev)
  		return -ENOMEM;

  	dss_copy_device_pdata(dssdev, plat_dssdev);

-	r = dsi_init_display(dssdev);
-	if (r) {
-		DSSERR("device %s init failed: %d\n", dssdev->name, r);
-		dss_put_device(dssdev);
-		return r;
-	}
-
  	r = omapdss_output_set_device(&dsi->output, dssdev);
  	if (r) {
  		DSSERR("failed to connect output to new device: %s\n",
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help