linux/include/linux/v4l2-subdev.h
<<
>>
Prefs
   1/*
   2 * V4L2 subdev userspace API
   3 *
   4 * Copyright (C) 2010 Nokia Corporation
   5 *
   6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
   7 *           Sakari Ailus <sakari.ailus@iki.fi>
   8 *
   9 * This program is free software; you can redistribute it and/or modify
  10 * it under the terms of the GNU General Public License version 2 as
  11 * published by the Free Software Foundation.
  12 *
  13 * This program is distributed in the hope that it will be useful,
  14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16 * GNU General Public License for more details.
  17 *
  18 * You should have received a copy of the GNU General Public License
  19 * along with this program; if not, write to the Free Software
  20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21 */
  22
  23#ifndef __LINUX_V4L2_SUBDEV_H
  24#define __LINUX_V4L2_SUBDEV_H
  25
  26#include <linux/ioctl.h>
  27#include <linux/types.h>
  28#include <linux/v4l2-mediabus.h>
  29
  30/**
  31 * enum v4l2_subdev_format_whence - Media bus format type
  32 * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
  33 * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
  34 */
  35enum v4l2_subdev_format_whence {
  36        V4L2_SUBDEV_FORMAT_TRY = 0,
  37        V4L2_SUBDEV_FORMAT_ACTIVE = 1,
  38};
  39
  40/**
  41 * struct v4l2_subdev_format - Pad-level media bus format
  42 * @which: format type (from enum v4l2_subdev_format_whence)
  43 * @pad: pad number, as reported by the media API
  44 * @format: media bus format (format code and frame size)
  45 */
  46struct v4l2_subdev_format {
  47        __u32 which;
  48        __u32 pad;
  49        struct v4l2_mbus_framefmt format;
  50        __u32 reserved[8];
  51};
  52
  53/**
  54 * struct v4l2_subdev_crop - Pad-level crop settings
  55 * @which: format type (from enum v4l2_subdev_format_whence)
  56 * @pad: pad number, as reported by the media API
  57 * @rect: pad crop rectangle boundaries
  58 */
  59struct v4l2_subdev_crop {
  60        __u32 which;
  61        __u32 pad;
  62        struct v4l2_rect rect;
  63        __u32 reserved[8];
  64};
  65
  66/**
  67 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
  68 * @pad: pad number, as reported by the media API
  69 * @index: format index during enumeration
  70 * @code: format code (from enum v4l2_mbus_pixelcode)
  71 */
  72struct v4l2_subdev_mbus_code_enum {
  73        __u32 pad;
  74        __u32 index;
  75        __u32 code;
  76        __u32 reserved[9];
  77};
  78
  79/**
  80 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
  81 * @pad: pad number, as reported by the media API
  82 * @index: format index during enumeration
  83 * @code: format code (from enum v4l2_mbus_pixelcode)
  84 */
  85struct v4l2_subdev_frame_size_enum {
  86        __u32 index;
  87        __u32 pad;
  88        __u32 code;
  89        __u32 min_width;
  90        __u32 max_width;
  91        __u32 min_height;
  92        __u32 max_height;
  93        __u32 reserved[9];
  94};
  95
  96/**
  97 * struct v4l2_subdev_frame_interval - Pad-level frame rate
  98 * @pad: pad number, as reported by the media API
  99 * @interval: frame interval in seconds
 100 */
 101struct v4l2_subdev_frame_interval {
 102        __u32 pad;
 103        struct v4l2_fract interval;
 104        __u32 reserved[9];
 105};
 106
 107/**
 108 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
 109 * @pad: pad number, as reported by the media API
 110 * @index: frame interval index during enumeration
 111 * @code: format code (from enum v4l2_mbus_pixelcode)
 112 * @width: frame width in pixels
 113 * @height: frame height in pixels
 114 * @interval: frame interval in seconds
 115 */
 116struct v4l2_subdev_frame_interval_enum {
 117        __u32 index;
 118        __u32 pad;
 119        __u32 code;
 120        __u32 width;
 121        __u32 height;
 122        struct v4l2_fract interval;
 123        __u32 reserved[9];
 124};
 125
 126#define VIDIOC_SUBDEV_G_FMT     _IOWR('V',  4, struct v4l2_subdev_format)
 127#define VIDIOC_SUBDEV_S_FMT     _IOWR('V',  5, struct v4l2_subdev_format)
 128#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
 129                        _IOWR('V', 21, struct v4l2_subdev_frame_interval)
 130#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
 131                        _IOWR('V', 22, struct v4l2_subdev_frame_interval)
 132#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
 133                        _IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
 134#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
 135                        _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
 136#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
 137                        _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
 138#define VIDIOC_SUBDEV_G_CROP    _IOWR('V', 59, struct v4l2_subdev_crop)
 139#define VIDIOC_SUBDEV_S_CROP    _IOWR('V', 60, struct v4l2_subdev_crop)
 140
 141#endif
 142