2 * Media controller test application
4 * Copyright (C) 2010 Ideas on board SPRL <laurent.pinchart@ideasonboard.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
23 #include <linux/v4l2-subdev.h>
28 * @brief Open a sub-device.
29 * @param entity - sub-device media entity.
31 * Open the V4L2 subdev device node associated with @a entity. The file
32 * descriptor is stored in the media_entity structure.
34 * @return 0 on success, or a negative error code on failure.
36 int v4l2_subdev_open(struct media_entity *entity);
39 * @brief Close a sub-device.
40 * @param entity - sub-device media entity.
42 * Close the V4L2 subdev device node associated with the @a entity and opened by
43 * a previous call to v4l2_subdev_open() (either explicit or implicit).
45 void v4l2_subdev_close(struct media_entity *entity);
48 * @brief Retrieve the format on a pad.
49 * @param entity - subdev-device media entity.
50 * @param format - format to be filled.
51 * @param pad - pad number.
52 * @param which - identifier of the format to get.
54 * Retrieve the current format on the @a entity @a pad and store it in the
55 * @a format structure.
57 * @a which is set to V4L2_SUBDEV_FORMAT_TRY to retrieve the try format stored
58 * in the file handle, of V4L2_SUBDEV_FORMAT_ACTIVE to retrieve the current
61 * @return 0 on success, or a negative error code on failure.
63 int v4l2_subdev_get_format(struct media_entity *entity,
64 struct v4l2_mbus_framefmt *format, unsigned int pad,
65 enum v4l2_subdev_format_whence which);
68 * @brief Set the format on a pad.
69 * @param entity - subdev-device media entity.
70 * @param format - format.
71 * @param pad - pad number.
72 * @param which - identifier of the format to set.
74 * Set the format on the @a entity @a pad to @a format. The driver is allowed to
75 * modify the requested format, in which case @a format is updated with the
78 * @a which is set to V4L2_SUBDEV_FORMAT_TRY to set the try format stored in the
79 * file handle, of V4L2_SUBDEV_FORMAT_ACTIVE to configure the device with an
82 * @return 0 on success, or a negative error code on failure.
84 int v4l2_subdev_set_format(struct media_entity *entity,
85 struct v4l2_mbus_framefmt *format, unsigned int pad,
86 enum v4l2_subdev_format_whence which);
89 * @brief Retrieve the crop rectangle on a pad.
90 * @param entity - subdev-device media entity.
91 * @param rect - crop rectangle to be filled.
92 * @param pad - pad number.
93 * @param which - identifier of the format to get.
95 * Retrieve the current crop rectangleon the @a entity @a pad and store it in
96 * the @a rect structure.
98 * @a which is set to V4L2_SUBDEV_FORMAT_TRY to retrieve the try crop rectangle
99 * stored in the file handle, of V4L2_SUBDEV_FORMAT_ACTIVE to retrieve the
100 * current active crop rectangle.
102 * @return 0 on success, or a negative error code on failure.
104 int v4l2_subdev_get_crop(struct media_entity *entity, struct v4l2_rect *rect,
105 unsigned int pad, enum v4l2_subdev_format_whence which);
108 * @brief Set the crop rectangle on a pad.
109 * @param entity - subdev-device media entity.
110 * @param rect - crop rectangle.
111 * @param pad - pad number.
112 * @param which - identifier of the format to set.
114 * Set the crop rectangle on the @a entity @a pad to @a rect. The driver is
115 * allowed to modify the requested rectangle, in which case @a rect is updated
116 * with the modifications.
118 * @a which is set to V4L2_SUBDEV_FORMAT_TRY to set the try crop rectangle
119 * stored in the file handle, of V4L2_SUBDEV_FORMAT_ACTIVE to configure the
120 * device with an active crop rectangle.
122 * @return 0 on success, or a negative error code on failure.
124 int v4l2_subdev_set_crop(struct media_entity *entity, struct v4l2_rect *rect,
125 unsigned int pad, enum v4l2_subdev_format_whence which);
128 * @brief Retrieve the frame interval on a sub-device.
129 * @param entity - subdev-device media entity.
130 * @param interval - frame interval to be filled.
132 * Retrieve the current frame interval on subdev @a entity and store it in the
133 * @a interval structure.
135 * Frame interval retrieving is usually supported only on devices at the
136 * beginning of video pipelines, such as sensors.
138 * @return 0 on success, or a negative error code on failure.
141 int v4l2_subdev_get_frame_interval(struct media_entity *entity,
142 struct v4l2_fract *interval);
145 * @brief Set the frame interval on a sub-device.
146 * @param entity - subdev-device media entity.
147 * @param interval - frame interval.
149 * Set the frame interval on subdev @a entity to @a interval. The driver is
150 * allowed to modify the requested frame interval, in which case @a interval is
151 * updated with the modifications.
153 * Frame interval setting is usually supported only on devices at the beginning
154 * of video pipelines, such as sensors.
156 * @return 0 on success, or a negative error code on failure.
158 int v4l2_subdev_set_frame_interval(struct media_entity *entity,
159 struct v4l2_fract *interval);