aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/meye.h12
-rw-r--r--include/linux/videodev2.h75
-rw-r--r--include/media/ak881x.h25
-rw-r--r--include/media/davinci/vpfe_capture.h2
-rw-r--r--include/media/ir-common.h74
-rw-r--r--include/media/ir-core.h142
-rw-r--r--include/media/ir-kbd-i2c.h6
-rw-r--r--include/media/rc-map.h121
-rw-r--r--include/media/sh_vou.h34
-rw-r--r--include/media/soc_camera.h12
-rw-r--r--include/media/v4l2-chip-ident.h127
-rw-r--r--include/media/v4l2-common.h27
-rw-r--r--include/media/v4l2-dev.h5
-rw-r--r--include/media/v4l2-event.h67
-rw-r--r--include/media/v4l2-fh.h65
-rw-r--r--include/media/v4l2-ioctl.h7
-rw-r--r--include/media/v4l2-mem2mem.h201
-rw-r--r--include/media/v4l2-subdev.h70
-rw-r--r--include/media/videobuf-core.h35
-rw-r--r--include/media/videobuf-dma-sg.h26
-rw-r--r--include/media/videobuf-vmalloc.h12
21 files changed, 892 insertions, 253 deletions
diff --git a/include/linux/meye.h b/include/linux/meye.h
index 12010ace1f04..0dd49954f746 100644
--- a/include/linux/meye.h
+++ b/include/linux/meye.h
@@ -44,17 +44,17 @@ struct meye_params {
44}; 44};
45 45
46/* query the extended parameters */ 46/* query the extended parameters */
47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) 47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params)
48/* set the extended parameters */ 48/* set the extended parameters */
49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) 49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params)
50/* queue a buffer for mjpeg capture */ 50/* queue a buffer for mjpeg capture */
51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) 51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int)
52/* sync a previously queued mjpeg buffer */ 52/* sync a previously queued mjpeg buffer */
53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) 53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int)
54/* get a still uncompressed snapshot */ 54/* get a still uncompressed snapshot */
55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) 55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4)
56/* get a jpeg compressed snapshot */ 56/* get a jpeg compressed snapshot */
57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) 57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int)
58 58
59/* V4L2 private controls */ 59/* V4L2 private controls */
60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE 60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3793d168b44d..047f7e6edb86 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -160,16 +160,6 @@ enum v4l2_buf_type {
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 160 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 161};
162 162
163enum v4l2_ctrl_type {
164 V4L2_CTRL_TYPE_INTEGER = 1,
165 V4L2_CTRL_TYPE_BOOLEAN = 2,
166 V4L2_CTRL_TYPE_MENU = 3,
167 V4L2_CTRL_TYPE_BUTTON = 4,
168 V4L2_CTRL_TYPE_INTEGER64 = 5,
169 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
170 V4L2_CTRL_TYPE_STRING = 7,
171};
172
173enum v4l2_tuner_type { 163enum v4l2_tuner_type {
174 V4L2_TUNER_RADIO = 1, 164 V4L2_TUNER_RADIO = 1,
175 V4L2_TUNER_ANALOG_TV = 2, 165 V4L2_TUNER_ANALOG_TV = 2,
@@ -294,6 +284,8 @@ struct v4l2_pix_format {
294 284
295/* Grey formats */ 285/* Grey formats */
296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 286#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
287#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
288#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
297#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ 289#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
298#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
299 291
@@ -369,6 +361,7 @@ struct v4l2_pix_format {
369#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 361#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
370#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 362#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
371#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ 363#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
364#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
372 365
373/* 366/*
374 * F O R M A T E N U M E R A T I O N 367 * F O R M A T E N U M E R A T I O N
@@ -549,6 +542,8 @@ struct v4l2_buffer {
549#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ 542#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
550#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ 543#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
551#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ 544#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
545/* Buffer is ready, but the data contained within is corrupted. */
546#define V4L2_BUF_FLAG_ERROR 0x0040
552#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 547#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
553#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ 548#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
554 549
@@ -939,6 +934,16 @@ struct v4l2_ext_controls {
939#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 934#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
940#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 935#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
941 936
937enum v4l2_ctrl_type {
938 V4L2_CTRL_TYPE_INTEGER = 1,
939 V4L2_CTRL_TYPE_BOOLEAN = 2,
940 V4L2_CTRL_TYPE_MENU = 3,
941 V4L2_CTRL_TYPE_BUTTON = 4,
942 V4L2_CTRL_TYPE_INTEGER64 = 5,
943 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
944 V4L2_CTRL_TYPE_STRING = 7,
945};
946
942/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 947/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
943struct v4l2_queryctrl { 948struct v4l2_queryctrl {
944 __u32 id; 949 __u32 id;
@@ -1023,14 +1028,24 @@ enum v4l2_colorfx {
1023 V4L2_COLORFX_NONE = 0, 1028 V4L2_COLORFX_NONE = 0,
1024 V4L2_COLORFX_BW = 1, 1029 V4L2_COLORFX_BW = 1,
1025 V4L2_COLORFX_SEPIA = 2, 1030 V4L2_COLORFX_SEPIA = 2,
1031 V4L2_COLORFX_NEGATIVE = 3,
1032 V4L2_COLORFX_EMBOSS = 4,
1033 V4L2_COLORFX_SKETCH = 5,
1034 V4L2_COLORFX_SKY_BLUE = 6,
1035 V4L2_COLORFX_GRASS_GREEN = 7,
1036 V4L2_COLORFX_SKIN_WHITEN = 8,
1037 V4L2_COLORFX_VIVID = 9,
1026}; 1038};
1027#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 1039#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1028#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 1040#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
1029 1041
1030#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) 1042#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
1031#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) 1043#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
1044
1045#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1046
1032/* last CID + 1 */ 1047/* last CID + 1 */
1033#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) 1048#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37)
1034 1049
1035/* MPEG-class control IDs defined by V4L2 */ 1050/* MPEG-class control IDs defined by V4L2 */
1036#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1051#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1276,6 +1291,9 @@ enum v4l2_exposure_auto_type {
1276 1291
1277#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) 1292#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1278 1293
1294#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1295#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1296
1279/* FM Modulator class control IDs */ 1297/* FM Modulator class control IDs */
1280#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1298#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1281#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1299#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
@@ -1621,6 +1639,38 @@ struct v4l2_streamparm {
1621}; 1639};
1622 1640
1623/* 1641/*
1642 * E V E N T S
1643 */
1644
1645#define V4L2_EVENT_ALL 0
1646#define V4L2_EVENT_VSYNC 1
1647#define V4L2_EVENT_EOS 2
1648#define V4L2_EVENT_PRIVATE_START 0x08000000
1649
1650/* Payload for V4L2_EVENT_VSYNC */
1651struct v4l2_event_vsync {
1652 /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
1653 __u8 field;
1654} __attribute__ ((packed));
1655
1656struct v4l2_event {
1657 __u32 type;
1658 union {
1659 struct v4l2_event_vsync vsync;
1660 __u8 data[64];
1661 } u;
1662 __u32 pending;
1663 __u32 sequence;
1664 struct timespec timestamp;
1665 __u32 reserved[9];
1666};
1667
1668struct v4l2_event_subscription {
1669 __u32 type;
1670 __u32 reserved[7];
1671};
1672
1673/*
1624 * A D V A N C E D D E B U G G I N G 1674 * A D V A N C E D D E B U G G I N G
1625 * 1675 *
1626 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! 1676 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
@@ -1742,6 +1792,9 @@ struct v4l2_dbg_chip_ident {
1742#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) 1792#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1743#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1793#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1744#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) 1794#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1795#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
1796#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
1797#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
1745 1798
1746/* Reminder: when adding new ioctls please add support for them to 1799/* Reminder: when adding new ioctls please add support for them to
1747 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1800 drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/include/media/ak881x.h b/include/media/ak881x.h
new file mode 100644
index 000000000000..b7f2add5ce7b
--- /dev/null
+++ b/include/media/ak881x.h
@@ -0,0 +1,25 @@
1/*
2 * Header for AK8813 / AK8814 TV-ecoders from Asahi Kasei Microsystems Co., Ltd. (AKM)
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef AK881X_H
12#define AK881X_H
13
14#define AK881X_IF_MODE_MASK (3 << 0)
15#define AK881X_IF_MODE_BT656 (0 << 0)
16#define AK881X_IF_MODE_MASTER (1 << 0)
17#define AK881X_IF_MODE_SLAVE (2 << 0)
18#define AK881X_FIELD (1 << 2)
19#define AK881X_COMPONENT (1 << 3)
20
21struct ak881x_pdata {
22 unsigned long flags;
23};
24
25#endif
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index 4314a5f6a087..cc973ed845a7 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -94,6 +94,8 @@ struct vpfe_config {
94 /* vpfe clock */ 94 /* vpfe clock */
95 struct clk *vpssclk; 95 struct clk *vpssclk;
96 struct clk *slaveclk; 96 struct clk *slaveclk;
97 /* Function for Clearing the interrupt */
98 void (*clr_intr)(int vdint);
97}; 99};
98 100
99struct vpfe_device { 101struct vpfe_device {
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index c66298062d39..528050e39ad9 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -50,6 +50,10 @@ struct card_ir {
50 struct ir_input_state ir; 50 struct ir_input_state ir;
51 char name[32]; 51 char name[32];
52 char phys[32]; 52 char phys[32];
53 int users;
54
55 u32 running:1;
56 struct ir_dev_props props;
53 57
54 /* Usual gpio signalling */ 58 /* Usual gpio signalling */
55 59
@@ -79,6 +83,9 @@ struct card_ir {
79 /* NEC decoding */ 83 /* NEC decoding */
80 u32 nec_gpio; 84 u32 nec_gpio;
81 struct tasklet_struct tlet; 85 struct tasklet_struct tlet;
86
87 /* IR core raw decoding */
88 u32 raw_decode;
82}; 89};
83 90
84/* Routines from ir-functions.c */ 91/* Routines from ir-functions.c */
@@ -97,71 +104,4 @@ u32 ir_rc5_decode(unsigned int code);
97void ir_rc5_timer_end(unsigned long data); 104void ir_rc5_timer_end(unsigned long data);
98void ir_rc5_timer_keyup(unsigned long data); 105void ir_rc5_timer_keyup(unsigned long data);
99 106
100/* scancode->keycode map tables from ir-keymaps.c */
101
102extern struct ir_scancode_table ir_codes_empty_table;
103extern struct ir_scancode_table ir_codes_avermedia_table;
104extern struct ir_scancode_table ir_codes_avermedia_dvbt_table;
105extern struct ir_scancode_table ir_codes_avermedia_m135a_table;
106extern struct ir_scancode_table ir_codes_avermedia_cardbus_table;
107extern struct ir_scancode_table ir_codes_apac_viewcomp_table;
108extern struct ir_scancode_table ir_codes_pixelview_table;
109extern struct ir_scancode_table ir_codes_pixelview_new_table;
110extern struct ir_scancode_table ir_codes_nebula_table;
111extern struct ir_scancode_table ir_codes_dntv_live_dvb_t_table;
112extern struct ir_scancode_table ir_codes_iodata_bctv7e_table;
113extern struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table;
114extern struct ir_scancode_table ir_codes_msi_tvanywhere_table;
115extern struct ir_scancode_table ir_codes_cinergy_1400_table;
116extern struct ir_scancode_table ir_codes_avertv_303_table;
117extern struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table;
118extern struct ir_scancode_table ir_codes_em_terratec_table;
119extern struct ir_scancode_table ir_codes_pinnacle_grey_table;
120extern struct ir_scancode_table ir_codes_flyvideo_table;
121extern struct ir_scancode_table ir_codes_flydvb_table;
122extern struct ir_scancode_table ir_codes_cinergy_table;
123extern struct ir_scancode_table ir_codes_eztv_table;
124extern struct ir_scancode_table ir_codes_avermedia_table;
125extern struct ir_scancode_table ir_codes_videomate_tv_pvr_table;
126extern struct ir_scancode_table ir_codes_manli_table;
127extern struct ir_scancode_table ir_codes_gotview7135_table;
128extern struct ir_scancode_table ir_codes_purpletv_table;
129extern struct ir_scancode_table ir_codes_pctv_sedna_table;
130extern struct ir_scancode_table ir_codes_pv951_table;
131extern struct ir_scancode_table ir_codes_rc5_tv_table;
132extern struct ir_scancode_table ir_codes_winfast_table;
133extern struct ir_scancode_table ir_codes_pinnacle_color_table;
134extern struct ir_scancode_table ir_codes_hauppauge_new_table;
135extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table;
136extern struct ir_scancode_table ir_codes_npgtech_table;
137extern struct ir_scancode_table ir_codes_norwood_table;
138extern struct ir_scancode_table ir_codes_proteus_2309_table;
139extern struct ir_scancode_table ir_codes_budget_ci_old_table;
140extern struct ir_scancode_table ir_codes_asus_pc39_table;
141extern struct ir_scancode_table ir_codes_encore_enltv_table;
142extern struct ir_scancode_table ir_codes_encore_enltv2_table;
143extern struct ir_scancode_table ir_codes_tt_1500_table;
144extern struct ir_scancode_table ir_codes_fusionhdtv_mce_table;
145extern struct ir_scancode_table ir_codes_behold_table;
146extern struct ir_scancode_table ir_codes_behold_columbus_table;
147extern struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table;
148extern struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table;
149extern struct ir_scancode_table ir_codes_powercolor_real_angel_table;
150extern struct ir_scancode_table ir_codes_avermedia_a16d_table;
151extern struct ir_scancode_table ir_codes_encore_enltv_fm53_table;
152extern struct ir_scancode_table ir_codes_real_audio_220_32_keys_table;
153extern struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table;
154extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table;
155extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table;
156extern struct ir_scancode_table ir_codes_kaiomy_table;
157extern struct ir_scancode_table ir_codes_dm1105_nec_table;
158extern struct ir_scancode_table ir_codes_tevii_nec_table;
159extern struct ir_scancode_table ir_codes_tbs_nec_table;
160extern struct ir_scancode_table ir_codes_evga_indtube_table;
161extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
162extern struct ir_scancode_table ir_codes_videomate_s350_table;
163extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
164extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table;
165extern struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table;
166extern struct ir_scancode_table ir_codes_kworld_315u_table;
167#endif 107#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 61c223bc3953..ad1303f20e00 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * Remote Controller core header 2 * Remote Controller core header
3 * 3 *
4 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
5 *
4 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2 of the License. 8 * the Free Software Foundation version 2 of the License.
@@ -14,61 +16,133 @@
14#ifndef _IR_CORE 16#ifndef _IR_CORE
15#define _IR_CORE 17#define _IR_CORE
16 18
17#include <linux/input.h>
18#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/kfifo.h>
21#include <linux/time.h>
22#include <linux/timer.h>
23#include <media/rc-map.h>
19 24
20extern int ir_core_debug; 25extern int ir_core_debug;
21#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ 26#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
22 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) 27 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
23 28
24#define IR_TYPE_UNKNOWN 0 29enum rc_driver_type {
25#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ 30 RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */
26#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ 31 RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */
27#define IR_TYPE_NEC (1 << 2)
28#define IR_TYPE_OTHER (((u64)1) << 63l)
29
30struct ir_scancode {
31 u16 scancode;
32 u32 keycode;
33};
34
35struct ir_scancode_table {
36 struct ir_scancode *scan;
37 int size;
38 u64 ir_type;
39 spinlock_t lock;
40}; 32};
41 33
34/**
35 * struct ir_dev_props - Allow caller drivers to set special properties
36 * @driver_type: specifies if the driver or hardware have already a decoder,
37 * or if it needs to use the IR raw event decoders to produce a scancode
38 * @allowed_protos: bitmask with the supported IR_TYPE_* protocols
39 * @scanmask: some hardware decoders are not capable of providing the full
40 * scancode to the application. As this is a hardware limit, we can't do
41 * anything with it. Yet, as the same keycode table can be used with other
42 * devices, a mask is provided to allow its usage. Drivers should generally
43 * leave this field in blank
44 * @priv: driver-specific data, to be used on the callbacks
45 * @change_protocol: allow changing the protocol used on hardware decoders
46 * @open: callback to allow drivers to enable polling/irq when IR input device
47 * is opened.
48 * @close: callback to allow drivers to disable polling/irq when IR input device
49 * is opened.
50 */
42struct ir_dev_props { 51struct ir_dev_props {
43 unsigned long allowed_protos; 52 enum rc_driver_type driver_type;
44 void *priv; 53 unsigned long allowed_protos;
45 int (*change_protocol)(void *priv, u64 ir_type); 54 u32 scanmask;
55 void *priv;
56 int (*change_protocol)(void *priv, u64 ir_type);
57 int (*open)(void *priv);
58 void (*close)(void *priv);
46}; 59};
47 60
48
49struct ir_input_dev { 61struct ir_input_dev {
50 struct input_dev *dev; /* Input device*/ 62 struct device dev; /* device */
63 char *driver_name; /* Name of the driver module */
51 struct ir_scancode_table rc_tab; /* scan/key table */ 64 struct ir_scancode_table rc_tab; /* scan/key table */
52 unsigned long devno; /* device number */ 65 unsigned long devno; /* device number */
53 struct attribute_group attr; /* IR attributes */
54 struct device *class_dev; /* virtual class dev */
55 const struct ir_dev_props *props; /* Device properties */ 66 const struct ir_dev_props *props; /* Device properties */
67 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
68 struct input_dev *input_dev; /* the input device associated with this device */
69
70 /* key info - needed by IR keycode handlers */
71 spinlock_t keylock; /* protects the below members */
72 bool keypressed; /* current state */
73 unsigned long keyup_jiffies; /* when should the current keypress be released? */
74 struct timer_list timer_keyup; /* timer for releasing a keypress */
75 u32 last_keycode; /* keycode of last command */
76 u32 last_scancode; /* scancode of last command */
77 u8 last_toggle; /* toggle of last command */
56}; 78};
57#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
58 79
59/* Routines from ir-keytable.c */ 80enum raw_event_type {
81 IR_SPACE = (1 << 0),
82 IR_PULSE = (1 << 1),
83 IR_START_EVENT = (1 << 2),
84 IR_STOP_EVENT = (1 << 3),
85};
60 86
61u32 ir_g_keycode_from_table(struct input_dev *input_dev, 87#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
62 u32 scancode);
63 88
64int ir_input_register(struct input_dev *dev, 89/* From ir-keytable.c */
90int __ir_input_register(struct input_dev *dev,
65 const struct ir_scancode_table *ir_codes, 91 const struct ir_scancode_table *ir_codes,
66 const struct ir_dev_props *props); 92 const struct ir_dev_props *props,
93 const char *driver_name);
94
95static inline int ir_input_register(struct input_dev *dev,
96 const char *map_name,
97 const struct ir_dev_props *props,
98 const char *driver_name) {
99 struct ir_scancode_table *ir_codes;
100 struct ir_input_dev *ir_dev;
101 int rc;
102
103 if (!map_name)
104 return -EINVAL;
105
106 ir_codes = get_rc_map(map_name);
107 if (!ir_codes)
108 return -EINVAL;
109
110 rc = __ir_input_register(dev, ir_codes, props, driver_name);
111 if (rc < 0)
112 return -EINVAL;
113
114 ir_dev = input_get_drvdata(dev);
115
116 if (!rc && ir_dev->props && ir_dev->props->change_protocol)
117 rc = ir_dev->props->change_protocol(ir_dev->props->priv,
118 ir_codes->ir_type);
119
120 return rc;
121}
122
67void ir_input_unregister(struct input_dev *input_dev); 123void ir_input_unregister(struct input_dev *input_dev);
68 124
69/* Routines from ir-sysfs.c */ 125void ir_repeat(struct input_dev *dev);
126void ir_keydown(struct input_dev *dev, int scancode, u8 toggle);
127u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);
128
129/* From ir-raw-event.c */
130
131struct ir_raw_event {
132 unsigned pulse:1;
133 unsigned duration:31;
134};
135
136#define IR_MAX_DURATION 0x7FFFFFFF /* a bit more than 2 seconds */
70 137
71int ir_register_class(struct input_dev *input_dev); 138void ir_raw_event_handle(struct input_dev *input_dev);
72void ir_unregister_class(struct input_dev *input_dev); 139int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
140int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
141static inline void ir_raw_event_reset(struct input_dev *input_dev)
142{
143 struct ir_raw_event ev = { .pulse = false, .duration = 0 };
144 ir_raw_event_store(input_dev, &ev);
145 ir_raw_event_handle(input_dev);
146}
73 147
74#endif 148#endif /* _IR_CORE */
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 9142936603cc..0506e45c9a4f 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -6,7 +6,7 @@
6struct IR_i2c; 6struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 struct ir_scancode_table *ir_codes; 9 char *ir_codes;
10 10
11 struct i2c_client *c; 11 struct i2c_client *c;
12 struct input_dev *input; 12 struct input_dev *input;
@@ -34,9 +34,9 @@ enum ir_kbd_get_key_fn {
34 34
35/* Can be passed when instantiating an ir_video i2c device */ 35/* Can be passed when instantiating an ir_video i2c device */
36struct IR_i2c_init_data { 36struct IR_i2c_init_data {
37 struct ir_scancode_table *ir_codes; 37 char *ir_codes;
38 const char *name; 38 const char *name;
39 u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ 39 u64 type; /* IR_TYPE_RC5, etc */
40 /* 40 /*
41 * Specify either a function pointer or a value indicating one of 41 * Specify either a function pointer or a value indicating one of
42 * ir_kbd_i2c's internal get_key functions 42 * ir_kbd_i2c's internal get_key functions
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
new file mode 100644
index 000000000000..5833966a7100
--- /dev/null
+++ b/include/media/rc-map.h
@@ -0,0 +1,121 @@
1/*
2 * rc-map.h - define RC map names used by RC drivers
3 *
4 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
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
12#include <linux/input.h>
13
14#define IR_TYPE_UNKNOWN 0
15#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */
16#define IR_TYPE_NEC (1 << 1)
17#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */
18#define IR_TYPE_JVC (1 << 3) /* JVC protocol */
19#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */
20#define IR_TYPE_OTHER (1u << 31)
21
22struct ir_scancode {
23 u32 scancode;
24 u32 keycode;
25};
26
27struct ir_scancode_table {
28 struct ir_scancode *scan;
29 unsigned int size; /* Max number of entries */
30 unsigned int len; /* Used number of entries */
31 unsigned int alloc; /* Size of *scan in bytes */
32 u64 ir_type;
33 char *name;
34 spinlock_t lock;
35};
36
37struct rc_keymap {
38 struct list_head list;
39 struct ir_scancode_table map;
40};
41
42/* Routines from rc-map.c */
43
44int ir_register_map(struct rc_keymap *map);
45void ir_unregister_map(struct rc_keymap *map);
46struct ir_scancode_table *get_rc_map(const char *name);
47void rc_map_init(void);
48
49/* Names of the several keytables defined in-kernel */
50
51#define RC_MAP_ADSTECH_DVB_T_PCI "rc-adstech-dvb-t-pci"
52#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp"
53#define RC_MAP_ASUS_PC39 "rc-asus-pc39"
54#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600"
55#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d"
56#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus"
57#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt"
58#define RC_MAP_AVERMEDIA_M135A_RM_JX "rc-avermedia-m135a-rm-jx"
59#define RC_MAP_AVERMEDIA "rc-avermedia"
60#define RC_MAP_AVERTV_303 "rc-avertv-303"
61#define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus"
62#define RC_MAP_BEHOLD "rc-behold"
63#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old"
64#define RC_MAP_CINERGY_1400 "rc-cinergy-1400"
65#define RC_MAP_CINERGY "rc-cinergy"
66#define RC_MAP_DM1105_NEC "rc-dm1105-nec"
67#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro"
68#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t"
69#define RC_MAP_EMPTY "rc-empty"
70#define RC_MAP_EM_TERRATEC "rc-em-terratec"
71#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2"
72#define RC_MAP_ENCORE_ENLTV_FM53 "rc-encore-enltv-fm53"
73#define RC_MAP_ENCORE_ENLTV "rc-encore-enltv"
74#define RC_MAP_EVGA_INDTUBE "rc-evga-indtube"
75#define RC_MAP_EZTV "rc-eztv"
76#define RC_MAP_FLYDVB "rc-flydvb"
77#define RC_MAP_FLYVIDEO "rc-flyvideo"
78#define RC_MAP_FUSIONHDTV_MCE "rc-fusionhdtv-mce"
79#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z"
80#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce"
81#define RC_MAP_GOTVIEW7135 "rc-gotview7135"
82#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new"
83#define RC_MAP_IMON_MCE "rc-imon-mce"
84#define RC_MAP_IMON_PAD "rc-imon-pad"
85#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
86#define RC_MAP_KAIOMY "rc-kaiomy"
87#define RC_MAP_KWORLD_315U "rc-kworld-315u"
88#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
89#define RC_MAP_MANLI "rc-manli"
90#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus"
91#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere"
92#define RC_MAP_NEBULA "rc-nebula"
93#define RC_MAP_NEC_TERRATEC_CINERGY_XS "rc-nec-terratec-cinergy-xs"
94#define RC_MAP_NORWOOD "rc-norwood"
95#define RC_MAP_NPGTECH "rc-npgtech"
96#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
97#define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color"
98#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
99#define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd"
100#define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new"
101#define RC_MAP_PIXELVIEW "rc-pixelview"
102#define RC_MAP_PIXELVIEW_MK12 "rc-pixelview-mk12"
103#define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel"
104#define RC_MAP_PROTEUS_2309 "rc-proteus-2309"
105#define RC_MAP_PURPLETV "rc-purpletv"
106#define RC_MAP_PV951 "rc-pv951"
107#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new"
108#define RC_MAP_RC5_TV "rc-rc5-tv"
109#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
110#define RC_MAP_TBS_NEC "rc-tbs-nec"
111#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"
112#define RC_MAP_TEVII_NEC "rc-tevii-nec"
113#define RC_MAP_TT_1500 "rc-tt-1500"
114#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350"
115#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr"
116#define RC_MAP_WINFAST "rc-winfast"
117#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
118/*
119 * Please, do not just append newer Remote Controller names at the end.
120 * The names should be ordered in alphabetical order
121 */
diff --git a/include/media/sh_vou.h b/include/media/sh_vou.h
new file mode 100644
index 000000000000..a3ef30242b00
--- /dev/null
+++ b/include/media/sh_vou.h
@@ -0,0 +1,34 @@
1/*
2 * SuperH Video Output Unit (VOU) driver header
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef SH_VOU_H
11#define SH_VOU_H
12
13#include <linux/i2c.h>
14
15/* Bus flags */
16#define SH_VOU_PCLK_FALLING (1 << 0)
17#define SH_VOU_HSYNC_LOW (1 << 1)
18#define SH_VOU_VSYNC_LOW (1 << 2)
19
20enum sh_vou_bus_fmt {
21 SH_VOU_BUS_8BIT,
22 SH_VOU_BUS_16BIT,
23 SH_VOU_BUS_BT656,
24};
25
26struct sh_vou_pdata {
27 enum sh_vou_bus_fmt bus_fmt;
28 int i2c_adap;
29 struct i2c_board_info *board_info;
30 unsigned long flags;
31 char *module_name;
32};
33
34#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 9d69f01b6fa2..c9a5bbfa6ab5 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -266,8 +266,8 @@ static inline unsigned long soc_camera_bus_param_compatible(
266 common_flags; 266 common_flags;
267} 267}
268 268
269static inline void soc_camera_limit_side(unsigned int *start, 269static inline void soc_camera_limit_side(int *start, int *length,
270 unsigned int *length, unsigned int start_min, 270 unsigned int start_min,
271 unsigned int length_min, unsigned int length_max) 271 unsigned int length_min, unsigned int length_max)
272{ 272{
273 if (*length < length_min) 273 if (*length < length_min)
@@ -284,4 +284,12 @@ static inline void soc_camera_limit_side(unsigned int *start,
284extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 284extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
285 unsigned long flags); 285 unsigned long flags);
286 286
287/* This is only temporary here - until v4l2-subdev begins to link to video_device */
288#include <linux/i2c.h>
289static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client)
290{
291 struct soc_camera_device *icd = client->dev.platform_data;
292 return icd->vdev;
293}
294
287#endif 295#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 56abf21dd786..21b4428c12ab 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -25,6 +25,10 @@
25#define V4L2_CHIP_IDENT_H_ 25#define V4L2_CHIP_IDENT_H_
26 26
27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */ 27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
28
29/* KEEP THIS LIST ORDERED BY ID!
30 Otherwise it will be hard to see which ranges are already in use when
31 adding support to a new chip family. */
28enum { 32enum {
29 /* general idents: reserved range 0-49 */ 33 /* general idents: reserved range 0-49 */
30 V4L2_IDENT_NONE = 0, /* No chip matched */ 34 V4L2_IDENT_NONE = 0, /* No chip matched */
@@ -77,17 +81,14 @@ enum {
77 V4L2_IDENT_CX23417 = 417, 81 V4L2_IDENT_CX23417 = 417,
78 V4L2_IDENT_CX23418 = 418, 82 V4L2_IDENT_CX23418 = 418,
79 83
80 /* module au0828 */
81 V4L2_IDENT_AU0828 = 828,
82
83 /* module indycam: just ident 2000 */
84 V4L2_IDENT_INDYCAM = 2000,
85
86 /* module bt819: reserved range 810-819 */ 84 /* module bt819: reserved range 810-819 */
87 V4L2_IDENT_BT815A = 815, 85 V4L2_IDENT_BT815A = 815,
88 V4L2_IDENT_BT817A = 817, 86 V4L2_IDENT_BT817A = 817,
89 V4L2_IDENT_BT819A = 819, 87 V4L2_IDENT_BT819A = 819,
90 88
89 /* module au0828 */
90 V4L2_IDENT_AU0828 = 828,
91
91 /* module bt856: just ident 856 */ 92 /* module bt856: just ident 856 */
92 V4L2_IDENT_BT856 = 856, 93 V4L2_IDENT_BT856 = 856,
93 94
@@ -99,6 +100,9 @@ enum {
99 V4L2_IDENT_KS0127 = 1127, 100 V4L2_IDENT_KS0127 = 1127,
100 V4L2_IDENT_KS0127B = 1128, 101 V4L2_IDENT_KS0127B = 1128,
101 102
103 /* module indycam: just ident 2000 */
104 V4L2_IDENT_INDYCAM = 2000,
105
102 /* module vp27smpx: just ident 2700 */ 106 /* module vp27smpx: just ident 2700 */
103 V4L2_IDENT_VP27SMPX = 2700, 107 V4L2_IDENT_VP27SMPX = 2700,
104 108
@@ -162,20 +166,21 @@ enum {
162 /* module saa7706h: just ident 7706 */ 166 /* module saa7706h: just ident 7706 */
163 V4L2_IDENT_SAA7706H = 7706, 167 V4L2_IDENT_SAA7706H = 7706,
164 168
169 /* module mt9v011, just ident 8243 */
170 V4L2_IDENT_MT9V011 = 8243,
171
165 /* module wm8739: just ident 8739 */ 172 /* module wm8739: just ident 8739 */
166 V4L2_IDENT_WM8739 = 8739, 173 V4L2_IDENT_WM8739 = 8739,
167 174
168 /* module wm8775: just ident 8775 */ 175 /* module wm8775: just ident 8775 */
169 V4L2_IDENT_WM8775 = 8775, 176 V4L2_IDENT_WM8775 = 8775,
170 177
171 /* module tda9840: just ident 9840 */
172 V4L2_IDENT_TDA9840 = 9840,
173
174 /* module cafe_ccic, just ident 8801 */ 178 /* module cafe_ccic, just ident 8801 */
175 V4L2_IDENT_CAFE = 8801, 179 V4L2_IDENT_CAFE = 8801,
176 180
177 /* module mt9v011, just ident 8243 */ 181 /* AKM AK8813/AK8814 */
178 V4L2_IDENT_MT9V011 = 8243, 182 V4L2_IDENT_AK8813 = 8813,
183 V4L2_IDENT_AK8814 = 8814,
179 184
180 /* module cx23885 and cx25840 */ 185 /* module cx23885 and cx25840 */
181 V4L2_IDENT_CX23885 = 8850, 186 V4L2_IDENT_CX23885 = 8850,
@@ -186,6 +191,9 @@ enum {
186 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ 191 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
187 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ 192 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
188 193
194 /* module tda9840: just ident 9840 */
195 V4L2_IDENT_TDA9840 = 9840,
196
189 /* module tw9910: just ident 9910 */ 197 /* module tw9910: just ident 9910 */
190 V4L2_IDENT_TW9910 = 9910, 198 V4L2_IDENT_TW9910 = 9910,
191 199
@@ -198,72 +206,70 @@ enum {
198 V4L2_IDENT_CX23101 = 23101, 206 V4L2_IDENT_CX23101 = 23101,
199 V4L2_IDENT_CX23102 = 23102, 207 V4L2_IDENT_CX23102 = 23102,
200 208
201 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 209 /* module msp3400: reserved range 34000-34999 for msp34xx */
202 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 210 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
203 use internally (tveeprom.c). */ 211 use internally (tveeprom.c). */
204 212
205 V4L2_IDENT_MSP3400B = 34002, 213 V4L2_IDENT_MSP3400B = 34002,
206 V4L2_IDENT_MSP3410B = 34102,
207
208 V4L2_IDENT_MSP3400C = 34003, 214 V4L2_IDENT_MSP3400C = 34003,
209 V4L2_IDENT_MSP3410C = 34103,
210
211 V4L2_IDENT_MSP3400D = 34004, 215 V4L2_IDENT_MSP3400D = 34004,
212 V4L2_IDENT_MSP3410D = 34104, 216 V4L2_IDENT_MSP3400G = 34007,
217 V4L2_IDENT_MSP3401G = 34017,
218 V4L2_IDENT_MSP3402G = 34027,
213 V4L2_IDENT_MSP3405D = 34054, 219 V4L2_IDENT_MSP3405D = 34054,
214 V4L2_IDENT_MSP3415D = 34154, 220 V4L2_IDENT_MSP3405G = 34057,
215 V4L2_IDENT_MSP3407D = 34074, 221 V4L2_IDENT_MSP3407D = 34074,
216 V4L2_IDENT_MSP3417D = 34174, 222 V4L2_IDENT_MSP3407G = 34077,
217 223
218 V4L2_IDENT_MSP3400G = 34007, 224 V4L2_IDENT_MSP3410B = 34102,
225 V4L2_IDENT_MSP3410C = 34103,
226 V4L2_IDENT_MSP3410D = 34104,
219 V4L2_IDENT_MSP3410G = 34107, 227 V4L2_IDENT_MSP3410G = 34107,
220 V4L2_IDENT_MSP3420G = 34207,
221 V4L2_IDENT_MSP3430G = 34307,
222 V4L2_IDENT_MSP3440G = 34407,
223 V4L2_IDENT_MSP3450G = 34507,
224 V4L2_IDENT_MSP3460G = 34607,
225
226 V4L2_IDENT_MSP3401G = 34017,
227 V4L2_IDENT_MSP3411G = 34117, 228 V4L2_IDENT_MSP3411G = 34117,
228 V4L2_IDENT_MSP3421G = 34217,
229 V4L2_IDENT_MSP3431G = 34317,
230 V4L2_IDENT_MSP3441G = 34417,
231 V4L2_IDENT_MSP3451G = 34517,
232 V4L2_IDENT_MSP3461G = 34617,
233
234 V4L2_IDENT_MSP3402G = 34027,
235 V4L2_IDENT_MSP3412G = 34127, 229 V4L2_IDENT_MSP3412G = 34127,
236 V4L2_IDENT_MSP3422G = 34227, 230 V4L2_IDENT_MSP3415D = 34154,
237 V4L2_IDENT_MSP3442G = 34427,
238 V4L2_IDENT_MSP3452G = 34527,
239
240 V4L2_IDENT_MSP3405G = 34057,
241 V4L2_IDENT_MSP3415G = 34157, 231 V4L2_IDENT_MSP3415G = 34157,
242 V4L2_IDENT_MSP3425G = 34257, 232 V4L2_IDENT_MSP3417D = 34174,
243 V4L2_IDENT_MSP3435G = 34357,
244 V4L2_IDENT_MSP3445G = 34457,
245 V4L2_IDENT_MSP3455G = 34557,
246 V4L2_IDENT_MSP3465G = 34657,
247
248 V4L2_IDENT_MSP3407G = 34077,
249 V4L2_IDENT_MSP3417G = 34177, 233 V4L2_IDENT_MSP3417G = 34177,
234
235 V4L2_IDENT_MSP3420G = 34207,
236 V4L2_IDENT_MSP3421G = 34217,
237 V4L2_IDENT_MSP3422G = 34227,
238 V4L2_IDENT_MSP3425G = 34257,
250 V4L2_IDENT_MSP3427G = 34277, 239 V4L2_IDENT_MSP3427G = 34277,
240
241 V4L2_IDENT_MSP3430G = 34307,
242 V4L2_IDENT_MSP3431G = 34317,
243 V4L2_IDENT_MSP3435G = 34357,
251 V4L2_IDENT_MSP3437G = 34377, 244 V4L2_IDENT_MSP3437G = 34377,
245
246 V4L2_IDENT_MSP3440G = 34407,
247 V4L2_IDENT_MSP3441G = 34417,
248 V4L2_IDENT_MSP3442G = 34427,
249 V4L2_IDENT_MSP3445G = 34457,
252 V4L2_IDENT_MSP3447G = 34477, 250 V4L2_IDENT_MSP3447G = 34477,
251
252 V4L2_IDENT_MSP3450G = 34507,
253 V4L2_IDENT_MSP3451G = 34517,
254 V4L2_IDENT_MSP3452G = 34527,
255 V4L2_IDENT_MSP3455G = 34557,
253 V4L2_IDENT_MSP3457G = 34577, 256 V4L2_IDENT_MSP3457G = 34577,
257
258 V4L2_IDENT_MSP3460G = 34607,
259 V4L2_IDENT_MSP3461G = 34617,
260 V4L2_IDENT_MSP3465G = 34657,
254 V4L2_IDENT_MSP3467G = 34677, 261 V4L2_IDENT_MSP3467G = 34677,
255 262
256 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 263 /* module msp3400: reserved range 44000-44999 for msp44xx */
257 V4L2_IDENT_MSP4400G = 44007, 264 V4L2_IDENT_MSP4400G = 44007,
258 V4L2_IDENT_MSP4410G = 44107,
259 V4L2_IDENT_MSP4420G = 44207,
260 V4L2_IDENT_MSP4440G = 44407,
261 V4L2_IDENT_MSP4450G = 44507,
262
263 V4L2_IDENT_MSP4408G = 44087, 265 V4L2_IDENT_MSP4408G = 44087,
266 V4L2_IDENT_MSP4410G = 44107,
264 V4L2_IDENT_MSP4418G = 44187, 267 V4L2_IDENT_MSP4418G = 44187,
268 V4L2_IDENT_MSP4420G = 44207,
265 V4L2_IDENT_MSP4428G = 44287, 269 V4L2_IDENT_MSP4428G = 44287,
270 V4L2_IDENT_MSP4440G = 44407,
266 V4L2_IDENT_MSP4448G = 44487, 271 V4L2_IDENT_MSP4448G = 44487,
272 V4L2_IDENT_MSP4450G = 44507,
267 V4L2_IDENT_MSP4458G = 44587, 273 V4L2_IDENT_MSP4458G = 44587,
268 274
269 /* Micron CMOS sensor chips: 45000-45099 */ 275 /* Micron CMOS sensor chips: 45000-45099 */
@@ -282,20 +288,27 @@ enum {
282 /* HV7131R CMOS sensor: just ident 46000 */ 288 /* HV7131R CMOS sensor: just ident 46000 */
283 V4L2_IDENT_HV7131R = 46000, 289 V4L2_IDENT_HV7131R = 46000,
284 290
291 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
292 V4L2_IDENT_RJ54N1CB0C = 51980,
293
294 /* module m52790: just ident 52790 */
295 V4L2_IDENT_M52790 = 52790,
296
285 /* module cs53132a: just ident 53132 */ 297 /* module cs53132a: just ident 53132 */
286 V4L2_IDENT_CS53l32A = 53132, 298 V4L2_IDENT_CS53l32A = 53132,
287 299
300 /* modules upd61151 MPEG2 encoder: just ident 54000 */
301 V4L2_IDENT_UPD61161 = 54000,
302 /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
303 V4L2_IDENT_UPD61162 = 54001,
304
288 /* module upd64031a: just ident 64031 */ 305 /* module upd64031a: just ident 64031 */
289 V4L2_IDENT_UPD64031A = 64031, 306 V4L2_IDENT_UPD64031A = 64031,
290 307
291 /* module upd64083: just ident 64083 */ 308 /* module upd64083: just ident 64083 */
292 V4L2_IDENT_UPD64083 = 64083, 309 V4L2_IDENT_UPD64083 = 64083,
293 310
294 /* module m52790: just ident 52790 */ 311 /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
295 V4L2_IDENT_M52790 = 52790,
296
297 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
298 V4L2_IDENT_RJ54N1CB0C = 51980,
299}; 312};
300 313
301#endif 314#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1c7b259f341c..98b32645e5a7 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -85,13 +85,13 @@
85struct v4l2_prio_state { 85struct v4l2_prio_state {
86 atomic_t prios[4]; 86 atomic_t prios[4];
87}; 87};
88int v4l2_prio_init(struct v4l2_prio_state *global); 88void v4l2_prio_init(struct v4l2_prio_state *global);
89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, 89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
90 enum v4l2_priority new); 90 enum v4l2_priority new);
91int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); 91void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
92int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); 92void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); 93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); 94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
95 95
96/* ------------------------------------------------------------------------- */ 96/* ------------------------------------------------------------------------- */
97 97
@@ -184,6 +184,25 @@ const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
184 184
185/* ------------------------------------------------------------------------- */ 185/* ------------------------------------------------------------------------- */
186 186
187/* SPI Helper functions */
188#if defined(CONFIG_SPI)
189
190#include <linux/spi/spi.h>
191
192struct spi_device;
193
194/* Load an spi module and return an initialized v4l2_subdev struct.
195 The client_type argument is the name of the chip that's on the adapter. */
196struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
197 struct spi_master *master, struct spi_board_info *info);
198
199/* Initialize an v4l2_subdev with data from an spi_device struct */
200void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
201 const struct v4l2_subdev_ops *ops);
202#endif
203
204/* ------------------------------------------------------------------------- */
205
187/* Note: these remaining ioctls/structs should be removed as well, but they are 206/* Note: these remaining ioctls/structs should be removed as well, but they are
188 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and 207 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
189 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup 208 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2dee93892ea2..bebe44b03e0f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -32,6 +32,7 @@ struct v4l2_device;
32 Drivers can clear this flag if they want to block all future 32 Drivers can clear this flag if they want to block all future
33 device access. It is cleared by video_unregister_device. */ 33 device access. It is cleared by video_unregister_device. */
34#define V4L2_FL_REGISTERED (0) 34#define V4L2_FL_REGISTERED (0)
35#define V4L2_FL_USES_V4L2_FH (1)
35 36
36struct v4l2_file_operations { 37struct v4l2_file_operations {
37 struct module *owner; 38 struct module *owner;
@@ -77,6 +78,10 @@ struct video_device
77 /* attribute to differentiate multiple indices on one physical device */ 78 /* attribute to differentiate multiple indices on one physical device */
78 int index; 79 int index;
79 80
81 /* V4L2 file handles */
82 spinlock_t fh_lock; /* Lock for all v4l2_fhs */
83 struct list_head fh_list; /* List of struct v4l2_fh */
84
80 int debug; /* Activates debug level*/ 85 int debug; /* Activates debug level*/
81 86
82 /* Video standard vars */ 87 /* Video standard vars */
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
new file mode 100644
index 000000000000..3b86177c8cd2
--- /dev/null
+++ b/include/media/v4l2-event.h
@@ -0,0 +1,67 @@
1/*
2 * v4l2-event.h
3 *
4 * V4L2 events.
5 *
6 * Copyright (C) 2009--2010 Nokia Corporation.
7 *
8 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.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_EVENT_H
26#define V4L2_EVENT_H
27
28#include <linux/types.h>
29#include <linux/videodev2.h>
30#include <linux/wait.h>
31
32struct v4l2_fh;
33struct video_device;
34
35struct v4l2_kevent {
36 struct list_head list;
37 struct v4l2_event event;
38};
39
40struct v4l2_subscribed_event {
41 struct list_head list;
42 u32 type;
43};
44
45struct v4l2_events {
46 wait_queue_head_t wait;
47 struct list_head subscribed; /* Subscribed events */
48 struct list_head free; /* Events ready for use */
49 struct list_head available; /* Dequeueable event */
50 unsigned int navailable;
51 unsigned int nallocated; /* Number of allocated events */
52 u32 sequence;
53};
54
55int v4l2_event_init(struct v4l2_fh *fh);
56int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n);
57void v4l2_event_free(struct v4l2_fh *fh);
58int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event,
59 int nonblocking);
60void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
61int v4l2_event_pending(struct v4l2_fh *fh);
62int v4l2_event_subscribe(struct v4l2_fh *fh,
63 struct v4l2_event_subscription *sub);
64int v4l2_event_unsubscribe(struct v4l2_fh *fh,
65 struct v4l2_event_subscription *sub);
66
67#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
new file mode 100644
index 000000000000..1d72dde320bf
--- /dev/null
+++ b/include/media/v4l2-fh.h
@@ -0,0 +1,65 @@
1/*
2 * v4l2-fh.h
3 *
4 * V4L2 file handle. Store per file handle data for the V4L2
5 * framework. Using file handles is optional for the drivers.
6 *
7 * Copyright (C) 2009--2010 Nokia Corporation.
8 *
9 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.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
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 */
25
26#ifndef V4L2_FH_H
27#define V4L2_FH_H
28
29#include <linux/list.h>
30
31struct video_device;
32struct v4l2_events;
33
34struct v4l2_fh {
35 struct list_head list;
36 struct video_device *vdev;
37 struct v4l2_events *events; /* events, pending and subscribed */
38};
39
40/*
41 * Initialise the file handle. Parts of the V4L2 framework using the
42 * file handles should be initialised in this function. Must be called
43 * from driver's v4l2_file_operations->open() handler if the driver
44 * uses v4l2_fh.
45 */
46int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
47/*
48 * Add the fh to the list of file handles on a video_device. The file
49 * handle must be initialised first.
50 */
51void v4l2_fh_add(struct v4l2_fh *fh);
52/*
53 * Remove file handle from the list of file handles. Must be called in
54 * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
55 */
56void v4l2_fh_del(struct v4l2_fh *fh);
57/*
58 * Release resources related to a file handle. Parts of the V4L2
59 * framework using the v4l2_fh must release their resources here, too.
60 * Must be called in v4l2_file_operations->release() handler if the
61 * driver uses v4l2_fh.
62 */
63void v4l2_fh_exit(struct v4l2_fh *fh);
64
65#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e8ba0f2efbae..06daa6e8e051 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -21,6 +21,8 @@
21#include <linux/videodev2.h> 21#include <linux/videodev2.h>
22#endif 22#endif
23 23
24struct v4l2_fh;
25
24struct v4l2_ioctl_ops { 26struct v4l2_ioctl_ops {
25 /* ioctl callbacks */ 27 /* ioctl callbacks */
26 28
@@ -254,6 +256,11 @@ struct v4l2_ioctl_ops {
254 int (*vidioc_g_dv_timings) (struct file *file, void *fh, 256 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
255 struct v4l2_dv_timings *timings); 257 struct v4l2_dv_timings *timings);
256 258
259 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
260 struct v4l2_event_subscription *sub);
261 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
262 struct v4l2_event_subscription *sub);
263
257 /* For other private ioctls */ 264 /* For other private ioctls */
258 long (*vidioc_default) (struct file *file, void *fh, 265 long (*vidioc_default) (struct file *file, void *fh,
259 int cmd, void *arg); 266 int cmd, void *arg);
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
new file mode 100644
index 000000000000..8d149f1c58d0
--- /dev/null
+++ b/include/media/v4l2-mem2mem.h
@@ -0,0 +1,201 @@
1/*
2 * Memory-to-memory device framework for Video for Linux 2.
3 *
4 * Helper functions for devices that use memory buffers for both source
5 * and destination.
6 *
7 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
8 * Pawel Osciak, <p.osciak@samsung.com>
9 * Marek Szyprowski, <m.szyprowski@samsung.com>
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 the
13 * Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version
15 */
16
17#ifndef _MEDIA_V4L2_MEM2MEM_H
18#define _MEDIA_V4L2_MEM2MEM_H
19
20#include <media/videobuf-core.h>
21
22/**
23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks
24 * @device_run: required. Begin the actual job (transaction) inside this
25 * callback.
26 * The job does NOT have to end before this callback returns
27 * (and it will be the usual case). When the job finishes,
28 * v4l2_m2m_job_finish() has to be called.
29 * @job_ready: optional. Should return 0 if the driver does not have a job
30 * fully prepared to run yet (i.e. it will not be able to finish a
31 * transaction without sleeping). If not provided, it will be
32 * assumed that one source and one destination buffer are all
33 * that is required for the driver to perform one full transaction.
34 * This method may not sleep.
35 * @job_abort: required. Informs the driver that it has to abort the currently
36 * running transaction as soon as possible (i.e. as soon as it can
37 * stop the device safely; e.g. in the next interrupt handler),
38 * even if the transaction would not have been finished by then.
39 * After the driver performs the necessary steps, it has to call
40 * v4l2_m2m_job_finish() (as if the transaction ended normally).
41 * This function does not have to (and will usually not) wait
42 * until the device enters a state when it can be stopped.
43 */
44struct v4l2_m2m_ops {
45 void (*device_run)(void *priv);
46 int (*job_ready)(void *priv);
47 void (*job_abort)(void *priv);
48};
49
50struct v4l2_m2m_dev;
51
52struct v4l2_m2m_queue_ctx {
53/* private: internal use only */
54 struct videobuf_queue q;
55
56 /* Queue for buffers ready to be processed as soon as this
57 * instance receives access to the device */
58 struct list_head rdy_queue;
59 u8 num_rdy;
60};
61
62struct v4l2_m2m_ctx {
63/* private: internal use only */
64 struct v4l2_m2m_dev *m2m_dev;
65
66 /* Capture (output to memory) queue context */
67 struct v4l2_m2m_queue_ctx cap_q_ctx;
68
69 /* Output (input from memory) queue context */
70 struct v4l2_m2m_queue_ctx out_q_ctx;
71
72 /* For device job queue */
73 struct list_head queue;
74 unsigned long job_flags;
75
76 /* Instance private data */
77 void *priv;
78};
79
80void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
81
82struct videobuf_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
83 enum v4l2_buf_type type);
84
85void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
86 struct v4l2_m2m_ctx *m2m_ctx);
87
88int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
89 struct v4l2_requestbuffers *reqbufs);
90
91int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
92 struct v4l2_buffer *buf);
93
94int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
95 struct v4l2_buffer *buf);
96int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
97 struct v4l2_buffer *buf);
98
99int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
100 enum v4l2_buf_type type);
101int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
102 enum v4l2_buf_type type);
103
104unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
105 struct poll_table_struct *wait);
106
107int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
108 struct vm_area_struct *vma);
109
110struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops);
111void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
112
113struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(void *priv, struct v4l2_m2m_dev *m2m_dev,
114 void (*vq_init)(void *priv, struct videobuf_queue *,
115 enum v4l2_buf_type));
116void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx);
117
118void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct videobuf_queue *vq,
119 struct videobuf_buffer *vb);
120
121/**
122 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for
123 * use
124 */
125static inline
126unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
127{
128 return m2m_ctx->cap_q_ctx.num_rdy;
129}
130
131/**
132 * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers
133 * ready for use
134 */
135static inline
136unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
137{
138 return m2m_ctx->out_q_ctx.num_rdy;
139}
140
141void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type);
142
143/**
144 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready
145 * buffers
146 */
147static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
148{
149 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
150}
151
152/**
153 * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of
154 * ready buffers
155 */
156static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
157{
158 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
159}
160
161/**
162 * v4l2_m2m_get_src_vq() - return videobuf_queue for source buffers
163 */
164static inline
165struct videobuf_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
166{
167 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
168}
169
170/**
171 * v4l2_m2m_get_dst_vq() - return videobuf_queue for destination buffers
172 */
173static inline
174struct videobuf_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx)
175{
176 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
177}
178
179void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx,
180 enum v4l2_buf_type type);
181
182/**
183 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready
184 * buffers and return it
185 */
186static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
187{
188 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
189}
190
191/**
192 * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of
193 * ready buffers and return it
194 */
195static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
196{
197 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
198}
199
200#endif /* _MEDIA_V4L2_MEM2MEM_H */
201
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 2bcdca0a57fc..a88889355ae0 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -184,28 +184,6 @@ struct v4l2_subdev_audio_ops {
184}; 184};
185 185
186/* 186/*
187 decode_vbi_line: video decoders that support sliced VBI need to implement
188 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
189 start of the VBI data that was generated by the decoder. The driver
190 then parses the sliced VBI data and sets the other fields in the
191 struct accordingly. The pointer p is updated to point to the start of
192 the payload which can be copied verbatim into the data field of the
193 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
194 type field is set to 0 on return.
195
196 s_vbi_data: used to generate VBI signals on a video signal.
197 v4l2_sliced_vbi_data is filled with the data packets that should be
198 output. Note that if you set the line field to 0, then that VBI signal
199 is disabled. If no valid VBI data was found, then the type field is
200 set to 0 on return.
201
202 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
203 Not all video decoders support this. If no data is available because
204 the readback register contains invalid or erroneous data -EIO is
205 returned. Note that you must fill in the 'id' member and the 'field'
206 member (to determine whether CC data from the first or second field
207 should be obtained).
208
209 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 187 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
210 video input devices. 188 video input devices.
211 189
@@ -243,10 +221,6 @@ struct v4l2_subdev_audio_ops {
243struct v4l2_subdev_video_ops { 221struct v4l2_subdev_video_ops {
244 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 222 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
245 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); 223 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
246 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
247 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
248 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
249 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
250 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 224 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
251 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); 225 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
252 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); 226 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
@@ -262,6 +236,8 @@ struct v4l2_subdev_video_ops {
262 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 236 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
263 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 237 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
264 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 238 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
239 int (*enum_dv_presets) (struct v4l2_subdev *sd,
240 struct v4l2_dv_enum_preset *preset);
265 int (*s_dv_preset)(struct v4l2_subdev *sd, 241 int (*s_dv_preset)(struct v4l2_subdev *sd,
266 struct v4l2_dv_preset *preset); 242 struct v4l2_dv_preset *preset);
267 int (*query_dv_preset)(struct v4l2_subdev *sd, 243 int (*query_dv_preset)(struct v4l2_subdev *sd,
@@ -280,6 +256,45 @@ struct v4l2_subdev_video_ops {
280 struct v4l2_mbus_framefmt *fmt); 256 struct v4l2_mbus_framefmt *fmt);
281}; 257};
282 258
259/*
260 decode_vbi_line: video decoders that support sliced VBI need to implement
261 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
262 start of the VBI data that was generated by the decoder. The driver
263 then parses the sliced VBI data and sets the other fields in the
264 struct accordingly. The pointer p is updated to point to the start of
265 the payload which can be copied verbatim into the data field of the
266 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
267 type field is set to 0 on return.
268
269 s_vbi_data: used to generate VBI signals on a video signal.
270 v4l2_sliced_vbi_data is filled with the data packets that should be
271 output. Note that if you set the line field to 0, then that VBI signal
272 is disabled. If no valid VBI data was found, then the type field is
273 set to 0 on return.
274
275 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
276 Not all video decoders support this. If no data is available because
277 the readback register contains invalid or erroneous data -EIO is
278 returned. Note that you must fill in the 'id' member and the 'field'
279 member (to determine whether CC data from the first or second field
280 should be obtained).
281
282 s_raw_fmt: setup the video encoder/decoder for raw VBI.
283
284 g_sliced_fmt: retrieve the current sliced VBI settings.
285
286 s_sliced_fmt: setup the sliced VBI settings.
287 */
288struct v4l2_subdev_vbi_ops {
289 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
290 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
291 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
292 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
293 int (*s_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
294 int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
295 int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
296};
297
283/** 298/**
284 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations 299 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
285 * @g_skip_top_lines: number of lines at the top of the image to be skipped. 300 * @g_skip_top_lines: number of lines at the top of the image to be skipped.
@@ -379,6 +394,7 @@ struct v4l2_subdev_ops {
379 const struct v4l2_subdev_tuner_ops *tuner; 394 const struct v4l2_subdev_tuner_ops *tuner;
380 const struct v4l2_subdev_audio_ops *audio; 395 const struct v4l2_subdev_audio_ops *audio;
381 const struct v4l2_subdev_video_ops *video; 396 const struct v4l2_subdev_video_ops *video;
397 const struct v4l2_subdev_vbi_ops *vbi;
382 const struct v4l2_subdev_ir_ops *ir; 398 const struct v4l2_subdev_ir_ops *ir;
383 const struct v4l2_subdev_sensor_ops *sensor; 399 const struct v4l2_subdev_sensor_ops *sensor;
384}; 400};
@@ -387,6 +403,8 @@ struct v4l2_subdev_ops {
387 403
388/* Set this flag if this subdev is a i2c device. */ 404/* Set this flag if this subdev is a i2c device. */
389#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) 405#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
406/* Set this flag if this subdev is a spi device. */
407#define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
390 408
391/* Each instance of a subdev driver should create this struct, either 409/* Each instance of a subdev driver should create this struct, either
392 stand-alone or embedded in a larger struct. 410 stand-alone or embedded in a larger struct.
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 316fdccdcaa0..f91a736c133d 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -127,30 +127,16 @@ struct videobuf_queue_ops {
127struct videobuf_qtype_ops { 127struct videobuf_qtype_ops {
128 u32 magic; 128 u32 magic;
129 129
130 void *(*alloc) (size_t size); 130 struct videobuf_buffer *(*alloc)(size_t size);
131 void *(*vmalloc) (struct videobuf_buffer *buf); 131 void *(*vaddr) (struct videobuf_buffer *buf);
132 int (*iolock) (struct videobuf_queue* q, 132 int (*iolock) (struct videobuf_queue *q,
133 struct videobuf_buffer *vb, 133 struct videobuf_buffer *vb,
134 struct v4l2_framebuffer *fbuf); 134 struct v4l2_framebuffer *fbuf);
135 int (*mmap) (struct videobuf_queue *q, 135 int (*sync) (struct videobuf_queue *q,
136 unsigned int *count,
137 unsigned int *size,
138 enum v4l2_memory memory);
139 int (*sync) (struct videobuf_queue* q,
140 struct videobuf_buffer *buf); 136 struct videobuf_buffer *buf);
141 int (*video_copy_to_user)(struct videobuf_queue *q,
142 char __user *data,
143 size_t count,
144 int nonblocking);
145 int (*copy_stream) (struct videobuf_queue *q,
146 char __user *data,
147 size_t count,
148 size_t pos,
149 int vbihack,
150 int nonblocking);
151 int (*mmap_free) (struct videobuf_queue *q);
152 int (*mmap_mapper) (struct videobuf_queue *q, 137 int (*mmap_mapper) (struct videobuf_queue *q,
153 struct vm_area_struct *vma); 138 struct videobuf_buffer *buf,
139 struct vm_area_struct *vma);
154}; 140};
155 141
156struct videobuf_queue { 142struct videobuf_queue {
@@ -171,7 +157,6 @@ struct videobuf_queue {
171 157
172 unsigned int streaming:1; 158 unsigned int streaming:1;
173 unsigned int reading:1; 159 unsigned int reading:1;
174 unsigned int is_mmapped:1;
175 160
176 /* capture via mmap() + ioctl(QBUF/DQBUF) */ 161 /* capture via mmap() + ioctl(QBUF/DQBUF) */
177 struct list_head stream; 162 struct list_head stream;
@@ -185,14 +170,14 @@ struct videobuf_queue {
185}; 170};
186 171
187int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); 172int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
188int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, 173int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
189 struct v4l2_framebuffer *fbuf); 174 struct v4l2_framebuffer *fbuf);
190 175
191void *videobuf_alloc(struct videobuf_queue* q); 176struct videobuf_buffer *videobuf_alloc(struct videobuf_queue *q);
192 177
193/* Used on videobuf-dvb */ 178/* Used on videobuf-dvb */
194void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, 179void *videobuf_queue_to_vaddr(struct videobuf_queue *q,
195 struct videobuf_buffer *buf); 180 struct videobuf_buffer *buf);
196 181
197void videobuf_queue_core_init(struct videobuf_queue *q, 182void videobuf_queue_core_init(struct videobuf_queue *q,
198 const struct videobuf_queue_ops *ops, 183 const struct videobuf_queue_ops *ops,
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index 53e72f787175..a195f3b9c00a 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -17,6 +17,8 @@
17 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 18 * the Free Software Foundation; either version 2
19 */ 19 */
20#ifndef _VIDEOBUF_DMA_SG_H
21#define _VIDEOBUF_DMA_SG_H
20 22
21#include <media/videobuf-core.h> 23#include <media/videobuf-core.h>
22 24
@@ -27,14 +29,14 @@
27 * block (NULL on errors). Memory for the scatterlist is allocated 29 * block (NULL on errors). Memory for the scatterlist is allocated
28 * using kmalloc. The caller must free the memory. 30 * using kmalloc. The caller must free the memory.
29 */ 31 */
30struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); 32struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
31 33
32/* 34/*
33 * Return a scatterlist for a an array of userpages (NULL on errors). 35 * Return a scatterlist for a an array of userpages (NULL on errors).
34 * Memory for the scatterlist is allocated using kmalloc. The caller 36 * Memory for the scatterlist is allocated using kmalloc. The caller
35 * must free the memory. 37 * must free the memory.
36 */ 38 */
37struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, 39struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages,
38 int offset); 40 int offset);
39 41
40/* --------------------------------------------------------------------- */ 42/* --------------------------------------------------------------------- */
@@ -78,8 +80,7 @@ struct videobuf_dmabuf {
78 int direction; 80 int direction;
79}; 81};
80 82
81struct videobuf_dma_sg_memory 83struct videobuf_dma_sg_memory {
82{
83 u32 magic; 84 u32 magic;
84 85
85 /* for mmap'ed buffers */ 86 /* for mmap'ed buffers */
@@ -95,14 +96,13 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
95 dma_addr_t addr, int nr_pages); 96 dma_addr_t addr, int nr_pages);
96int videobuf_dma_free(struct videobuf_dmabuf *dma); 97int videobuf_dma_free(struct videobuf_dmabuf *dma);
97 98
98int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 99int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
99int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 100int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
100int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 101struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
101struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf);
102 102
103void *videobuf_sg_alloc(size_t size); 103void *videobuf_sg_alloc(size_t size);
104 104
105void videobuf_queue_sg_init(struct videobuf_queue* q, 105void videobuf_queue_sg_init(struct videobuf_queue *q,
106 const struct videobuf_queue_ops *ops, 106 const struct videobuf_queue_ops *ops,
107 struct device *dev, 107 struct device *dev,
108 spinlock_t *irqlock, 108 spinlock_t *irqlock,
@@ -111,9 +111,11 @@ void videobuf_queue_sg_init(struct videobuf_queue* q,
111 unsigned int msize, 111 unsigned int msize,
112 void *priv); 112 void *priv);
113 113
114 /*FIXME: these variants are used only on *-alsa code, where videobuf is 114/*FIXME: these variants are used only on *-alsa code, where videobuf is
115 * used without queue 115 * used without queue
116 */ 116 */
117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma); 117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); 118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
119 119
120#endif /* _VIDEOBUF_DMA_SG_H */
121
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index 4b419a257a7d..851eb1a2ff2a 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -19,17 +19,17 @@
19 19
20/* --------------------------------------------------------------------- */ 20/* --------------------------------------------------------------------- */
21 21
22struct videobuf_vmalloc_memory 22struct videobuf_vmalloc_memory {
23{
24 u32 magic; 23 u32 magic;
25 24
26 void *vmalloc; 25 void *vmalloc;
27 26
28 /* remap_vmalloc_range seems to need to run after mmap() on some cases */ 27 /* remap_vmalloc_range seems to need to run
28 * after mmap() on some cases */
29 struct vm_area_struct *vma; 29 struct vm_area_struct *vma;
30}; 30};
31 31
32void videobuf_queue_vmalloc_init(struct videobuf_queue* q, 32void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
33 const struct videobuf_queue_ops *ops, 33 const struct videobuf_queue_ops *ops,
34 struct device *dev, 34 struct device *dev,
35 spinlock_t *irqlock, 35 spinlock_t *irqlock,
@@ -38,8 +38,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
38 unsigned int msize, 38 unsigned int msize,
39 void *priv); 39 void *priv);
40 40
41void *videobuf_to_vmalloc (struct videobuf_buffer *buf); 41void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
42 42
43void videobuf_vmalloc_free (struct videobuf_buffer *buf); 43void videobuf_vmalloc_free(struct videobuf_buffer *buf);
44 44
45#endif 45#endif