mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Liu Ying <victor.liu@nxp.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
Subject: [PATCH 1/2] drm/bridge: dw-hdmi: use connector->display_info for HDMI and audio detection
Date: Thu,  3 Dec 2026 01:03:39 +0100	[thread overview]
Message-ID: <20261203000340.10415-2-gianfranco.mariotti94@gmail.com> (raw)
In-Reply-To: <20261203000340.10415-1-gianfranco.mariotti94@gmail.com>

Currently dw-hdmi only updates hdmi->sink_is_hdmi and
hdmi->sink_has_audio inside dw_hdmi_edid_read() using the deprecated
drm_edid_raw(), drm_detect_hdmi_monitor(), and drm_detect_monitor_audio()
helpers.

This has three issues:
1. When chained to a standalone display-connector (e.g. hdmi-connector
   with its own ddc-i2c-bus), drm_bridge_connector reads EDID through the
   downstream connector bridge and populates connector->display_info,
   bypassing dw_hdmi_edid_read() and leaving sink_is_hdmi and
   sink_has_audio false even for HDMI monitors.
2. When an EDID override or firmware EDID is active,
   connector->display_info reflects the overridden EDID while
   dw_hdmi_edid_read() may not run.
3. When an EDID read fails after a previous HDMI monitor was unplugged,
   dw_hdmi_edid_read() returns NULL without clearing the stale flags,
   whereas drm_edid_connector_update(connector, NULL) resets
   connector->display_info.

Resolve the FIXME in dw_hdmi_edid_read() by latching
connector->display_info.is_hdmi and connector->display_info.has_audio in
dw_hdmi_bridge_atomic_enable() under hdmi->mutex before calling
dw_hdmi_update_power(). Capturing them in .atomic_enable() (rather than
in dw_hdmi_setup()) also avoids racing with connector->display_info
updates and preserves the cached HDMI/audio flags across transient
hotplug unplug/replug cycles handled inside dw_hdmi_irq() before
userspace re-reads EDID.

Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index d63cd7a9f243b..e24fd67264ce1 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2471,7 +2471,6 @@ static const struct drm_edid *dw_hdmi_edid_read(struct dw_hdmi *hdmi,
 						struct drm_connector *connector)
 {
 	const struct drm_edid *drm_edid;
-	const struct edid *edid;
 
 	if (!hdmi->ddc)
 		return NULL;
@@ -2482,19 +2481,6 @@ static const struct drm_edid *dw_hdmi_edid_read(struct dw_hdmi *hdmi,
 		return NULL;
 	}
 
-	/*
-	 * FIXME: This should use connector->display_info.is_hdmi and
-	 * connector->display_info.has_audio from a path that has read the EDID
-	 * and called drm_edid_connector_update().
-	 */
-	edid = drm_edid_raw(drm_edid);
-
-	dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
-		edid->width_cm, edid->height_cm);
-
-	hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
-	hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
-
 	return drm_edid;
 }
 
@@ -3006,10 +2992,14 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge,
 
 	connector = drm_atomic_get_new_connector_for_encoder(state,
 							     bridge->encoder);
+	if (WARN_ON(!connector))
+		return;
 
 	mutex_lock(&hdmi->mutex);
 	hdmi->disabled = false;
 	hdmi->curr_conn = connector;
+	hdmi->sink_is_hdmi = connector->display_info.is_hdmi;
+	hdmi->sink_has_audio = connector->display_info.has_audio;
 	dw_hdmi_update_power(hdmi);
 	dw_hdmi_update_phy_mask(hdmi);
 	handle_plugged_change(hdmi, true);
-- 
2.25.1


  reply	other threads:[~2026-12-03  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  0:03 [PATCH 0/2] drm/bridge: dw-hdmi: use display_info and support non-HDMI downstream connectors Gianfranco Mariotti
2026-12-03  0:03 ` Gianfranco Mariotti [this message]
2026-12-03  0:03 ` [PATCH 2/2] drm/bridge: dw-hdmi: enable HDMI mode for non-HDMI/DVI " Gianfranco Mariotti

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=20261203000340.10415-2-gianfranco.mariotti94@gmail.com \
    --to=gianfranco.mariotti94@gmail.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=victor.liu@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®