diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:09:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:09:32 -0400 |
commit | c634920abaf9c0a93266a57beff6fce9d3852cb2 (patch) | |
tree | 5ac85f54905a8cd3b12b262c66189084cbff54fc /include | |
parent | 6abd2c860e34add677de50e8b134f5af6f4b0893 (diff) | |
parent | a991f44b79fa49b281eb078eed4a76a42101012a (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (310 commits)
V4L/DVB (6316): Change list_for_each+list_entry to list_for_each_entry
V4L/DVB (6315): pvrusb2: Change list_for_each+list_entry to list_for_each_entry
V4L/DVB (6314): saa7134: Replace list_for_each+list_entry with list_for_each_entry
V4L/DVB (6313): ivtv: Replace list_for_each+list_entry with list_for_each_entry
V4L/DVB (6312): cx88: Replace list_for_each+list_entry with list_for_each_entry
V4L/DVB (6311): dvb: Replace list_for_each+list_entry with list_for_each_entry
V4L/DVB (6308): V4L: zc0301, remove bad usage of ERESTARTSYS
V4L/DVB (6307): V4L: w9968cf, remove bad usage of ERESTARTSYS
V4L/DVB (6306): Few clenups for saa7134 resume code
V4L/DVB (6305): V4L: videobuf-core.c avoid NULL dereferences in videobuf-core
V4L/DVB (6301): pvrusb: Update DEBUGIFC sysfs to kernel 2.6.13+
V4L/DVB (6300): CodingStyle cleanup
V4L/DVB (6299): dvb: Add dependencies for VIDEOBUF_DVB
V4L/DVB (6297): cx23885: remove wrong Kconfig selection of VIDEOBUF
V4L/DVB (6296): dib0700: add support for AverMedia DVB-T Express card
V4L/DVB (6295): saa7134: add autodetection for KWorld ATSC-115
V4L/DVB (6293): V4L: convert struct class_device to struct device
V4L/DVB (6292): videobuf_core init always require callback implementation
V4L/DVB (6291): Fix: avoid oops on some SMP machines
V4L/DVB (6290): remove videobuf_set_pci_ops
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/i2c-id.h | 2 | ||||
-rw-r--r-- | include/linux/ivtv.h (renamed from include/media/ivtv.h) | 11 | ||||
-rw-r--r-- | include/linux/ivtvfb.h | 42 | ||||
-rw-r--r-- | include/linux/videodev2.h | 7 | ||||
-rw-r--r-- | include/media/cx2341x.h | 2 | ||||
-rw-r--r-- | include/media/ir-common.h | 1 | ||||
-rw-r--r-- | include/media/saa7146.h | 1 | ||||
-rw-r--r-- | include/media/saa7146_vv.h | 2 | ||||
-rw-r--r-- | include/media/tuner-types.h | 4 | ||||
-rw-r--r-- | include/media/tuner.h | 1 | ||||
-rw-r--r-- | include/media/v4l2-chip-ident.h | 3 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 16 | ||||
-rw-r--r-- | include/media/v4l2-int-device.h | 278 | ||||
-rw-r--r-- | include/media/videobuf-core.h (renamed from include/media/video-buf.h) | 181 | ||||
-rw-r--r-- | include/media/videobuf-dma-sg.h | 122 | ||||
-rw-r--r-- | include/media/videobuf-dvb.h (renamed from include/media/video-buf-dvb.h) | 0 | ||||
-rw-r--r-- | include/media/videobuf-vmalloc.h | 41 |
17 files changed, 583 insertions, 131 deletions
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index b69014865714..a271b67a8e2d 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -119,6 +119,7 @@ | |||
119 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ | 119 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ |
120 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ | 120 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ |
121 | #define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ | 121 | #define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ |
122 | #define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ | ||
122 | 123 | ||
123 | #define I2C_DRIVERID_I2CDEV 900 | 124 | #define I2C_DRIVERID_I2CDEV 900 |
124 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ | 125 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ |
@@ -196,6 +197,7 @@ | |||
196 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ | 197 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ |
197 | #define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ | 198 | #define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ |
198 | #define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */ | 199 | #define I2C_HW_B_INTELFB 0x010021 /* intel framebuffer driver */ |
200 | #define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ | ||
199 | 201 | ||
200 | /* --- PCF 8584 based algorithms */ | 202 | /* --- PCF 8584 based algorithms */ |
201 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ | 203 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ |
diff --git a/include/media/ivtv.h b/include/linux/ivtv.h index 412b48ea8eda..794b8daa9378 100644 --- a/include/media/ivtv.h +++ b/include/linux/ivtv.h | |||
@@ -18,8 +18,15 @@ | |||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _LINUX_IVTV_H | 21 | #ifndef __LINUX_IVTV_H__ |
22 | #define _LINUX_IVTV_H | 22 | #define __LINUX_IVTV_H__ |
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | #include <linux/compiler.h> /* need __user */ | ||
26 | #else | ||
27 | #define __user | ||
28 | #endif | ||
29 | #include <linux/types.h> | ||
23 | 30 | ||
24 | /* ivtv knows several distinct output modes: MPEG streaming, | 31 | /* ivtv knows several distinct output modes: MPEG streaming, |
25 | YUV streaming, YUV updates through user DMA and the passthrough | 32 | YUV streaming, YUV updates through user DMA and the passthrough |
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h new file mode 100644 index 000000000000..e980ba62ddcc --- /dev/null +++ b/include/linux/ivtvfb.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | On Screen Display cx23415 Framebuffer driver | ||
3 | |||
4 | Copyright (C) 2006, 2007 Ian Armstrong <ian@iarmst.demon.co.uk> | ||
5 | |||
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. | ||
10 | |||
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. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_IVTVFB_H__ | ||
22 | #define __LINUX_IVTVFB_H__ | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | #include <linux/compiler.h> /* need __user */ | ||
26 | #else | ||
27 | #define __user | ||
28 | #endif | ||
29 | #include <linux/types.h> | ||
30 | |||
31 | /* Framebuffer external API */ | ||
32 | |||
33 | struct ivtvfb_dma_frame { | ||
34 | void __user *source; | ||
35 | unsigned long dest_offset; | ||
36 | int count; | ||
37 | }; | ||
38 | |||
39 | #define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) | ||
40 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t) | ||
41 | |||
42 | #endif | ||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index ae9b24c12f6a..1f503e94eff1 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -271,6 +271,7 @@ struct v4l2_pix_format | |||
271 | 271 | ||
272 | /* Pixel format FOURCC depth Description */ | 272 | /* Pixel format FOURCC depth Description */ |
273 | #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ | 273 | #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ |
274 | #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ | ||
274 | #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ | 275 | #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ |
275 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ | 276 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ |
276 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ | 277 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ |
@@ -280,6 +281,7 @@ struct v4l2_pix_format | |||
280 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ | 281 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ |
281 | #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ | 282 | #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ |
282 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ | 283 | #define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ |
284 | #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */ | ||
283 | #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ | 285 | #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ |
284 | #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ | 286 | #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ |
285 | #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ | 287 | #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ |
@@ -287,6 +289,10 @@ struct v4l2_pix_format | |||
287 | #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ | 289 | #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ |
288 | #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ | 290 | #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ |
289 | #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ | 291 | #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ |
292 | #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y','4','4','4') /* 16 xxxxyyyy uuuuvvvv */ | ||
293 | #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y','U','V','O') /* 16 YUV-5-5-5 */ | ||
294 | #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y','U','V','P') /* 16 YUV-5-6-5 */ | ||
295 | #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y','U','V','4') /* 32 YUV-8-8-8-8 */ | ||
290 | 296 | ||
291 | /* two planes -- one Y, one Cr + Cb interleaved */ | 297 | /* two planes -- one Y, one Cr + Cb interleaved */ |
292 | #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ | 298 | #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ |
@@ -298,7 +304,6 @@ struct v4l2_pix_format | |||
298 | #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ | 304 | #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ |
299 | #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ | 305 | #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ |
300 | #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ | 306 | #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ |
301 | #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ | ||
302 | 307 | ||
303 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ | 308 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ |
304 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ | 309 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ |
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h index 38c12fed7535..af8071d7620d 100644 --- a/include/media/cx2341x.h +++ b/include/media/cx2341x.h | |||
@@ -91,7 +91,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, | |||
91 | int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | 91 | int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, |
92 | struct v4l2_queryctrl *qctrl); | 92 | struct v4l2_queryctrl *qctrl); |
93 | const char **cx2341x_ctrl_get_menu(u32 id); | 93 | const char **cx2341x_ctrl_get_menu(u32 id); |
94 | int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, | 94 | int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, |
95 | struct v4l2_ext_controls *ctrls, unsigned int cmd); | 95 | struct v4l2_ext_controls *ctrls, unsigned int cmd); |
96 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); | 96 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); |
97 | void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix); | 97 | void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix); |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 9807a7c15830..7a785fa77212 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -140,6 +140,7 @@ extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE]; | |||
140 | extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE]; | 140 | extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE]; |
141 | extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; | 141 | extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; |
142 | extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; | 142 | extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; |
143 | extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; | ||
143 | 144 | ||
144 | #endif | 145 | #endif |
145 | 146 | ||
diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 67703249b245..cd3ff2c29d5e 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h | |||
@@ -146,7 +146,6 @@ struct saa7146_dev | |||
146 | 146 | ||
147 | /* from saa7146_i2c.c */ | 147 | /* from saa7146_i2c.c */ |
148 | int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); | 148 | int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); |
149 | int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg *msgs, int num, int retries); | ||
150 | 149 | ||
151 | /* from saa7146_core.c */ | 150 | /* from saa7146_core.c */ |
152 | extern struct list_head saa7146_devices; | 151 | extern struct list_head saa7146_devices; |
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index cce20ed5cf6c..e49f7e156061 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/videodev.h> | 4 | #include <linux/videodev.h> |
5 | #include <media/v4l2-common.h> | 5 | #include <media/v4l2-common.h> |
6 | #include <media/saa7146.h> | 6 | #include <media/saa7146.h> |
7 | #include <media/video-buf.h> | 7 | #include <media/videobuf-dma-sg.h> |
8 | 8 | ||
9 | #define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */ | 9 | #define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */ |
10 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ | 10 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ |
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index e5ad3fcfe984..b201371416a0 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h | |||
@@ -79,6 +79,10 @@ struct tuner_params { | |||
79 | /* Select 18% (or according to datasheet 0%) L standard PLL gating, | 79 | /* Select 18% (or according to datasheet 0%) L standard PLL gating, |
80 | vs the driver default of 36%. */ | 80 | vs the driver default of 36%. */ |
81 | unsigned int default_pll_gating_18:1; | 81 | unsigned int default_pll_gating_18:1; |
82 | /* IF to use in radio mode. Tuners with a separate radio IF filter | ||
83 | seem to use 10.7, while those without use 33.3 for PAL/SECAM tuners | ||
84 | and 41.3 for NTSC tuners. 0 = 10.7, 1 = 33.3, 2 = 41.3 */ | ||
85 | unsigned int radio_if:2; | ||
82 | /* Default tda9887 TOP value in dB for the low band. Default is 0. | 86 | /* Default tda9887 TOP value in dB for the low band. Default is 0. |
83 | Range: -16:+15 */ | 87 | Range: -16:+15 */ |
84 | signed int default_top_low:5; | 88 | signed int default_top_low:5; |
diff --git a/include/media/tuner.h b/include/media/tuner.h index 160381c72e4b..c03dceb92605 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -146,6 +146,7 @@ extern int tuner_debug; | |||
146 | #define TDA9887_AUTOMUTE (1<<18) | 146 | #define TDA9887_AUTOMUTE (1<<18) |
147 | #define TDA9887_GATING_18 (1<<19) | 147 | #define TDA9887_GATING_18 (1<<19) |
148 | #define TDA9887_GAIN_NORMAL (1<<20) | 148 | #define TDA9887_GAIN_NORMAL (1<<20) |
149 | #define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */ | ||
149 | 150 | ||
150 | #ifdef __KERNEL__ | 151 | #ifdef __KERNEL__ |
151 | 152 | ||
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 09d16c4f00f7..8ae42c41dd08 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -65,6 +65,9 @@ enum { | |||
65 | V4L2_IDENT_CX23415 = 415, | 65 | V4L2_IDENT_CX23415 = 415, |
66 | V4L2_IDENT_CX23416 = 416, | 66 | V4L2_IDENT_CX23416 = 416, |
67 | 67 | ||
68 | /* module vp27smpx: just ident 2700 */ | ||
69 | V4L2_IDENT_VP27SMPX = 2700, | ||
70 | |||
68 | /* module wm8739: just ident 8739 */ | 71 | /* module wm8739: just ident 8739 */ |
69 | V4L2_IDENT_WM8739 = 8739, | 72 | V4L2_IDENT_WM8739 = 8739, |
70 | 73 | ||
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 17f8f3a2f0a3..e75d5e6c4cea 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/videodev2.h> | 23 | #include <linux/videodev2.h> |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #include <linux/fs.h> | ||
27 | |||
28 | #define VIDEO_MAJOR 81 | 26 | #define VIDEO_MAJOR 81 |
29 | /* Minor device allocation */ | 27 | /* Minor device allocation */ |
30 | #define MINOR_VFL_TYPE_GRABBER_MIN 0 | 28 | #define MINOR_VFL_TYPE_GRABBER_MIN 0 |
@@ -88,8 +86,11 @@ struct video_device | |||
88 | /* device ops */ | 86 | /* device ops */ |
89 | const struct file_operations *fops; | 87 | const struct file_operations *fops; |
90 | 88 | ||
89 | /* sysfs */ | ||
90 | struct device class_dev; /* v4l device */ | ||
91 | struct device *dev; /* device parent */ | ||
92 | |||
91 | /* device info */ | 93 | /* device info */ |
92 | struct device *dev; | ||
93 | char name[32]; | 94 | char name[32]; |
94 | int type; /* v4l1 */ | 95 | int type; /* v4l1 */ |
95 | int type2; /* v4l2 */ | 96 | int type2; /* v4l2 */ |
@@ -334,7 +335,6 @@ void *priv; | |||
334 | /* for videodev.c intenal usage -- please don't touch */ | 335 | /* for videodev.c intenal usage -- please don't touch */ |
335 | int users; /* video_exclusive_{open|close} ... */ | 336 | int users; /* video_exclusive_{open|close} ... */ |
336 | struct mutex lock; /* ... helper function uses these */ | 337 | struct mutex lock; /* ... helper function uses these */ |
337 | struct class_device class_dev; /* sysfs */ | ||
338 | }; | 338 | }; |
339 | 339 | ||
340 | /* Class-dev to video-device */ | 340 | /* Class-dev to video-device */ |
@@ -362,18 +362,18 @@ extern int video_usercopy(struct inode *inode, struct file *file, | |||
362 | 362 | ||
363 | static inline int __must_check | 363 | static inline int __must_check |
364 | video_device_create_file(struct video_device *vfd, | 364 | video_device_create_file(struct video_device *vfd, |
365 | struct class_device_attribute *attr) | 365 | struct device_attribute *attr) |
366 | { | 366 | { |
367 | int ret = class_device_create_file(&vfd->class_dev, attr); | 367 | int ret = device_create_file(&vfd->class_dev, attr); |
368 | if (ret < 0) | 368 | if (ret < 0) |
369 | printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret); | 369 | printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret); |
370 | return ret; | 370 | return ret; |
371 | } | 371 | } |
372 | static inline void | 372 | static inline void |
373 | video_device_remove_file(struct video_device *vfd, | 373 | video_device_remove_file(struct video_device *vfd, |
374 | struct class_device_attribute *attr) | 374 | struct device_attribute *attr) |
375 | { | 375 | { |
376 | class_device_remove_file(&vfd->class_dev, attr); | 376 | device_remove_file(&vfd->class_dev, attr); |
377 | } | 377 | } |
378 | 378 | ||
379 | #endif /* CONFIG_VIDEO_V4L1_COMPAT */ | 379 | #endif /* CONFIG_VIDEO_V4L1_COMPAT */ |
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h new file mode 100644 index 000000000000..066ebfc4f983 --- /dev/null +++ b/include/media/v4l2-int-device.h | |||
@@ -0,0 +1,278 @@ | |||
1 | /* | ||
2 | * include/media/v4l2-int-device.h | ||
3 | * | ||
4 | * V4L2 internal ioctl interface. | ||
5 | * | ||
6 | * Copyright (C) 2007 Nokia Corporation. | ||
7 | * | ||
8 | * Contact: Sakari Ailus <sakari.ailus@nokia.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * version 2 as published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
22 | * 02110-1301 USA | ||
23 | */ | ||
24 | |||
25 | #ifndef V4L2_INT_DEVICE_H | ||
26 | #define V4L2_INT_DEVICE_H | ||
27 | |||
28 | #include <linux/module.h> | ||
29 | #include <media/v4l2-common.h> | ||
30 | |||
31 | #define V4L2NAMESIZE 32 | ||
32 | |||
33 | /* | ||
34 | * | ||
35 | * The internal V4L2 device interface core. | ||
36 | * | ||
37 | */ | ||
38 | |||
39 | enum v4l2_int_type { | ||
40 | v4l2_int_type_master = 1, | ||
41 | v4l2_int_type_slave | ||
42 | }; | ||
43 | |||
44 | struct v4l2_int_device; | ||
45 | |||
46 | struct v4l2_int_master { | ||
47 | int (*attach)(struct v4l2_int_device *master, | ||
48 | struct v4l2_int_device *slave); | ||
49 | void (*detach)(struct v4l2_int_device *master); | ||
50 | }; | ||
51 | |||
52 | typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *); | ||
53 | typedef int (v4l2_int_ioctl_func_0)(struct v4l2_int_device *); | ||
54 | typedef int (v4l2_int_ioctl_func_1)(struct v4l2_int_device *, void *); | ||
55 | |||
56 | struct v4l2_int_ioctl_desc { | ||
57 | int num; | ||
58 | v4l2_int_ioctl_func *func; | ||
59 | }; | ||
60 | |||
61 | struct v4l2_int_slave { | ||
62 | /* Don't touch master. */ | ||
63 | struct v4l2_int_device *master; | ||
64 | |||
65 | char attach_to[V4L2NAMESIZE]; | ||
66 | |||
67 | int num_ioctls; | ||
68 | struct v4l2_int_ioctl_desc *ioctls; | ||
69 | }; | ||
70 | |||
71 | struct v4l2_int_device { | ||
72 | /* Don't touch head. */ | ||
73 | struct list_head head; | ||
74 | |||
75 | struct module *module; | ||
76 | |||
77 | char name[V4L2NAMESIZE]; | ||
78 | |||
79 | enum v4l2_int_type type; | ||
80 | union { | ||
81 | struct v4l2_int_master *master; | ||
82 | struct v4l2_int_slave *slave; | ||
83 | } u; | ||
84 | |||
85 | void *priv; | ||
86 | }; | ||
87 | |||
88 | int v4l2_int_device_register(struct v4l2_int_device *d); | ||
89 | void v4l2_int_device_unregister(struct v4l2_int_device *d); | ||
90 | |||
91 | int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd); | ||
92 | int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg); | ||
93 | |||
94 | /* | ||
95 | * | ||
96 | * Types and definitions for IOCTL commands. | ||
97 | * | ||
98 | */ | ||
99 | |||
100 | /* Slave interface type. */ | ||
101 | enum v4l2_if_type { | ||
102 | /* | ||
103 | * Parallel 8-, 10- or 12-bit interface, used by for example | ||
104 | * on certain image sensors. | ||
105 | */ | ||
106 | V4L2_IF_TYPE_BT656, | ||
107 | }; | ||
108 | |||
109 | enum v4l2_if_type_bt656_mode { | ||
110 | /* | ||
111 | * Modes without Bt synchronisation codes. Separate | ||
112 | * synchronisation signal lines are used. | ||
113 | */ | ||
114 | V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT, | ||
115 | V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT, | ||
116 | V4L2_IF_TYPE_BT656_MODE_NOBT_12BIT, | ||
117 | /* | ||
118 | * Use Bt synchronisation codes. The vertical and horizontal | ||
119 | * synchronisation is done based on synchronisation codes. | ||
120 | */ | ||
121 | V4L2_IF_TYPE_BT656_MODE_BT_8BIT, | ||
122 | V4L2_IF_TYPE_BT656_MODE_BT_10BIT, | ||
123 | }; | ||
124 | |||
125 | struct v4l2_if_type_bt656 { | ||
126 | /* | ||
127 | * 0: Frame begins when vsync is high. | ||
128 | * 1: Frame begins when vsync changes from low to high. | ||
129 | */ | ||
130 | unsigned frame_start_on_rising_vs:1; | ||
131 | /* Use Bt synchronisation codes for sync correction. */ | ||
132 | unsigned bt_sync_correct:1; | ||
133 | /* Swap every two adjacent image data elements. */ | ||
134 | unsigned swap:1; | ||
135 | /* Inverted latch clock polarity from slave. */ | ||
136 | unsigned latch_clk_inv:1; | ||
137 | /* Hs polarity. 0 is active high, 1 active low. */ | ||
138 | unsigned nobt_hs_inv:1; | ||
139 | /* Vs polarity. 0 is active high, 1 active low. */ | ||
140 | unsigned nobt_vs_inv:1; | ||
141 | enum v4l2_if_type_bt656_mode mode; | ||
142 | /* Minimum accepted bus clock for slave (in Hz). */ | ||
143 | u32 clock_min; | ||
144 | /* Maximum accepted bus clock for slave. */ | ||
145 | u32 clock_max; | ||
146 | /* | ||
147 | * Current wish of the slave. May only change in response to | ||
148 | * ioctls that affect image capture. | ||
149 | */ | ||
150 | u32 clock_curr; | ||
151 | }; | ||
152 | |||
153 | struct v4l2_ifparm { | ||
154 | enum v4l2_if_type if_type; | ||
155 | union { | ||
156 | struct v4l2_if_type_bt656 bt656; | ||
157 | } u; | ||
158 | }; | ||
159 | |||
160 | /* IOCTL command numbers. */ | ||
161 | enum v4l2_int_ioctl_num { | ||
162 | /* | ||
163 | * | ||
164 | * "Proper" V4L ioctls, as in struct video_device. | ||
165 | * | ||
166 | */ | ||
167 | vidioc_int_enum_fmt_cap_num = 1, | ||
168 | vidioc_int_g_fmt_cap_num, | ||
169 | vidioc_int_s_fmt_cap_num, | ||
170 | vidioc_int_try_fmt_cap_num, | ||
171 | vidioc_int_queryctrl_num, | ||
172 | vidioc_int_g_ctrl_num, | ||
173 | vidioc_int_s_ctrl_num, | ||
174 | vidioc_int_g_parm_num, | ||
175 | vidioc_int_s_parm_num, | ||
176 | |||
177 | /* | ||
178 | * | ||
179 | * Strictly internal ioctls. | ||
180 | * | ||
181 | */ | ||
182 | /* Initialise the device when slave attaches to the master. */ | ||
183 | vidioc_int_dev_init_num = 1000, | ||
184 | /* Delinitialise the device at slave detach. */ | ||
185 | vidioc_int_dev_exit_num, | ||
186 | /* Set device power state: 0 is off, non-zero is on. */ | ||
187 | vidioc_int_s_power_num, | ||
188 | /* Get slave interface parameters. */ | ||
189 | vidioc_int_g_ifparm_num, | ||
190 | /* Does the slave need to be reset after VIDIOC_DQBUF? */ | ||
191 | vidioc_int_g_needs_reset_num, | ||
192 | |||
193 | /* | ||
194 | * | ||
195 | * VIDIOC_INT_* ioctls. | ||
196 | * | ||
197 | */ | ||
198 | /* VIDIOC_INT_RESET */ | ||
199 | vidioc_int_reset_num, | ||
200 | /* VIDIOC_INT_INIT */ | ||
201 | vidioc_int_init_num, | ||
202 | /* VIDIOC_INT_G_CHIP_IDENT */ | ||
203 | vidioc_int_g_chip_ident_num, | ||
204 | |||
205 | /* | ||
206 | * | ||
207 | * Start of private ioctls. | ||
208 | * | ||
209 | */ | ||
210 | vidioc_int_priv_start_num = 2000, | ||
211 | }; | ||
212 | |||
213 | /* | ||
214 | * | ||
215 | * IOCTL wrapper functions for better type checking. | ||
216 | * | ||
217 | */ | ||
218 | |||
219 | #define V4L2_INT_WRAPPER_0(name) \ | ||
220 | static inline int vidioc_int_##name(struct v4l2_int_device *d) \ | ||
221 | { \ | ||
222 | return v4l2_int_ioctl_0(d, vidioc_int_##name##_num); \ | ||
223 | } \ | ||
224 | \ | ||
225 | static inline struct v4l2_int_ioctl_desc \ | ||
226 | vidioc_int_##name##_cb(int (*func) \ | ||
227 | (struct v4l2_int_device *)) \ | ||
228 | { \ | ||
229 | struct v4l2_int_ioctl_desc desc; \ | ||
230 | \ | ||
231 | desc.num = vidioc_int_##name##_num; \ | ||
232 | desc.func = (v4l2_int_ioctl_func *)func; \ | ||
233 | \ | ||
234 | return desc; \ | ||
235 | } | ||
236 | |||
237 | #define V4L2_INT_WRAPPER_1(name, arg_type, asterisk) \ | ||
238 | static inline int vidioc_int_##name(struct v4l2_int_device *d, \ | ||
239 | arg_type asterisk arg) \ | ||
240 | { \ | ||
241 | return v4l2_int_ioctl_1(d, vidioc_int_##name##_num, \ | ||
242 | (void *)(unsigned long)arg); \ | ||
243 | } \ | ||
244 | \ | ||
245 | static inline struct v4l2_int_ioctl_desc \ | ||
246 | vidioc_int_##name##_cb(int (*func) \ | ||
247 | (struct v4l2_int_device *, \ | ||
248 | arg_type asterisk)) \ | ||
249 | { \ | ||
250 | struct v4l2_int_ioctl_desc desc; \ | ||
251 | \ | ||
252 | desc.num = vidioc_int_##name##_num; \ | ||
253 | desc.func = (v4l2_int_ioctl_func *)func; \ | ||
254 | \ | ||
255 | return desc; \ | ||
256 | } | ||
257 | |||
258 | V4L2_INT_WRAPPER_1(enum_fmt_cap, struct v4l2_fmtdesc, *); | ||
259 | V4L2_INT_WRAPPER_1(g_fmt_cap, struct v4l2_format, *); | ||
260 | V4L2_INT_WRAPPER_1(s_fmt_cap, struct v4l2_format, *); | ||
261 | V4L2_INT_WRAPPER_1(try_fmt_cap, struct v4l2_format, *); | ||
262 | V4L2_INT_WRAPPER_1(queryctrl, struct v4l2_queryctrl, *); | ||
263 | V4L2_INT_WRAPPER_1(g_ctrl, struct v4l2_control, *); | ||
264 | V4L2_INT_WRAPPER_1(s_ctrl, struct v4l2_control, *); | ||
265 | V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *); | ||
266 | V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *); | ||
267 | |||
268 | V4L2_INT_WRAPPER_0(dev_init); | ||
269 | V4L2_INT_WRAPPER_0(dev_exit); | ||
270 | V4L2_INT_WRAPPER_1(s_power, int, ); | ||
271 | V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *); | ||
272 | V4L2_INT_WRAPPER_1(g_needs_reset, void, *); | ||
273 | |||
274 | V4L2_INT_WRAPPER_0(reset); | ||
275 | V4L2_INT_WRAPPER_0(init); | ||
276 | V4L2_INT_WRAPPER_1(g_chip_ident, int, *); | ||
277 | |||
278 | #endif | ||
diff --git a/include/media/video-buf.h b/include/media/videobuf-core.h index d6f079476db3..9fa09fb800a1 100644 --- a/include/media/video-buf.h +++ b/include/media/videobuf-core.h | |||
@@ -1,48 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * generic helper functions for handling video4linux capture buffers | ||
2 | * | 3 | * |
3 | * generic helper functions for video4linux capture buffers, to handle | 4 | * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> |
4 | * memory management and PCI DMA. | ||
5 | * Right now, bttv, saa7134, saa7146 and cx88 use it. | ||
6 | * | ||
7 | * The functions expect the hardware being able to scatter gatter | ||
8 | * (i.e. the buffers are not linear in physical memory, but fragmented | ||
9 | * into PAGE_SIZE chunks). They also assume the driver does not need | ||
10 | * to touch the video data. | ||
11 | * | ||
12 | * device specific map/unmap/sync stuff now are mapped as file operations | ||
13 | * to allow its usage by USB and virtual devices. | ||
14 | * | 5 | * |
6 | * Highly based on video-buf written originally by: | ||
15 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> | 7 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> |
16 | * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> | 8 | * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> |
17 | * (c) 2006 Ted Walther and John Sokol | 9 | * (c) 2006 Ted Walther and John Sokol |
18 | * | 10 | * |
19 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
20 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
21 | * the Free Software Foundation; either version 2 of the License, or | 13 | * the Free Software Foundation; either version 2 |
22 | * (at your option) any later version. | ||
23 | */ | 14 | */ |
24 | 15 | ||
25 | #include <linux/videodev2.h> | ||
26 | #include <linux/poll.h> | 16 | #include <linux/poll.h> |
17 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
18 | #include <linux/videodev.h> | ||
19 | #endif | ||
20 | #include <linux/videodev2.h> | ||
27 | 21 | ||
28 | #define UNSET (-1U) | 22 | #define UNSET (-1U) |
29 | 23 | ||
30 | /* --------------------------------------------------------------------- */ | ||
31 | |||
32 | /* | ||
33 | * Return a scatterlist for some page-aligned vmalloc()'ed memory | ||
34 | * block (NULL on errors). Memory for the scatterlist is allocated | ||
35 | * using kmalloc. The caller must free the memory. | ||
36 | */ | ||
37 | struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); | ||
38 | |||
39 | /* | ||
40 | * Return a scatterlist for a an array of userpages (NULL on errors). | ||
41 | * Memory for the scatterlist is allocated using kmalloc. The caller | ||
42 | * must free the memory. | ||
43 | */ | ||
44 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | ||
45 | int offset); | ||
46 | 24 | ||
47 | struct videobuf_buffer; | 25 | struct videobuf_buffer; |
48 | struct videobuf_queue; | 26 | struct videobuf_queue; |
@@ -50,69 +28,6 @@ struct videobuf_queue; | |||
50 | /* --------------------------------------------------------------------- */ | 28 | /* --------------------------------------------------------------------- */ |
51 | 29 | ||
52 | /* | 30 | /* |
53 | * A small set of helper functions to manage buffers (both userland | ||
54 | * and kernel) for DMA. | ||
55 | * | ||
56 | * videobuf_dma_init_*() | ||
57 | * creates a buffer. The userland version takes a userspace | ||
58 | * pointer + length. The kernel version just wants the size and | ||
59 | * does memory allocation too using vmalloc_32(). | ||
60 | * | ||
61 | * videobuf_dma_*() | ||
62 | * see Documentation/DMA-mapping.txt, these functions to | ||
63 | * basically the same. The map function does also build a | ||
64 | * scatterlist for the buffer (and unmap frees it ...) | ||
65 | * | ||
66 | * videobuf_dma_free() | ||
67 | * no comment ... | ||
68 | * | ||
69 | */ | ||
70 | |||
71 | struct videobuf_dmabuf { | ||
72 | u32 magic; | ||
73 | |||
74 | /* for userland buffer */ | ||
75 | int offset; | ||
76 | struct page **pages; | ||
77 | |||
78 | /* for kernel buffers */ | ||
79 | void *vmalloc; | ||
80 | |||
81 | /* Stores the userspace pointer to vmalloc area */ | ||
82 | void *varea; | ||
83 | |||
84 | /* for overlay buffers (pci-pci dma) */ | ||
85 | dma_addr_t bus_addr; | ||
86 | |||
87 | /* common */ | ||
88 | struct scatterlist *sglist; | ||
89 | int sglen; | ||
90 | int nr_pages; | ||
91 | int direction; | ||
92 | }; | ||
93 | |||
94 | void videobuf_dma_init(struct videobuf_dmabuf *dma); | ||
95 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, | ||
96 | unsigned long data, unsigned long size); | ||
97 | int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | ||
98 | int nr_pages); | ||
99 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | ||
100 | dma_addr_t addr, int nr_pages); | ||
101 | int videobuf_dma_free(struct videobuf_dmabuf *dma); | ||
102 | |||
103 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
104 | int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
105 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
106 | |||
107 | /*FIXME: these variants are used only on *-alsa code, where videobuf is | ||
108 | * used without queue | ||
109 | */ | ||
110 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
111 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
112 | |||
113 | /* --------------------------------------------------------------------- */ | ||
114 | |||
115 | /* | ||
116 | * A small set of helper functions to manage video4linux buffers. | 31 | * A small set of helper functions to manage video4linux buffers. |
117 | * | 32 | * |
118 | * struct videobuf_buffer holds the data structures used by the helper | 33 | * struct videobuf_buffer holds the data structures used by the helper |
@@ -162,26 +77,33 @@ struct videobuf_buffer { | |||
162 | unsigned int input; | 77 | unsigned int input; |
163 | enum v4l2_field field; | 78 | enum v4l2_field field; |
164 | enum videobuf_state state; | 79 | enum videobuf_state state; |
165 | struct videobuf_dmabuf dma; | ||
166 | struct list_head stream; /* QBUF/DQBUF list */ | 80 | struct list_head stream; /* QBUF/DQBUF list */ |
167 | 81 | ||
168 | /* for mmap'ed buffers */ | ||
169 | enum v4l2_memory memory; | ||
170 | size_t boff; /* buffer offset (mmap + overlay) */ | ||
171 | size_t bsize; /* buffer size */ | ||
172 | unsigned long baddr; /* buffer addr (userland ptr!) */ | ||
173 | struct videobuf_mapping *map; | ||
174 | |||
175 | /* touched by irq handler */ | 82 | /* touched by irq handler */ |
176 | struct list_head queue; | 83 | struct list_head queue; |
177 | wait_queue_head_t done; | 84 | wait_queue_head_t done; |
178 | unsigned int field_count; | 85 | unsigned int field_count; |
179 | struct timeval ts; | 86 | struct timeval ts; |
180 | }; | ||
181 | 87 | ||
182 | typedef int (vb_map_sg_t)(void *dev,struct scatterlist *sglist,int nr_pages, | 88 | /* Memory type */ |
183 | int direction); | 89 | enum v4l2_memory memory; |
90 | |||
91 | /* buffer size */ | ||
92 | size_t bsize; | ||
93 | |||
94 | /* buffer offset (mmap + overlay) */ | ||
95 | size_t boff; | ||
184 | 96 | ||
97 | /* buffer addr (userland ptr!) */ | ||
98 | unsigned long baddr; | ||
99 | |||
100 | /* for mmap'ed buffers */ | ||
101 | struct videobuf_mapping *map; | ||
102 | |||
103 | /* Private pointer to allow specific methods to store their data */ | ||
104 | int privsize; | ||
105 | void *priv; | ||
106 | }; | ||
185 | 107 | ||
186 | struct videobuf_queue_ops { | 108 | struct videobuf_queue_ops { |
187 | int (*buf_setup)(struct videobuf_queue *q, | 109 | int (*buf_setup)(struct videobuf_queue *q, |
@@ -193,14 +115,37 @@ struct videobuf_queue_ops { | |||
193 | struct videobuf_buffer *vb); | 115 | struct videobuf_buffer *vb); |
194 | void (*buf_release)(struct videobuf_queue *q, | 116 | void (*buf_release)(struct videobuf_queue *q, |
195 | struct videobuf_buffer *vb); | 117 | struct videobuf_buffer *vb); |
118 | }; | ||
196 | 119 | ||
197 | /* Helper operations - device dependent. | 120 | #define MAGIC_QTYPE_OPS 0x12261003 |
198 | * If null, videobuf_init defaults all to PCI handling | 121 | |
199 | */ | 122 | /* Helper operations - device type dependent */ |
123 | struct videobuf_qtype_ops { | ||
124 | u32 magic; | ||
200 | 125 | ||
201 | vb_map_sg_t *vb_map_sg; | 126 | void* (*alloc) (size_t size); |
202 | vb_map_sg_t *vb_dma_sync_sg; | 127 | int (*iolock) (struct videobuf_queue* q, |
203 | vb_map_sg_t *vb_unmap_sg; | 128 | struct videobuf_buffer *vb, |
129 | struct v4l2_framebuffer *fbuf); | ||
130 | int (*mmap) (struct videobuf_queue *q, | ||
131 | unsigned int *count, | ||
132 | unsigned int *size, | ||
133 | enum v4l2_memory memory); | ||
134 | int (*sync) (struct videobuf_queue* q, | ||
135 | struct videobuf_buffer *buf); | ||
136 | int (*copy_to_user) (struct videobuf_queue *q, | ||
137 | char __user *data, | ||
138 | size_t count, | ||
139 | int nonblocking); | ||
140 | int (*copy_stream) (struct videobuf_queue *q, | ||
141 | char __user *data, | ||
142 | size_t count, | ||
143 | size_t pos, | ||
144 | int vbihack, | ||
145 | int nonblocking); | ||
146 | int (*mmap_free) (struct videobuf_queue *q); | ||
147 | int (*mmap_mapper) (struct videobuf_queue *q, | ||
148 | struct vm_area_struct *vma); | ||
204 | }; | 149 | }; |
205 | 150 | ||
206 | struct videobuf_queue { | 151 | struct videobuf_queue { |
@@ -215,6 +160,7 @@ struct videobuf_queue { | |||
215 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ | 160 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ |
216 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; | 161 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; |
217 | struct videobuf_queue_ops *ops; | 162 | struct videobuf_queue_ops *ops; |
163 | struct videobuf_qtype_ops *int_ops; | ||
218 | 164 | ||
219 | /* capture via mmap() + ioctl(QBUF/DQBUF) */ | 165 | /* capture via mmap() + ioctl(QBUF/DQBUF) */ |
220 | unsigned int streaming; | 166 | unsigned int streaming; |
@@ -229,28 +175,25 @@ struct videobuf_queue { | |||
229 | void *priv_data; | 175 | void *priv_data; |
230 | }; | 176 | }; |
231 | 177 | ||
232 | void* videobuf_alloc(unsigned int size); | ||
233 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | 178 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); |
234 | int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, | 179 | int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, |
235 | struct v4l2_framebuffer *fbuf); | 180 | struct v4l2_framebuffer *fbuf); |
236 | 181 | ||
237 | /* Maps fops to PCI stuff */ | 182 | void *videobuf_alloc(struct videobuf_queue* q); |
238 | void videobuf_queue_pci(struct videobuf_queue* q); | ||
239 | 183 | ||
240 | void videobuf_queue_init(struct videobuf_queue *q, | 184 | void videobuf_queue_core_init(struct videobuf_queue *q, |
241 | struct videobuf_queue_ops *ops, | 185 | struct videobuf_queue_ops *ops, |
242 | void *dev, | 186 | void *dev, |
243 | spinlock_t *irqlock, | 187 | spinlock_t *irqlock, |
244 | enum v4l2_buf_type type, | 188 | enum v4l2_buf_type type, |
245 | enum v4l2_field field, | 189 | enum v4l2_field field, |
246 | unsigned int msize, | 190 | unsigned int msize, |
247 | void *priv); | 191 | void *priv, |
192 | struct videobuf_qtype_ops *int_ops); | ||
248 | int videobuf_queue_is_busy(struct videobuf_queue *q); | 193 | int videobuf_queue_is_busy(struct videobuf_queue *q); |
249 | void videobuf_queue_cancel(struct videobuf_queue *q); | 194 | void videobuf_queue_cancel(struct videobuf_queue *q); |
250 | 195 | ||
251 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q); | 196 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q); |
252 | void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, | ||
253 | enum v4l2_buf_type type); | ||
254 | int videobuf_reqbufs(struct videobuf_queue *q, | 197 | int videobuf_reqbufs(struct videobuf_queue *q, |
255 | struct v4l2_requestbuffers *req); | 198 | struct v4l2_requestbuffers *req); |
256 | int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); | 199 | int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); |
@@ -258,6 +201,10 @@ int videobuf_qbuf(struct videobuf_queue *q, | |||
258 | struct v4l2_buffer *b); | 201 | struct v4l2_buffer *b); |
259 | int videobuf_dqbuf(struct videobuf_queue *q, | 202 | int videobuf_dqbuf(struct videobuf_queue *q, |
260 | struct v4l2_buffer *b, int nonblocking); | 203 | struct v4l2_buffer *b, int nonblocking); |
204 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
205 | int videobuf_cgmbuf(struct videobuf_queue *q, | ||
206 | struct video_mbuf *mbuf, int count); | ||
207 | #endif | ||
261 | int videobuf_streamon(struct videobuf_queue *q); | 208 | int videobuf_streamon(struct videobuf_queue *q); |
262 | int videobuf_streamoff(struct videobuf_queue *q); | 209 | int videobuf_streamoff(struct videobuf_queue *q); |
263 | 210 | ||
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h new file mode 100644 index 000000000000..38105031db23 --- /dev/null +++ b/include/media/videobuf-dma-sg.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * helper functions for PCI DMA video4linux capture buffers | ||
3 | * | ||
4 | * The functions expect the hardware being able to scatter gatter | ||
5 | * (i.e. the buffers are not linear in physical memory, but fragmented | ||
6 | * into PAGE_SIZE chunks). They also assume the driver does not need | ||
7 | * to touch the video data. | ||
8 | * | ||
9 | * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> | ||
10 | * | ||
11 | * Highly based on video-buf written originally by: | ||
12 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> | ||
13 | * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> | ||
14 | * (c) 2006 Ted Walther and John Sokol | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License as published by | ||
18 | * the Free Software Foundation; either version 2 | ||
19 | */ | ||
20 | |||
21 | #include <media/videobuf-core.h> | ||
22 | |||
23 | /* --------------------------------------------------------------------- */ | ||
24 | |||
25 | /* | ||
26 | * Return a scatterlist for some page-aligned vmalloc()'ed memory | ||
27 | * block (NULL on errors). Memory for the scatterlist is allocated | ||
28 | * using kmalloc. The caller must free the memory. | ||
29 | */ | ||
30 | struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); | ||
31 | |||
32 | /* | ||
33 | * Return a scatterlist for a an array of userpages (NULL on errors). | ||
34 | * Memory for the scatterlist is allocated using kmalloc. The caller | ||
35 | * must free the memory. | ||
36 | */ | ||
37 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | ||
38 | int offset); | ||
39 | |||
40 | /* --------------------------------------------------------------------- */ | ||
41 | |||
42 | /* | ||
43 | * A small set of helper functions to manage buffers (both userland | ||
44 | * and kernel) for DMA. | ||
45 | * | ||
46 | * videobuf_dma_init_*() | ||
47 | * creates a buffer. The userland version takes a userspace | ||
48 | * pointer + length. The kernel version just wants the size and | ||
49 | * does memory allocation too using vmalloc_32(). | ||
50 | * | ||
51 | * videobuf_dma_*() | ||
52 | * see Documentation/DMA-mapping.txt, these functions to | ||
53 | * basically the same. The map function does also build a | ||
54 | * scatterlist for the buffer (and unmap frees it ...) | ||
55 | * | ||
56 | * videobuf_dma_free() | ||
57 | * no comment ... | ||
58 | * | ||
59 | */ | ||
60 | |||
61 | struct videobuf_dmabuf { | ||
62 | u32 magic; | ||
63 | |||
64 | /* for userland buffer */ | ||
65 | int offset; | ||
66 | struct page **pages; | ||
67 | |||
68 | /* for kernel buffers */ | ||
69 | void *vmalloc; | ||
70 | |||
71 | /* Stores the userspace pointer to vmalloc area */ | ||
72 | void *varea; | ||
73 | |||
74 | /* for overlay buffers (pci-pci dma) */ | ||
75 | dma_addr_t bus_addr; | ||
76 | |||
77 | /* common */ | ||
78 | struct scatterlist *sglist; | ||
79 | int sglen; | ||
80 | int nr_pages; | ||
81 | int direction; | ||
82 | }; | ||
83 | |||
84 | struct videbuf_pci_sg_memory | ||
85 | { | ||
86 | u32 magic; | ||
87 | |||
88 | /* for mmap'ed buffers */ | ||
89 | struct videobuf_dmabuf dma; | ||
90 | }; | ||
91 | |||
92 | void videobuf_dma_init(struct videobuf_dmabuf *dma); | ||
93 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, | ||
94 | unsigned long data, unsigned long size); | ||
95 | int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | ||
96 | int nr_pages); | ||
97 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | ||
98 | dma_addr_t addr, int nr_pages); | ||
99 | int videobuf_dma_free(struct videobuf_dmabuf *dma); | ||
100 | |||
101 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
102 | int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
103 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
104 | struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf); | ||
105 | |||
106 | void *videobuf_pci_alloc (size_t size); | ||
107 | |||
108 | void videobuf_queue_pci_init(struct videobuf_queue* q, | ||
109 | struct videobuf_queue_ops *ops, | ||
110 | void *dev, | ||
111 | spinlock_t *irqlock, | ||
112 | enum v4l2_buf_type type, | ||
113 | enum v4l2_field field, | ||
114 | unsigned int msize, | ||
115 | void *priv); | ||
116 | |||
117 | /*FIXME: these variants are used only on *-alsa code, where videobuf is | ||
118 | * used without queue | ||
119 | */ | ||
120 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
121 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
122 | |||
diff --git a/include/media/video-buf-dvb.h b/include/media/videobuf-dvb.h index 8233cafdeef6..8233cafdeef6 100644 --- a/include/media/video-buf-dvb.h +++ b/include/media/videobuf-dvb.h | |||
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h new file mode 100644 index 000000000000..26a8958d23d1 --- /dev/null +++ b/include/media/videobuf-vmalloc.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * helper functions for vmalloc capture buffers | ||
3 | * | ||
4 | * The functions expect the hardware being able to scatter gatter | ||
5 | * (i.e. the buffers are not linear in physical memory, but fragmented | ||
6 | * into PAGE_SIZE chunks). They also assume the driver does not need | ||
7 | * to touch the video data. | ||
8 | * | ||
9 | * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 | ||
14 | */ | ||
15 | |||
16 | #include <media/videobuf-core.h> | ||
17 | |||
18 | /* --------------------------------------------------------------------- */ | ||
19 | |||
20 | struct videbuf_vmalloc_memory | ||
21 | { | ||
22 | u32 magic; | ||
23 | |||
24 | void *vmalloc; | ||
25 | |||
26 | /* remap_vmalloc_range seems to need to run after mmap() on some cases */ | ||
27 | struct vm_area_struct *vma; | ||
28 | }; | ||
29 | |||
30 | void videobuf_queue_vmalloc_init(struct videobuf_queue* q, | ||
31 | struct videobuf_queue_ops *ops, | ||
32 | void *dev, | ||
33 | spinlock_t *irqlock, | ||
34 | enum v4l2_buf_type type, | ||
35 | enum v4l2_field field, | ||
36 | unsigned int msize, | ||
37 | void *priv); | ||
38 | |||
39 | void *videobuf_to_vmalloc (struct videobuf_buffer *buf); | ||
40 | |||
41 | void videobuf_vmalloc_free (struct videobuf_buffer *buf); | ||