aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorSenthilvadivu Guruswamy <svadivu@ti.com>2011-01-24 01:21:57 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-03-11 08:46:19 -0500
commit96c401bcb83a182a4f332f2f64ee6530ba35511a (patch)
tree9561806b92baf3ab42d9d859e7ad67a6b1c5125c /drivers/video
parentcf07f5316215972e987c63b0a75a922c89813781 (diff)
OMAP2, 3: DSS2: DSS: 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 of DSS 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. DSS 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')
-rw-r--r--drivers/video/omap2/dss/core.c19
-rw-r--r--drivers/video/omap2/dss/dss.c55
-rw-r--r--drivers/video/omap2/dss/dss.h4
3 files changed, 64 insertions, 14 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index ee56859c52ce..e399ca22e514 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -517,15 +517,9 @@ static int omap_dss_probe(struct platform_device *pdev)
517 core.ctx_id = dss_get_ctx_id(); 517 core.ctx_id = dss_get_ctx_id();
518 DSSDBG("initial ctx id %u\n", core.ctx_id); 518 DSSDBG("initial ctx id %u\n", core.ctx_id);
519 519
520#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT 520 r = dss_init_platform_driver();
521 /* DISPC_CONTROL */
522 if (omap_readl(0x48050440) & 1) /* LCD enabled? */
523 skip_init = 1;
524#endif
525
526 r = dss_init(skip_init);
527 if (r) { 521 if (r) {
528 DSSERR("Failed to initialize DSS\n"); 522 DSSERR("Failed to initialize DSS platform driver\n");
529 goto err_dss; 523 goto err_dss;
530 } 524 }
531 525
@@ -553,6 +547,11 @@ static int omap_dss_probe(struct platform_device *pdev)
553 goto err_venc; 547 goto err_venc;
554 } 548 }
555 549
550#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
551 /* DISPC_CONTROL */
552 if (omap_readl(0x48050440) & 1) /* LCD enabled? */
553 skip_init = 1;
554#endif
556 if (cpu_is_omap34xx()) { 555 if (cpu_is_omap34xx()) {
557 r = sdi_init(skip_init); 556 r = sdi_init(skip_init);
558 if (r) { 557 if (r) {
@@ -610,7 +609,7 @@ err_dispc:
610err_dpi: 609err_dpi:
611 rfbi_exit(); 610 rfbi_exit();
612err_rfbi: 611err_rfbi:
613 dss_exit(); 612 dss_uninit_platform_driver();
614err_dss: 613err_dss:
615 dss_clk_disable_all_no_ctx(); 614 dss_clk_disable_all_no_ctx();
616 dss_put_clocks(); 615 dss_put_clocks();
@@ -635,7 +634,7 @@ static int omap_dss_remove(struct platform_device *pdev)
635 sdi_exit(); 634 sdi_exit();
636 } 635 }
637 636
638 dss_exit(); 637 dss_uninit_platform_driver();
639 638
640 /* 639 /*
641 * As part of hwmod changes, DSS is not the only controller of dss 640 * As part of hwmod changes, DSS is not the only controller of dss
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 77c3621c9171..01406f48f438 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -59,6 +59,7 @@ struct dss_reg {
59 dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) 59 dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end))
60 60
61static struct { 61static struct {
62 struct platform_device *pdev;
62 void __iomem *base; 63 void __iomem *base;
63 64
64 struct clk *dpll4_m4_ck; 65 struct clk *dpll4_m4_ck;
@@ -549,7 +550,7 @@ void dss_set_dac_pwrdn_bgz(bool enable)
549 REG_FLD_MOD(DSS_CONTROL, enable, 5, 5); /* DAC Power-Down Control */ 550 REG_FLD_MOD(DSS_CONTROL, enable, 5, 5); /* DAC Power-Down Control */
550} 551}
551 552
552int dss_init(bool skip_init) 553static int dss_init(bool skip_init)
553{ 554{
554 int r; 555 int r;
555 u32 rev; 556 u32 rev;
@@ -629,7 +630,7 @@ fail0:
629 return r; 630 return r;
630} 631}
631 632
632void dss_exit(void) 633static void dss_exit(void)
633{ 634{
634 if (cpu_is_omap34xx()) 635 if (cpu_is_omap34xx())
635 clk_put(dss.dpll4_m4_ck); 636 clk_put(dss.dpll4_m4_ck);
@@ -639,3 +640,53 @@ void dss_exit(void)
639 iounmap(dss.base); 640 iounmap(dss.base);
640} 641}
641 642
643/* DSS HW IP initialisation */
644static int omap_dsshw_probe(struct platform_device *pdev)
645{
646 int r;
647 int skip_init = 0;
648
649 dss.pdev = pdev;
650
651#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
652 /* DISPC_CONTROL */
653 if (omap_readl(0x48050440) & 1) /* LCD enabled? */
654 skip_init = 1;
655#endif
656
657 r = dss_init(skip_init);
658 if (r) {
659 DSSERR("Failed to initialize DSS\n");
660 goto err_dss;
661 }
662
663err_dss:
664
665 return r;
666}
667
668static int omap_dsshw_remove(struct platform_device *pdev)
669{
670 dss_exit();
671
672 return 0;
673}
674
675static struct platform_driver omap_dsshw_driver = {
676 .probe = omap_dsshw_probe,
677 .remove = omap_dsshw_remove,
678 .driver = {
679 .name = "omapdss_dss",
680 .owner = THIS_MODULE,
681 },
682};
683
684int dss_init_platform_driver(void)
685{
686 return platform_driver_register(&omap_dsshw_driver);
687}
688
689void dss_uninit_platform_driver(void)
690{
691 return platform_driver_unregister(&omap_dsshw_driver);
692}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index b394951120ac..37c4544e8907 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -214,8 +214,8 @@ void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr);
214void dss_recheck_connections(struct omap_dss_device *dssdev, bool force); 214void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
215 215
216/* DSS */ 216/* DSS */
217int dss_init(bool skip_init); 217int dss_init_platform_driver(void);
218void dss_exit(void); 218void dss_uninit_platform_driver(void);
219 219
220void dss_save_context(void); 220void dss_save_context(void);
221void dss_restore_context(void); 221void dss_restore_context(void);