From: Nhat Tran <nhat.tranminhk2@gmail.com>
To: Russell King <linux@armlinux.org.uk>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Hans Verkuil <hverkuil@kernel.org>,
Linus Walleij <linusw@kernel.org>,
dri-devel@lists.freedesktop.org, linux-gpio@vger.kernel.org,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
Nhat Tran <nhat.tranminhk2@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] drm/bridge: tda998x: Fix CEC calibration with lazy IRQ disable
Date: Fri, 20 Nov 2026 22:00:04 +0700 [thread overview]
Message-ID: <20261120150004.64033-1-nhat.tranminhk2@gmail.com> (raw)
The CEC oscillator calibration pulses the TDA998x interrupt line low for
10ms through the "nxp,calib" GPIO. Before driving the line,
tda998x_cec_calibration() calls disable_irq() so that gpiolib allows the
GPIO, which is also used as an interrupt, to be switched to an output.
gpiolib only allows that once the interrupt is actually disabled at the
GPIO controller. Since commit a8173820f441 ("gpio: gpiolib: Allow GPIO
IRQs to lazy disable"), disable_irq() is lazy on GPIO controllers that
do not implement .irq_disable, such as gpio-omap: the line is not masked
and gpiolib still considers the interrupt enabled. The direction change
is refused and the calibration pulse is never generated. On a
BeagleBone Black this happens on every boot:
tda998x 0-0070: found TDA19988
gpio-537 (nxp,calib): gpiod_direction_output_nonotify: tried to set a GPIO tied to an IRQ as output
tda9950 0-0034: TDA9950 CEC interface, hardware version 3.3
Set IRQ_DISABLE_UNLAZY for the duration of the calibration so that
disable_irq() masks the line immediately, and clear it again once the
interrupt has been re-enabled.
Tested on a BeagleBone Black without an HDMI sink connected: the error
is gone, the GPIO is back to an input used as an interrupt afterwards,
no spurious interrupts are raised, and rebinding tda9950 repeatedly
reruns the calibration cleanly. CEC communication with a sink was not
tested.
Fixes: a8173820f441 ("gpio: gpiolib: Allow GPIO IRQs to lazy disable")
Cc: stable@vger.kernel.org
Signed-off-by: Nhat Tran <nhat.tranminhk2@gmail.com>
---
drivers/gpu/drm/bridge/tda998x_drv.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/tda998x_drv.c b/drivers/gpu/drm/bridge/tda998x_drv.c
index 0b966c9844e7..0815ce283f49 100644
--- a/drivers/gpu/drm/bridge/tda998x_drv.c
+++ b/drivers/gpu/drm/bridge/tda998x_drv.c
@@ -495,8 +495,16 @@ static void tda998x_cec_calibration(struct tda998x_priv *priv)
struct gpio_desc *calib = priv->calib;
mutex_lock(&priv->edid_mutex);
- if (priv->hdmi->irq > 0)
+ if (priv->hdmi->irq > 0) {
+ /*
+ * The pulse is driven on the IRQ line itself, and gpiolib
+ * refuses to drive a GPIO whose interrupt is still enabled.
+ * Make disable_irq() mask the line right away instead of
+ * lazily, so that the GPIO can be switched to an output.
+ */
+ irq_set_status_flags(priv->hdmi->irq, IRQ_DISABLE_UNLAZY);
disable_irq(priv->hdmi->irq);
+ }
gpiod_direction_output(calib, 1);
tda998x_cec_set_calibration(priv, true);
@@ -508,8 +516,10 @@ static void tda998x_cec_calibration(struct tda998x_priv *priv)
tda998x_cec_set_calibration(priv, false);
gpiod_direction_input(calib);
- if (priv->hdmi->irq > 0)
+ if (priv->hdmi->irq > 0) {
enable_irq(priv->hdmi->irq);
+ irq_clear_status_flags(priv->hdmi->irq, IRQ_DISABLE_UNLAZY);
+ }
mutex_unlock(&priv->edid_mutex);
}
--
2.25.1
reply other threads:[~2026-11-20 15:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261120150004.64033-1-nhat.tranminhk2@gmail.com \
--to=nhat.tranminhk2@gmail.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hverkuil@kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luca.ceresoli@bootlin.com \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®