diff options
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r-- | include/media/v4l2-subdev.h | 150 |
1 files changed, 94 insertions, 56 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index ec399c770301..980a86c08fce 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -108,22 +108,31 @@ struct v4l2_decode_vbi_line { | |||
108 | * not yet implemented) since ops provide proper type-checking. | 108 | * not yet implemented) since ops provide proper type-checking. |
109 | */ | 109 | */ |
110 | 110 | ||
111 | /* Subdevice external IO pin configuration */ | 111 | /** |
112 | #define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */ | 112 | * enum v4l2_subdev_io_pin_bits - Subdevice external IO pin configuration |
113 | #define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1) | 113 | * bits |
114 | #define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2) | 114 | * |
115 | #define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */ | 115 | * @V4L2_SUBDEV_IO_PIN_DISABLE: disables a pin config. ENABLE assumed. |
116 | #define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */ | 116 | * @V4L2_SUBDEV_IO_PIN_OUTPUT: set it if pin is an output. |
117 | * @V4L2_SUBDEV_IO_PIN_INPUT: set it if pin is an input. | ||
118 | * @V4L2_SUBDEV_IO_PIN_SET_VALUE: to set the output value via | ||
119 | * &struct v4l2_subdev_io_pin_config->value. | ||
120 | * @V4L2_SUBDEV_IO_PIN_ACTIVE_LOW: pin active is bit 0. | ||
121 | * Otherwise, ACTIVE HIGH is assumed. | ||
122 | */ | ||
123 | enum v4l2_subdev_io_pin_bits { | ||
124 | V4L2_SUBDEV_IO_PIN_DISABLE = 0, | ||
125 | V4L2_SUBDEV_IO_PIN_OUTPUT = 1, | ||
126 | V4L2_SUBDEV_IO_PIN_INPUT = 2, | ||
127 | V4L2_SUBDEV_IO_PIN_SET_VALUE = 3, | ||
128 | V4L2_SUBDEV_IO_PIN_ACTIVE_LOW = 4, | ||
129 | }; | ||
117 | 130 | ||
118 | /** | 131 | /** |
119 | * struct v4l2_subdev_io_pin_config - Subdevice external IO pin configuration | 132 | * struct v4l2_subdev_io_pin_config - Subdevice external IO pin configuration |
120 | * | 133 | * |
121 | * @flags: bitmask with flags for this pin's config: | 134 | * @flags: bitmask with flags for this pin's config, whose bits are defined by |
122 | * %V4L2_SUBDEV_IO_PIN_DISABLE - disables a pin config, | 135 | * &enum v4l2_subdev_io_pin_bits. |
123 | * %V4L2_SUBDEV_IO_PIN_OUTPUT - if pin is an output, | ||
124 | * %V4L2_SUBDEV_IO_PIN_INPUT - if pin is an input, | ||
125 | * %V4L2_SUBDEV_IO_PIN_SET_VALUE - to set the output value via @value | ||
126 | * and %V4L2_SUBDEV_IO_PIN_ACTIVE_LOW - if active is 0. | ||
127 | * @pin: Chip external IO pin to configure | 136 | * @pin: Chip external IO pin to configure |
128 | * @function: Internal signal pad/function to route to IO pin | 137 | * @function: Internal signal pad/function to route to IO pin |
129 | * @value: Initial value for pin - e.g. GPIO output value | 138 | * @value: Initial value for pin - e.g. GPIO output value |
@@ -140,7 +149,7 @@ struct v4l2_subdev_io_pin_config { | |||
140 | /** | 149 | /** |
141 | * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs | 150 | * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs |
142 | * | 151 | * |
143 | * @log_status: callback for %VIDIOC_LOG_STATUS ioctl handler code. | 152 | * @log_status: callback for VIDIOC_LOG_STATUS() ioctl handler code. |
144 | * | 153 | * |
145 | * @s_io_pin_config: configure one or more chip I/O pins for chips that | 154 | * @s_io_pin_config: configure one or more chip I/O pins for chips that |
146 | * multiplex different internal signal pads out to IO pins. This function | 155 | * multiplex different internal signal pads out to IO pins. This function |
@@ -168,9 +177,9 @@ struct v4l2_subdev_io_pin_config { | |||
168 | * @compat_ioctl32: called when a 32 bits application uses a 64 bits Kernel, | 177 | * @compat_ioctl32: called when a 32 bits application uses a 64 bits Kernel, |
169 | * in order to fix data passed from/to userspace. | 178 | * in order to fix data passed from/to userspace. |
170 | * | 179 | * |
171 | * @g_register: callback for %VIDIOC_G_REGISTER ioctl handler code. | 180 | * @g_register: callback for VIDIOC_DBG_G_REGISTER() ioctl handler code. |
172 | * | 181 | * |
173 | * @s_register: callback for %VIDIOC_G_REGISTER ioctl handler code. | 182 | * @s_register: callback for VIDIOC_DBG_S_REGISTER() ioctl handler code. |
174 | * | 183 | * |
175 | * @s_power: puts subdevice in power saving mode (on == 0) or normal operation | 184 | * @s_power: puts subdevice in power saving mode (on == 0) or normal operation |
176 | * mode (on == 1). | 185 | * mode (on == 1). |
@@ -215,29 +224,48 @@ struct v4l2_subdev_core_ops { | |||
215 | * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened | 224 | * struct v4l2_subdev_tuner_ops - Callbacks used when v4l device was opened |
216 | * in radio mode. | 225 | * in radio mode. |
217 | * | 226 | * |
218 | * @s_radio: callback for %VIDIOC_S_RADIO ioctl handler code. | 227 | * @s_radio: callback that switches the tuner to radio mode. |
228 | * drivers should explicitly call it when a tuner ops should | ||
229 | * operate on radio mode, before being able to handle it. | ||
230 | * Used on devices that have both AM/FM radio receiver and TV. | ||
219 | * | 231 | * |
220 | * @s_frequency: callback for %VIDIOC_S_FREQUENCY ioctl handler code. | 232 | * @s_frequency: callback for VIDIOC_S_FREQUENCY() ioctl handler code. |
221 | * | 233 | * |
222 | * @g_frequency: callback for %VIDIOC_G_FREQUENCY ioctl handler code. | 234 | * @g_frequency: callback for VIDIOC_G_FREQUENCY() ioctl handler code. |
223 | * freq->type must be filled in. Normally done by video_ioctl2() | 235 | * freq->type must be filled in. Normally done by video_ioctl2() |
224 | * or the bridge driver. | 236 | * or the bridge driver. |
225 | * | 237 | * |
226 | * @enum_freq_bands: callback for %VIDIOC_ENUM_FREQ_BANDS ioctl handler code. | 238 | * @enum_freq_bands: callback for VIDIOC_ENUM_FREQ_BANDS() ioctl handler code. |
227 | * | 239 | * |
228 | * @g_tuner: callback for %VIDIOC_G_TUNER ioctl handler code. | 240 | * @g_tuner: callback for VIDIOC_G_TUNER() ioctl handler code. |
229 | * | 241 | * |
230 | * @s_tuner: callback for %VIDIOC_S_TUNER ioctl handler code. @vt->type must be | 242 | * @s_tuner: callback for VIDIOC_S_TUNER() ioctl handler code. @vt->type must be |
231 | * filled in. Normally done by video_ioctl2 or the | 243 | * filled in. Normally done by video_ioctl2 or the |
232 | * bridge driver. | 244 | * bridge driver. |
233 | * | 245 | * |
234 | * @g_modulator: callback for %VIDIOC_G_MODULATOR ioctl handler code. | 246 | * @g_modulator: callback for VIDIOC_G_MODULATOR() ioctl handler code. |
235 | * | 247 | * |
236 | * @s_modulator: callback for %VIDIOC_S_MODULATOR ioctl handler code. | 248 | * @s_modulator: callback for VIDIOC_S_MODULATOR() ioctl handler code. |
237 | * | 249 | * |
238 | * @s_type_addr: sets tuner type and its I2C addr. | 250 | * @s_type_addr: sets tuner type and its I2C addr. |
239 | * | 251 | * |
240 | * @s_config: sets tda9887 specific stuff, like port1, port2 and qss | 252 | * @s_config: sets tda9887 specific stuff, like port1, port2 and qss |
253 | * | ||
254 | * .. note:: | ||
255 | * | ||
256 | * On devices that have both AM/FM and TV, it is up to the driver | ||
257 | * to explicitly call s_radio when the tuner should be switched to | ||
258 | * radio mode, before handling other &struct v4l2_subdev_tuner_ops | ||
259 | * that would require it. An example of such usage is:: | ||
260 | * | ||
261 | * static void s_frequency(void *priv, const struct v4l2_frequency *f) | ||
262 | * { | ||
263 | * ... | ||
264 | * if (f.type == V4L2_TUNER_RADIO) | ||
265 | * v4l2_device_call_all(v4l2_dev, 0, tuner, s_radio); | ||
266 | * ... | ||
267 | * v4l2_device_call_all(v4l2_dev, 0, tuner, s_frequency); | ||
268 | * } | ||
241 | */ | 269 | */ |
242 | struct v4l2_subdev_tuner_ops { | 270 | struct v4l2_subdev_tuner_ops { |
243 | int (*s_radio)(struct v4l2_subdev *sd); | 271 | int (*s_radio)(struct v4l2_subdev *sd); |
@@ -285,25 +313,32 @@ struct v4l2_subdev_audio_ops { | |||
285 | int (*s_stream)(struct v4l2_subdev *sd, int enable); | 313 | int (*s_stream)(struct v4l2_subdev *sd, int enable); |
286 | }; | 314 | }; |
287 | 315 | ||
288 | /* Indicates the @length field specifies maximum data length. */ | 316 | /** |
289 | #define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX (1U << 0) | 317 | * enum v4l2_mbus_frame_desc_entry - media bus frame description flags |
290 | /* | 318 | * |
291 | * Indicates that the format does not have line offsets, i.e. the | 319 | * @V4L2_MBUS_FRAME_DESC_FL_LEN_MAX: |
292 | * receiver should use 1D DMA. | 320 | * Indicates that &struct v4l2_mbus_frame_desc_entry->length field |
321 | * specifies maximum data length. | ||
322 | * @V4L2_MBUS_FRAME_DESC_FL_BLOB: | ||
323 | * Indicates that the format does not have line offsets, i.e. | ||
324 | * the receiver should use 1D DMA. | ||
293 | */ | 325 | */ |
294 | #define V4L2_MBUS_FRAME_DESC_FL_BLOB (1U << 1) | 326 | enum v4l2_mbus_frame_desc_flags { |
327 | V4L2_MBUS_FRAME_DESC_FL_LEN_MAX = BIT(0), | ||
328 | V4L2_MBUS_FRAME_DESC_FL_BLOB = BIT(1), | ||
329 | }; | ||
295 | 330 | ||
296 | /** | 331 | /** |
297 | * struct v4l2_mbus_frame_desc_entry - media bus frame description structure | 332 | * struct v4l2_mbus_frame_desc_entry - media bus frame description structure |
298 | * | 333 | * |
299 | * @flags: bitmask flags: %V4L2_MBUS_FRAME_DESC_FL_LEN_MAX and | 334 | * @flags: bitmask flags, as defined by &enum v4l2_mbus_frame_desc_flags. |
300 | * %V4L2_MBUS_FRAME_DESC_FL_BLOB. | 335 | * @pixelcode: media bus pixel code, valid if @flags |
301 | * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set | 336 | * %FRAME_DESC_FL_BLOB is not set. |
302 | * @length: number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB | 337 | * @length: number of octets per frame, valid if @flags |
303 | * is set | 338 | * %V4L2_MBUS_FRAME_DESC_FL_LEN_MAX is set. |
304 | */ | 339 | */ |
305 | struct v4l2_mbus_frame_desc_entry { | 340 | struct v4l2_mbus_frame_desc_entry { |
306 | u16 flags; | 341 | enum v4l2_mbus_frame_desc_flags flags; |
307 | u32 pixelcode; | 342 | u32 pixelcode; |
308 | u32 length; | 343 | u32 length; |
309 | }; | 344 | }; |
@@ -332,9 +367,9 @@ struct v4l2_mbus_frame_desc { | |||
332 | * regarding clock frequency dividers, etc. If not used, then set flags | 367 | * regarding clock frequency dividers, etc. If not used, then set flags |
333 | * to 0. If the frequency is not supported, then -EINVAL is returned. | 368 | * to 0. If the frequency is not supported, then -EINVAL is returned. |
334 | * | 369 | * |
335 | * @g_std: callback for %VIDIOC_G_STD ioctl handler code. | 370 | * @g_std: callback for VIDIOC_G_STD() ioctl handler code. |
336 | * | 371 | * |
337 | * @s_std: callback for %VIDIOC_S_STD ioctl handler code. | 372 | * @s_std: callback for VIDIOC_S_STD() ioctl handler code. |
338 | * | 373 | * |
339 | * @s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by | 374 | * @s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by |
340 | * video input devices. | 375 | * video input devices. |
@@ -342,7 +377,7 @@ struct v4l2_mbus_frame_desc { | |||
342 | * @g_std_output: get current standard for video OUTPUT devices. This is ignored | 377 | * @g_std_output: get current standard for video OUTPUT devices. This is ignored |
343 | * by video input devices. | 378 | * by video input devices. |
344 | * | 379 | * |
345 | * @querystd: callback for %VIDIOC_QUERYSTD ioctl handler code. | 380 | * @querystd: callback for VIDIOC_QUERYSTD() ioctl handler code. |
346 | * | 381 | * |
347 | * @g_tvnorms: get &v4l2_std_id with all standards supported by the video | 382 | * @g_tvnorms: get &v4l2_std_id with all standards supported by the video |
348 | * CAPTURE device. This is ignored by video output devices. | 383 | * CAPTURE device. This is ignored by video output devices. |
@@ -358,13 +393,15 @@ struct v4l2_mbus_frame_desc { | |||
358 | * | 393 | * |
359 | * @g_pixelaspect: callback to return the pixelaspect ratio. | 394 | * @g_pixelaspect: callback to return the pixelaspect ratio. |
360 | * | 395 | * |
361 | * @g_parm: callback for %VIDIOC_G_PARM ioctl handler code. | 396 | * @g_parm: callback for VIDIOC_G_PARM() ioctl handler code. |
362 | * | 397 | * |
363 | * @s_parm: callback for %VIDIOC_S_PARM ioctl handler code. | 398 | * @s_parm: callback for VIDIOC_S_PARM() ioctl handler code. |
364 | * | 399 | * |
365 | * @g_frame_interval: callback for %VIDIOC_G_FRAMEINTERVAL ioctl handler code. | 400 | * @g_frame_interval: callback for VIDIOC_SUBDEV_G_FRAME_INTERVAL() |
401 | * ioctl handler code. | ||
366 | * | 402 | * |
367 | * @s_frame_interval: callback for %VIDIOC_S_FRAMEINTERVAL ioctl handler code. | 403 | * @s_frame_interval: callback for VIDIOC_SUBDEV_S_FRAME_INTERVAL() |
404 | * ioctl handler code. | ||
368 | * | 405 | * |
369 | * @s_dv_timings: Set custom dv timings in the sub device. This is used | 406 | * @s_dv_timings: Set custom dv timings in the sub device. This is used |
370 | * when sub device is capable of setting detailed timing information | 407 | * when sub device is capable of setting detailed timing information |
@@ -372,7 +409,7 @@ struct v4l2_mbus_frame_desc { | |||
372 | * | 409 | * |
373 | * @g_dv_timings: Get custom dv timings in the sub device. | 410 | * @g_dv_timings: Get custom dv timings in the sub device. |
374 | * | 411 | * |
375 | * @query_dv_timings: callback for %VIDIOC_QUERY_DV_TIMINGS ioctl handler code. | 412 | * @query_dv_timings: callback for VIDIOC_QUERY_DV_TIMINGS() ioctl handler code. |
376 | * | 413 | * |
377 | * @g_mbus_config: get supported mediabus configurations | 414 | * @g_mbus_config: get supported mediabus configurations |
378 | * | 415 | * |
@@ -443,7 +480,8 @@ struct v4l2_subdev_video_ops { | |||
443 | * member (to determine whether CC data from the first or second field | 480 | * member (to determine whether CC data from the first or second field |
444 | * should be obtained). | 481 | * should be obtained). |
445 | * | 482 | * |
446 | * @g_sliced_vbi_cap: callback for %VIDIOC_SLICED_VBI_CAP ioctl handler code. | 483 | * @g_sliced_vbi_cap: callback for VIDIOC_G_SLICED_VBI_CAP() ioctl handler |
484 | * code. | ||
447 | * | 485 | * |
448 | * @s_raw_fmt: setup the video encoder/decoder for raw VBI. | 486 | * @s_raw_fmt: setup the video encoder/decoder for raw VBI. |
449 | * | 487 | * |
@@ -610,30 +648,30 @@ struct v4l2_subdev_pad_config { | |||
610 | * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations | 648 | * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations |
611 | * | 649 | * |
612 | * @init_cfg: initialize the pad config to default values | 650 | * @init_cfg: initialize the pad config to default values |
613 | * @enum_mbus_code: callback for %VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl handler | 651 | * @enum_mbus_code: callback for VIDIOC_SUBDEV_ENUM_MBUS_CODE() ioctl handler |
614 | * code. | 652 | * code. |
615 | * @enum_frame_size: callback for %VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl handler | 653 | * @enum_frame_size: callback for VIDIOC_SUBDEV_ENUM_FRAME_SIZE() ioctl handler |
616 | * code. | 654 | * code. |
617 | * | 655 | * |
618 | * @enum_frame_interval: callback for %VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL ioctl | 656 | * @enum_frame_interval: callback for VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL() ioctl |
619 | * handler code. | 657 | * handler code. |
620 | * | 658 | * |
621 | * @get_fmt: callback for %VIDIOC_SUBDEV_G_FMT ioctl handler code. | 659 | * @get_fmt: callback for VIDIOC_SUBDEV_G_FMT() ioctl handler code. |
622 | * | 660 | * |
623 | * @set_fmt: callback for %VIDIOC_SUBDEV_S_FMT ioctl handler code. | 661 | * @set_fmt: callback for VIDIOC_SUBDEV_S_FMT() ioctl handler code. |
624 | * | 662 | * |
625 | * @get_selection: callback for %VIDIOC_SUBDEV_G_SELECTION ioctl handler code. | 663 | * @get_selection: callback for VIDIOC_SUBDEV_G_SELECTION() ioctl handler code. |
626 | * | 664 | * |
627 | * @set_selection: callback for %VIDIOC_SUBDEV_S_SELECTION ioctl handler code. | 665 | * @set_selection: callback for VIDIOC_SUBDEV_S_SELECTION() ioctl handler code. |
628 | * | 666 | * |
629 | * @get_edid: callback for %VIDIOC_SUBDEV_G_EDID ioctl handler code. | 667 | * @get_edid: callback for VIDIOC_SUBDEV_G_EDID() ioctl handler code. |
630 | * | 668 | * |
631 | * @set_edid: callback for %VIDIOC_SUBDEV_S_EDID ioctl handler code. | 669 | * @set_edid: callback for VIDIOC_SUBDEV_S_EDID() ioctl handler code. |
632 | * | 670 | * |
633 | * @dv_timings_cap: callback for %VIDIOC_SUBDEV_DV_TIMINGS_CAP ioctl handler | 671 | * @dv_timings_cap: callback for VIDIOC_SUBDEV_DV_TIMINGS_CAP() ioctl handler |
634 | * code. | 672 | * code. |
635 | * | 673 | * |
636 | * @enum_dv_timings: callback for %VIDIOC_SUBDEV_ENUM_DV_TIMINGS ioctl handler | 674 | * @enum_dv_timings: callback for VIDIOC_SUBDEV_ENUM_DV_TIMINGS() ioctl handler |
637 | * code. | 675 | * code. |
638 | * | 676 | * |
639 | * @link_validate: used by the media controller code to check if the links | 677 | * @link_validate: used by the media controller code to check if the links |
@@ -766,7 +804,7 @@ struct v4l2_subdev_platform_data { | |||
766 | * @list: List of sub-devices | 804 | * @list: List of sub-devices |
767 | * @owner: The owner is the same as the driver's &struct device owner. | 805 | * @owner: The owner is the same as the driver's &struct device owner. |
768 | * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev | 806 | * @owner_v4l2_dev: true if the &sd->owner matches the owner of @v4l2_dev->dev |
769 | * ownner. Initialized by v4l2_device_register_subdev(). | 807 | * owner. Initialized by v4l2_device_register_subdev(). |
770 | * @flags: subdev flags. Can be: | 808 | * @flags: subdev flags. Can be: |
771 | * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device; | 809 | * %V4L2_SUBDEV_FL_IS_I2C - Set this flag if this subdev is a i2c device; |
772 | * %V4L2_SUBDEV_FL_IS_SPI - Set this flag if this subdev is a spi device; | 810 | * %V4L2_SUBDEV_FL_IS_SPI - Set this flag if this subdev is a spi device; |