]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/easycap/easycap_settings.c
Merge branch 'for-paul-38-rebased' of git://gitorious.org/linux-omap-dss2/linux
[mv-sheeva.git] / drivers / staging / easycap / easycap_settings.c
1 /******************************************************************************
2 *                                                                             *
3 *  easycap_settings.c                                                         *
4 *                                                                             *
5 ******************************************************************************/
6 /*
7  *
8  *  Copyright (C) 2010 R.M. Thomas  <rmthomas@sciolus.org>
9  *
10  *
11  *  This is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  The software is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this software; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  *
25 */
26 /*****************************************************************************/
27
28 #include "easycap.h"
29 #include "easycap_debug.h"
30
31 /*---------------------------------------------------------------------------*/
32 /*
33  *  THE LEAST SIGNIFICANT BIT OF easycap_standard.mask HAS MEANING:
34  *                         0 => 25 fps
35  *                         1 => 30 fps
36  *
37  *  THE MOST  SIGNIFICANT BIT OF easycap_standard.mask HAS MEANING:
38  *                         0 => full framerate
39  *                         1 => 20%  framerate
40  */
41 /*---------------------------------------------------------------------------*/
42 const struct easycap_standard easycap_standard[] = {
43 {
44 .mask = 0x00FF & PAL_BGHIN ,
45 .v4l2_standard = {
46         .index = PAL_BGHIN,
47         .id = (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_H | \
48                                         V4L2_STD_PAL_I | V4L2_STD_PAL_N),
49         .name = "PAL_BGHIN",
50         .frameperiod = {1, 25},
51         .framelines = 625,
52         .reserved = {0, 0, 0, 0}
53         }
54 },
55 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
56 {
57 .mask = 0x00FF & NTSC_N_443 ,
58 .v4l2_standard = {
59         .index = NTSC_N_443,
60         .id = V4L2_STD_UNKNOWN,
61         .name = "NTSC_N_443",
62         .frameperiod = {1, 25},
63         .framelines = 480,
64         .reserved = {0, 0, 0, 0}
65 }
66 },
67 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
68 {
69 .mask = 0x00FF & PAL_Nc ,
70 .v4l2_standard = {
71         .index = PAL_Nc,
72         .id = V4L2_STD_PAL_Nc,
73         .name = "PAL_Nc",
74         .frameperiod = {1, 25},
75         .framelines = 625,
76         .reserved = {0, 0, 0, 0}
77 }
78 },
79 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
80 {
81 .mask = 0x00FF & NTSC_N ,
82 .v4l2_standard = {
83         .index = NTSC_N,
84         .id = V4L2_STD_UNKNOWN,
85         .name = "NTSC_N",
86         .frameperiod = {1, 25},
87         .framelines = 525,
88         .reserved = {0, 0, 0, 0}
89 }
90 },
91 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
92 {
93 .mask = 0x00FF & SECAM ,
94 .v4l2_standard = {
95         .index = SECAM,
96         .id = V4L2_STD_SECAM,
97         .name = "SECAM",
98         .frameperiod = {1, 25},
99         .framelines = 625,
100         .reserved = {0, 0, 0, 0}
101 }
102 },
103 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
104 {
105 .mask = 0x00FF & NTSC_M ,
106 .v4l2_standard = {
107         .index = NTSC_M,
108         .id = V4L2_STD_NTSC_M,
109         .name = "NTSC_M",
110         .frameperiod = {1, 30},
111         .framelines = 525,
112         .reserved = {0, 0, 0, 0}
113 }
114 },
115 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
116 {
117 .mask = 0x00FF & NTSC_M_JP ,
118 .v4l2_standard = {
119         .index = NTSC_M_JP,
120         .id = V4L2_STD_NTSC_M_JP,
121         .name = "NTSC_M_JP",
122         .frameperiod = {1, 30},
123         .framelines = 525,
124         .reserved = {0, 0, 0, 0}
125 }
126 },
127 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
128 {
129 .mask = 0x00FF & PAL_60 ,
130 .v4l2_standard = {
131         .index = PAL_60,
132         .id = V4L2_STD_PAL_60,
133         .name = "PAL_60",
134         .frameperiod = {1, 30},
135         .framelines = 525,
136         .reserved = {0, 0, 0, 0}
137 }
138 },
139 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
140 {
141 .mask = 0x00FF & NTSC_443 ,
142 .v4l2_standard = {
143         .index = NTSC_443,
144         .id = V4L2_STD_NTSC_443,
145         .name = "NTSC_443",
146         .frameperiod = {1, 30},
147         .framelines = 525,
148         .reserved = {0, 0, 0, 0}
149 }
150 },
151 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
152 {
153 .mask = 0x00FF & PAL_M ,
154 .v4l2_standard = {
155         .index = PAL_M,
156         .id = V4L2_STD_PAL_M,
157         .name = "PAL_M",
158         .frameperiod = {1, 30},
159         .framelines = 525,
160         .reserved = {0, 0, 0, 0}
161 }
162 },
163 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
164 {
165 .mask = 0x8000 | (0x00FF & PAL_BGHIN_SLOW),
166 .v4l2_standard = {
167         .index = PAL_BGHIN_SLOW,
168         .id = (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_H | \
169                                 V4L2_STD_PAL_I | V4L2_STD_PAL_N | \
170                                         (((v4l2_std_id)0x01) << 32)),
171         .name = "PAL_BGHIN_SLOW",
172         .frameperiod = {1, 5},
173         .framelines = 625,
174         .reserved = {0, 0, 0, 0}
175 }
176 },
177 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
178 {
179 .mask = 0x8000 | (0x00FF & NTSC_N_443_SLOW),
180 .v4l2_standard = {
181         .index = NTSC_N_443_SLOW,
182         .id = (V4L2_STD_UNKNOWN | (((v4l2_std_id)0x11) << 32)),
183         .name = "NTSC_N_443_SLOW",
184         .frameperiod = {1, 5},
185         .framelines = 480,
186         .reserved = {0, 0, 0, 0}
187 }
188 },
189 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
190 {
191 .mask = 0x8000 | (0x00FF & PAL_Nc_SLOW),
192 .v4l2_standard = {
193         .index = PAL_Nc_SLOW,
194         .id = (V4L2_STD_PAL_Nc | (((v4l2_std_id)0x01) << 32)),
195         .name = "PAL_Nc_SLOW",
196         .frameperiod = {1, 5},
197         .framelines = 625,
198         .reserved = {0, 0, 0, 0}
199 }
200 },
201 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
202 {
203 .mask = 0x8000 | (0x00FF & NTSC_N_SLOW),
204 .v4l2_standard = {
205         .index = NTSC_N_SLOW,
206         .id = (V4L2_STD_UNKNOWN | (((v4l2_std_id)0x21) << 32)),
207         .name = "NTSC_N_SLOW",
208         .frameperiod = {1, 5},
209         .framelines = 525,
210         .reserved = {0, 0, 0, 0}
211 }
212 },
213 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
214 {
215 .mask = 0x8000 | (0x00FF & SECAM_SLOW),
216 .v4l2_standard = {
217         .index = SECAM_SLOW,
218         .id = (V4L2_STD_SECAM | (((v4l2_std_id)0x01) << 32)),
219         .name = "SECAM_SLOW",
220         .frameperiod = {1, 5},
221         .framelines = 625,
222         .reserved = {0, 0, 0, 0}
223 }
224 },
225 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
226 {
227 .mask = 0x8000 | (0x00FF & NTSC_M_SLOW),
228 .v4l2_standard = {
229         .index = NTSC_M_SLOW,
230         .id = (V4L2_STD_NTSC_M | (((v4l2_std_id)0x01) << 32)),
231         .name = "NTSC_M_SLOW",
232         .frameperiod = {1, 6},
233         .framelines = 525,
234         .reserved = {0, 0, 0, 0}
235 }
236 },
237 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
238 {
239 .mask = 0x8000 | (0x00FF & NTSC_M_JP_SLOW),
240 .v4l2_standard = {
241         .index = NTSC_M_JP_SLOW,
242         .id = (V4L2_STD_NTSC_M_JP | (((v4l2_std_id)0x01) << 32)),
243         .name = "NTSC_M_JP_SLOW",
244         .frameperiod = {1, 6},
245         .framelines = 525,
246         .reserved = {0, 0, 0, 0}
247 }
248 },
249 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
250 {
251 .mask = 0x8000 | (0x00FF & PAL_60_SLOW),
252 .v4l2_standard = {
253         .index = PAL_60_SLOW,
254         .id = (V4L2_STD_PAL_60 | (((v4l2_std_id)0x01) << 32)),
255         .name = "PAL_60_SLOW",
256         .frameperiod = {1, 6},
257         .framelines = 525,
258         .reserved = {0, 0, 0, 0}
259 }
260 },
261 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
262 {
263 .mask = 0x8000 | (0x00FF & NTSC_443_SLOW),
264 .v4l2_standard = {
265         .index = NTSC_443_SLOW,
266         .id = (V4L2_STD_NTSC_443 | (((v4l2_std_id)0x01) << 32)),
267         .name = "NTSC_443_SLOW",
268         .frameperiod = {1, 6},
269         .framelines = 525,
270         .reserved = {0, 0, 0, 0}
271 }
272 },
273 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
274 {
275 .mask = 0x8000 | (0x00FF & PAL_M_SLOW),
276 .v4l2_standard = {
277         .index = PAL_M_SLOW,
278         .id = (V4L2_STD_PAL_M | (((v4l2_std_id)0x01) << 32)),
279         .name = "PAL_M_SLOW",
280         .frameperiod = {1, 6},
281         .framelines = 525,
282         .reserved = {0, 0, 0, 0}
283 }
284 },
285 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
286 {
287 .mask = 0xFFFF
288 }
289 };
290 /*---------------------------------------------------------------------------*/
291 /*
292  *  THE 16-BIT easycap_format.mask HAS MEANING:
293  *    (least significant) BIT  0:     0 => PAL, 25 FPS;   1 => NTSC, 30 FPS
294  *                        BITS 2-4:   RESERVED FOR DIFFERENTIATING STANDARDS
295  *                        BITS 5-7:   NUMBER OF BYTES PER PIXEL
296  *                        BIT  8:     0 => NATIVE BYTE ORDER;  1 => SWAPPED
297  *                        BITS 9-10:  RESERVED FOR OTHER BYTE PERMUTATIONS
298  *                        BIT 11:     0 => UNDECIMATED;    1 => DECIMATED
299  *                        BIT 12:     0 => OFFER FRAMES;   1 => OFFER FIELDS
300  *                        BIT 13:     0 => FULL FRAMERATE; 1 => REDUCED
301  *     (most significant) BITS 14-15: RESERVED FOR OTHER FIELD/FRAME OPTIONS
302  *  IT FOLLOWS THAT:
303  *     bytesperpixel IS         ((0x00E0 & easycap_format.mask) >> 5)
304  *     byteswaporder IS true IF (0 != (0x0100 & easycap_format.mask))
305  *
306  *     decimatepixel IS true IF (0 != (0x0800 & easycap_format.mask))
307  *
308  *       offerfields IS true IF (0 != (0x1000 & easycap_format.mask))
309  */
310 /*---------------------------------------------------------------------------*/
311
312 struct easycap_format easycap_format[1 + SETTINGS_MANY];
313
314 int
315 fillin_formats(void)
316 {
317 int i, j, k, m, n;
318 __u32 width, height, pixelformat, bytesperline, sizeimage;
319 __u32 field, colorspace;
320 __u16 mask1, mask2, mask3, mask4;
321 char name1[32], name2[32], name3[32], name4[32];
322
323 for (i = 0, n = 0; i < STANDARD_MANY; i++) {
324         mask1 = 0x0000;
325         switch (i) {
326         case PAL_BGHIN: {
327                 mask1 = 0x1F & PAL_BGHIN;
328                 strcpy(&name1[0], "PAL_BGHIN");
329                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
330                 break;
331         }
332         case SECAM: {
333                 mask1 = 0x1F & SECAM;
334                 strcpy(&name1[0], "SECAM");
335                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
336                 break;
337         }
338         case PAL_Nc: {
339                 mask1 = 0x1F & PAL_Nc;
340                 strcpy(&name1[0], "PAL_Nc");
341                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
342                 break;
343         }
344         case PAL_60: {
345                 mask1 = 0x1F & PAL_60;
346                 strcpy(&name1[0], "PAL_60");
347                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
348                 break;
349         }
350         case PAL_M: {
351                 mask1 = 0x1F & PAL_M;
352                 strcpy(&name1[0], "PAL_M");
353                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
354                 break;
355         }
356         case NTSC_M: {
357                 mask1 = 0x1F & NTSC_M;
358                 strcpy(&name1[0], "NTSC_M");
359                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
360                 break;
361         }
362         case NTSC_443: {
363                 mask1 = 0x1F & NTSC_443;
364                 strcpy(&name1[0], "NTSC_443");
365                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
366                 break;
367         }
368         case NTSC_M_JP: {
369                 mask1 = 0x1F & NTSC_M_JP;
370                 strcpy(&name1[0], "NTSC_M_JP");
371                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
372                 break;
373         }
374         case NTSC_N: {
375                 mask1 = 0x1F & NTSC_M;
376                 strcpy(&name1[0], "NTSC_N");
377                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
378                 break;
379         }
380         case NTSC_N_443: {
381                 mask1 = 0x1F & NTSC_N_443;
382                 strcpy(&name1[0], "NTSC_N_443");
383                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
384                 break;
385         }
386         case PAL_BGHIN_SLOW: {
387                 mask1 = 0x001F & PAL_BGHIN_SLOW;
388                 mask1 |= 0x0200;
389                 strcpy(&name1[0], "PAL_BGHIN_SLOW");
390                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
391                 break;
392         }
393         case SECAM_SLOW: {
394                 mask1 = 0x001F & SECAM_SLOW;
395                 mask1 |= 0x0200;
396                 strcpy(&name1[0], "SECAM_SLOW");
397                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
398                 break;
399         }
400         case PAL_Nc_SLOW: {
401                 mask1 = 0x001F & PAL_Nc_SLOW;
402                 mask1 |= 0x0200;
403                 strcpy(&name1[0], "PAL_Nc_SLOW");
404                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
405                 break;
406         }
407         case PAL_60_SLOW: {
408                 mask1 = 0x001F & PAL_60_SLOW;
409                 mask1 |= 0x0200;
410                 strcpy(&name1[0], "PAL_60_SLOW");
411                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
412                 break;
413         }
414         case PAL_M_SLOW: {
415                 mask1 = 0x001F & PAL_M_SLOW;
416                 mask1 |= 0x0200;
417                 strcpy(&name1[0], "PAL_M_SLOW");
418                 colorspace = V4L2_COLORSPACE_470_SYSTEM_BG;
419                 break;
420         }
421         case NTSC_M_SLOW: {
422                 mask1 = 0x001F & NTSC_M_SLOW;
423                 mask1 |= 0x0200;
424                 strcpy(&name1[0], "NTSC_M_SLOW");
425                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
426                 break;
427         }
428         case NTSC_443_SLOW: {
429                 mask1 = 0x001F & NTSC_443_SLOW;
430                 mask1 |= 0x0200;
431                 strcpy(&name1[0], "NTSC_443_SLOW");
432                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
433                 break;
434         }
435         case NTSC_M_JP_SLOW: {
436                 mask1 = 0x001F & NTSC_M_JP_SLOW;
437                 mask1 |= 0x0200;
438                 strcpy(&name1[0], "NTSC_M_JP_SLOW");
439                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
440                 break;
441         }
442         case NTSC_N_SLOW: {
443                 mask1 = 0x001F & NTSC_N_SLOW;
444                 mask1 |= 0x0200;
445                 strcpy(&name1[0], "NTSC_N_SLOW");
446                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
447                 break;
448         }
449         case NTSC_N_443_SLOW: {
450                 mask1 = 0x001F & NTSC_N_443_SLOW;
451                 mask1 |= 0x0200;
452                 strcpy(&name1[0], "NTSC_N_443_SLOW");
453                 colorspace = V4L2_COLORSPACE_470_SYSTEM_M;
454                 break;
455         }
456         default:
457                 return -1;
458         }
459
460         for (j = 0; j < RESOLUTION_MANY; j++) {
461                 mask2 = 0x0000;
462                 switch (j) {
463                 case AT_720x576: {
464                         if (0x1 & mask1)
465                                 continue;
466                         strcpy(&name2[0], "_AT_720x576");
467                         width = 720; height = 576; break;
468                 }
469                 case AT_704x576: {
470                         if (0x1 & mask1)
471                                 continue;
472                         strcpy(&name2[0], "_AT_704x576");
473                         width = 704; height = 576; break;
474                 }
475                 case AT_640x480: {
476                         strcpy(&name2[0], "_AT_640x480");
477                         width = 640; height = 480; break;
478                 }
479                 case AT_720x480: {
480                         if (!(0x1 & mask1))
481                                 continue;
482                         strcpy(&name2[0], "_AT_720x480");
483                         width = 720; height = 480; break;
484                 }
485                 case AT_360x288: {
486                         if (0x1 & mask1)
487                                 continue;
488                         strcpy(&name2[0], "_AT_360x288");
489                         width = 360; height = 288; mask2 = 0x0800; break;
490                 }
491                 case AT_320x240: {
492                         strcpy(&name2[0], "_AT_320x240");
493                         width = 320; height = 240; mask2 = 0x0800; break;
494                 }
495                 case AT_360x240: {
496                         if (!(0x1 & mask1))
497                                 continue;
498                         strcpy(&name2[0], "_AT_360x240");
499                         width = 360; height = 240; mask2 = 0x0800; break;
500                 }
501                 default:
502                         return -2;
503                 }
504
505                 for (k = 0; k < PIXELFORMAT_MANY; k++) {
506                         mask3 = 0x0000;
507                         switch (k) {
508                         case FMT_UYVY: {
509                                 strcpy(&name3[0], "_" STRINGIZE(FMT_UYVY));
510                                 pixelformat = V4L2_PIX_FMT_UYVY;
511                                 mask3 |= (0x02 << 5);
512                                 break;
513                         }
514                         case FMT_YUY2: {
515                                 strcpy(&name3[0], "_" STRINGIZE(FMT_YUY2));
516                                 pixelformat = V4L2_PIX_FMT_YUYV;
517                                 mask3 |= (0x02 << 5);
518                                 mask3 |= 0x0100;
519                                 break;
520                         }
521                         case FMT_RGB24: {
522                                 strcpy(&name3[0], "_" STRINGIZE(FMT_RGB24));
523                                 pixelformat = V4L2_PIX_FMT_RGB24;
524                                 mask3 |= (0x03 << 5);
525                                 break;
526                         }
527                         case FMT_RGB32: {
528                                 strcpy(&name3[0], "_" STRINGIZE(FMT_RGB32));
529                                 pixelformat = V4L2_PIX_FMT_RGB32;
530                                 mask3 |= (0x04 << 5);
531                                 break;
532                         }
533                         case FMT_BGR24: {
534                                 strcpy(&name3[0], "_" STRINGIZE(FMT_BGR24));
535                                 pixelformat = V4L2_PIX_FMT_BGR24;
536                                 mask3 |= (0x03 << 5);
537                                 mask3 |= 0x0100;
538                                 break;
539                         }
540                         case FMT_BGR32: {
541                                 strcpy(&name3[0], "_" STRINGIZE(FMT_BGR32));
542                                 pixelformat = V4L2_PIX_FMT_BGR32;
543                                 mask3 |= (0x04 << 5);
544                                 mask3 |= 0x0100;
545                                 break;
546                         }
547                         default:
548                                 return -3;
549                         }
550                         bytesperline = width * ((mask3 & 0x00F0) >> 4);
551                         sizeimage =  bytesperline * height;
552
553                         for (m = 0; m < INTERLACE_MANY; m++) {
554                                 mask4 = 0x0000;
555                                 switch (m) {
556                                 case FIELD_NONE: {
557                                         strcpy(&name4[0], "-n");
558                                         field = V4L2_FIELD_NONE;
559                                         break;
560                                 }
561                                 case FIELD_INTERLACED: {
562                                         strcpy(&name4[0], "-i");
563                                         mask4 |= 0x1000;
564                                         field = V4L2_FIELD_INTERLACED;
565                                         break;
566                                 }
567                                 default:
568                                         return -4;
569                                 }
570                                 if (SETTINGS_MANY <= n)
571                                         return -5;
572                                 strcpy(&easycap_format[n].name[0], &name1[0]);
573                                 strcat(&easycap_format[n].name[0], &name2[0]);
574                                 strcat(&easycap_format[n].name[0], &name3[0]);
575                                 strcat(&easycap_format[n].name[0], &name4[0]);
576                                 easycap_format[n].mask = \
577                                                 mask1 | mask2 | mask3 | mask4;
578                                 easycap_format[n].v4l2_format\
579                                         .type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
580                                 easycap_format[n].v4l2_format\
581                                         .fmt.pix.width = width;
582                                 easycap_format[n].v4l2_format\
583                                         .fmt.pix.height = height;
584                                 easycap_format[n].v4l2_format\
585                                         .fmt.pix.pixelformat = pixelformat;
586                                 easycap_format[n].v4l2_format\
587                                         .fmt.pix.field = field;
588                                 easycap_format[n].v4l2_format\
589                                         .fmt.pix.bytesperline = bytesperline;
590                                 easycap_format[n].v4l2_format\
591                                         .fmt.pix.sizeimage = sizeimage;
592                                 easycap_format[n].v4l2_format\
593                                         .fmt.pix.colorspace = colorspace;
594                                 easycap_format[n].v4l2_format\
595                                         .fmt.pix.priv = 0;
596                                 n++;
597                         }
598                 }
599         }
600 }
601 if ((1 + SETTINGS_MANY) <= n)
602         return -6;
603 easycap_format[n].mask = 0xFFFF;
604 return n;
605 }
606 /*---------------------------------------------------------------------------*/
607 struct v4l2_queryctrl easycap_control[] = \
608 {{
609 .id       = V4L2_CID_BRIGHTNESS,
610 .type     = V4L2_CTRL_TYPE_INTEGER,
611 .name     = "Brightness",
612 .minimum  = 0,
613 .maximum  = 255,
614 .step     =  1,
615 .default_value = SAA_0A_DEFAULT,
616 .flags    = 0,
617 .reserved = {0, 0}
618 },
619 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
620 {
621 .id       = V4L2_CID_CONTRAST,
622 .type     = V4L2_CTRL_TYPE_INTEGER,
623 .name     = "Contrast",
624 .minimum  = 0,
625 .maximum  = 255,
626 .step     =   1,
627 .default_value = SAA_0B_DEFAULT + 128,
628 .flags    = 0,
629 .reserved = {0, 0}
630 },
631 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
632 {
633 .id       = V4L2_CID_SATURATION,
634 .type     = V4L2_CTRL_TYPE_INTEGER,
635 .name     = "Saturation",
636 .minimum  = 0,
637 .maximum  = 255,
638 .step     =   1,
639 .default_value = SAA_0C_DEFAULT + 128,
640 .flags    = 0,
641 .reserved = {0, 0}
642 },
643 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
644 {
645 .id       = V4L2_CID_HUE,
646 .type     = V4L2_CTRL_TYPE_INTEGER,
647 .name     = "Hue",
648 .minimum  = 0,
649 .maximum  = 255,
650 .step     =   1,
651 .default_value = SAA_0D_DEFAULT + 128,
652 .flags    = 0,
653 .reserved = {0, 0}
654 },
655 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
656 {
657 .id       = V4L2_CID_AUDIO_VOLUME,
658 .type     = V4L2_CTRL_TYPE_INTEGER,
659 .name     = "Volume",
660 .minimum  = 0,
661 .maximum  = 31,
662 .step     =   1,
663 .default_value = 16,
664 .flags    = 0,
665 .reserved = {0, 0}
666 },
667 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
668 {
669 .id       = V4L2_CID_AUDIO_MUTE,
670 .type     = V4L2_CTRL_TYPE_BOOLEAN,
671 .name     = "Mute",
672 .default_value = true,
673 .flags    = 0,
674 .reserved = {0, 0}
675 },
676 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
677 {
678 .id = 0xFFFFFFFF
679 }
680 };
681 /*****************************************************************************/