Re: [RFC PATCH] media: cec: DRM connector to CEC dev mapping

From: Dariusz Marcinkiewicz
Date: Tue Apr 09 2019 - 03:33:22 EST


Hi Hans.

On Thu, Apr 4, 2019 at 2:23 PM Hans Verkuil <hverkuil@xxxxxxxxx> wrote:
>
...
> > Notes:
> > Sending the patch in its current form the get feedback if that is
> > considered a right approach or if some other way of learning
> > the mapping in userland is preferred.
>
> Thank you for this patch. It's interesting, but I think it should be
> redesigned a bit.
>
> Basically what you want to do is to provide a way for userspace to associate
> the CEC device with the HDMI connector it is associated with.
>
> But this information is known the moment the cec adapter is allocated or the
> cec_notifier is registered for a connector. So I would provide this information
> at that time, rather than through separate functions. This makes everything
> nicely atomic. This also avoids the need of a connector_info event, since the
> connector info is known from the very beginning. You still need the ioctl to
> obtain this information, though.
>
Great, good to know that the event can be removed. I wasn't 100% sure
if in all cases it can be assumed that connector info will be set on
the notifier before the CEC adapter is created, hence the event.
Sending an updated patch with the event no longer there.

> There are also two related issues.
>
> Firstly, CEC is used not only for DRM, but also for V4L2, and it makes sense
> to provide connector info there as well. For V4L2 this would probably look
> like this (tentative as I am not completely sure about the major/minor numbers):
>
> struct v4l2_connector_info {
> __u32 major;
> __u32 minor;
> __u16 connector_mask;
> }
>
> Where the major/minor numbers determine the video or v4l-subdev device that controls
> the HDMI connector(s). Since a CEC device for HDMI receivers can be responsible for
> multiple HDMI inputs we need the connector_mask to indicate which HDMI inputs it is
> associated with.
Would simply allowing for multiple connector types to be hooked up
with cec adapters be sufficient to cover this? Please take a look at
the follow up patch.

>
> Secondly, there are USB-CEC dongles that are not directly associated with an HDMI
> connector since the driver simply doesn't know. But it would be nice if the user
> can provide that information. I did a proof-of-concept here:
>
> https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=pulse8-notifier
>
> and it works fine. But the problem is that the connector name is currently only
> available on the i915 via port_identifier(port), and that that port identifier
> string is not visible to the end-user. I had to try various port names ("Port A",
> "Port B", etc) before I hit the right one.
>
Is there something extra needed for the proposed approach to work in
this case? Looking at the above change - since a notifier is going to
be used to pass the connector info, it should work there as well. And
not being a DRM specialist myself, I don't know what would be the
better way (that wouldn't rely on port identifier) of pairing up a
connector with an adapter.

Thank you very much for your comments and apologies for delayed response.