OMAPDSS: outputs: Create and register output instances
authorArchit Taneja <archit@ti.com>
Wed, 26 Sep 2012 11:00:49 +0000 (16:30 +0530)
committerArchit Taneja <archit@ti.com>
Wed, 26 Sep 2012 11:00:49 +0000 (16:30 +0530)
Add output structs to output driver's private data. Register output instances by
having an init function in the probes of the platform device drivers for
different outputs. The *_init_output for each output registers the output and
fill up the output's plaform device, type and id fields. The *_uninit_output
functions unregister the output.

In the probe of each interface driver, the output entities are initialized
before the *_probe_pdata() functions intentionally. This is done to ensure that
the output entity is prepared before the panels connected to the output are
registered. We need the output entities to be ready because OMAPDSS will try
to make connections between overlays, managers, outputs and devices during the
panel's probe.

Signed-off-by: Archit Taneja <archit@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 f6800e19bbcb4ea6d7b0b9b2d55fe331fba8d68e..ee1fa1e1a0150b410a178d0af988993e877eeb52 100644 (file)
@@ -44,6 +44,8 @@ static struct {
        struct omap_video_timings timings;
        struct dss_lcd_mgr_config mgr_config;
        int data_lines;
+
+       struct omap_dss_output output;
 } dpi;
 
 static struct platform_device *dpi_get_dsidev(enum omap_dss_clk_source clk)
@@ -436,10 +438,30 @@ static void __init dpi_probe_pdata(struct platform_device *dpidev)
        }
 }
 
+static void __init dpi_init_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &dpi.output;
+
+       out->pdev = pdev;
+       out->id = OMAP_DSS_OUTPUT_DPI;
+       out->type = OMAP_DISPLAY_TYPE_DPI;
+
+       dss_register_output(out);
+}
+
+static void __exit dpi_uninit_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &dpi.output;
+
+       dss_unregister_output(out);
+}
+
 static int __init omap_dpi_probe(struct platform_device *pdev)
 {
        mutex_init(&dpi.lock);
 
+       dpi_init_output(pdev);
+
        dpi_probe_pdata(pdev);
 
        return 0;
@@ -449,6 +471,8 @@ static int __exit omap_dpi_remove(struct platform_device *pdev)
 {
        dss_unregister_child_devices(&pdev->dev);
 
+       dpi_uninit_output(pdev);
+
        return 0;
 }
 
index 5c82c918d2e3689223b019e12427b15bffac6241..55748bc081e8e66e202f242419bcad1d55a55a69 100644 (file)
@@ -336,6 +336,8 @@ struct dsi_data {
        enum omap_dss_dsi_pixel_format pix_fmt;
        enum omap_dss_dsi_mode mode;
        struct omap_dss_dsi_videomode_timings vm_timings;
+
+       struct omap_dss_output output;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -5156,6 +5158,28 @@ static void __init dsi_probe_pdata(struct platform_device *dsidev)
        }
 }
 
+static void __init dsi_init_output(struct platform_device *dsidev)
+{
+       struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+       struct omap_dss_output *out = &dsi->output;
+
+       out->pdev = dsidev;
+       out->id = dsi->module_id == 0 ?
+                       OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
+
+       out->type = OMAP_DISPLAY_TYPE_DSI;
+
+       dss_register_output(out);
+}
+
+static void __exit dsi_uninit_output(struct platform_device *dsidev)
+{
+       struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+       struct omap_dss_output *out = &dsi->output;
+
+       dss_unregister_output(out);
+}
+
 /* DSI1 HW IP initialisation */
 static int __init omap_dsihw_probe(struct platform_device *dsidev)
 {
@@ -5250,6 +5274,8 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev)
        else
                dsi->num_lanes_supported = 3;
 
+       dsi_init_output(dsidev);
+
        dsi_probe_pdata(dsidev);
 
        dsi_runtime_put(dsidev);
@@ -5281,6 +5307,8 @@ static int __exit omap_dsihw_remove(struct platform_device *dsidev)
 
        dss_unregister_child_devices(&dsidev->dev);
 
+       dsi_uninit_output(dsidev);
+
        pm_runtime_disable(&dsidev->dev);
 
        dsi_put_clocks(dsidev);
index 23daf7dcf54a1646b3419d71feb54686b88d2d58..294bf9879434fd9513e75d17249cd3da634b6d55 100644 (file)
@@ -68,6 +68,8 @@ static struct {
        int ct_cp_hpd_gpio;
        int ls_oe_gpio;
        int hpd_gpio;
+
+       struct omap_dss_output output;
 } hdmi;
 
 /*
@@ -970,6 +972,24 @@ static void __init hdmi_probe_pdata(struct platform_device *pdev)
        }
 }
 
+static void __init hdmi_init_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &hdmi.output;
+
+       out->pdev = pdev;
+       out->id = OMAP_DSS_OUTPUT_HDMI;
+       out->type = OMAP_DISPLAY_TYPE_HDMI;
+
+       dss_register_output(out);
+}
+
+static void __exit hdmi_uninit_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &hdmi.output;
+
+       dss_unregister_output(out);
+}
+
 /* HDMI HW IP initialisation */
 static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -1013,6 +1033,8 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 
        dss_debugfs_create_file("hdmi", hdmi_dump_regs);
 
+       hdmi_init_output(pdev);
+
        hdmi_probe_pdata(pdev);
 
        return 0;
@@ -1033,6 +1055,8 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
 
        hdmi_panel_exit();
 
+       hdmi_uninit_output(pdev);
+
        pm_runtime_disable(&pdev->dev);
 
        hdmi_put_clocks();
index 38d9b8ecbe3c4663a2a08530fab26f5e7ccb182d..58e51722fccf291059be48e8ff3d9516ff0b5c36 100644 (file)
@@ -116,6 +116,8 @@ static struct {
        int pixel_size;
        int data_lines;
        struct rfbi_timings intf_timings;
+
+       struct omap_dss_output output;
 } rfbi;
 
 static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val)
@@ -1002,6 +1004,24 @@ static void __init rfbi_probe_pdata(struct platform_device *rfbidev)
        }
 }
 
+static void __init rfbi_init_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &rfbi.output;
+
+       out->pdev = pdev;
+       out->id = OMAP_DSS_OUTPUT_DBI;
+       out->type = OMAP_DISPLAY_TYPE_DBI;
+
+       dss_register_output(out);
+}
+
+static void __exit rfbi_uninit_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &rfbi.output;
+
+       dss_unregister_output(out);
+}
+
 /* RFBI HW IP initialisation */
 static int __init omap_rfbihw_probe(struct platform_device *pdev)
 {
@@ -1053,6 +1073,8 @@ static int __init omap_rfbihw_probe(struct platform_device *pdev)
 
        dss_debugfs_create_file("rfbi", rfbi_dump_regs);
 
+       rfbi_init_output(pdev);
+
        rfbi_probe_pdata(pdev);
 
        return 0;
@@ -1065,7 +1087,11 @@ err_runtime_get:
 static int __exit omap_rfbihw_remove(struct platform_device *pdev)
 {
        dss_unregister_child_devices(&pdev->dev);
+
+       rfbi_uninit_output(pdev);
+
        pm_runtime_disable(&pdev->dev);
+
        return 0;
 }
 
index 919ff728c502c37f7431072b44fff9f61522fae6..47f9fe4e1741127039aed3611c52b5b766efbc65 100644 (file)
@@ -36,6 +36,8 @@ static struct {
        struct dss_lcd_mgr_config mgr_config;
        struct omap_video_timings timings;
        int datapairs;
+
+       struct omap_dss_output output;
 } sdi;
 
 static void sdi_config_lcd_manager(struct omap_dss_device *dssdev)
@@ -255,8 +257,28 @@ static void __init sdi_probe_pdata(struct platform_device *sdidev)
        }
 }
 
+static void __init sdi_init_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &sdi.output;
+
+       out->pdev = pdev;
+       out->id = OMAP_DSS_OUTPUT_SDI;
+       out->type = OMAP_DISPLAY_TYPE_SDI;
+
+       dss_register_output(out);
+}
+
+static void __exit sdi_uninit_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &sdi.output;
+
+       dss_unregister_output(out);
+}
+
 static int __init omap_sdi_probe(struct platform_device *pdev)
 {
+       sdi_init_output(pdev);
+
        sdi_probe_pdata(pdev);
 
        return 0;
@@ -266,6 +288,8 @@ static int __exit omap_sdi_remove(struct platform_device *pdev)
 {
        dss_unregister_child_devices(&pdev->dev);
 
+       sdi_uninit_output(pdev);
+
        return 0;
 }
 
index 996779c0204c475bd5267a804c712218155ed273..24d278b3e7fd3d28c6ae9d3d8b7697215b54742c 100644 (file)
@@ -303,6 +303,8 @@ static struct {
        struct omap_video_timings timings;
        enum omap_dss_venc_type type;
        bool invert_polarity;
+
+       struct omap_dss_output output;
 } venc;
 
 static inline void venc_write_reg(int idx, u32 val)
@@ -797,6 +799,24 @@ static void __init venc_probe_pdata(struct platform_device *vencdev)
        }
 }
 
+static void __init venc_init_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &venc.output;
+
+       out->pdev = pdev;
+       out->id = OMAP_DSS_OUTPUT_VENC;
+       out->type = OMAP_DISPLAY_TYPE_VENC;
+
+       dss_register_output(out);
+}
+
+static void __exit venc_uninit_output(struct platform_device *pdev)
+{
+       struct omap_dss_output *out = &venc.output;
+
+       dss_unregister_output(out);
+}
+
 /* VENC HW IP initialisation */
 static int __init omap_venchw_probe(struct platform_device *pdev)
 {
@@ -844,6 +864,8 @@ static int __init omap_venchw_probe(struct platform_device *pdev)
 
        dss_debugfs_create_file("venc", venc_dump_regs);
 
+       venc_init_output(pdev);
+
        venc_probe_pdata(pdev);
 
        return 0;
@@ -866,6 +888,8 @@ static int __exit omap_venchw_remove(struct platform_device *pdev)
 
        venc_panel_exit();
 
+       venc_uninit_output(pdev);
+
        pm_runtime_disable(&pdev->dev);
        venc_put_clocks();