For DP bridges, that can be used for DP AltMode, it might be necessary
to enforce HPD status. There is an existing ->oob_hotplug_event() on
the DRM connector, but it currently just calls into hpd_notify().

As DP bridge drivers usually also implement .detect and that also
generates calls into hpd_notify, this is a bad place to force the
HPD status as the follow-up detect call might force it off again
resulting in all follow-up calls to the detection routine also
failing.

Avoid this by having a dedicated function for OOB events.

Signed-off-by: Sebastian Reichel <[email protected]>
---
 drivers/gpu/drm/display/drm_bridge_connector.c |  6 ++++++
 include/drm/drm_bridge.h                       | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c 
b/drivers/gpu/drm/display/drm_bridge_connector.c
index 92f8a2d7aab4..802b5677194b 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -180,6 +180,12 @@ static void drm_bridge_connector_oob_hotplug_event(struct 
drm_connector *connect
        struct drm_bridge_connector *bridge_connector =
                to_drm_bridge_connector(connector);
 
+       /* Notify all bridges in the pipeline of hotplug events. */
+       drm_for_each_bridge_in_chain_scoped(bridge_connector->encoder, bridge) {
+               if (bridge->funcs->oob_notify)
+                       bridge->funcs->oob_notify(bridge, connector, status);
+       }
+
        drm_bridge_connector_handle_hpd(bridge_connector, status);
 }
 
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 00a95f927e34..11802e39d1f1 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -646,6 +646,20 @@ struct drm_bridge_funcs {
         */
        void (*hpd_disable)(struct drm_bridge *bridge);
 
+       /**
+        * @oob_notify:
+        *
+        * Notify the bridge of out of band hot plug detection.
+        *
+        * This callback is optional, it may be implemented by bridges that
+        * need to be notified of display connection or disconnection for
+        * internal reasons. One use case is to force the DP controllers HPD
+        * signal for USB-C DP AltMode.
+        */
+       void (*oob_notify)(struct drm_bridge *bridge,
+                          struct drm_connector *connector,
+                          enum drm_connector_status status);
+
        /**
         * @hdmi_tmds_char_rate_valid:
         *

-- 
2.53.0

Reply via email to