From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA3D8CD37BF for ; Sun, 10 May 2026 12:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rV70VolF2CwOWi48gqTKGXbhqTqF0Non5YNAHJbgsPo=; b=Y2E+ht7wGIQbwX XeC0GuMSaVcf3c6W6mda6opbxybHsxW8ShOJk9Zi/83jt6TGA4yc/RCdW3KouAKz2O45KGc+RtHFH B+1AXxFqeozMuEpfsGr2mOu7GARdGavJ9P3wooZ01ACLMr9Ydmd556RAEfjW2Ex6ZRA6twZK1OeOJ uMf85LSbU+geVMnPwGTJMwueZZ82XobATEGpE06EaXreZCFOdeWbhTsorIuOLbiE0GBvuBL3AK9/n iawThZcjhl9Ytywmv5nclW9zBbOjIpJJHz/mGDYwxCsuQ5yWQjwK0f0+KBs5/SMAkiZCUQI0HPGZR Ds18wh3dxdq350yaiLsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wM3Vy-0000000AmAh-3BVk; Sun, 10 May 2026 12:44:10 +0000 Received: from smtp.forwardemail.net ([149.28.215.223]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wM3Vs-0000000Am1h-25p4 for linux-amlogic@lists.infradead.org; Sun, 10 May 2026 12:44:06 +0000 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=1778417044; bh=mqYIr5XYCPPm4zN6s5d5jbCM07Px6OPI7bSs1N/w+Ak=; b=0e5agqe7VLJ2F8TJ4cYfRML/q4rSc5aDLRC/6zHyKZGbwOgdhneiJNnd7mDso4sAtnRz6P0Il 9Q8D3lTI1jJmBft5G2oQVMej2IHAYk3fpZnRa4khOCIxCzAX7Kh0flQdizwBixKLLbMorXzhH5Y kuDMrLFaQ6ZQy0CIdA8Wf4Kky6uH93gJxRfdRcNZFfR9uVgmW1kSZr03zJNOcDACmTVsCTdlJdN LvBz5B5C3ebz1PBZlCSFjXuMcwy4bHFQSkhuXSe/PZkVz3vm5BS1Qb92iXT3/zVjxAL/CV3TQ9e /frRMCsD7uYW8e6jZMzkBc709zJ5HhpTyltVvT1VnZyQ== X-Forward-Email-ID: 6a007d4b0d91f03a31a0bd72 X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-Forward-Email-Version: 2.8.0 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 Subject: [PATCH v5 20/21] drm: bridge: dw_hdmi: Merge top and bottom half IRQ handlers Date: Sun, 10 May 2026 12:41:04 +0000 Message-ID: <20260510124111.1226584-21-jonas@kwiboo.se> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260510124111.1226584-1-jonas@kwiboo.se> References: <20260510124111.1226584-1-jonas@kwiboo.se> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260510_054404_593778_7FE5765B X-CRM114-Status: GOOD ( 11.98 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Baryshkov , imx@lists.linux.dev, Liu Ying , linux-kernel@vger.kernel.org, Sandy Huang , dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Diederik de Haas , linux-rockchip@lists.infradead.org, linux-amlogic@lists.infradead.org, Andy Yan , Chen-Yu Tsai , Nicolas Frattaroli , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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. Signed-off-by: Jonas Karlman --- 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/bridge/synopsys/dw-hdmi.c index 70068764deaa..2ea8ce5eca36 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2984,30 +2984,18 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) if (hdmi->i2c) ret = dw_hdmi_i2c_irq(hdmi); - intr_stat = 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 = dev_id; - u8 intr_stat; - /* * Interrupt generation is accomplished in the following way: * interrupt = (mask == 0) && (polarity == 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 = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { + intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0) & HDMI_IH_PHY_STAT0_HPD; + if (intr_stat) { enum drm_connector_status status; + hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); + /* Set HPD interrupt polarity based on current HPD status. */ status = dw_hdmi_phy_read_hpd(hdmi, hdmi->phy.data); hdmi_modb(hdmi, status == connector_status_connected ? @@ -3019,12 +3007,13 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) 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 = IRQ_HANDLED; } - 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; } static void dw_hdmi_hpd_work(struct work_struct *work) @@ -3324,9 +3313,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); - ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq, - dw_hdmi_irq, IRQF_SHARED, - dev_name(dev), hdmi); + ret = devm_request_irq(dev, irq, dw_hdmi_hardirq, IRQF_SHARED, + dev_name(dev), hdmi); if (ret) goto err_res; -- 2.54.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic