All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 0/4] Add /sys media_dev attr for V4L/DVB devices
@ 2021-02-02 14:49 Hans Verkuil
  2021-02-02 14:49 ` [PATCHv3 1/4] vim2m: intialize the media device earlier Hans Verkuil
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Hans Verkuil @ 2021-02-02 14:49 UTC (permalink / raw)
  To: linux-media; +Cc: Laurent Pinchart, Sakari Ailus

A long standing issue is how to find the associated media device for
a V4L or DVB device node. This is primarily useful for applications
like v4l2-ctl and v4l2-compliance.

Until recently these applications relied on /sys and the fact that
the media device was accessible in /sys via:

/sys/class/video4linux/videoX/device/mediaY/

But commit ee494cf377e1 ("media: v4l2-device: Link subdevices to their
parent devices if available") broke that scheme for subdevices. That
scheme was rather a hack anyway.

Attempts to report the major/minor number of the media device via the
public API (i.e. by extending VIDIOC_QUERYCAP or VIDIOC_SUBDEV_QUERYCAP)
failed, so this patch series now just adds a media_dev attribute when a
V4L or DVB device node is created. This attribute contains the major:minor
of the media device. It is only created if the device node is actually
associated with a media controller.

The original idea for this v3 was to store the media device minor/major
at the time of the device node registration, however the media device
node is typically created last, so this information isn't known yet.

Instead a new media_device_devt() function was added that returns the
dev_t of the media device node safely.

In addition a patch was added for vim2m to ensure that the v4l2_dev.mdev
is set before video_register_device() to ensure that the media_dev
attribute is created.

This issue was reported by Sebastian Frick:

https://lore.kernel.org/linux-media/20210120183054.5ltnjdtrmumplevt@basti-TUXEDO-Book-XA1510/T/#t

Regards,

        Hans

Changes since v2: add new media_device_devt function.
        Add vim2m patch: v4l2_dev.mdev was set too late.

Changes since v1: use the is_visible callback to ensure the attribute
        is only shown if mdev is non-NULL.

Hans Verkuil (4):
  vim2m: intialize the media device earlier
  media-device: add media_device_devt function
  v4l2-dev: add /sys media_dev attr for V4L2 devices
  dvbdev: add /sys media_dev attr for DVB devices

 drivers/media/dvb-core/dvbdev.c    | 45 +++++++++++++++++++++++++++
 drivers/media/mc/mc-device.c       | 16 ++++++++++
 drivers/media/test-drivers/vim2m.c | 14 +++++----
 drivers/media/v4l2-core/v4l2-dev.c | 49 +++++++++++++++++++++++++++++-
 include/media/media-device.h       | 10 ++++++
 5 files changed, 127 insertions(+), 7 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-03  8:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 14:49 [PATCHv3 0/4] Add /sys media_dev attr for V4L/DVB devices Hans Verkuil
2021-02-02 14:49 ` [PATCHv3 1/4] vim2m: intialize the media device earlier Hans Verkuil
2021-02-02 14:49 ` [PATCHv3 2/4] media-device: add media_device_devt function Hans Verkuil
2021-02-02 14:49 ` [PATCHv3 3/4] v4l2-dev: add /sys media_dev attr for V4L2 devices Hans Verkuil
2021-02-02 14:49 ` [PATCHv3 4/4] dvbdev: add /sys media_dev attr for DVB devices Hans Verkuil
2021-02-03  5:25 ` [PATCHv3 0/4] Add /sys media_dev attr for V4L/DVB devices Sebastian Fricke
2021-02-03  7:59   ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.