OMAP2, 3: DSS2: DSI: create platform_driver, move init, exit to driver
authorSenthilvadivu Guruswamy <svadivu@ti.com>
Mon, 24 Jan 2011 06:22:02 +0000 (06:22 +0000)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 Mar 2011 13:46:21 +0000 (15:46 +0200)
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>
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-devkit8000.c
arch/arm/mach-omap2/board-igep0020.c
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-omap3pandora.c
arch/arm/mach-omap2/board-omap3stalker.c
arch/arm/mach-omap2/board-zoom-peripherals.c
drivers/video/omap2/dss/core.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/dss.h

index 652e7c3..75814ae 100644 (file)
@@ -401,6 +401,7 @@ static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
 /* VPLL2 for digital video outputs */
 static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
        REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
 };
 
 static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
index b64774b..e102e14 100644 (file)
@@ -277,8 +277,10 @@ static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
        .setup          = devkit8000_twl_gpio_setup,
 };
 
-static struct regulator_consumer_supply devkit8000_vpll1_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
 static struct regulator_init_data devkit8000_vmmc1 = {
@@ -319,8 +321,8 @@ static struct regulator_init_data devkit8000_vpll1 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &devkit8000_vpll1_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(devkit8000_vpll1_supplies),
+       .consumer_supplies      = devkit8000_vpll1_supplies,
 };
 
 /* VAUX4 for ads7846 and nubs */
index c4b3c1c..12b3e41 100644 (file)
@@ -485,8 +485,10 @@ static struct omap_dss_board_info igep2_dss_data = {
        .default_device = &igep2_dvi_device,
 };
 
-static struct regulator_consumer_supply igep2_vpll2_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply igep2_vpll2_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 static struct regulator_init_data igep2_vpll2 = {
        .constraints = {
@@ -499,8 +501,8 @@ static struct regulator_init_data igep2_vpll2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &igep2_vpll2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(igep2_vpll2_supplies),
+       .consumer_supplies      = igep2_vpll2_supplies,
 };
 
 static void __init igep2_display_init(void)
index 2fad38f..e663c43 100644 (file)
@@ -234,8 +234,10 @@ static struct omap_dss_board_info beagle_dss_data = {
 static struct regulator_consumer_supply beagle_vdac_supply =
        REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
-static struct regulator_consumer_supply beagle_vdvi_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply beagle_vdvi_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 static void __init beagle_display_init(void)
 {
@@ -422,8 +424,8 @@ static struct regulator_init_data beagle_vpll2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &beagle_vdvi_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(beagle_vdvi_supplies),
+       .consumer_supplies      = beagle_vdvi_supplies,
 };
 
 static struct twl4030_usb_data beagle_usb_data = {
index a6564b4..5800db3 100644 (file)
@@ -560,8 +560,10 @@ static struct regulator_init_data omap3_evm_vdac = {
 };
 
 /* VPLL2 for digital video outputs */
-static struct regulator_consumer_supply omap3_evm_vpll2_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply omap3_evm_vpll2_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 static struct regulator_init_data omap3_evm_vpll2 = {
        .constraints = {
@@ -573,8 +575,8 @@ static struct regulator_init_data omap3_evm_vpll2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &omap3_evm_vpll2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(omap3_evm_vpll2_supplies),
+       .consumer_supplies      = omap3_evm_vpll2_supplies,
 };
 
 /* ads7846 on SPI */
index 37de418..131a58d 100644 (file)
@@ -347,6 +347,7 @@ static struct regulator_consumer_supply pandora_vdda_dac_supply =
 static struct regulator_consumer_supply pandora_vdds_supplies[] = {
        REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
        REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
 };
 
 static struct regulator_consumer_supply pandora_vcc_lcd_supply =
index bd0eed8..d1163a8 100644 (file)
@@ -457,8 +457,10 @@ static struct regulator_init_data omap3_stalker_vdac = {
 };
 
 /* VPLL2 for digital video outputs */
-static struct regulator_consumer_supply omap3_stalker_vpll2_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply omap3_stalker_vpll2_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 static struct regulator_init_data omap3_stalker_vpll2 = {
        .constraints            = {
@@ -471,8 +473,8 @@ static struct regulator_init_data omap3_stalker_vpll2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &omap3_stalker_vpll2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(omap3_stalker_vpll2_supplies),
+       .consumer_supplies      = omap3_stalker_vpll2_supplies,
 };
 
 static struct twl4030_platform_data omap3stalker_twldata = {
index 405400c..8dee754 100644 (file)
@@ -226,8 +226,10 @@ static struct omap2_hsmmc_info mmc[] = {
        {}      /* Terminator */
 };
 
-static struct regulator_consumer_supply zoom_vpll2_supply =
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+static struct regulator_consumer_supply zoom_vpll2_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
 
 static struct regulator_consumer_supply zoom_vdda_dac_supply =
        REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
@@ -241,8 +243,8 @@ static struct regulator_init_data zoom_vpll2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies          = 1,
-       .consumer_supplies              = &zoom_vpll2_supply,
+       .num_consumer_supplies          = ARRAY_SIZE(zoom_vpll2_supplies),
+       .consumer_supplies              = zoom_vpll2_supplies,
 };
 
 static struct regulator_init_data zoom_vdac = {
index 57c6303..3f7a5fc 100644 (file)
@@ -222,9 +222,9 @@ static int omap_dss_probe(struct platform_device *pdev)
                        goto err_sdi;
                }
 
-               r = dsi_init(pdev);
+               r = dsi_init_platform_driver();
                if (r) {
-                       DSSERR("Failed to initialize DSI\n");
+                       DSSERR("Failed to initialize DSI platform driver\n");
                        goto err_dsi;
                }
        }
@@ -259,7 +259,7 @@ err_register:
        dss_uninitialize_debugfs();
 err_debugfs:
        if (cpu_is_omap34xx())
-               dsi_exit();
+               dsi_uninit_platform_driver();
 err_dsi:
        if (cpu_is_omap34xx())
                sdi_exit();
@@ -290,7 +290,7 @@ static int omap_dss_remove(struct platform_device *pdev)
        dpi_exit();
        rfbi_uninit_platform_driver();
        if (cpu_is_omap34xx()) {
-               dsi_exit();
+               dsi_uninit_platform_driver();
                sdi_exit();
        }
 
index ddf3a05..fa85f1a 100644 (file)
@@ -222,6 +222,7 @@ struct dsi_irq_stats {
 
 static struct
 {
+       struct platform_device *pdev;
        void __iomem    *base;
 
        struct dsi_clock_info current_cinfo;
@@ -292,6 +293,20 @@ static inline u32 dsi_read_reg(const struct dsi_reg idx)
        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)
 {
@@ -3238,7 +3253,7 @@ void dsi_wait_dsi2_pll_active(void)
                DSSERR("DSI2 PLL clock not active\n");
 }
 
-int dsi_init(struct platform_device *pdev)
+static int dsi_init(struct platform_device *pdev)
 {
        u32 rev;
        int r;
@@ -3275,7 +3290,7 @@ int dsi_init(struct platform_device *pdev)
                goto err1;
        }
 
-       dsi.vdds_dsi_reg = dss_get_vdds_dsi();
+       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);
@@ -3298,8 +3313,13 @@ err1:
        return r;
 }
 
-void dsi_exit(void)
+static void dsi_exit(void)
 {
+       if (dsi.vdds_dsi_reg != NULL) {
+               regulator_put(dsi.vdds_dsi_reg);
+               dsi.vdds_dsi_reg = NULL;
+       }
+
        iounmap(dsi.base);
 
        destroy_workqueue(dsi.workqueue);
@@ -3307,3 +3327,41 @@ void dsi_exit(void)
        DSSDBG("omap_dsi_exit\n");
 }
 
+/* DSI1 HW IP initialisation */
+static int omap_dsi1hw_probe(struct platform_device *pdev)
+{
+       int r;
+       dsi.pdev = pdev;
+       r = dsi_init(pdev);
+       if (r) {
+               DSSERR("Failed to initialize DSI\n");
+               goto err_dsi;
+       }
+err_dsi:
+       return r;
+}
+
+static int omap_dsi1hw_remove(struct platform_device *pdev)
+{
+       dsi_exit();
+       return 0;
+}
+
+static struct platform_driver omap_dsi1hw_driver = {
+       .probe          = omap_dsi1hw_probe,
+       .remove         = omap_dsi1hw_remove,
+       .driver         = {
+               .name   = "omapdss_dsi1",
+               .owner  = THIS_MODULE,
+       },
+};
+
+int dsi_init_platform_driver(void)
+{
+       return platform_driver_register(&omap_dsi1hw_driver);
+}
+
+void dsi_uninit_platform_driver(void)
+{
+       return platform_driver_unregister(&omap_dsi1hw_driver);
+}
index 9313851..981d247 100644 (file)
@@ -261,8 +261,8 @@ static inline void sdi_exit(void)
 
 /* DSI */
 #ifdef CONFIG_OMAP2_DSS_DSI
-int dsi_init(struct platform_device *pdev);
-void dsi_exit(void);
+int dsi_init_platform_driver(void);
+void dsi_uninit_platform_driver(void);
 
 void dsi_dump_clocks(struct seq_file *s);
 void dsi_dump_irqs(struct seq_file *s);
@@ -287,11 +287,11 @@ void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
 void dsi_wait_dsi1_pll_active(void);
 void dsi_wait_dsi2_pll_active(void);
 #else
-static inline int dsi_init(struct platform_device *pdev)
+static inline int dsi_init_platform_driver(void)
 {
        return 0;
 }
-static inline void dsi_exit(void)
+static inline void dsi_uninit_platform_driver(void)
 {
 }
 static inline void dsi_wait_dsi1_pll_active(void)