drm: remove drm_bridge_hpd_disable() from drm_bridge_connector_destroy()
authorAbhinav Kumar <quic_abhinavk@quicinc.com>
Tue, 19 Sep 2023 17:48:12 +0000 (10:48 -0700)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sun, 3 Dec 2023 18:22:02 +0000 (20:22 +0200)
drm_bridge_hpd_enable()/drm_bridge_hpd_disable() callbacks call into
the respective driver's hpd_enable()/hpd_disable() ops. These ops control
the HPD enable/disable logic which in some cases like MSM can be a
dedicate hardware block to control the HPD.

During probe_defer cases, a connector can be initialized and then later
destroyed till the probe is retried. During connector destroy in these
cases, the hpd_disable() callback gets called without a corresponding
hpd_enable() leading to an unbalanced state potentially causing even
a crash.

This can be avoided by the respective drivers maintaining their own
state logic to ensure that a hpd_disable() without a corresponding
hpd_enable() just returns without doing anything.

However, to have a generic fix it would be better to avoid the
hpd_disable() callback from the connector destroy path and let
the hpd_enable() / hpd_disable() balance be maintained by the
corresponding drm_bridge_connector_enable_hpd() /
drm_bridge_connector_disable_hpd() APIs which should get called by
drm_kms_helper_disable_hpd().

changes in v2:
- minor change in commit text (Dmitry)

Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230919174813.26958-1-quic_abhinavk@quicinc.com
drivers/gpu/drm/drm_bridge_connector.c

index 8239ad43aed58c4112cc4e791df3889dead6aa5c..3acd67021ec62fbb4699cd7b05e97c3632d36511 100644 (file)
@@ -198,12 +198,6 @@ static void drm_bridge_connector_destroy(struct drm_connector *connector)
        struct drm_bridge_connector *bridge_connector =
                to_drm_bridge_connector(connector);
 
-       if (bridge_connector->bridge_hpd) {
-               struct drm_bridge *hpd = bridge_connector->bridge_hpd;
-
-               drm_bridge_hpd_disable(hpd);
-       }
-
        drm_connector_unregister(connector);
        drm_connector_cleanup(connector);