From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (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 EF3FC38A738 for ; Mon, 18 May 2026 18:03:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127424; cv=none; b=EM32Lhkz077IfqvRRAQUNzcfu5K1hDrVDBM003S00tnQcvHmJeHtcMiYePOzjld/EuNynMNhiqDY/UQjRgk4koVx+mIMDVkwyV2tXqciIHro92abRNWocpAZMttsg1Ia6IpQGcZeiq8mdYx091WFucvOgCHzI+H7mtBbbLKM3jw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127424; c=relaxed/simple; bh=mc5qYkvHimozgFABBNS1IVGauTwWAU2kMYJZwG0KI34=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=svKmqu9fYlMdwhUF5So888fMmBy2+MRiK45G5vvc/685Ox08I+rI6zZEM4Vxe07g5Ph3IRlpr/1h37HIty7L8KESNBlJduNvgi9B3oDW8m/Xop86hZspyZ+XDlByYtDwUT8zjnQAhmdJ2Sex3gklhoSDl3kM2xVI3DzguGnr78A= 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=W6MTlGyt; arc=none smtp.client-ip=149.28.215.223 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="W6MTlGyt" 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=1779127408; bh=6RF7BKuGakMjKCbN9mlVwwIB3PRUeYCX0ksZtYl9O4g=; b=W6MTlGytGV8Qqwz4+EdfZEqGZ5p9mvhyJCR8QFdf/G6w2JSwPDNrqPfIfAlnPHQDOh0xv70q+ 8wQwf+9BY/cKIgwLj/x1Q06TMPtw1dfMoCvmL1cEdoxPqbyGnT3JotaqJr4D1jjDIQKy06zacbM lz3uhX56p4+S6G7CcknlgJRq3o1QNWhrK+5jsCkuNfWR+zxPPI+V8i3ARoQvsxSn3l7SozGHrP9 bbUEHadPoO5BUjkeYxB/GK36qbVYk5pcQ+Yu37Vq1Upi+XWH2jlqavAsEYPh4msT1VXMDC0KiX4 nWQzofi4MTH/J8rvODZlwOVJpjmRsS3evsnfDCtcAzKg== X-Forward-Email-ID: 6a0b5429b84dbc72d2274daf X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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, Christopher Obbard Subject: [PATCH v7 01/23] drm: bridge: dw_hdmi: Disable scrambler feature when not supported Date: Mon, 18 May 2026 18:01:37 +0000 Message-ID: <20260518180206.2480119-2-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The scrambler feature can be left enabled when hotplugging from a sink and mode that require scrambling to a sink that does not support SCDC or scrambling. Typically a blank screen or 'no signal' message can be observed after using a HDMI 2.0 4K@60Hz mode and then hotplugging to a sink that only support HDMI 1.4. Fix this by disabling the scrambler feature when SCDC is not supported. Fixes: 264fce6cc2c1 ("drm/bridge: dw-hdmi: Add SCDC and TMDS Scrambling sup= port") Reported-by: Christopher Obbard Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change v4: No change v3: Collect r-b tag v2: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 41b3a9cfa2f5..d3e6a6562870 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2135,6 +2135,8 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, HDMI_MC_SWRSTZ); drm_scdc_set_scrambling(hdmi->curr_conn, 0); } + } else if (hdmi->version >=3D 0x200a) { + hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL); } =20 /* Set up horizontal active pixel width */ --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (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 B5C2F38AC80 for ; Mon, 18 May 2026 18:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127425; cv=none; b=e77Ivp0Csm0k+Ijuq2hRJYE688OTBWz8jd1wkHp75SsUnxOGr9aYORenIJWE7x78nCIvcfhga/5CD0NrnPs5OrqaOaDJEShYNqpQClPwJJwsXLQGvU8nGc1JC4opHTOhDa47Gsguohrl4jwc9auYaFSzAJIM6+z5Sn1M+PZmRUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127425; c=relaxed/simple; bh=btch7YNj62k8XMYLCsc95ARynbCYXqpN5GWs6pH3568=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WqBgKkf+GLCgz+VBWeNiAxR6Eptansh5SsqMh7y+Hn3XdldfMhzdz3q2joJW/U0DsM5uIBHtPooQQq+wvE+t82Kr8KTxvBYIvmv0aN6DEHyWfb6vGMLHQ1LDK26keZqOnbvTJ51sr8UhfVjHsnS96i/2RIJqNMyvH39Uyc2EtEc= 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=d3WOYtUG; arc=none smtp.client-ip=149.28.215.223 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="d3WOYtUG" 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=1779127419; bh=fYmxPzn2Z9iehS0fAf63Ttmw7rvgQXUScT2oAp7xhm8=; b=d3WOYtUG+PumNEAZdtmvnKJqD6zqngbtnyEJAAGt7Rri+lsGr3sC29eMRUmP/9OcO96GOw80R JSEFfjWwkfmrMzg06PlV/R8+Nj3qALVpbnq7oMjvargQhlLj5OUzFueqFm6VmlZ+/3RnDLvW1B1 SIOG9STE6DyeuKdyl93htGMO+e0/9wKLF1m4ra1KE3AvCt9XySNgoB7leTRbBKP6xyD4rWxzWQU AsadKgeCCLXEMnM0A6ZIjVp+0cjD8Mv4lLkmIFIDs/nsrDon9Dsu4eUAok1PyArRz9bx5b3M1Ap 3PNdofE49CT2Dp6Ge8MV/ymak/7bG3FZBqs/XZwWkosQ== X-Forward-Email-ID: 6a0b542db84dbc72d2274dca X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Lucas Stach Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 02/23] drm: bridge: dw_hdmi: Only notify connected status on HPD interrupt Date: Mon, 18 May 2026 18:01:38 +0000 Message-ID: <20260518180206.2480119-3-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" drm_helper_hpd_irq_event() and drm_bridge_hpd_notify() may incorrectly be called with a connected status when HPD is high and RX sense is changed. This typically happens when the HDMI cable is unplugged, shortly before the HPD is changed to low. The original intent of commit da09daf88108 ("drm: bridge: dw_hdmi: only trigger hotplug event on link change") was to signal hotplug event at correct interrupt states. Based on the commit message the intent was to trigger hotplug event: - when HPD goes high (plugin) - when both HPD and RX sense has gone low (plugout) However, following interrupt state changes can typically be observed when the HDMI cable is unplugged: - RX interrupt: HPD=3Dhigh RX=3Dlow -> triggers a connected event - HPD interrupt: HPD=3Dlow RX=3Dlow -> triggers a disconnected event Fix this by only notify connected status on the HPD interrupt when HPD is going high, not on the RX sense interrupt when RX sense is changed. After this a connected event should be triggered when HPD=3Dhigh at HPD interrupt, and a disconnected event should be triggered when both HPD=3Dlow and RX=3Dlow at either HPD or RX interrupt. Fixes: da09daf88108 ("drm: bridge: dw_hdmi: only trigger hotplug event on l= ink change") Reviewed-by: Nicolas Frattaroli Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change v4: Collect r-b tag v3: Update commit message v2: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index d3e6a6562870..b7bfc0e9a6b2 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3157,7 +3157,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) mutex_unlock(&hdmi->cec_notifier_mutex); } =20 - if (phy_stat & HDMI_PHY_HPD) + if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && + (phy_stat & HDMI_PHY_HPD)) status =3D connector_status_connected; =20 if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 26FDB35F184 for ; Mon, 18 May 2026 18:02:35 +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=1779127356; cv=none; b=OFyCgWThfcfmcToe6rNhILUQgWGexsIXnhq1RaMySubXfDbQqNdEdhgB+6+y6lHBezys8XxFNzRfBOF6zDYZ0xSb0iliwhJzdITAoFmjORjmp2WqLqppsxwgRBucd2LXQEMjDHeJMX2yExA9HkEy1GpTzIKHKFiZ/siJKCeebNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127356; c=relaxed/simple; bh=+EzzxgqWIWtl9fpOuLcA4N1A62StxktT0wkipKF9bQk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D8pS/YBJzTXWp0zL6P7cB1uAhimtgjxkIbVGsyzPCqdX2/g1cBuo8cgVn0R2alBmTVGz+EXEf0GzOyUIszoNXlDsxRtsOehU8K4vXcrvr7OI5GaMJrPiRiIHTc5/uquud784NzLOURwS5xtpl9rp1dpS6xiAP3ilQ42Xl/d7RL4= 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=z6ghaNZp; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="z6ghaNZp" 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=1779127354; bh=RDtWO1bQ5DXpi9puwzpO7ZNdN3UnLZgsoflq5+aG8Jc=; b=z6ghaNZpIrjoJT6scbQh8SGXYYJ9TVwK3OS6E/rsIWXalh/DIg7pKMyUe51JVYSdIEiBLFtft euBRQz/Z7/xc/wWlzEWHeGrTpzMpufTu0LS3s+f8vFRacKJ7kk6uGpF6gV/oOym4nU4op6Jab90 4qqHRM8O4nCIRRpk7qYL8CwhvsBVPpdiG5kDtMjcpSRGnHP0SqlVxqvxo6bs6Jq2hguVURuHidw 41gS3qDytf2I3RBxRLHvoNbGYljrTBdeUjTpno54y0iXVEC06tXXDY5HrjPjSZJa/h4KbotwL9d dsFZgJt5CsFz0vRxTlgpvyVG+rNB4fxbq88mvN+6MWVA== X-Forward-Email-ID: 6a0b5432b84dbc72d2274de5 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Russell King , Hans Verkuil , Archit Taneja Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 03/23] drm: bridge: dw_hdmi: Free IRQ before CEC adapter is unregistered Date: Mon, 18 May 2026 18:01:39 +0000 Message-ID: <20260518180206.2480119-4-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The interrupt allocated with devm_request_threaded_irq() can be use-after-free when the devres release action try to free_irq(). KASAN report a slab-use-after-free in dw_hdmi_cec_hardirq during unbind: Call trace: [...] dw_hdmi_cec_hardirq+0x4cc/0x560 free_irq+0x48c/0x7e4 devm_irq_release+0x54/0x90 dr_node_release+0x38/0x5c release_nodes+0xac/0x130 devres_release_all+0xf4/0x1b0 device_unbind_cleanup+0x28/0x1f8 device_release_driver_internal+0x358/0x470 device_release_driver+0x18/0x24 bus_remove_device+0x33c/0x4f0 device_del+0x2d8/0x790 platform_device_del+0x34/0x1e0 platform_device_unregister+0x14/0x3c dw_hdmi_remove+0x74/0x180 [...] Freed by: [...] kfree+0x1dc/0x5dc cec_delete_adapter+0xd4/0x118 cec_devnode_release+0xa4/0xe0 device_release+0xa0/0x200 kobject_put+0x14c/0x26c put_device+0x14/0x30 cec_unregister_adapter+0x20c/0x280 dw_hdmi_cec_remove+0x8c/0xd0 [...] Explicitly devm_free_irq() before the CEC adapter is unregistered to fix this possible use-after-free issue. Fixes: a616e63c56ef ("drm/bridge: dw-hdmi: add cec driver") Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- v7: New patch KASAN report a slab-use-after-free in dw_hdmi_cec_hardirq when, echo fe0a0000.hdmi > /sys/bus/platform/drivers/dwhdmi-rockchip/unbind on a Rockchip RK3566 device prior to this fix. --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/dr= m/bridge/synopsys/dw-hdmi-cec.c index 9549dabde941..67a2a242d3ca 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c @@ -309,6 +309,7 @@ static void dw_hdmi_cec_remove(struct platform_device *= pdev) struct dw_hdmi_cec *cec =3D platform_get_drvdata(pdev); =20 cec_notifier_cec_adap_unregister(cec->notify, cec->adap); + devm_free_irq(&pdev->dev, cec->irq, cec->adap); cec_unregister_adapter(cec->adap); } =20 --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 0404B351C22 for ; Mon, 18 May 2026 18:02:37 +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=1779127359; cv=none; b=RNuw3LXtHNBTRBszpY5BuVMQczM7CwTasOpkrE8waLBqzlZ1V4/nLEkoV6eIHCqUp6J4h50AZa65BtV8vGzGJa2OexycmXkPgzgg7gSNR2zvJx9hI1lkxp121D9kEDHZhizaFHeKqWB7LP92i+nY/HM5UYNG27724I2ROnEuzLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127359; c=relaxed/simple; bh=09QitLERPIBz65/8xeO8cESTBv8KCG/K8BGM5+8dujs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UY6wBGw985IadI9mWPv2Gy3oN3tSmhgx5I2sGT0AZHU+BYDSiAunOhf4Lt3Efy59VDBkIXms2Yc3Lb5kJgBCjotJKeXr+5rIlcxOzUnMJICpgMp8ax7NyWgV+VuV0qMR9Z4kmNxRCjZW7g7M11t/+DKUF+QZm9mGn12xd/ELGK8= 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=wFZvUq26; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="wFZvUq26" 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=1779127357; bh=rHR6JQhfCZioVtWjb43UfYe+VOtInpIVxB1wWysQtG0=; b=wFZvUq265pmgZIn9bJUibLh7MbQt0NXimNi5/9kxcpnZK7pBG2jdjG7UoYr2pP+KqdbYGpgJG N9IntEIMuSXQHe5FsUUB0OVvIq9BoT1MGbk8rO0msCUV6JD5VLlAMeh5xWjMm9XdzvV2RzmD3vb 6EIvw0npPkyXQd1p8phJme7gDqvGdpvh6mOV5UieCkX/lcIIGTntXa0jtafPFVz8hZgpI+i1w2o q7w5OGXr5QA7R5T7rH6SSJ3n8J1gdIGo9aDiDeyrNR+paFZj44Q5Nl/8YASd4RE2AdViokjuAmS iPcqHAjdRovspbzahyjLF8Lj1FpymT2hqVDuwards25A== X-Forward-Email-ID: 6a0b5436b84dbc72d2274e00 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Cristian Ciocaltea , Louis Chauvet Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 04/23] drm: bridge: dw_hdmi: Hold bridge ref until connector cleanup Date: Mon, 18 May 2026 18:01:40 +0000 Message-ID: <20260518180206.2480119-5-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" drmres connector cleanup typically run after devres has released the last dw-hdmi bridge reference. Since struct dw_hdmi, where the connector lives, is freed when the last bridge reference is released, connector cleanup can end up accessing freed memory. Call trace without a bridge reference held until connector cleanup: - dw_hdmi_bridge_detach() - dw_hdmi_bridge_destroy() <<-- struct dw_hdmi is free() - [drm:drm_managed_release] drmres release begin - [drm:drm_managed_release] REL (...) drm_mode_config_init_release (0 bytes) - dw_hdmi_connector_destroy() - drm_connector_cleanup() <<-- drm_connector is use-after-free [...] - [drm:drm_managed_release] drmres release end Hold a bridge reference for as long as the connector exists and drop it after drm_connector_cleanup() has completed to keep struct dw_hdmi alive until connector teardown is finished and avoids the use-after-free. Call trace with a bridge reference held until connector cleanup: - dw_hdmi_bridge_detach() - [drm:drm_managed_release] drmres release begin - [drm:drm_managed_release] REL (...) drm_mode_config_init_release (0 bytes) - dw_hdmi_connector_destroy() - drm_connector_cleanup() <<-- drm_connector is destroy() - drm_bridge_put() - dw_hdmi_bridge_destroy() <<-- struct dw_hdmi is free() [...] - [drm:drm_managed_release] drmres release end Fixes: ed6987b67418 ("drm/bridge: dw-hdmi: convert to devm_drm_bridge_alloc= () API") Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Reviewed-by: Luca Ceresoli Tested-by: Heiko Stuebner #rk3328 --- v7: Add fixes tag, re-order patch v6: Collect t-b tag v5: New patch This use-after-free issue likely existed before commit ed6987b67418 when devm_kzalloc() was used instead of devm_drm_bridge_alloc(). However, v6.16-rc1 first introduced bridge refcount and drm_bridge_put(), parts that are used to help fix the use-after-free issue. KASAN report a slab-use-after-free in __refcount_add_not_zero when, echo fe0a0000.hdmi > /sys/bus/platform/drivers/dwhdmi-rockchip/unbind on a Rockchip RK3566 device prior to this fix. --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index b7bfc0e9a6b2..9d795c550f8a 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2568,10 +2568,18 @@ static void dw_hdmi_connector_force(struct drm_conn= ector *connector) mutex_unlock(&hdmi->mutex); } =20 +static void dw_hdmi_connector_destroy(struct drm_connector *connector) +{ + struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); + + drm_connector_cleanup(connector); + drm_bridge_put(&hdmi->bridge); +} + static const struct drm_connector_funcs dw_hdmi_connector_funcs =3D { .fill_modes =3D drm_helper_probe_single_connector_modes, .detect =3D dw_hdmi_connector_detect, - .destroy =3D drm_connector_cleanup, + .destroy =3D dw_hdmi_connector_destroy, .force =3D dw_hdmi_connector_force, .reset =3D drm_atomic_helper_connector_reset, .atomic_duplicate_state =3D drm_atomic_helper_connector_duplicate_state, @@ -2588,6 +2596,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *h= dmi) struct drm_connector *connector =3D &hdmi->connector; struct cec_connector_info conn_info; struct cec_notifier *notifier; + int ret; =20 if (hdmi->version >=3D 0x200a) connector->ycbcr_420_allowed =3D @@ -2600,10 +2609,14 @@ static int dw_hdmi_connector_create(struct dw_hdmi = *hdmi) =20 drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs); =20 - drm_connector_init_with_ddc(hdmi->bridge.dev, connector, - &dw_hdmi_connector_funcs, - DRM_MODE_CONNECTOR_HDMIA, - hdmi->ddc); + ret =3D drm_connector_init_with_ddc(hdmi->bridge.dev, connector, + &dw_hdmi_connector_funcs, + DRM_MODE_CONNECTOR_HDMIA, + hdmi->ddc); + if (ret) + return ret; + + drm_bridge_get(&hdmi->bridge); =20 /* * drm_connector_attach_max_bpc_property() requires the --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (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 1C777382381 for ; Mon, 18 May 2026 18:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127361; cv=none; b=r0JVjpO0wLf7wGTtVxO7urEIC/Nm7OSxoP8JKomMz9umJMFAimCsGiC/RMf4vFcmqx/BQj5++wXkgAtfDw3Cmy+x87pQCCRBmvPgpRtwdqypkw/ErvO2sa63NUNDq141qLyik3PMxk+m8iolp6byacmDuUtUiwWSo2Dh0rTZrYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127361; c=relaxed/simple; bh=1Zrx6uTOGkPC+BKJ5nx36MlypCB2PNKCChinpj1ft4w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UuS5i1Ss8wT9UYxWHgmsHqOErh2oilFBSlpcJWMk6EXJ7PxncR0P+RxGKJYbn6f1bGh/RBlWBJywCmPkyY2qAOg4sqwa0M+fhu1lEbzpcSiVBEbODqoHYjQVlVHTERlLa4kqwidChx93eQ3mhsWYS858SAtcbNe9+Q0bpQLJlwY= 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=JTDmkPFH; arc=none smtp.client-ip=121.127.44.73 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="JTDmkPFH" 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=1779127358; bh=UTke0A6Lv/1fUQtQniAEq60/oKDmSb3Qk0p4Red78bM=; b=JTDmkPFH2LghijAXdAhxQtNmQjjyrgZ2TovQSP9Go09EMxz3vU8uVfKjK6sQPJpo15dUifM9D /Lf5V5JF8XSyBTjxKL7yMqeehF2VhKBn2W1yL6eM/NLNDSGcr6LAjZFpeqayq73RrxYD/cVkiF1 vWbBHMLy2an0SW0pdUf1injwLQ/cg9a4HtszAWxgHdzpLGzsH3eBf4HiO0eYeFzLjlP1U9Rn9dV qYYjiTGEZ8mJD9DS59h9ioCT97dqdCn++vkR6IYw+D2laq1hluw6S4pNrmKki0km3/7yVIaVpE+ mpzAdDM0KWYUJu/gh9FkE9279u9BkqTPVw8sJu13HmAg== X-Forward-Email-ID: 6a0b543bb84dbc72d2274e1b X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 05/23] drm: bridge: dw_hdmi: Call poweron/poweroff from atomic enable/disable Date: Mon, 18 May 2026 18:01:41 +0000 Message-ID: <20260518180206.2480119-6-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change to only call poweron/poweroff from atomic_enable/atomic_disable funcs instead of trying to be clever by keeping a bridge_is_on state and poweron/off in the hotplug IRQ handler. The bridge is already enabled/disabled depending on connection status with the call to drm_helper_hpd_irq_event() in hotplug IRQ handler. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Update commit message, Collect t-b tag v5: No change v4: No change v3: Collect r-b tag v2: Update commit message --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 33 ++--------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 9d795c550f8a..8bec9b5cd803 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -171,7 +171,6 @@ struct dw_hdmi { enum drm_connector_force force; /* mutex-protected force state */ struct drm_connector *curr_conn;/* current connector (only valid when !di= sabled) */ bool disabled; /* DRM has disabled our bridge */ - bool bridge_is_on; /* indicates the bridge is on */ bool rxsense; /* rxsense state */ u8 phy_mask; /* desired phy int mask settings */ u8 mc_clkdis; /* clock disable register */ @@ -2400,8 +2399,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi *= hdmi) =20 static void dw_hdmi_poweron(struct dw_hdmi *hdmi) { - hdmi->bridge_is_on =3D true; - /* * The curr_conn field is guaranteed to be valid here, as this function * is only be called when !hdmi->disabled. @@ -2415,30 +2412,6 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) hdmi->phy.ops->disable(hdmi, hdmi->phy.data); hdmi->phy.enabled =3D false; } - - hdmi->bridge_is_on =3D false; -} - -static void dw_hdmi_update_power(struct dw_hdmi *hdmi) -{ - int force =3D hdmi->force; - - if (hdmi->disabled) { - force =3D DRM_FORCE_OFF; - } else if (force =3D=3D DRM_FORCE_UNSPECIFIED) { - if (hdmi->rxsense) - force =3D DRM_FORCE_ON; - else - force =3D DRM_FORCE_OFF; - } - - if (force =3D=3D DRM_FORCE_OFF) { - if (hdmi->bridge_is_on) - dw_hdmi_poweroff(hdmi); - } else { - if (!hdmi->bridge_is_on) - dw_hdmi_poweron(hdmi); - } } =20 /* @@ -2563,7 +2536,6 @@ static void dw_hdmi_connector_force(struct drm_connec= tor *connector) =20 mutex_lock(&hdmi->mutex); hdmi->force =3D connector->force; - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); } @@ -3001,7 +2973,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_= bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled =3D true; hdmi->curr_conn =3D NULL; - dw_hdmi_update_power(hdmi); + dw_hdmi_poweroff(hdmi); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, false); mutex_unlock(&hdmi->mutex); @@ -3019,7 +2991,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_b= ridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled =3D false; hdmi->curr_conn =3D connector; - dw_hdmi_update_power(hdmi); + dw_hdmi_poweron(hdmi); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); @@ -3119,7 +3091,6 @@ void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, boo= l hpd, bool rx_sense) if (hpd) hdmi->rxsense =3D true; =20 - dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); } mutex_unlock(&hdmi->mutex); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (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 66340382381 for ; Mon, 18 May 2026 18:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127366; cv=none; b=gjR8AQKabhR3nnNzpvKwg9D5GdVoLfzykKZZSJvSWw/J2apwwhWJjHyBAAq101gCtwS5g2QeD96AA2iorAXYQygsBM3394OVAVohuZRHLmF6I5Nvr0fqzFvi2JB3l/SfMp2vSuAoHlvGr6Mn/f7UBb2vC7vR9qRL1HFh0ZnBWjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127366; c=relaxed/simple; bh=+GHMXgMkveoSB6+q+uagvPBDuTCXIBe2XtS7lx2O3YU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lDNWOYpDtxRSwumr1s9O7nkEHASwpZTjoH347cbevMzbN8on5/uCDDBUpV/fgosmDpS7y8cVk1KMcSq6jw5q2bboCMjyKzVyqRC3SwUD0FxpdJMV82jhS2zZbuTSA3os5NqAC8FlzVL8yIHqLGbxo310MPWxS26o4Gbau03wDOg= 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=Wx8JcxL9; arc=none smtp.client-ip=121.127.44.73 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="Wx8JcxL9" 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=1779127364; bh=XfdOVcCGyUBMZGBHIeMbtLWfoogDufTONgzIIn0zATo=; b=Wx8JcxL9unkAaw7u08TCuKzdlb8DqAcfqYWMhO/GgRw+razDXZxcwHx8bq5Cl3uCywpKXoIOv b07fZfhr4greiKxQ6253tmm3F1FIMqc4xW65JP7mX39dcqPWjaTcJp1N2Dl/m7BFvVD3xlvUXiu /JAhG6S4xjOnBz4fs2fT40Q+V382wPwv8bVnVQPeGQidtu51cu9UUOay5KECO6QSMHivEDSwKbw 2CY6OXMzgH5hu9biwMyqEhd3LBp4XEdgXtySBNYdU7LhrRJcffEK/+xP9DuAH9bdj0Oesj5aQY9 epPdeNk5uvKNbfOMX2Imyxn0LVKS1cNzRZYvfs6k8KOA== X-Forward-Email-ID: 6a0b543fb84dbc72d2274e36 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 06/23] drm: bridge: dw_hdmi: Use passed mode instead of stored previous_mode Date: Mon, 18 May 2026 18:01:42 +0000 Message-ID: <20260518180206.2480119-7-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the passed mode instead of mixing use of passed mode and the stored previous_mode in dw_hdmi_setup(). The passed mode is currenly always the previous_mode. Also fix a small typo and add a variable to help shorten a code line. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change v4: No change v3: Collect r-b tag v2: Update commit message, s/type/typo/ --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 8bec9b5cd803..7a9b4a7e9cbf 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2258,6 +2258,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, const struct drm_connector *connector, const struct drm_display_mode *mode) { + const struct drm_display_info *display =3D &connector->display_info; int ret; =20 hdmi_disable_overflow_interrupts(hdmi); @@ -2303,12 +2304,10 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, hdmi->hdmi_data.video_mode.mdataenablepolarity =3D true; =20 /* HDMI Initialization Step B.1 */ - hdmi_av_composer(hdmi, &connector->display_info, mode); + hdmi_av_composer(hdmi, display, mode); =20 - /* HDMI Initializateion Step B.2 */ - ret =3D hdmi->phy.ops->init(hdmi, hdmi->phy.data, - &connector->display_info, - &hdmi->previous_mode); + /* HDMI Initialization Step B.2 */ + ret =3D hdmi->phy.ops->init(hdmi, hdmi->phy.data, display, mode); if (ret) return ret; hdmi->phy.enabled =3D true; --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 79690385506 for ; Mon, 18 May 2026 18:02:47 +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=1779127369; cv=none; b=rIOLH822npAvEuQ1ajN39ur0Ez8WYmNjrwyDJGvc5hfG68Gh6B9mBpJFzdOKbe/VCqpZQ2pS7u95RUS4lAzwIYqObH2TORzYU/2tufb+gp2tHeoCzFJSNJDcBmZG/7vA33xFWNcHK+g+p0oL0fnM7AThxacfk9979y2UMkge7Js= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127369; c=relaxed/simple; bh=XvpFfqMu74q/pPiT3pSd5LvDOyL8w9iDjB4gJkjkDj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nfMQ6w1eqFHtefcfARZUvwq9Tb9p8zgLdug+v12jb3zPYmAskka8Ve64XC0LYWtjYMALhvh8eoeAkDCunZrbOXrRgKhyFaAC0Bzru1FVDNzcRbXJXtlAeoEfnBQEpqbfV3FsJUG1wd9NlS4WCX49zehan8Pyc2zIBc2C71QiGK0= 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=Aw1kUua7; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="Aw1kUua7" 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=1779127367; bh=1SwUqaE6mORlk0iEp6kMdcbakTgSMLCePrjjya+/Sfw=; b=Aw1kUua7x9p2DSkO3KGhHishOgIeIZ5dX7qm/SqTKWWeY9SDdJRBahH7FbifzIGiJmAjrhrkc mMtg/GL7zTHL856qGh7ESRcKwcR7WXSHG7p9oPIsFsJKAJkajIefAh11b431vUt2LQK0paLsHIw zVPawGq77sMXKbccusTQ6CfUpQHcu5/zsPwS5vBC9+MsdH4OwQC6mK7loqqoNSfOURurbd0/qhb 1IwMVv1GArghPPOIdIMvobof0H+SqUm1b479gZimMwzJOcr1dRTPUs44nCE8WvG2cQogIcalGlk GxB9149XDsODEADdmw53Qh27+Js0u6/YBIpDca9X/AKw== X-Forward-Email-ID: 6a0b5443b84dbc72d2274e51 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 07/23] drm: bridge: dw_hdmi: Fold poweron and setup functions Date: Mon, 18 May 2026 18:01:43 +0000 Message-ID: <20260518180206.2480119-8-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fold the poweron and setup functions into one function and use the adjusted_mode directly from the new crtc_state to remove the need of storing previous_mode. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change, rebase on next-20260508 v4: No change v3: Collect r-b tag v2: No change --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 7a9b4a7e9cbf..161ab16fdd78 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2254,9 +2254,9 @@ static void hdmi_disable_overflow_interrupts(struct d= w_hdmi *hdmi) HDMI_IH_MUTE_FC_STAT2); } =20 -static int dw_hdmi_setup(struct dw_hdmi *hdmi, - const struct drm_connector *connector, - const struct drm_display_mode *mode) +static int dw_hdmi_poweron(struct dw_hdmi *hdmi, + const struct drm_connector *connector, + const struct drm_display_mode *mode) { const struct drm_display_info *display =3D &connector->display_info; int ret; @@ -2396,15 +2396,6 @@ static void initialize_hdmi_ih_mutes(struct dw_hdmi = *hdmi) hdmi_writeb(hdmi, ih_mute, HDMI_IH_MUTE); } =20 -static void dw_hdmi_poweron(struct dw_hdmi *hdmi) -{ - /* - * The curr_conn field is guaranteed to be valid here, as this function - * is only be called when !hdmi->disabled. - */ - dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode); -} - static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) { if (hdmi->phy.enabled) { @@ -2982,15 +2973,19 @@ static void dw_hdmi_bridge_atomic_enable(struct drm= _bridge *bridge, struct drm_atomic_commit *state) { struct dw_hdmi *hdmi =3D bridge->driver_private; + const struct drm_display_mode *mode; struct drm_connector *connector; + struct drm_crtc *crtc; =20 connector =3D drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + crtc =3D drm_atomic_get_new_connector_state(state, connector)->crtc; + mode =3D &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; =20 mutex_lock(&hdmi->mutex); hdmi->disabled =3D false; hdmi->curr_conn =3D connector; - dw_hdmi_poweron(hdmi); + dw_hdmi_poweron(hdmi, connector, mode); dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 44C4C3890F8 for ; Mon, 18 May 2026 18:02:52 +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=1779127373; cv=none; b=mccYOpJnD/uctD3ZxcSpnr87RQqISaMFA/YwQmKxSfv72E+ICNPEqvKRj+yAjPVDauncdt6LiPSXX383jVrMNzxQU+ImgI0VH54Y52xySV86kjlY9YydgYfdd4pZP24naMZWEZhd0Hfqtw/L7TycJiSQU3sy7ePx4TGUSu/HKgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127373; c=relaxed/simple; bh=4oFgxsJCxts7pDZAh2HjEOvdZkZhMEjA0JJY8ocS3Xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LtVYDMoro4v+t1tu8HMF9ZlYkMVwTVxK1ucOxY3zn2M3+xmk6P0X70AhE5NEcajI8ifyU6hIXAHNP35l+xoSnt0PWAOgbeZLV3nHSuW8O8PmAsvD3KXyhejz5SCLQMZmMILGhNPBTe7OTZmi1crrJ9Bn6bzRr/MSZJA3lUoQbFw= 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=DxruQiVy; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="DxruQiVy" 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=1779127371; bh=Rh/xrpW30RZreylHYOm9Re6EnMeOqUrElK42Lfzz66g=; b=DxruQiVyvpuxglp93ZxQnb0XMs7TzHtxcrNaN2RKtT4wtB4UQG0xbbHRXA4XBqcgQxNiXJhzW 7LouKOkQmk3KrMtB+R5mo80gFkFhExTO2Ej8HqQXa7Xxfsgtn61w0WDnnFizOskB1hi0kzobdP9 R6E4T9nvHHXEVPXW6zMyoC4c6me5gRubzJb59Q7gk3y/aSI3yRO/xAvmnwFScCn/QFlLBYNxEJJ VEmPZQ2tXmsq+ZEcIZ+t86lznxATh5wS9U3f/4BdZ3BmBvRwM88+tRYlccXJTOdubZr5gyVQm+d 2H3mRETHsSxaRZmHSc0fs5zm5PzgRRx4j84qER1r+hFA== X-Forward-Email-ID: 6a0b5447b84dbc72d2274e6c 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 08/23] drm: bridge: dw_hdmi: Remove previous_mode and mode_set Date: Mon, 18 May 2026 18:01:44 +0000 Message-ID: <20260518180206.2480119-9-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With the use of adjusted_mode directly from the crtc_state there is no longer a need to store a copy in previous_mode, remove it and the now unneeded mode_set ops. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change, rebase on next-20260508 v4: No change v3: Collect r-b tag v2: No change --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 161ab16fdd78..cbbd15578042 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -156,8 +156,6 @@ struct dw_hdmi { bool enabled; } phy; =20 - struct drm_display_mode previous_mode; - struct i2c_adapter *ddc; void __iomem *regs; bool sink_is_hdmi; @@ -167,7 +165,7 @@ struct dw_hdmi { struct pinctrl_state *default_state; struct pinctrl_state *unwedge_state; =20 - struct mutex mutex; /* for state below and previous_mode */ + struct mutex mutex; /* for state below */ enum drm_connector_force force; /* mutex-protected force state */ struct drm_connector *curr_conn;/* current connector (only valid when !di= sabled) */ bool disabled; /* DRM has disabled our bridge */ @@ -2941,20 +2939,6 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, return mode_status; } =20 -static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge, - const struct drm_display_mode *orig_mode, - const struct drm_display_mode *mode) -{ - struct dw_hdmi *hdmi =3D bridge->driver_private; - - mutex_lock(&hdmi->mutex); - - /* Store the display mode for plugin/DKMS poweron events */ - drm_mode_copy(&hdmi->previous_mode, mode); - - mutex_unlock(&hdmi->mutex); -} - static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, struct drm_atomic_commit *state) { @@ -3018,7 +3002,6 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_f= uncs =3D { .atomic_get_input_bus_fmts =3D dw_hdmi_bridge_atomic_get_input_bus_fmts, .atomic_enable =3D dw_hdmi_bridge_atomic_enable, .atomic_disable =3D dw_hdmi_bridge_atomic_disable, - .mode_set =3D dw_hdmi_bridge_mode_set, .mode_valid =3D dw_hdmi_bridge_mode_valid, .detect =3D dw_hdmi_bridge_detect, .edid_read =3D dw_hdmi_bridge_edid_read, --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 6C97B27E1D7 for ; Mon, 18 May 2026 18:02:57 +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=1779127379; cv=none; b=VHnKfhOEYRiGuB06VM5lFyRvJFOhCLlbQog6yYkK5GkuSvi1FziJLYzr8g6f0hk3KixBIG4WL8+9+P/1mjPShMeCkKihDz1ne6AD2GbRZyotmQgw4BljA9f1CJOxWNhKAijsELnj9KnraRe3e7KZuqELhw/Z0P83/tSpW4syCD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127379; c=relaxed/simple; bh=gJ9Ym4SEBXPrg9rbf03paHyAyTACieHc3kewtWnsqoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jngKAtyu9ugzlgL80WBwkr2hHpBrksie1Qz+1aTVErJKjT+qEuXUUCArAMbkvlcuOlQHsdod6yUsIb/mhRd+hP7h5etT+SAd6OQFaCamK9z20F70Tar8YKzLubPCBl0tohCg6KHQjeAdunXvE/NsGDtACAAjY4/PCD3iL9WPS94= 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=l8xDgENk; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="l8xDgENk" 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=1779127376; bh=y1qusCJrJS8qT16e2pU+cznjnv8NM8UAIVFu7XIBUj8=; b=l8xDgENk0Ffz8bvIvEvFbkJYjwVKmsyNLNSs95YuQEmKjx54Yh4eDrPUZzFz6xmoHHsXs7Jyy MTCujYuB30sLmtz4vEsNImt5Eg2UUonHN9TPiqENTRgPvrVT4vYzame7oRF94hjd1CsEU7DDB3x DVrG7a+VtVeuL+d0PQEJVx8155O8u1KxhGN9HsIkzMFPB9X1yLSuCdAYAdq7P85M+xlHi9fcD/F /C4SvcUlLRVnlzxWFXgVTcN0lHcuo5A0Q8OiTx+/IUGTK1DuDj78D3hmtUeXN80SFYNOX8nCFq7 ERol6XF21hAycjGYN2qOfd1T+NT1MzxstPDSpooIpscg== X-Forward-Email-ID: 6a0b544cb84dbc72d2274e87 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 09/23] drm: bridge: dw_hdmi: Unregister CEC notifier during connector cleanup Date: Mon, 18 May 2026 18:01:45 +0000 Message-ID: <20260518180206.2480119-10-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The CEC notifier is being unregistered when the bridge detach, something that happens earlier than normal connector cleanup. Change to unregister the CEC notifier at connector cleanup, in the connector .destroy() func, to align the lifetime of the connector and the CEC notifier and closer match a drmres handled generic CEC notifier. Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Reviewed-by: Luca Ceresoli Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index cbbd15578042..5fd26ff8f55b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2532,6 +2532,11 @@ static void dw_hdmi_connector_destroy(struct drm_con= nector *connector) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); =20 + mutex_lock(&hdmi->cec_notifier_mutex); + cec_notifier_conn_unregister(hdmi->cec_notifier); + hdmi->cec_notifier =3D NULL; + mutex_unlock(&hdmi->cec_notifier_mutex); + drm_connector_cleanup(connector); drm_bridge_put(&hdmi->bridge); } @@ -2909,16 +2914,6 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *= bridge, return dw_hdmi_connector_create(hdmi); } =20 -static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) -{ - struct dw_hdmi *hdmi =3D bridge->driver_private; - - mutex_lock(&hdmi->cec_notifier_mutex); - cec_notifier_conn_unregister(hdmi->cec_notifier); - hdmi->cec_notifier =3D NULL; - mutex_unlock(&hdmi->cec_notifier_mutex); -} - static enum drm_mode_status dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info, @@ -2996,7 +2991,6 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_f= uncs =3D { .atomic_destroy_state =3D drm_atomic_helper_bridge_destroy_state, .atomic_reset =3D drm_atomic_helper_bridge_reset, .attach =3D dw_hdmi_bridge_attach, - .detach =3D dw_hdmi_bridge_detach, .atomic_check =3D dw_hdmi_bridge_atomic_check, .atomic_get_output_bus_fmts =3D dw_hdmi_bridge_atomic_get_output_bus_fmts, .atomic_get_input_bus_fmts =3D dw_hdmi_bridge_atomic_get_input_bus_fmts, --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (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 64746392823 for ; Mon, 18 May 2026 18:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127444; cv=none; b=l2295amWw1Dc9bl4eQb0skVvz0utLA4ioTAAZAOKW7wz/TV/Q8qt3oIBQjAnFHxkUKmh3W9GGh1a7bnLYSH2An/x4+CTVvmVQh+Ncq6WrPZHCqfKS3Nc7rChnA4Fd2yHk29y7DbnBi+7EJRAZMb+gw74G2G8dGR13Fbe6nUEIaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127444; c=relaxed/simple; bh=VxZ1Kez/06U4VoDeHYL41XHk0JGP/YzohyWCreMpChs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pIFiZiz2b0e6uabmzOiN3mTRbrLPIGoIeXHAPLKIRvalmWZXI50IYLFDVYIrij/iHH+clbdS0WYcsVidYOr2uZ/9rAeZUTYXzcM+ZFrVRkgNqQUNwYND5KpjWUmEuuQl5WvTh7Ro9GBVK8M9D+6GSBlpvgbYslbIYIKaGflw52A= 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=zHNsEAbh; arc=none smtp.client-ip=149.28.215.223 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="zHNsEAbh" 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=1779127437; bh=znz3x9aHiZWJo1Ge4Me4toMEFecshVWA02u6IfcfS5U=; b=zHNsEAbhuR80jQm70yn9zOAF0xDBi3avBSFQdtgupHjxN4Fw2pnq9b0fTF62HuK9i0S+4buYn pGjmZvZs1rBpYkcyOEhX7kA7aLJ1DTGjV2OTKfv3SZaS8vLtU0czN+tNb0pdgk/Kmn/rVWIaj0w xnQdhJI3DdlIdE0JoFvt35qIv+V5kXJQ40dHH88hojRUoQeMwpzmINQYvP2ojp5A/zXPEx8E2aY chU/8DvdpEEO50wYaPRXQuyg+djirDMhK9ABhpr4/sUY64wc1RS8snUQMwbDSUNJFvtpWJdvUVq vTPUNA3xELPTApAuNg4MX4cU+tUUPhNbN2Yyepnsojrg== X-Forward-Email-ID: 6a0b5450b84dbc72d2274ea2 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 10/23] drm: bridge: dw_hdmi: Invalidate CEC phys addr from connector detect Date: Mon, 18 May 2026 18:01:46 +0000 Message-ID: <20260518180206.2480119-11-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Wait until the connector detect ops is called to invalidate CEC phys addr instead of doing it directly from the irq handler. The CEC notifier is only registered for the dw-hdmi connector so this has no impact when the bridge connector is used. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- v7: Update commit message v6: Collect t-b tag v5: No change v4: No change v3: No change v2: Collect r-b tag --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 5fd26ff8f55b..aae1b890167b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2472,7 +2472,17 @@ dw_hdmi_connector_detect(struct drm_connector *conne= ctor, bool force) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connector); - return dw_hdmi_detect(hdmi); + enum drm_connector_status status; + + status =3D dw_hdmi_detect(hdmi); + + if (status =3D=3D connector_status_disconnected) { + mutex_lock(&hdmi->cec_notifier_mutex); + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + mutex_unlock(&hdmi->cec_notifier_mutex); + } + + return status; } =20 static int dw_hdmi_connector_get_modes(struct drm_connector *connector) @@ -3106,12 +3116,6 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) phy_stat & HDMI_PHY_HPD, phy_stat & HDMI_PHY_RX_SENSE); =20 - if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) =3D=3D 0) { - mutex_lock(&hdmi->cec_notifier_mutex); - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); - mutex_unlock(&hdmi->cec_notifier_mutex); - } - if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && (phy_stat & HDMI_PHY_HPD)) status =3D connector_status_connected; --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (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 D252F392C5F for ; Mon, 18 May 2026 18:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127443; cv=none; b=YTyjfpAM1ZoTjwmXC6BPN14h9nzvpzptfd34lmR8C9aIk05ZBccDmhvkqfpQ2+Ldp61/vWQfvy22xOR2LkjxIb/SCSBXE25KGkfryWaIo6pGdKlOnYj6lMvQLsQAIlKtKcfe3tdbsroKV8S/FC8QMf23/VXiPvY6+yIBxe1+HOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127443; c=relaxed/simple; bh=ByMF4GdGQiltK/0H6283abIVApJohj6GSCPI6hIyQeY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LOBbfw4K+dNtdr98D35qk+0x9MLeLVy7xs2CKRLlXX4vblTRUuhsPKQnuTyaKmZdWLeEi5Xh5oN3/M7gbsAPJb92Xqvd+k0eJgquJESKEqREwqdaoA4S0MdLHQJB4jDJwUbP58/2coIi4i+0IrTvFtvss1A5JAgMZkvIgKZHYCM= 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=vMbSH2qq; arc=none smtp.client-ip=149.28.215.223 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="vMbSH2qq" 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=1779127441; bh=L2AMeBsoZf2kxfYyxGGP2ccyAI98iX6EvehGmYx28b8=; b=vMbSH2qqhfYsDJ2kz5cKUe7zYynSmDCLzQPMuL/S/PBD1Q7zJ/F+GMUa7kz5LKMGxWJUtnaAV TfbhcintWiboyt1RBqke75E8UJq7V+DIbsagt2D09xo3AyQbtoV3xu8GnQvHtxWhUZRYi50D3D2 qoi4D0OUJEey3Cy6yWHFB4IsLdO7OuIjwUNxtemfWRP1Uc2a7yC8YQaZC59//OhmDLVlVYa46Jx ZUrrOjxwz/yMcCFa+qrdqPjppy9uP3yijJJnc0YAWiGJd3sDSQ9x+u4w7iepU6n7eJyHmOtmW9o 5t0gxQ+YF9qJw3PJJRShBovHqeflSFkBSnuhzQSZARwg== X-Forward-Email-ID: 6a0b5454b84dbc72d2274ebd X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 11/23] drm: bridge: dw_hdmi: Remove cec_notifier_mutex Date: Mon, 18 May 2026 18:01:47 +0000 Message-ID: <20260518180206.2480119-12-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With CEC phys addr invalidation moved away from the irq handler there is no longer a need for cec_notifier_mutex, remove it. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change, cec_notifier_conn_unregister() call moved v4: No change v3: No change v2: Collect r-b tag --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index aae1b890167b..0dd4c823c60a 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -189,7 +189,6 @@ struct dw_hdmi { void (*enable_audio)(struct dw_hdmi *hdmi); void (*disable_audio)(struct dw_hdmi *hdmi); =20 - struct mutex cec_notifier_mutex; struct cec_notifier *cec_notifier; =20 hdmi_codec_plugged_cb plugged_cb; @@ -2476,11 +2475,8 @@ dw_hdmi_connector_detect(struct drm_connector *conne= ctor, bool force) =20 status =3D dw_hdmi_detect(hdmi); =20 - if (status =3D=3D connector_status_disconnected) { - mutex_lock(&hdmi->cec_notifier_mutex); + if (status =3D=3D connector_status_disconnected) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); - mutex_unlock(&hdmi->cec_notifier_mutex); - } =20 return status; } @@ -2542,10 +2538,8 @@ static void dw_hdmi_connector_destroy(struct drm_con= nector *connector) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); =20 - mutex_lock(&hdmi->cec_notifier_mutex); cec_notifier_conn_unregister(hdmi->cec_notifier); hdmi->cec_notifier =3D NULL; - mutex_unlock(&hdmi->cec_notifier_mutex); =20 drm_connector_cleanup(connector); drm_bridge_put(&hdmi->bridge); @@ -2612,9 +2606,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *h= dmi) if (!notifier) return -ENOMEM; =20 - mutex_lock(&hdmi->cec_notifier_mutex); hdmi->cec_notifier =3D notifier; - mutex_unlock(&hdmi->cec_notifier_mutex); =20 return 0; } @@ -3323,7 +3315,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, =20 mutex_init(&hdmi->mutex); mutex_init(&hdmi->audio_mutex); - mutex_init(&hdmi->cec_notifier_mutex); spin_lock_init(&hdmi->audio_lock); =20 ddc_node =3D of_parse_phandle(np, "ddc-i2c-bus", 0); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (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 B96F835F184 for ; Mon, 18 May 2026 18:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127390; cv=none; b=SNpAmHjqDXEZcw1Qqn3h4OdMJGFQrKu2f4t6GKu3NkNt6S8Yer6E1C0YbsJvMV8u1YUUC6V/sjHYixxgElPYI3eXVp2wH9YGi8M5VQZdirVsNWvDNf5UiZBKjymkYKusp3jmNzh0oOss6HL0vAcYF/SnnFpYhKBiBfNI0hZzbVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127390; c=relaxed/simple; bh=D76Y56SHJ2BnmV1Zv2cihDqb26GLqvAwDVfqYG5bmhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hy4dRx65jBRnlmmf5xqaDURFoyX1zJs2e/ntt+lj6LD8lnIzLlK9/KIk7y/SWZAiBECGcsYpzxO3ZwM9ZXZ8pufw+vR2FdAZwvufB9EQ+FuIwI55kJ5JQEAzcX23/YKuXfEszsV1keYZa6G1g/r3Vm8MGD9tEouUMqL45JBxwRA= 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=BAVSI2Dt; arc=none smtp.client-ip=121.127.44.73 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="BAVSI2Dt" 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=1779127388; bh=VREGyApHK6J7pc3w6oy726nYHsrZBeAKE5N1IrlK1z4=; b=BAVSI2Dtk/iWbrhsOVq1apsHrbS/czdzyQ/guKPEaDuKjksjpb4+k58c22Ew4BPdy8eAZHgDd a+akCVNeA7LGXIQOJaPK9eoBfx8Fv6fAhdScxg8gWawLTsXUovsm2KR2U+A5ht7g/xHRdxejsDF S3w2sxot4tye3enCYMkwr2lWKVDl2p+twFa4g0ZSruAhKISsck5FAEMBzI6jg0LPJVPDXkajsiM znyMCB+PxdnsfHXUxLpPvqGtZ5cgmyXsBUHXPKfhIjxeLuTe5tiJM/IDICUIpCQ07N54a0PJk+D ssbQf78ioCXEBwQFZ/sbJ6yD1gOyRbEyBe9dXAAssANg== X-Forward-Email-ID: 6a0b5458b84dbc72d2274ed8 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 12/23] drm: bridge: dw_hdmi: Extract dw_hdmi_connector_status_update() Date: Mon, 18 May 2026 18:01:48 +0000 Message-ID: <20260518180206.2480119-13-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move connector EDID update and CEC phys addr handling to a helper function as a preparation before moving EDID refresh from get_modes funcs to detect/force funcs. Reviewed-by: Nicolas Frattaroli Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Pass struct dw_hdmi as a parameter, to allow calls from bridge funcs, Collect t-b tag v5: No change v4: Collect r-b tag v3: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 0dd4c823c60a..a056e147731b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2466,6 +2466,21 @@ static const struct drm_edid *dw_hdmi_edid_read(stru= ct dw_hdmi *hdmi, * DRM Connector Operations */ =20 +static void +dw_hdmi_connector_status_update(struct dw_hdmi *hdmi, + struct drm_connector *connector, + enum drm_connector_status status) +{ + const struct drm_edid *drm_edid; + + drm_edid =3D 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); +} + static enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -2485,18 +2500,10 @@ static int dw_hdmi_connector_get_modes(struct drm_c= onnector *connector) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connector); - const struct drm_edid *drm_edid; - int ret; =20 - drm_edid =3D dw_hdmi_edid_read(hdmi, connector); + dw_hdmi_connector_status_update(hdmi, connector, connector->status); =20 - drm_edid_connector_update(connector, drm_edid); - cec_notifier_set_phys_addr(hdmi->cec_notifier, - connector->display_info.source_physical_address); - ret =3D drm_edid_connector_add_modes(connector); - drm_edid_free(drm_edid); - - return ret; + return drm_edid_connector_add_modes(connector); } =20 static int dw_hdmi_connector_atomic_check(struct drm_connector *connector, --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 6DA9138839C for ; Mon, 18 May 2026 18:03:12 +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=1779127394; cv=none; b=dd6xEfDcrbH9KjUSWtuMrePolgHs38cztI058LROieq4iqjCT7ETSnLOMpSNajYyhKj6RuaqQb3VR5tKd9ixELo47Siu8ylQZQL7lefAPj28oaBozp/2+BBGv89YQIxrLAl5Qyuzd/Qf7dP/JKmBEPp+vtAoEAsG6Kq84aKAJpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127394; c=relaxed/simple; bh=OtMHuXOw5CZXWHUwo68fFhxzMybcZloconXv/fdFaB0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wo0oV0eW5YEDLLsVw2E+x+2PuCSPaRR11dP5Tl1oPerY2T5ooOTeY2PRzGcj6kj4b4AqEGSKWdNMLgKIj0Cdm6BR0pLaHCVkp+BCWuBIbnM107fMQDcishpwyzun6u8bsLLx+LawkhIkixnlHiQ8TQzA0S0ED7f1DlC6N7ULOJA= 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=rHF0rKOf; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="rHF0rKOf" 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=1779127392; bh=lr3z/DHKRf4suiaEwJ9iTpcatjgqAyObdCZqCekB2Iw=; b=rHF0rKOfvMaIl8V04r3cw0/8+MzyIobwcHeRx0WSkY+8tlUHwsXBMfiRd/9VGsCFzpEEnXUyh A547PvzitAwB3BxcacpXkdp4+MIk8NGGMPR1sVMAIMvS6ee7pZfWKucedrUJGAY+Imrk4lu1EYO 2gXFIL/wMJgZ0ieltPZBiRg07576rY5cKwjDFlKhClDmkt2mtvOHWzNqvEbal4plXOlp+v4IdvL ThGQ6VIhaHfPi/pcOoR6T9+hZf7L4ozsgGlPAghAYcEXKuo1Huhy1tyheUnn8XRu73q+3pVy+MK Jq7UwqVwziPBAPqvzMXFs5WkEZvYSHzHC/nkJQNOmd3g== 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- 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/br= idge/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 *hdm= i, { const struct drm_edid *drm_edid; =20 + if (status =3D=3D connector_status_disconnected) { + drm_edid_connector_update(connector, NULL); + cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + return; + } + drm_edid =3D dw_hdmi_edid_read(hdmi, connector); drm_edid_connector_update(connector, drm_edid); drm_edid_free(drm_edid); =20 - cec_notifier_set_phys_addr(hdmi->cec_notifier, - connector->display_info.source_physical_address); + if (status =3D=3D connector_status_connected) + cec_notifier_set_phys_addr(hdmi->cec_notifier, + connector->display_info.source_physical_address); } =20 static enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { - struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, - connector); + struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); enum drm_connector_status status; =20 status =3D dw_hdmi_detect(hdmi); =20 - if (status =3D=3D connector_status_disconnected) - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + dw_hdmi_connector_status_update(hdmi, connector, status); =20 return status; } =20 static int dw_hdmi_connector_get_modes(struct drm_connector *connector) { - struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, - connector); - - dw_hdmi_connector_status_update(hdmi, connector, connector->status); - return drm_edid_connector_add_modes(connector); } =20 @@ -2532,13 +2532,15 @@ static int dw_hdmi_connector_atomic_check(struct dr= m_connector *connector, =20 static void dw_hdmi_connector_force(struct drm_connector *connector) { - struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, - connector); + struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); =20 mutex_lock(&hdmi->mutex); hdmi->force =3D connector->force; + hdmi->last_connector_result =3D connector->status; dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); + + dw_hdmi_connector_status_update(hdmi, connector, connector->status); } =20 static void dw_hdmi_connector_destroy(struct drm_connector *connector) --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 99B8B38839C for ; Mon, 18 May 2026 18:03:17 +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=1779127399; cv=none; b=KGimotqxzYU3nBlK28G8gxLgJ0TuDft6VzcxBg/DBuz42P8Tf6Uo73vwqdUEqjvsJls/GlYXvj8sSHOnvf7d5eGFqxecJaVlyRzuHNCxQ665K+M7GRXaVKu0bNm0Gp3MvEldWoGjG/vHvdwLq0yRGLkCYVnTYOj79U+daqWBrg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127399; c=relaxed/simple; bh=aPjgFj2tFZkTZgLTst0Zgb8TiwhKya/fGTOhynP3e0Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G3J2SW0UYNcgC3nnM7gH/zgAbYjI/l1P3El8PhvyLQJ9mMc80iazzCa7wt898MCk+DysRSIAt31GuCaJd1o3HYR6246eHteBZrE544zTjnulIWr2uqLAbHhceen7yg3hHMy9znsGdOSfXhtOuEtWKO/JwujvOWRZmYLxgniUB50= 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=oKP3PLVp; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="oKP3PLVp" 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=1779127397; bh=3cI+jdj9ZYte4FwNaqyzMzzwM5GJ7XpjpxmuDl+jgno=; b=oKP3PLVpUacKueIN1OxGRp+tS7IKGuWxI/cF8thBI1/t1NmhroaTEaqhhLqOwRcyKEKa3p1+P rM83HAADnS81GLP0iaiQ6FBIQtEWr8LDR9nwhHavt9JHqO2oKQo04gEW4jSyy3Zb/9hFBeYm/Li 5Dv80FVk/XuRWxiVC8A2S3hjyM1lCuce+CP3tHA4Pk3pphUfX9/78ir4zCIjn3aYYpDDZaoe5PX rzKDozVvtCdmew0ZNb0nZFHeLr4Hk4k0NT6Rqvxxhur1YKEh4uCPF0sZzkEEqtdjV7e05LxcQYj pBvSMq+D84tGDNNLZYTN+54eafGnyRJPSSDciR3Bm9VA== X-Forward-Email-ID: 6a0b5461b84dbc72d2274f23 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 14/23] drm: bridge: dw_hdmi: Use display_info is_hdmi and has_audio Date: Mon, 18 May 2026 18:01:50 +0000 Message-ID: <20260518180206.2480119-15-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" drm_edid_connector_update() is being called from bridge connector funcs and from detect and force funcs for dw-hdmi connector. Change to use is_hdmi and has_audio from display_info directly instead of keeping our own state in sink_is_hdmi and sink_has_audio. Also remove the old and unused edid struct member and related define. Reviewed-by: Neil Armstrong Reviewed-by: Nicolas Frattaroli Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change, re-order patch v6: Collect t-b tag v5: No change v4: Collect r-b tag v3: No change v2: Collect r-b tag --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 32 ++++------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index a4ecf830103d..0e84dff72470 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -46,8 +46,6 @@ #define DDC_CI_ADDR 0x37 #define DDC_SEGMENT_ADDR 0x30 =20 -#define HDMI_EDID_LEN 512 - /* DW-HDMI Controller >=3D 0x200a are at least compliant with SCDC version= 1 */ #define SCDC_MIN_SOURCE_VERSION 0x1 =20 @@ -147,8 +145,6 @@ struct dw_hdmi { =20 int vic; =20 - u8 edid[HDMI_EDID_LEN]; - struct { const struct dw_hdmi_phy_ops *ops; const char *name; @@ -158,8 +154,6 @@ struct dw_hdmi { =20 struct i2c_adapter *ddc; void __iomem *regs; - bool sink_is_hdmi; - bool sink_has_audio; =20 struct pinctrl *pinctrl; struct pinctrl_state *default_state; @@ -2056,7 +2050,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, HDMI_FC_INVIDCONF_IN_I_P_INTERLACED : HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE; =20 - inv_val |=3D hdmi->sink_is_hdmi ? + inv_val |=3D display->is_hdmi ? HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE : HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE; =20 @@ -2292,7 +2286,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, if (hdmi->hdmi_data.enc_out_bus_format =3D=3D MEDIA_BUS_FMT_FIXED) hdmi->hdmi_data.enc_out_bus_format =3D MEDIA_BUS_FMT_RGB888_1X24; =20 - hdmi->hdmi_data.rgb_limited_range =3D hdmi->sink_is_hdmi && + hdmi->hdmi_data.rgb_limited_range =3D display->is_hdmi && drm_default_rgb_quant_range(mode) =3D=3D HDMI_QUANTIZATION_RANGE_LIMITED; =20 @@ -2312,7 +2306,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, /* HDMI Initialization Step B.3 */ dw_hdmi_enable_video_path(hdmi); =20 - if (hdmi->sink_has_audio) { + if (display->has_audio) { dev_dbg(hdmi->dev, "sink has audio support\n"); =20 /* HDMI Initialization Step E - Configure audio */ @@ -2321,7 +2315,7 @@ static int dw_hdmi_poweron(struct dw_hdmi *hdmi, } =20 /* not for DVI mode */ - if (hdmi->sink_is_hdmi) { + if (display->is_hdmi) { dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); =20 /* HDMI Initialization Step F - Configure AVI InfoFrame */ @@ -2435,29 +2429,13 @@ static const struct drm_edid *dw_hdmi_edid_read(str= uct dw_hdmi *hdmi, struct drm_connector *connector) { const struct drm_edid *drm_edid; - const struct edid *edid; =20 if (!hdmi->ddc) return NULL; =20 drm_edid =3D drm_edid_read_ddc(connector, hdmi->ddc); - if (!drm_edid) { + if (!drm_edid) dev_dbg(hdmi->dev, "failed to get edid\n"); - 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 =3D 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 =3D drm_detect_hdmi_monitor(edid); - hdmi->sink_has_audio =3D drm_detect_monitor_audio(edid); =20 return drm_edid; } --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 55271305675 for ; Mon, 18 May 2026 18:03:22 +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=1779127404; cv=none; b=LqAYXlKyOrDFZz7Yiww2Fu1g4JJH6ili9TYz7UcbycQuqbCFFnx02ZEg+9ueGuE4N4VlTvVXES3wolPgVboWqjwyxGeg5DyGn2UXlMRTjZC+0HJcLjOTekaE4MCMy9yeGY51h3IBNK2g9DB1uEB0UZ9j/7WCa43mbqzTKNVQ9Co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127404; c=relaxed/simple; bh=S0Pv7cemxkmwMqKP+dbnMBJv0+tJmP3YiDn21DzeREo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OKxDMk0vATyYQOuI5+PLN0eu51YSBKDCbzUMgIfxMdX39FncBAqpFYACdz5mL1bQutyG4qHJX1gRB57FCQmLAtiL3DEM1EUWD6L1sxbLlbBtyfhsRH/0OO+xZfH3/fJtYF0gd+eYZnDUNJKiRZNVhiGW+zEL9BchWq7QRDQ/jR4= 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=iRD1Bil5; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="iRD1Bil5" 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=1779127401; bh=ozZ64lc/u62KCDiC1IyBlegc4d7ugh2Odmie8y2x51Y=; b=iRD1Bil56FSaomRC7C3X8yWlq5QFlMqkQ9Dku00doXt6Nvod2Yi9WNAZt33XU9hwbQKCq+gpG kgpc2hCnZekgHCI1YyLg4FKRxMcyrTrdAIQG4HGuYxlLCYB+tH5E+vB/74N0JgxbfNM9ICbhdlP YY9Aq6+MqbE95/yKhX0IM4f4JKHlqabVwWZ6Y5cisXUB9eqVAfuHKENPgeUEBXBxrZG4Vx2ArvX O1BBbIUiCQ2STZkDx6Yt1EYYKA8W/e6OELbuzQuVByRVpfRS9qalGRlAO0Xb6M9tv5v9K8N/2i9 +ZZgtd0M4bg6YhcN5B8b9nUF27MXaikj6cjCxs97T7ew== X-Forward-Email-ID: 6a0b5465b84dbc72d2274f3e 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 15/23] drm: bridge: dw_hdmi: Use generic CEC notifier helpers Date: Mon, 18 May 2026 18:01:51 +0000 Message-ID: <20260518180206.2480119-16-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The commit 8b1a8f8b2002 ("drm/display: add CEC helpers code") added generic CEC helpers to be used by HDMI drivers. Replace the open-coded CEC notifier handling with use of the generic CEC notifier helpers. Ensure DRM_DISPLAY_HDMI_CEC_NOTIFIER_HELPER is also selected when DRM_DW_HDMI_CEC is enabled so that the CEC helpers is available. The drmm release action for the generic CEC notifier should run just before dw_hdmi_connector_destroy(), closely matching the lifetime of the replaced CEC notifier and the connector. Reviewed-by: Neil Armstrong Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Update commit message, Collect t-b tag v5: Collect r-b tag v4: New patch --- drivers/gpu/drm/bridge/synopsys/Kconfig | 1 + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 26 +++++------------------ 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/Kconfig b/drivers/gpu/drm/brid= ge/synopsys/Kconfig index a46df7583bcf..e6723af03b43 100644 --- a/drivers/gpu/drm/bridge/synopsys/Kconfig +++ b/drivers/gpu/drm/bridge/synopsys/Kconfig @@ -49,6 +49,7 @@ config DRM_DW_HDMI_CEC depends on DRM_DW_HDMI select CEC_CORE select CEC_NOTIFIER + select DRM_DISPLAY_HDMI_CEC_NOTIFIER_HELPER help Support the CE interface which is part of the Synopsys Designware HDMI block. diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 0e84dff72470..37406555af7b 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -23,12 +23,11 @@ #include #include =20 -#include - #include #include =20 #include +#include #include #include #include @@ -183,8 +182,6 @@ struct dw_hdmi { void (*enable_audio)(struct dw_hdmi *hdmi); void (*disable_audio)(struct dw_hdmi *hdmi); =20 - struct cec_notifier *cec_notifier; - hdmi_codec_plugged_cb plugged_cb; struct device *codec_dev; enum drm_connector_status last_connector_result; @@ -2453,7 +2450,7 @@ dw_hdmi_connector_status_update(struct dw_hdmi *hdmi, =20 if (status =3D=3D connector_status_disconnected) { drm_edid_connector_update(connector, NULL); - cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); + drm_connector_cec_phys_addr_invalidate(connector); return; } =20 @@ -2462,8 +2459,7 @@ dw_hdmi_connector_status_update(struct dw_hdmi *hdmi, drm_edid_free(drm_edid); =20 if (status =3D=3D connector_status_connected) - cec_notifier_set_phys_addr(hdmi->cec_notifier, - connector->display_info.source_physical_address); + drm_connector_cec_phys_addr_set(connector); } =20 static enum drm_connector_status @@ -2525,9 +2521,6 @@ static void dw_hdmi_connector_destroy(struct drm_conn= ector *connector) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); =20 - cec_notifier_conn_unregister(hdmi->cec_notifier); - hdmi->cec_notifier =3D NULL; - drm_connector_cleanup(connector); drm_bridge_put(&hdmi->bridge); } @@ -2550,8 +2543,6 @@ static const struct drm_connector_helper_funcs dw_hdm= i_connector_helper_funcs =3D static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) { struct drm_connector *connector =3D &hdmi->connector; - struct cec_connector_info conn_info; - struct cec_notifier *notifier; int ret; =20 if (hdmi->version >=3D 0x200a) @@ -2587,15 +2578,8 @@ static int dw_hdmi_connector_create(struct dw_hdmi *= hdmi) =20 drm_connector_attach_encoder(connector, hdmi->bridge.encoder); =20 - cec_fill_conn_info_from_drm(&conn_info, connector); - - notifier =3D cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); - if (!notifier) - return -ENOMEM; - - hdmi->cec_notifier =3D notifier; - - return 0; + return drmm_connector_hdmi_cec_notifier_register(connector, NULL, + hdmi->dev); } =20 /* -----------------------------------------------------------------------= ------ --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (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 214AC395DBF for ; Mon, 18 May 2026 18:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=149.28.215.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127447; cv=none; b=RlRyY46I9mXtoZmt5WSTf8tVb3jcYjNR71l5yO0mn82HYoVNC0CaQAWSO9A+xdPBK7Bmc+QMIl9T3QY7nxbpaGsAWiAfabZD+V2iK884nivYixEEi0KCf/yFDkw+A1EgFS3988oYbxt7qwfRWhKqrqlyu1fds8gT0BUw0yl6Fvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127447; c=relaxed/simple; bh=Wq7HFLMcq+ycT/VWxLv/F1+w4pBeTXs/AtjVVW2asLA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rc/EW0vWx3VVFgEh/K54nvyivjZ8aeZinOz8JJMpkvAreec0K2uJmWkp9yeXI2lSrY/QODwKKRKFMWpz7vx1M6aa00wUlQyuw44EvqrkYhwkjIjvMIYd0DcVWL9el3/AAnKlP0c4UbjDyQPpYtHfTVCX6uzE/BIcfajBt8mfN1E= 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=szIgxJAh; arc=none smtp.client-ip=149.28.215.223 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="szIgxJAh" 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=1779127445; bh=pRDjhi4A67HVrKb8G93iuKDjCCMCnoa34s8OGiHVDR4=; b=szIgxJAhIaqegswDM+ufEsIP6zg5cXLWKo3CH4U4wKSvW6JAYDB9Mo5ZVuRkFolkQ5c6oPZS2 gVM9nRjZ4tMH9acOxcBqNGhL7Z13ieWQEGD5usjrP76Qk5v7fEDmOyn00jipP8bSDBPx4X9Z5G8 ZVVifM9mcR2kWdPX6Wtkyq9gr+pppwvS0IiMmiZVKvexaaOWvj8ngEqO3iUnpWA4sDwusXpAPE7 gvQOW3SZjoZ/x8Pl4y4MMXV56fvKUrGOzHXRg8y7GrZRObPjAbIagcLQjTje3Dr68q+XnNid9Pt wMRaV0I9GteNysLfY3T34Qw1R0VIOalTnj73H0TXK11Q== X-Forward-Email-ID: 6a0b546ab84dbc72d2274f59 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 16/23] drm: bridge: dw_hdmi: Update EDID and CEC phys addr in bridge detect() Date: Mon, 18 May 2026 18:01:52 +0000 Message-ID: <20260518180206.2480119-17-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update EDID and CEC phys addr in the bridge detect() func to closely match the behavior of a bridge connector with a HDMI bridge attached and the dw-hdmi connector. This change introduce a slight delay to the bridge connector detect() and get_modes() funcs due to multiple EDID reads. This is an acceptable added delay to help ensure EDID and CEC phys addr always are correct. Signed-off-by: Jonas Karlman Reviewed-by: Neil Armstrong Tested-by: Heiko Stuebner #rk3328 --- v7: Update commit message v6: New patch This is a temporary change until dw-hdmi is fully converted into a HDMI bridge in a future part of this multi-series effort. The patch "drm/bridge-connector: Use cached connector status in .get_modes()" [1] can help remove one unnecessary EDID read until dw-hdmi is fully converted into a HDMI bridge. [1] https://lore.kernel.org/dri-devel/20260426-dw-hdmi-qp-scramb-v5-3-d778e= 70c317b@collabora.com/ --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 37406555af7b..0c4388e7aa5e 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2947,8 +2947,17 @@ static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge, struct drm_connector *con= nector) { struct dw_hdmi *hdmi =3D bridge->driver_private; + enum drm_connector_status status; =20 - return dw_hdmi_detect(hdmi); + status =3D dw_hdmi_detect(hdmi); + + /* + * Update EDID and CEC phys addr to match the behavior of a bridge + * connector with a HDMI bridge attached and the dw-hdmi connector. + */ + dw_hdmi_connector_status_update(hdmi, connector, status); + + return status; } =20 static const struct drm_edid *dw_hdmi_bridge_edid_read(struct drm_bridge *= bridge, --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 2983E38239E for ; Mon, 18 May 2026 18:03:31 +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=1779127413; cv=none; b=mS0B9y09rjSLa4X2DxXN6JiIUxsZlBoYGM+Jz0pY4jZjBTL7oo0NQ7U6bt9KOgSlBWjIhBk3J/2LbtA0MABZOhRx+z0lULn0sjLBwA2MSOALFkD31thERwRWiOV+dtVwN4KFnavWcBEPTAY/pMfwYqMSxLCvnaKJ1da5b6Rw57g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127413; c=relaxed/simple; bh=/bn/ib7xA0N4c3muUGNEVYXey9RC1LAI6e7bdbz04I0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LCRS535vuQwB+yls3wbNfcrnwXv5+K4E6xtYUj9PUReml1V2KsdURVLQYOGKgdIc72qjJjZkCvRGhTvJRYLGhvSJZONhfEWRgtEjOWAop3FPX296MDZQ/ZJ0/6yck7XliOBK1gB1cyN/U0OUC5Q1AvGGsnt6NZgpkr184S96VDo= 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=l8eHPFv0; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="l8eHPFv0" 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=1779127411; bh=HKqZrWH/mIENot9S0r7SqDZlavFSRVbiuTr0NBVKdNk=; b=l8eHPFv0TmAuE5YrdT6n7leBO/3MCxmMkzPr36OOoa1EzoHVYffsNv0dQlT0TKPqgq9J+RieA voIrVa76jwrzVHpqGbBDhpdcUB0VeJ0rHtjJoVtdyIBFidSgOmLtCTKrEbFGnkwSQOlWhQjeoS6 eXbyZqFvpL1sfchRxuS79+Cv2qzRa8SM/U/KTqTEGHK3SWJi5lJNiFBRkX2FvqwO0/wvi9t0Rb0 IOpYafFlN11d8K3pRJLAQOLNqBGf55Vh71ri4VW+7qqbPlcGhryaujlHvYRIQlXJnOU4nX5BZXn UFX2+phIfONpO3FnAzZDCcDGBDg26kGSQ8+NoGJs58Gw== X-Forward-Email-ID: 6a0b546eb84dbc72d2274f74 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 17/23] drm: bridge: dw_hdmi: Declare bridge CEC notifier support Date: Mon, 18 May 2026 18:01:53 +0000 Message-ID: <20260518180206.2480119-18-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" EDID and CEC phys addr is now being updated in bridge detect() func, making it possible to have CEC notifier support using the bridge connector. Add the CEC notifier bridge op to instruct the bridge connector to make use of the generic CEC notifier helpers. Signed-off-by: Jonas Karlman Acked-by: Hans Verkuil Tested-by: Heiko Stuebner #rk3328 --- v7: Only declare CEC notifier support when CEC device register succeeds v6: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 0c4388e7aa5e..5dacb8a99715 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3515,6 +3515,10 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device= *pdev, pdevinfo.dma_mask =3D 0; =20 hdmi->cec =3D platform_device_register_full(&pdevinfo); + if (!IS_ERR(hdmi->cec)) { + hdmi->bridge.ops |=3D DRM_BRIDGE_OP_HDMI_CEC_NOTIFIER; + hdmi->bridge.hdmi_cec_dev =3D hdmi->dev; + } } =20 drm_bridge_add(&hdmi->bridge); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 5328D38239E for ; Mon, 18 May 2026 18:03:37 +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=1779127418; cv=none; b=ipG0HPWVfWD+yFXAzKuRzzwtTTZRki6lhstJqW3zRuiN3S10tIr9UNLqMMoowx/Ol956uPX66lZcuOZ9Gm4zrdG1dhBcClBn8iCFKX2fZKg1DfxcOiweY1B0HRxxwXTe4UTuqxEVcR+vycGrlqv7Nr2if2vruMNiGj535mleIxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127418; c=relaxed/simple; bh=o5jV3jx0mJ5mgZ4jLLFGXoPXS/YTfsilvhksT+Tc3Nc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GoMojJTvmZwcktdR+1AM3yRZgcFfXSQy9nn85gyfgr/jwrf3Oni52J3PVuGN3zTz3G2OSHRQSvsFCgcewesnUZbfOUo4wHq25p0ntDncyQyGiPeq6jOOjOG/lv7FHtFGU3nGf3ZgOzVsfTHXHoRcGrvPksyl45RtW2VekuocDoo= 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=GpxA/ofT; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="GpxA/ofT" 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=1779127416; bh=/hZiUkfIGiN8nQnQfqNQPTR4hVnEkYNLDTXPMKl0d0I=; b=GpxA/ofTPszh8XDD2h1fr0Ya2OjQ5Mzt/ZpGrDymGCbcWWJJlHWdcGfA9D/qywIcftvOb99lf XMPsq+MhfSzld/em66LRRUYJa7gfL2Sujx5q8ubles0t9oMTosuxefxEfkxRxHQnN8QxffPDXre 8uyZpNXUmDuHVOjLMWQGHQt56WZ/9MnoS82IdppxejCI/glUMVe7FMMj4bQAOYPr5G3fbeo0YG2 g+q8VWGzmmI4sGEzZdJaXT/+7weSp59CRvJO8mpGiK1ZTaTpLLSG6xW6AGFtHcc76dFOXbqQSYt QXCEinIMIwNBQOCDpKBhhlOeOOtqzBBsYWJ38OF5yjkw== X-Forward-Email-ID: 6a0b5472b84dbc72d2274f8f 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 18/23] drm: bridge: dw_hdmi: Drop call to drm_bridge_hpd_notify() Date: Mon, 18 May 2026 18:01:54 +0000 Message-ID: <20260518180206.2480119-19-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The use of calls to both drm_helper_hpd_irq_event() and drm_bridge_hpd_notify() from the HPD IRQ handler may cause multiple hotplug uevents and modesets when the bridge connector is used. Use of drm_helper_hpd_irq_event() cause the internal DRM function check_connector_changed() to be called, which in turn calls the connector detect()/force() funcs to detect any connection status or epoch changes, and when changed trigger a hotplug uevent. This also help ensure that EDID and CEC phys addr is updated. If only a call drm_bridge_hpd_notify() would be used, a custom connector status/EDID change detection logic needs to be implemented, to fully match what check_connector_changed() already provides. The bridge connector detect() func also ensures that any hpd_notify() funcs are called for all bridges in the chain, so there is not really any need to have a call to drm_bridge_hpd_notify() here. With both calls there is two hotplug uevents, two modesets and a total of four .hpd_notify() calls (using a bridge connector): dw_hdmi_irq(): EVENT=3Dplugout drm_helper_hpd_irq_event(): dw_hdmi_bridge_hpd_notify(status=3D2) [drm:check_connector_changed] [CONNECTOR:46:HDMI-A-1] status updated fr= om connected to disconnected [drm:check_connector_changed] [CONNECTOR:46:HDMI-A-1] Changed epoch cou= nter 1 =3D> 2 [drm:drm_sysfs_connector_hotplug_event] [CONNECTOR:46:HDMI-A-1] generat= ing connector hotplug event drm_client_hotplug(): [drm:drm_fb_helper_hotplug_event] [drm:drm_client_modeset_probe] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:46:HDMI-A-1] dw_hdmi_bridge_hpd_notify(status=3D2) [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:46:HDMI-A-1] d= isconnected [drm:drm_edid_connector_update] [CONNECTOR:46:HDMI-A-1] EDID changed, e= poch counter 3 [drm:drm_client_modeset_probe] No connectors reported connected with mo= des [drm:drm_client_modeset_probe] [CONNECTOR:46:HDMI-A-1] enabled? no [drm:drm_client_firmware_config.isra.0] Not using firmware configuration [drm:drm_client_modeset_probe] picking CRTCs for 3840x2160 config [drm:drm_client_hotplug] fbdev: ret=3D0 drm_bridge_hpd_notify(): dw_hdmi_bridge_hpd_notify(status=3D2) [drm:drm_sysfs_connector_hotplug_event] [CONNECTOR:46:HDMI-A-1] generat= ing connector hotplug event drm_client_hotplug(): [drm:drm_fb_helper_hotplug_event] [drm:drm_client_modeset_probe] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:46:HDMI-A-1] dw_hdmi_bridge_hpd_notify(status=3D2) [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:46:HDMI-A-1] d= isconnected [drm:drm_client_modeset_probe] No connectors reported connected with mo= des [drm:drm_client_modeset_probe] [CONNECTOR:46:HDMI-A-1] enabled? no [drm:drm_client_firmware_config.isra.0] Not using firmware configuration [drm:drm_client_modeset_probe] picking CRTCs for 3840x2160 config [drm:drm_client_hotplug] fbdev: ret=3D0 Change to only call drm_helper_hpd_irq_event() from HPD IRQ handler to ensure that only one hotplug uevent is sent to userspace when connection status or EDID changes. With only a call the drm_helper_hpd_irq_event() there is only a single hotplug uevent and only two .hpd_notify() calls: dw_hdmi_irq(): EVENT=3Dplugout drm_helper_hpd_irq_event(): dw_hdmi_bridge_hpd_notify(status=3D2) [drm:check_connector_changed] [CONNECTOR:46:HDMI-A-1] status updated fr= om connected to disconnected [drm:check_connector_changed] [CONNECTOR:46:HDMI-A-1] Changed epoch cou= nter 1 =3D> 2 [drm:drm_sysfs_connector_hotplug_event] [CONNECTOR:46:HDMI-A-1] generat= ing connector hotplug event drm_client_hotplug(): [drm:drm_fb_helper_hotplug_event] [drm:drm_client_modeset_probe] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:46:HDMI-A-1] dw_hdmi_bridge_hpd_notify(status=3D2) [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:46:HDMI-A-1] d= isconnected [drm:drm_edid_connector_update] [CONNECTOR:46:HDMI-A-1] EDID changed, e= poch counter 3 [drm:drm_client_modeset_probe] No connectors reported connected with mo= des [drm:drm_client_modeset_probe] [CONNECTOR:46:HDMI-A-1] enabled? no [drm:drm_client_firmware_config.isra.0] Not using firmware configuration [drm:drm_client_modeset_probe] picking CRTCs for 3840x2160 config [drm:drm_client_hotplug] fbdev: ret=3D0 Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Drop the call from IRQ handler instead, prior to use of a HPD delayed work to avoid a possible deadlock with use of sync() calls in the bridge hpd_disable() ops, Update commit message, Collect t-b tag v5: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 5dacb8a99715..8afc9d240121 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3101,10 +3101,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) status =3D=3D connector_status_connected ? "plugin" : "plugout"); =20 - if (hdmi->bridge.dev) { + if (hdmi->bridge.dev) drm_helper_hpd_irq_event(hdmi->bridge.dev); - drm_bridge_hpd_notify(&hdmi->bridge, status); - } } =20 hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 Received: from smtp.forwardemail.net (smtp.forwardemail.net [121.127.44.73]) (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 7093E38A713 for ; Mon, 18 May 2026 18:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=121.127.44.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127421; cv=none; b=ZjcPy7Q694c94lrmsrAEZuwQ7SOm4EtKMfyWn/P1srStbe6MG//t+ZHpZY3MldG+Di80YECcfo0AvBygPN/L9J1JFnAkqHiI4t6yMapeq2nGQIlZVZGaqDgwep4ISAQQNK3Pbbggbn0F+JwY2/UMbWCVDeul3Rck57Rabp4MhtA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127421; c=relaxed/simple; bh=7tdKucEB1FT5o83Pw4WOLkuAeD4Nho/RlyViLslg6WU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OGZpoyfDBn5UA+6PBQ/xzatG1zMyyNu6ddtzfJEAOaDo+uoWzIGI1YH1R/Z+c1PXA/rGf3oDbC31iFGug50vqCyG4ArxmTM24AUyE2jkaGudshtkmGH9OMA9Gz7JKcW3wd7xPKQsKwkQ7oPuDx0f6uv67shtiIFv44byeNHarKc= 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=MDnLZT/4; arc=none smtp.client-ip=121.127.44.73 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="MDnLZT/4" 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=1779127418; bh=wJnhBtAKYj8914+p1N910J9+JVRtN9gFjiQ73Zs/23Y=; b=MDnLZT/4dKsc8Zw2uCNfogXIhBHdwq9wbN2BkHs9Elt65cngCEU/4sCVlZALuWTkq7oxKgy9u DRqa6b4Yu7DNcfyqfS22ByQC9F5QOqJN84wKmsGbKjNHVKkZT7vbAa8be/oxLWmA5VJ0HGtQBkj p8othvCbk5+/d3nfvEqnziGQbvvdbidYlGsY9CNFgpMatDCGCbd92clYfpSbidGPv1xPdkpI20m pwXuKK0Wqb95DAUNH9cxrdaoHllOBNUgYglfcbc9hEBX6SHzOF5PaXQ9PQC4bsWAlMCCFnOb0a2 TYF19cbNc579cmbZ2Ebe/LVOwWrpFLuMm0USmLf8w0bQ== X-Forward-Email-ID: 6a0b5476b84dbc72d2274faa X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 121.127.44.73 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 19/23] drm: bridge: dw_hdmi: Use delayed_work to debounce hotplug event Date: Mon, 18 May 2026 18:01:55 +0000 Message-ID: <20260518180206.2480119-20-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" HDMI Specification Version 1.4b chapter 8.5 mentions: An HDMI Sink shall not assert high voltage level on its Hot Plug Detect pin when the E-EDID is not available for reading. A Source may use a high voltage level Hot Plug Detect signal to initiate the reading of E-EDID data. An HDMI Sink shall indicate any change to the contents of the E-EDID by driving a low voltage level pulse on the Hot Plug Detect pin. This pulse shall be at least 100 msec. Use a delayed work to debounce reacting on HPD events to improve handling of a HPD low voltage level pulse when a sink changes the EDID. The delayed work is only enabled between enable_hpd()/hpd_enable() and disable_hpd()/hpd_disable() calls from core, i.e. enabled after attach/bind/resume and disabled before detach/unbind/suspend. The 1100 msec hotplug debounce timeout was arbitrarily picked to match other drivers using same const, and testing using a Raspberry Pi Monitor seem to use a 200-300 msec pulse when going from standby to power on state. Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: Change to free irq before mute and clear using IH regs, also include clear of STAT0_RX_SENSE v6: Change back to disable_delayed_work_sync() in hpd disable ops, Ensure HPD interrupt is masked and IRQ handler is disabled early in dw_hdmi_remove() to prevent any irq re-arming of delayed work, Drop use of suspend helper v5: Change to none-sync disable_delayed_work() in hpd disable ops, Change to cancel_delayed_work_sync() in remove, Add cancel_delayed_work_sync() to new suspend helper v4: Disable/mask delayed_work until enable_hpd()/hpd_enable(), Read connector status directly from HW regs in hpd_work v3: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 80 +++++++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 8afc9d240121..270db58a0e7c 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -50,6 +50,8 @@ =20 #define HDMI14_MAX_TMDSCLK 340000000 =20 +#define HOTPLUG_DEBOUNCE_MS 1100 + static const u16 csc_coeff_default[3][4] =3D { { 0x2000, 0x0000, 0x0000, 0x0000 }, { 0x0000, 0x2000, 0x0000, 0x0000 }, @@ -185,6 +187,7 @@ struct dw_hdmi { hdmi_codec_plugged_cb plugged_cb; struct device *codec_dev; enum drm_connector_status last_connector_result; + struct delayed_work hpd_work; }; =20 const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(struct dw_hdmi *hdmi) @@ -2517,6 +2520,20 @@ static void dw_hdmi_connector_force(struct drm_conne= ctor *connector) dw_hdmi_connector_status_update(hdmi, connector, connector->status); } =20 +static void dw_hdmi_connector_enable_hpd(struct drm_connector *connector) +{ + struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); + + enable_delayed_work(&hdmi->hpd_work); +} + +static void dw_hdmi_connector_disable_hpd(struct drm_connector *connector) +{ + struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); + + disable_delayed_work_sync(&hdmi->hpd_work); +} + static void dw_hdmi_connector_destroy(struct drm_connector *connector) { struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); @@ -2538,6 +2555,8 @@ static const struct drm_connector_funcs dw_hdmi_conne= ctor_funcs =3D { static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_fu= ncs =3D { .get_modes =3D dw_hdmi_connector_get_modes, .atomic_check =3D dw_hdmi_connector_atomic_check, + .enable_hpd =3D dw_hdmi_connector_enable_hpd, + .disable_hpd =3D dw_hdmi_connector_disable_hpd, }; =20 static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) @@ -2968,6 +2987,20 @@ static const struct drm_edid *dw_hdmi_bridge_edid_re= ad(struct drm_bridge *bridge return dw_hdmi_edid_read(hdmi, connector); } =20 +static void dw_hdmi_bridge_hpd_enable(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi =3D bridge->driver_private; + + enable_delayed_work(&hdmi->hpd_work); +} + +static void dw_hdmi_bridge_hpd_disable(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi =3D bridge->driver_private; + + disable_delayed_work_sync(&hdmi->hpd_work); +} + static const struct drm_bridge_funcs dw_hdmi_bridge_funcs =3D { .atomic_duplicate_state =3D drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state =3D drm_atomic_helper_bridge_destroy_state, @@ -2981,6 +3014,8 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_f= uncs =3D { .mode_valid =3D dw_hdmi_bridge_mode_valid, .detect =3D dw_hdmi_bridge_detect, .edid_read =3D dw_hdmi_bridge_edid_read, + .hpd_enable =3D dw_hdmi_bridge_hpd_enable, + .hpd_disable =3D dw_hdmi_bridge_hpd_disable, }; =20 /* -----------------------------------------------------------------------= ------ @@ -3101,8 +3136,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) status =3D=3D connector_status_connected ? "plugin" : "plugout"); =20 - if (hdmi->bridge.dev) - drm_helper_hpd_irq_event(hdmi->bridge.dev); + mod_delayed_work(system_percpu_wq, &hdmi->hpd_work, + msecs_to_jiffies(HOTPLUG_DEBOUNCE_MS)); } =20 hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); @@ -3112,6 +3147,29 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) return IRQ_HANDLED; } =20 +static void dw_hdmi_hpd_work(struct work_struct *work) +{ + struct dw_hdmi *hdmi =3D container_of(work, struct dw_hdmi, hpd_work.work= ); + struct drm_device *dev =3D hdmi->bridge.dev; + + if (WARN_ON(!dev)) + return; + + /* + * Notify the DRM core of the HPD event using drm_helper_hpd_irq_event() + * instead of drm_bridge_hpd_notify(). This will cause the DRM function + * check_connector_changed() to be called, which in turn calls the + * connector detect()/force() funcs to detect any connection status or + * epoch changes. The bridge connector detect() func also ensures that + * any hpd_notify() funcs are called for all bridges in the chain. + * + * drm_bridge_hpd_notify() shares a mutex with drm_bridge_hpd_disable(), + * and can result in a deadlock due to the disable_delayed_work_sync() + * call to wait on work to complete in dw_hdmi_bridge_hpd_disable(). + */ + drm_helper_hpd_irq_event(dev); +} + static const struct dw_hdmi_phy_data dw_hdmi_phys[] =3D { { .type =3D DW_HDMI_PHY_DWC_HDMI_TX_PHY, @@ -3396,6 +3454,9 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, goto err_res; } =20 + INIT_DELAYED_WORK(&hdmi->hpd_work, dw_hdmi_hpd_work); + disable_delayed_work(&hdmi->hpd_work); + ret =3D devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq, dw_hdmi_irq, IRQF_SHARED, dev_name(dev), hdmi); @@ -3532,6 +3593,18 @@ EXPORT_SYMBOL_GPL(dw_hdmi_probe); =20 void dw_hdmi_remove(struct dw_hdmi *hdmi) { + struct platform_device *pdev =3D to_platform_device(hdmi->dev); + int irq =3D platform_get_irq(pdev, 0); + + /* Free, mute and clear phy interrupts */ + devm_free_irq(hdmi->dev, irq, hdmi); + hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, + HDMI_IH_PHY_STAT0); + + /* Cancel any pending hot plug work */ + cancel_delayed_work_sync(&hdmi->hpd_work); + drm_bridge_remove(&hdmi->bridge); =20 if (hdmi->audio && !IS_ERR(hdmi->audio)) @@ -3539,9 +3612,6 @@ void dw_hdmi_remove(struct dw_hdmi *hdmi) if (!IS_ERR(hdmi->cec)) platform_device_unregister(hdmi->cec); =20 - /* Disable all interrupts */ - hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); - if (hdmi->i2c) i2c_del_adapter(&hdmi->i2c->adap); else --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 C92A0389DED for ; Mon, 18 May 2026 18:03:42 +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=1779127424; cv=none; b=ZEwOnMdW5qNgpMcBnXmq6Si2xFofR5lmnewB+gDXwWNPtSiKp8LHk6Xtcj+Hs5hFSC0tXFdCBTEkCDwuvPmMkeCsQKyU+F0T4rTH5dhcop8CN71ERXwangb9eraObDeiio98wrhC8BMm0cnO45jTouSDJMyLhbTEl8Kf2EZyh/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127424; c=relaxed/simple; bh=hhDIR+PQ3uddj+E0YHPdeb3FIA4GJdtTEPsQfBIBOxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KNdju57AqFuWfLzDzURAMsWh3RQQ9muZXKHaVCFjSwbGELGN3cwjFwUdo31QaOjZGWE4r5P7zGmYoy84yrvpsJeZqlBwSMKWqoIemk1t3RsExxactU4lK+DCd8tqcF+lNuX3QJgt6EL24O0Mh2mVMnvnsaZ5Y3AHvyOUMWwyXAw= 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=oS+hH8tu; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="oS+hH8tu" 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=1779127422; bh=+uSrtO2JJzMCbI3CJAflxiCkbYeBMnL/M2bFQGOmTz8=; b=oS+hH8tuwZHIBltI8wO2v5Cs66x+zUrhB2cZz+h/neLAKcDLM4tcnOA5hTPZd7ILRADLYsOMe 0ztP+cFzYFmwbPJCS1KQldDlZDeq41hOgRv64e3LKaVFeHTb+6KiiY0cHxEp4FZ5KgvcmH+a0wh TmhfEFSNC4aYg1N1WqJMzeG9RbxO/JRf+c5RCrGGmQu0W5sh7/5HfWJEbvccAHk/IYnrmKUuYPn qHW+b5CVG6VMKCsSgE4kBcIwyopqeaw9xNNHXtz/UFUBHmySSEY8I3oQLBPXX02Zgwh54yEM02o 9vmM3KIvdzXkSIlAh2mXz1Hq4O6d1zHvMzcXEYSSfh7Q== X-Forward-Email-ID: 6a0b547bb84dbc72d2274fc5 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 20/23] drm: bridge: dw_hdmi: Rework HDP and RXSENSE interrupt handling Date: Mon, 18 May 2026 18:01:56 +0000 Message-ID: <20260518180206.2480119-21-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The commit aeac23bda87f ("drm: bridge/dw_hdmi: improve HDMI enable/disable handling") added use of PHY RXSENSE indications to avoid triggering a full enable/disable of the HDMI block when a sink use a HPD low voltage level pulse to indicate changes of the EDID. HDMI Specification Version 1.4b chapter 8.5 mentions: An HDMI Sink shall indicate any change to the contents of the E-EDID by driving a low voltage level pulse on the Hot Plug Detect pin. This pulse shall be at least 100 msec. A delayed work is now used to debounce reacting on a HPD low voltage level pulse when a sink changes the EDID. The delayed work triggers a hotplug uevent every time the connection status or EDID has changed. Remove RXSENSE handling to simplify the HPD interrupt handling and instead depend on the delayed work to detect any connection status or EDID changes. This also ensures the initial HPD interrupt polarity is based on current HPD status to avoid an unnecessary interrupt from being triggered immediately at probe or resume when a sink is connected. Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: Remove clear of STAT0_RX_SENSE in dw_hdmi_remove() added in prior patch v6: Update commit message, Collect t-b tag v5: Add comment about interrupt generation v4: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 147 ++++------------------ 1 file changed, 22 insertions(+), 125 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 270db58a0e7c..2e09bff5faf7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -161,11 +161,7 @@ struct dw_hdmi { struct pinctrl_state *unwedge_state; =20 struct mutex mutex; /* for state below */ - enum drm_connector_force force; /* mutex-protected force state */ struct drm_connector *curr_conn;/* current connector (only valid when !di= sabled) */ - bool disabled; /* DRM has disabled our bridge */ - bool rxsense; /* rxsense state */ - u8 phy_mask; /* desired phy int mask settings */ u8 mc_clkdis; /* clock disable register */ =20 spinlock_t audio_lock; @@ -196,14 +192,6 @@ const struct dw_hdmi_plat_data *dw_hdmi_to_plat_data(s= truct dw_hdmi *hdmi) } EXPORT_SYMBOL_GPL(dw_hdmi_to_plat_data); =20 -#define HDMI_IH_PHY_STAT0_RX_SENSE \ - (HDMI_IH_PHY_STAT0_RX_SENSE0 | HDMI_IH_PHY_STAT0_RX_SENSE1 | \ - HDMI_IH_PHY_STAT0_RX_SENSE2 | HDMI_IH_PHY_STAT0_RX_SENSE3) - -#define HDMI_PHY_RX_SENSE \ - (HDMI_PHY_RX_SENSE0 | HDMI_PHY_RX_SENSE1 | \ - HDMI_PHY_RX_SENSE2 | HDMI_PHY_RX_SENSE3) - static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) { regmap_write(hdmi->regm, offset << hdmi->reg_shift, val); @@ -1702,36 +1690,25 @@ EXPORT_SYMBOL_GPL(dw_hdmi_phy_read_hpd); void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data, bool force, bool disabled, bool rxsense) { - u8 old_mask =3D hdmi->phy_mask; - - if (force || disabled || !rxsense) - hdmi->phy_mask |=3D HDMI_PHY_RX_SENSE; - else - hdmi->phy_mask &=3D ~HDMI_PHY_RX_SENSE; - - if (old_mask !=3D hdmi->phy_mask) - hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); } EXPORT_SYMBOL_GPL(dw_hdmi_phy_update_hpd); =20 void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data) { /* - * Configure the PHY RX SENSE and HPD interrupts polarities and clear - * any pending interrupt. + * Configure the PHY HPD interrupt polarity based on current HPD status + * and clear any pending interrupt. */ - hdmi_writeb(hdmi, HDMI_PHY_HPD | HDMI_PHY_RX_SENSE, HDMI_PHY_POL0); - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, - HDMI_IH_PHY_STAT0); + hdmi_modb(hdmi, hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ? + 0 : HDMI_PHY_HPD, HDMI_PHY_HPD, HDMI_PHY_POL0); + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); =20 /* Enable cable hot plug irq. */ - hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); + hdmi_writeb(hdmi, ~HDMI_PHY_HPD, HDMI_PHY_MASK0); =20 /* Clear and unmute interrupts. */ - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, - HDMI_IH_PHY_STAT0); - hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE), - HDMI_IH_MUTE_PHY_STAT0); + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); + hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); } EXPORT_SYMBOL_GPL(dw_hdmi_phy_setup_hpd); =20 @@ -2395,26 +2372,6 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) } } =20 -/* - * Adjust the detection of RXSENSE according to whether we have a forced - * connection mode enabled, or whether we have been disabled. There is - * no point processing RXSENSE interrupts if we have a forced connection - * state, or DRM has us disabled. - * - * We also disable rxsense interrupts when we think we're disconnected - * to avoid floating TDMS signals giving false rxsense interrupts. - * - * Note: we still need to listen for HPD interrupts even when DRM has us - * disabled so that we can detect a connect event. - */ -static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) -{ - if (hdmi->phy.ops->update_hpd) - hdmi->phy.ops->update_hpd(hdmi, hdmi->phy.data, - hdmi->force, hdmi->disabled, - hdmi->rxsense); -} - static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) { enum drm_connector_status result; @@ -2512,9 +2469,7 @@ static void dw_hdmi_connector_force(struct drm_connec= tor *connector) struct dw_hdmi *hdmi =3D container_of(connector, struct dw_hdmi, connecto= r); =20 mutex_lock(&hdmi->mutex); - hdmi->force =3D connector->force; hdmi->last_connector_result =3D connector->status; - dw_hdmi_update_phy_mask(hdmi); mutex_unlock(&hdmi->mutex); =20 dw_hdmi_connector_status_update(hdmi, connector, connector->status); @@ -2932,10 +2887,8 @@ static void dw_hdmi_bridge_atomic_disable(struct drm= _bridge *bridge, struct dw_hdmi *hdmi =3D bridge->driver_private; =20 mutex_lock(&hdmi->mutex); - hdmi->disabled =3D true; hdmi->curr_conn =3D NULL; dw_hdmi_poweroff(hdmi); - dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, false); mutex_unlock(&hdmi->mutex); } @@ -2954,10 +2907,8 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_= bridge *bridge, mode =3D &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; =20 mutex_lock(&hdmi->mutex); - hdmi->disabled =3D false; hdmi->curr_conn =3D connector; dw_hdmi_poweron(hdmi, connector, mode); - dw_hdmi_update_phy_mask(hdmi); handle_plugged_change(hdmi, true); mutex_unlock(&hdmi->mutex); } @@ -3060,78 +3011,29 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *d= ev_id) =20 void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) { - mutex_lock(&hdmi->mutex); - - if (!hdmi->force) { - /* - * If the RX sense status indicates we're disconnected, - * clear the software rxsense status. - */ - if (!rx_sense) - hdmi->rxsense =3D false; - - /* - * Only set the software rxsense status when both - * rxsense and hpd indicates we're connected. - * This avoids what seems to be bad behaviour in - * at least iMX6S versions of the phy. - */ - if (hpd) - hdmi->rxsense =3D true; - - dw_hdmi_update_phy_mask(hdmi); - } - mutex_unlock(&hdmi->mutex); } EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); =20 static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) { struct dw_hdmi *hdmi =3D dev_id; - u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; - enum drm_connector_status status =3D connector_status_unknown; - - intr_stat =3D hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); - phy_int_pol =3D hdmi_readb(hdmi, HDMI_PHY_POL0); - phy_stat =3D hdmi_readb(hdmi, HDMI_PHY_STAT0); - - phy_pol_mask =3D 0; - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) - phy_pol_mask |=3D HDMI_PHY_HPD; - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE0) - phy_pol_mask |=3D HDMI_PHY_RX_SENSE0; - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE1) - phy_pol_mask |=3D HDMI_PHY_RX_SENSE1; - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE2) - phy_pol_mask |=3D HDMI_PHY_RX_SENSE2; - if (intr_stat & HDMI_IH_PHY_STAT0_RX_SENSE3) - phy_pol_mask |=3D HDMI_PHY_RX_SENSE3; - - if (phy_pol_mask) - hdmi_modb(hdmi, ~phy_int_pol, phy_pol_mask, HDMI_PHY_POL0); + u8 intr_stat; =20 /* - * RX sense tells us whether the TDMS transmitters are detecting - * load - in other words, there's something listening on the - * other end of the link. Use this to decide whether we should - * power on the phy as HPD may be toggled by the sink to merely - * ask the source to re-read the EDID. + * Interrupt generation is accomplished in the following way: + * interrupt =3D (mask =3D=3D 0) && (polarity =3D=3D status) + * All interrupts are forwarded to the Interrupt Handler sticky bit + * register ih_phy_stat0 and muted using the register ih_mute_phy_stat0. */ - if (intr_stat & - (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { - dw_hdmi_setup_rx_sense(hdmi, - phy_stat & HDMI_PHY_HPD, - phy_stat & HDMI_PHY_RX_SENSE); + intr_stat =3D hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); + if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { + enum drm_connector_status status; =20 - if ((intr_stat & HDMI_IH_PHY_STAT0_HPD) && - (phy_stat & HDMI_PHY_HPD)) - status =3D connector_status_connected; + /* Set HPD interrupt polarity based on current HPD status. */ + status =3D dw_hdmi_phy_read_hpd(hdmi, hdmi->phy.data); + hdmi_modb(hdmi, status =3D=3D connector_status_connected ? + 0 : HDMI_PHY_HPD, HDMI_PHY_HPD, HDMI_PHY_POL0); =20 - if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) - status =3D connector_status_disconnected; - } - - if (status !=3D connector_status_unknown) { dev_dbg(hdmi->dev, "EVENT=3D%s\n", status =3D=3D connector_status_connected ? "plugin" : "plugout"); @@ -3141,8 +3043,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) } =20 hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); - hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE), - HDMI_IH_MUTE_PHY_STAT0); + hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); =20 return IRQ_HANDLED; } @@ -3343,9 +3244,6 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, hdmi->dev =3D dev; hdmi->sample_rate =3D 48000; hdmi->channels =3D 2; - hdmi->disabled =3D true; - hdmi->rxsense =3D true; - hdmi->phy_mask =3D (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); hdmi->mc_clkdis =3D 0x7f; hdmi->last_connector_result =3D connector_status_disconnected; =20 @@ -3599,8 +3497,7 @@ void dw_hdmi_remove(struct dw_hdmi *hdmi) /* Free, mute and clear phy interrupts */ devm_free_irq(hdmi->dev, irq, hdmi); hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, - HDMI_IH_PHY_STAT0); + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0); =20 /* Cancel any pending hot plug work */ cancel_delayed_work_sync(&hdmi->hpd_work); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 3883538A700 for ; Mon, 18 May 2026 18:03:48 +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=1779127430; cv=none; b=RO9DtXXvswcVQld3Ljw3q4x/49QpGfHgsmyiZYTlV++uVx6+7lmUFYNA/QEndwVR7iUu9o+7qBbrL2u7zkk32demJrFBA8FyRl+6AosA6/A80PSwRlHv67cCYpHJ5HVuST7lhIZh5cdhWmghkhmHPcdTWTrx8YFmlE1rs2iWSVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127430; c=relaxed/simple; bh=hNfz02kud7vQ1qzBwfbaPhDzpXrskyFcSXhrexaep80=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u/cEcRB+73M7IT7KOrgVfwSNXEQpLUV9UpXQHArbiv8LqKiLnvkIVyx4FAVyjs8kOn/1QdZQGuiIw+V9NZwdz0XsHQoDq43Ho0g2VLxCT4qqzDq7utCry354IBAqZ1a7L7lgmrGD+fd7vLjBajaCF+fu5+qGAkmJmrqdtnWSNcs= 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=ybJwveAQ; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="ybJwveAQ" 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=1779127427; bh=Ry3rWikgNkPVoNnWVwwoiFSRnwKwUJAQoPLjpbMoazU=; b=ybJwveAQ5KtDLujeB0PCEw9vYPCqjRQE9oAllIBYKdq4x9UVDQSvwv6bCs7FIBMy8GtoNpOWr JMWAXeimUUEdPgJtPaJ2bpC6DTa65u5PvKQvQJ3qQnTtf0cFcYrmXx/3I63BDuD78v9LpRGhAOr nUX+GmfUKsRgCk8d4JnOSRMiEkAezfkbemAwOfZeJ8TUgPFPUV801Jx0z8LRlZ+BFt92tpecB7D kb3X3rnSpADujPu7FoOOo1Bda4pZHdj5AIt44lSAnxKG6UYgOBrHe38Eu7SljvgZ3KaBaWWoOwV 0LD2M2V7bXTHHS71N5Xo0TiwmWLUwRiop2CYVD0sG4SQ== X-Forward-Email-ID: 6a0b547fb84dbc72d2274fe0 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 21/23] drm: bridge: dw_hdmi: Remove the empty dw_hdmi_setup_rx_sense() Date: Mon, 18 May 2026 18:01:57 +0000 Message-ID: <20260518180206.2480119-22-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The dw_hdmi_setup_rx_sense() helper is empty and no longer needed after recent RXSENSE and HPD rework, remove it. Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change v4: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 ----- drivers/gpu/drm/meson/meson_dw_hdmi.c | 3 --- include/drm/bridge/dw_hdmi.h | 2 -- 3 files changed, 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 2e09bff5faf7..42d630efb875 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3009,11 +3009,6 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *de= v_id) return ret; } =20 -void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) -{ -} -EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); - static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) { struct dw_hdmi *hdmi =3D dev_id; diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/= meson_dw_hdmi.c index fef1702acb14..2a8756da569b 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -524,9 +524,6 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void= *dev_id) if (stat & HDMITX_TOP_INTR_HPD_RISE) hpd_connected =3D true; =20 - dw_hdmi_setup_rx_sense(dw_hdmi->hdmi, hpd_connected, - hpd_connected); - drm_helper_hpd_irq_event(dw_hdmi->bridge->dev); drm_bridge_hpd_notify(dw_hdmi->bridge, hpd_connected ? connector_status_connected diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 8500dd4f99d8..a612b9fa6dbb 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -186,8 +186,6 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pd= ev, =20 void dw_hdmi_resume(struct dw_hdmi *hdmi); =20 -void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); - int dw_hdmi_set_plugged_cb(struct dw_hdmi *hdmi, hdmi_codec_plugged_cb fn, struct device *codec_dev); void dw_hdmi_set_sample_non_pcm(struct dw_hdmi *hdmi, unsigned int non_pcm= ); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 51D8638E8B7 for ; Mon, 18 May 2026 18:03:53 +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=1779127434; cv=none; b=oafgNb2WKHYBj5+Db8iyqUOViYlcH175UjvgoEq0q3qTVyjN1GVZLVYg3OkqbLVbultpnDeU8eO8u3QZ16ShMwl3SCBQ58gUQ4/O1bby+d0VlBnoY2S8L9EoEskcuTG5WfaFaLIdN0vomzm/K1ZG+j3TUG3HCZu95Ytt1PPdrv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127434; c=relaxed/simple; bh=Db5AQmWHCs0vy2HAopNEuQI1/S8es9njAViZkCKWD0o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U/XHYOjuByhRHbpquU9NkIshojYAnZDZw+Xlm2m2rqdTFvlJXUjnzYGRMkLtMrSXW/l3X+WR1UgRdjSFQjQ66Zv3VCnQRR1BkSKCn5UXH7htuu99Pb/vifyme+vGOj7eRPQO/5JCvSZdYbaVcQBvf1a9RWB2Bx+1wISheWj2ds4= 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=x23iHkYn; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="x23iHkYn" 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=1779127432; bh=9uqA4jKYzliYkZko16kXvMFNWZFyXqBx7ysVDcNYMxw=; b=x23iHkYnSp9N4fGjxWPvQER1tr2e5or4kxuYs+53aXSgQhC22Ro+itsN8HOzV/UoA2oijMZ2l XmTY7G5mdFMfGVQI3CcBNPDSymz4/admD9wWc5LXStA1j58mKLVdTbMUgONmVekMwsOWA0WrB94 2oDSdKZJzHEl8H1b+7EV0PXHYqoJ6jclBq3BmrOodS71wVpEX6x/LDJo4yQxF25zKy8dLjqYOmT Jtx1dL7LaO5ZW8RTk9hEJClLppOY/JpeD7ozH1jdt7ad+y3fHjkvS92dTxBjzxNb9XIXTH2/dWa 6HSwhzQeqjw+e/segYjdZnvZpmUNUaHo3xPYXrF2zhEw== X-Forward-Email-ID: 6a0b5485b84dbc72d2274ffb 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Liu Ying , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Sandy Huang , Andy Yan , Chen-Yu Tsai , Samuel Holland Cc: Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 22/23] drm: bridge: dw_hdmi: Remove the empty dw_hdmi_phy_update_hpd() Date: Mon, 18 May 2026 18:01:58 +0000 Message-ID: <20260518180206.2480119-23-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The dw_hdmi_phy_update_hpd() helper is empty and no longer needed after recent RXSENSE and HPD rework, remove it. Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect t-b tag v5: No change v4: New patch --- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 1 - drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 ------- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 -- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 2 -- include/drm/bridge/dw_hdmi.h | 4 ---- 5 files changed, 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/= bridge/imx/imx8mp-hdmi-tx.c index 8e8cfd66f23b..20d389dbfdc5 100644 --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c @@ -78,7 +78,6 @@ static const struct dw_hdmi_phy_ops imx8mp_hdmi_phy_ops = =3D { .disable =3D imx8mp_hdmi_phy_disable, .setup_hpd =3D im8mp_hdmi_phy_setup_hpd, .read_hpd =3D dw_hdmi_phy_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, }; =20 static int imx8mp_dw_hdmi_bind(struct device *dev) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index 42d630efb875..c596534510da 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1687,12 +1687,6 @@ enum drm_connector_status dw_hdmi_phy_read_hpd(struc= t dw_hdmi *hdmi, } EXPORT_SYMBOL_GPL(dw_hdmi_phy_read_hpd); =20 -void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data, - bool force, bool disabled, bool rxsense) -{ -} -EXPORT_SYMBOL_GPL(dw_hdmi_phy_update_hpd); - void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data) { /* @@ -1716,7 +1710,6 @@ static const struct dw_hdmi_phy_ops dw_hdmi_synopsys_= phy_ops =3D { .init =3D dw_hdmi_phy_init, .disable =3D dw_hdmi_phy_disable, .read_hpd =3D dw_hdmi_phy_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, .setup_hpd =3D dw_hdmi_phy_setup_hpd, }; =20 diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/= rockchip/dw_hdmi-rockchip.c index 0dc1eb5d2ae3..7136e713df2e 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -413,7 +413,6 @@ static const struct dw_hdmi_phy_ops rk3228_hdmi_phy_ops= =3D { .init =3D dw_hdmi_rockchip_genphy_init, .disable =3D dw_hdmi_rockchip_genphy_disable, .read_hpd =3D dw_hdmi_phy_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, .setup_hpd =3D dw_hdmi_rk3228_setup_hpd, }; =20 @@ -449,7 +448,6 @@ static const struct dw_hdmi_phy_ops rk3328_hdmi_phy_ops= =3D { .init =3D dw_hdmi_rockchip_genphy_init, .disable =3D dw_hdmi_rockchip_genphy_disable, .read_hpd =3D dw_hdmi_rk3328_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, .setup_hpd =3D dw_hdmi_rk3328_setup_hpd, }; =20 diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index 4fa69c463dc4..2ac99b8ce8c4 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -221,7 +221,6 @@ static const struct dw_hdmi_phy_ops sun8i_a83t_hdmi_phy= _ops =3D { .init =3D sun8i_a83t_hdmi_phy_config, .disable =3D sun8i_a83t_hdmi_phy_disable, .read_hpd =3D dw_hdmi_phy_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, .setup_hpd =3D dw_hdmi_phy_setup_hpd, }; =20 @@ -395,7 +394,6 @@ static const struct dw_hdmi_phy_ops sun8i_h3_hdmi_phy_o= ps =3D { .init =3D sun8i_h3_hdmi_phy_config, .disable =3D sun8i_h3_hdmi_phy_disable, .read_hpd =3D dw_hdmi_phy_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, .setup_hpd =3D dw_hdmi_phy_setup_hpd, }; =20 diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index a612b9fa6dbb..10013b8d3adb 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -118,8 +118,6 @@ struct dw_hdmi_phy_ops { const struct drm_display_mode *mode); void (*disable)(struct dw_hdmi *hdmi, void *data); enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data); - void (*update_hpd)(struct dw_hdmi *hdmi, void *data, - bool force, bool disabled, bool rxsense); void (*setup_hpd)(struct dw_hdmi *hdmi, void *data); }; =20 @@ -213,8 +211,6 @@ void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi); =20 enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, void *data); -void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data, - bool force, bool disabled, bool rxsense); void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data); =20 bool dw_hdmi_bus_fmt_is_420(struct dw_hdmi *hdmi); --=20 2.54.0 From nobody Mon May 25 04:35:17 2026 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 6E6A138AC8B for ; Mon, 18 May 2026 18:03:57 +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=1779127439; cv=none; b=bVXemilt9HeBJ75HFi2xIbBhqut2JKh22in9Ur50EMjAP+8HlQjJYn4m97AaojhRrLFuy7VMm515/6xulQ2pRsnCsyGoDrndE7tj8mnXgfLyBVLesxWBrAeabSfiBdibugra3b9cq+P0ByCPkgulxCrX3inBTP6N7J61wsg4jTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779127439; c=relaxed/simple; bh=yd+lw8+pp/vNR2yHfMljkumqCTTFezpKMrfCPZ99sFY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t4KSTFy5kVVxdZ6/vaW44ibJZFkGLEpRJ4eGLF7EPx7mOnkBIc3hwLdgADZ33q5VFv6eV479L6RCMox2iAzvVGwhSacRZIR0h4LJrn9Pjd3lQ0jjQckWKzViyMwaoAG+1RFvY4IIi62iF1mvxl+8x8ztLGnXUChyHXl/AfAg4nI= 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=hF3FljoT; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="hF3FljoT" 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=1779127436; bh=+tNbdHFGwve4PQpiDKk/njnhtvjRkwYwD94Sgvq2l/k=; b=hF3FljoTFhjS5vNkTB1cXD0umJwi6oUMRX5wgMsA2hh3VGH96TGIF94XQ5JzfRyXPDRi+5jxq 6rZTnJkEA/3SpyQqEM9/feXcAuy52Gv2kSqxM1swhlXhmWRldEkqPhPsNheXb4Z9JjO4wz0zfLr pCLTigJd1pC9ef4KElzgZR2L45E/utMKOmb1qA8uBOFWllbfU9DNqB0a4IKGk2Q7heHrNVJvEXu z2GSub8fKQxER+lhcw0Ls8lbHSThGioJtGN6Sp8Cr7FLzMayYFfjo98i+BkOR7lA3c8DVh+9wVa arq8B0cAOQFHvKL7SVD8ZZvL/ARZHsTh217RtEjB+HBA== X-Forward-Email-ID: 6a0b5489b84dbc72d2275016 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 To: Andrzej Hajda , Neil Armstrong , Robert Foss , Heiko Stuebner , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Liu Ying , Sandy Huang , Andy Yan , Chen-Yu Tsai , Christian Hewitt , Diederik de Haas , Nicolas Frattaroli , Dmitry Baryshkov , 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 23/23] drm: bridge: dw_hdmi: Merge top and bottom half IRQ handlers Date: Mon, 18 May 2026 18:01:59 +0000 Message-ID: <20260518180206.2480119-24-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The bottom half IRQ handler only modify delay of or queue a delayed work used for HPD handling. The mod_delayed_work() called is documented as being safe to call from any context including IRQ handler. Merge top and bottom half IRQ handlers to simplify IRQ handling now that HPD event is handled using a delayed work. Tested-by: Diederik de Haas # Rock64, RockPro64,= Quartz64-B Signed-off-by: Jonas Karlman Tested-by: Heiko Stuebner #rk3328 --- v7: No change v6: Collect r-b tag v5: No change v4: New patch --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 34 ++++++++--------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/br= idge/synopsys/dw-hdmi.c index c596534510da..99dd62b6becf 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2993,30 +2993,18 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *d= ev_id) if (hdmi->i2c) ret =3D dw_hdmi_i2c_irq(hdmi); =20 - intr_stat =3D hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); - if (intr_stat) { - hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); - return IRQ_WAKE_THREAD; - } - - return ret; -} - -static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) -{ - struct dw_hdmi *hdmi =3D dev_id; - u8 intr_stat; - /* * Interrupt generation is accomplished in the following way: * interrupt =3D (mask =3D=3D 0) && (polarity =3D=3D status) * All interrupts are forwarded to the Interrupt Handler sticky bit * register ih_phy_stat0 and muted using the register ih_mute_phy_stat0. */ - intr_stat =3D hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { + intr_stat =3D hdmi_readb(hdmi, HDMI_IH_PHY_STAT0) & HDMI_IH_PHY_STAT0_HPD; + if (intr_stat) { enum drm_connector_status status; =20 + hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); + /* Set HPD interrupt polarity based on current HPD status. */ status =3D dw_hdmi_phy_read_hpd(hdmi, hdmi->phy.data); hdmi_modb(hdmi, status =3D=3D connector_status_connected ? @@ -3028,12 +3016,13 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_i= d) =20 mod_delayed_work(system_percpu_wq, &hdmi->hpd_work, msecs_to_jiffies(HOTPLUG_DEBOUNCE_MS)); + + hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); + hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); + ret =3D IRQ_HANDLED; } =20 - hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); - hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0); - - return IRQ_HANDLED; + return ret; } =20 static void dw_hdmi_hpd_work(struct work_struct *work) @@ -3343,9 +3332,8 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device = *pdev, INIT_DELAYED_WORK(&hdmi->hpd_work, dw_hdmi_hpd_work); disable_delayed_work(&hdmi->hpd_work); =20 - ret =3D devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq, - dw_hdmi_irq, IRQF_SHARED, - dev_name(dev), hdmi); + ret =3D devm_request_irq(dev, irq, dw_hdmi_hardirq, IRQF_SHARED, + dev_name(dev), hdmi); if (ret) goto err_res; =20 --=20 2.54.0