Re: [PATCH v3 00/10] media: synopsys: hdmirx: support an HDMI bridge in front of the receiver
From: Sascha Hauer
Date: Mon Nov 16 2026 - 10:14:09 EST
On 2026-11-13 10:01, Hans Verkuil wrote:
> Hi Sascha,
>
> On 05/10/2026 15:28, Sascha Hauer wrote:
> > The Synopsys HDMI receiver driver assumes the HDMI connector belongs to
> > it: the connector's +5V line arrives on hpd-gpios, and there is nothing
> > between the source and the receiver. On the board this series comes from
> > that is not the case. An HDMI bridge owns the connector, the receiver
> > sits behind it, and the two are described by an OF graph endpoint.
> >
> > Three things follow from that, and the series is arranged in that order.
> >
> > Patch 1 comes before them and is a fix for the driver as it is. The
> > driver data is devm allocated, but an open file descriptor keeps the
> > video device alive past unbind, so the last close works on freed memory.
> > The media device the series adds would have been torn down the same way,
> > which is why the fix leads the series. It stands on its own and is
> > marked for stable.
> >
> > Patches 2-3 give the driver a media device and register the video device
> > as an entity with a sink pad. On their own they add a graph with one node
> > in it; they exist so that there is somewhere for the bridge to appear.
> >
> > Patches 4-5 add the endpoint to the binding and bind the remote subdev
> > through a v4l2 async notifier, linking its source pad to the receiver's
> > sink pad. Such a board cannot provide hpd-gpios, so the binding requires
> > either hpd-gpios or the port. Without an endpoint in the device tree the
> > driver keeps working exactly as before, so boards wired straight to the
> > connector are unaffected.
> >
> > Patch 6 is fallout from the wait for signal lock, which was bounded by an
> > iteration count whose duration came from the 5V debounce it called
> > each time round. That debounce goes away on a board with no hpd-gpios
> > later in the series, so the wait gets a real timeout first.
> >
> > Patches 7-10 are the 5V state itself. Patch 7 stops probe requiring an
> > interrupt for hpd-gpios. Patch 8 makes v4l2_device_unregister_subdev()
> > wait for notifications already in flight. Nothing kept a subdev from
> > notifying a v4l2_device that was unbinding it; that is not new with this
> > series, as asynchronously bound subdevs sending V4L2_EVENT_SOURCE_CHANGE
> > race the same way today. Patch 9 adds V4L2_DEVICE_NOTIFY_RX_POWER_PRESENT,
> > and patch 10 has the receiver set v4l2_dev.notify and take the state from
> > whatever is bound in front of it. The notification is only an edge, as
> > the 5V interrupt is with hpd-gpios: the hotplug worker then asks the
> > subdev through g_input_status(), so nothing is cached that could go
> > stale against bind or unbind. Without a det_irq there is nothing to
> > disable across suspend and remove either, so patch 10 disables the
> > hotplug work items themselves instead of cancelling them. Patch 8 is
> > what lets the notify callback read sd->v4l2_dev while the subdev is
> > being unbound.
> >
> > V4L2_CID_DV_RX_POWER_PRESENT is otherwise the only place this state is
> > published - adv7604, adv7842, tc358743 and tda1997x all set that control
> > from their cable detect interrupt and stop there - while a format change
> > already gets an in-kernel notification through v4l2_subdev_notify_event().
> > An earlier version of this series hooked the control with
> > v4l2_ctrl_notify() instead. That reaches into another device's control
> > handler, and the only thing it bought was working with those four
> > drivers unmodified, which turns out to be worth nothing: they are HDMI
> > sinks, so none of them could sit in front of an HDMI receiver anyway.
> >
> > Nothing in tree sends the new notification yet. The driver for the device
> > on this board does, and the alternative was a mechanism that no in-tree
> > driver could have used either.
> >
> > There is no in-tree device tree using the new port yet: the board is not
> > upstream, and the device in front of the receiver, a Lontium LT86102UXE
> > 1:2 HDMI splitter, has no driver upstream either. I would rather send the
> > infrastructure for review now than sit on it until the board lands.
> >
> > Tested on that board, and build tested for arm64 at each patch with W=1.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
>
> As mentioned in my reply to patch 1/10 I'll take that one. But for the remaining
> 9 patches I need to see the 'v4l2-compliance -m /dev/mediaX -s' output to make
> sure the media device topology is sane and streaming works as expected.
>
> Use the v4l2-compliance version from the v4l-utils git repo so you have the latest
> code.
>
> I also need more time to review the v4l2 core notify patches. Apologies for not
> doing that sooner, I hadn't noticed before that this series made core changes as well.
>
> I haven't looked at that notify code for years, so I will need to refresh my
> memory.
>
> My plan is to merge patch 1/10 today in our next branch. It is probably best
> if you post a v4 rebased to that and including the v4l2-compliance output in
> the cover letter.
Thanks for looking into this. I'll send a rebased v4 shortly. The
v4l2-compliance test works on this v3 already.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |