Commit a779618b authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: Use the drm_panel_bridge API

Replace the manual panel handling code by a drm_panel_bridge. This
simplifies the driver and allows all components in the display pipeline
to be treated as bridges, paving the way to generic connector handling.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-25-laurent.pinchart@ideasonboard.com
parent 514fc910
......@@ -149,8 +149,7 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
goto done;
}
if (dssdev->id &&
(dssdev->next || dssdev->bridge || dssdev->panel))
if (dssdev->id && (dssdev->next || dssdev->bridge))
goto done;
}
......@@ -185,11 +184,10 @@ int omapdss_device_connect(struct dss_device *dss,
if (!dst) {
/*
* The destination is NULL when the source is connected to a
* bridge or panel instead of a DSS device. Stop here, we will
* attach the bridge or panel later when we will have a DRM
* encoder.
* bridge instead of a DSS device. Stop here, we will attach
* the bridge later when we will have a DRM encoder.
*/
return src && (src->bridge || src->panel) ? 0 : -EINVAL;
return src && src->bridge ? 0 : -EINVAL;
}
if (omapdss_device_is_connected(dst))
......@@ -217,7 +215,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
dst ? dev_name(dst->dev) : "NULL");
if (!dst) {
WARN_ON(!src->bridge && !src->panel);
WARN_ON(!src->bridge);
return;
}
......
......@@ -21,6 +21,7 @@
int omapdss_device_init_output(struct omap_dss_device *out)
{
struct device_node *remote_node;
int ret;
remote_node = of_graph_get_remote_node(out->dev->of_node,
ffs(out->of_ports) - 1, 0);
......@@ -39,17 +40,39 @@ int omapdss_device_init_output(struct omap_dss_device *out)
if (out->next && out->type != out->next->type) {
dev_err(out->dev, "output type and display type don't match\n");
omapdss_device_put(out->next);
out->next = NULL;
return -EINVAL;
ret = -EINVAL;
goto error;
}
if (out->panel) {
struct drm_bridge *bridge;
bridge = drm_panel_bridge_add(out->panel);
if (IS_ERR(bridge)) {
dev_err(out->dev,
"unable to create panel bridge (%ld)\n",
PTR_ERR(bridge));
ret = PTR_ERR(bridge);
goto error;
}
return out->next || out->bridge || out->panel ? 0 : -EPROBE_DEFER;
out->bridge = bridge;
}
return out->next || out->bridge ? 0 : -EPROBE_DEFER;
error:
omapdss_device_put(out->next);
out->next = NULL;
return ret;
}
EXPORT_SYMBOL(omapdss_device_init_output);
void omapdss_device_cleanup_output(struct omap_dss_device *out)
{
if (out->bridge && out->panel)
drm_panel_bridge_remove(out->bridge);
if (out->next)
omapdss_device_put(out->next);
}
......
......@@ -6,7 +6,6 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h>
#include "omap_drv.h"
......@@ -190,7 +189,6 @@ static int omap_connector_get_modes_edid(struct drm_connector *connector,
static int omap_connector_get_modes(struct drm_connector *connector)
{
struct omap_connector *omap_connector = to_omap_connector(connector);
struct omap_dss_device *dssdev;
DBG("%s", connector->name);
......@@ -213,14 +211,6 @@ static int omap_connector_get_modes(struct drm_connector *connector)
if (dssdev)
return dssdev->ops->get_modes(dssdev, connector);
/*
* Otherwise if the display pipeline uses a drm_panel, we delegate the
* operation to the panel API.
*/
if (omap_connector->output->panel)
return drm_panel_get_modes(omap_connector->output->panel,
connector);
/*
* We can't retrieve modes, which can happen for instance for a DVI or
* VGA output with the DDC bus unconnected. The KMS core will add the
......
......@@ -16,7 +16,6 @@
#include <drm/drm_fb_helper.h>
#include <drm/drm_file.h>
#include <drm/drm_ioctl.h>
#include <drm/drm_panel.h>
#include <drm/drm_prime.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
......@@ -134,9 +133,6 @@ static void omap_disconnect_pipelines(struct drm_device *ddev)
for (i = 0; i < priv->num_pipes; i++) {
struct omap_drm_pipeline *pipe = &priv->pipes[i];
if (pipe->output->panel)
drm_panel_detach(pipe->output->panel);
omapdss_device_disconnect(NULL, pipe->output);
omapdss_device_put(pipe->output);
......@@ -221,8 +217,6 @@ static int omap_display_id(struct omap_dss_device *output)
bridge = drm_bridge_get_next_bridge(bridge);
node = bridge->of_node;
} else if (output->panel) {
node = output->panel->dev->of_node;
}
return node ? of_alias_get_id(node, "display") : -ENODEV;
......@@ -337,13 +331,6 @@ static int omap_modeset_init(struct drm_device *dev)
return -ENOMEM;
drm_connector_attach_encoder(pipe->connector, encoder);
if (pipe->output->panel) {
ret = drm_panel_attach(pipe->output->panel,
pipe->connector);
if (ret < 0)
return ret;
}
}
crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
......
......@@ -10,7 +10,6 @@
#include <drm/drm_crtc.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_edid.h>
#include <drm/drm_panel.h>
#include "omap_drv.h"
......@@ -157,12 +156,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
/* Disable the panel if present. */
if (dssdev->panel) {
drm_panel_disable(dssdev->panel);
drm_panel_unprepare(dssdev->panel);
}
/*
* Disable the chain of external devices, starting at the one at the
* internal encoder's output.
......@@ -212,12 +205,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
* internal encoder's output.
*/
omapdss_device_enable(dssdev->next);
/* Enable the panel if present. */
if (dssdev->panel) {
drm_panel_prepare(dssdev->panel);
drm_panel_enable(dssdev->panel);
}
}
static int omap_encoder_atomic_check(struct drm_encoder *encoder,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment