Lines Matching +full:a +full:- +full:c
1 .. SPDX-License-Identifier: GPL-2.0
4 --------------------
6 Each device instance is represented by a struct v4l2_device.
8 would embed this struct inside a larger struct.
12 :c:func:`v4l2_device_register <v4l2_device_register>`
13 (dev, :c:type:`v4l2_dev <v4l2_device>`).
15 Registration will initialize the :c:type:`v4l2_device` struct. If the
16 dev->driver_data field is ``NULL``, it will be linked to
17 :c:type:`v4l2_dev <v4l2_device>` argument.
20 dev->driver_data manually to point to the driver-specific device structure
21 that embed the struct v4l2_device instance. This is achieved by a
23 They must also set the struct v4l2_device mdev field to point to a
24 properly initialized and registered :c:type:`media_device` instance.
26 If :c:type:`v4l2_dev <v4l2_device>`\ ->name is empty then it will be set to a
28 If you set it up before calling :c:func:`v4l2_device_register` then it will
30 :c:type:`v4l2_dev <v4l2_device>`\ ->name before calling
31 :c:func:`v4l2_device_register`.
33 You can use :c:func:`v4l2_device_set_name` to set the name based on a driver
34 name and a driver-global atomic_t instance. This will generate names like
35 ``ivtv0``, ``ivtv1``, etc. If the name ends with a digit, then it will insert
36 a dash: ``cx18-0``, ``cx18-1``, etc. This function returns the instance number.
38 The first ``dev`` argument is normally the ``struct device`` pointer of a
42 :c:type:`v4l2_dev <v4l2_device>` with a particular parent.
44 You can also supply a ``notify()`` callback that can be called by sub-devices
46 sub-device. Any notifications a sub-device supports must be defined in a header
51 :c:func:`v4l2_device_unregister`
52 (:c:type:`v4l2_dev <v4l2_device>`).
54 If the dev->driver_data field points to :c:type:`v4l2_dev <v4l2_device>`,
58 If you have a hotpluggable device (e.g. a USB device), then when a disconnect
59 happens the parent device becomes invalid. Since :c:type:`v4l2_device` has a
63 :c:func:`v4l2_device_disconnect`
64 (:c:type:`v4l2_dev <v4l2_device>`).
67 :c:func:`v4l2_device_unregister` function for that. If your driver is not
68 hotpluggable, then there is no need to call :c:func:`v4l2_device_disconnect`.
70 Sometimes you need to iterate over all devices registered by a specific
72 hardware. E.g. the ivtvfb driver is a framebuffer driver that uses the ivtv
77 .. code-block:: c
96 pci_bus_type is a global. For USB buses use usb_bus_type. */
104 Sometimes you need to keep a running counter of the device instance. This is
105 commonly used to map a device instance to an index of a module option array.
109 .. code-block:: c
116 state->instance = atomic_inc_return(&drv_instance) - 1;
120 safe to unregister :c:type:`v4l2_device` for hotpluggable devices. For this
121 purpose :c:type:`v4l2_device` has refcounting support. The refcount is
122 increased whenever :c:func:`video_register_device` is called and it is
124 zero, then the :c:type:`v4l2_device` release() callback is called. You can
130 :c:func:`v4l2_device_get`
131 (:c:type:`v4l2_dev <v4l2_device>`).
135 :c:func:`v4l2_device_put`
136 (:c:type:`v4l2_dev <v4l2_device>`).
139 :c:func:`v4l2_device_put` in the ``disconnect()`` callback (for USB devices)
146 .. kernel-doc:: include/media/v4l2-device.h