OMAPDSS: separate pdata based initialization
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 2 May 2012 11:55:12 +0000 (14:55 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 May 2012 12:09:24 +0000 (15:09 +0300)
Move the platform-data based display device initialization into a
separate function, so that we may later add of-based initialization.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/dpi.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/hdmi.c
drivers/video/omap2/dss/rfbi.c
drivers/video/omap2/dss/sdi.c
drivers/video/omap2/dss/venc.c

index de3454b91497d8c5b956e1f3ff6791a339f216d2..8c2056c9537bd1162d08dd0c6d63a2437b926c45 100644 (file)
@@ -365,7 +365,7 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev)
        return 0;
 }
 
-static int __init omap_dpi_probe(struct platform_device *pdev)
+static void __init dpi_probe_pdata(struct platform_device *pdev)
 {
        struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        int i, r;
@@ -387,6 +387,11 @@ static int __init omap_dpi_probe(struct platform_device *pdev)
                        DSSERR("device %s register failed: %d\n",
                                        dssdev->name, r);
        }
+}
+
+static int __init omap_dpi_probe(struct platform_device *pdev)
+{
+       dpi_probe_pdata(pdev);
 
        return 0;
 }
index b882a77911e6aca53b5f4b3d598232f1499297be..e2aaf5a167fae22736e98d88d5d6036734c6cdac 100644 (file)
@@ -4602,6 +4602,34 @@ static void dsi_put_clocks(struct platform_device *dsidev)
                clk_put(dsi->sys_clk);
 }
 
+static void __init dsi_probe_pdata(struct platform_device *dsidev)
+{
+       struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+       struct omap_dss_board_info *pdata = dsidev->dev.platform_data;
+       int i, r;
+
+       for (i = 0; i < pdata->num_devices; ++i) {
+               struct omap_dss_device *dssdev = pdata->devices[i];
+
+               if (dssdev->type != OMAP_DISPLAY_TYPE_DSI)
+                       continue;
+
+               if (dssdev->phy.dsi.module != dsi->module_id)
+                       continue;
+
+               r = dsi_init_display(dssdev);
+               if (r) {
+                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
+                       continue;
+               }
+
+               r = omap_dss_register_device(dssdev, &dsidev->dev, i);
+               if (r)
+                       DSSERR("device %s register failed: %d\n",
+                                       dssdev->name, r);
+       }
+}
+
 /* DSI1 HW IP initialisation */
 static int __init omap_dsihw_probe(struct platform_device *dsidev)
 {
@@ -4609,7 +4637,6 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev)
        int r, i;
        struct resource *dsi_mem;
        struct dsi_data *dsi;
-       struct omap_dss_board_info *pdata = dsidev->dev.platform_data;
 
        dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL);
        if (!dsi)
@@ -4697,26 +4724,7 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev)
        else
                dsi->num_lanes_supported = 3;
 
-       for (i = 0; i < pdata->num_devices; ++i) {
-               struct omap_dss_device *dssdev = pdata->devices[i];
-
-               if (dssdev->type != OMAP_DISPLAY_TYPE_DSI)
-                       continue;
-
-               if (dssdev->phy.dsi.module != dsi->module_id)
-                       continue;
-
-               r = dsi_init_display(dssdev);
-               if (r) {
-                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
-                       continue;
-               }
-
-               r = omap_dss_register_device(dssdev, &dsidev->dev, i);
-               if (r)
-                       DSSERR("device %s register failed: %d\n",
-                               dssdev->name, r);
-       }
+       dsi_probe_pdata(dsidev);
 
        dsi_runtime_put(dsidev);
 
index fa1a054bb03bcac6a10120d445096f1c03ebe791..5f2e2f677befaef397d8cba343f8b55f81735118 100644 (file)
@@ -771,12 +771,35 @@ static void hdmi_put_clocks(void)
                clk_put(hdmi.sys_clk);
 }
 
+static void __init hdmi_probe_pdata(struct platform_device *pdev)
+{
+       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
+       int r, i;
+
+       for (i = 0; i < pdata->num_devices; ++i) {
+               struct omap_dss_device *dssdev = pdata->devices[i];
+
+               if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI)
+                       continue;
+
+               r = hdmi_init_display(dssdev);
+               if (r) {
+                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
+                       continue;
+               }
+
+               r = omap_dss_register_device(dssdev, &pdev->dev, i);
+               if (r)
+                       DSSERR("device %s register failed: %d\n",
+                                       dssdev->name, r);
+       }
+}
+
 /* HDMI HW IP initialisation */
 static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 {
-       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        struct resource *hdmi_mem;
-       int r, i;
+       int r;
 
        hdmi.pdev = pdev;
 
@@ -813,23 +836,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 
        dss_debugfs_create_file("hdmi", hdmi_dump_regs);
 
-       for (i = 0; i < pdata->num_devices; ++i) {
-               struct omap_dss_device *dssdev = pdata->devices[i];
-
-               if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI)
-                       continue;
-
-               r = hdmi_init_display(dssdev);
-               if (r) {
-                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
-                       continue;
-               }
-
-               r = omap_dss_register_device(dssdev, &pdev->dev, i);
-               if (r)
-                       DSSERR("device %s register failed: %d\n",
-                                       dssdev->name, r);
-       }
+       hdmi_probe_pdata(pdev);
 
 #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
        defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
index f081f01b0b7dc5093b18d6dd762c9ec3a944302f..3d8c206e90e5d93631a0dc493f9ab180fbfa181e 100644 (file)
@@ -927,14 +927,37 @@ static int __init rfbi_init_display(struct omap_dss_device *dssdev)
        return 0;
 }
 
+static void __init rfbi_probe_pdata(struct platform_device *pdev)
+{
+       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
+       int i, r;
+
+       for (i = 0; i < pdata->num_devices; ++i) {
+               struct omap_dss_device *dssdev = pdata->devices[i];
+
+               if (dssdev->type != OMAP_DISPLAY_TYPE_DBI)
+                       continue;
+
+               r = rfbi_init_display(dssdev);
+               if (r) {
+                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
+                       continue;
+               }
+
+               r = omap_dss_register_device(dssdev, &pdev->dev, i);
+               if (r)
+                       DSSERR("device %s register failed: %d\n",
+                               dssdev->name, r);
+       }
+}
+
 /* RFBI HW IP initialisation */
 static int __init omap_rfbihw_probe(struct platform_device *pdev)
 {
-       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        u32 rev;
        struct resource *rfbi_mem;
        struct clk *clk;
-       int r, i;
+       int r;
 
        rfbi.pdev = pdev;
 
@@ -979,23 +1002,7 @@ static int __init omap_rfbihw_probe(struct platform_device *pdev)
 
        dss_debugfs_create_file("rfbi", rfbi_dump_regs);
 
-       for (i = 0; i < pdata->num_devices; ++i) {
-               struct omap_dss_device *dssdev = pdata->devices[i];
-
-               if (dssdev->type != OMAP_DISPLAY_TYPE_DBI)
-                       continue;
-
-               r = rfbi_init_display(dssdev);
-               if (r) {
-                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
-                       continue;
-               }
-
-               r = omap_dss_register_device(dssdev, &pdev->dev, i);
-               if (r)
-                       DSSERR("device %s register failed: %d\n",
-                               dssdev->name, r);
-       }
+       rfbi_probe_pdata(pdev);
 
        return 0;
 
index 2641a768f316b933193a9887c6ec2279b9e7f9a0..3a43dc2a9b46c992b22770b163a5e47611b7bb9e 100644 (file)
@@ -176,7 +176,7 @@ static int __init sdi_init_display(struct omap_dss_device *dssdev)
        return 0;
 }
 
-static int __init omap_sdi_probe(struct platform_device *pdev)
+static void __init sdi_probe_pdata(struct platform_device *pdev)
 {
        struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        int i, r;
@@ -198,6 +198,11 @@ static int __init omap_sdi_probe(struct platform_device *pdev)
                        DSSERR("device %s register failed: %d\n",
                                        dssdev->name, r);
        }
+}
+
+static int __init omap_sdi_probe(struct platform_device *pdev)
+{
+       sdi_probe_pdata(pdev);
 
        return 0;
 }
index 005fdaa2cf7db5c2400d12921654b08a7ec0e702..178c40d3312ea8e57a7df71cffcfa369297a554d 100644 (file)
@@ -829,13 +829,36 @@ static void venc_put_clocks(void)
                clk_put(venc.tv_dac_clk);
 }
 
+static void __init venc_probe_pdata(struct platform_device *pdev)
+{
+       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
+       int r, i;
+
+       for (i = 0; i < pdata->num_devices; ++i) {
+               struct omap_dss_device *dssdev = pdata->devices[i];
+
+               if (dssdev->type != OMAP_DISPLAY_TYPE_VENC)
+                       continue;
+
+               r = venc_init_display(dssdev);
+               if (r) {
+                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
+                       continue;
+               }
+
+               r = omap_dss_register_device(dssdev, &pdev->dev, i);
+               if (r)
+                       DSSERR("device %s register failed: %d\n",
+                                       dssdev->name, r);
+       }
+}
+
 /* VENC HW IP initialisation */
 static int __init omap_venchw_probe(struct platform_device *pdev)
 {
-       struct omap_dss_board_info *pdata = pdev->dev.platform_data;
        u8 rev_id;
        struct resource *venc_mem;
-       int r, i;
+       int r;
 
        venc.pdev = pdev;
 
@@ -877,23 +900,7 @@ static int __init omap_venchw_probe(struct platform_device *pdev)
 
        dss_debugfs_create_file("venc", venc_dump_regs);
 
-       for (i = 0; i < pdata->num_devices; ++i) {
-               struct omap_dss_device *dssdev = pdata->devices[i];
-
-               if (dssdev->type != OMAP_DISPLAY_TYPE_VENC)
-                       continue;
-
-               r = venc_init_display(dssdev);
-               if (r) {
-                       DSSERR("device %s init failed: %d\n", dssdev->name, r);
-                       continue;
-               }
-
-               r = omap_dss_register_device(dssdev, &pdev->dev, i);
-               if (r)
-                       DSSERR("device %s register failed: %d\n",
-                                       dssdev->name, r);
-       }
+       venc_probe_pdata(pdev);
 
        return 0;