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/venc.c b/drivers/video/omap2/dss/venc.c
index 1aadceb..43009e5 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -305,17 +305,6 @@
return l;
}
-static struct regulator *venc_get_vdda_dac(void)
-{
- struct regulator *reg;
-
- reg = regulator_get(&venc.pdev->dev, "vdda_dac");
- if (!IS_ERR(reg))
- venc.vdda_dac_reg = reg;
-
- return reg;
-}
-
static void venc_write_config(const struct venc_config *config)
{
DSSDBG("write venc conf\n");
@@ -655,6 +644,19 @@
{
DSSDBG("init_display\n");
+ if (venc.vdda_dac_reg == NULL) {
+ struct regulator *vdda_dac;
+
+ vdda_dac = regulator_get(&venc.pdev->dev, "vdda_dac");
+
+ if (IS_ERR(vdda_dac)) {
+ DSSERR("can't get VDDA_DAC regulator\n");
+ return PTR_ERR(vdda_dac);
+ }
+
+ venc.vdda_dac_reg = vdda_dac;
+ }
+
return 0;
}
@@ -734,13 +736,6 @@
return -ENOMEM;
}
- venc.vdda_dac_reg = venc_get_vdda_dac();
- if (IS_ERR(venc.vdda_dac_reg)) {
- iounmap(venc.base);
- DSSERR("can't get VDDA_DAC regulator\n");
- return PTR_ERR(venc.vdda_dac_reg);
- }
-
venc_enable_clocks(1);
rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff);