aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-02-02 09:25:31 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-02-18 09:14:53 -0500
commit057596eea8402aa8f7a670bf3195665aa8267204 (patch)
tree1c42fca7337e9b4000cb5d2fc2f9f7b53c7de31e /drivers/media/video/v4l2-common.c
parent1a4e30c3eaffb83218977477bb83d54316844acb (diff)
V4L/DVB (7133): Fix Kconfig dependencies
As pointed by Adrian Bunk, with I2C=m and VIDEO_DEV=y, videodev brokes. This patch moves the functions that videodev needs from v4l2-common. It also fixes some Kconfig changes. After this patch, I2C=m / VIDEO_DEV=y will make v4l2 core statically linked into kernel. v4l2-common will be m, and all V4L drivers will also be m. This approach is very conservative, since it is possible to have V4L drivers that don't need I2C or v4l2-common. The better is to map what drivers really need v4l2-common, making them to select v4l2-common, and allowing the others to be 'y', 'm' and 'n'. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r--drivers/media/video/v4l2-common.c351
1 files changed, 12 insertions, 339 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 4a8fc170138b..34deb68ae568 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -56,7 +56,6 @@
56#include <asm/pgtable.h> 56#include <asm/pgtable.h>
57#include <asm/io.h> 57#include <asm/io.h>
58#include <asm/div64.h> 58#include <asm/div64.h>
59#include <linux/video_decoder.h>
60#define __OLD_VIDIOC_ /* To allow fixing old calls*/ 59#define __OLD_VIDIOC_ /* To allow fixing old calls*/
61#include <media/v4l2-common.h> 60#include <media/v4l2-common.h>
62#include <media/v4l2-chip-ident.h> 61#include <media/v4l2-chip-ident.h>
@@ -81,107 +80,6 @@ MODULE_LICENSE("GPL");
81 * Video Standard Operations (contributed by Michael Schimek) 80 * Video Standard Operations (contributed by Michael Schimek)
82 */ 81 */
83 82
84char *v4l2_norm_to_name(v4l2_std_id id)
85{
86 char *name;
87 u32 myid = id;
88
89 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
90 64 bit comparations. So, on that architecture, with some gcc variants,
91 compilation fails. Currently, the max value is 30bit wide.
92 */
93 BUG_ON(myid != id);
94
95 switch (myid) {
96 case V4L2_STD_PAL:
97 name="PAL"; break;
98 case V4L2_STD_PAL_BG:
99 name="PAL-BG"; break;
100 case V4L2_STD_PAL_DK:
101 name="PAL-DK"; break;
102 case V4L2_STD_PAL_B:
103 name="PAL-B"; break;
104 case V4L2_STD_PAL_B1:
105 name="PAL-B1"; break;
106 case V4L2_STD_PAL_G:
107 name="PAL-G"; break;
108 case V4L2_STD_PAL_H:
109 name="PAL-H"; break;
110 case V4L2_STD_PAL_I:
111 name="PAL-I"; break;
112 case V4L2_STD_PAL_D:
113 name="PAL-D"; break;
114 case V4L2_STD_PAL_D1:
115 name="PAL-D1"; break;
116 case V4L2_STD_PAL_K:
117 name="PAL-K"; break;
118 case V4L2_STD_PAL_M:
119 name="PAL-M"; break;
120 case V4L2_STD_PAL_N:
121 name="PAL-N"; break;
122 case V4L2_STD_PAL_Nc:
123 name="PAL-Nc"; break;
124 case V4L2_STD_PAL_60:
125 name="PAL-60"; break;
126 case V4L2_STD_NTSC:
127 name="NTSC"; break;
128 case V4L2_STD_NTSC_M:
129 name="NTSC-M"; break;
130 case V4L2_STD_NTSC_M_JP:
131 name="NTSC-M-JP"; break;
132 case V4L2_STD_NTSC_443:
133 name="NTSC-443"; break;
134 case V4L2_STD_NTSC_M_KR:
135 name="NTSC-M-KR"; break;
136 case V4L2_STD_SECAM:
137 name="SECAM"; break;
138 case V4L2_STD_SECAM_DK:
139 name="SECAM-DK"; break;
140 case V4L2_STD_SECAM_B:
141 name="SECAM-B"; break;
142 case V4L2_STD_SECAM_D:
143 name="SECAM-D"; break;
144 case V4L2_STD_SECAM_G:
145 name="SECAM-G"; break;
146 case V4L2_STD_SECAM_H:
147 name="SECAM-H"; break;
148 case V4L2_STD_SECAM_K:
149 name="SECAM-K"; break;
150 case V4L2_STD_SECAM_K1:
151 name="SECAM-K1"; break;
152 case V4L2_STD_SECAM_L:
153 name="SECAM-L"; break;
154 case V4L2_STD_SECAM_LC:
155 name="SECAM-LC"; break;
156 default:
157 name="Unknown"; break;
158 }
159
160 return name;
161}
162
163/* Fill in the fields of a v4l2_standard structure according to the
164 'id' and 'transmission' parameters. Returns negative on error. */
165int v4l2_video_std_construct(struct v4l2_standard *vs,
166 int id, char *name)
167{
168 u32 index = vs->index;
169
170 memset(vs, 0, sizeof(struct v4l2_standard));
171 vs->index = index;
172 vs->id = id;
173 if (id & V4L2_STD_525_60) {
174 vs->frameperiod.numerator = 1001;
175 vs->frameperiod.denominator = 30000;
176 vs->framelines = 525;
177 } else {
178 vs->frameperiod.numerator = 1;
179 vs->frameperiod.denominator = 25;
180 vs->framelines = 625;
181 }
182 strlcpy(vs->name,name,sizeof(vs->name));
183 return 0;
184}
185 83
186/* ----------------------------------------------------------------- */ 84/* ----------------------------------------------------------------- */
187/* priority handling */ 85/* priority handling */
@@ -195,6 +93,7 @@ int v4l2_prio_init(struct v4l2_prio_state *global)
195 memset(global,0,sizeof(*global)); 93 memset(global,0,sizeof(*global));
196 return 0; 94 return 0;
197} 95}
96EXPORT_SYMBOL(v4l2_prio_init);
198 97
199int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, 98int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
200 enum v4l2_priority new) 99 enum v4l2_priority new)
@@ -210,11 +109,13 @@ int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
210 *local = new; 109 *local = new;
211 return 0; 110 return 0;
212} 111}
112EXPORT_SYMBOL(v4l2_prio_change);
213 113
214int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local) 114int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local)
215{ 115{
216 return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT); 116 return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT);
217} 117}
118EXPORT_SYMBOL(v4l2_prio_open);
218 119
219int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local) 120int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local)
220{ 121{
@@ -222,6 +123,7 @@ int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local)
222 atomic_dec(&global->prios[*local]); 123 atomic_dec(&global->prios[*local]);
223 return 0; 124 return 0;
224} 125}
126EXPORT_SYMBOL(v4l2_prio_close);
225 127
226enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global) 128enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
227{ 129{
@@ -233,6 +135,7 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
233 return V4L2_PRIORITY_BACKGROUND; 135 return V4L2_PRIORITY_BACKGROUND;
234 return V4L2_PRIORITY_UNSET; 136 return V4L2_PRIORITY_UNSET;
235} 137}
138EXPORT_SYMBOL(v4l2_prio_max);
236 139
237int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local) 140int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
238{ 141{
@@ -240,220 +143,7 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
240 return -EBUSY; 143 return -EBUSY;
241 return 0; 144 return 0;
242} 145}
243 146EXPORT_SYMBOL(v4l2_prio_check);
244
245/* ----------------------------------------------------------------- */
246/* some arrays for pretty-printing debug messages of enum types */
247
248char *v4l2_field_names[] = {
249 [V4L2_FIELD_ANY] = "any",
250 [V4L2_FIELD_NONE] = "none",
251 [V4L2_FIELD_TOP] = "top",
252 [V4L2_FIELD_BOTTOM] = "bottom",
253 [V4L2_FIELD_INTERLACED] = "interlaced",
254 [V4L2_FIELD_SEQ_TB] = "seq-tb",
255 [V4L2_FIELD_SEQ_BT] = "seq-bt",
256 [V4L2_FIELD_ALTERNATE] = "alternate",
257 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
258 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
259};
260
261char *v4l2_type_names[] = {
262 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap",
263 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over",
264 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out",
265 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
266 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
267 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
268 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
269 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
270};
271
272/* ------------------------------------------------------------------ */
273/* debug help functions */
274
275#ifdef CONFIG_VIDEO_V4L1_COMPAT
276static const char *v4l1_ioctls[] = {
277 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
278 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
279 [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN",
280 [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER",
281 [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER",
282 [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT",
283 [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT",
284 [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE",
285 [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN",
286 [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN",
287 [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF",
288 [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF",
289 [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY",
290 [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ",
291 [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ",
292 [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO",
293 [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO",
294 [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC",
295 [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE",
296 [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF",
297 [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT",
298 [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE",
299 [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE",
300 [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE",
301 [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
302 [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO",
303 [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
304 [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT",
305 [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT"
306};
307#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
308#endif
309
310static const char *v4l2_ioctls[] = {
311 [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP",
312 [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED",
313 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT",
314 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT",
315 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT",
316 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS",
317 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF",
318 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF",
319 [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF",
320 [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY",
321 [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF",
322 [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF",
323 [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON",
324 [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF",
325 [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM",
326 [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM",
327 [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD",
328 [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD",
329 [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD",
330 [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT",
331 [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL",
332 [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL",
333 [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER",
334 [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER",
335 [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO",
336 [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO",
337 [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL",
338 [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU",
339 [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT",
340 [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT",
341 [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT",
342 [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT",
343 [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT",
344 [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT",
345 [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT",
346 [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR",
347 [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR",
348 [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY",
349 [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY",
350 [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP",
351 [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP",
352 [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP",
353 [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP",
354 [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP",
355 [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD",
356 [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT",
357 [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO",
358 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
359 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
360 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
361 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
362 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
363 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
364 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
365 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
366#if 1
367 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
368 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
369 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
370 [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
371 [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
372
373 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
374 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
375
376 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
377#endif
378};
379#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
380
381static const char *v4l2_int_ioctls[] = {
382#ifdef CONFIG_VIDEO_V4L1_COMPAT
383 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
384 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
385 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
386 [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT",
387 [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT",
388 [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT",
389 [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE",
390 [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO",
391 [_IOC_NR(DECODER_INIT)] = "DECODER_INIT",
392 [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS",
393 [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP",
394#endif
395 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
396
397 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
398 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
399 [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG",
400
401 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
402 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",
403 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
404 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE",
405 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA",
406 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA",
407 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ",
408 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY",
409 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING",
410 [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING",
411 [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING",
412 [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING",
413 [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ",
414 [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT",
415 [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT",
416 [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT",
417};
418#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
419
420/* Common ioctl debug function. This function can be used by
421 external ioctl messages as well as internal V4L ioctl */
422void v4l_printk_ioctl(unsigned int cmd)
423{
424 char *dir;
425
426 switch (_IOC_DIR(cmd)) {
427 case _IOC_NONE: dir = "--"; break;
428 case _IOC_READ: dir = "r-"; break;
429 case _IOC_WRITE: dir = "-w"; break;
430 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
431 default: dir = "*ERR*"; break;
432 }
433 switch (_IOC_TYPE(cmd)) {
434 case 'd':
435 printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n",
436 (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
437 v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
438 break;
439#ifdef CONFIG_VIDEO_V4L1_COMPAT
440 case 'v':
441 printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
442 (_IOC_NR(cmd) < V4L1_IOCTLS) ?
443 v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
444 break;
445#endif
446 case 'V':
447 printk("v4l2 ioctl %s, dir=%s (0x%08x)\n",
448 (_IOC_NR(cmd) < V4L2_IOCTLS) ?
449 v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
450 break;
451
452 default:
453 printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n",
454 _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
455 }
456}
457 147
458/* ----------------------------------------------------------------- */ 148/* ----------------------------------------------------------------- */
459 149
@@ -482,6 +172,7 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
482 } 172 }
483 return 0; 173 return 0;
484} 174}
175EXPORT_SYMBOL(v4l2_ctrl_check);
485 176
486/* Returns NULL or a character pointer array containing the menu for 177/* Returns NULL or a character pointer array containing the menu for
487 the given control ID. The pointer array ends with a NULL pointer. 178 the given control ID. The pointer array ends with a NULL pointer.
@@ -642,6 +333,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
642 return NULL; 333 return NULL;
643 } 334 }
644} 335}
336EXPORT_SYMBOL(v4l2_ctrl_get_menu);
645 337
646/* Fill in a struct v4l2_queryctrl */ 338/* Fill in a struct v4l2_queryctrl */
647int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def) 339int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def)
@@ -764,6 +456,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
764 snprintf(qctrl->name, sizeof(qctrl->name), name); 456 snprintf(qctrl->name, sizeof(qctrl->name), name);
765 return 0; 457 return 0;
766} 458}
459EXPORT_SYMBOL(v4l2_ctrl_query_fill);
767 460
768/* Fill in a struct v4l2_queryctrl with standard values based on 461/* Fill in a struct v4l2_queryctrl with standard values based on
769 the control ID. */ 462 the control ID. */
@@ -898,6 +591,7 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl)
898 return -EINVAL; 591 return -EINVAL;
899 } 592 }
900} 593}
594EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
901 595
902/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and 596/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and
903 the menu. The qctrl pointer may be NULL, in which case it is ignored. */ 597 the menu. The qctrl pointer may be NULL, in which case it is ignored. */
@@ -916,6 +610,7 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc
916 qmenu->reserved = 0; 610 qmenu->reserved = 0;
917 return 0; 611 return 0;
918} 612}
613EXPORT_SYMBOL(v4l2_ctrl_query_menu);
919 614
920/* ctrl_classes points to an array of u32 pointers, the last element is 615/* ctrl_classes points to an array of u32 pointers, the last element is
921 a NULL pointer. Each u32 array is a 0-terminated array of control IDs. 616 a NULL pointer. Each u32 array is a 0-terminated array of control IDs.
@@ -966,6 +661,7 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
966 return 0; 661 return 0;
967 return **ctrl_classes; 662 return **ctrl_classes;
968} 663}
664EXPORT_SYMBOL(v4l2_ctrl_next);
969 665
970int v4l2_chip_match_host(u32 match_type, u32 match_chip) 666int v4l2_chip_match_host(u32 match_type, u32 match_chip)
971{ 667{
@@ -1038,26 +734,3 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver
1038} 734}
1039EXPORT_SYMBOL(v4l2_i2c_attach); 735EXPORT_SYMBOL(v4l2_i2c_attach);
1040#endif 736#endif
1041
1042/* ----------------------------------------------------------------- */
1043
1044EXPORT_SYMBOL(v4l2_norm_to_name);
1045EXPORT_SYMBOL(v4l2_video_std_construct);
1046
1047EXPORT_SYMBOL(v4l2_prio_init);
1048EXPORT_SYMBOL(v4l2_prio_change);
1049EXPORT_SYMBOL(v4l2_prio_open);
1050EXPORT_SYMBOL(v4l2_prio_close);
1051EXPORT_SYMBOL(v4l2_prio_max);
1052EXPORT_SYMBOL(v4l2_prio_check);
1053
1054EXPORT_SYMBOL(v4l2_field_names);
1055EXPORT_SYMBOL(v4l2_type_names);
1056EXPORT_SYMBOL(v4l_printk_ioctl);
1057
1058EXPORT_SYMBOL(v4l2_ctrl_next);
1059EXPORT_SYMBOL(v4l2_ctrl_check);
1060EXPORT_SYMBOL(v4l2_ctrl_get_menu);
1061EXPORT_SYMBOL(v4l2_ctrl_query_menu);
1062EXPORT_SYMBOL(v4l2_ctrl_query_fill);
1063EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);