OMAP2, 3: DSS2: VENC: create platform_driver, move init, exit to driver
authorSenthilvadivu Guruswamy <svadivu@ti.com>
Mon, 24 Jan 2011 06:22:01 +0000 (06:22 +0000)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 Mar 2011 13:46:20 +0000 (15:46 +0200)
Hwmod adaptation design requires each of the DSS HW IP to be a platform driver.
So a platform_driver for VENC 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, venc_vdda_dac reading is moved to venc.c.

VENC 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>
12 files changed:
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-cm-t35.c
arch/arm/mach-omap2/board-devkit8000.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-rx51-peripherals.c
arch/arm/mach-omap2/board-zoom-peripherals.c
drivers/video/omap2/dss/core.c
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/venc.c

index e018472861e6669cdcbff67c8373a5d3686693a0..652e7c38c62ec4cb8627c15b6cb0cfb8c86abd26 100644 (file)
@@ -395,7 +395,7 @@ static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
 };
 
 static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
-       REGULATOR_SUPPLY("vdda_dac", "omapdss"),
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
 };
 
 /* VPLL2 for digital video outputs */
index 27bea540ccbb9a679bd6b079dcb88adb2c6fb54f..e55fde0a720dcb0b3d7a526c4beea13e36345620 100644 (file)
@@ -488,7 +488,7 @@ static struct regulator_consumer_supply cm_t35_vsim_supply = {
 };
 
 static struct regulator_consumer_supply cm_t35_vdac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 static struct regulator_consumer_supply cm_t35_vdvi_supply =
        REGULATOR_SUPPLY("vdvi", "omapdss");
index 728f27c5bcb1e598967cd79a510e9e0b537d0637..b64774b3d82c751baba7786161da45cf356718b8 100644 (file)
@@ -196,7 +196,7 @@ static struct omap_dss_board_info devkit8000_dss_data = {
 };
 
 static struct regulator_consumer_supply devkit8000_vdda_dac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 static uint32_t board_keymap[] = {
        KEY(0, 0, KEY_1),
index 20c5dbea895387aa72ed8eee8d4d52dc1ee88240..2fad38f9e68389c34138fa73a05c4e8bf1a3d333 100644 (file)
@@ -232,7 +232,7 @@ static struct omap_dss_board_info beagle_dss_data = {
 };
 
 static struct regulator_consumer_supply beagle_vdac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 static struct regulator_consumer_supply beagle_vdvi_supply =
        REGULATOR_SUPPLY("vdds_dsi", "omapdss");
index b65848c59e1d3ab2340d985bcd2aa0ea338d6119..a6564b41b97af86f2cd793530bc0666c263492ec 100644 (file)
@@ -542,7 +542,7 @@ static struct twl4030_codec_data omap3evm_codec_data = {
 };
 
 static struct regulator_consumer_supply omap3_evm_vdda_dac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 /* VDAC for DSS driving S-Video */
 static struct regulator_init_data omap3_evm_vdac = {
index 5386a8190ea134d62f6e3c7dd74974e945921c7f..37de418edd2a39ec741443aca25a35f43e2c7d2a 100644 (file)
@@ -342,7 +342,7 @@ static struct regulator_consumer_supply pandora_vmmc3_supply =
        REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2");
 
 static struct regulator_consumer_supply pandora_vdda_dac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 static struct regulator_consumer_supply pandora_vdds_supplies[] = {
        REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
index 15ede8b49815049e9ce20ef0083382853e4a85e8..bd0eed8580783dd6d53dcc41fd6f3407c1576651 100644 (file)
@@ -439,7 +439,7 @@ static struct twl4030_codec_data omap3stalker_codec_data = {
 };
 
 static struct regulator_consumer_supply omap3_stalker_vdda_dac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 /* VDAC for DSS driving S-Video */
 static struct regulator_init_data omap3_stalker_vdac = {
index 5f1900c532ec3af00a039f34255a0bb1ca17bddb..bbcb6775a6a3006486b5d64890aca629e66e3ab3 100644 (file)
@@ -372,7 +372,7 @@ static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
 };
 
 static struct regulator_consumer_supply rx51_vdac_supply[] = {
-       REGULATOR_SUPPLY("vdda_dac", "omapdss"),
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
 };
 
 static struct regulator_init_data rx51_vaux1 = {
index 448ab60195d5cac1d33de96a4661668fed2e9fa2..405400c4762b5d1634c443c92725bfa765a9577a 100644 (file)
@@ -230,7 +230,7 @@ static struct regulator_consumer_supply zoom_vpll2_supply =
        REGULATOR_SUPPLY("vdds_dsi", "omapdss");
 
 static struct regulator_consumer_supply zoom_vdda_dac_supply =
-       REGULATOR_SUPPLY("vdda_dac", "omapdss");
+       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
 
 static struct regulator_init_data zoom_vpll2 = {
        .constraints = {
index 8b7eab83e41245c4c3ce541d5a6f90b2a5469e8e..57c6303cb1cda529f126a8e070c9d0d96c3e22dd 100644 (file)
@@ -43,7 +43,6 @@ static struct {
 
        struct regulator *vdds_dsi_reg;
        struct regulator *vdds_sdi_reg;
-       struct regulator *vdda_dac_reg;
 } core;
 
 static char *def_disp_name;
@@ -85,20 +84,6 @@ struct regulator *dss_get_vdds_sdi(void)
        return reg;
 }
 
-struct regulator *dss_get_vdda_dac(void)
-{
-       struct regulator *reg;
-
-       if (core.vdda_dac_reg != NULL)
-               return core.vdda_dac_reg;
-
-       reg = regulator_get(&core.pdev->dev, "vdda_dac");
-       if (!IS_ERR(reg))
-               core.vdda_dac_reg = reg;
-
-       return reg;
-}
-
 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 static int dss_debug_show(struct seq_file *s, void *unused)
 {
@@ -219,9 +204,9 @@ static int omap_dss_probe(struct platform_device *pdev)
                goto err_dispc;
        }
 
-       r = venc_init(pdev);
+       r = venc_init_platform_driver();
        if (r) {
-               DSSERR("Failed to initialize venc\n");
+               DSSERR("Failed to initialize venc platform driver\n");
                goto err_venc;
        }
 
@@ -279,7 +264,7 @@ err_dsi:
        if (cpu_is_omap34xx())
                sdi_exit();
 err_sdi:
-       venc_exit();
+       venc_uninit_platform_driver();
 err_venc:
        dispc_uninit_platform_driver();
 err_dispc:
@@ -300,7 +285,7 @@ static int omap_dss_remove(struct platform_device *pdev)
 
        dss_uninitialize_debugfs();
 
-       venc_exit();
+       venc_uninit_platform_driver();
        dispc_uninit_platform_driver();
        dpi_exit();
        rfbi_uninit_platform_driver();
@@ -597,11 +582,6 @@ static void __exit omap_dss_exit(void)
                core.vdds_sdi_reg = NULL;
        }
 
-       if (core.vdda_dac_reg != NULL) {
-               regulator_put(core.vdda_dac_reg);
-               core.vdda_dac_reg = NULL;
-       }
-
        platform_driver_unregister(&omap_dss_driver);
 
        omap_dss_bus_unregister();
index f4835c85db90e077cda59085689d3c3d121451e5..931385185dc61ae2e7af27260017ac9d55bd193b 100644 (file)
@@ -172,7 +172,6 @@ struct platform_device;
 struct bus_type *dss_get_bus(void);
 struct regulator *dss_get_vdds_dsi(void);
 struct regulator *dss_get_vdds_sdi(void);
-struct regulator *dss_get_vdda_dac(void);
 
 /* display */
 int dss_suspend_all_devices(void);
@@ -412,16 +411,16 @@ int dispc_get_clock_div(enum omap_channel channel,
 
 /* VENC */
 #ifdef CONFIG_OMAP2_DSS_VENC
-int venc_init(struct platform_device *pdev);
-void venc_exit(void);
+int venc_init_platform_driver(void);
+void venc_uninit_platform_driver(void);
 void venc_dump_regs(struct seq_file *s);
 int venc_init_display(struct omap_dss_device *display);
 #else
-static inline int venc_init(struct platform_device *pdev)
+static inline int venc_init_platform_driver(void)
 {
        return 0;
 }
-static inline void venc_exit(void)
+static inline void venc_uninit_platform_driver(void)
 {
 }
 #endif
index eff35050e28a6149f188ee3ef87f1ace6e704774..765a4ac44ecdc4837b8191bde8fef71a6e704a51 100644 (file)
@@ -289,6 +289,7 @@ const struct omap_video_timings omap_dss_ntsc_timings = {
 EXPORT_SYMBOL(omap_dss_ntsc_timings);
 
 static struct {
+       struct platform_device *pdev;
        void __iomem *base;
        struct mutex venc_lock;
        u32 wss_data;
@@ -306,6 +307,17 @@ static inline u32 venc_read_reg(int idx)
        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");
@@ -641,46 +653,6 @@ static struct omap_dss_driver venc_driver = {
 };
 /* driver end */
 
-
-
-int venc_init(struct platform_device *pdev)
-{
-       u8 rev_id;
-
-       mutex_init(&venc.venc_lock);
-
-       venc.wss_data = 0;
-
-       venc.base = ioremap(VENC_BASE, SZ_1K);
-       if (!venc.base) {
-               DSSERR("can't ioremap VENC\n");
-               return -ENOMEM;
-       }
-
-       venc.vdda_dac_reg = dss_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);
-       printk(KERN_INFO "OMAP VENC rev %d\n", rev_id);
-
-       venc_enable_clocks(0);
-
-       return omap_dss_register_driver(&venc_driver);
-}
-
-void venc_exit(void)
-{
-       omap_dss_unregister_driver(&venc_driver);
-
-       iounmap(venc.base);
-}
-
 int venc_init_display(struct omap_dss_device *dssdev)
 {
        DSSDBG("init_display\n");
@@ -740,3 +712,67 @@ void venc_dump_regs(struct seq_file *s)
 
 #undef DUMPREG
 }
+
+/* VENC HW IP initialisation */
+static int omap_venchw_probe(struct platform_device *pdev)
+{
+       u8 rev_id;
+       venc.pdev = pdev;
+
+       mutex_init(&venc.venc_lock);
+
+       venc.wss_data = 0;
+
+       venc.base = ioremap(VENC_BASE, SZ_1K);
+       if (!venc.base) {
+               DSSERR("can't ioremap VENC\n");
+               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);
+       printk(KERN_INFO "OMAP VENC rev %d\n", rev_id);
+
+       venc_enable_clocks(0);
+
+       return omap_dss_register_driver(&venc_driver);
+}
+
+static int omap_venchw_remove(struct platform_device *pdev)
+{
+       if (venc.vdda_dac_reg != NULL) {
+               regulator_put(venc.vdda_dac_reg);
+               venc.vdda_dac_reg = NULL;
+       }
+       omap_dss_unregister_driver(&venc_driver);
+
+       iounmap(venc.base);
+       return 0;
+}
+
+static struct platform_driver omap_venchw_driver = {
+       .probe          = omap_venchw_probe,
+       .remove         = omap_venchw_remove,
+       .driver         = {
+               .name   = "omapdss_venc",
+               .owner  = THIS_MODULE,
+       },
+};
+
+int venc_init_platform_driver(void)
+{
+       return platform_driver_register(&omap_venchw_driver);
+}
+
+void venc_uninit_platform_driver(void)
+{
+       return platform_driver_unregister(&omap_venchw_driver);
+}