From: Baihan Li <libai...@huawei.com>

If the system started with VGA connected, the desktop like GDM cannot get
DP's CRTC when DP device is plugged in, because there is only one crtc
sharing use of VGA and DP. So change VGA to disconnected when DP is
connected.

Fixes: 4c962bc929f1 ("drm/hisilicon/hibmc: Add vga connector detect functions")
Signed-off-by: Baihan Li <libai...@huawei.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
index 36401b46034c..73dd3d5fc26c 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
@@ -49,6 +49,18 @@ static int hibmc_connector_get_modes(struct drm_connector 
*connector)
        return count;
 }
 
+static int hibmc_vdac_detect(struct drm_connector *connector, struct 
drm_modeset_acquire_ctx *ctx,
+                            bool force)
+{
+       struct hibmc_drm_private *priv = to_hibmc_drm_private(connector->dev);
+       struct hibmc_dp *dp = &priv->dp;
+
+       if (dp->hpd_status)
+               return connector_status_disconnected;
+
+       return connector_status_connected;
+}
+
 static void hibmc_connector_destroy(struct drm_connector *connector)
 {
        struct hibmc_vdac *vdac = to_hibmc_vdac(connector);
@@ -60,7 +72,7 @@ static void hibmc_connector_destroy(struct drm_connector 
*connector)
 static const struct drm_connector_helper_funcs
        hibmc_connector_helper_funcs = {
        .get_modes = hibmc_connector_get_modes,
-       .detect_ctx = drm_connector_helper_detect_from_ddc,
+       .detect_ctx = hibmc_vdac_detect,
 };
 
 static const struct drm_connector_funcs hibmc_connector_funcs = {
-- 
2.33.0

Reply via email to