Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30b71761 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen
Browse files

drm/omap: Add support for drm_panel



Hook up drm_panel support in the omapdrm driver. The change is
relatively simply as the way has been paved by drm_bridge support
already. In addition to looking up, attaching to and detaching from the
panel, we only need to add panel support in the connector .get_modes()
handler, take connector bus flags (set by the panel) into account, and
enable/disable the panel in the encoder enable/disable operations
handlers.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 79107f27
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -157,7 +157,8 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
			goto done;
		}

		if (dssdev->id && (dssdev->next || dssdev->bridge))
		if (dssdev->id &&
		    (dssdev->next || dssdev->bridge || dssdev->panel))
			goto done;
	}

@@ -192,10 +193,11 @@ int omapdss_device_connect(struct dss_device *dss,
	if (!dst) {
		/*
		 * The destination is NULL when the source is connected to a
		 * bridge instead of a DSS device. Stop here, we will attach the
		 * bridge later when we will have a DRM encoder.
		 * 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.
		 */
		return src && src->bridge ? 0 : -EINVAL;
		return src && (src->bridge || src->panel) ? 0 : -EINVAL;
	}

	if (omapdss_device_is_connected(dst))
@@ -223,7 +225,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
		dst ? dev_name(dst->dev) : "NULL");

	if (!dst) {
		WARN_ON(!src->bridge);
		WARN_ON(!src->bridge && !src->panel);
		return;
	}

+1 −0
Original line number Diff line number Diff line
@@ -411,6 +411,7 @@ struct omap_dss_device {
	struct dss_device *dss;
	struct omap_dss_device *next;
	struct drm_bridge *bridge;
	struct drm_panel *panel;

	struct list_head list;

+6 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@
#include <linux/of.h>
#include <linux/of_graph.h>

#include <drm/drm_panel.h>

#include "dss.h"
#include "omapdss.h"

@@ -37,6 +39,9 @@ int omapdss_device_init_output(struct omap_dss_device *out)

	out->next = omapdss_find_device_by_node(remote_node);
	out->bridge = of_drm_find_bridge(remote_node);
	out->panel = of_drm_find_panel(remote_node);
	if (IS_ERR(out->panel))
		out->panel = NULL;

	of_node_put(remote_node);

@@ -47,7 +52,7 @@ int omapdss_device_init_output(struct omap_dss_device *out)
		return -EINVAL;
	}

	return out->next || out->bridge ? 0 : -EPROBE_DEFER;
	return out->next || out->bridge || out->panel ? 0 : -EPROBE_DEFER;
}
EXPORT_SYMBOL(omapdss_device_init_output);

+9 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#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"
@@ -211,6 +212,7 @@ 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);
@@ -233,6 +235,13 @@ 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);

	/*
	 * 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
+14 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_panel.h>

#include "omap_dmm_tiler.h"
#include "omap_drv.h"
@@ -137,6 +138,9 @@ 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);
@@ -214,13 +218,15 @@ static int omap_display_id(struct omap_dss_device *output)
		display = omapdss_display_get(output);
		node = display->dev->of_node;
		omapdss_device_put(display);
	} else {
	} else if (output->bridge) {
		struct drm_bridge *bridge = output->bridge;

		while (bridge->next)
			bridge = bridge->next;

		node = bridge->of_node;
	} else if (output->panel) {
		node = output->panel->dev->of_node;
	}

	return node ? of_alias_get_id(node, "display") : -ENODEV;
@@ -335,6 +341,13 @@ 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]);
Loading