aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/dvb/frontend.h46
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/videodev2.h3
-rw-r--r--include/media/davinci/ccdc_types.h43
-rw-r--r--include/media/davinci/dm355_ccdc.h321
-rw-r--r--include/media/davinci/dm644x_ccdc.h184
-rw-r--r--include/media/davinci/vpfe_capture.h198
-rw-r--r--include/media/davinci/vpfe_types.h51
-rw-r--r--include/media/davinci/vpss.h69
-rw-r--r--include/media/soc_camera.h113
-rw-r--r--include/media/soc_camera_platform.h9
-rw-r--r--include/media/tuner.h2
-rw-r--r--include/media/tvp514x.h4
-rw-r--r--include/media/v4l2-chip-ident.h3
-rw-r--r--include/media/v4l2-common.h24
-rw-r--r--include/media/v4l2-dev.h6
16 files changed, 999 insertions, 79 deletions
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 51c8d2d49e42..b6cb5425cde3 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -173,7 +173,8 @@ typedef enum fe_modulation {
173typedef enum fe_transmit_mode { 173typedef enum fe_transmit_mode {
174 TRANSMISSION_MODE_2K, 174 TRANSMISSION_MODE_2K,
175 TRANSMISSION_MODE_8K, 175 TRANSMISSION_MODE_8K,
176 TRANSMISSION_MODE_AUTO 176 TRANSMISSION_MODE_AUTO,
177 TRANSMISSION_MODE_4K
177} fe_transmit_mode_t; 178} fe_transmit_mode_t;
178 179
179typedef enum fe_bandwidth { 180typedef enum fe_bandwidth {
@@ -268,15 +269,42 @@ struct dvb_frontend_event {
268#define DTV_FE_CAPABILITY 16 269#define DTV_FE_CAPABILITY 16
269#define DTV_DELIVERY_SYSTEM 17 270#define DTV_DELIVERY_SYSTEM 17
270 271
271#define DTV_API_VERSION 35 272/* ISDB-T and ISDB-Tsb */
272#define DTV_API_VERSION 35 273#define DTV_ISDBT_PARTIAL_RECEPTION 18
273#define DTV_CODE_RATE_HP 36 274#define DTV_ISDBT_SOUND_BROADCASTING 19
274#define DTV_CODE_RATE_LP 37
275#define DTV_GUARD_INTERVAL 38
276#define DTV_TRANSMISSION_MODE 39
277#define DTV_HIERARCHY 40
278 275
279#define DTV_MAX_COMMAND DTV_HIERARCHY 276#define DTV_ISDBT_SB_SUBCHANNEL_ID 20
277#define DTV_ISDBT_SB_SEGMENT_IDX 21
278#define DTV_ISDBT_SB_SEGMENT_COUNT 22
279
280#define DTV_ISDBT_LAYERA_FEC 23
281#define DTV_ISDBT_LAYERA_MODULATION 24
282#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
283#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
284
285#define DTV_ISDBT_LAYERB_FEC 27
286#define DTV_ISDBT_LAYERB_MODULATION 28
287#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
288#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
289
290#define DTV_ISDBT_LAYERC_FEC 31
291#define DTV_ISDBT_LAYERC_MODULATION 32
292#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
293#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
294
295#define DTV_API_VERSION 35
296
297#define DTV_CODE_RATE_HP 36
298#define DTV_CODE_RATE_LP 37
299#define DTV_GUARD_INTERVAL 38
300#define DTV_TRANSMISSION_MODE 39
301#define DTV_HIERARCHY 40
302
303#define DTV_ISDBT_LAYER_ENABLED 41
304
305#define DTV_ISDBS_TS_ID 42
306
307#define DTV_MAX_COMMAND DTV_ISDBS_TS_ID
280 308
281typedef enum fe_pilot { 309typedef enum fe_pilot {
282 PILOT_ON, 310 PILOT_ON,
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 25b823b81734..540b0583d9fb 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 0 27#define DVB_API_VERSION_MINOR 1
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3689d7d81fe9..b59e78c57161 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -910,9 +910,10 @@ enum v4l2_colorfx {
910 V4L2_COLORFX_SEPIA = 2, 910 V4L2_COLORFX_SEPIA = 2,
911}; 911};
912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
913#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
913 914
914/* last CID + 1 */ 915/* last CID + 1 */
915#define V4L2_CID_LASTP1 (V4L2_CID_BASE+33) 916#define V4L2_CID_LASTP1 (V4L2_CID_BASE+34)
916 917
917/* MPEG-class control IDs defined by V4L2 */ 918/* MPEG-class control IDs defined by V4L2 */
918#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 919#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
diff --git a/include/media/davinci/ccdc_types.h b/include/media/davinci/ccdc_types.h
new file mode 100644
index 000000000000..5773874bf266
--- /dev/null
+++ b/include/media/davinci/ccdc_types.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
4 * 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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 **************************************************************************/
19#ifndef _CCDC_TYPES_H
20#define _CCDC_TYPES_H
21enum ccdc_pixfmt {
22 CCDC_PIXFMT_RAW,
23 CCDC_PIXFMT_YCBCR_16BIT,
24 CCDC_PIXFMT_YCBCR_8BIT
25};
26
27enum ccdc_frmfmt {
28 CCDC_FRMFMT_PROGRESSIVE,
29 CCDC_FRMFMT_INTERLACED
30};
31
32/* PIXEL ORDER IN MEMORY from LSB to MSB */
33/* only applicable for 8-bit input mode */
34enum ccdc_pixorder {
35 CCDC_PIXORDER_YCBYCR,
36 CCDC_PIXORDER_CBYCRY,
37};
38
39enum ccdc_buftype {
40 CCDC_BUFTYPE_FLD_INTERLEAVED,
41 CCDC_BUFTYPE_FLD_SEPARATED
42};
43#endif
diff --git a/include/media/davinci/dm355_ccdc.h b/include/media/davinci/dm355_ccdc.h
new file mode 100644
index 000000000000..df8a7b107477
--- /dev/null
+++ b/include/media/davinci/dm355_ccdc.h
@@ -0,0 +1,321 @@
1/*
2 * Copyright (C) 2005-2009 Texas Instruments Inc
3 *
4 * 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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _DM355_CCDC_H
19#define _DM355_CCDC_H
20#include <media/davinci/ccdc_types.h>
21#include <media/davinci/vpfe_types.h>
22
23/* enum for No of pixel per line to be avg. in Black Clamping */
24enum ccdc_sample_length {
25 CCDC_SAMPLE_1PIXELS,
26 CCDC_SAMPLE_2PIXELS,
27 CCDC_SAMPLE_4PIXELS,
28 CCDC_SAMPLE_8PIXELS,
29 CCDC_SAMPLE_16PIXELS
30};
31
32/* enum for No of lines in Black Clamping */
33enum ccdc_sample_line {
34 CCDC_SAMPLE_1LINES,
35 CCDC_SAMPLE_2LINES,
36 CCDC_SAMPLE_4LINES,
37 CCDC_SAMPLE_8LINES,
38 CCDC_SAMPLE_16LINES
39};
40
41/* enum for Alaw gama width */
42enum ccdc_gamma_width {
43 CCDC_GAMMA_BITS_13_4,
44 CCDC_GAMMA_BITS_12_3,
45 CCDC_GAMMA_BITS_11_2,
46 CCDC_GAMMA_BITS_10_1,
47 CCDC_GAMMA_BITS_09_0
48};
49
50enum ccdc_colpats {
51 CCDC_RED,
52 CCDC_GREEN_RED,
53 CCDC_GREEN_BLUE,
54 CCDC_BLUE
55};
56
57struct ccdc_col_pat {
58 enum ccdc_colpats olop;
59 enum ccdc_colpats olep;
60 enum ccdc_colpats elop;
61 enum ccdc_colpats elep;
62};
63
64enum ccdc_datasft {
65 CCDC_DATA_NO_SHIFT,
66 CCDC_DATA_SHIFT_1BIT,
67 CCDC_DATA_SHIFT_2BIT,
68 CCDC_DATA_SHIFT_3BIT,
69 CCDC_DATA_SHIFT_4BIT,
70 CCDC_DATA_SHIFT_5BIT,
71 CCDC_DATA_SHIFT_6BIT
72};
73
74enum ccdc_data_size {
75 CCDC_DATA_16BITS,
76 CCDC_DATA_15BITS,
77 CCDC_DATA_14BITS,
78 CCDC_DATA_13BITS,
79 CCDC_DATA_12BITS,
80 CCDC_DATA_11BITS,
81 CCDC_DATA_10BITS,
82 CCDC_DATA_8BITS
83};
84enum ccdc_mfilt1 {
85 CCDC_NO_MEDIAN_FILTER1,
86 CCDC_AVERAGE_FILTER1,
87 CCDC_MEDIAN_FILTER1
88};
89
90enum ccdc_mfilt2 {
91 CCDC_NO_MEDIAN_FILTER2,
92 CCDC_AVERAGE_FILTER2,
93 CCDC_MEDIAN_FILTER2
94};
95
96/* structure for ALaw */
97struct ccdc_a_law {
98 /* Enable/disable A-Law */
99 unsigned char enable;
100 /* Gama Width Input */
101 enum ccdc_gamma_width gama_wd;
102};
103
104/* structure for Black Clamping */
105struct ccdc_black_clamp {
106 /* only if bClampEnable is TRUE */
107 unsigned char b_clamp_enable;
108 /* only if bClampEnable is TRUE */
109 enum ccdc_sample_length sample_pixel;
110 /* only if bClampEnable is TRUE */
111 enum ccdc_sample_line sample_ln;
112 /* only if bClampEnable is TRUE */
113 unsigned short start_pixel;
114 /* only if bClampEnable is FALSE */
115 unsigned short sgain;
116 unsigned short dc_sub;
117};
118
119/* structure for Black Level Compensation */
120struct ccdc_black_compensation {
121 /* Constant value to subtract from Red component */
122 unsigned char r;
123 /* Constant value to subtract from Gr component */
124 unsigned char gr;
125 /* Constant value to subtract from Blue component */
126 unsigned char b;
127 /* Constant value to subtract from Gb component */
128 unsigned char gb;
129};
130
131struct ccdc_float {
132 int integer;
133 unsigned int decimal;
134};
135
136#define CCDC_CSC_COEFF_TABLE_SIZE 16
137/* structure for color space converter */
138struct ccdc_csc {
139 unsigned char enable;
140 /*
141 * S8Q5. Use 2 decimal precision, user values range from -3.00 to 3.99.
142 * example - to use 1.03, set integer part as 1, and decimal part as 3
143 * to use -1.03, set integer part as -1 and decimal part as 3
144 */
145 struct ccdc_float coeff[CCDC_CSC_COEFF_TABLE_SIZE];
146};
147
148/* Structures for Vertical Defect Correction*/
149enum ccdc_vdf_csl {
150 CCDC_VDF_NORMAL,
151 CCDC_VDF_HORZ_INTERPOL_SAT,
152 CCDC_VDF_HORZ_INTERPOL
153};
154
155enum ccdc_vdf_cuda {
156 CCDC_VDF_WHOLE_LINE_CORRECT,
157 CCDC_VDF_UPPER_DISABLE
158};
159
160enum ccdc_dfc_mwr {
161 CCDC_DFC_MWR_WRITE_COMPLETE,
162 CCDC_DFC_WRITE_REG
163};
164
165enum ccdc_dfc_mrd {
166 CCDC_DFC_READ_COMPLETE,
167 CCDC_DFC_READ_REG
168};
169
170enum ccdc_dfc_ma_rst {
171 CCDC_DFC_INCR_ADDR,
172 CCDC_DFC_CLR_ADDR
173};
174
175enum ccdc_dfc_mclr {
176 CCDC_DFC_CLEAR_COMPLETE,
177 CCDC_DFC_CLEAR
178};
179
180struct ccdc_dft_corr_ctl {
181 enum ccdc_vdf_csl vdfcsl;
182 enum ccdc_vdf_cuda vdfcuda;
183 unsigned int vdflsft;
184};
185
186struct ccdc_dft_corr_mem_ctl {
187 enum ccdc_dfc_mwr dfcmwr;
188 enum ccdc_dfc_mrd dfcmrd;
189 enum ccdc_dfc_ma_rst dfcmarst;
190 enum ccdc_dfc_mclr dfcmclr;
191};
192
193#define CCDC_DFT_TABLE_SIZE 16
194/*
195 * Main Structure for vertical defect correction. Vertical defect
196 * correction can correct upto 16 defects if defects less than 16
197 * then pad the rest with 0
198 */
199struct ccdc_vertical_dft {
200 unsigned char ver_dft_en;
201 unsigned char gen_dft_en;
202 unsigned int saturation_ctl;
203 struct ccdc_dft_corr_ctl dft_corr_ctl;
204 struct ccdc_dft_corr_mem_ctl dft_corr_mem_ctl;
205 int table_size;
206 unsigned int dft_corr_horz[CCDC_DFT_TABLE_SIZE];
207 unsigned int dft_corr_vert[CCDC_DFT_TABLE_SIZE];
208 unsigned int dft_corr_sub1[CCDC_DFT_TABLE_SIZE];
209 unsigned int dft_corr_sub2[CCDC_DFT_TABLE_SIZE];
210 unsigned int dft_corr_sub3[CCDC_DFT_TABLE_SIZE];
211};
212
213struct ccdc_data_offset {
214 unsigned char horz_offset;
215 unsigned char vert_offset;
216};
217
218/*
219 * Structure for CCDC configuration parameters for raw capture mode passed
220 * by application
221 */
222struct ccdc_config_params_raw {
223 /* data shift to be applied before storing */
224 enum ccdc_datasft datasft;
225 /* data size value from 8 to 16 bits */
226 enum ccdc_data_size data_sz;
227 /* median filter for sdram */
228 enum ccdc_mfilt1 mfilt1;
229 enum ccdc_mfilt2 mfilt2;
230 /* low pass filter enable/disable */
231 unsigned char lpf_enable;
232 /* Threshold of median filter */
233 int med_filt_thres;
234 /*
235 * horz and vertical data offset. Appliable for defect correction
236 * and lsc
237 */
238 struct ccdc_data_offset data_offset;
239 /* Structure for Optional A-Law */
240 struct ccdc_a_law alaw;
241 /* Structure for Optical Black Clamp */
242 struct ccdc_black_clamp blk_clamp;
243 /* Structure for Black Compensation */
244 struct ccdc_black_compensation blk_comp;
245 /* struture for vertical Defect Correction Module Configuration */
246 struct ccdc_vertical_dft vertical_dft;
247 /* structure for color space converter Module Configuration */
248 struct ccdc_csc csc;
249 /* color patters for bayer capture */
250 struct ccdc_col_pat col_pat_field0;
251 struct ccdc_col_pat col_pat_field1;
252};
253
254#ifdef __KERNEL__
255#include <linux/io.h>
256
257#define CCDC_WIN_PAL {0, 0, 720, 576}
258#define CCDC_WIN_VGA {0, 0, 640, 480}
259
260struct ccdc_params_ycbcr {
261 /* pixel format */
262 enum ccdc_pixfmt pix_fmt;
263 /* progressive or interlaced frame */
264 enum ccdc_frmfmt frm_fmt;
265 /* video window */
266 struct v4l2_rect win;
267 /* field id polarity */
268 enum vpfe_pin_pol fid_pol;
269 /* vertical sync polarity */
270 enum vpfe_pin_pol vd_pol;
271 /* horizontal sync polarity */
272 enum vpfe_pin_pol hd_pol;
273 /* enable BT.656 embedded sync mode */
274 int bt656_enable;
275 /* cb:y:cr:y or y:cb:y:cr in memory */
276 enum ccdc_pixorder pix_order;
277 /* interleaved or separated fields */
278 enum ccdc_buftype buf_type;
279};
280
281/* Gain applied to Raw Bayer data */
282struct ccdc_gain {
283 unsigned short r_ye;
284 unsigned short gr_cy;
285 unsigned short gb_g;
286 unsigned short b_mg;
287};
288
289/* Structure for CCDC configuration parameters for raw capture mode */
290struct ccdc_params_raw {
291 /* pixel format */
292 enum ccdc_pixfmt pix_fmt;
293 /* progressive or interlaced frame */
294 enum ccdc_frmfmt frm_fmt;
295 /* video window */
296 struct v4l2_rect win;
297 /* field id polarity */
298 enum vpfe_pin_pol fid_pol;
299 /* vertical sync polarity */
300 enum vpfe_pin_pol vd_pol;
301 /* horizontal sync polarity */
302 enum vpfe_pin_pol hd_pol;
303 /* interleaved or separated fields */
304 enum ccdc_buftype buf_type;
305 /* Gain values */
306 struct ccdc_gain gain;
307 /* offset */
308 unsigned int ccdc_offset;
309 /* horizontal flip enable */
310 unsigned char horz_flip_enable;
311 /*
312 * enable to store the image in inverse order in memory
313 * (bottom to top)
314 */
315 unsigned char image_invert_enable;
316 /* Configurable part of raw data */
317 struct ccdc_config_params_raw config_params;
318};
319
320#endif
321#endif /* DM355_CCDC_H */
diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h
new file mode 100644
index 000000000000..3e178eb52fb3
--- /dev/null
+++ b/include/media/davinci/dm644x_ccdc.h
@@ -0,0 +1,184 @@
1/*
2 * Copyright (C) 2006-2009 Texas Instruments Inc
3 *
4 * 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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _DM644X_CCDC_H
19#define _DM644X_CCDC_H
20#include <media/davinci/ccdc_types.h>
21#include <media/davinci/vpfe_types.h>
22
23/* enum for No of pixel per line to be avg. in Black Clamping*/
24enum ccdc_sample_length {
25 CCDC_SAMPLE_1PIXELS,
26 CCDC_SAMPLE_2PIXELS,
27 CCDC_SAMPLE_4PIXELS,
28 CCDC_SAMPLE_8PIXELS,
29 CCDC_SAMPLE_16PIXELS
30};
31
32/* enum for No of lines in Black Clamping */
33enum ccdc_sample_line {
34 CCDC_SAMPLE_1LINES,
35 CCDC_SAMPLE_2LINES,
36 CCDC_SAMPLE_4LINES,
37 CCDC_SAMPLE_8LINES,
38 CCDC_SAMPLE_16LINES
39};
40
41/* enum for Alaw gama width */
42enum ccdc_gama_width {
43 CCDC_GAMMA_BITS_15_6,
44 CCDC_GAMMA_BITS_14_5,
45 CCDC_GAMMA_BITS_13_4,
46 CCDC_GAMMA_BITS_12_3,
47 CCDC_GAMMA_BITS_11_2,
48 CCDC_GAMMA_BITS_10_1,
49 CCDC_GAMMA_BITS_09_0
50};
51
52enum ccdc_data_size {
53 CCDC_DATA_16BITS,
54 CCDC_DATA_15BITS,
55 CCDC_DATA_14BITS,
56 CCDC_DATA_13BITS,
57 CCDC_DATA_12BITS,
58 CCDC_DATA_11BITS,
59 CCDC_DATA_10BITS,
60 CCDC_DATA_8BITS
61};
62
63/* structure for ALaw */
64struct ccdc_a_law {
65 /* Enable/disable A-Law */
66 unsigned char enable;
67 /* Gama Width Input */
68 enum ccdc_gama_width gama_wd;
69};
70
71/* structure for Black Clamping */
72struct ccdc_black_clamp {
73 unsigned char enable;
74 /* only if bClampEnable is TRUE */
75 enum ccdc_sample_length sample_pixel;
76 /* only if bClampEnable is TRUE */
77 enum ccdc_sample_line sample_ln;
78 /* only if bClampEnable is TRUE */
79 unsigned short start_pixel;
80 /* only if bClampEnable is TRUE */
81 unsigned short sgain;
82 /* only if bClampEnable is FALSE */
83 unsigned short dc_sub;
84};
85
86/* structure for Black Level Compensation */
87struct ccdc_black_compensation {
88 /* Constant value to subtract from Red component */
89 char r;
90 /* Constant value to subtract from Gr component */
91 char gr;
92 /* Constant value to subtract from Blue component */
93 char b;
94 /* Constant value to subtract from Gb component */
95 char gb;
96};
97
98/* structure for fault pixel correction */
99struct ccdc_fault_pixel {
100 /* Enable or Disable fault pixel correction */
101 unsigned char enable;
102 /* Number of fault pixel */
103 unsigned short fp_num;
104 /* Address of fault pixel table */
105 unsigned int fpc_table_addr;
106};
107
108/* Structure for CCDC configuration parameters for raw capture mode passed
109 * by application
110 */
111struct ccdc_config_params_raw {
112 /* data size value from 8 to 16 bits */
113 enum ccdc_data_size data_sz;
114 /* Structure for Optional A-Law */
115 struct ccdc_a_law alaw;
116 /* Structure for Optical Black Clamp */
117 struct ccdc_black_clamp blk_clamp;
118 /* Structure for Black Compensation */
119 struct ccdc_black_compensation blk_comp;
120 /* Structure for Fault Pixel Module Configuration */
121 struct ccdc_fault_pixel fault_pxl;
122};
123
124
125#ifdef __KERNEL__
126#include <linux/io.h>
127/* Define to enable/disable video port */
128#define FP_NUM_BYTES 4
129/* Define for extra pixel/line and extra lines/frame */
130#define NUM_EXTRAPIXELS 8
131#define NUM_EXTRALINES 8
132
133/* settings for commonly used video formats */
134#define CCDC_WIN_PAL {0, 0, 720, 576}
135/* ntsc square pixel */
136#define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
137
138/* Structure for CCDC configuration parameters for raw capture mode */
139struct ccdc_params_raw {
140 /* pixel format */
141 enum ccdc_pixfmt pix_fmt;
142 /* progressive or interlaced frame */
143 enum ccdc_frmfmt frm_fmt;
144 /* video window */
145 struct v4l2_rect win;
146 /* field id polarity */
147 enum vpfe_pin_pol fid_pol;
148 /* vertical sync polarity */
149 enum vpfe_pin_pol vd_pol;
150 /* horizontal sync polarity */
151 enum vpfe_pin_pol hd_pol;
152 /* interleaved or separated fields */
153 enum ccdc_buftype buf_type;
154 /*
155 * enable to store the image in inverse
156 * order in memory(bottom to top)
157 */
158 unsigned char image_invert_enable;
159 /* configurable paramaters */
160 struct ccdc_config_params_raw config_params;
161};
162
163struct ccdc_params_ycbcr {
164 /* pixel format */
165 enum ccdc_pixfmt pix_fmt;
166 /* progressive or interlaced frame */
167 enum ccdc_frmfmt frm_fmt;
168 /* video window */
169 struct v4l2_rect win;
170 /* field id polarity */
171 enum vpfe_pin_pol fid_pol;
172 /* vertical sync polarity */
173 enum vpfe_pin_pol vd_pol;
174 /* horizontal sync polarity */
175 enum vpfe_pin_pol hd_pol;
176 /* enable BT.656 embedded sync mode */
177 int bt656_enable;
178 /* cb:y:cr:y or y:cb:y:cr in memory */
179 enum ccdc_pixorder pix_order;
180 /* interleaved or separated fields */
181 enum ccdc_buftype buf_type;
182};
183#endif
184#endif /* _DM644X_CCDC_H */
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
new file mode 100644
index 000000000000..71d8982e13ff
--- /dev/null
+++ b/include/media/davinci/vpfe_capture.h
@@ -0,0 +1,198 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
4 * 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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef _VPFE_CAPTURE_H
20#define _VPFE_CAPTURE_H
21
22#ifdef __KERNEL__
23
24/* Header files */
25#include <media/v4l2-dev.h>
26#include <linux/videodev2.h>
27#include <linux/clk.h>
28#include <linux/i2c.h>
29#include <media/v4l2-ioctl.h>
30#include <media/v4l2-device.h>
31#include <media/videobuf-dma-contig.h>
32#include <media/davinci/vpfe_types.h>
33
34#define VPFE_CAPTURE_NUM_DECODERS 5
35
36/* Macros */
37#define VPFE_MAJOR_RELEASE 0
38#define VPFE_MINOR_RELEASE 0
39#define VPFE_BUILD 1
40#define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
41 (VPFE_MINOR_RELEASE << 8) | \
42 VPFE_BUILD)
43
44#define CAPTURE_DRV_NAME "vpfe-capture"
45
46struct vpfe_pixel_format {
47 struct v4l2_fmtdesc fmtdesc;
48 /* bytes per pixel */
49 int bpp;
50};
51
52struct vpfe_std_info {
53 int active_pixels;
54 int active_lines;
55 /* current frame format */
56 int frame_format;
57};
58
59struct vpfe_route {
60 u32 input;
61 u32 output;
62};
63
64struct vpfe_subdev_info {
65 /* Sub device name */
66 char name[32];
67 /* Sub device group id */
68 int grp_id;
69 /* Number of inputs supported */
70 int num_inputs;
71 /* inputs available at the sub device */
72 struct v4l2_input *inputs;
73 /* Sub dev routing information for each input */
74 struct vpfe_route *routes;
75 /* check if sub dev supports routing */
76 int can_route;
77 /* ccdc bus/interface configuration */
78 struct vpfe_hw_if_param ccdc_if_params;
79 /* i2c subdevice board info */
80 struct i2c_board_info board_info;
81};
82
83struct vpfe_config {
84 /* Number of sub devices connected to vpfe */
85 int num_subdevs;
86 /* information about each subdev */
87 struct vpfe_subdev_info *sub_devs;
88 /* evm card info */
89 char *card_name;
90 /* ccdc name */
91 char *ccdc;
92 /* vpfe clock */
93 struct clk *vpssclk;
94 struct clk *slaveclk;
95};
96
97struct vpfe_device {
98 /* V4l2 specific parameters */
99 /* Identifies video device for this channel */
100 struct video_device *video_dev;
101 /* sub devices */
102 struct v4l2_subdev **sd;
103 /* vpfe cfg */
104 struct vpfe_config *cfg;
105 /* V4l2 device */
106 struct v4l2_device v4l2_dev;
107 /* parent device */
108 struct device *pdev;
109 /* Used to keep track of state of the priority */
110 struct v4l2_prio_state prio;
111 /* number of open instances of the channel */
112 u32 usrs;
113 /* Indicates id of the field which is being displayed */
114 u32 field_id;
115 /* flag to indicate whether decoder is initialized */
116 u8 initialized;
117 /* current interface type */
118 struct vpfe_hw_if_param vpfe_if_params;
119 /* ptr to currently selected sub device */
120 struct vpfe_subdev_info *current_subdev;
121 /* current input at the sub device */
122 int current_input;
123 /* Keeps track of the information about the standard */
124 struct vpfe_std_info std_info;
125 /* std index into std table */
126 int std_index;
127 /* CCDC IRQs used when CCDC/ISIF output to SDRAM */
128 unsigned int ccdc_irq0;
129 unsigned int ccdc_irq1;
130 /* number of buffers in fbuffers */
131 u32 numbuffers;
132 /* List of buffer pointers for storing frames */
133 u8 *fbuffers[VIDEO_MAX_FRAME];
134 /* Pointer pointing to current v4l2_buffer */
135 struct videobuf_buffer *cur_frm;
136 /* Pointer pointing to next v4l2_buffer */
137 struct videobuf_buffer *next_frm;
138 /*
139 * This field keeps track of type of buffer exchange mechanism
140 * user has selected
141 */
142 enum v4l2_memory memory;
143 /* Used to store pixel format */
144 struct v4l2_format fmt;
145 /*
146 * used when IMP is chained to store the crop window which
147 * is different from the image window
148 */
149 struct v4l2_rect crop;
150 /* Buffer queue used in video-buf */
151 struct videobuf_queue buffer_queue;
152 /* Queue of filled frames */
153 struct list_head dma_queue;
154 /* Used in video-buf */
155 spinlock_t irqlock;
156 /* IRQ lock for DMA queue */
157 spinlock_t dma_queue_lock;
158 /* lock used to access this structure */
159 struct mutex lock;
160 /* number of users performing IO */
161 u32 io_usrs;
162 /* Indicates whether streaming started */
163 u8 started;
164 /*
165 * offset where second field starts from the starting of the
166 * buffer for field seperated YCbCr formats
167 */
168 u32 field_off;
169};
170
171/* File handle structure */
172struct vpfe_fh {
173 struct vpfe_device *vpfe_dev;
174 /* Indicates whether this file handle is doing IO */
175 u8 io_allowed;
176 /* Used to keep track priority of this instance */
177 enum v4l2_priority prio;
178};
179
180struct vpfe_config_params {
181 u8 min_numbuffers;
182 u8 numbuffers;
183 u32 min_bufsize;
184 u32 device_bufsize;
185};
186
187#endif /* End of __KERNEL__ */
188/**
189 * VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params
190 * This can be used to configure modules such as defect pixel correction,
191 * color space conversion, culling etc. This is an experimental ioctl that
192 * will change in future kernels. So use this ioctl with care !
193 * TODO: This is to be split into multiple ioctls and also explore the
194 * possibility of extending the v4l2 api to include this
195 **/
196#define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \
197 void *)
198#endif /* _DAVINCI_VPFE_H */
diff --git a/include/media/davinci/vpfe_types.h b/include/media/davinci/vpfe_types.h
new file mode 100644
index 000000000000..76fb74bad08c
--- /dev/null
+++ b/include/media/davinci/vpfe_types.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
4 * 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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option)any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _VPFE_TYPES_H
19#define _VPFE_TYPES_H
20
21#ifdef __KERNEL__
22
23enum vpfe_pin_pol {
24 VPFE_PINPOL_POSITIVE,
25 VPFE_PINPOL_NEGATIVE
26};
27
28enum vpfe_hw_if_type {
29 /* BT656 - 8 bit */
30 VPFE_BT656,
31 /* BT1120 - 16 bit */
32 VPFE_BT1120,
33 /* Raw Bayer */
34 VPFE_RAW_BAYER,
35 /* YCbCr - 8 bit with external sync */
36 VPFE_YCBCR_SYNC_8,
37 /* YCbCr - 16 bit with external sync */
38 VPFE_YCBCR_SYNC_16,
39 /* BT656 - 10 bit */
40 VPFE_BT656_10BIT
41};
42
43/* interface description */
44struct vpfe_hw_if_param {
45 enum vpfe_hw_if_type if_type;
46 enum vpfe_pin_pol hdpol;
47 enum vpfe_pin_pol vdpol;
48};
49
50#endif
51#endif
diff --git a/include/media/davinci/vpss.h b/include/media/davinci/vpss.h
new file mode 100644
index 000000000000..fcdff745fae2
--- /dev/null
+++ b/include/media/davinci/vpss.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2009 Texas Instruments Inc
3 *
4 * 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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * vpss - video processing subsystem module header file.
19 *
20 * Include this header file if a driver needs to configure vpss system
21 * module. It exports a set of library functions for video drivers to
22 * configure vpss system module functions such as clock enable/disable,
23 * vpss interrupt mux to arm, and other common vpss system module
24 * functions.
25 */
26#ifndef _VPSS_H
27#define _VPSS_H
28
29/* selector for ccdc input selection on DM355 */
30enum vpss_ccdc_source_sel {
31 VPSS_CCDCIN,
32 VPSS_HSSIIN
33};
34
35/* Used for enable/diable VPSS Clock */
36enum vpss_clock_sel {
37 /* DM355/DM365 */
38 VPSS_CCDC_CLOCK,
39 VPSS_IPIPE_CLOCK,
40 VPSS_H3A_CLOCK,
41 VPSS_CFALD_CLOCK,
42 /*
43 * When using VPSS_VENC_CLOCK_SEL in vpss_enable_clock() api
44 * following applies:-
45 * en = 0 selects ENC_CLK
46 * en = 1 selects ENC_CLK/2
47 */
48 VPSS_VENC_CLOCK_SEL,
49 VPSS_VPBE_CLOCK,
50};
51
52/* select input to ccdc on dm355 */
53int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel);
54/* enable/disable a vpss clock, 0 - success, -1 - failure */
55int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en);
56
57/* wbl reset for dm644x */
58enum vpss_wbl_sel {
59 VPSS_PCR_AEW_WBL_0 = 16,
60 VPSS_PCR_AF_WBL_0,
61 VPSS_PCR_RSZ4_WBL_0,
62 VPSS_PCR_RSZ3_WBL_0,
63 VPSS_PCR_RSZ2_WBL_0,
64 VPSS_PCR_RSZ1_WBL_0,
65 VPSS_PCR_PREV_WBL_0,
66 VPSS_PCR_CCDC_WBL_O,
67};
68int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel);
69#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 23ecead35e7a..3d74e60032dd 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -16,24 +16,17 @@
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/videobuf-core.h> 18#include <media/videobuf-core.h>
19#include <media/v4l2-device.h>
19 20
20struct soc_camera_device { 21struct soc_camera_device {
21 struct list_head list; 22 struct list_head list;
22 struct device dev; 23 struct device dev;
23 struct device *control; 24 struct device *pdev; /* Platform device */
24 unsigned short width; /* Current window */ 25 s32 user_width;
25 unsigned short height; /* sizes */ 26 s32 user_height;
26 unsigned short x_min; /* Camera capabilities */
27 unsigned short y_min;
28 unsigned short x_current; /* Current window location */
29 unsigned short y_current;
30 unsigned short width_min; 27 unsigned short width_min;
31 unsigned short width_max;
32 unsigned short height_min; 28 unsigned short height_min;
33 unsigned short height_max;
34 unsigned short y_skip_top; /* Lines to skip at the top */ 29 unsigned short y_skip_top; /* Lines to skip at the top */
35 unsigned short gain;
36 unsigned short exposure;
37 unsigned char iface; /* Host number */ 30 unsigned char iface; /* Host number */
38 unsigned char devnum; /* Device number per host */ 31 unsigned char devnum; /* Device number per host */
39 unsigned char buswidth; /* See comment in .c */ 32 unsigned char buswidth; /* See comment in .c */
@@ -46,7 +39,6 @@ struct soc_camera_device {
46 struct soc_camera_format_xlate *user_formats; 39 struct soc_camera_format_xlate *user_formats;
47 int num_user_formats; 40 int num_user_formats;
48 enum v4l2_field field; /* Preserve field over close() */ 41 enum v4l2_field field; /* Preserve field over close() */
49 struct module *owner;
50 void *host_priv; /* Per-device host private data */ 42 void *host_priv; /* Per-device host private data */
51 /* soc_camera.c private count. Only accessed with .video_lock held */ 43 /* soc_camera.c private count. Only accessed with .video_lock held */
52 int use_count; 44 int use_count;
@@ -59,8 +51,8 @@ struct soc_camera_file {
59}; 51};
60 52
61struct soc_camera_host { 53struct soc_camera_host {
54 struct v4l2_device v4l2_dev;
62 struct list_head list; 55 struct list_head list;
63 struct device *dev;
64 unsigned char nr; /* Host number */ 56 unsigned char nr; /* Host number */
65 void *priv; 57 void *priv;
66 const char *drv_name; 58 const char *drv_name;
@@ -73,9 +65,18 @@ struct soc_camera_host_ops {
73 void (*remove)(struct soc_camera_device *); 65 void (*remove)(struct soc_camera_device *);
74 int (*suspend)(struct soc_camera_device *, pm_message_t); 66 int (*suspend)(struct soc_camera_device *, pm_message_t);
75 int (*resume)(struct soc_camera_device *); 67 int (*resume)(struct soc_camera_device *);
68 /*
69 * .get_formats() is called for each client device format, but
70 * .put_formats() is only called once. Further, if any of the calls to
71 * .get_formats() fail, .put_formats() will not be called at all, the
72 * failing .get_formats() must then clean up internally.
73 */
76 int (*get_formats)(struct soc_camera_device *, int, 74 int (*get_formats)(struct soc_camera_device *, int,
77 struct soc_camera_format_xlate *); 75 struct soc_camera_format_xlate *);
78 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *); 76 void (*put_formats)(struct soc_camera_device *);
77 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
78 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *);
79 int (*set_crop)(struct soc_camera_device *, struct v4l2_crop *);
79 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); 80 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
80 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 81 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
81 void (*init_videobuf)(struct videobuf_queue *, 82 void (*init_videobuf)(struct videobuf_queue *,
@@ -83,7 +84,11 @@ struct soc_camera_host_ops {
83 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *); 84 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *);
84 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 85 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
85 int (*set_bus_param)(struct soc_camera_device *, __u32); 86 int (*set_bus_param)(struct soc_camera_device *, __u32);
87 int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
88 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
86 unsigned int (*poll)(struct file *, poll_table *); 89 unsigned int (*poll)(struct file *, poll_table *);
90 const struct v4l2_queryctrl *controls;
91 int num_controls;
87}; 92};
88 93
89#define SOCAM_SENSOR_INVERT_PCLK (1 << 0) 94#define SOCAM_SENSOR_INVERT_PCLK (1 << 0)
@@ -102,6 +107,12 @@ struct soc_camera_link {
102 int i2c_adapter_id; 107 int i2c_adapter_id;
103 struct i2c_board_info *board_info; 108 struct i2c_board_info *board_info;
104 const char *module_name; 109 const char *module_name;
110 /*
111 * For non-I2C devices platform platform has to provide methods to
112 * add a device to the system and to remove
113 */
114 int (*add_device)(struct soc_camera_link *, struct device *);
115 void (*del_device)(struct soc_camera_link *);
105 /* Optional callbacks to power on or off and reset the sensor */ 116 /* Optional callbacks to power on or off and reset the sensor */
106 int (*power)(struct device *, int); 117 int (*power)(struct device *, int);
107 int (*reset)(struct device *); 118 int (*reset)(struct device *);
@@ -115,27 +126,45 @@ struct soc_camera_link {
115 void (*free_bus)(struct soc_camera_link *); 126 void (*free_bus)(struct soc_camera_link *);
116}; 127};
117 128
118static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 129static inline struct soc_camera_device *to_soc_camera_dev(
130 const struct device *dev)
119{ 131{
120 return container_of(dev, struct soc_camera_device, dev); 132 return container_of(dev, struct soc_camera_device, dev);
121} 133}
122 134
123static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) 135static inline struct soc_camera_host *to_soc_camera_host(
136 const struct device *dev)
124{ 137{
125 return dev_get_drvdata(dev); 138 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
139
140 return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev);
126} 141}
127 142
128extern int soc_camera_host_register(struct soc_camera_host *ici); 143static inline struct soc_camera_link *to_soc_camera_link(
129extern void soc_camera_host_unregister(struct soc_camera_host *ici); 144 const struct soc_camera_device *icd)
130extern int soc_camera_device_register(struct soc_camera_device *icd); 145{
131extern void soc_camera_device_unregister(struct soc_camera_device *icd); 146 return icd->dev.platform_data;
147}
132 148
133extern int soc_camera_video_start(struct soc_camera_device *icd); 149static inline struct device *to_soc_camera_control(
134extern void soc_camera_video_stop(struct soc_camera_device *icd); 150 const struct soc_camera_device *icd)
151{
152 return dev_get_drvdata(&icd->dev);
153}
135 154
136extern const struct soc_camera_data_format *soc_camera_format_by_fourcc( 155static inline struct v4l2_subdev *soc_camera_to_subdev(
156 const struct soc_camera_device *icd)
157{
158 struct device *control = to_soc_camera_control(icd);
159 return dev_get_drvdata(control);
160}
161
162int soc_camera_host_register(struct soc_camera_host *ici);
163void soc_camera_host_unregister(struct soc_camera_host *ici);
164
165const struct soc_camera_data_format *soc_camera_format_by_fourcc(
137 struct soc_camera_device *icd, unsigned int fourcc); 166 struct soc_camera_device *icd, unsigned int fourcc);
138extern const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( 167const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
139 struct soc_camera_device *icd, unsigned int fourcc); 168 struct soc_camera_device *icd, unsigned int fourcc);
140 169
141struct soc_camera_data_format { 170struct soc_camera_data_format {
@@ -163,30 +192,11 @@ struct soc_camera_format_xlate {
163}; 192};
164 193
165struct soc_camera_ops { 194struct soc_camera_ops {
166 struct module *owner;
167 int (*probe)(struct soc_camera_device *);
168 void (*remove)(struct soc_camera_device *);
169 int (*suspend)(struct soc_camera_device *, pm_message_t state); 195 int (*suspend)(struct soc_camera_device *, pm_message_t state);
170 int (*resume)(struct soc_camera_device *); 196 int (*resume)(struct soc_camera_device *);
171 int (*init)(struct soc_camera_device *);
172 int (*release)(struct soc_camera_device *);
173 int (*start_capture)(struct soc_camera_device *);
174 int (*stop_capture)(struct soc_camera_device *);
175 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
176 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
177 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
178 unsigned long (*query_bus_param)(struct soc_camera_device *); 197 unsigned long (*query_bus_param)(struct soc_camera_device *);
179 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 198 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
180 int (*get_chip_id)(struct soc_camera_device *,
181 struct v4l2_dbg_chip_ident *);
182 int (*set_std)(struct soc_camera_device *, v4l2_std_id *);
183 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); 199 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
184#ifdef CONFIG_VIDEO_ADV_DEBUG
185 int (*get_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
186 int (*set_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
187#endif
188 int (*get_control)(struct soc_camera_device *, struct v4l2_control *);
189 int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
190 const struct v4l2_queryctrl *controls; 200 const struct v4l2_queryctrl *controls;
191 int num_controls; 201 int num_controls;
192}; 202};
@@ -268,6 +278,21 @@ static inline unsigned long soc_camera_bus_param_compatible(
268 common_flags; 278 common_flags;
269} 279}
270 280
281static inline void soc_camera_limit_side(unsigned int *start,
282 unsigned int *length, unsigned int start_min,
283 unsigned int length_min, unsigned int length_max)
284{
285 if (*length < length_min)
286 *length = length_min;
287 else if (*length > length_max)
288 *length = length_max;
289
290 if (*start < start_min)
291 *start = start_min;
292 else if (*start > start_min + length_max - *length)
293 *start = start_min + length_max - *length;
294}
295
271extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 296extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
272 unsigned long flags); 297 unsigned long flags);
273 298
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index 1d092b4678aa..bb70401b8141 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -12,15 +12,18 @@
12#define __SOC_CAMERA_H__ 12#define __SOC_CAMERA_H__
13 13
14#include <linux/videodev2.h> 14#include <linux/videodev2.h>
15#include <media/soc_camera.h>
16
17struct device;
15 18
16struct soc_camera_platform_info { 19struct soc_camera_platform_info {
17 int iface; 20 const char *format_name;
18 char *format_name;
19 unsigned long format_depth; 21 unsigned long format_depth;
20 struct v4l2_pix_format format; 22 struct v4l2_pix_format format;
21 unsigned long bus_param; 23 unsigned long bus_param;
22 void (*power)(int); 24 struct device *dev;
23 int (*set_capture)(struct soc_camera_platform_info *info, int enable); 25 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
26 struct soc_camera_link link;
24}; 27};
25 28
26#endif /* __SOC_CAMERA_H__ */ 29#endif /* __SOC_CAMERA_H__ */
diff --git a/include/media/tuner.h b/include/media/tuner.h
index c146f2f530b0..4d5b53ff17db 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -127,6 +127,8 @@
127#define TUNER_PHILIPS_FM1216MK5 79 127#define TUNER_PHILIPS_FM1216MK5 79
128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ 128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
129#define TUNER_PARTSNIC_PTI_5NF05 81 129#define TUNER_PARTSNIC_PTI_5NF05 81
130#define TUNER_PHILIPS_CU1216L 82
131#define TUNER_NXP_TDA18271 83
130 132
131/* tv card specific */ 133/* tv card specific */
132#define TDA9887_PRESENT (1<<0) 134#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/tvp514x.h b/include/media/tvp514x.h
index 5e7ee968c6dc..74387e83f5b9 100644
--- a/include/media/tvp514x.h
+++ b/include/media/tvp514x.h
@@ -104,10 +104,6 @@ enum tvp514x_output {
104 * @ vs_polarity: VSYNC Polarity configuration for current interface. 104 * @ vs_polarity: VSYNC Polarity configuration for current interface.
105 */ 105 */
106struct tvp514x_platform_data { 106struct tvp514x_platform_data {
107 char *master;
108 int (*power_set) (enum v4l2_power on);
109 int (*ifparm) (struct v4l2_ifparm *p);
110 int (*priv_data_set) (void *);
111 /* Interface control params */ 107 /* Interface control params */
112 bool clk_polarity; 108 bool clk_polarity;
113 bool hs_polarity; 109 bool hs_polarity;
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 94e908c0d7a0..cf16689adba7 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -135,6 +135,9 @@ enum {
135 /* module adv7175: just ident 7175 */ 135 /* module adv7175: just ident 7175 */
136 V4L2_IDENT_ADV7175 = 7175, 136 V4L2_IDENT_ADV7175 = 7175,
137 137
138 /* module adv7180: just ident 7180 */
139 V4L2_IDENT_ADV7180 = 7180,
140
138 /* module saa7185: just ident 7185 */ 141 /* module saa7185: just ident 7185 */
139 V4L2_IDENT_SAA7185 = 7185, 142 V4L2_IDENT_SAA7185 = 7185,
140 143
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 33a18426ab9b..1c25b10da34b 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -139,29 +139,23 @@ struct v4l2_subdev_ops;
139/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
140 Only call request_module if module_name != NULL. 140 Only call request_module if module_name != NULL.
141 The client_type argument is the name of the chip that's on the adapter. */ 141 The client_type argument is the name of the chip that's on the adapter. */
142struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, 142struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
143 struct i2c_adapter *adapter,
144 const char *module_name, const char *client_type, u8 addr);
145/* Probe and load an i2c module and return an initialized v4l2_subdev struct.
146 Only call request_module if module_name != NULL.
147 The client_type argument is the name of the chip that's on the adapter. */
148struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev,
149 struct i2c_adapter *adapter, 143 struct i2c_adapter *adapter,
150 const char *module_name, const char *client_type, 144 const char *module_name, const char *client_type,
151 const unsigned short *addrs); 145 int irq, void *platform_data,
152/* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */ 146 u8 addr, const unsigned short *probe_addrs);
153struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev,
154 struct i2c_adapter *adapter,
155 const char *module_name, const char *client_type, u8 addr);
156 147
157/* Load an i2c module and return an initialized v4l2_subdev struct. 148/* Load an i2c module and return an initialized v4l2_subdev struct.
158 Only call request_module if module_name != NULL. 149 Only call request_module if module_name != NULL.
159 The client_type argument is the name of the chip that's on the adapter. */ 150 The client_type argument is the name of the chip that's on the adapter. */
160struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, 151static inline struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
161 struct i2c_adapter *adapter, 152 struct i2c_adapter *adapter,
162 const char *module_name, const char *client_type, 153 const char *module_name, const char *client_type,
163 int irq, void *platform_data, 154 u8 addr, const unsigned short *probe_addrs)
164 u8 addr, const unsigned short *probe_addrs); 155{
156 return v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, module_name,
157 client_type, 0, NULL, addr, probe_addrs);
158}
165 159
166struct i2c_board_info; 160struct i2c_board_info;
167 161
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2058dd45e915..73c9867d744c 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -100,8 +100,10 @@ struct video_device
100 100
101 Also note that vdev->minor is set to -1 if the registration failed. */ 101 Also note that vdev->minor is set to -1 if the registration failed. */
102int __must_check video_register_device(struct video_device *vdev, int type, int nr); 102int __must_check video_register_device(struct video_device *vdev, int type, int nr);
103int __must_check video_register_device_index(struct video_device *vdev, 103
104 int type, int nr, int index); 104/* Same as video_register_device, but no warning is issued if the desired
105 device node number was already in use. */
106int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr);
105 107
106/* Unregister video devices. Will do nothing if vdev == NULL or 108/* Unregister video devices. Will do nothing if vdev == NULL or
107 vdev->minor < 0. */ 109 vdev->minor < 0. */