mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
To: "Vladimir Yakovlev" <vovchkir@gmail.com>,
	"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>
Cc: "Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"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>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/bridge: lontium-lt9611uxc: use irq as optional parameter
Date: Tue, 16 Dec 2025 08:37:38 +0100	[thread overview]
Message-ID: <DEZGWL9B8SOU.ON89J7KLA9QA@bootlin.com> (raw)
In-Reply-To: <20251208161708.3763458-1-vovchkir@gmail.com>

Hello,

On Mon Dec 8, 2025 at 5:17 PM CET, Vladimir Yakovlev wrote:
> On some systems the interrupt pin may not be used.
> In this case we exclude DRM_BRIDGE_OP_HPD from supported operations,
> after which a polling thread is started to detect the connection.
> (the default polling period for DRM is 10 seconds)
>
> Signed-off-by: Vladimir Yakovlev <vovchkir@gmail.com>
> ---
>  drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 26 ++++++++++++++--------
>  1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> index 3868ad05e011..4d550cd1a9a1 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> @@ -851,19 +851,25 @@ static int lt9611uxc_probe(struct i2c_client *client)
>  	init_waitqueue_head(&lt9611uxc->wq);
>  	INIT_WORK(&lt9611uxc->work, lt9611uxc_hpd_work);
>
> -	ret = request_threaded_irq(client->irq, NULL,
> -				   lt9611uxc_irq_thread_handler,
> -				   IRQF_ONESHOT, "lt9611uxc", lt9611uxc);
> -	if (ret) {
> -		dev_err(dev, "failed to request irq\n");
> -		goto err_disable_regulators;
> +	if (client->irq) {
> +		ret = request_threaded_irq(client->irq, NULL,
> +					   lt9611uxc_irq_thread_handler,
> +					   IRQF_ONESHOT, "lt9611uxc", lt9611uxc);

This is per se correct, but while you're touching this it's a good
opportunity to switch to devm_request_threaded_irq(). This would simplify
the removal code too (see below).

> +		if (ret) {
> +			dev_err(dev, "failed to request irq\n");
> +			goto err_disable_regulators;
> +		}
> +		dev_dbg(dev, "Uses IRQ\n");
> +	} else {
> +		dev_warn(dev, "The interrupt (IRQ) is not specified in the DTS.\n");
> +		dev_warn(dev, "Check the interrupt (IRQ) or polling will be used!!!\n");

If hardware without this IRQ is supported, there is no reason to warn. You
can have a dev_dbg() at most, or even nothing at all.

>  	}
>
>  	i2c_set_clientdata(client, lt9611uxc);
>
>  	lt9611uxc->bridge.of_node = client->dev.of_node;
>  	lt9611uxc->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
> -	if (lt9611uxc->hpd_supported)
> +	if (lt9611uxc->hpd_supported && client->irq)
>  		lt9611uxc->bridge.ops |= DRM_BRIDGE_OP_HPD;
>  	lt9611uxc->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
>
> @@ -892,7 +898,8 @@ static int lt9611uxc_probe(struct i2c_client *client)
>  	return 0;
>
>  err_remove_bridge:
> -	free_irq(client->irq, lt9611uxc);
> +	if (client->irq)
> +		free_irq(client->irq, lt9611uxc);

With devm_request_threaded_irq() you can remove entirely the free_irq()
here...

>  	cancel_work_sync(&lt9611uxc->work);
>  	drm_bridge_remove(&lt9611uxc->bridge);
>
> @@ -910,7 +917,8 @@ static void lt9611uxc_remove(struct i2c_client *client)
>  {
>  	struct lt9611uxc *lt9611uxc = i2c_get_clientdata(client);
>
> -	free_irq(client->irq, lt9611uxc);
> +	if (client->irq)
> +		free_irq(client->irq, lt9611uxc);

...as well as here.

So I'd suggest to add a new patch to switch to devm_request_threaded_irq(),
followed by this one, which will be a simpler.

Best regards,
Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2025-12-16  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08 16:17 Vladimir Yakovlev
2025-12-16  7:37 ` Luca Ceresoli [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-09-02 23:18 [PATCH] drm/bridge: lontium-lt9611uxc: disable audio capture for HDMI card Vladimir Yakovlev
2025-09-02 23:18 ` [PATCH] drm/bridge: lontium-lt9611uxc: use irq as optional parameter Vladimir Yakovlev

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=DEZGWL9B8SOU.ON89J7KLA9QA@bootlin.com \
    --to=luca.ceresoli@bootlin.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=vovchkir@gmail.com \
    /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®