@@ -21,7 +21,9 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
+#include <drm/drm_bridge_connector.h>
#include <drm/drm_fb_helper.h>
+#include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h>
#include "omap_dmm_tiler.h"
@@ -296,9 +298,13 @@ static int omap_modeset_init(struct drm_device *dev)
if (pipe->output->bridge) {
ret = drm_bridge_attach(pipe->encoder,
pipe->output->bridge, NULL,
- true);
- if (ret < 0)
+ false);
+ if (ret < 0) {
+ dev_err(priv->dev,
+ "unable to attach bridge %pOF\n",
+ pipe->output->bridge->of_node);
return ret;
+ }
}
id = omap_display_id(pipe->output);
@@ -334,8 +340,31 @@ static int omap_modeset_init(struct drm_device *dev)
encoder);
if (!pipe->connector)
return -ENOMEM;
+ } else {
+ struct drm_bridge *bridge = pipe->output->bridge;
- drm_connector_attach_encoder(pipe->connector, encoder);
+ pipe->connector = drm_bridge_connector_init(dev,
+ bridge);
+ if (IS_ERR(pipe->connector)) {
+ dev_err(priv->dev,
+ "unable to create bridge connector for %pOF\n",
+ bridge->of_node);
+ return PTR_ERR(pipe->connector);
+ }
+ }
+
+ drm_connector_attach_encoder(pipe->connector, encoder);
+
+ /*
+ * FIXME: drm_panel should not store the drm_connector pointer
+ * internally but should receive it in its .get_modes()
+ * operation.
+ */
+ 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]);
@@ -400,8 +429,15 @@ static void omap_modeset_enable_external_hpd(struct drm_device *ddev)
unsigned int i;
for (i = 0; i < priv->num_pipes; i++) {
- if (priv->pipes[i].connector)
- omap_connector_enable_hpd(priv->pipes[i].connector);
+ struct drm_connector *connector = priv->pipes[i].connector;
+
+ if (!connector)
+ continue;
+
+ if (priv->pipes[i].output->next)
+ omap_connector_enable_hpd(connector);
+ else
+ drm_bridge_connector_enable_hpd(connector);
}
}
@@ -414,8 +450,15 @@ static void omap_modeset_disable_external_hpd(struct drm_device *ddev)
unsigned int i;
for (i = 0; i < priv->num_pipes; i++) {
- if (priv->pipes[i].connector)
- omap_connector_disable_hpd(priv->pipes[i].connector);
+ struct drm_connector *connector = priv->pipes[i].connector;
+
+ if (!connector)
+ continue;
+
+ if (priv->pipes[i].output->next)
+ omap_connector_disable_hpd(connector);
+ else
+ drm_bridge_connector_disable_hpd(connector);
}
}
Use the drm_bridge_connector helper to create a connector for pipelines that use drm_bridge. This allows splitting connector operations across multiple bridges when necessary, instead of having the last bridge in the chain creating the connector and handling all connector operations internally. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- drivers/gpu/drm/omapdrm/omap_drv.c | 57 ++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 7 deletions(-)