aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-02-22 08:53:46 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-03-11 08:46:23 -0500
commit5f42f2ce63f5ecbd9bc744b9c25d9786e9a8e3b4 (patch)
tree8ed7158d7e8b39cb184ade1bed6794963f44b9fc /drivers
parentac425ed5fb0b6564d4eeee9fb13ef0c1f6da8e8f (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/omap2/dss/dpi.c21
-rw-r--r--drivers/video/omap2/dss/dsi.c36
-rw-r--r--drivers/video/omap2/dss/sdi.c18
-rw-r--r--drivers/video/omap2/dss/venc.c31
4 files changed, 52 insertions, 54 deletions
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 746f1b6dd89..026702b921e 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -303,22 +303,27 @@ int dpi_init_display(struct omap_dss_device *dssdev)
303{ 303{
304 DSSDBG("init_display\n"); 304 DSSDBG("init_display\n");
305 305
306 return 0; 306 if (cpu_is_omap34xx() && dpi.vdds_dsi_reg == NULL) {
307} 307 struct regulator *vdds_dsi;
308 308
309int dpi_init(struct platform_device *pdev) 309 vdds_dsi = dss_get_vdds_dsi();
310{ 310
311 if (cpu_is_omap34xx()) { 311 if (IS_ERR(vdds_dsi)) {
312 dpi.vdds_dsi_reg = dss_get_vdds_dsi();
313 if (IS_ERR(dpi.vdds_dsi_reg)) {
314 DSSERR("can't get VDDS_DSI regulator\n"); 312 DSSERR("can't get VDDS_DSI regulator\n");
315 return PTR_ERR(dpi.vdds_dsi_reg); 313 return PTR_ERR(vdds_dsi);
316 } 314 }
315
316 dpi.vdds_dsi_reg = vdds_dsi;
317 } 317 }
318 318
319 return 0; 319 return 0;
320} 320}
321 321
322int dpi_init(struct platform_device *pdev)
323{
324 return 0;
325}
326
322void dpi_exit(void) 327void dpi_exit(void)
323{ 328{
324} 329}
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index c7b5382e1a6..2928cddeb3f 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -291,20 +291,6 @@ static inline u32 dsi_read_reg(const struct dsi_reg idx)
291 return __raw_readl(dsi.base + idx.idx); 291 return __raw_readl(dsi.base + idx.idx);
292} 292}
293 293
294static struct regulator *dsi_get_vdds_dsi(void)
295{
296 struct regulator *reg;
297
298 if (dsi.vdds_dsi_reg != NULL)
299 return dsi.vdds_dsi_reg;
300
301 reg = regulator_get(&dsi.pdev->dev, "vdds_dsi");
302 if (!IS_ERR(reg))
303 dsi.vdds_dsi_reg = reg;
304
305 return reg;
306}
307
308 294
309void dsi_save_context(void) 295void dsi_save_context(void)
310{ 296{
@@ -3236,6 +3222,19 @@ int dsi_init_display(struct omap_dss_device *dssdev)
3236 dsi.vc[0].dssdev = dssdev; 3222 dsi.vc[0].dssdev = dssdev;
3237 dsi.vc[1].dssdev = dssdev; 3223 dsi.vc[1].dssdev = dssdev;
3238 3224
3225 if (dsi.vdds_dsi_reg == NULL) {
3226 struct regulator *vdds_dsi;
3227
3228 vdds_dsi = regulator_get(&dsi.pdev->dev, "vdds_dsi");
3229
3230 if (IS_ERR(vdds_dsi)) {
3231 DSSERR("can't get VDDS_DSI regulator\n");
3232 return PTR_ERR(vdds_dsi);
3233 }
3234
3235 dsi.vdds_dsi_reg = vdds_dsi;
3236 }
3237
3239 return 0; 3238 return 0;
3240} 3239}
3241 3240
@@ -3295,13 +3294,6 @@ static int dsi_init(struct platform_device *pdev)
3295 goto err1; 3294 goto err1;
3296 } 3295 }
3297 3296
3298 dsi.vdds_dsi_reg = dsi_get_vdds_dsi();
3299 if (IS_ERR(dsi.vdds_dsi_reg)) {
3300 DSSERR("can't get VDDS_DSI regulator\n");
3301 r = PTR_ERR(dsi.vdds_dsi_reg);
3302 goto err2;
3303 }
3304
3305 enable_clocks(1); 3297 enable_clocks(1);
3306 3298
3307 rev = dsi_read_reg(DSI_REVISION); 3299 rev = dsi_read_reg(DSI_REVISION);
@@ -3311,8 +3303,6 @@ static int dsi_init(struct platform_device *pdev)
3311 enable_clocks(0); 3303 enable_clocks(0);
3312 3304
3313 return 0; 3305 return 0;
3314err2:
3315 iounmap(dsi.base);
3316err1: 3306err1:
3317 destroy_workqueue(dsi.workqueue); 3307 destroy_workqueue(dsi.workqueue);
3318 return r; 3308 return r;
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 8272fc1f327..9f10a0d9e76 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -157,6 +157,19 @@ int sdi_init_display(struct omap_dss_device *dssdev)
157{ 157{
158 DSSDBG("SDI init\n"); 158 DSSDBG("SDI init\n");
159 159
160 if (sdi.vdds_sdi_reg == NULL) {
161 struct regulator *vdds_sdi;
162
163 vdds_sdi = dss_get_vdds_sdi();
164
165 if (IS_ERR(vdds_sdi)) {
166 DSSERR("can't get VDDS_SDI regulator\n");
167 return PTR_ERR(vdds_sdi);
168 }
169
170 sdi.vdds_sdi_reg = vdds_sdi;
171 }
172
160 return 0; 173 return 0;
161} 174}
162 175
@@ -165,11 +178,6 @@ int sdi_init(bool skip_init)
165 /* we store this for first display enable, then clear it */ 178 /* we store this for first display enable, then clear it */
166 sdi.skip_init = skip_init; 179 sdi.skip_init = skip_init;
167 180
168 sdi.vdds_sdi_reg = dss_get_vdds_sdi();
169 if (IS_ERR(sdi.vdds_sdi_reg)) {
170 DSSERR("can't get VDDS_SDI regulator\n");
171 return PTR_ERR(sdi.vdds_sdi_reg);
172 }
173 /* 181 /*
174 * Enable clocks already here, otherwise there would be a toggle 182 * Enable clocks already here, otherwise there would be a toggle
175 * of them until sdi_display_enable is called. 183 * of them until sdi_display_enable is called.
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 1aadceb76e1..43009e57cd3 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -305,17 +305,6 @@ static inline u32 venc_read_reg(int idx)
305 return l; 305 return l;
306} 306}
307 307
308static struct regulator *venc_get_vdda_dac(void)
309{
310 struct regulator *reg;
311
312 reg = regulator_get(&venc.pdev->dev, "vdda_dac");
313 if (!IS_ERR(reg))
314 venc.vdda_dac_reg = reg;
315
316 return reg;
317}
318
319static void venc_write_config(const struct venc_config *config) 308static void venc_write_config(const struct venc_config *config)
320{ 309{
321 DSSDBG("write venc conf\n"); 310 DSSDBG("write venc conf\n");
@@ -655,6 +644,19 @@ int venc_init_display(struct omap_dss_device *dssdev)
655{ 644{
656 DSSDBG("init_display\n"); 645 DSSDBG("init_display\n");
657 646
647 if (venc.vdda_dac_reg == NULL) {
648 struct regulator *vdda_dac;
649
650 vdda_dac = regulator_get(&venc.pdev->dev, "vdda_dac");
651
652 if (IS_ERR(vdda_dac)) {
653 DSSERR("can't get VDDA_DAC regulator\n");
654 return PTR_ERR(vdda_dac);
655 }
656
657 venc.vdda_dac_reg = vdda_dac;
658 }
659
658 return 0; 660 return 0;
659} 661}
660 662
@@ -734,13 +736,6 @@ static int omap_venchw_probe(struct platform_device *pdev)
734 return -ENOMEM; 736 return -ENOMEM;
735 } 737 }
736 738
737 venc.vdda_dac_reg = venc_get_vdda_dac();
738 if (IS_ERR(venc.vdda_dac_reg)) {
739 iounmap(venc.base);
740 DSSERR("can't get VDDA_DAC regulator\n");
741 return PTR_ERR(venc.vdda_dac_reg);
742 }
743
744 venc_enable_clocks(1); 739 venc_enable_clocks(1);
745 740
746 rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff); 741 rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff);