diff mbox

[RFC,2/3] drm/bridge: panel: Make use of the panel detection infrastructure

Message ID 20180430144323.9233-3-boris.brezillon@bootlin.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Brezillon April 30, 2018, 2:43 p.m. UTC
The DRM panel framework now exposes a way to know whether a panel is
connected or disconnected.

Use this panel detection logic to implement the connector->detect_ctx()
method and allow one to report when a panel is connected or disconnected
which is particularly useful to support panels connected through
extension boards.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 drivers/gpu/drm/bridge/panel.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
index 6d99d4a3beb3..195deb651243 100644
--- a/drivers/gpu/drm/bridge/panel.c
+++ b/drivers/gpu/drm/bridge/panel.c
@@ -44,9 +44,21 @@  static int panel_bridge_connector_get_modes(struct drm_connector *connector)
 	return drm_panel_get_modes(panel_bridge->panel);
 }
 
+static int
+panel_bridge_connector_detect_ctx(struct drm_connector *connector,
+				  struct drm_modeset_acquire_ctx *ctx,
+				  bool force)
+{
+	struct panel_bridge *panel_bridge =
+		drm_connector_to_panel_bridge(connector);
+
+	return drm_panel_detect(panel_bridge->panel);
+}
+
 static const struct drm_connector_helper_funcs
 panel_bridge_connector_helper_funcs = {
 	.get_modes = panel_bridge_connector_get_modes,
+	.detect_ctx = panel_bridge_connector_detect_ctx,
 };
 
 static const struct drm_connector_funcs panel_bridge_connector_funcs = {
@@ -68,6 +80,7 @@  static int panel_bridge_attach(struct drm_bridge *bridge)
 		return -ENODEV;
 	}
 
+	connector->polled = panel_bridge->panel->polled;
 	drm_connector_helper_add(connector,
 				 &panel_bridge_connector_helper_funcs);