Lines Matching +full:sub +full:- +full:bus

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * V4L2 sub-device support header.
12 #include <linux/v4l2-subdev.h>
13 #include <media/media-entity.h>
14 #include <media/v4l2-async.h>
15 #include <media/v4l2-common.h>
16 #include <media/v4l2-dev.h>
17 #include <media/v4l2-fh.h>
18 #include <media/v4l2-mediabus.h>
44 * struct v4l2_decode_vbi_line - used to decode_vbi_line
50 * @line: Line number of the sliced VBI data (1-23)
61 * Sub-devices are devices that are connected somehow to the main bridge
65 * Usually these devices are controlled through an i2c bus, but other buses
69 * generic manner. Most operations that these sub-devices support fall in
98 * The ioctl ops is meant for generic ioctl-like commands. Depending on
99 * the use-case it might be better to use subdev-specific ops (currently
100 * not yet implemented) since ops provide proper type-checking.
104 * enum v4l2_subdev_io_pin_bits - Subdevice external IO pin configuration
111 * &struct v4l2_subdev_io_pin_config->value.
124 * struct v4l2_subdev_io_pin_config - Subdevice external IO pin configuration
130 * @value: Initial value for pin - e.g. GPIO output value
142 * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs
160 * drivers without discussing this first on the linux-media mailinglist.
166 * @command: called by in-kernel drivers in order to call functions internal
181 * Documentation/driver-api/media/camera-sensor.rst . pre_streamon and
182 * post_streamoff callbacks can be used for e.g. setting the bus to LP-11
217 struct v4l2_event_subscription *sub);
219 struct v4l2_event_subscription *sub);
223 * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened
237 * freq->type must be filled in. Normally done by video_ioctl2()
244 * @s_tuner: callback for VIDIOC_S_TUNER() ioctl handler code. @vt->type must be
287 * struct v4l2_subdev_audio_ops - Callbacks used for audio-related settings
293 * -EINVAL is returned.
298 * If the frequency is not supported, then %-EINVAL is returned.
302 * Never attempt to use user-level input IDs (e.g. Composite, S-Video,
306 * The calling driver is responsible for mapping a user-level input to
322 * @vc: CSI-2 virtual channel
323 * @dt: CSI-2 data type ID
331 * enum v4l2_mbus_frame_desc_flags - media bus frame description flags
334 * Indicates that &struct v4l2_mbus_frame_desc_entry->length field
346 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure
350 * @pixelcode: media bus pixel code, valid if @flags
354 * @bus: Bus-specific frame descriptor parameters
355 * @bus.csi2: CSI-2-specific bus configuration
364 } bus; member
374 * enum v4l2_mbus_frame_desc_type - media bus frame description type
380 * Parallel media bus.
382 * CSI-2 media bus. Frame desc parameters must be set in
383 * &struct v4l2_mbus_frame_desc_entry->csi2.
392 * struct v4l2_mbus_frame_desc - media bus data frame description
393 * @type: type of the bus (enum v4l2_mbus_frame_desc_type)
404 * enum v4l2_subdev_pre_streamon_flags - Flags for pre_streamon subdev core op
406 * @V4L2_SUBDEV_PRE_STREAMON_FL_MANUAL_LP: Set the transmitter to either LP-11
407 * or LP-111 mode before call to s_stream().
414 * struct v4l2_subdev_video_ops - Callbacks used when v4l device was opened
423 * to 0. If the frequency is not supported, then -EINVAL is returned.
447 * sub-device. Failure on stop will remove any resources acquired in
451 * v4l2-subdev.c.
469 * initialising the bus. Current usage is to set a CSI-2 transmitter to
470 * LP-11 or LP-111 mode before streaming. See &enum
474 * indicated by the flags argument. In particular, -EACCES indicates lack
501 * struct v4l2_subdev_vbi_ops - Callbacks used when v4l device was opened
521 * the readback register contains invalid or erroneous data %-EIO is
546 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
561 * enum v4l2_subdev_ir_mode- describes the type of IR supported
570 * struct v4l2_subdev_ir_parameters - Parameters for IR TX or TX
619 * struct v4l2_subdev_ir_ops - operations for IR subdevices
622 * The semantics are similar to a non-blocking read() call.
631 * settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
638 * The semantics are similar to a non-blocking write() call.
647 * settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
674 * struct v4l2_subdev_pad_config - Used for storing subdev pad information.
689 * struct v4l2_subdev_stream_config - Used for storing stream configuration.
713 * struct v4l2_subdev_stream_configs - A collection of stream configs.
724 * struct v4l2_subdev_krouting - subdev routing table
739 * struct v4l2_subdev_state - Used for storing subdev state information.
743 * @sd: the sub-device which the state is related to
763 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
791 * @s_dv_timings: Set custom dv timings in the sub device. This is used
792 * when sub device is capable of setting detailed timing information
795 * @g_dv_timings: Get custom dv timings in the sub device.
808 * @get_frame_desc: get the current low level media bus frame parameters.
810 * @set_frame_desc: set the low level media bus frame parameters, @fd array
813 * @get_mbus_config: get the media bus configuration of a remote sub-device.
814 * The media bus configuration is usually retrieved from the
815 * firmware interface at sub-device probe time, immediately
817 * driver. Remote sub-devices (usually video receivers) shall
818 * use this operation to query the transmitting end bus
820 * Callers should make sure they get the most up-to-date as
906 * struct v4l2_subdev_ops - Subdev operations
929 * struct v4l2_subdev_internal_ops - V4L2 subdev internal ops
946 * filehandle to the v4l-subdevX device node was closed. If no device
947 * node was created for this sub-device, then the @release callback
951 * sub-device that sets the V4L2_SUBDEV_FL_HAS_DEVNODE flag.
984 * - Centrally managed subdev active state is enabled
985 * - Legacy pad config is _not_ supported (state->pads is NULL)
986 * - Routing ioctls are available
987 * - Multiple streams per pad are supported
994 * struct v4l2_subdev_platform_data - regulators config struct
998 * @host_priv: Per-subdevice data, specific for a certain video host device
1008 * struct v4l2_subdev - describes a V4L2 sub-device
1011 * @list: List of sub-devices
1013 * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev
1016 * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device;
1017 * %V4L2_SUBDEV_FL_IS_SPI - Set this flag if this subdev is a spi device;
1018 * %V4L2_SUBDEV_FL_HAS_DEVNODE - Set this flag if this subdev needs a
1020 * %V4L2_SUBDEV_FL_HAS_EVENTS - Set this flag if this subdev generates
1028 * @name: Name of the sub-device. Please notice that the name must be unique.
1029 * @grp_id: can be used to group similar subdevs. Value is driver-specific
1036 * either dev->of_node->fwnode or dev->fwnode (whichever is non-NULL).
1038 * @notifier->done_list list.
1041 * @subdev_notifier: A sub-device notifier implicitly registered for the sub-
1060 * stand-alone or embedded in a larger struct.
1111 * media_entity_to_v4l2_subdev - Returns a &struct v4l2_subdev from
1126 * vdev_to_v4l2_subdev - Returns a &struct v4l2_subdev from
1135 * struct v4l2_subdev_fh - Used for storing subdev information per file handle
1152 * to_v4l2_subdev_fh - Returns a &struct v4l2_subdev_fh from
1163 * v4l2_set_subdevdata - Sets V4L2 dev private device data
1170 sd->dev_priv = p; in v4l2_set_subdevdata()
1174 * v4l2_get_subdevdata - Gets V4L2 dev private device data
1182 return sd->dev_priv; in v4l2_get_subdevdata()
1186 * v4l2_set_subdev_hostdata - Sets V4L2 dev private host data
1193 sd->host_priv = p; in v4l2_set_subdev_hostdata()
1197 * v4l2_get_subdev_hostdata - Gets V4L2 dev private data
1205 return sd->host_priv; in v4l2_get_subdev_hostdata()
1211 * v4l2_subdev_get_fwnode_pad_1_to_1 - Get pad number from a subdev fwnode
1228 * v4l2_subdev_link_validate_default - validates a media link
1235 * This function ensures that width, height and the media bus pixel
1244 * v4l2_subdev_link_validate - validates a media link
1251 * width, height and the media bus pixel code are equal on both
1254 * The function can be used as a drop-in &media_entity_ops.link_validate
1263 * v4l2_subdev_has_pad_interdep - MC has_pad_interdep implementation for subdevs
1281 * __v4l2_subdev_state_alloc - allocate v4l2_subdev_state
1296 * __v4l2_subdev_state_free - free a v4l2_subdev_state
1305 * v4l2_subdev_init_finalize() - Finalizes the initialization of the subdevice
1322 ":" __stringify(__LINE__) ":sd->active_state->lock"; \
1330 * v4l2_subdev_cleanup() - Releases the resources allocated by the subdevice
1333 * Clean up a V4L2 async sub-device. Must be called for a sub-device as part of
1340 * A macro to generate the macro or function name for sub-devices state access
1357 * v4l2_subdev_state_get_format() - Get pointer to a stream format
1365 * For stream-unaware drivers the format for the corresponding pad is returned.
1376 * const-correctness in all cases.
1392 * v4l2_subdev_state_get_crop() - Get pointer to a stream crop rectangle
1400 * For stream-unaware drivers the crop rectangle for the corresponding pad is
1414 * v4l2_subdev_state_get_compose() - Get pointer to a stream compose rectangle
1422 * For stream-unaware drivers the compose rectangle for the corresponding pad is
1436 * v4l2_subdev_state_get_interval() - Get pointer to a stream frame interval
1444 * For stream-unaware drivers the frame interval for the corresponding pad is
1460 * v4l2_subdev_get_fmt() - Fill format based on state
1465 * Fill @format->format field based on the information in the @format struct.
1477 * v4l2_subdev_get_frame_interval() - Fill frame interval based on state
1482 * Fill @fi->interval field based on the information in the @fi struct.
1495 * v4l2_subdev_set_routing() - Set given routing to subdev state
1515 * for_each_active_route - iterate on all active routes of a routing table
1524 * v4l2_subdev_set_routing_with_fmt() - Set given routing and format to subdev
1540 * v4l2_subdev_routing_find_opposite_end() - Find the opposite stream
1553 * Returns 0 on success, or -EINVAL if no matching route is found.
1560 * v4l2_subdev_state_get_opposite_stream_format() - Get pointer to opposite
1576 * v4l2_subdev_state_xlate_streams() - Translate streams from one pad to another
1599 * enum v4l2_subdev_routing_restriction - Subdevice internal routing restrictions
1616 * only non-overlapping 1-to-1 stream routing is allowed (a combination of
1645 * v4l2_subdev_routing_validate() - Verify that routes comply with driver
1660 * v4l2_subdev_enable_streams() - Enable streams on a pad
1671 * contains an already enabled stream, this function returns -EALREADY without
1674 * Per-stream enable is only available for subdevs that implement the
1676 * function implements a best-effort compatibility by calling the .s_stream()
1681 * * -EALREADY: One of the streams in streams_mask is already enabled
1682 * * -EINVAL: The pad index is invalid, or doesn't correspond to a source pad
1683 * * -EOPNOTSUPP: Falling back to the legacy .s_stream() operation is
1690 * v4l2_subdev_disable_streams() - Disable streams on a pad
1701 * contains a disabled stream, this function returns -EALREADY without
1704 * Per-stream disable is only available for subdevs that implement the
1706 * function implements a best-effort compatibility by calling the .s_stream()
1711 * * -EALREADY: One of the streams in streams_mask is not enabled
1712 * * -EINVAL: The pad index is invalid, or doesn't correspond to a source pad
1713 * * -EOPNOTSUPP: Falling back to the legacy .s_stream() operation is
1720 * v4l2_subdev_s_stream_helper() - Helper to implement the subdev s_stream
1725 * Subdevice drivers that implement the streams-aware
1741 * v4l2_subdev_lock_state() - Locks the subdev state
1750 mutex_lock(state->lock); in v4l2_subdev_lock_state()
1754 * v4l2_subdev_unlock_state() - Unlocks the subdev state
1761 mutex_unlock(state->lock); in v4l2_subdev_unlock_state()
1765 * v4l2_subdev_lock_states - Lock two sub-device states
1769 * Locks the state of two sub-devices.
1781 mutex_lock(state1->lock); in v4l2_subdev_lock_states()
1782 if (state1->lock != state2->lock) in v4l2_subdev_lock_states()
1783 mutex_lock(state2->lock); in v4l2_subdev_lock_states()
1787 * v4l2_subdev_unlock_states() - Unlock two sub-device states
1791 * Unlocks the state of two sub-devices.
1799 mutex_unlock(state1->lock); in v4l2_subdev_unlock_states()
1800 if (state1->lock != state2->lock) in v4l2_subdev_unlock_states()
1801 mutex_unlock(state2->lock); in v4l2_subdev_unlock_states()
1805 * v4l2_subdev_get_unlocked_active_state() - Checks that the active subdev state
1819 if (sd->active_state) in v4l2_subdev_get_unlocked_active_state()
1820 lockdep_assert_not_held(sd->active_state->lock); in v4l2_subdev_get_unlocked_active_state()
1821 return sd->active_state; in v4l2_subdev_get_unlocked_active_state()
1825 * v4l2_subdev_get_locked_active_state() - Checks that the active subdev state
1840 if (sd->active_state) in v4l2_subdev_get_locked_active_state()
1841 lockdep_assert_held(sd->active_state->lock); in v4l2_subdev_get_locked_active_state()
1842 return sd->active_state; in v4l2_subdev_get_locked_active_state()
1846 * v4l2_subdev_lock_and_get_active_state() - Locks and returns the active subdev
1858 if (sd->active_state) in v4l2_subdev_lock_and_get_active_state()
1859 v4l2_subdev_lock_state(sd->active_state); in v4l2_subdev_lock_and_get_active_state()
1860 return sd->active_state; in v4l2_subdev_lock_and_get_active_state()
1864 * v4l2_subdev_init - initializes the sub-device struct
1875 * v4l2_subdev_call - call an operation of a v4l2_subdev.
1892 __result = -ENODEV; \
1893 else if (!(__sd->ops->o && __sd->ops->o->f)) \
1894 __result = -ENOIOCTLCMD; \
1896 v4l2_subdev_call_wrappers.o->f) \
1897 __result = v4l2_subdev_call_wrappers.o->f( \
1900 __result = __sd->ops->o->f(__sd, ##args); \
1905 * v4l2_subdev_call_state_active - call an operation of a v4l2_subdev which
1935 * v4l2_subdev_call_state_try - call an operation of a v4l2_subdev which
1951 * Note: only legacy non-MC drivers may need this macro.
1958 ":" __stringify(__LINE__) ":state->lock"; \
1969 * v4l2_subdev_has_op - Checks if a subdev defines a certain operation.
1977 ((sd)->ops->o && (sd)->ops->o->f)
1980 * v4l2_subdev_notify_event() - Delivers event notification for subdevice
1993 * v4l2_subdev_is_streaming() - Returns if the subdevice is streaming