| Message ID | 20260518180206.2480119-14-jonas@kwiboo.se (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-23514-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id 904241C0029 for <noreply@patchwork.local>; Mon, 18 May 2026 20:05:02 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=kwiboo.se; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-23514-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-23514-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id D49E130531D4 for <noreply@patchwork.local>; Mon, 18 May 2026 18:03:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 016E327E1D7; Mon, 18 May 2026 18:03:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="Pbgpp2PG" X-Original-To: linux-sunxi@lists.linux.dev Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0259D384258 for <linux-sunxi@lists.linux.dev>; Mon, 18 May 2026 18:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127393; cv=none; b=UN/L979J1fGrOx1LfM5/PmdoK4X5XchZ97j3hmAyCT6nFHFe5CknkOnZeJ7W66KmTuHb3Iqbd3mCNcRoIg+qCfmTB9ZdK58jkVXSzkA3tfUeUqo+FxJUVWM3ALPxxgH+i0BDI2qaBpOLIJVfv3ZBTZNpQmctu10jTPW85V3GN38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127393; c=relaxed/simple; bh=OtMHuXOw5CZXWHUwo68fFhxzMybcZloconXv/fdFaB0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kcBjCl8uDYBQGzhqpN9GC3irgZSWlq6DUEjnP1wbeYXq/fty8x0qinXY/svhwAQQJGIOHjP4oJ4fIl4vdYsGrnNSI7OJSZ8NiHMRzagjl+WK6vvIY1vCWvktcqWQ7GaxpdHQIocqJHlP/mAQi5tGt5QrU9YDOsyWq2gVOACescs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=Pbgpp2PG; arc=none smtp.client-ip=121.127.44.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1779127391; bh=lr3z/DHKRf4suiaEwJ9iTpcatjgqAyObdCZqCekB2Iw=; b=Pbgpp2PGg/C8Dy2k/6XgldOI/MPH7aK93OfzC3x8xfLXEdig9kFi2qDPdgAV4ppNQ/wSBjaAw nv6iOhxHUa8EjM34sVe+p5Ts9G08iZ7dJmFMKvAzMyJgxurEJKhSgf5KltSuT3Z01onKqNUM/GO fdNxIWDhUSCNsV6q2gfU0rTZDeihgVzI04OJNfPcfbfzaJH8roesYmpkqqfqF38Qn4M4BHjCB4x F3aBR6xkNsJsmZn3WzN8dlvlWCT/s/fCDLCkd7EmrNgNG0wYShd0WLiUqv9gQKPv0LfH/e3JPjj ecsWbldy1pm9LS5LCNZgw14XkpCs1N1ncpybr9bbnR/A== X-Forward-Email-ID: 6a0b545db84dbc72d2274f08 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.66 X-Forward-Email-Version: 2.8.12 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: Jonas Karlman <jonas@kwiboo.se> To: Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Heiko Stuebner <heiko@sntech.de>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, Luca Ceresoli <luca.ceresoli@bootlin.com>, 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> Cc: Liu Ying <victor.liu@nxp.com>, Sandy Huang <hjc@rock-chips.com>, Andy Yan <andy.yan@rock-chips.com>, Chen-Yu Tsai <wens@kernel.org>, Christian Hewitt <christianshewitt@gmail.com>, Diederik de Haas <diederik@cknow-tech.com>, Nicolas Frattaroli <nicolas.frattaroli@collabora.com>, Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, imx@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v7 13/23] drm: bridge: dw_hdmi: Use dw_hdmi_connector_status_update() Date: Mon, 18 May 2026 18:01:49 +0000 Message-ID: <20260518180206.2480119-14-jonas@kwiboo.se> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260518180206.2480119-1-jonas@kwiboo.se> References: <20260518180206.2480119-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-0.66 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[28]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[collabora.com:email,tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo,cknow-tech.com:email,kwiboo.se:email,kwiboo.se:dkim]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[nxp.com,rock-chips.com,kernel.org,gmail.com,cknow-tech.com,collabora.com,oss.qualcomm.com,lists.freedesktop.org,lists.infradead.org,lists.linux.dev,vger.kernel.org]; R_DKIM_ALLOW(0.00)[kwiboo.se:s=fe-e1b5cab7be]; FROM_NEQ_ENVFROM(0.00)[jonas@kwiboo.se,linux-sunxi@lists.linux.dev]; DMARC_POLICY_ALLOW(0.00)[kwiboo.se,quarantine]; FREEMAIL_TO(0.00)[intel.com,linaro.org,kernel.org,sntech.de,ideasonboard.com,kwiboo.se,gmail.com,bootlin.com,linux.intel.com,suse.de,ffwll.ch]; DKIM_TRACE(0.00)[kwiboo.se:+]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114:c]; RCVD_COUNT_THREE(0.00)[4]; FORGED_SENDER_MAILLIST(0.00)[]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-23514-noreply=patchwork.local]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; TO_DN_SOME(0.00)[] X-Rspamd-Queue-Id: 904241C0029 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
drm: bridge: dw_hdmi: Misc enable/disable, CEC and EDID cleanup
|
|
Commit Message
Jonas Karlman
May 18, 2026, 6:01 p.m. UTC
Update connector EDID and CEC phys addr from detect and force funcs to ensure that userspace always have access to latest read EDID after a sink use a HPD low voltage pulse to indicate that EDID has changed. With EDID being updated in detect and force funcs, there should no longer be a need to re-read EDID in get_modes funcs, so drop it. This change make the dw-hdmi connector work more closely like the bridge connector does with a hdmi bridge. Reviewed-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Tested-by: Diederik de Haas <diederik@cknow-tech.com> # Rock64, RockPro64, Quartz64-B Signed-off-by: Jonas Karlman <jonas@kwiboo.se> --- v7: No change v6: Pass struct dw_hdmi as a parameter, Collect t-b tag v5: No change v4: Move last_connector_result assign in force ops to this patch, Collect r-b tag v3: Reworked 'Update EDID during hotplug processing' patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-)
Comments
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The CEC physical address is no longer set when the connector status is `connector_status_unknown`, breaking CEC functionality for displays with unreliable HPD. - [High] Unconditional EDID read over I2C in `detect()` ignores the `force` parameter, causing severe performance degradation and I2C spam. -- commit d5d270011a2b02f003218ae7b96f62fae2b447e9 Author: Jonas Karlman <jonas@kwiboo.se> drm: bridge: dw_hdmi: Use dw_hdmi_connector_status_update() This commit updates the dw-hdmi connector to fetch EDID and update CEC physical addresses during detect and force functions rather than in get_modes. It aims to ensure userspace always has access to the latest read EDID. > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c [ ... ] > @@ -2473,36 +2473,36 @@ dw_hdmi_connector_status_update(struct dw_hdmi *hdmi, [ ... ] > drm_edid = dw_hdmi_edid_read(hdmi, connector); > drm_edid_connector_update(connector, drm_edid); > drm_edid_free(drm_edid); > > - cec_notifier_set_phys_addr(hdmi->cec_notifier, > - connector->display_info.source_physical_address); > + if (status == connector_status_connected) > + cec_notifier_set_phys_addr(hdmi->cec_notifier, > + connector->display_info.source_physical_address); > } Does this break CEC functionality for displays with unreliable HPD? By guarding the cec_notifier_set_phys_addr() call with a check for connector_status_connected, the CEC physical address update is skipped if the status evaluates to connector_status_unknown. Previously, this was called unconditionally after a successful EDID read, which allowed CEC to work even when HPD was unreliable. > static enum drm_connector_status > dw_hdmi_connector_detect(struct drm_connector *connector, bool force) > { > - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, > - connector); > + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); > enum drm_connector_status status; > > status = dw_hdmi_detect(hdmi); > > - if (status == connector_status_disconnected) > - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); > + dw_hdmi_connector_status_update(hdmi, connector, status); Will this cause performance issues by performing unconditional I2C EDID reads on every detect call? The dw_hdmi_connector_status_update() function reads the EDID over I2C unless the status is disconnected, but this completely ignores the force parameter passed to detect. If a system-wide hotplug event occurs on another port, drm_helper_hpd_irq_event() will call detect with force=false on all HPD-capable connectors. Could this trigger an unnecessary 20-50ms I2C EDID read here, spamming the I2C bus and blocking the shared KMS system workqueue? > > return status; > }
On 18/05/2026 20:01, Jonas Karlman wrote: > Update connector EDID and CEC phys addr from detect and force funcs to > ensure that userspace always have access to latest read EDID after a > sink use a HPD low voltage pulse to indicate that EDID has changed. > > With EDID being updated in detect and force funcs, there should no > longer be a need to re-read EDID in get_modes funcs, so drop it. > > This change make the dw-hdmi connector work more closely like the bridge > connector does with a hdmi bridge. > > Reviewed-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> > Tested-by: Diederik de Haas <diederik@cknow-tech.com> # Rock64, RockPro64, Quartz64-B > Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Acked-by: Hans Verkuil <hverkuil+cisco@kernel.org> Regards, Hans > --- > v7: No change > v6: Pass struct dw_hdmi as a parameter, > Collect t-b tag > v5: No change > v4: Move last_connector_result assign in force ops to this patch, > Collect r-b tag > v3: Reworked 'Update EDID during hotplug processing' patch > --- > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 28 ++++++++++++----------- > 1 file changed, 15 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > index a056e147731b..a4ecf830103d 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > @@ -2473,36 +2473,36 @@ dw_hdmi_connector_status_update(struct dw_hdmi *hdmi, > { > const struct drm_edid *drm_edid; > > + if (status == connector_status_disconnected) { > + drm_edid_connector_update(connector, NULL); > + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); > + return; > + } > + > drm_edid = dw_hdmi_edid_read(hdmi, connector); > drm_edid_connector_update(connector, drm_edid); > drm_edid_free(drm_edid); > > - cec_notifier_set_phys_addr(hdmi->cec_notifier, > - connector->display_info.source_physical_address); > + if (status == connector_status_connected) > + cec_notifier_set_phys_addr(hdmi->cec_notifier, > + connector->display_info.source_physical_address); > } > > static enum drm_connector_status > dw_hdmi_connector_detect(struct drm_connector *connector, bool force) > { > - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, > - connector); > + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); > enum drm_connector_status status; > > status = dw_hdmi_detect(hdmi); > > - if (status == connector_status_disconnected) > - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); > + dw_hdmi_connector_status_update(hdmi, connector, status); > > return status; > } > > static int dw_hdmi_connector_get_modes(struct drm_connector *connector) > { > - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, > - connector); > - > - dw_hdmi_connector_status_update(hdmi, connector, connector->status); > - > return drm_edid_connector_add_modes(connector); > } > > @@ -2532,13 +2532,15 @@ static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, > > static void dw_hdmi_connector_force(struct drm_connector *connector) > { > - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, > - connector); > + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); > > mutex_lock(&hdmi->mutex); > hdmi->force = connector->force; > + hdmi->last_connector_result = connector->status; > dw_hdmi_update_phy_mask(hdmi); > mutex_unlock(&hdmi->mutex); > + > + dw_hdmi_connector_status_update(hdmi, connector, connector->status); > } > > static void dw_hdmi_connector_destroy(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index a056e147731b..a4ecf830103d 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2473,36 +2473,36 @@ dw_hdmi_connector_status_update(struct dw_hdmi *hdmi, { const struct drm_edid *drm_edid; + if (status == connector_status_disconnected) { + drm_edid_connector_update(connector, NULL); + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + return; + } + drm_edid = dw_hdmi_edid_read(hdmi, connector); drm_edid_connector_update(connector, drm_edid); drm_edid_free(drm_edid); - cec_notifier_set_phys_addr(hdmi->cec_notifier, - connector->display_info.source_physical_address); + if (status == connector_status_connected) + cec_notifier_set_phys_addr(hdmi->cec_notifier, + connector->display_info.source_physical_address); } static enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); enum drm_connector_status status; status = dw_hdmi_detect(hdmi); - if (status == connector_status_disconnected) - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + dw_hdmi_connector_status_update(hdmi, connector, status); return status; } static int dw_hdmi_connector_get_modes(struct drm_connector *connector) { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); - - dw_hdmi_connector_status_update(hdmi, connector, connector->status); - return drm_edid_connector_add_modes(connector); } @@ -2532,13 +2532,15 @@ static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, static void dw_hdmi_connector_force(struct drm_connector *connector) { - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, - connector); + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); mutex_lock(&hdmi->mutex); hdmi->force = connector->force; + hdmi->last_connector_result = connector->status; dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); + + dw_hdmi_connector_status_update(hdmi, connector, connector->status); } static void dw_hdmi_connector_destroy(struct drm_connector *connector)