From: Damon Ding <damon.ding@rock-chips.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Heiko Stuebner <heiko@sntech.de>,
Andy Yan <andy.yan@rock-chips.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Damon Ding <damon.ding@rock-chips.com>
Subject: [PATCH v2 03/10] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling
Date: Tue, 4 Aug 2026 16:17:10 +0800 [thread overview]
Message-ID: <20260804081717.741404-4-damon.ding@rock-chips.com> (raw)
In-Reply-To: <20260804081717.741404-1-damon.ding@rock-chips.com>
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 <damon.ding@rock-chips.com>
---
.../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 7ef8ef812b55..4fe248e66515 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -707,10 +707,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;
}
@@ -721,6 +719,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");
@@ -728,11 +729,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;
}
@@ -1403,10 +1399,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 == -ENXIO) {
--
2.34.1
next prev parent reply other threads:[~2026-08-04 8:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 8:17 [PATCH v2 00/10] Add HPD support for Rockchip Analogix DP Damon Ding
2026-08-04 8:17 ` [PATCH v2 01/10] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection Damon Ding
2026-08-04 8:17 ` [PATCH v2 02/10] drm/bridge: analogix_dp: Return bitmask from analogix_dp_get_irq_type() Damon Ding
2026-08-04 8:17 ` Damon Ding [this message]
2026-08-04 8:17 ` [PATCH v2 04/10] drm/bridge: analogix_dp: Extend clear_hotplug_interrupts to accept IRQ bitmask Damon Ding
2026-08-04 8:17 ` [PATCH v2 05/10] drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept irq bitmask Damon Ding
2026-08-04 8:17 ` [PATCH v2 06/10] drm/bridge: analogix_dp: Simplify analogix_dp_config_interrupt() Damon Ding
2026-08-04 8:17 ` [PATCH v2 07/10] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme Damon Ding
2026-08-04 8:17 ` [PATCH v2 08/10] drm/bridge: analogix_dp: Skip native HPD interrupt ops for GPIO HPD Damon Ding
2026-08-04 8:17 ` [PATCH v2 09/10] drm/bridge: analogix_dp: Restrict forced connected status only for panel endpoint Damon Ding
2026-08-04 8:17 ` [PATCH v2 10/10] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge Damon Ding
2026-08-04 22:39 ` [PATCH v2 00/10] Add HPD support for Rockchip Analogix DP Heiko Stübner
2026-08-05 4:06 ` Damon Ding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804081717.741404-4-damon.ding@rock-chips.com \
--to=damon.ding@rock-chips.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=andy.yan@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=luca.ceresoli@bootlin.com \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox