aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 13:22:44 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 13:22:44 -0400
commitc893e7c64e36087dceb4662917976a81d1754fc0 (patch)
tree30e441fe3e13fc8fcf9690bfe5222f404e19daa0 /include
parentec3ed85f926f4e900bc48cec6e72abbe6475321f (diff)
parent2cefabc00ffdc1f22f960df946ae41b163081d5e (diff)
Merge branch 'patches_for_v3.6' into v4l_for_linus
* patches_for_v3.6: (174 commits) v4l: Export v4l2-common.h in include/linux/Kbuild media: Revert "[media] Terratec Cinergy S2 USB HD Rev.2" [media] media: Use pr_info not homegrown pr_reg macro [media] Terratec Cinergy S2 USB HD Rev.2 [media] v4l: Correct conflicting V4L2 subdev selection API documentation [media] Feature removal: V4L2 selections API target and flag definitions [media] v4l: Unify selection flags documentation [media] v4l: Unify selection flags [media] v4l: Common documentation for selection targets [media] v4l: Unify selection targets across V4L2 and V4L2 subdev interfaces [media] v4l: Remove "_ACTUAL" from subdev selection API target definition names [media] V4L: Remove "_ACTIVE" from the selection target name definitions [media] media: dvb-usb: print mac address via native %pM [media] s5p-tv: Use module_i2c_driver in sii9234_drv.c file [media] media: gpio-ir-recv: add allowed_protos for platform data [media] s5p-jpeg: Use module_platform_driver in jpeg-core.c file [media] saa7134: fix spelling of detach in label [media] cx88-blackbird: replace ioctl by unlocked_ioctl [media] cx88: don't use current_norm [media] cx88: fix a number of v4l2-compliance violations ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/i2c.h3
-rw-r--r--include/linux/uvcvideo.h3
-rw-r--r--include/linux/v4l2-common.h71
-rw-r--r--include/linux/v4l2-subdev.h20
-rw-r--r--include/linux/videodev2.h32
-rw-r--r--include/media/adv7393.h28
-rw-r--r--include/media/gpio-ir-recv.h6
-rw-r--r--include/media/mt9t001.h1
-rw-r--r--include/media/v4l2-chip-ident.h3
-rw-r--r--include/media/v4l2-dev.h3
-rw-r--r--include/media/v4l2-ioctl.h25
-rw-r--r--include/media/videobuf-core.h2
-rw-r--r--include/media/videobuf2-core.h54
-rw-r--r--include/media/videobuf2-dma-contig.h6
15 files changed, 192 insertions, 66 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index d38b3a8fb380..ef4cc9429c3a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -382,6 +382,7 @@ header-y += usbdevice_fs.h
382header-y += utime.h 382header-y += utime.h
383header-y += utsname.h 383header-y += utsname.h
384header-y += uvcvideo.h 384header-y += uvcvideo.h
385header-y += v4l2-common.h
385header-y += v4l2-dv-timings.h 386header-y += v4l2-dv-timings.h
386header-y += v4l2-mediabus.h 387header-y += v4l2-mediabus.h
387header-y += v4l2-subdev.h 388header-y += v4l2-subdev.h
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 195d8b3d9cfb..a121c012309a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -68,6 +68,9 @@ extern int i2c_master_recv(const struct i2c_client *client, char *buf,
68 */ 68 */
69extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, 69extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
70 int num); 70 int num);
71/* Unlocked flavor */
72extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
73 int num);
71 74
72/* This is the very generalized SMBus access routine. You probably do not 75/* This is the very generalized SMBus access routine. You probably do not
73 want to use this, though; one of the functions below may be much easier, 76 want to use this, though; one of the functions below may be much easier,
diff --git a/include/linux/uvcvideo.h b/include/linux/uvcvideo.h
index f46a53f060d7..3b081862b9e8 100644
--- a/include/linux/uvcvideo.h
+++ b/include/linux/uvcvideo.h
@@ -58,7 +58,8 @@ struct uvc_xu_control_mapping {
58struct uvc_xu_control_query { 58struct uvc_xu_control_query {
59 __u8 unit; 59 __u8 unit;
60 __u8 selector; 60 __u8 selector;
61 __u8 query; 61 __u8 query; /* Video Class-Specific Request Code, */
62 /* defined in linux/usb/video.h A.8. */
62 __u16 size; 63 __u16 size;
63 __u8 __user *data; 64 __u8 __user *data;
64}; 65};
diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
new file mode 100644
index 000000000000..0fa8b64c3cdb
--- /dev/null
+++ b/include/linux/v4l2-common.h
@@ -0,0 +1,71 @@
1/*
2 * include/linux/v4l2-common.h
3 *
4 * Common V4L2 and V4L2 subdev definitions.
5 *
6 * Users are advised to #include this file either through videodev2.h
7 * (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer
8 * to this file directly.
9 *
10 * Copyright (C) 2012 Nokia Corporation
11 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * version 2 as published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 * 02110-1301 USA
26 *
27 */
28
29#ifndef __V4L2_COMMON__
30#define __V4L2_COMMON__
31
32/*
33 *
34 * Selection interface definitions
35 *
36 */
37
38/* Current cropping area */
39#define V4L2_SEL_TGT_CROP 0x0000
40/* Default cropping area */
41#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
42/* Cropping bounds */
43#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
44/* Current composing area */
45#define V4L2_SEL_TGT_COMPOSE 0x0100
46/* Default composing area */
47#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
48/* Composing bounds */
49#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
50/* Current composing area plus all padding pixels */
51#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
52
53/* Backward compatibility target definitions --- to be removed. */
54#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
55#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
56#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL \
57 V4L2_SEL_TGT_CROP
58#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL \
59 V4L2_SEL_TGT_COMPOSE
60
61/* Selection flags */
62#define V4L2_SEL_FLAG_GE (1 << 0)
63#define V4L2_SEL_FLAG_LE (1 << 1)
64#define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2)
65
66/* Backward compatibility flag definitions --- to be removed. */
67#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE
68#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE
69#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
70
71#endif /* __V4L2_COMMON__ */
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 812019ee1e06..8c57ee9872bb 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/v4l2-common.h>
28#include <linux/v4l2-mediabus.h> 29#include <linux/v4l2-mediabus.h>
29 30
30/** 31/**
@@ -123,27 +124,14 @@ struct v4l2_subdev_frame_interval_enum {
123 __u32 reserved[9]; 124 __u32 reserved[9];
124}; 125};
125 126
126#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE (1 << 0)
127#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1)
128#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2)
129
130/* active cropping area */
131#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL 0x0000
132/* cropping bounds */
133#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002
134/* current composing area */
135#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL 0x0100
136/* composing bounds */
137#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
138
139
140/** 127/**
141 * struct v4l2_subdev_selection - selection info 128 * struct v4l2_subdev_selection - selection info
142 * 129 *
143 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY 130 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
144 * @pad: pad number, as reported by the media API 131 * @pad: pad number, as reported by the media API
145 * @target: selection target, used to choose one of possible rectangles 132 * @target: Selection target, used to choose one of possible rectangles,
146 * @flags: constraint flags 133 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
134 * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
147 * @r: coordinates of the selection window 135 * @r: coordinates of the selection window
148 * @reserved: for future use, set to zero for now 136 * @reserved: for future use, set to zero for now
149 * 137 *
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 2039c5d3292e..5d78910f926c 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -64,6 +64,7 @@
64#include <linux/compiler.h> 64#include <linux/compiler.h>
65#include <linux/ioctl.h> 65#include <linux/ioctl.h>
66#include <linux/types.h> 66#include <linux/types.h>
67#include <linux/v4l2-common.h>
67 68
68/* 69/*
69 * Common stuff for both V4L1 and V4L2 70 * Common stuff for both V4L1 and V4L2
@@ -657,7 +658,7 @@ struct v4l2_buffer {
657 struct v4l2_plane *planes; 658 struct v4l2_plane *planes;
658 } m; 659 } m;
659 __u32 length; 660 __u32 length;
660 __u32 input; 661 __u32 reserved2;
661 __u32 reserved; 662 __u32 reserved;
662}; 663};
663 664
@@ -671,7 +672,6 @@ struct v4l2_buffer {
671/* Buffer is ready, but the data contained within is corrupted. */ 672/* Buffer is ready, but the data contained within is corrupted. */
672#define V4L2_BUF_FLAG_ERROR 0x0040 673#define V4L2_BUF_FLAG_ERROR 0x0040
673#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 674#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
674#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
675#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */ 675#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */
676/* Cache handling flags */ 676/* Cache handling flags */
677#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 677#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
@@ -761,32 +761,12 @@ struct v4l2_crop {
761 struct v4l2_rect c; 761 struct v4l2_rect c;
762}; 762};
763 763
764/* Hints for adjustments of selection rectangle */
765#define V4L2_SEL_FLAG_GE 0x00000001
766#define V4L2_SEL_FLAG_LE 0x00000002
767
768/* Selection targets */
769
770/* Current cropping area */
771#define V4L2_SEL_TGT_CROP_ACTIVE 0x0000
772/* Default cropping area */
773#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
774/* Cropping bounds */
775#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
776/* Current composing area */
777#define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100
778/* Default composing area */
779#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
780/* Composing bounds */
781#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
782/* Current composing area plus all padding pixels */
783#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
784
785/** 764/**
786 * struct v4l2_selection - selection info 765 * struct v4l2_selection - selection info
787 * @type: buffer type (do not use *_MPLANE types) 766 * @type: buffer type (do not use *_MPLANE types)
788 * @target: selection target, used to choose one of possible rectangles 767 * @target: Selection target, used to choose one of possible rectangles;
789 * @flags: constraints flags 768 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
769 * @flags: constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
790 * @r: coordinates of selection window 770 * @r: coordinates of selection window
791 * @reserved: for future use, rounds structure size to 64 bytes, set to zero 771 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
792 * 772 *
@@ -2039,6 +2019,8 @@ struct v4l2_modulator {
2039/* Flags for the 'capability' field */ 2019/* Flags for the 'capability' field */
2040#define V4L2_TUNER_CAP_LOW 0x0001 2020#define V4L2_TUNER_CAP_LOW 0x0001
2041#define V4L2_TUNER_CAP_NORM 0x0002 2021#define V4L2_TUNER_CAP_NORM 0x0002
2022#define V4L2_TUNER_CAP_HWSEEK_BOUNDED 0x0004
2023#define V4L2_TUNER_CAP_HWSEEK_WRAP 0x0008
2042#define V4L2_TUNER_CAP_STEREO 0x0010 2024#define V4L2_TUNER_CAP_STEREO 0x0010
2043#define V4L2_TUNER_CAP_LANG2 0x0020 2025#define V4L2_TUNER_CAP_LANG2 0x0020
2044#define V4L2_TUNER_CAP_SAP 0x0020 2026#define V4L2_TUNER_CAP_SAP 0x0020
diff --git a/include/media/adv7393.h b/include/media/adv7393.h
new file mode 100644
index 000000000000..b28edf351842
--- /dev/null
+++ b/include/media/adv7393.h
@@ -0,0 +1,28 @@
1/*
2 * ADV7393 header file
3 *
4 * Copyright (C) 2010-2012 ADVANSEE - http://www.advansee.com/
5 * Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
6 *
7 * Based on ADV7343 driver,
8 *
9 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation version 2.
14 *
15 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
16 * kind, whether express or implied; without even the implied warranty
17 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 */
20
21#ifndef ADV7393_H
22#define ADV7393_H
23
24#define ADV7393_COMPOSITE_ID (0)
25#define ADV7393_COMPONENT_ID (1)
26#define ADV7393_SVIDEO_ID (2)
27
28#endif /* End of #ifndef ADV7393_H */
diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h
index 67797bf5d432..0142736a59db 100644
--- a/include/media/gpio-ir-recv.h
+++ b/include/media/gpio-ir-recv.h
@@ -14,8 +14,10 @@
14#define __GPIO_IR_RECV_H__ 14#define __GPIO_IR_RECV_H__
15 15
16struct gpio_ir_recv_platform_data { 16struct gpio_ir_recv_platform_data {
17 int gpio_nr; 17 int gpio_nr;
18 bool active_low; 18 bool active_low;
19 u64 allowed_protos;
20 const char *map_name;
19}; 21};
20 22
21#endif /* __GPIO_IR_RECV_H__ */ 23#endif /* __GPIO_IR_RECV_H__ */
diff --git a/include/media/mt9t001.h b/include/media/mt9t001.h
index e839a78bb9c5..03fd63edd133 100644
--- a/include/media/mt9t001.h
+++ b/include/media/mt9t001.h
@@ -3,6 +3,7 @@
3 3
4struct mt9t001_platform_data { 4struct mt9t001_platform_data {
5 unsigned int clk_pol:1; 5 unsigned int clk_pol:1;
6 unsigned int ext_clk;
6}; 7};
7 8
8#endif 9#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 7395c815939d..58f914a40b20 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -180,6 +180,9 @@ enum {
180 /* module adv7343: just ident 7343 */ 180 /* module adv7343: just ident 7343 */
181 V4L2_IDENT_ADV7343 = 7343, 181 V4L2_IDENT_ADV7343 = 7343,
182 182
183 /* module adv7393: just ident 7393 */
184 V4L2_IDENT_ADV7393 = 7393,
185
183 /* module saa7706h: just ident 7706 */ 186 /* module saa7706h: just ident 7706 */
184 V4L2_IDENT_SAA7706H = 7706, 187 V4L2_IDENT_SAA7706H = 7706,
185 188
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index a056e6ee1b68..5c416cdc88d5 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -100,6 +100,9 @@ struct video_device
100 /* Control handler associated with this device node. May be NULL. */ 100 /* Control handler associated with this device node. May be NULL. */
101 struct v4l2_ctrl_handler *ctrl_handler; 101 struct v4l2_ctrl_handler *ctrl_handler;
102 102
103 /* vb2_queue associated with this device node. May be NULL. */
104 struct vb2_queue *queue;
105
103 /* Priority state. If NULL, then v4l2_dev->prio will be used. */ 106 /* Priority state. If NULL, then v4l2_dev->prio will be used. */
104 struct v4l2_prio_state *prio; 107 struct v4l2_prio_state *prio;
105 108
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index d8b76f7392f8..19e93523c2d8 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -295,28 +295,19 @@ struct v4l2_ioctl_ops {
295#define V4L2_DEBUG_IOCTL 0x01 295#define V4L2_DEBUG_IOCTL 0x01
296#define V4L2_DEBUG_IOCTL_ARG 0x02 296#define V4L2_DEBUG_IOCTL_ARG 0x02
297 297
298/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
299#define v4l_print_ioctl(name, cmd) \
300 do { \
301 printk(KERN_DEBUG "%s: ", name); \
302 v4l_printk_ioctl(cmd); \
303 } while (0)
304
305/* Use this macro in I2C drivers where 'client' is the struct i2c_client
306 pointer */
307#define v4l_i2c_print_ioctl(client, cmd) \
308 do { \
309 v4l_client_printk(KERN_DEBUG, client, ""); \
310 v4l_printk_ioctl(cmd); \
311 } while (0)
312
313/* Video standard functions */ 298/* Video standard functions */
314extern const char *v4l2_norm_to_name(v4l2_std_id id); 299extern const char *v4l2_norm_to_name(v4l2_std_id id);
315extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); 300extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
316extern int v4l2_video_std_construct(struct v4l2_standard *vs, 301extern int v4l2_video_std_construct(struct v4l2_standard *vs,
317 int id, const char *name); 302 int id, const char *name);
318/* Prints the ioctl in a human-readable format */ 303/* Prints the ioctl in a human-readable format. If prefix != NULL,
319extern void v4l_printk_ioctl(unsigned int cmd); 304 then do printk(KERN_DEBUG "%s: ", prefix) first. */
305extern void v4l_printk_ioctl(const char *prefix, unsigned int cmd);
306
307/* Internal use only: get the mutex (if any) that we need to lock for the
308 given command. */
309struct video_device;
310extern struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned cmd);
320 311
321/* names for fancy debug output */ 312/* names for fancy debug output */
322extern const char *v4l2_field_names[]; 313extern const char *v4l2_field_names[];
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 90ed895e217d..8c6e825940e5 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -72,7 +72,6 @@ struct videobuf_buffer {
72 unsigned int height; 72 unsigned int height;
73 unsigned int bytesperline; /* use only if != 0 */ 73 unsigned int bytesperline; /* use only if != 0 */
74 unsigned long size; 74 unsigned long size;
75 unsigned int input;
76 enum v4l2_field field; 75 enum v4l2_field field;
77 enum videobuf_state state; 76 enum videobuf_state state;
78 struct list_head stream; /* QBUF/DQBUF list */ 77 struct list_head stream; /* QBUF/DQBUF list */
@@ -142,7 +141,6 @@ struct videobuf_queue {
142 wait_queue_head_t wait; /* wait if queue is empty */ 141 wait_queue_head_t wait; /* wait if queue is empty */
143 142
144 enum v4l2_buf_type type; 143 enum v4l2_buf_type type;
145 unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */
146 unsigned int msize; 144 unsigned int msize;
147 enum v4l2_field field; 145 enum v4l2_field field;
148 enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ 146 enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index a15d1f1b319e..8dd9b6cc296b 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -244,12 +244,23 @@ struct vb2_ops {
244 void (*buf_queue)(struct vb2_buffer *vb); 244 void (*buf_queue)(struct vb2_buffer *vb);
245}; 245};
246 246
247struct v4l2_fh;
248
247/** 249/**
248 * struct vb2_queue - a videobuf queue 250 * struct vb2_queue - a videobuf queue
249 * 251 *
250 * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h 252 * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h
251 * @io_modes: supported io methods (see vb2_io_modes enum) 253 * @io_modes: supported io methods (see vb2_io_modes enum)
252 * @io_flags: additional io flags (see vb2_fileio_flags enum) 254 * @io_flags: additional io flags (see vb2_fileio_flags enum)
255 * @lock: pointer to a mutex that protects the vb2_queue struct. The
256 * driver can set this to a mutex to let the v4l2 core serialize
257 * the queuing ioctls. If the driver wants to handle locking
258 * itself, then this should be set to NULL. This lock is not used
259 * by the videobuf2 core API.
260 * @owner: The filehandle that 'owns' the buffers, i.e. the filehandle
261 * that called reqbufs, create_buffers or started fileio.
262 * This field is not used by the videobuf2 core API, but it allows
263 * drivers to easily associate an owner filehandle with the queue.
253 * @ops: driver-specific callbacks 264 * @ops: driver-specific callbacks
254 * @mem_ops: memory allocator specific callbacks 265 * @mem_ops: memory allocator specific callbacks
255 * @drv_priv: driver private data 266 * @drv_priv: driver private data
@@ -273,6 +284,8 @@ struct vb2_queue {
273 enum v4l2_buf_type type; 284 enum v4l2_buf_type type;
274 unsigned int io_modes; 285 unsigned int io_modes;
275 unsigned int io_flags; 286 unsigned int io_flags;
287 struct mutex *lock;
288 struct v4l2_fh *owner;
276 289
277 const struct vb2_ops *ops; 290 const struct vb2_ops *ops;
278 const struct vb2_mem_ops *mem_ops; 291 const struct vb2_mem_ops *mem_ops;
@@ -404,4 +417,45 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
404 return 0; 417 return 0;
405} 418}
406 419
420/*
421 * The following functions are not part of the vb2 core API, but are simple
422 * helper functions that you can use in your struct v4l2_file_operations,
423 * struct v4l2_ioctl_ops and struct vb2_ops. They will serialize if vb2_queue->lock
424 * or video_device->lock is set, and they will set and test vb2_queue->owner
425 * to check if the calling filehandle is permitted to do the queuing operation.
426 */
427
428/* struct v4l2_ioctl_ops helpers */
429
430int vb2_ioctl_reqbufs(struct file *file, void *priv,
431 struct v4l2_requestbuffers *p);
432int vb2_ioctl_create_bufs(struct file *file, void *priv,
433 struct v4l2_create_buffers *p);
434int vb2_ioctl_prepare_buf(struct file *file, void *priv,
435 struct v4l2_buffer *p);
436int vb2_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *p);
437int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
438int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p);
439int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i);
440int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i);
441
442/* struct v4l2_file_operations helpers */
443
444int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma);
445int vb2_fop_release(struct file *file);
446ssize_t vb2_fop_write(struct file *file, char __user *buf,
447 size_t count, loff_t *ppos);
448ssize_t vb2_fop_read(struct file *file, char __user *buf,
449 size_t count, loff_t *ppos);
450unsigned int vb2_fop_poll(struct file *file, poll_table *wait);
451#ifndef CONFIG_MMU
452unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr,
453 unsigned long len, unsigned long pgoff, unsigned long flags);
454#endif
455
456/* struct vb2_ops helpers, only use if vq->lock is non-NULL. */
457
458void vb2_ops_wait_prepare(struct vb2_queue *vq);
459void vb2_ops_wait_finish(struct vb2_queue *vq);
460
407#endif /* _MEDIA_VIDEOBUF2_CORE_H */ 461#endif /* _MEDIA_VIDEOBUF2_CORE_H */
diff --git a/include/media/videobuf2-dma-contig.h b/include/media/videobuf2-dma-contig.h
index 19ae1e350567..8197f87d6c61 100644
--- a/include/media/videobuf2-dma-contig.h
+++ b/include/media/videobuf2-dma-contig.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * videobuf2-dma-coherent.h - DMA coherent memory allocator for videobuf2 2 * videobuf2-dma-contig.h - DMA contig memory allocator for videobuf2
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics 4 * Copyright (C) 2010 Samsung Electronics
5 * 5 *
@@ -10,8 +10,8 @@
10 * the Free Software Foundation. 10 * the Free Software Foundation.
11 */ 11 */
12 12
13#ifndef _MEDIA_VIDEOBUF2_DMA_COHERENT_H 13#ifndef _MEDIA_VIDEOBUF2_DMA_CONTIG_H
14#define _MEDIA_VIDEOBUF2_DMA_COHERENT_H 14#define _MEDIA_VIDEOBUF2_DMA_CONTIG_H
15 15
16#include <media/videobuf2-core.h> 16#include <media/videobuf2-core.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>