From 511afb44d72aa7b6b871fa71f829afaaa27e84f0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 4 Mar 2018 23:42:36 +0200 Subject: drm/omap: Reverse direction of DSS device (dis)connect operations The omapdrm and omapdss drivers are architectured based on display pipelines made of multiple components handled from sink (display) to source (DSS output). This is incompatible with the DRM bridge and panel APIs that handle components from source to sink. To reconcile the omapdrm and omapdss drivers with the DRM bridge and panel model, we need to reverse the direction of the DSS device operations. Start with the connect and disconnect operations. Signed-off-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/omap_drv.c') diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index f10e5053580b..0052f151bf7a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -157,11 +157,14 @@ static void omap_disconnect_pipelines(struct drm_device *ddev) unsigned int i; for (i = 0; i < priv->num_pipes; i++) { - struct omap_dss_device *display = priv->pipes[i].display; + struct omap_drm_pipeline *pipe = &priv->pipes[i]; + + omapdss_device_disconnect(NULL, pipe->output); - omapdss_device_disconnect(display, NULL); - priv->pipes[i].display = NULL; - omapdss_device_put(display); + omapdss_device_put(pipe->output); + omapdss_device_put(pipe->display); + pipe->output = NULL; + pipe->display = NULL; } priv->num_pipes = 0; @@ -182,26 +185,30 @@ static int omap_compare_pipes(const void *a, const void *b) static int omap_connect_pipelines(struct drm_device *ddev) { struct omap_drm_private *priv = ddev->dev_private; - struct omap_dss_device *display = NULL; + struct omap_dss_device *output = NULL; int r; if (!omapdss_stack_is_ready()) return -EPROBE_DEFER; - for_each_dss_display(display) { - r = omapdss_device_connect(priv->dss, display, NULL); + for_each_dss_output(output) { + r = omapdss_device_connect(priv->dss, NULL, output); if (r == -EPROBE_DEFER) { - omapdss_device_put(display); + omapdss_device_put(output); goto cleanup; } else if (r) { - dev_warn(display->dev, "could not connect display: %s\n", - display->name); + dev_warn(output->dev, "could not connect output %s\n", + output->name); } else { - omapdss_device_get(display); - priv->pipes[priv->num_pipes++].display = display; + struct omap_drm_pipeline *pipe; + + pipe = &priv->pipes[priv->num_pipes++]; + pipe->output = omapdss_device_get(output); + pipe->display = omapdss_display_get(output); + if (priv->num_pipes == ARRAY_SIZE(priv->pipes)) { - /* To balance the 'for_each_dss_display' loop */ - omapdss_device_put(display); + /* To balance the 'for_each_dss_output' loop */ + omapdss_device_put(output); break; } } -- cgit v1.2.3