OMAP: DSS2: Delay regulator_get() calls
DSS submodules DPI/SDI/DSI/VENC require a regulator to function.
However, if the board doesn't use, say, SDI, the board shouldn't need to
configure vdds_sdi regulator required by the SDI module.
Currently the regulators are acquired when the DSS driver is loaded.
This means that if the kernel is configured with SDI, vdds_sdi regulator
is needed for all boards.
This patch changes the DSS driver to acquire the regulators only when a
display of particular type is initialized. For example, vdds_sdi is
acquired when sdi_init_display() is called.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index c7b5382e..2928cdd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -291,20 +291,6 @@
return __raw_readl(dsi.base + idx.idx);
}
-static struct regulator *dsi_get_vdds_dsi(void)
-{
- struct regulator *reg;
-
- if (dsi.vdds_dsi_reg != NULL)
- return dsi.vdds_dsi_reg;
-
- reg = regulator_get(&dsi.pdev->dev, "vdds_dsi");
- if (!IS_ERR(reg))
- dsi.vdds_dsi_reg = reg;
-
- return reg;
-}
-
void dsi_save_context(void)
{
@@ -3236,6 +3222,19 @@
dsi.vc[0].dssdev = dssdev;
dsi.vc[1].dssdev = dssdev;
+ if (dsi.vdds_dsi_reg == NULL) {
+ struct regulator *vdds_dsi;
+
+ vdds_dsi = regulator_get(&dsi.pdev->dev, "vdds_dsi");
+
+ 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;
}
@@ -3295,13 +3294,6 @@
goto err1;
}
- dsi.vdds_dsi_reg = dsi_get_vdds_dsi();
- if (IS_ERR(dsi.vdds_dsi_reg)) {
- DSSERR("can't get VDDS_DSI regulator\n");
- r = PTR_ERR(dsi.vdds_dsi_reg);
- goto err2;
- }
-
enable_clocks(1);
rev = dsi_read_reg(DSI_REVISION);
@@ -3311,8 +3303,6 @@
enable_clocks(0);
return 0;
-err2:
- iounmap(dsi.base);
err1:
destroy_workqueue(dsi.workqueue);
return r;