History log of /linux-master/include/media/v4l2-device.h
Revision Date Author Comments
# 06016a67 23-Sep-2023 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: v4l2-device.h: drop V4L2_DEVICE_NAME_SIZE

Don't use defines for the size of a name field, everyone
should just use sizeof(). In this case it was never used,
but it is bad practice, so just drop it.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>


# b0649455 23-Oct-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: fix kernel-doc markups

Some identifiers have different names between their prototypes
and the kernel-doc markup. Seome seems to be due to cut-and-paste
related issues.

Others need to be fixed, as kernel-doc markups should use this format:
identifier - description

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> # IPU3 and V4L2
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# f75c431e 07-May-2020 Jacopo Mondi <jacopo@jmondi.org>

media: v4l2-dev: Add v4l2_device_register_ro_subdev_node()

Add to the V4L2 core a function to register device nodes for video
subdevices in read-only mode.

Registering a device node in read-only mode is useful to expose to
userspace the current sub-device configuration, without allowing
application to change it by using the V4L2 subdevice ioctls.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 60d70d75 27-Feb-2020 Jonathan Neuschäfer <j.neuschaefer@gmx.net>

media: v4l2: Switch to new kerneldoc syntax for named variable macro arguments

The new syntax is available since commit 43756e347f21
("scripts/kernel-doc: Add support for named variable macro arguments").

The same HTML output is produced with and without this patch.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# afb34781 08-Dec-2019 Nathan Chancellor <nathan@kernel.org>

media: v4l2-device.h: Explicitly compare grp{id,mask} to zero in v4l2_device macros

When building with Clang + -Wtautological-constant-compare, several of
the ivtv and cx18 drivers warn along the lines of:

drivers/media/pci/cx18/cx18-driver.c:1005:21: warning: converting the
result of '<<' to a boolean always evaluates to true
[-Wtautological-constant-compare]
cx18_call_hw(cx, CX18_HW_GPIO_RESET_CTRL,
^
drivers/media/pci/cx18/cx18-cards.h:18:37: note: expanded from macro
'CX18_HW_GPIO_RESET_CTRL'
#define CX18_HW_GPIO_RESET_CTRL (1 << 6)
^
1 warning generated.

This warning happens because the shift operation is implicitly converted
to a boolean in v4l2_device_mask_call_all before being negated. This can
be solved by just comparing the mask result to 0 explicitly so that
there is no boolean conversion. The ultimate goal is to enable
-Wtautological-compare globally because there are several subwarnings
that would be helpful to have.

For visual consistency and avoidance of these warnings in the future,
all of the implicitly boolean conversions in the v4l2_device macros
are converted to explicit ones as well.

Link: https://github.com/ClangBuiltLinux/linux/issues/752

Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# b95182a6 05-Nov-2019 Hans Verkuil <hverkuil-cisco@xs4all.nl>

media: v4l2-device.h: fix typo: putss -> puts

Fix typo: putss -> puts

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 1a59d1b8 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 93a9d900 23-May-2018 Hans Verkuil <hans.verkuil@cisco.com>

media: v4l2-device.h: add v4l2_device_supports_requests() helper

Add a simple helper function that tests if the driver supports
the request API.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# acd14c18 03-May-2018 Hans Verkuil <hans.verkuil@cisco.com>

media: v4l2-device.h: always expose mdev

The mdev field is only present if CONFIG_MEDIA_CONTROLLER is set.
But since we will need to pass the media_device to vb2 and the
control framework it is very convenient to just make this field
available all the time. If CONFIG_MEDIA_CONTROLLER is not set,
then it will just be NULL.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# d651ff91 21-Sep-2017 Mauro Carvalho Chehab <mchehab@kernel.org>

media: v4l2-device.h: document helper macros

There are several macros that aren't documented using kernel-docs
markups.

Document them.

While here, add cross-references to structs on this file.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 65d7aba0 30-Aug-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] v4l2-device.h: fix some doc tags

Fix some minor issues at the documentation tags on this file,
adding cross-references where needed, and fixing some broken
ones.

While here, fix a few spaces before tabs to make Checkpatch happier.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 575f9308 20-Jul-2016 Mauro Carvalho Chehab <mchehab@kernel.org>

[media] v4l2-device.h: document functions

The functions at v4l2-device.h are not using the proper
markups. Add it, and include at the v4l2-core.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 96655553 03-Apr-2016 Hans Verkuil <hans.verkuil@cisco.com>

[media] v4l2-device.h: add v4l2_device_mask_ variants

The v4l2_device_call_* defines filter subdevs based on the grp_id value.
But some drivers use a bitmask, so instead of filtering by grp_id == value,
you want to filter by grp_id & value.

Make variants of these defines to do this.

The 'has_op' define has been extended to have a grp_id argument as well, and
a mask variant has been added.

This extra argument required a change to go7007.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# 5cf6f7f3 17-Feb-2015 Hans Verkuil <hans.verkuil@cisco.com>

[media] v4l2-core: remove the old .ioctl BKL replacement

To keep V4L2 drivers that did not yet convert to unlocked_ioctl happy,
the v4l2 core had a .ioctl file operation that took a V4L2 lock.

The last drivers are now converted to unlocked_ioctl, so all this
old code can now be removed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>


# ba76a6e6 17-Mar-2014 Hans Verkuil <hans.verkuil@cisco.com>

[media] v4l2-subdev.h: fix sparse error with v4l2_subdev_notify

The notify function is a void function, yet the v4l2_subdev_notify
define uses it in a ? : construction, which causes sparse warnings.

Replace the define by a static inline function and move it to
v4l2-device.h, which is where it belongs since it needs to know the
v4l2_device struct. This wasn't a problem when it was a define, but
as a static inline function this no longer compiles in v4l2-subdev.h.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>


# 2180f92d 03-Mar-2013 Hans Verkuil <hans.verkuil@cisco.com>

[media] v4l2-core: add code to check for specific ops

This patch adds a v4l2_subdev_has_op() macro and a v4l2_device_has_op macro to
quickly check if a specific subdev or any subdev supports a particular subdev
operation.
This makes it easy for drivers to disable certain ioctls if none of the subdevs
supports the necessary functionality.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# c6c73544 22-Mar-2011 Guennadi Liakhovetski <g.liakhovetski@gmx.de>

[media] v4l2-device: fix a macro definition

v4l2_device_unregister_subdev() wrongly uses "arg..." instead of "## arg"
in its body. Fix it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# bedf8bcf 12-Mar-2011 Hans Verkuil <hverkuil@xs4all.nl>

[media] v4l2-device: add kref and a release function

The video_device struct has proper ref counting and its release function
will be called when the last user releases it. But no such support was
available for struct v4l2_device. This made it hard to determine when a
USB driver can release the device if it has multiple device nodes.

With one device node it is easy of course, since when the device node is
released, the whole device can be released.

This patch adds refcounting to v4l2_device. When registering device nodes
the v4l2_device refcount will be increased, when releasing device nodes
it will be decreased. The (optional) release function will be called when
the last device node was released.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 0f62fd6a 24-Feb-2011 Hans Verkuil <hverkuil@xs4all.nl>

[media] v4l2: add v4l2_prio_state to v4l2_device and video_device

Integrate the v4l2_prio_state into the core, ready for use.

One struct v4l2_prio_state is added to v4l2_device and a pointer
to a prio state is added to video_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 95db3a60 09-Dec-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com>

[media] v4l: Add a media_device pointer to the v4l2_device structure

The pointer will later be used to register/unregister media entities
when registering/unregistering a v4l2_subdev or a video_device.

With the introduction of media devices, device drivers need to store a
pointer to a driver-specific structure in the device's drvdata.
v4l2_device can't claim ownership of the drvdata anymore.

To maintain compatibility with drivers that rely on v4l2_device storing
a pointer to itself in the device's drvdata, v4l2_device_register() will
keep doing so if the drvdata is NULL.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 2096a5dc 09-Dec-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com>

[media] v4l: subdev: Add device node support

Create a device node named subdevX for every registered subdev.

As the device node is registered before the subdev core::s_config
function is called, return -EGAIN on open until initialization
completes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Vimarsh Zutshi <vimarsh.zutshi@gmail.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 879aa24d 26-Nov-2010 Hans Verkuil <hverkuil@xs4all.nl>

[media] V4L: improve the BKL replacement heuristic

The BKL replacement mutex had some serious performance side-effects on
V4L drivers. It is replaced by a better heuristic that works around the
worst of the side-effects.

Read the v4l2-dev.c comments for the whole sorry story. This is a
temporary measure only until we can convert all v4l drivers to use
unlocked_ioctl.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 6c2d4dd1 12-Aug-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>

V4L/DVB: V4L2: avoid name conflicts in macros

"sd" and "err" are too common names to be used in macros for local variables.
Prefix them with an underscore to avoid name clashing.

[mchehab@redhat.com: whitespace cleanups]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 0996517c 01-Aug-2010 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB: v4l2: Add new control handling framework

Add a new framework to handle controls which makes life for driver
developers much easier.

Note that this patch moves some of the control support that used to be in
v4l2-common.c to v4l2-ctrls.c. The tables were copied unchanged. The body
of v4l2_ctrl_query_fill() was copied to a new v4l2_ctrl_fill() function
in v4l2-ctrls.c. This new function doesn't use the v4l2_queryctrl
struct anymore, which makes it more general.

The remainder of v4l2-ctrls.c is all new. Highlights include:

- No need to implement VIDIOC_QUERYCTRL, QUERYMENU, S_CTRL, G_CTRL,
S_EXT_CTRLS, G_EXT_CTRLS or TRY_EXT_CTRLS in either bridge drivers
or subdevs. New wrapper functions are provided that can just be plugged in.
Once everything has been converted these wrapper functions can be removed as well.

- When subdevices are added their controls can be automatically merged
with the bridge driver's controls.

- Most drivers just need to implement s_ctrl to set the controls.
The framework handles the locking and tries to be as 'atomic' as possible.

- Ready for the subdev device nodes: the same mechanism applies to subdevs
and their device nodes as well. Sub-device drivers can make controls
local, preventing them from being merged with bridge drivers.

- Takes care of backwards compatibility handling of VIDIOC_S_CTRL and
VIDIOC_G_CTRL. Handling of V4L2_CID_PRIVATE_BASE is fully transparent.
CTRL_CLASS controls are automatically added.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 102e7813 02-May-2009 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (11671): v4l2: add v4l2_device_set_name()

Add a utility function that can be used to setup the v4l2_device's name
field in a standard manner.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 1351a58c 16-Apr-2009 Kay Sievers <kay.sievers@vrfy.org>

V4L/DVB (11517): v4l: remove driver-core BUS_ID_SIZE

The name size limit is gone from the driver core, the BUS_ID_SIZE
value will be removed.

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# ae6cfaac 14-Mar-2009 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (11044): v4l2-device: add v4l2_device_disconnect

Call v4l2_device_disconnect when the parent of a hotpluggable device
disconnects. This ensures that you do not have a pointer to a device that
is no longer present.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 98ec6339 08-Mar-2009 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (11021): v4l2-device: add a notify callback.

Add a notify callback to v4l2_device to let sub-devices notify their
parent of special events.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 3a63e449 14-Feb-2009 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (10643): v4l2-device: allow a NULL parent device when registering.

Some drivers (e.g. for ISA devices) have no parent device because there
is no associated bus driver. Allow the parent device to be NULL in
those cases when registering v4l2_device.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# f9129a2e 12-Jan-2009 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (10230): v4l2-device: fix buggy macro

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 069b7479 30-Dec-2008 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlocked_ioctl.

Since internal to v4l2 the ioctl prototype is the same regardless of it
being called through .ioctl or .unlocked_ioctl, we need to convert it all
to the long return type of unlocked_ioctl.

Thanks to Jean-Francois Moine for posting an initial patch for this and
thus bringing it to our attention.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>


# 2a1fcdf0 29-Nov-2008 Hans Verkuil <hverkuil@xs4all.nl>

V4L/DVB (9820): v4l2: add v4l2_device and v4l2_subdev structs to the v4l2 framework.

Start implementing a proper v4l2 framework as discussed during the
Linux Plumbers Conference 2008.

Introduces v4l2_device (for device instances) and v4l2_subdev (representing
sub-device instances).

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Reviewed-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: Andy Walls <awalls@radix.net>
Reviewed-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>