All of lore.kernel.org
 help / color / mirror / Atom feed
From: Binbin Zhou <zhoubb.aaron@gmail.com>
To: alexander.deucher@amd.com, hristian.koenig@amd.com
Cc: zhoubinbin@uniontech.com, Binbin Zhou <zhoubb.aaron@gmail.com>,
	amd-gfx@lists.freedesktop.org
Subject: [PATCH] drm/admgpu: check HDMI HPD status after ddc probe
Date: Sat,  9 May 2020 13:48:34 +0800	[thread overview]
Message-ID: <20200509054834.21484-1-zhoubb.aaron@gmail.com> (raw)

Now, we check the presence of the EDID to determine if there is a monitor
present.

DVI-I connectors have both analog and digital encoders and the HPD pin
is only reliable on the digital part.

But when I pull out the Radeon HD8570's HDMI connector, the HDMI status
in system is still perform connected.

asd@asd-PC:~$ cat /sys/class/drm/card0-HDMI-A-1/status 
connected

At this moment, if I want to read the EDID by /dev/i2c-X with I2C
driver, there is no EDID can be read.

Dmesg witha drm.debug=0x6, we can find the following message:

[drm:drm_helper_hpd_irq_event] [CONNECTOR:41:HDMI-A-1] status
updated from connected to connected

Based on the appearance, I thought to check the HPD status again, because
the HPD status is perform disconnected, after amdgpu_display_ddc_probe().
If the amdgpu_display_hpd_sense() return false, I think the HDMI connector
status is undefined, and just return disconnected simply.

I'm not sure if it happened to other AMD cards.

Signed-off-by: Binbin Zhou <zhoubb.aaron@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index f355d9a752d2..ee657db9a228 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -973,7 +973,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
 	const struct drm_encoder_helper_funcs *encoder_funcs;
 	int r;
 	enum drm_connector_status ret = connector_status_disconnected;
-	bool dret = false, broken_edid = false;
+	bool dret = false, broken_edid = false, undefined_flag = false;
 
 	if (!drm_kms_helper_is_poll_worker()) {
 		r = pm_runtime_get_sync(connector->dev->dev);
@@ -988,7 +988,12 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
 
 	if (amdgpu_connector->ddc_bus)
 		dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
-	if (dret) {
+
+	/* Check the HDMI HPD pin status again */
+	if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd))
+		undefined_flag = true;
+
+	if (dret && !undefined_flag) {
 		amdgpu_connector->detected_by_load = false;
 		amdgpu_connector_free_edid(connector);
 		amdgpu_connector_get_edid(connector);
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2020-05-09  5:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  5:48 Binbin Zhou [this message]
2020-05-09 13:35 ` [PATCH] drm/admgpu: check HDMI HPD status after ddc probe Alex Deucher
2020-05-11  1:45   ` Aaron Chou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200509054834.21484-1-zhoubb.aaron@gmail.com \
    --to=zhoubb.aaron@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=hristian.koenig@amd.com \
    --cc=zhoubinbin@uniontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.