aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss
diff options
context:
space:
mode:
authorSenthilvadivu Guruswamy <svadivu@ti.com>2011-01-24 01:22:02 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-03-11 08:46:21 -0500
commitc8aac01b7bd1109795586db11ea7f12ab1e2d163 (patch)
treeea58a702e4f3fe550548daa724c2ee71dd5ac1b7 /drivers/video/omap2/dss
parent30ea50c9f5166a375b4dc0109d18a5d21bab5711 (diff)
OMAP2, 3: DSS2: DSI: create platform_driver, move init, exit to driver
Hwmod adaptation design requires each of the DSS HW IP to be a platform driver. So a platform_driver for DSI is created and init exit methods are moved from core.c to its driver probe,remove. pdev member has to be maintained by its own drivers. Also, vdds_dsi regulator handling is copied to dsi.c, since vdds_dsi regulator is needed by dpi_init() too. Board files are updated accordingly to add 2 instances of vdds_dsi regulator. DSI platform driver is registered from inside omap_dss_probe, in the order desired. Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com> Signed-off-by: Sumit Semwal <sumit.semwal@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss')
-rw-r--r--drivers/video/omap2/dss/core.c8
-rw-r--r--drivers/video/omap2/dss/dsi.c64
-rw-r--r--drivers/video/omap2/dss/dss.h8
3 files changed, 69 insertions, 11 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 57c6303cb1cd..3f7a5fcd1142 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -222,9 +222,9 @@ static int omap_dss_probe(struct platform_device *pdev)
222 goto err_sdi; 222 goto err_sdi;
223 } 223 }
224 224
225 r = dsi_init(pdev); 225 r = dsi_init_platform_driver();
226 if (r) { 226 if (r) {
227 DSSERR("Failed to initialize DSI\n"); 227 DSSERR("Failed to initialize DSI platform driver\n");
228 goto err_dsi; 228 goto err_dsi;
229 } 229 }
230 } 230 }
@@ -259,7 +259,7 @@ err_register:
259 dss_uninitialize_debugfs(); 259 dss_uninitialize_debugfs();
260err_debugfs: 260err_debugfs:
261 if (cpu_is_omap34xx()) 261 if (cpu_is_omap34xx())
262 dsi_exit(); 262 dsi_uninit_platform_driver();
263err_dsi: 263err_dsi:
264 if (cpu_is_omap34xx()) 264 if (cpu_is_omap34xx())
265 sdi_exit(); 265 sdi_exit();
@@ -290,7 +290,7 @@ static int omap_dss_remove(struct platform_device *pdev)
290 dpi_exit(); 290 dpi_exit();
291 rfbi_uninit_platform_driver(); 291 rfbi_uninit_platform_driver();
292 if (cpu_is_omap34xx()) { 292 if (cpu_is_omap34xx()) {
293 dsi_exit(); 293 dsi_uninit_platform_driver();
294 sdi_exit(); 294 sdi_exit();
295 } 295 }
296 296
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index ddf3a0560822..fa85f1adba2a 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -222,6 +222,7 @@ struct dsi_irq_stats {
222 222
223static struct 223static struct
224{ 224{
225 struct platform_device *pdev;
225 void __iomem *base; 226 void __iomem *base;
226 227
227 struct dsi_clock_info current_cinfo; 228 struct dsi_clock_info current_cinfo;
@@ -292,6 +293,20 @@ static inline u32 dsi_read_reg(const struct dsi_reg idx)
292 return __raw_readl(dsi.base + idx.idx); 293 return __raw_readl(dsi.base + idx.idx);
293} 294}
294 295
296static struct regulator *dsi_get_vdds_dsi(void)
297{
298 struct regulator *reg;
299
300 if (dsi.vdds_dsi_reg != NULL)
301 return dsi.vdds_dsi_reg;
302
303 reg = regulator_get(&dsi.pdev->dev, "vdds_dsi");
304 if (!IS_ERR(reg))
305 dsi.vdds_dsi_reg = reg;
306
307 return reg;
308}
309
295 310
296void dsi_save_context(void) 311void dsi_save_context(void)
297{ 312{
@@ -3238,7 +3253,7 @@ void dsi_wait_dsi2_pll_active(void)
3238 DSSERR("DSI2 PLL clock not active\n"); 3253 DSSERR("DSI2 PLL clock not active\n");
3239} 3254}
3240 3255
3241int dsi_init(struct platform_device *pdev) 3256static int dsi_init(struct platform_device *pdev)
3242{ 3257{
3243 u32 rev; 3258 u32 rev;
3244 int r; 3259 int r;
@@ -3275,7 +3290,7 @@ int dsi_init(struct platform_device *pdev)
3275 goto err1; 3290 goto err1;
3276 } 3291 }
3277 3292
3278 dsi.vdds_dsi_reg = dss_get_vdds_dsi(); 3293 dsi.vdds_dsi_reg = dsi_get_vdds_dsi();
3279 if (IS_ERR(dsi.vdds_dsi_reg)) { 3294 if (IS_ERR(dsi.vdds_dsi_reg)) {
3280 DSSERR("can't get VDDS_DSI regulator\n"); 3295 DSSERR("can't get VDDS_DSI regulator\n");
3281 r = PTR_ERR(dsi.vdds_dsi_reg); 3296 r = PTR_ERR(dsi.vdds_dsi_reg);
@@ -3298,8 +3313,13 @@ err1:
3298 return r; 3313 return r;
3299} 3314}
3300 3315
3301void dsi_exit(void) 3316static void dsi_exit(void)
3302{ 3317{
3318 if (dsi.vdds_dsi_reg != NULL) {
3319 regulator_put(dsi.vdds_dsi_reg);
3320 dsi.vdds_dsi_reg = NULL;
3321 }
3322
3303 iounmap(dsi.base); 3323 iounmap(dsi.base);
3304 3324
3305 destroy_workqueue(dsi.workqueue); 3325 destroy_workqueue(dsi.workqueue);
@@ -3307,3 +3327,41 @@ void dsi_exit(void)
3307 DSSDBG("omap_dsi_exit\n"); 3327 DSSDBG("omap_dsi_exit\n");
3308} 3328}
3309 3329
3330/* DSI1 HW IP initialisation */
3331static int omap_dsi1hw_probe(struct platform_device *pdev)
3332{
3333 int r;
3334 dsi.pdev = pdev;
3335 r = dsi_init(pdev);
3336 if (r) {
3337 DSSERR("Failed to initialize DSI\n");
3338 goto err_dsi;
3339 }
3340err_dsi:
3341 return r;
3342}
3343
3344static int omap_dsi1hw_remove(struct platform_device *pdev)
3345{
3346 dsi_exit();
3347 return 0;
3348}
3349
3350static struct platform_driver omap_dsi1hw_driver = {
3351 .probe = omap_dsi1hw_probe,
3352 .remove = omap_dsi1hw_remove,
3353 .driver = {
3354 .name = "omapdss_dsi1",
3355 .owner = THIS_MODULE,
3356 },
3357};
3358
3359int dsi_init_platform_driver(void)
3360{
3361 return platform_driver_register(&omap_dsi1hw_driver);
3362}
3363
3364void dsi_uninit_platform_driver(void)
3365{
3366 return platform_driver_unregister(&omap_dsi1hw_driver);
3367}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 931385185dc6..981d247c30f2 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -261,8 +261,8 @@ static inline void sdi_exit(void)
261 261
262/* DSI */ 262/* DSI */
263#ifdef CONFIG_OMAP2_DSS_DSI 263#ifdef CONFIG_OMAP2_DSS_DSI
264int dsi_init(struct platform_device *pdev); 264int dsi_init_platform_driver(void);
265void dsi_exit(void); 265void dsi_uninit_platform_driver(void);
266 266
267void dsi_dump_clocks(struct seq_file *s); 267void dsi_dump_clocks(struct seq_file *s);
268void dsi_dump_irqs(struct seq_file *s); 268void dsi_dump_irqs(struct seq_file *s);
@@ -287,11 +287,11 @@ void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
287void dsi_wait_dsi1_pll_active(void); 287void dsi_wait_dsi1_pll_active(void);
288void dsi_wait_dsi2_pll_active(void); 288void dsi_wait_dsi2_pll_active(void);
289#else 289#else
290static inline int dsi_init(struct platform_device *pdev) 290static inline int dsi_init_platform_driver(void)
291{ 291{
292 return 0; 292 return 0;
293} 293}
294static inline void dsi_exit(void) 294static inline void dsi_uninit_platform_driver(void)
295{ 295{
296} 296}
297static inline void dsi_wait_dsi1_pll_active(void) 297static inline void dsi_wait_dsi1_pll_active(void)