From: Archit Taneja Date: Wed, 26 Sep 2012 11:00:49 +0000 (+0530) Subject: OMAPDSS: outputs: Create and register output instances X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=81b87f515f6abbbe4eef42835065db9d0831ef35;p=openwrt%2Fstaging%2Fblogic.git OMAPDSS: outputs: Create and register output instances 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 --- diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index f6800e19bbcb..ee1fa1e1a015 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -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; } diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 5c82c918d2e3..55748bc081e8 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -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); diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 23daf7dcf54a..294bf9879434 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -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(); diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 38d9b8ecbe3c..58e51722fccf 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -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; } diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 919ff728c502..47f9fe4e1741 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -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; } diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 996779c0204c..24d278b3e7fd 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -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();