mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Dingxian Wen <shawn.wen@rock-chips.com>,
	Shreeya Patel <shreeya.patel@collabora.com>
Cc: Gerald Loacker <gerald.loacker@wolfvision.net>,
	Lucas Sinn <lucas.sinn@wolfvision.net>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	kernel@collabora.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 07/10] media: synopsys: hdmirx: skip the 5V detect interrupt without a GPIO
Date: Wed, 4 Nov 2026 17:12:39 +0300	[thread overview]
Message-ID: <ae39979a-70c2-4f73-abed-bf5699a0addf@collabora.com> (raw)
In-Reply-To: <20261005-hdmirx-media-v3-7-71a11a2e3e76@pengutronix.de>

On 10/5/26 16:28, Sascha Hauer wrote:
> From: Gerald Loacker <gerald.loacker@wolfvision.net>
> 
> The hpd GPIO is fetched with devm_gpiod_get_optional(), so a board that
> does not wire 5V detect to the receiver leaves detect_5v_gpio NULL.
> hdmirx_setup_irq() then calls gpiod_to_irq() on it anyway, which returns
> -EINVAL for a NULL descriptor, and probe fails. The GPIO is only
> optional as far as the fetch goes.
> 
> Set the interrupt up only when the GPIO is there. det_irq then keeps the
> zero devm_kzalloc() gave it, so hdmirx_enable_irq() and
> hdmirx_disable_irq() skip it as well.
> 
> Nothing else has to change for such a board to probe: 5V is then never
> reported as present, which is what gpiod_get_value_cansleep() on a NULL
> descriptor already returns. Getting the state from somewhere else is a
> separate matter.
> 
> Assisted-by: LLM
> Signed-off-by: Gerald Loacker <gerald.loacker@wolfvision.net>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>   .../media/platform/synopsys/hdmirx/snps_hdmirx.c   | 34 ++++++++++++----------
>   1 file changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> index a28eb86e0b83c..a937ee23e230c 100644
> --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> @@ -2521,7 +2521,8 @@ static void hdmirx_disable_irq(struct device *dev)
>   {
>   	struct snps_hdmirx_dev *hdmirx_dev = dev_get_drvdata(dev);
>   
> -	disable_irq(hdmirx_dev->det_irq);
> +	if (hdmirx_dev->det_irq > 0)
> +		disable_irq(hdmirx_dev->det_irq);
>   	disable_irq(hdmirx_dev->dma_irq);
>   	disable_irq(hdmirx_dev->hdmi_irq);
>   
> @@ -2535,7 +2536,8 @@ static void hdmirx_enable_irq(struct device *dev)
>   
>   	enable_irq(hdmirx_dev->hdmi_irq);
>   	enable_irq(hdmirx_dev->dma_irq);
> -	enable_irq(hdmirx_dev->det_irq);
> +	if (hdmirx_dev->det_irq > 0)
> +		enable_irq(hdmirx_dev->det_irq);
>   
>   	queue_delayed_work(system_dfl_wq,
>   			   &hdmirx_dev->delayed_work_hotplug,
> @@ -2619,21 +2621,23 @@ static int hdmirx_setup_irq(struct snps_hdmirx_dev *hdmirx_dev,
>   		return ret;
>   	}
>   
> -	irq = gpiod_to_irq(hdmirx_dev->detect_5v_gpio);
> -	if (irq < 0) {
> -		dev_err_probe(dev, irq, "failed to get hdmirx-5v irq\n");
> -		return irq;
> -	}
> +	if (hdmirx_dev->detect_5v_gpio) {
> +		irq = gpiod_to_irq(hdmirx_dev->detect_5v_gpio);
> +		if (irq < 0) {
> +			dev_err_probe(dev, irq, "failed to get hdmirx-5v irq\n");
> +			return irq;
> +		}
>   
> -	irq_set_status_flags(irq, IRQ_NOAUTOEN);
> +		irq_set_status_flags(irq, IRQ_NOAUTOEN);
>   
> -	hdmirx_dev->det_irq = irq;
> -	ret = devm_request_irq(dev, irq, hdmirx_5v_det_irq_handler,
> -			       IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
> -			       "rk_hdmirx-5v", hdmirx_dev);
> -	if (ret) {
> -		dev_err_probe(dev, ret, "failed to request hdmirx-5v irq\n");
> -		return ret;
> +		hdmirx_dev->det_irq = irq;
> +		ret = devm_request_irq(dev, irq, hdmirx_5v_det_irq_handler,
> +				       IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
> +				       "rk_hdmirx-5v", hdmirx_dev);
> +		if (ret) {
> +			dev_err_probe(dev, ret, "failed to request hdmirx-5v irq\n");
> +			return ret;
> +		}
>   	}
>   
>   	return 0;
> 

Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

-- 
Best regards,
Dmitry

  reply	other threads:[~2026-11-04 14:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 13:28 [PATCH v3 00/10] media: synopsys: hdmirx: support an HDMI bridge in front of the receiver Sascha Hauer
2026-10-05 13:28 ` [PATCH v3 01/10] media: synopsys: hdmirx: free the driver data when the last user is gone Sascha Hauer
2026-10-07 11:20   ` Dmitry Osipenko
2026-10-16 11:06     ` Sascha Hauer
2026-11-04 14:18       ` Dmitry Osipenko
2026-10-05 13:28 ` [PATCH v3 02/10] media: synopsys: hdmirx: add media device infrastructure Sascha Hauer
2026-11-04 14:11   ` Dmitry Osipenko
2026-10-05 13:28 ` [PATCH v3 03/10] media: synopsys: hdmirx: add media entity for video capture device Sascha Hauer
2026-11-04 14:11   ` Dmitry Osipenko
2026-10-05 13:28 ` [PATCH v3 04/10] dt-bindings: media: snps,dw-hdmi-rx: add a port for a bridge in front Sascha Hauer
2026-11-04 14:11   ` Dmitry Osipenko
2026-11-04 14:12   ` Dmitry Osipenko
2026-10-05 13:28 ` [PATCH v3 05/10] media: synopsys: hdmirx: add async subdevice support Sascha Hauer
2026-11-04 14:12   ` Dmitry Osipenko
2026-10-05 13:28 ` [PATCH v3 06/10] media: synopsys: hdmirx: give the signal lock wait a real timeout Sascha Hauer
2026-11-04 14:12   ` Dmitry Osipenko
2026-10-05 13:28 ` [PATCH v3 07/10] media: synopsys: hdmirx: skip the 5V detect interrupt without a GPIO Sascha Hauer
2026-11-04 14:12   ` Dmitry Osipenko [this message]
2026-10-05 13:28 ` [PATCH v3 08/10] media: v4l2-device: wait for notifications when unregistering a subdev Sascha Hauer
2026-10-05 13:28 ` [PATCH v3 09/10] media: v4l2-subdev: notify the bridge when the source power changes Sascha Hauer
2026-10-05 13:28 ` [PATCH v3 10/10] media: synopsys: hdmirx: get the 5V state from the upstream subdev Sascha Hauer
2026-11-04 14:12   ` Dmitry Osipenko

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=ae39979a-70c2-4f73-abed-bf5699a0addf@collabora.com \
    --to=dmitry.osipenko@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gerald.loacker@wolfvision.net \
    --cc=hverkuil@kernel.org \
    --cc=kernel@collabora.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lucas.sinn@wolfvision.net \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.wen@rock-chips.com \
    --cc=shreeya.patel@collabora.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®