From c6ca5b2201289995f70ee19c0eaf4b5f2ae09923 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 14 Mar 2013 15:47:29 +0200 Subject: OMAPDSS: only probe pdata if there's one omapdss output drivers always read the platform data. This crashes when there's no platform data when using DT. Add a check to read the platform data only if it exists. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/venc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 74fdb3ee209..7b2e3ae18bd 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -866,16 +866,17 @@ static int omap_venchw_probe(struct platform_device *pdev) venc_init_output(pdev); - r = venc_probe_pdata(pdev); - if (r) { - venc_panel_exit(); - venc_uninit_output(pdev); - pm_runtime_disable(&pdev->dev); - return r; + if (pdev->dev.platform_data) { + r = venc_probe_pdata(pdev); + if (r) + goto err_probe; } return 0; +err_probe: + venc_panel_exit(); + venc_uninit_output(pdev); err_panel_init: err_runtime_get: pm_runtime_disable(&pdev->dev); -- cgit v1.2.3-70-g09d2 From 7e436bb2e3b14706a8bbed21d8d244a89199a907 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 17 May 2013 12:48:55 +0300 Subject: OMAPDSS: VENC: clean up regulator init Clean up the VENC driver's regulator init to remove the (unused) omap_dss_device parameter, renaming the function to a more sensible name, and making the code slightly clearer. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/venc.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 7b2e3ae18bd..a06c8600a91 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -633,23 +633,22 @@ void omapdss_venc_invert_vid_out_polarity(struct omap_dss_device *dssdev, mutex_unlock(&venc.venc_lock); } -static int venc_init_display(struct omap_dss_device *dssdev) +static int venc_init_regulator(void) { - DSSDBG("init_display\n"); + struct regulator *vdda_dac; - if (venc.vdda_dac_reg == NULL) { - struct regulator *vdda_dac; - - vdda_dac = regulator_get(&venc.pdev->dev, "vdda_dac"); + if (venc.vdda_dac_reg != NULL) + return 0; - if (IS_ERR(vdda_dac)) { - DSSERR("can't get VDDA_DAC regulator\n"); - return PTR_ERR(vdda_dac); - } + vdda_dac = devm_regulator_get(&venc.pdev->dev, "vdda_dac"); - venc.vdda_dac_reg = vdda_dac; + if (IS_ERR(vdda_dac)) { + DSSERR("can't get VDDA_DAC regulator\n"); + return PTR_ERR(vdda_dac); } + venc.vdda_dac_reg = vdda_dac; + return 0; } @@ -765,19 +764,16 @@ static int venc_probe_pdata(struct platform_device *vencdev) if (!plat_dssdev) return 0; + r = venc_init_regulator(); + if (r) + return r; + dssdev = dss_alloc_and_init_device(&vencdev->dev); if (!dssdev) return -ENOMEM; dss_copy_device_pdata(dssdev, plat_dssdev); - r = venc_init_display(dssdev); - if (r) { - DSSERR("device %s init failed: %d\n", dssdev->name, r); - dss_put_device(dssdev); - return r; - } - r = omapdss_output_set_device(&venc.output, dssdev); if (r) { DSSERR("failed to connect output to new device: %s\n", @@ -887,11 +883,6 @@ static int __exit omap_venchw_remove(struct platform_device *pdev) { dss_unregister_child_devices(&pdev->dev); - if (venc.vdda_dac_reg != NULL) { - regulator_put(venc.vdda_dac_reg); - venc.vdda_dac_reg = NULL; - } - venc_panel_exit(); venc_uninit_output(pdev); -- cgit v1.2.3-70-g09d2 From 7ae9a71e09d098deecce1140acf4f5e529211270 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 10 May 2013 15:27:07 +0300 Subject: OMAPDSS: remove dssdev uses in trivial cases In the future the "dssdev" parameter passed to output drivers will change its meaning. Instead of being a pointer to the panel device, it's a pointer to the output instance. To make the transition easier, some of the uses for this dssdev parameter can be easily removed. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/hdmi.c | 6 +++--- drivers/video/omap2/dss/rfbi.c | 8 ++++---- drivers/video/omap2/dss/sdi.c | 6 +++--- drivers/video/omap2/dss/venc.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 98341fe3205..86b495c4b90 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -560,7 +560,7 @@ static int hdmi_power_on_full(struct omap_dss_device *dssdev) { int r; struct omap_video_timings *p; - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = hdmi.output.manager; unsigned long phy; r = hdmi_power_on_core(dssdev); @@ -623,7 +623,7 @@ err_pll_enable: static void hdmi_power_off_full(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = hdmi.output.manager; dss_mgr_disable(mgr); @@ -720,7 +720,7 @@ bool omapdss_hdmi_detect(void) int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = dssdev->output; + struct omap_dss_output *out = &hdmi.output; int r = 0; DSSDBG("ENTER hdmi_display_enable\n"); diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 1ff221edc35..cfcb52f088a 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -312,7 +312,7 @@ static int rfbi_transfer_area(struct omap_dss_device *dssdev, { u32 l; int r; - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = rfbi.output.manager; u16 width = rfbi.timings.x_res; u16 height = rfbi.timings.y_res; @@ -852,7 +852,7 @@ static void rfbi_dump_regs(struct seq_file *s) static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = rfbi.output.manager; struct dss_lcd_mgr_config mgr_config; mgr_config.io_pad_mode = DSS_IO_PAD_MODE_RFBI; @@ -890,7 +890,7 @@ static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev) int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = dssdev->output; + struct omap_dss_output *out = &rfbi.output; int r; if (out == NULL || out->manager == NULL) { @@ -933,7 +933,7 @@ EXPORT_SYMBOL(omapdss_rfbi_display_enable); void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = dssdev->output; + struct omap_dss_output *out = &rfbi.output; dss_mgr_unregister_framedone_handler(out->manager, framedone_callback, NULL); diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 89e53ebe36e..ab67953f09b 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -111,7 +111,7 @@ static int sdi_calc_clock_div(unsigned long pclk, static void sdi_config_lcd_manager(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = sdi.output.manager; sdi.mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS; @@ -126,7 +126,7 @@ static void sdi_config_lcd_manager(struct omap_dss_device *dssdev) int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = dssdev->output; + struct omap_dss_output *out = &sdi.output; struct omap_video_timings *t = &sdi.timings; struct dss_clock_info dss_cinfo; struct dispc_clock_info dispc_cinfo; @@ -223,7 +223,7 @@ EXPORT_SYMBOL(omapdss_sdi_display_enable); void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = sdi.output.manager; dss_mgr_disable(mgr); diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index a06c8600a91..f6d2b3f9888 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -429,7 +429,7 @@ static const struct venc_config *venc_timings_to_config( static int venc_power_on(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = venc.output.manager; u32 l; int r; @@ -480,7 +480,7 @@ err0: static void venc_power_off(struct omap_dss_device *dssdev) { - struct omap_overlay_manager *mgr = dssdev->output->manager; + struct omap_overlay_manager *mgr = venc.output.manager; venc_write_reg(VENC_OUTPUT_CONTROL, 0); dss_set_dac_pwrdn_bgz(0); @@ -500,7 +500,7 @@ unsigned long venc_get_pixel_clock(void) int omapdss_venc_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = dssdev->output; + struct omap_dss_output *out = &venc.output; int r; DSSDBG("venc_display_enable\n"); -- cgit v1.2.3-70-g09d2 From d3923933930273a2c1f724c50fe1dd829e196b31 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 25 Apr 2013 13:12:07 +0300 Subject: OMAPDSS: remove omap_dss_start/stop_device() The omap_dss_start_device() and omap_dss_stop_device(), called by the DSS output drivers, are old relics. They originally did something totally else, but nowadays they increase the module ref count for panels that are enabled. This model is quite broken: the panel modules may be used even before they are enabled. For example, configuring the panel requires calls to functions located in the panel modules. In the following patches we try to improve the ref count management for the modules and display devices. The first step, however, is to remove the omap_dss_start/stop_device() totally. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/display.c | 20 -------------------- drivers/video/omap2/dss/dpi.c | 10 ---------- drivers/video/omap2/dss/dsi.c | 10 ---------- drivers/video/omap2/dss/hdmi.c | 12 +----------- drivers/video/omap2/dss/rfbi.c | 9 --------- drivers/video/omap2/dss/sdi.c | 10 ---------- drivers/video/omap2/dss/venc.c | 12 +----------- include/video/omapdss.h | 3 --- 8 files changed, 2 insertions(+), 84 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index a9a1d5563aa..809676473a9 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -233,26 +233,6 @@ struct omap_dss_device *omap_dss_find_device(void *data, } EXPORT_SYMBOL(omap_dss_find_device); -int omap_dss_start_device(struct omap_dss_device *dssdev) -{ - if (!dssdev->driver) { - DSSDBG("no driver\n"); - return -ENODEV; - } - - if (!try_module_get(dssdev->dev->driver->owner)) - return -ENODEV; - - return 0; -} -EXPORT_SYMBOL(omap_dss_start_device); - -void omap_dss_stop_device(struct omap_dss_device *dssdev) -{ - module_put(dssdev->dev->driver->owner); -} -EXPORT_SYMBOL(omap_dss_stop_device); - void videomode_to_omap_video_timings(const struct videomode *vm, struct omap_video_timings *ovt) { diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index aa653c46d9a..e8cbf86eff9 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -364,12 +364,6 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) goto err_no_out_mgr; } - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err_start_dev; - } - if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) { r = regulator_enable(dpi.vdds_dsi_reg); if (r) @@ -424,8 +418,6 @@ err_get_dispc: if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) regulator_disable(dpi.vdds_dsi_reg); err_reg_enable: - omap_dss_stop_device(dssdev); -err_start_dev: err_no_out_mgr: err_no_reg: mutex_unlock(&dpi.lock); @@ -452,8 +444,6 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) regulator_disable(dpi.vdds_dsi_reg); - omap_dss_stop_device(dssdev); - mutex_unlock(&dpi.lock); } EXPORT_SYMBOL(omapdss_dpi_display_disable); diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 7d9e5ccb41e..26aa4c324c1 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -4592,12 +4592,6 @@ int omapdss_dsi_display_enable(struct omap_dss_device *dssdev) mutex_lock(&dsi->lock); - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err_start_dev; - } - r = dsi_runtime_get(dsidev); if (r) goto err_get_dsi; @@ -4618,8 +4612,6 @@ err_init_dsi: dsi_enable_pll_clock(dsidev, 0); dsi_runtime_put(dsidev); err_get_dsi: - omap_dss_stop_device(dssdev); -err_start_dev: mutex_unlock(&dsi->lock); DSSDBG("dsi_display_enable FAILED\n"); return r; @@ -4648,8 +4640,6 @@ void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, dsi_runtime_put(dsidev); dsi_enable_pll_clock(dsidev, 0); - omap_dss_stop_device(dssdev); - mutex_unlock(&dsi->lock); } EXPORT_SYMBOL(omapdss_dsi_display_disable); diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 86b495c4b90..1804f1e28b9 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -735,23 +735,15 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio; - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err0; - } - r = hdmi_power_on_full(dssdev); if (r) { DSSERR("failed to power on device\n"); - goto err1; + goto err0; } mutex_unlock(&hdmi.lock); return 0; -err1: - omap_dss_stop_device(dssdev); err0: mutex_unlock(&hdmi.lock); return r; @@ -765,8 +757,6 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev) hdmi_power_off_full(dssdev); - omap_dss_stop_device(dssdev); - mutex_unlock(&hdmi.lock); } diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index cfcb52f088a..30ff0e0d462 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -902,12 +902,6 @@ int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) if (r) return r; - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err0; - } - r = dss_mgr_register_framedone_handler(out->manager, framedone_callback, NULL); if (r) { @@ -924,8 +918,6 @@ int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) return 0; err1: - omap_dss_stop_device(dssdev); -err0: rfbi_runtime_put(); return r; } @@ -937,7 +929,6 @@ void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) dss_mgr_unregister_framedone_handler(out->manager, framedone_callback, NULL); - omap_dss_stop_device(dssdev); rfbi_runtime_put(); } diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index ab67953f09b..d4f3313bc37 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -138,12 +138,6 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) return -ENODEV; } - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err_start_dev; - } - r = regulator_enable(sdi.vdds_sdi_reg); if (r) goto err_reg_enable; @@ -215,8 +209,6 @@ err_calc_clock_div: err_get_dispc: regulator_disable(sdi.vdds_sdi_reg); err_reg_enable: - omap_dss_stop_device(dssdev); -err_start_dev: return r; } EXPORT_SYMBOL(omapdss_sdi_display_enable); @@ -232,8 +224,6 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) dispc_runtime_put(); regulator_disable(sdi.vdds_sdi_reg); - - omap_dss_stop_device(dssdev); } EXPORT_SYMBOL(omapdss_sdi_display_disable); diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index f6d2b3f9888..d529a924943 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -513,23 +513,15 @@ int omapdss_venc_display_enable(struct omap_dss_device *dssdev) goto err0; } - r = omap_dss_start_device(dssdev); - if (r) { - DSSERR("failed to start device\n"); - goto err0; - } - r = venc_power_on(dssdev); if (r) - goto err1; + goto err0; venc.wss_data = 0; mutex_unlock(&venc.venc_lock); return 0; -err1: - omap_dss_stop_device(dssdev); err0: mutex_unlock(&venc.venc_lock); return r; @@ -543,8 +535,6 @@ void omapdss_venc_display_disable(struct omap_dss_device *dssdev) venc_power_off(dssdev); - omap_dss_stop_device(dssdev); - mutex_unlock(&venc.venc_lock); } diff --git a/include/video/omapdss.h b/include/video/omapdss.h index b7d975755cf..6a699f537a6 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -779,9 +779,6 @@ struct omap_dss_device *omap_dss_find_device(void *data, int (*match)(struct omap_dss_device *dssdev, void *data)); const char *omapdss_get_default_display_name(void); -int omap_dss_start_device(struct omap_dss_device *dssdev); -void omap_dss_stop_device(struct omap_dss_device *dssdev); - void videomode_to_omap_video_timings(const struct videomode *vm, struct omap_video_timings *ovt); void omap_video_timings_to_videomode(const struct omap_video_timings *ovt, -- cgit v1.2.3-70-g09d2 From 1f68d9c4b660487c5878c4800ff5a402abc6c005 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 19 Apr 2013 15:09:34 +0300 Subject: OMAPDSS: combine omap_dss_output into omap_dss_device We currently have omap_dss_device, which represents an external display device, sometimes an external encoder, sometimes a panel. Then we have omap_dss_output, which represents DSS's output encoder. In the future with new display device model, we construct a video pipeline from the display blocks. To accomplish this, all the blocks need to be presented by the same entity. Thus, this patch combines omap_dss_output into omap_dss_device. Some of the fields in omap_dss_output are already found in omap_dss_device, but some are not. This means we'll have DSS output specific fields in omap_dss_device, which is not very nice. However, it is easier to just keep those output specific fields there for now, and after transition to new display device model is made, they can be cleaned up easier than could be done now. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_crtc.c | 4 +-- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/video/omap2/dss/apply.c | 6 ++-- drivers/video/omap2/dss/core.c | 4 +-- drivers/video/omap2/dss/dpi.c | 12 +++---- drivers/video/omap2/dss/dsi.c | 18 +++++----- drivers/video/omap2/dss/dss.h | 4 +-- drivers/video/omap2/dss/hdmi.c | 12 +++---- drivers/video/omap2/dss/output.c | 32 +++++++++--------- drivers/video/omap2/dss/rfbi.c | 14 ++++---- drivers/video/omap2/dss/sdi.c | 12 +++---- drivers/video/omap2/dss/venc.c | 12 +++---- include/video/omapdss.h | 66 +++++++++++++++++-------------------- 13 files changed, 96 insertions(+), 102 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index b2ab2f5d3cb..4cec678dba9 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -95,7 +95,7 @@ static struct omap_crtc *omap_crtcs[8]; /* we can probably ignore these until we support command-mode panels: */ static int omap_crtc_connect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { if (mgr->output) return -EINVAL; @@ -110,7 +110,7 @@ static int omap_crtc_connect(struct omap_overlay_manager *mgr, } static void omap_crtc_disconnect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { mgr->output->manager = NULL; mgr->output = NULL; diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index c65dd0d6b01..78a78c6ea57 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -259,7 +259,7 @@ static int omap_modeset_init(struct drm_device *dev) struct drm_encoder *encoder = priv->encoders[i]; struct omap_dss_device *dssdev = omap_encoder_get_dssdev(encoder); - struct omap_dss_output *output; + struct omap_dss_device *output; output = omapdss_find_output_from_display(dssdev); diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index ced656ae705..752b9859290 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -791,13 +791,13 @@ static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr) } static int dss_mgr_connect_compat(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { return mgr->set_output(mgr, dst); } static void dss_mgr_disconnect_compat(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { mgr->unset_output(mgr); } @@ -1166,7 +1166,7 @@ static void dss_mgr_get_info(struct omap_overlay_manager *mgr, } static int dss_mgr_set_output(struct omap_overlay_manager *mgr, - struct omap_dss_output *output) + struct omap_dss_device *output) { int r; diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 7118449919c..1aeb274e30f 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -353,7 +353,7 @@ static int dss_driver_remove(struct device *dev) static int omapdss_default_connect(struct omap_dss_device *dssdev) { - struct omap_dss_output *out; + struct omap_dss_device *out; struct omap_overlay_manager *mgr; int r; @@ -375,7 +375,7 @@ static int omapdss_default_connect(struct omap_dss_device *dssdev) static void omapdss_default_disconnect(struct omap_dss_device *dssdev) { - struct omap_dss_output *out; + struct omap_dss_device *out; struct omap_overlay_manager *mgr; out = dssdev->output; diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index e8cbf86eff9..482b918757b 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -48,7 +48,7 @@ static struct { struct dss_lcd_mgr_config mgr_config; int data_lines; - struct omap_dss_output output; + struct omap_dss_device output; } dpi; static struct platform_device *dpi_get_dsidev(enum omap_channel channel) @@ -347,7 +347,7 @@ static void dpi_config_lcd_manager(struct omap_overlay_manager *mgr) int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &dpi.output; + struct omap_dss_device *out = &dpi.output; int r; mutex_lock(&dpi.lock); @@ -680,11 +680,11 @@ static int dpi_probe_pdata(struct platform_device *dpidev) static void dpi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &dpi.output; + struct omap_dss_device *out = &dpi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_DPI; - out->type = OMAP_DISPLAY_TYPE_DPI; + out->output_type = OMAP_DISPLAY_TYPE_DPI; out->name = "dpi.0"; out->dispc_channel = dpi_get_channel(); @@ -693,7 +693,7 @@ static void dpi_init_output(struct platform_device *pdev) static void __exit dpi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &dpi.output; + struct omap_dss_device *out = &dpi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 26aa4c324c1..88780731f7a 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -363,7 +363,7 @@ struct dsi_data { enum omap_dss_dsi_mode mode; struct omap_dss_dsi_videomode_timings vm_timings; - struct omap_dss_output output; + struct omap_dss_device output; }; struct dsi_packet_sent_handler_data { @@ -383,12 +383,12 @@ static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dside static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) { - return dssdev->output->pdev; + return to_platform_device(dssdev->output->dev); } struct platform_device *dsi_get_dsidev_from_id(int module) { - struct omap_dss_output *out; + struct omap_dss_device *out; enum omap_dss_output_id id; switch (module) { @@ -404,7 +404,7 @@ struct platform_device *dsi_get_dsidev_from_id(int module) out = omap_dss_get_output(id); - return out ? out->pdev : NULL; + return out ? to_platform_device(out->dev) : NULL; } static inline void dsi_write_reg(struct platform_device *dsidev, @@ -4133,7 +4133,7 @@ int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct omap_overlay_manager *mgr = dsi->output.manager; int bpp = dsi_get_pixel_size(dsi->pix_fmt); - struct omap_dss_output *out = &dsi->output; + struct omap_dss_device *out = &dsi->output; u8 data_type; u16 word_count; int r; @@ -5415,13 +5415,13 @@ static int dsi_probe_pdata(struct platform_device *dsidev) static void dsi_init_output(struct platform_device *dsidev) { struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - struct omap_dss_output *out = &dsi->output; + struct omap_dss_device *out = &dsi->output; - out->pdev = dsidev; + out->dev = &dsidev->dev; out->id = dsi->module_id == 0 ? OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2; - out->type = OMAP_DISPLAY_TYPE_DSI; + out->output_type = OMAP_DISPLAY_TYPE_DSI; out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1"; out->dispc_channel = dsi_get_channel(dsi->module_id); @@ -5431,7 +5431,7 @@ static void dsi_init_output(struct platform_device *dsidev) static void dsi_uninit_output(struct platform_device *dsidev) { struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); - struct omap_dss_output *out = &dsi->output; + struct omap_dss_device *out = &dsi->output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 03d729ac8c4..67a509ea1fc 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -180,8 +180,8 @@ void dss_copy_device_pdata(struct omap_dss_device *dst, const struct omap_dss_device *src); /* output */ -void dss_register_output(struct omap_dss_output *out); -void dss_unregister_output(struct omap_dss_output *out); +void dss_register_output(struct omap_dss_device *out); +void dss_unregister_output(struct omap_dss_device *out); /* display */ int dss_suspend_all_devices(void); diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 1804f1e28b9..1c1c1eee999 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -70,7 +70,7 @@ static struct { int ls_oe_gpio; int hpd_gpio; - struct omap_dss_output output; + struct omap_dss_device output; } hdmi; /* @@ -720,7 +720,7 @@ bool omapdss_hdmi_detect(void) int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; int r = 0; DSSDBG("ENTER hdmi_display_enable\n"); @@ -1035,11 +1035,11 @@ static int hdmi_probe_pdata(struct platform_device *pdev) static void hdmi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_HDMI; - out->type = OMAP_DISPLAY_TYPE_HDMI; + out->output_type = OMAP_DISPLAY_TYPE_HDMI; out->name = "hdmi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; @@ -1048,7 +1048,7 @@ static void hdmi_init_output(struct platform_device *pdev) static void __exit hdmi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &hdmi.output; + struct omap_dss_device *out = &hdmi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c index a53b08b2249..cc81fec1626 100644 --- a/drivers/video/omap2/dss/output.c +++ b/drivers/video/omap2/dss/output.c @@ -27,7 +27,7 @@ static LIST_HEAD(output_list); static DEFINE_MUTEX(output_lock); -int omapdss_output_set_device(struct omap_dss_output *out, +int omapdss_output_set_device(struct omap_dss_device *out, struct omap_dss_device *dssdev) { int r; @@ -41,7 +41,7 @@ int omapdss_output_set_device(struct omap_dss_output *out, goto err; } - if (out->type != dssdev->type) { + if (out->output_type != dssdev->type) { DSSERR("output type and display type don't match\n"); r = -EINVAL; goto err; @@ -60,7 +60,7 @@ err: } EXPORT_SYMBOL(omapdss_output_set_device); -int omapdss_output_unset_device(struct omap_dss_output *out) +int omapdss_output_unset_device(struct omap_dss_device *out) { int r; @@ -92,19 +92,19 @@ err: } EXPORT_SYMBOL(omapdss_output_unset_device); -void dss_register_output(struct omap_dss_output *out) +void dss_register_output(struct omap_dss_device *out) { list_add_tail(&out->list, &output_list); } -void dss_unregister_output(struct omap_dss_output *out) +void dss_unregister_output(struct omap_dss_device *out) { list_del(&out->list); } -struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id) +struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id) { - struct omap_dss_output *out; + struct omap_dss_device *out; list_for_each_entry(out, &output_list, list) { if (out->id == id) @@ -115,9 +115,9 @@ struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id) } EXPORT_SYMBOL(omap_dss_get_output); -struct omap_dss_output *omap_dss_find_output(const char *name) +struct omap_dss_device *omap_dss_find_output(const char *name) { - struct omap_dss_output *out; + struct omap_dss_device *out; list_for_each_entry(out, &output_list, list) { if (strcmp(out->name, name) == 0) @@ -128,12 +128,12 @@ struct omap_dss_output *omap_dss_find_output(const char *name) } EXPORT_SYMBOL(omap_dss_find_output); -struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node) +struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node) { - struct omap_dss_output *out; + struct omap_dss_device *out; list_for_each_entry(out, &output_list, list) { - if (out->pdev->dev.of_node == node) + if (out->dev->of_node == node) return out; } @@ -141,7 +141,7 @@ struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node) } EXPORT_SYMBOL(omap_dss_find_output_by_node); -struct omap_dss_output *omapdss_find_output_from_display(struct omap_dss_device *dssdev) +struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev) { return dssdev->output; } @@ -149,7 +149,7 @@ EXPORT_SYMBOL(omapdss_find_output_from_display); struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev) { - struct omap_dss_output *out; + struct omap_dss_device *out; out = omapdss_find_output_from_display(dssdev); @@ -180,14 +180,14 @@ void dss_uninstall_mgr_ops(void) EXPORT_SYMBOL(dss_uninstall_mgr_ops); int dss_mgr_connect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { return dss_mgr_ops->connect(mgr, dst); } EXPORT_SYMBOL(dss_mgr_connect); void dss_mgr_disconnect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst) + struct omap_dss_device *dst) { dss_mgr_ops->disconnect(mgr, dst); } diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 30ff0e0d462..35836eb73a6 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -117,7 +117,7 @@ static struct { int data_lines; struct rfbi_timings intf_timings; - struct omap_dss_output output; + struct omap_dss_device output; } rfbi; static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) @@ -890,7 +890,7 @@ static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev) int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; int r; if (out == NULL || out->manager == NULL) { @@ -925,7 +925,7 @@ EXPORT_SYMBOL(omapdss_rfbi_display_enable); void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; dss_mgr_unregister_framedone_handler(out->manager, framedone_callback, NULL); @@ -1013,11 +1013,11 @@ static int rfbi_probe_pdata(struct platform_device *rfbidev) static void rfbi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_DBI; - out->type = OMAP_DISPLAY_TYPE_DBI; + out->output_type = OMAP_DISPLAY_TYPE_DBI; out->name = "rfbi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_LCD; @@ -1026,7 +1026,7 @@ static void rfbi_init_output(struct platform_device *pdev) static void __exit rfbi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &rfbi.output; + struct omap_dss_device *out = &rfbi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index d4f3313bc37..5e81de58d93 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -40,7 +40,7 @@ static struct { struct omap_video_timings timings; int datapairs; - struct omap_dss_output output; + struct omap_dss_device output; } sdi; struct sdi_clk_calc_ctx { @@ -126,7 +126,7 @@ static void sdi_config_lcd_manager(struct omap_dss_device *dssdev) int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &sdi.output; + struct omap_dss_device *out = &sdi.output; struct omap_video_timings *t = &sdi.timings; struct dss_clock_info dss_cinfo; struct dispc_clock_info dispc_cinfo; @@ -335,11 +335,11 @@ static int sdi_probe_pdata(struct platform_device *sdidev) static void sdi_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &sdi.output; + struct omap_dss_device *out = &sdi.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_SDI; - out->type = OMAP_DISPLAY_TYPE_SDI; + out->output_type = OMAP_DISPLAY_TYPE_SDI; out->name = "sdi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_LCD; @@ -348,7 +348,7 @@ static void sdi_init_output(struct platform_device *pdev) static void __exit sdi_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &sdi.output; + struct omap_dss_device *out = &sdi.output; dss_unregister_output(out); } diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index d529a924943..96c49bc7bdb 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -304,7 +304,7 @@ static struct { enum omap_dss_venc_type type; bool invert_polarity; - struct omap_dss_output output; + struct omap_dss_device output; } venc; static inline void venc_write_reg(int idx, u32 val) @@ -500,7 +500,7 @@ unsigned long venc_get_pixel_clock(void) int omapdss_venc_display_enable(struct omap_dss_device *dssdev) { - struct omap_dss_output *out = &venc.output; + struct omap_dss_device *out = &venc.output; int r; DSSDBG("venc_display_enable\n"); @@ -785,11 +785,11 @@ static int venc_probe_pdata(struct platform_device *vencdev) static void venc_init_output(struct platform_device *pdev) { - struct omap_dss_output *out = &venc.output; + struct omap_dss_device *out = &venc.output; - out->pdev = pdev; + out->dev = &pdev->dev; out->id = OMAP_DSS_OUTPUT_VENC; - out->type = OMAP_DISPLAY_TYPE_VENC; + out->output_type = OMAP_DISPLAY_TYPE_VENC; out->name = "venc.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; @@ -798,7 +798,7 @@ static void venc_init_output(struct platform_device *pdev) static void __exit venc_uninit_output(struct platform_device *pdev) { - struct omap_dss_output *out = &venc.output; + struct omap_dss_device *out = &venc.output; dss_unregister_output(out); } diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 6a699f537a6..8e5035a5454 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -515,7 +515,7 @@ struct omap_overlay_manager { enum omap_dss_output_id supported_outputs; /* dynamic fields */ - struct omap_dss_output *output; + struct omap_dss_device *output; /* * The following functions do not block: @@ -529,7 +529,7 @@ struct omap_overlay_manager { */ int (*set_output)(struct omap_overlay_manager *mgr, - struct omap_dss_output *output); + struct omap_dss_device *output); int (*unset_output)(struct omap_overlay_manager *mgr); int (*set_manager_info)(struct omap_overlay_manager *mgr, @@ -572,29 +572,6 @@ struct omap_dss_writeback_info { u8 pre_mult_alpha; }; -struct omap_dss_output { - struct list_head list; - - const char *name; - - /* display type supported by the output */ - enum omap_display_type type; - - /* DISPC channel for this output */ - enum omap_channel dispc_channel; - - /* output instance */ - enum omap_dss_output_id id; - - /* output's platform device pointer */ - struct platform_device *pdev; - - /* dynamic fields */ - struct omap_overlay_manager *manager; - - struct omap_dss_device *device; -}; - struct omap_dss_device { /* old device, to be removed */ struct device old_dev; @@ -608,6 +585,7 @@ struct omap_dss_device { char alias[16]; enum omap_display_type type; + enum omap_display_type output_type; /* obsolete, to be removed */ enum omap_channel channel; @@ -669,7 +647,7 @@ struct omap_dss_device { enum omap_display_caps caps; - struct omap_dss_output *output; + struct omap_dss_device *output; enum omap_dss_display_state state; @@ -680,6 +658,22 @@ struct omap_dss_device { void (*platform_disable)(struct omap_dss_device *dssdev); int (*set_backlight)(struct omap_dss_device *dssdev, int level); int (*get_backlight)(struct omap_dss_device *dssdev); + + + /* OMAP DSS output specific fields */ + + struct list_head list; + + /* DISPC channel for this output */ + enum omap_channel dispc_channel; + + /* output instance */ + enum omap_dss_output_id id; + + /* dynamic fields */ + struct omap_overlay_manager *manager; + + struct omap_dss_device *device; }; struct omap_dss_hdmi_data @@ -798,14 +792,14 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num); int omap_dss_get_num_overlays(void); struct omap_overlay *omap_dss_get_overlay(int num); -struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id); -struct omap_dss_output *omap_dss_find_output(const char *name); -struct omap_dss_output *omap_dss_find_output_by_node(struct device_node *node); -int omapdss_output_set_device(struct omap_dss_output *out, +struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id); +struct omap_dss_device *omap_dss_find_output(const char *name); +struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node); +int omapdss_output_set_device(struct omap_dss_device *out, struct omap_dss_device *dssdev); -int omapdss_output_unset_device(struct omap_dss_output *out); +int omapdss_output_unset_device(struct omap_dss_device *out); -struct omap_dss_output *omapdss_find_output_from_display(struct omap_dss_device *dssdev); +struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev); struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev); void omapdss_default_get_resolution(struct omap_dss_device *dssdev, @@ -909,9 +903,9 @@ void omapdss_compat_uninit(void); struct dss_mgr_ops { int (*connect)(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void (*disconnect)(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void (*start_update)(struct omap_overlay_manager *mgr); int (*enable)(struct omap_overlay_manager *mgr); @@ -930,9 +924,9 @@ int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); void dss_uninstall_mgr_ops(void); int dss_mgr_connect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void dss_mgr_disconnect(struct omap_overlay_manager *mgr, - struct omap_dss_output *dst); + struct omap_dss_device *dst); void dss_mgr_set_timings(struct omap_overlay_manager *mgr, const struct omap_video_timings *timings); void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, -- cgit v1.2.3-70-g09d2 From b7328e14591fb532688db36ef894ac8c34948b4e Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 3 May 2013 11:42:18 +0300 Subject: OMAPDSS: add THIS_MODULE owner to DSS outputs Setup the owner field for DSS output's omap_dss_device so that module refcounting works. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/dpi.c | 1 + drivers/video/omap2/dss/dsi.c | 1 + drivers/video/omap2/dss/hdmi.c | 1 + drivers/video/omap2/dss/rfbi.c | 1 + drivers/video/omap2/dss/sdi.c | 1 + drivers/video/omap2/dss/venc.c | 1 + 6 files changed, 6 insertions(+) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 482b918757b..892a2b207ee 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -687,6 +687,7 @@ static void dpi_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_DPI; out->name = "dpi.0"; out->dispc_channel = dpi_get_channel(); + out->owner = THIS_MODULE; dss_register_output(out); } diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 88780731f7a..d6b019faed2 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -5424,6 +5424,7 @@ static void dsi_init_output(struct platform_device *dsidev) out->output_type = OMAP_DISPLAY_TYPE_DSI; out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1"; out->dispc_channel = dsi_get_channel(dsi->module_id); + out->owner = THIS_MODULE; dss_register_output(out); } diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 1c1c1eee999..0f93903d440 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -1042,6 +1042,7 @@ static void hdmi_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_HDMI; out->name = "hdmi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; + out->owner = THIS_MODULE; dss_register_output(out); } diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 35836eb73a6..f18c9466849 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -1020,6 +1020,7 @@ static void rfbi_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_DBI; out->name = "rfbi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_LCD; + out->owner = THIS_MODULE; dss_register_output(out); } diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 5e81de58d93..bcb75f5d537 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -342,6 +342,7 @@ static void sdi_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_SDI; out->name = "sdi.0"; out->dispc_channel = OMAP_DSS_CHANNEL_LCD; + out->owner = THIS_MODULE; dss_register_output(out); } diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 96c49bc7bdb..4a8a214067a 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -792,6 +792,7 @@ static void venc_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_VENC; out->name = "venc.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; + out->owner = THIS_MODULE; dss_register_output(out); } -- cgit v1.2.3-70-g09d2 From 5391e87d1259e45fbb153aad97fe21a41403b534 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 16 May 2013 10:44:13 +0300 Subject: OMAPDSS: remove dispc's dependency to VENC/HDMI DISPC needs to know the clock rate for DIGIT (i.e. TV) channel, and this clock is provided by either VENC or HDMI modules. Currently DISPC will call a function in VENC/HDMI, asking what the clock rate is. This means we have a fixed dependency from DISPC to both VENC and HDMI. To have a more generic approach, and in particular to allow adding OMAP5 HDMI driver, we need to remove this dependency. This patch makes VENC/HDMI inform DISPC when the their clock changes, thus reversing the dependency and removing the issue. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/dispc.c | 20 +++++++------------- drivers/video/omap2/dss/dss.h | 19 +------------------ drivers/video/omap2/dss/hdmi.c | 8 ++------ drivers/video/omap2/dss/venc.c | 8 ++------ 4 files changed, 12 insertions(+), 43 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 83d7bb9da60..02a7340111d 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -103,6 +103,7 @@ static struct { int irq; unsigned long core_clk_rate; + unsigned long tv_pclk_rate; u32 fifo_size[DISPC_MAX_NR_FIFOS]; /* maps which plane is using a fifo. fifo-id -> plane-id */ @@ -3071,22 +3072,15 @@ unsigned long dispc_mgr_pclk_rate(enum omap_channel channel) return r / pcd; } else { - enum dss_hdmi_venc_clk_source_select source; - - source = dss_get_hdmi_venc_clk_source(); - - switch (source) { - case DSS_VENC_TV_CLK: - return venc_get_pixel_clock(); - case DSS_HDMI_M_PCLK: - return hdmi_get_pixel_clock(); - default: - BUG(); - return 0; - } + return dispc.tv_pclk_rate; } } +void dispc_set_tv_pclk(unsigned long pclk) +{ + dispc.tv_pclk_rate = pclk; +} + unsigned long dispc_core_clk_rate(void) { return dispc.core_clk_rate; diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 67a509ea1fc..ed70fa01d19 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -426,6 +426,7 @@ void dispc_mgr_set_clock_div(enum omap_channel channel, const struct dispc_clock_info *cinfo); int dispc_mgr_get_clock_div(enum omap_channel channel, struct dispc_clock_info *cinfo); +void dispc_set_tv_pclk(unsigned long pclk); u32 dispc_wb_get_framedone_irq(void); bool dispc_wb_go_busy(void); @@ -437,17 +438,8 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, bool mem_to_mem, const struct omap_video_timings *timings); /* VENC */ -#ifdef CONFIG_OMAP2_DSS_VENC int venc_init_platform_driver(void) __init; void venc_uninit_platform_driver(void) __exit; -unsigned long venc_get_pixel_clock(void); -#else -static inline unsigned long venc_get_pixel_clock(void) -{ - WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); - return 0; -} -#endif int omapdss_venc_display_enable(struct omap_dss_device *dssdev); void omapdss_venc_display_disable(struct omap_dss_device *dssdev); void omapdss_venc_set_timings(struct omap_dss_device *dssdev, @@ -464,17 +456,8 @@ int venc_panel_init(void); void venc_panel_exit(void); /* HDMI */ -#ifdef CONFIG_OMAP4_DSS_HDMI int hdmi_init_platform_driver(void) __init; void hdmi_uninit_platform_driver(void) __exit; -unsigned long hdmi_get_pixel_clock(void); -#else -static inline unsigned long hdmi_get_pixel_clock(void) -{ - WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); - return 0; -} -#endif int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev); void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev); int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev); diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 3038eef99ba..e1c0992b522 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -465,12 +465,6 @@ end: return cm; } -unsigned long hdmi_get_pixel_clock(void) -{ - /* HDMI Pixel Clock in Mhz */ - return hdmi.ip_data.cfg.timings.pixel_clock * 1000; -} - static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, struct hdmi_pll_info *pi) { @@ -663,6 +657,8 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, if (t != NULL) hdmi.ip_data.cfg = *t; + dispc_set_tv_pclk(t->timings.pixel_clock * 1000); + mutex_unlock(&hdmi.lock); } diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 4a8a214067a..8720f137d4f 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -492,12 +492,6 @@ static void venc_power_off(struct omap_dss_device *dssdev) venc_runtime_put(); } -unsigned long venc_get_pixel_clock(void) -{ - /* VENC Pixel Clock in Mhz */ - return 13500000; -} - int omapdss_venc_display_enable(struct omap_dss_device *dssdev) { struct omap_dss_device *out = &venc.output; @@ -551,6 +545,8 @@ void omapdss_venc_set_timings(struct omap_dss_device *dssdev, venc.timings = *timings; + dispc_set_tv_pclk(13500000); + mutex_unlock(&venc.venc_lock); } -- cgit v1.2.3-70-g09d2 From 5d47dbc85228de3ce82dea11af3c169e66cbf520 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 24 Apr 2013 13:32:51 +0300 Subject: OMAPDSS: public omapdss_register_output() In order to allow multiple display block in a video pipeline, we need to give the drivers way to register themselves. For now we have the omapdss_register_display() which is used to register panels, and dss_register_output() which is used to register DSS encoders. This patch makes dss_register_output() public (with the name of omapdss_register_output), which can be used to register also external encoders. The distinction between register_output and register_display is that a "display" is an entity at the end of the videopipeline, and "output" is something inside the pipeline. The registration and naming will be made saner in the future, but the current names and functions are kept to minimize changes during the dss device model transition. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/dpi.c | 4 ++-- drivers/video/omap2/dss/dsi.c | 4 ++-- drivers/video/omap2/dss/dss.h | 4 ---- drivers/video/omap2/dss/hdmi.c | 4 ++-- drivers/video/omap2/dss/output.c | 7 +++++-- drivers/video/omap2/dss/rfbi.c | 4 ++-- drivers/video/omap2/dss/sdi.c | 4 ++-- drivers/video/omap2/dss/venc.c | 4 ++-- include/video/omapdss.h | 2 ++ 9 files changed, 19 insertions(+), 18 deletions(-) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 892a2b207ee..5351d02e306 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -689,14 +689,14 @@ static void dpi_init_output(struct platform_device *pdev) out->dispc_channel = dpi_get_channel(); out->owner = THIS_MODULE; - dss_register_output(out); + omapdss_register_output(out); } static void __exit dpi_uninit_output(struct platform_device *pdev) { struct omap_dss_device *out = &dpi.output; - dss_unregister_output(out); + omapdss_unregister_output(out); } static int omap_dpi_probe(struct platform_device *pdev) diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index d6b019faed2..58fbff94e01 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -5426,7 +5426,7 @@ static void dsi_init_output(struct platform_device *dsidev) out->dispc_channel = dsi_get_channel(dsi->module_id); out->owner = THIS_MODULE; - dss_register_output(out); + omapdss_register_output(out); } static void dsi_uninit_output(struct platform_device *dsidev) @@ -5434,7 +5434,7 @@ static void dsi_uninit_output(struct platform_device *dsidev) struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct omap_dss_device *out = &dsi->output; - dss_unregister_output(out); + omapdss_unregister_output(out); } /* DSI1 HW IP initialisation */ diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index ed70fa01d19..50a2362ef8f 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -179,10 +179,6 @@ void dss_put_device(struct omap_dss_device *dssdev); void dss_copy_device_pdata(struct omap_dss_device *dst, const struct omap_dss_device *src); -/* output */ -void dss_register_output(struct omap_dss_device *out); -void dss_unregister_output(struct omap_dss_device *out); - /* display */ int dss_suspend_all_devices(void); int dss_resume_all_devices(void); diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index e1c0992b522..2b0a2aac8ae 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -1036,14 +1036,14 @@ static void hdmi_init_output(struct platform_device *pdev) out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; out->owner = THIS_MODULE; - dss_register_output(out); + omapdss_register_output(out); } static void __exit hdmi_uninit_output(struct platform_device *pdev) { struct omap_dss_device *out = &hdmi.output; - dss_unregister_output(out); + omapdss_unregister_output(out); } /* HDMI HW IP initialisation */ diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c index 9ad7d2175a7..0ba168e2390 100644 --- a/drivers/video/omap2/dss/output.c +++ b/drivers/video/omap2/dss/output.c @@ -92,15 +92,18 @@ err: } EXPORT_SYMBOL(omapdss_output_unset_device); -void dss_register_output(struct omap_dss_device *out) +int omapdss_register_output(struct omap_dss_device *out) { list_add_tail(&out->list, &output_list); + return 0; } +EXPORT_SYMBOL(omapdss_register_output); -void dss_unregister_output(struct omap_dss_device *out) +void omapdss_unregister_output(struct omap_dss_device *out) { list_del(&out->list); } +EXPORT_SYMBOL(omapdss_unregister_output); struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id) { diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index f18c9466849..fdfe6e6f25d 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -1022,14 +1022,14 @@ static void rfbi_init_output(struct platform_device *pdev) out->dispc_channel = OMAP_DSS_CHANNEL_LCD; out->owner = THIS_MODULE; - dss_register_output(out); + omapdss_register_output(out); } static void __exit rfbi_uninit_output(struct platform_device *pdev) { struct omap_dss_device *out = &rfbi.output; - dss_unregister_output(out); + omapdss_unregister_output(out); } /* RFBI HW IP initialisation */ diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index bcb75f5d537..69d907f7df4 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c @@ -344,14 +344,14 @@ static void sdi_init_output(struct platform_device *pdev) out->dispc_channel = OMAP_DSS_CHANNEL_LCD; out->owner = THIS_MODULE; - dss_register_output(out); + omapdss_register_output(out); } static void __exit sdi_uninit_output(struct platform_device *pdev) { struct omap_dss_device *out = &sdi.output; - dss_unregister_output(out); + omapdss_unregister_output(out); } static int omap_sdi_probe(struct platform_device *pdev) diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 8720f137d4f..e47b64eee62 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -790,14 +790,14 @@ static void venc_init_output(struct platform_device *pdev) out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; out->owner = THIS_MODULE; - dss_register_output(out); + omapdss_register_output(out); } static void __exit venc_uninit_output(struct platform_device *pdev) { struct omap_dss_device *out = &venc.output; - dss_unregister_output(out); + omapdss_unregister_output(out); } /* VENC HW IP initialisation */ diff --git a/include/video/omapdss.h b/include/video/omapdss.h index ef9db241b4a..cca912a5f32 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -780,6 +780,8 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num); int omap_dss_get_num_overlays(void); struct omap_overlay *omap_dss_get_overlay(int num); +int omapdss_register_output(struct omap_dss_device *output); +void omapdss_unregister_output(struct omap_dss_device *output); struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id); struct omap_dss_device *omap_dss_find_output(const char *name); struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node); -- cgit v1.2.3-70-g09d2 From fb8efa49660ea450ad632c9d8b70f12e4a43a495 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Fri, 24 May 2013 13:19:50 +0300 Subject: OMAPDSS: AnalogTV: Add ops Add "ops" style method for using analog TV functionality. Ops style calls will allow us to have arbitrarily long display pipelines, where each entity can call ops in the previous display entity. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/venc.c | 72 ++++++++++++++++++++++++++++++++++++++++++ include/video/omapdss.h | 26 +++++++++++++++ 2 files changed, 98 insertions(+) (limited to 'drivers/video/omap2/dss/venc.c') diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index e47b64eee62..496a106fe82 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -564,6 +564,16 @@ int omapdss_venc_check_timings(struct omap_dss_device *dssdev, return -EINVAL; } +static void venc_get_timings(struct omap_dss_device *dssdev, + struct omap_video_timings *timings) +{ + mutex_lock(&venc.venc_lock); + + *timings = venc.timings; + + mutex_unlock(&venc.venc_lock); +} + u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev) { /* Invert due to VENC_L21_WC_CTL:INV=1 */ @@ -779,6 +789,67 @@ static int venc_probe_pdata(struct platform_device *vencdev) return 0; } +static int venc_connect(struct omap_dss_device *dssdev, + struct omap_dss_device *dst) +{ + struct omap_overlay_manager *mgr; + int r; + + r = venc_init_regulator(); + if (r) + return r; + + mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); + if (!mgr) + return -ENODEV; + + r = dss_mgr_connect(mgr, dssdev); + if (r) + return r; + + r = omapdss_output_set_device(dssdev, dst); + if (r) { + DSSERR("failed to connect output to new device: %s\n", + dst->name); + dss_mgr_disconnect(mgr, dssdev); + return r; + } + + return 0; +} + +static void venc_disconnect(struct omap_dss_device *dssdev, + struct omap_dss_device *dst) +{ + WARN_ON(dst != dssdev->device); + + if (dst != dssdev->device) + return; + + omapdss_output_unset_device(dssdev); + + if (dssdev->manager) + dss_mgr_disconnect(dssdev->manager, dssdev); +} + +static const struct omapdss_atv_ops venc_ops = { + .connect = venc_connect, + .disconnect = venc_disconnect, + + .enable = omapdss_venc_display_enable, + .disable = omapdss_venc_display_disable, + + .check_timings = omapdss_venc_check_timings, + .set_timings = omapdss_venc_set_timings, + .get_timings = venc_get_timings, + + .set_type = omapdss_venc_set_type, + .invert_vid_out_polarity = omapdss_venc_invert_vid_out_polarity, + + .set_wss = omapdss_venc_set_wss, + .get_wss = omapdss_venc_get_wss, +}; + static void venc_init_output(struct platform_device *pdev) { struct omap_dss_device *out = &venc.output; @@ -788,6 +859,7 @@ static void venc_init_output(struct platform_device *pdev) out->output_type = OMAP_DISPLAY_TYPE_VENC; out->name = "venc.0"; out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; + out->ops.atv = &venc_ops; out->owner = THIS_MODULE; omapdss_register_output(out); diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 3b3903fa150..adb103633bd 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -628,6 +628,31 @@ struct omapdss_dvi_ops { struct omap_video_timings *timings); }; +struct omapdss_atv_ops { + int (*connect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + void (*disconnect)(struct omap_dss_device *dssdev, + struct omap_dss_device *dst); + + int (*enable)(struct omap_dss_device *dssdev); + void (*disable)(struct omap_dss_device *dssdev); + + int (*check_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*set_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + void (*get_timings)(struct omap_dss_device *dssdev, + struct omap_video_timings *timings); + + void (*set_type)(struct omap_dss_device *dssdev, + enum omap_dss_venc_type type); + void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev, + bool invert_polarity); + + int (*set_wss)(struct omap_dss_device *dssdev, u32 wss); + u32 (*get_wss)(struct omap_dss_device *dssdev); +}; + struct omap_dss_device { /* old device, to be removed */ struct device old_dev; @@ -697,6 +722,7 @@ struct omap_dss_device { const struct omapdss_dpi_ops *dpi; const struct omapdss_sdi_ops *sdi; const struct omapdss_dvi_ops *dvi; + const struct omapdss_atv_ops *atv; } ops; /* helper variable for driver suspend/resume */ -- cgit v1.2.3-70-g09d2