Instead of calling the .set_timings() operation recursively from the display device backwards, iterate over the devices manually in the DRM encoder code. This moves the complexity to a single central location and simplifies the logic in omap_dss_device drivers.
Signed-off-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reic...@collabora.co.uk> --- .../gpu/drm/omapdrm/displays/connector-analog-tv.c | 10 ---------- drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 10 ---------- drivers/gpu/drm/omapdrm/displays/connector-hdmi.c | 10 ---------- drivers/gpu/drm/omapdrm/displays/encoder-opa362.c | 11 ----------- drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c | 9 --------- drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c | 9 --------- drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 9 --------- .../drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 9 --------- .../gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | 9 --------- .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c | 9 --------- .../gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | 9 --------- .../gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 9 --------- .../gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c | 9 --------- drivers/gpu/drm/omapdrm/dss/dpi.c | 2 -- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 2 -- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 2 -- drivers/gpu/drm/omapdrm/dss/sdi.c | 2 -- drivers/gpu/drm/omapdrm/dss/venc.c | 2 -- drivers/gpu/drm/omapdrm/omap_encoder.c | 20 ++++++++------------ 19 files changed, 8 insertions(+), 144 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c index 4866bf8ed524..28a3ce8f88d2 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c @@ -73,22 +73,12 @@ static void tvc_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void tvc_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static const struct omap_dss_device_ops tvc_ops = { .connect = tvc_connect, .disconnect = tvc_disconnect, .enable = tvc_enable, .disable = tvc_disable, - - .set_timings = tvc_set_timings, }; static int tvc_probe(struct platform_device *pdev) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index 818a4dc452e0..24b14f44248e 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c @@ -78,14 +78,6 @@ static void dvic_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void dvic_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static int dvic_ddc_read(struct i2c_adapter *adapter, unsigned char *buf, u16 count, u8 offset) { @@ -192,8 +184,6 @@ static const struct omap_dss_device_ops dvic_ops = { .enable = dvic_enable, .disable = dvic_disable, - .set_timings = dvic_set_timings, - .read_edid = dvic_read_edid, .detect = dvic_detect, diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c index a32e4159242d..e602fa4a50a4 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c @@ -79,14 +79,6 @@ static void hdmic_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void hdmic_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static bool hdmic_detect(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); @@ -124,8 +116,6 @@ static const struct omap_dss_device_ops hdmic_ops = { .enable = hdmic_enable, .disable = hdmic_disable, - .set_timings = hdmic_set_timings, - .detect = hdmic_detect, .register_hpd_cb = hdmic_register_hpd_cb, .unregister_hpd_cb = hdmic_unregister_hpd_cb, diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c index bdf796123133..4fefd80f53bb 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c @@ -85,22 +85,11 @@ static void opa362_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void opa362_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - dev_dbg(dssdev->dev, "set_timings\n"); - - src->ops->set_timings(src, vm); -} - static const struct omap_dss_device_ops opa362_ops = { .connect = opa362_connect, .disconnect = opa362_disconnect, .enable = opa362_enable, .disable = opa362_disable, - .set_timings = opa362_set_timings, }; static int opa362_probe(struct platform_device *pdev) diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c index c3ceee2d19d0..f1a748353279 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c @@ -76,20 +76,11 @@ static void tfp410_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void tfp410_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static const struct omap_dss_device_ops tfp410_ops = { .connect = tfp410_connect, .disconnect = tfp410_disconnect, .enable = tfp410_enable, .disable = tfp410_disable, - .set_timings = tfp410_set_timings, }; static int tfp410_probe(struct platform_device *pdev) diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c index 4598e5ca4238..94de55fd8884 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c @@ -91,14 +91,6 @@ static void tpd_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void tpd_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static bool tpd_detect(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); @@ -134,7 +126,6 @@ static const struct omap_dss_device_ops tpd_ops = { .disconnect = tpd_disconnect, .enable = tpd_enable, .disable = tpd_disable, - .set_timings = tpd_set_timings, .detect = tpd_detect, .register_hpd_cb = tpd_register_hpd_cb, .unregister_hpd_cb = tpd_unregister_hpd_cb, diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index 95cdfde174aa..1f8161b041be 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c @@ -93,14 +93,6 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void panel_dpi_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void panel_dpi_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -116,7 +108,6 @@ static const struct omap_dss_device_ops panel_dpi_ops = { .enable = panel_dpi_enable, .disable = panel_dpi_disable, - .set_timings = panel_dpi_set_timings, .get_timings = panel_dpi_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c index 4e21de0e010d..f6ef8ff964dd 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c @@ -163,14 +163,6 @@ static void lb035q02_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void lb035q02_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void lb035q02_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -186,7 +178,6 @@ static const struct omap_dss_device_ops lb035q02_ops = { .enable = lb035q02_enable, .disable = lb035q02_disable, - .set_timings = lb035q02_set_timings, .get_timings = lb035q02_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c index f6fc7b8e639b..f445de6369f7 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c @@ -156,14 +156,6 @@ static void nec_8048_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void nec_8048_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void nec_8048_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -179,7 +171,6 @@ static const struct omap_dss_device_ops nec_8048_ops = { .enable = nec_8048_enable, .disable = nec_8048_disable, - .set_timings = nec_8048_set_timings, .get_timings = nec_8048_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c index 51ca92c82e2a..64b1369cb274 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c @@ -126,14 +126,6 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void sharp_ls_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void sharp_ls_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -149,7 +141,6 @@ static const struct omap_dss_device_ops sharp_ls_ops = { .enable = sharp_ls_enable, .disable = sharp_ls_disable, - .set_timings = sharp_ls_set_timings, .get_timings = sharp_ls_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c index 974982c46445..e04663856b31 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c @@ -629,14 +629,6 @@ static void acx565akm_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void acx565akm_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void acx565akm_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -652,7 +644,6 @@ static const struct omap_dss_device_ops acx565akm_ops = { .enable = acx565akm_enable, .disable = acx565akm_disable, - .set_timings = acx565akm_set_timings, .get_timings = acx565akm_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c index ee17eb3e0a48..7ddc8c574a61 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c @@ -295,14 +295,6 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void td028ttec1_panel_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void td028ttec1_panel_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -318,7 +310,6 @@ static const struct omap_dss_device_ops td028ttec1_ops = { .enable = td028ttec1_panel_enable, .disable = td028ttec1_panel_disable, - .set_timings = td028ttec1_panel_set_timings, .get_timings = td028ttec1_panel_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c index 7b0439274458..8440fcb744d9 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c @@ -369,14 +369,6 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev) dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -static void tpo_td043_set_timings(struct omap_dss_device *dssdev, - const struct videomode *vm) -{ - struct omap_dss_device *src = dssdev->src; - - src->ops->set_timings(src, vm); -} - static void tpo_td043_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { @@ -392,7 +384,6 @@ static const struct omap_dss_device_ops tpo_td043_ops = { .enable = tpo_td043_enable, .disable = tpo_td043_disable, - .set_timings = tpo_td043_set_timings, .get_timings = tpo_td043_get_timings, }; diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index 223586788648..ca4f3c4c6318 100644 --- a/drivers/gpu/drm/omapdrm/dss/dpi.c +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c @@ -477,8 +477,6 @@ static void dpi_set_timings(struct omap_dss_device *dssdev, dpi->vm = *vm; - dss_mgr_set_timings(&dpi->output, vm); - mutex_unlock(&dpi->lock); } diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index df7cfb3e2b12..cf6230eac31a 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -259,8 +259,6 @@ static void hdmi_display_set_timings(struct omap_dss_device *dssdev, dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock); - dss_mgr_set_timings(&hdmi->output, vm); - mutex_unlock(&hdmi->lock); } diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index cb212e5e790f..b0e4a7463f8c 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -258,8 +258,6 @@ static void hdmi_display_set_timings(struct omap_dss_device *dssdev, dispc_set_tv_pclk(hdmi->dss->dispc, vm->pixelclock); - dss_mgr_set_timings(&hdmi->output, vm); - mutex_unlock(&hdmi->lock); } diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c index 36edcdbf0609..b2fe2387037a 100644 --- a/drivers/gpu/drm/omapdrm/dss/sdi.c +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c @@ -218,8 +218,6 @@ static void sdi_set_timings(struct omap_dss_device *dssdev, struct sdi_device *sdi = dssdev_to_sdi(dssdev); sdi->vm = *vm; - - dss_mgr_set_timings(&sdi->output, vm); } static int sdi_check_timings(struct omap_dss_device *dssdev, diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c index 39e3c43c54c1..ff0b18c8e4ac 100644 --- a/drivers/gpu/drm/omapdrm/dss/venc.c +++ b/drivers/gpu/drm/omapdrm/dss/venc.c @@ -593,8 +593,6 @@ static void venc_set_timings(struct omap_dss_device *dssdev, dispc_set_tv_pclk(venc->dss->dispc, 13500000); - dss_mgr_set_timings(&venc->output, vm); - mutex_unlock(&venc->venc_lock); } diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c index 749d21a92edd..452e625f6ce3 100644 --- a/drivers/gpu/drm/omapdrm/omap_encoder.c +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c @@ -58,7 +58,6 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder, { struct drm_device *dev = encoder->dev; struct omap_encoder *omap_encoder = to_omap_encoder(encoder); - struct omap_dss_device *display = omap_encoder->display; struct drm_connector *connector; struct omap_dss_device *dssdev; struct videomode vm = { 0 }; @@ -104,18 +103,15 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder, } } - /* - * HACK: Call the .set_timings() operation if available, this will - * eventually store timings in the CRTC. Otherwise (for DSI outputs) - * store the timings directly. - * - * All outputs should be brought in sync to operate similarly. - */ - if (display->ops->set_timings) - display->ops->set_timings(display, &vm); - else - *omap_crtc_timings(encoder->crtc) = vm; + /* Set timings for all devices in the display pipeline. */ + dss_mgr_set_timings(omap_encoder->output, &vm); + + for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) { + if (dssdev->ops->set_timings) + dssdev->ops->set_timings(dssdev, &vm); + } + /* Set the HDMI mode and HDMI infoframe if applicable. */ hdmi_mode = false; list_for_each_entry(connector, &dev->mode_config.connector_list, head) { if (connector->encoder == encoder) { -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel