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 94CC3CA5FA1 for ; Mon, 28 Sep 2026 08:20:19 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uqtiwfFyGghTfeCQXY8tmw/p9oipFPBxqyTMxzJz3Pw=; b=ohtdonmtJE9dXR Jnm8DHdYS+Veud3FtQBu/e219VNXXcJrqul1xIMC3QRu/68/ddg1bKZO3qiZLM9PpcWJyB/mdSnzo xp/GVcSln5GSwXNKYu/JmXCxhSQ1M9tDwsp/UsIjWrnraH89iO7CFN+AGrRhdnmaq/sZgBqQgmhrB f2/QF73AJhTjLT/uGKV+nHDNzRk/v5bm2RhALqyyDMG3HwdJefIELkNYEoXqUHVdYq3KdB5dSQR/j OqOCYO/fqttDmFrM/1MN9LW1Lvs5W3BzhbRNMGi0vHmrHsQjSA0CIIBH07O/WYdrPeNVxYyhatnPm OeAa7d9WQfXQkY35eQHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xB6au-000000003om-1FhZ; Mon, 28 Sep 2026 08:20:16 +0000 Received: from mail-m121165.qiye.163.com ([115.236.121.165]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xB6aq-000000003lM-3g7Z; Mon, 28 Sep 2026 08:20:14 +0000 Received: from zyb-HP-ProDesk-680-G2-MT.. (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 4f5398e5f; Mon, 28 Sep 2026 16:15:05 +0800 (GMT+08:00) From: Damon Ding To: Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jingoo Han , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Peter Griffin , Alim Akhtar , Heiko Stuebner Cc: Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Dmitry Baryshkov , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Damon Ding Subject: [PATCH v3 03/14] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Date: Mon, 28 Sep 2026 16:14:07 +0800 Message-Id: <20260928081418.3605775-4-damon.ding@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260928081418.3605775-1-damon.ding@rock-chips.com> References: <20260928081418.3605775-1-damon.ding@rock-chips.com> MIME-Version: 1.0 X-HM-Tid: 0aa0e714f49203a8kunm323e2b5437cf1f X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlCSUlOVkIaSUpNGB4ZGEsaQ1YVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSU 9PT0hVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=Wfr60wMvG2J8qXhOo+zFzALi2vXZTHnXnItUIGi80sunqP3uXezqTn20pSNXseZJpW14EPUORahf2X8lmgkjMQy2T0E3haipumge3QtefnLqRgtXcBC66qN5HZikwDMj0wARqUkZXwgFCjtPTlDh5i1Tyse4Ml1PBRn1DthkrPU=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=TeGRKIo9zN3ch77zMT+V+rC/6To7Yk8YMsagDBLa1v4=; h=date:mime-version:subject:message-id:from; X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260928_012013_137185_73C41CF3 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The threaded IRQ is requested without IRQF_ONESHOT, allowing hardirq to preempt the threaded handler. This creates a read-modify-write race on HPD interrupt mask registers between the hardirq mute and thread unmute operations. Add IRQF_ONESHOT to keep the IRQ line masked during thread execution, which eliminates the race and makes the per-event mute/unmute calls in hardirq and thread handlers redundant. Move interrupt status clearing to the beginning of the threaded handler, before drm_helper_hpd_irq_event(), to avoid losing events that arrive during the event handling. Signed-off-by: Damon Ding --- Changes in v3: - Split out a separate commit to improve the return value checking for &analogix_dp_device.irq.(Sashiko) --- .../gpu/drm/bridge/analogix/analogix_dp_core.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 27c9a764e25f..974be5b702dc 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -704,10 +704,8 @@ static irqreturn_t analogix_dp_hardirq(int irq, void *arg) u32 irq_type; irq_type = analogix_dp_get_irq_type(dp); - if (irq_type) { - analogix_dp_mute_hpd_interrupt(dp); + if (irq_type) ret = IRQ_WAKE_THREAD; - } return ret; } @@ -718,6 +716,9 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg) u32 irq_type; irq_type = analogix_dp_get_irq_type(dp); + if (irq_type) + analogix_dp_clear_hotplug_interrupts(dp); + if (irq_type & DP_IRQ_TYPE_HP_CABLE_IN || irq_type & DP_IRQ_TYPE_HP_CABLE_OUT) { dev_dbg(dp->dev, "Detected cable status changed!\n"); @@ -725,11 +726,6 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg) drm_helper_hpd_irq_event(dp->drm_dev); } - if (irq_type) { - analogix_dp_clear_hotplug_interrupts(dp); - analogix_dp_unmute_hpd_interrupt(dp); - } - return IRQ_HANDLED; } @@ -1474,10 +1470,11 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) * that we can get the current state of the GPIO. */ dp->irq = gpiod_to_irq(dp->hpd_gpiod); - irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN; + irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN | + IRQF_ONESHOT; } else { dp->irq = platform_get_irq(pdev, 0); - irq_flags = IRQF_NO_AUTOEN; + irq_flags = IRQF_NO_AUTOEN | IRQF_ONESHOT; } if (dp->irq < 0) { -- 2.34.1 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip