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 03/10] media: synopsys: hdmirx: add media entity for video capture device
Date: Wed, 4 Nov 2026 17:11:42 +0300 [thread overview]
Message-ID: <12f1f67a-9855-4765-9f3c-5f30853df76b@collabora.com> (raw)
In-Reply-To: <20261005-hdmirx-media-v3-3-71a11a2e3e76@pengutronix.de>
On 10/5/26 16:28, Sascha Hauer wrote:
> From: Gerald Loacker <gerald.loacker@wolfvision.net>
>
> Register the video device as a media entity with a sink pad to integrate
> it into the media controller topology. This allows the capture device to
> be properly represented in the media graph and enables userspace to
> discover the device capabilities through the MC API.
>
> The sink pad indicates that this entity receives data (HDMI video stream)
> which is then made available through the V4L2 video capture interface.
>
> Initialize the pad before registering the video device. The previous patch
> gave v4l2_dev an mdev, so video_register_device() already registers the
> entity, and doing it the other way round would hand
> media_device_register_entity() an entity with no pads yet.
>
> 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 | 26 ++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> index 8b04c84be75ec..9891e0f3874ea 100644
> --- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> +++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
> @@ -125,6 +125,7 @@ struct snps_hdmirx_dev {
> struct hdmirx_stream stream;
> struct v4l2_device v4l2_dev;
> struct media_device mdev;
> + struct media_pad pad;
> struct v4l2_ctrl_handler hdl;
> struct v4l2_ctrl *detect_tx_5v_ctrl;
> struct v4l2_ctrl *rgb_range;
> @@ -2761,15 +2762,29 @@ static int hdmirx_probe(struct platform_device *pdev)
>
> stream = &hdmirx_dev->stream;
> stream->hdmirx_dev = hdmirx_dev;
> +
> + hdmirx_dev->pad.flags = MEDIA_PAD_FL_SINK;
> + ret = media_entity_pads_init(&stream->vdev.entity, 1, &hdmirx_dev->pad);
> + if (ret) {
> + dev_err_probe(dev, ret, "media entity pads initialization failed\n");
> + goto err_unreg_v4l2_dev;
> + }
> +
> ret = hdmirx_register_stream_vdev(stream);
> if (ret < 0) {
> dev_err_probe(dev, ret, "video device registration failed\n");
> - goto err_unreg_v4l2_dev;
> + goto err_cleanup_entity;
> + }
> +
> + ret = media_device_register(&hdmirx_dev->mdev);
> + if (ret) {
> + dev_err_probe(dev, ret, "media device registration failed\n");
> + goto err_unreg_video_dev;
> }
>
> ret = hdmirx_register_cec(hdmirx_dev, pdev);
> if (ret)
> - goto err_unreg_video_dev;
> + goto err_unreg_media;
>
> hdmirx_load_default_edid(hdmirx_dev);
>
> @@ -2784,8 +2799,12 @@ static int hdmirx_probe(struct platform_device *pdev)
>
> return 0;
>
> +err_unreg_media:
> + media_device_unregister(&hdmirx_dev->mdev);
> err_unreg_video_dev:
> vb2_video_unregister_device(&hdmirx_dev->stream.vdev);
> +err_cleanup_entity:
> + media_entity_cleanup(&hdmirx_dev->stream.vdev.entity);
> err_unreg_v4l2_dev:
> v4l2_device_unregister(&hdmirx_dev->v4l2_dev);
> hdmirx_disable(dev);
> @@ -2814,7 +2833,10 @@ static void hdmirx_remove(struct platform_device *pdev)
>
> hdmirx_disable_irq(dev);
>
> + media_device_unregister(&hdmirx_dev->mdev);
> +
> vb2_video_unregister_device(&hdmirx_dev->stream.vdev);
> + media_entity_cleanup(&hdmirx_dev->stream.vdev.entity);
> v4l2_device_unregister(&hdmirx_dev->v4l2_dev);
>
> hdmirx_disable(dev);
>
Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
--
Best regards,
Dmitry
next prev parent reply other threads:[~2026-11-04 14:12 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 [this message]
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
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=12f1f67a-9855-4765-9f3c-5f30853df76b@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®