aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
Diffstat (limited to 'include/media')
-rw-r--r--include/media/m5mols.h4
-rw-r--r--include/media/mt9p031.h19
-rw-r--r--include/media/mt9t001.h8
-rw-r--r--include/media/omap3isp.h140
-rw-r--r--include/media/ov772x.h26
-rw-r--r--include/media/rc-core.h7
-rw-r--r--include/media/rc-map.h3
-rw-r--r--include/media/s5k6aa.h51
-rw-r--r--include/media/s5p_fimc.h18
-rw-r--r--include/media/saa7146.h39
-rw-r--r--include/media/soc_camera.h104
-rw-r--r--include/media/soc_camera_platform.h4
-rw-r--r--include/media/soc_mediabus.h2
-rw-r--r--include/media/v4l2-chip-ident.h3
-rw-r--r--include/media/v4l2-ctrls.h15
-rw-r--r--include/media/v4l2-int-device.h3
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-mediabus.h12
-rw-r--r--include/media/v4l2-subdev.h5
-rw-r--r--include/media/videobuf2-core.h71
-rw-r--r--include/media/videobuf2-dma-contig.h6
21 files changed, 384 insertions, 158 deletions
diff --git a/include/media/m5mols.h b/include/media/m5mols.h
index aac2c0e06d5e..4a825ae5c6c8 100644
--- a/include/media/m5mols.h
+++ b/include/media/m5mols.h
@@ -18,15 +18,13 @@
18 18
19/** 19/**
20 * struct m5mols_platform_data - platform data for M-5MOLS driver 20 * struct m5mols_platform_data - platform data for M-5MOLS driver
21 * @irq: GPIO getting the irq pin of M-5MOLS
22 * @gpio_reset: GPIO driving the reset pin of M-5MOLS 21 * @gpio_reset: GPIO driving the reset pin of M-5MOLS
23 * @reset_polarity: active state for gpio_rst pin, 0 or 1 22 * @reset_polarity: active state for gpio_reset pin, 0 or 1
24 * @set_power: an additional callback to the board setup code 23 * @set_power: an additional callback to the board setup code
25 * to be called after enabling and before disabling 24 * to be called after enabling and before disabling
26 * the sensor's supply regulators 25 * the sensor's supply regulators
27 */ 26 */
28struct m5mols_platform_data { 27struct m5mols_platform_data {
29 int irq;
30 int gpio_reset; 28 int gpio_reset;
31 u8 reset_polarity; 29 u8 reset_polarity;
32 int (*set_power)(struct device *dev, int on); 30 int (*set_power)(struct device *dev, int on);
diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h
new file mode 100644
index 000000000000..96448c7a318b
--- /dev/null
+++ b/include/media/mt9p031.h
@@ -0,0 +1,19 @@
1#ifndef MT9P031_H
2#define MT9P031_H
3
4struct v4l2_subdev;
5
6enum {
7 MT9P031_COLOR_VERSION,
8 MT9P031_MONOCHROME_VERSION,
9};
10
11struct mt9p031_platform_data {
12 int (*set_xclk)(struct v4l2_subdev *subdev, int hz);
13 int (*reset)(struct v4l2_subdev *subdev, int active);
14 int ext_freq; /* input frequency to the mt9p031 for PLL dividers */
15 int target_freq; /* frequency target for the PLL */
16 int version; /* MT9P031_COLOR_VERSION or MT9P031_MONOCHROME_VERSION */
17};
18
19#endif
diff --git a/include/media/mt9t001.h b/include/media/mt9t001.h
new file mode 100644
index 000000000000..e839a78bb9c5
--- /dev/null
+++ b/include/media/mt9t001.h
@@ -0,0 +1,8 @@
1#ifndef _MEDIA_MT9T001_H
2#define _MEDIA_MT9T001_H
3
4struct mt9t001_platform_data {
5 unsigned int clk_pol:1;
6};
7
8#endif
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
new file mode 100644
index 000000000000..e917b1da6577
--- /dev/null
+++ b/include/media/omap3isp.h
@@ -0,0 +1,140 @@
1/*
2 * omap3isp.h
3 *
4 * TI OMAP3 ISP - Platform data
5 *
6 * Copyright (C) 2011 Nokia Corporation
7 *
8 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 * Sakari Ailus <sakari.ailus@iki.fi>
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 version 2 as
13 * 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 __MEDIA_OMAP3ISP_H__
27#define __MEDIA_OMAP3ISP_H__
28
29struct i2c_board_info;
30struct isp_device;
31
32enum isp_interface_type {
33 ISP_INTERFACE_PARALLEL,
34 ISP_INTERFACE_CSI2A_PHY2,
35 ISP_INTERFACE_CCP2B_PHY1,
36 ISP_INTERFACE_CCP2B_PHY2,
37 ISP_INTERFACE_CSI2C_PHY1,
38};
39
40enum {
41 ISP_BRIDGE_DISABLE = 0,
42 ISP_BRIDGE_LITTLE_ENDIAN = 2,
43 ISP_BRIDGE_BIG_ENDIAN = 3,
44};
45
46enum {
47 ISP_LANE_SHIFT_0 = 0,
48 ISP_LANE_SHIFT_2 = 1,
49 ISP_LANE_SHIFT_4 = 2,
50 ISP_LANE_SHIFT_6 = 3,
51};
52
53/**
54 * struct isp_parallel_platform_data - Parallel interface platform data
55 * @data_lane_shift: Data lane shifter
56 * ISP_LANE_SHIFT_0 - CAMEXT[13:0] -> CAM[13:0]
57 * ISP_LANE_SHIFT_2 - CAMEXT[13:2] -> CAM[11:0]
58 * ISP_LANE_SHIFT_4 - CAMEXT[13:4] -> CAM[9:0]
59 * ISP_LANE_SHIFT_6 - CAMEXT[13:6] -> CAM[7:0]
60 * @clk_pol: Pixel clock polarity
61 * 0 - Non Inverted, 1 - Inverted
62 * @hs_pol: Horizontal synchronization polarity
63 * 0 - Active high, 1 - Active low
64 * @vs_pol: Vertical synchronization polarity
65 * 0 - Active high, 1 - Active low
66 * @bridge: CCDC Bridge input control
67 * ISP_BRIDGE_DISABLE - Disable
68 * ISP_BRIDGE_LITTLE_ENDIAN - Little endian
69 * ISP_BRIDGE_BIG_ENDIAN - Big endian
70 */
71struct isp_parallel_platform_data {
72 unsigned int data_lane_shift:2;
73 unsigned int clk_pol:1;
74 unsigned int hs_pol:1;
75 unsigned int vs_pol:1;
76 unsigned int bridge:2;
77};
78
79enum {
80 ISP_CCP2_PHY_DATA_CLOCK = 0,
81 ISP_CCP2_PHY_DATA_STROBE = 1,
82};
83
84enum {
85 ISP_CCP2_MODE_MIPI = 0,
86 ISP_CCP2_MODE_CCP2 = 1,
87};
88
89/**
90 * struct isp_ccp2_platform_data - CCP2 interface platform data
91 * @strobe_clk_pol: Strobe/clock polarity
92 * 0 - Non Inverted, 1 - Inverted
93 * @crc: Enable the cyclic redundancy check
94 * @ccp2_mode: Enable CCP2 compatibility mode
95 * ISP_CCP2_MODE_MIPI - MIPI-CSI1 mode
96 * ISP_CCP2_MODE_CCP2 - CCP2 mode
97 * @phy_layer: Physical layer selection
98 * ISP_CCP2_PHY_DATA_CLOCK - Data/clock physical layer
99 * ISP_CCP2_PHY_DATA_STROBE - Data/strobe physical layer
100 * @vpclk_div: Video port output clock control
101 */
102struct isp_ccp2_platform_data {
103 unsigned int strobe_clk_pol:1;
104 unsigned int crc:1;
105 unsigned int ccp2_mode:1;
106 unsigned int phy_layer:1;
107 unsigned int vpclk_div:2;
108};
109
110/**
111 * struct isp_csi2_platform_data - CSI2 interface platform data
112 * @crc: Enable the cyclic redundancy check
113 * @vpclk_div: Video port output clock control
114 */
115struct isp_csi2_platform_data {
116 unsigned crc:1;
117 unsigned vpclk_div:2;
118};
119
120struct isp_subdev_i2c_board_info {
121 struct i2c_board_info *board_info;
122 int i2c_adapter_id;
123};
124
125struct isp_v4l2_subdevs_group {
126 struct isp_subdev_i2c_board_info *subdevs;
127 enum isp_interface_type interface;
128 union {
129 struct isp_parallel_platform_data parallel;
130 struct isp_ccp2_platform_data ccp2;
131 struct isp_csi2_platform_data csi2;
132 } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */
133};
134
135struct isp_platform_data {
136 struct isp_v4l2_subdevs_group *subdevs;
137 void (*set_constraints)(struct isp_device *isp, bool enable);
138};
139
140#endif /* __MEDIA_OMAP3ISP_H__ */
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index 548bf1155c83..00dbb7c4feae 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -12,12 +12,9 @@
12#ifndef __OV772X_H__ 12#ifndef __OV772X_H__
13#define __OV772X_H__ 13#define __OV772X_H__
14 14
15#include <media/soc_camera.h>
16
17/* for flags */ 15/* for flags */
18#define OV772X_FLAG_VFLIP (1 << 0) /* Vertical flip image */ 16#define OV772X_FLAG_VFLIP (1 << 0) /* Vertical flip image */
19#define OV772X_FLAG_HFLIP (1 << 1) /* Horizontal flip image */ 17#define OV772X_FLAG_HFLIP (1 << 1) /* Horizontal flip image */
20#define OV772X_FLAG_8BIT (1 << 2) /* default 10 bit */
21 18
22/* 19/*
23 * for Edge ctrl 20 * for Edge ctrl
@@ -32,22 +29,23 @@ struct ov772x_edge_ctrl {
32 unsigned char lower; 29 unsigned char lower;
33}; 30};
34 31
35#define OV772X_MANUAL_EDGE_CTRL 0x80 /* un-used bit of strength */ 32#define OV772X_MANUAL_EDGE_CTRL 0x80 /* un-used bit of strength */
36#define EDGE_STRENGTH_MASK 0x1F 33#define OV772X_EDGE_STRENGTH_MASK 0x1F
37#define EDGE_THRESHOLD_MASK 0x0F 34#define OV772X_EDGE_THRESHOLD_MASK 0x0F
38#define EDGE_UPPER_MASK 0xFF 35#define OV772X_EDGE_UPPER_MASK 0xFF
39#define EDGE_LOWER_MASK 0xFF 36#define OV772X_EDGE_LOWER_MASK 0xFF
40 37
41#define OV772X_AUTO_EDGECTRL(u, l) \ 38#define OV772X_AUTO_EDGECTRL(u, l) \
42{ \ 39{ \
43 .upper = (u & EDGE_UPPER_MASK), \ 40 .upper = (u & OV772X_EDGE_UPPER_MASK), \
44 .lower = (l & EDGE_LOWER_MASK), \ 41 .lower = (l & OV772X_EDGE_LOWER_MASK), \
45} 42}
46 43
47#define OV772X_MANUAL_EDGECTRL(s, t) \ 44#define OV772X_MANUAL_EDGECTRL(s, t) \
48{ \ 45{ \
49 .strength = (s & EDGE_STRENGTH_MASK) | OV772X_MANUAL_EDGE_CTRL,\ 46 .strength = (s & OV772X_EDGE_STRENGTH_MASK) | \
50 .threshold = (t & EDGE_THRESHOLD_MASK), \ 47 OV772X_MANUAL_EDGE_CTRL, \
48 .threshold = (t & OV772X_EDGE_THRESHOLD_MASK), \
51} 49}
52 50
53/* 51/*
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index b1f19b77ecd4..b0c494a69079 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -23,8 +23,11 @@
23#include <media/rc-map.h> 23#include <media/rc-map.h>
24 24
25extern int rc_core_debug; 25extern int rc_core_debug;
26#define IR_dprintk(level, fmt, arg...) if (rc_core_debug >= level) \ 26#define IR_dprintk(level, fmt, ...) \
27 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) 27do { \
28 if (rc_core_debug >= level) \
29 pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \
30} while (0)
28 31
29enum rc_driver_type { 32enum rc_driver_type {
30 RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */ 33 RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 17c9759ae77b..26a3bd0fe57c 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -61,6 +61,7 @@ void rc_map_init(void);
61#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp" 61#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp"
62#define RC_MAP_ASUS_PC39 "rc-asus-pc39" 62#define RC_MAP_ASUS_PC39 "rc-asus-pc39"
63#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600" 63#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600"
64#define RC_MAP_ATI_X10 "rc-ati-x10"
64#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d" 65#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d"
65#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus" 66#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus"
66#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt" 67#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt"
@@ -106,6 +107,7 @@ void rc_map_init(void);
106#define RC_MAP_LIRC "rc-lirc" 107#define RC_MAP_LIRC "rc-lirc"
107#define RC_MAP_LME2510 "rc-lme2510" 108#define RC_MAP_LME2510 "rc-lme2510"
108#define RC_MAP_MANLI "rc-manli" 109#define RC_MAP_MANLI "rc-manli"
110#define RC_MAP_MEDION_X10 "rc-medion-x10"
109#define RC_MAP_MSI_DIGIVOX_II "rc-msi-digivox-ii" 111#define RC_MAP_MSI_DIGIVOX_II "rc-msi-digivox-ii"
110#define RC_MAP_MSI_DIGIVOX_III "rc-msi-digivox-iii" 112#define RC_MAP_MSI_DIGIVOX_III "rc-msi-digivox-iii"
111#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" 113#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus"
@@ -130,6 +132,7 @@ void rc_map_init(void);
130#define RC_MAP_RC5_TV "rc-rc5-tv" 132#define RC_MAP_RC5_TV "rc-rc5-tv"
131#define RC_MAP_RC6_MCE "rc-rc6-mce" 133#define RC_MAP_RC6_MCE "rc-rc6-mce"
132#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 134#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
135#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly"
133#define RC_MAP_STREAMZAP "rc-streamzap" 136#define RC_MAP_STREAMZAP "rc-streamzap"
134#define RC_MAP_TBS_NEC "rc-tbs-nec" 137#define RC_MAP_TBS_NEC "rc-tbs-nec"
135#define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2" 138#define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2"
diff --git a/include/media/s5k6aa.h b/include/media/s5k6aa.h
new file mode 100644
index 000000000000..ba34f7055e55
--- /dev/null
+++ b/include/media/s5k6aa.h
@@ -0,0 +1,51 @@
1/*
2 * S5K6AAFX camera sensor driver header
3 *
4 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
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#ifndef S5K6AA_H
13#define S5K6AA_H
14
15#include <media/v4l2-mediabus.h>
16
17/**
18 * struct s5k6aa_gpio - data structure describing a GPIO
19 * @gpio: GPIO number
20 * @level: indicates active state of the @gpio
21 */
22struct s5k6aa_gpio {
23 int gpio;
24 int level;
25};
26
27/**
28 * struct s5k6aa_platform_data - s5k6aa driver platform data
29 * @set_power: an additional callback to the board code, called
30 * after enabling the regulators and before switching
31 * the sensor off
32 * @mclk_frequency: sensor's master clock frequency in Hz
33 * @gpio_reset: GPIO driving RESET pin
34 * @gpio_stby: GPIO driving STBY pin
35 * @nlanes: maximum number of MIPI-CSI lanes used
36 * @horiz_flip: default horizontal image flip value, non zero to enable
37 * @vert_flip: default vertical image flip value, non zero to enable
38 */
39
40struct s5k6aa_platform_data {
41 int (*set_power)(int enable);
42 unsigned long mclk_frequency;
43 struct s5k6aa_gpio gpio_reset;
44 struct s5k6aa_gpio gpio_stby;
45 enum v4l2_mbus_type bus_type;
46 u8 nlanes;
47 u8 horiz_flip;
48 u8 vert_flip;
49};
50
51#endif /* S5K6AA_H */
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 9fdff8a4ed26..688fb3f1dc35 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -19,11 +19,6 @@ enum cam_bus_type {
19 FIMC_LCD_WB, /* FIFO link from LCD mixer */ 19 FIMC_LCD_WB, /* FIFO link from LCD mixer */
20}; 20};
21 21
22#define FIMC_CLK_INV_PCLK (1 << 0)
23#define FIMC_CLK_INV_VSYNC (1 << 1)
24#define FIMC_CLK_INV_HREF (1 << 2)
25#define FIMC_CLK_INV_HSYNC (1 << 3)
26
27struct i2c_board_info; 22struct i2c_board_info;
28 23
29/** 24/**
@@ -36,7 +31,8 @@ struct i2c_board_info;
36 * @csi_data_align: MIPI-CSI interface data alignment in bits 31 * @csi_data_align: MIPI-CSI interface data alignment in bits
37 * @i2c_bus_num: i2c control bus id the sensor is attached to 32 * @i2c_bus_num: i2c control bus id the sensor is attached to
38 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) 33 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
39 * @flags: flags defining bus signals polarity inversion (High by default) 34 * @clk_id: index of the SoC peripheral clock for sensors
35 * @flags: the parallel bus flags defining signals polarity (V4L2_MBUS_*)
40 */ 36 */
41struct s5p_fimc_isp_info { 37struct s5p_fimc_isp_info {
42 struct i2c_board_info *board_info; 38 struct i2c_board_info *board_info;
@@ -46,6 +42,7 @@ struct s5p_fimc_isp_info {
46 u16 i2c_bus_num; 42 u16 i2c_bus_num;
47 u16 mux_id; 43 u16 mux_id;
48 u16 flags; 44 u16 flags;
45 u8 clk_id;
49}; 46};
50 47
51/** 48/**
@@ -58,4 +55,13 @@ struct s5p_platform_fimc {
58 struct s5p_fimc_isp_info *isp_info; 55 struct s5p_fimc_isp_info *isp_info;
59 int num_clients; 56 int num_clients;
60}; 57};
58
59/*
60 * v4l2_device notification id. This is only for internal use in the kernel.
61 * Sensor subdevs should issue S5P_FIMC_TX_END_NOTIFY notification in single
62 * frame capture mode when there is only one VSYNC pulse issued by the sensor
63 * at begining of the frame transmission.
64 */
65#define S5P_FIMC_TX_END_NOTIFY _IO('e', 0)
66
61#endif /* S5P_FIMC_H_ */ 67#endif /* S5P_FIMC_H_ */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 79827143d5ac..0f037e8edf9a 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -1,7 +1,6 @@
1#ifndef __SAA7146__ 1#ifndef __SAA7146__
2#define __SAA7146__ 2#define __SAA7146__
3 3
4#include <linux/module.h> /* for module-version */
5#include <linux/delay.h> /* for delay-stuff */ 4#include <linux/delay.h> /* for delay-stuff */
6#include <linux/slab.h> /* for kmalloc/kfree */ 5#include <linux/slab.h> /* for kmalloc/kfree */
7#include <linux/pci.h> /* for pci-config-stuff, vendor ids etc. */ 6#include <linux/pci.h> /* for pci-config-stuff, vendor ids etc. */
@@ -25,28 +24,38 @@
25 24
26extern unsigned int saa7146_debug; 25extern unsigned int saa7146_debug;
27 26
28//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__func__)
29
30#ifndef DEBUG_VARIABLE 27#ifndef DEBUG_VARIABLE
31 #define DEBUG_VARIABLE saa7146_debug 28 #define DEBUG_VARIABLE saa7146_debug
32#endif 29#endif
33 30
34#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME, __func__) 31#define ERR(fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__)
35#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; } 32
36 33#define _DBG(mask, fmt, ...) \
37#define ERR(x) { DEBUG_PROLOG; printk x; } 34do { \
38 35 if (DEBUG_VARIABLE & mask) \
39#define DEB_S(x) if (0!=(DEBUG_VARIABLE&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */ 36 pr_debug("%s(): " fmt, __func__, ##__VA_ARGS__); \
40#define DEB_D(x) if (0!=(DEBUG_VARIABLE&0x02)) { DEBUG_PROLOG; printk x; } /* more detailed debug messages */ 37} while (0)
41#define DEB_EE(x) if (0!=(DEBUG_VARIABLE&0x04)) { DEBUG_PROLOG; printk x; } /* print enter and exit of functions */ 38
42#define DEB_I2C(x) if (0!=(DEBUG_VARIABLE&0x08)) { DEBUG_PROLOG; printk x; } /* i2c debug messages */ 39/* simple debug messages */
43#define DEB_VBI(x) if (0!=(DEBUG_VARIABLE&0x10)) { DEBUG_PROLOG; printk x; } /* vbi debug messages */ 40#define DEB_S(fmt, ...) _DBG(0x01, fmt, ##__VA_ARGS__)
44#define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */ 41/* more detailed debug messages */
45#define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */ 42#define DEB_D(fmt, ...) _DBG(0x02, fmt, ##__VA_ARGS__)
43/* print enter and exit of functions */
44#define DEB_EE(fmt, ...) _DBG(0x04, fmt, ##__VA_ARGS__)
45/* i2c debug messages */
46#define DEB_I2C(fmt, ...) _DBG(0x08, fmt, ##__VA_ARGS__)
47/* vbi debug messages */
48#define DEB_VBI(fmt, ...) _DBG(0x10, fmt, ##__VA_ARGS__)
49/* interrupt debug messages */
50#define DEB_INT(fmt, ...) _DBG(0x20, fmt, ##__VA_ARGS__)
51/* capture debug messages */
52#define DEB_CAP(fmt, ...) _DBG(0x40, fmt, ##__VA_ARGS__)
46 53
47#define SAA7146_ISR_CLEAR(x,y) \ 54#define SAA7146_ISR_CLEAR(x,y) \
48 saa7146_write(x, ISR, (y)); 55 saa7146_write(x, ISR, (y));
49 56
57struct module;
58
50struct saa7146_dev; 59struct saa7146_dev;
51struct saa7146_extension; 60struct saa7146_extension;
52struct saa7146_vv; 61struct saa7146_vv;
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 7582952dceae..b1377b931eb7 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -12,12 +12,14 @@
12#ifndef SOC_CAMERA_H 12#ifndef SOC_CAMERA_H
13#define SOC_CAMERA_H 13#define SOC_CAMERA_H
14 14
15#include <linux/bitops.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/mutex.h> 17#include <linux/mutex.h>
17#include <linux/pm.h> 18#include <linux/pm.h>
18#include <linux/videodev2.h> 19#include <linux/videodev2.h>
19#include <media/videobuf-core.h> 20#include <media/videobuf-core.h>
20#include <media/videobuf2-core.h> 21#include <media/videobuf2-core.h>
22#include <media/v4l2-ctrls.h>
21#include <media/v4l2-device.h> 23#include <media/v4l2-device.h>
22 24
23struct file; 25struct file;
@@ -37,8 +39,8 @@ struct soc_camera_device {
37 unsigned char iface; /* Host number */ 39 unsigned char iface; /* Host number */
38 unsigned char devnum; /* Device number per host */ 40 unsigned char devnum; /* Device number per host */
39 struct soc_camera_sense *sense; /* See comment in struct definition */ 41 struct soc_camera_sense *sense; /* See comment in struct definition */
40 struct soc_camera_ops *ops;
41 struct video_device *vdev; 42 struct video_device *vdev;
43 struct v4l2_ctrl_handler ctrl_handler;
42 const struct soc_camera_format_xlate *current_fmt; 44 const struct soc_camera_format_xlate *current_fmt;
43 struct soc_camera_format_xlate *user_formats; 45 struct soc_camera_format_xlate *user_formats;
44 int num_user_formats; 46 int num_user_formats;
@@ -93,14 +95,10 @@ struct soc_camera_host_ops {
93 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *); 95 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *);
94 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 96 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
95 int (*set_bus_param)(struct soc_camera_device *, __u32); 97 int (*set_bus_param)(struct soc_camera_device *, __u32);
96 int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
97 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
98 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 98 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
99 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 99 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
100 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *); 100 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
101 unsigned int (*poll)(struct file *, poll_table *); 101 unsigned int (*poll)(struct file *, poll_table *);
102 const struct v4l2_queryctrl *controls;
103 int num_controls;
104}; 102};
105 103
106#define SOCAM_SENSOR_INVERT_PCLK (1 << 0) 104#define SOCAM_SENSOR_INVERT_PCLK (1 << 0)
@@ -193,13 +191,6 @@ struct soc_camera_format_xlate {
193 const struct soc_mbus_pixelfmt *host_fmt; 191 const struct soc_mbus_pixelfmt *host_fmt;
194}; 192};
195 193
196struct soc_camera_ops {
197 unsigned long (*query_bus_param)(struct soc_camera_device *);
198 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
199 const struct v4l2_queryctrl *controls;
200 int num_controls;
201};
202
203#define SOCAM_SENSE_PCLK_CHANGED (1 << 0) 194#define SOCAM_SENSE_PCLK_CHANGED (1 << 0)
204 195
205/** 196/**
@@ -226,65 +217,18 @@ struct soc_camera_sense {
226 unsigned long pixel_clock; 217 unsigned long pixel_clock;
227}; 218};
228 219
229static inline struct v4l2_queryctrl const *soc_camera_find_qctrl( 220#define SOCAM_DATAWIDTH(x) BIT((x) - 1)
230 struct soc_camera_ops *ops, int id) 221#define SOCAM_DATAWIDTH_4 SOCAM_DATAWIDTH(4)
231{ 222#define SOCAM_DATAWIDTH_8 SOCAM_DATAWIDTH(8)
232 int i; 223#define SOCAM_DATAWIDTH_9 SOCAM_DATAWIDTH(9)
233 224#define SOCAM_DATAWIDTH_10 SOCAM_DATAWIDTH(10)
234 for (i = 0; i < ops->num_controls; i++) 225#define SOCAM_DATAWIDTH_15 SOCAM_DATAWIDTH(15)
235 if (ops->controls[i].id == id) 226#define SOCAM_DATAWIDTH_16 SOCAM_DATAWIDTH(16)
236 return &ops->controls[i];
237
238 return NULL;
239}
240
241#define SOCAM_MASTER (1 << 0)
242#define SOCAM_SLAVE (1 << 1)
243#define SOCAM_HSYNC_ACTIVE_HIGH (1 << 2)
244#define SOCAM_HSYNC_ACTIVE_LOW (1 << 3)
245#define SOCAM_VSYNC_ACTIVE_HIGH (1 << 4)
246#define SOCAM_VSYNC_ACTIVE_LOW (1 << 5)
247#define SOCAM_DATAWIDTH_4 (1 << 6)
248#define SOCAM_DATAWIDTH_8 (1 << 7)
249#define SOCAM_DATAWIDTH_9 (1 << 8)
250#define SOCAM_DATAWIDTH_10 (1 << 9)
251#define SOCAM_DATAWIDTH_15 (1 << 10)
252#define SOCAM_DATAWIDTH_16 (1 << 11)
253#define SOCAM_PCLK_SAMPLE_RISING (1 << 12)
254#define SOCAM_PCLK_SAMPLE_FALLING (1 << 13)
255#define SOCAM_DATA_ACTIVE_HIGH (1 << 14)
256#define SOCAM_DATA_ACTIVE_LOW (1 << 15)
257#define SOCAM_MIPI_1LANE (1 << 16)
258#define SOCAM_MIPI_2LANE (1 << 17)
259#define SOCAM_MIPI_3LANE (1 << 18)
260#define SOCAM_MIPI_4LANE (1 << 19)
261#define SOCAM_MIPI (SOCAM_MIPI_1LANE | SOCAM_MIPI_2LANE | \
262 SOCAM_MIPI_3LANE | SOCAM_MIPI_4LANE)
263 227
264#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \ 228#define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \
265 SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ 229 SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \
266 SOCAM_DATAWIDTH_15 | SOCAM_DATAWIDTH_16) 230 SOCAM_DATAWIDTH_15 | SOCAM_DATAWIDTH_16)
267 231
268static inline unsigned long soc_camera_bus_param_compatible(
269 unsigned long camera_flags, unsigned long bus_flags)
270{
271 unsigned long common_flags, hsync, vsync, pclk, data, buswidth, mode;
272 unsigned long mipi;
273
274 common_flags = camera_flags & bus_flags;
275
276 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW);
277 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW);
278 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING);
279 data = common_flags & (SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_LOW);
280 mode = common_flags & (SOCAM_MASTER | SOCAM_SLAVE);
281 buswidth = common_flags & SOCAM_DATAWIDTH_MASK;
282 mipi = common_flags & SOCAM_MIPI;
283
284 return ((!hsync || !vsync || !pclk || !data || !mode || !buswidth) && !mipi) ? 0 :
285 common_flags;
286}
287
288static inline void soc_camera_limit_side(int *start, int *length, 232static inline void soc_camera_limit_side(int *start, int *length,
289 unsigned int start_min, 233 unsigned int start_min,
290 unsigned int length_min, unsigned int length_max) 234 unsigned int length_min, unsigned int length_max)
@@ -300,23 +244,37 @@ static inline void soc_camera_limit_side(int *start, int *length,
300 *start = start_min + length_max - *length; 244 *start = start_min + length_max - *length;
301} 245}
302 246
303extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 247unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
304 unsigned long flags); 248 unsigned long flags);
249unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
250 const struct v4l2_mbus_config *cfg);
305 251
306/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 252/* This is only temporary here - until v4l2-subdev begins to link to video_device */
307#include <linux/i2c.h> 253#include <linux/i2c.h>
308static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client) 254static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
255{
256 struct v4l2_subdev *sd = i2c_get_clientdata(client);
257 struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id;
258 return icd ? icd->vdev : NULL;
259}
260
261static inline struct soc_camera_link *soc_camera_i2c_to_link(const struct i2c_client *client)
262{
263 return client->dev.platform_data;
264}
265
266static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev)
309{ 267{
310 struct soc_camera_device *icd = client->dev.platform_data; 268 struct soc_camera_device *icd = dev_get_drvdata(vdev->parent);
311 return icd->vdev; 269 return soc_camera_to_subdev(icd);
312} 270}
313 271
314static inline struct soc_camera_device *soc_camera_from_vb2q(struct vb2_queue *vq) 272static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq)
315{ 273{
316 return container_of(vq, struct soc_camera_device, vb2_vidq); 274 return container_of(vq, struct soc_camera_device, vb2_vidq);
317} 275}
318 276
319static inline struct soc_camera_device *soc_camera_from_vbq(struct videobuf_queue *vq) 277static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobuf_queue *vq)
320{ 278{
321 return container_of(vq, struct soc_camera_device, vb_vidq); 279 return container_of(vq, struct soc_camera_device, vb_vidq);
322} 280}
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index 74f0fa15ca47..8aa4200a0b1d 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/videodev2.h> 14#include <linux/videodev2.h>
15#include <media/soc_camera.h> 15#include <media/soc_camera.h>
16#include <media/v4l2-mediabus.h>
16 17
17struct device; 18struct device;
18 19
@@ -20,7 +21,8 @@ struct soc_camera_platform_info {
20 const char *format_name; 21 const char *format_name;
21 unsigned long format_depth; 22 unsigned long format_depth;
22 struct v4l2_mbus_framefmt format; 23 struct v4l2_mbus_framefmt format;
23 unsigned long bus_param; 24 unsigned long mbus_param;
25 enum v4l2_mbus_type mbus_type;
24 struct soc_camera_device *icd; 26 struct soc_camera_device *icd;
25 int (*set_capture)(struct soc_camera_platform_info *info, int enable); 27 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
26}; 28};
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index fae432544b41..73f1e7eb60f3 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -82,5 +82,7 @@ const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
82s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); 82s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
83int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf, 83int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,
84 unsigned int *numerator, unsigned int *denominator); 84 unsigned int *numerator, unsigned int *denominator);
85unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg,
86 unsigned int flags);
85 87
86#endif 88#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 63fd9d3db296..810a20928a21 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -212,9 +212,6 @@ enum {
212 /* module sn9c20x: just ident 10000 */ 212 /* module sn9c20x: just ident 10000 */
213 V4L2_IDENT_SN9C20X = 10000, 213 V4L2_IDENT_SN9C20X = 10000,
214 214
215 /* Siliconfile sensors: reserved range 10100 - 10199 */
216 V4L2_IDENT_NOON010PC30 = 10100,
217
218 /* module cx231xx and cx25840 */ 215 /* module cx231xx and cx25840 */
219 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */ 216 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
220 V4L2_IDENT_CX23100 = 23100, 217 V4L2_IDENT_CX23100 = 23100,
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 13fe4d744aba..eeb3df637144 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -65,14 +65,12 @@ struct v4l2_ctrl_ops {
65 * @is_private: If set, then this control is private to its handler and it 65 * @is_private: If set, then this control is private to its handler and it
66 * will not be added to any other handlers. Drivers can set 66 * will not be added to any other handlers. Drivers can set
67 * this flag. 67 * this flag.
68 * @is_volatile: If set, then this control is volatile. This means that the
69 * control's current value cannot be cached and needs to be
70 * retrieved through the g_volatile_ctrl op. Drivers can set
71 * this flag.
72 * @is_auto: If set, then this control selects whether the other cluster 68 * @is_auto: If set, then this control selects whether the other cluster
73 * members are in 'automatic' mode or 'manual' mode. This is 69 * members are in 'automatic' mode or 'manual' mode. This is
74 * used for autogain/gain type clusters. Drivers should never 70 * used for autogain/gain type clusters. Drivers should never
75 * set this flag directly. 71 * set this flag directly.
72 * @has_volatiles: If set, then one or more members of the cluster are volatile.
73 * Drivers should never touch this flag.
76 * @manual_mode_value: If the is_auto flag is set, then this is the value 74 * @manual_mode_value: If the is_auto flag is set, then this is the value
77 * of the auto control that determines if that control is in 75 * of the auto control that determines if that control is in
78 * manual mode. So if the value of the auto control equals this 76 * manual mode. So if the value of the auto control equals this
@@ -118,8 +116,8 @@ struct v4l2_ctrl {
118 116
119 unsigned int is_new:1; 117 unsigned int is_new:1;
120 unsigned int is_private:1; 118 unsigned int is_private:1;
121 unsigned int is_volatile:1;
122 unsigned int is_auto:1; 119 unsigned int is_auto:1;
120 unsigned int has_volatiles:1;
123 unsigned int manual_mode_value:8; 121 unsigned int manual_mode_value:8;
124 122
125 const struct v4l2_ctrl_ops *ops; 123 const struct v4l2_ctrl_ops *ops;
@@ -208,9 +206,6 @@ struct v4l2_ctrl_handler {
208 * must be NULL. 206 * must be NULL.
209 * @is_private: If set, then this control is private to its handler and it 207 * @is_private: If set, then this control is private to its handler and it
210 * will not be added to any other handlers. 208 * will not be added to any other handlers.
211 * @is_volatile: If set, then this control is volatile. This means that the
212 * control's current value cannot be cached and needs to be
213 * retrieved through the g_volatile_ctrl op.
214 */ 209 */
215struct v4l2_ctrl_config { 210struct v4l2_ctrl_config {
216 const struct v4l2_ctrl_ops *ops; 211 const struct v4l2_ctrl_ops *ops;
@@ -225,7 +220,6 @@ struct v4l2_ctrl_config {
225 u32 menu_skip_mask; 220 u32 menu_skip_mask;
226 const char * const *qmenu; 221 const char * const *qmenu;
227 unsigned int is_private:1; 222 unsigned int is_private:1;
228 unsigned int is_volatile:1;
229}; 223};
230 224
231/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID. 225/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
@@ -389,8 +383,7 @@ void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
389 * @manual_val: The value for the first control in the cluster that equals the 383 * @manual_val: The value for the first control in the cluster that equals the
390 * manual setting. 384 * manual setting.
391 * @set_volatile: If true, then all controls except the first auto control will 385 * @set_volatile: If true, then all controls except the first auto control will
392 * have is_volatile set to true. If false, then is_volatile will not 386 * be volatile.
393 * be touched.
394 * 387 *
395 * Use for control groups where one control selects some automatic feature and 388 * Use for control groups where one control selects some automatic feature and
396 * the other controls are only active whenever the automatic feature is turned 389 * the other controls are only active whenever the automatic feature is turned
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index fbf585561570..e6aa2318367b 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -25,7 +25,6 @@
25#ifndef V4L2_INT_DEVICE_H 25#ifndef V4L2_INT_DEVICE_H
26#define V4L2_INT_DEVICE_H 26#define V4L2_INT_DEVICE_H
27 27
28#include <linux/module.h>
29#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
30 29
31#define V4L2NAMESIZE 32 30#define V4L2NAMESIZE 32
@@ -41,6 +40,8 @@ enum v4l2_int_type {
41 v4l2_int_type_slave 40 v4l2_int_type_slave
42}; 41};
43 42
43struct module;
44
44struct v4l2_int_device; 45struct v4l2_int_device;
45 46
46struct v4l2_int_master { 47struct v4l2_int_master {
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index dd9f1e7b8ff7..4d1c74ad4c84 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -122,6 +122,8 @@ struct v4l2_ioctl_ops {
122 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 122 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
123 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 123 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
124 124
125 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
126 int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
125 127
126 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); 128 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
127 int (*vidioc_g_fbuf) (struct file *file, void *fh, 129 int (*vidioc_g_fbuf) (struct file *file, void *fh,
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 6114007c8c74..83ae07e53350 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -22,8 +22,12 @@
22 */ 22 */
23#define V4L2_MBUS_MASTER (1 << 0) 23#define V4L2_MBUS_MASTER (1 << 0)
24#define V4L2_MBUS_SLAVE (1 << 1) 24#define V4L2_MBUS_SLAVE (1 << 1)
25/* Which signal polarities it supports */ 25/*
26/* Note: in BT.656 mode HSYNC and VSYNC are unused */ 26 * Signal polarity flags
27 * Note: in BT.656 mode HSYNC, FIELD, and VSYNC are unused
28 * V4L2_MBUS_[HV]SYNC* flags should be also used for specifying
29 * configuration of hardware that uses [HV]REF signals
30 */
27#define V4L2_MBUS_HSYNC_ACTIVE_HIGH (1 << 2) 31#define V4L2_MBUS_HSYNC_ACTIVE_HIGH (1 << 2)
28#define V4L2_MBUS_HSYNC_ACTIVE_LOW (1 << 3) 32#define V4L2_MBUS_HSYNC_ACTIVE_LOW (1 << 3)
29#define V4L2_MBUS_VSYNC_ACTIVE_HIGH (1 << 4) 33#define V4L2_MBUS_VSYNC_ACTIVE_HIGH (1 << 4)
@@ -32,6 +36,10 @@
32#define V4L2_MBUS_PCLK_SAMPLE_FALLING (1 << 7) 36#define V4L2_MBUS_PCLK_SAMPLE_FALLING (1 << 7)
33#define V4L2_MBUS_DATA_ACTIVE_HIGH (1 << 8) 37#define V4L2_MBUS_DATA_ACTIVE_HIGH (1 << 8)
34#define V4L2_MBUS_DATA_ACTIVE_LOW (1 << 9) 38#define V4L2_MBUS_DATA_ACTIVE_LOW (1 << 9)
39/* FIELD = 0/1 - Field1 (odd)/Field2 (even) */
40#define V4L2_MBUS_FIELD_EVEN_HIGH (1 << 10)
41/* FIELD = 1/0 - Field1 (odd)/Field2 (even) */
42#define V4L2_MBUS_FIELD_EVEN_LOW (1 << 11)
35 43
36/* Serial flags */ 44/* Serial flags */
37/* How many lanes the client can use */ 45/* How many lanes the client can use */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 257da1a30f66..f0f3358d1b1b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -158,6 +158,7 @@ struct v4l2_subdev_core_ops {
158 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); 158 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
159 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); 159 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
160 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 160 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
161 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
161 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm); 162 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
162 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 163 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
163#ifdef CONFIG_VIDEO_ADV_DEBUG 164#ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -534,13 +535,13 @@ struct v4l2_subdev {
534 void *dev_priv; 535 void *dev_priv;
535 void *host_priv; 536 void *host_priv;
536 /* subdev device node */ 537 /* subdev device node */
537 struct video_device devnode; 538 struct video_device *devnode;
538}; 539};
539 540
540#define media_entity_to_v4l2_subdev(ent) \ 541#define media_entity_to_v4l2_subdev(ent) \
541 container_of(ent, struct v4l2_subdev, entity) 542 container_of(ent, struct v4l2_subdev, entity)
542#define vdev_to_v4l2_subdev(vdev) \ 543#define vdev_to_v4l2_subdev(vdev) \
543 container_of(vdev, struct v4l2_subdev, devnode) 544 video_get_drvdata(vdev)
544 545
545/* 546/*
546 * Used for storing subdev information per file handle 547 * Used for storing subdev information per file handle
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index f87472acbc51..a15d1f1b319e 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -75,7 +75,6 @@ struct vb2_mem_ops {
75 75
76struct vb2_plane { 76struct vb2_plane {
77 void *mem_priv; 77 void *mem_priv;
78 int mapped:1;
79}; 78};
80 79
81/** 80/**
@@ -106,6 +105,7 @@ enum vb2_fileio_flags {
106/** 105/**
107 * enum vb2_buffer_state - current video buffer state 106 * enum vb2_buffer_state - current video buffer state
108 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control 107 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control
108 * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver
109 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver 109 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver
110 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used 110 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used
111 * in a hardware operation 111 * in a hardware operation
@@ -117,6 +117,7 @@ enum vb2_fileio_flags {
117 */ 117 */
118enum vb2_buffer_state { 118enum vb2_buffer_state {
119 VB2_BUF_STATE_DEQUEUED, 119 VB2_BUF_STATE_DEQUEUED,
120 VB2_BUF_STATE_PREPARED,
120 VB2_BUF_STATE_QUEUED, 121 VB2_BUF_STATE_QUEUED,
121 VB2_BUF_STATE_ACTIVE, 122 VB2_BUF_STATE_ACTIVE,
122 VB2_BUF_STATE_DONE, 123 VB2_BUF_STATE_DONE,
@@ -147,7 +148,6 @@ struct vb2_queue;
147 * @done_entry: entry on the list that stores all buffers ready to 148 * @done_entry: entry on the list that stores all buffers ready to
148 * be dequeued to userspace 149 * be dequeued to userspace
149 * @planes: private per-plane information; do not change 150 * @planes: private per-plane information; do not change
150 * @num_planes_mapped: number of mapped planes; do not change
151 */ 151 */
152struct vb2_buffer { 152struct vb2_buffer {
153 struct v4l2_buffer v4l2_buf; 153 struct v4l2_buffer v4l2_buf;
@@ -164,19 +164,26 @@ struct vb2_buffer {
164 struct list_head done_entry; 164 struct list_head done_entry;
165 165
166 struct vb2_plane planes[VIDEO_MAX_PLANES]; 166 struct vb2_plane planes[VIDEO_MAX_PLANES];
167 unsigned int num_planes_mapped;
168}; 167};
169 168
170/** 169/**
171 * struct vb2_ops - driver-specific callbacks 170 * struct vb2_ops - driver-specific callbacks
172 * 171 *
173 * @queue_setup: called from a VIDIOC_REQBUFS handler, before 172 * @queue_setup: called from VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS
174 * memory allocation; driver should return the required 173 * handlers before memory allocation, or, if
175 * number of buffers in num_buffers, the required number 174 * *num_planes != 0, after the allocation to verify a
176 * of planes per buffer in num_planes; the size of each 175 * smaller number of buffers. Driver should return
177 * plane should be set in the sizes[] array and optional 176 * the required number of buffers in *num_buffers, the
178 * per-plane allocator specific context in alloc_ctxs[] 177 * required number of planes per buffer in *num_planes; the
179 * array 178 * size of each plane should be set in the sizes[] array
179 * and optional per-plane allocator specific context in the
180 * alloc_ctxs[] array. When called from VIDIOC_REQBUFS,
181 * fmt == NULL, the driver has to use the currently
182 * configured format and *num_buffers is the total number
183 * of buffers, that are being allocated. When called from
184 * VIDIOC_CREATE_BUFS, fmt != NULL and it describes the
185 * target frame format. In this case *num_buffers are being
186 * allocated additionally to q->num_buffers.
180 * @wait_prepare: release any locks taken while calling vb2 functions; 187 * @wait_prepare: release any locks taken while calling vb2 functions;
181 * it is called before an ioctl needs to wait for a new 188 * it is called before an ioctl needs to wait for a new
182 * buffer to arrive; required to avoid a deadlock in 189 * buffer to arrive; required to avoid a deadlock in
@@ -189,30 +196,39 @@ struct vb2_buffer {
189 * perform additional buffer-related initialization; 196 * perform additional buffer-related initialization;
190 * initialization failure (return != 0) will prevent 197 * initialization failure (return != 0) will prevent
191 * queue setup from completing successfully; optional 198 * queue setup from completing successfully; optional
192 * @buf_prepare: called every time the buffer is queued from userspace; 199 * @buf_prepare: called every time the buffer is queued from userspace
193 * drivers may perform any initialization required before 200 * and from the VIDIOC_PREPARE_BUF ioctl; drivers may
194 * each hardware operation in this callback; 201 * perform any initialization required before each hardware
195 * if an error is returned, the buffer will not be queued 202 * operation in this callback; if an error is returned, the
196 * in driver; optional 203 * buffer will not be queued in driver; optional
197 * @buf_finish: called before every dequeue of the buffer back to 204 * @buf_finish: called before every dequeue of the buffer back to
198 * userspace; drivers may perform any operations required 205 * userspace; drivers may perform any operations required
199 * before userspace accesses the buffer; optional 206 * before userspace accesses the buffer; optional
200 * @buf_cleanup: called once before the buffer is freed; drivers may 207 * @buf_cleanup: called once before the buffer is freed; drivers may
201 * perform any additional cleanup; optional 208 * perform any additional cleanup; optional
202 * @start_streaming: called once before entering 'streaming' state; enables 209 * @start_streaming: called once to enter 'streaming' state; the driver may
203 * driver to receive buffers over buf_queue() callback 210 * receive buffers with @buf_queue callback before
211 * @start_streaming is called; the driver gets the number
212 * of already queued buffers in count parameter; driver
213 * can return an error if hardware fails or not enough
214 * buffers has been queued, in such case all buffers that
215 * have been already given by the @buf_queue callback are
216 * invalidated.
204 * @stop_streaming: called when 'streaming' state must be disabled; driver 217 * @stop_streaming: called when 'streaming' state must be disabled; driver
205 * should stop any DMA transactions or wait until they 218 * should stop any DMA transactions or wait until they
206 * finish and give back all buffers it got from buf_queue() 219 * finish and give back all buffers it got from buf_queue()
207 * callback; may use vb2_wait_for_all_buffers() function 220 * callback; may use vb2_wait_for_all_buffers() function
208 * @buf_queue: passes buffer vb to the driver; driver may start 221 * @buf_queue: passes buffer vb to the driver; driver may start
209 * hardware operation on this buffer; driver should give 222 * hardware operation on this buffer; driver should give
210 * the buffer back by calling vb2_buffer_done() function 223 * the buffer back by calling vb2_buffer_done() function;
224 * it is allways called after calling STREAMON ioctl;
225 * might be called before start_streaming callback if user
226 * pre-queued buffers before calling STREAMON
211 */ 227 */
212struct vb2_ops { 228struct vb2_ops {
213 int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers, 229 int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt,
214 unsigned int *num_planes, unsigned long sizes[], 230 unsigned int *num_buffers, unsigned int *num_planes,
215 void *alloc_ctxs[]); 231 unsigned int sizes[], void *alloc_ctxs[]);
216 232
217 void (*wait_prepare)(struct vb2_queue *q); 233 void (*wait_prepare)(struct vb2_queue *q);
218 void (*wait_finish)(struct vb2_queue *q); 234 void (*wait_finish)(struct vb2_queue *q);
@@ -222,7 +238,7 @@ struct vb2_ops {
222 int (*buf_finish)(struct vb2_buffer *vb); 238 int (*buf_finish)(struct vb2_buffer *vb);
223 void (*buf_cleanup)(struct vb2_buffer *vb); 239 void (*buf_cleanup)(struct vb2_buffer *vb);
224 240
225 int (*start_streaming)(struct vb2_queue *q); 241 int (*start_streaming)(struct vb2_queue *q, unsigned int count);
226 int (*stop_streaming)(struct vb2_queue *q); 242 int (*stop_streaming)(struct vb2_queue *q);
227 243
228 void (*buf_queue)(struct vb2_buffer *vb); 244 void (*buf_queue)(struct vb2_buffer *vb);
@@ -276,6 +292,7 @@ struct vb2_queue {
276 wait_queue_head_t done_wq; 292 wait_queue_head_t done_wq;
277 293
278 void *alloc_ctx[VIDEO_MAX_PLANES]; 294 void *alloc_ctx[VIDEO_MAX_PLANES];
295 unsigned int plane_sizes[VIDEO_MAX_PLANES];
279 296
280 unsigned int streaming:1; 297 unsigned int streaming:1;
281 298
@@ -291,6 +308,9 @@ int vb2_wait_for_all_buffers(struct vb2_queue *q);
291int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); 308int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
292int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req); 309int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
293 310
311int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
312int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
313
294int vb2_queue_init(struct vb2_queue *q); 314int vb2_queue_init(struct vb2_queue *q);
295 315
296void vb2_queue_release(struct vb2_queue *q); 316void vb2_queue_release(struct vb2_queue *q);
@@ -302,6 +322,13 @@ int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
302int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type); 322int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type);
303 323
304int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); 324int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma);
325#ifndef CONFIG_MMU
326unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
327 unsigned long addr,
328 unsigned long len,
329 unsigned long pgoff,
330 unsigned long flags);
331#endif
305unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait); 332unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait);
306size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, 333size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
307 loff_t *ppos, int nonblock); 334 loff_t *ppos, int nonblock);
diff --git a/include/media/videobuf2-dma-contig.h b/include/media/videobuf2-dma-contig.h
index 7e6c68b23773..19ae1e350567 100644
--- a/include/media/videobuf2-dma-contig.h
+++ b/include/media/videobuf2-dma-contig.h
@@ -17,11 +17,11 @@
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18 18
19static inline dma_addr_t 19static inline dma_addr_t
20vb2_dma_contig_plane_paddr(struct vb2_buffer *vb, unsigned int plane_no) 20vb2_dma_contig_plane_dma_addr(struct vb2_buffer *vb, unsigned int plane_no)
21{ 21{
22 dma_addr_t *paddr = vb2_plane_cookie(vb, plane_no); 22 dma_addr_t *addr = vb2_plane_cookie(vb, plane_no);
23 23
24 return *paddr; 24 return *addr;
25} 25}
26 26
27void *vb2_dma_contig_init_ctx(struct device *dev); 27void *vb2_dma_contig_init_ctx(struct device *dev);