Commit | Line | Data |
---|---|---|
702422bd T |
1 | /***************************************************************************** |
2 | * * | |
3 | * easycap.h * | |
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 | /* | |
29 | * THE FOLLOWING PARAMETERS ARE UNDEFINED: | |
30 | * | |
31 | * EASYCAP_DEBUG | |
702422bd T |
32 | * |
33 | * IF REQUIRED THEY MUST BE EXTERNALLY DEFINED, FOR EXAMPLE AS COMPILER | |
34 | * OPTIONS. | |
35 | */ | |
36 | /*---------------------------------------------------------------------------*/ | |
37 | ||
3dbab733 TW |
38 | #ifndef __EASYCAP_H__ |
39 | #define __EASYCAP_H__ | |
702422bd | 40 | |
f36bc37a MT |
41 | /*---------------------------------------------------------------------------*/ |
42 | /* | |
43 | * THESE ARE NORMALLY DEFINED | |
44 | */ | |
45 | /*---------------------------------------------------------------------------*/ | |
46 | #define PATIENCE 500 | |
f36bc37a | 47 | #define PERSEVERE |
702422bd T |
48 | /*---------------------------------------------------------------------------*/ |
49 | /* | |
50 | * THESE ARE FOR MAINTENANCE ONLY - NORMALLY UNDEFINED: | |
51 | */ | |
52 | /*---------------------------------------------------------------------------*/ | |
702422bd | 53 | #undef EASYCAP_TESTCARD |
702422bd | 54 | /*---------------------------------------------------------------------------*/ |
702422bd T |
55 | #include <linux/kernel.h> |
56 | #include <linux/errno.h> | |
57 | #include <linux/init.h> | |
58 | #include <linux/slab.h> | |
59 | #include <linux/module.h> | |
60 | #include <linux/kref.h> | |
702422bd T |
61 | #include <linux/usb.h> |
62 | #include <linux/uaccess.h> | |
63 | ||
64 | #include <linux/i2c.h> | |
702422bd T |
65 | #include <linux/workqueue.h> |
66 | #include <linux/poll.h> | |
67 | #include <linux/mm.h> | |
68 | #include <linux/fs.h> | |
69 | #include <linux/delay.h> | |
70 | #include <linux/types.h> | |
71 | ||
a9855917 MT |
72 | #include <linux/vmalloc.h> |
73 | #include <linux/sound.h> | |
74 | #include <sound/core.h> | |
75 | #include <sound/pcm.h> | |
76 | #include <sound/pcm_params.h> | |
77 | #include <sound/info.h> | |
78 | #include <sound/initval.h> | |
79 | #include <sound/control.h> | |
702422bd | 80 | #include <media/v4l2-dev.h> |
702422bd | 81 | #include <media/v4l2-device.h> |
702422bd | 82 | #include <linux/videodev2.h> |
702422bd | 83 | #include <linux/soundcard.h> |
702422bd | 84 | |
702422bd T |
85 | /*---------------------------------------------------------------------------*/ |
86 | /* VENDOR, PRODUCT: Syntek Semiconductor Co., Ltd | |
87 | * | |
88 | * EITHER EasyCAP USB 2.0 Video Adapter with Audio, Model No. DC60 | |
89 | * with input cabling: AUDIO(L), AUDIO(R), CVBS, S-VIDEO. | |
90 | * | |
91 | * OR EasyCAP 4CHANNEL USB 2.0 DVR, Model No. EasyCAP002 | |
92 | * with input cabling: MICROPHONE, CVBS1, CVBS2, CVBS3, CVBS4. | |
93 | */ | |
94 | /*---------------------------------------------------------------------------*/ | |
95 | #define USB_EASYCAP_VENDOR_ID 0x05e1 | |
96 | #define USB_EASYCAP_PRODUCT_ID 0x0408 | |
97 | ||
a9855917 | 98 | #define EASYCAP_DRIVER_VERSION "0.9.01" |
702422bd T |
99 | #define EASYCAP_DRIVER_DESCRIPTION "easycapdc60" |
100 | ||
101 | #define USB_SKEL_MINOR_BASE 192 | |
e68703cf | 102 | #define DONGLE_MANY 8 |
f36bc37a | 103 | #define INPUT_MANY 6 |
702422bd T |
104 | /*---------------------------------------------------------------------------*/ |
105 | /* | |
106 | * DEFAULT LUMINANCE, CONTRAST, SATURATION AND HUE | |
107 | */ | |
108 | /*---------------------------------------------------------------------------*/ | |
109 | #define SAA_0A_DEFAULT 0x7F | |
110 | #define SAA_0B_DEFAULT 0x3F | |
111 | #define SAA_0C_DEFAULT 0x2F | |
112 | #define SAA_0D_DEFAULT 0x00 | |
113 | /*---------------------------------------------------------------------------*/ | |
114 | /* | |
115 | * VIDEO STREAMING PARAMETERS: | |
116 | * USB 2.0 PROVIDES FOR HIGH-BANDWIDTH ENDPOINTS WITH AN UPPER LIMIT | |
117 | * OF 3072 BYTES PER MICROFRAME for wMaxPacketSize. | |
118 | */ | |
119 | /*---------------------------------------------------------------------------*/ | |
120 | #define VIDEO_ISOC_BUFFER_MANY 16 | |
121 | #define VIDEO_ISOC_ORDER 3 | |
122 | #define VIDEO_ISOC_FRAMESPERDESC ((unsigned int) 1 << VIDEO_ISOC_ORDER) | |
123 | #define USB_2_0_MAXPACKETSIZE 3072 | |
124 | #if (USB_2_0_MAXPACKETSIZE > PAGE_SIZE) | |
125 | #error video_isoc_buffer[.] will not be big enough | |
126 | #endif | |
f36bc37a | 127 | #define VIDEO_JUNK_TOLERATE VIDEO_ISOC_BUFFER_MANY |
849322a0 | 128 | #define VIDEO_LOST_TOLERATE 50 |
702422bd T |
129 | /*---------------------------------------------------------------------------*/ |
130 | /* | |
131 | * VIDEO BUFFERS | |
132 | */ | |
133 | /*---------------------------------------------------------------------------*/ | |
134 | #define FIELD_BUFFER_SIZE (203 * PAGE_SIZE) | |
135 | #define FRAME_BUFFER_SIZE (405 * PAGE_SIZE) | |
136 | #define FIELD_BUFFER_MANY 4 | |
137 | #define FRAME_BUFFER_MANY 6 | |
138 | /*---------------------------------------------------------------------------*/ | |
139 | /* | |
140 | * AUDIO STREAMING PARAMETERS | |
141 | */ | |
142 | /*---------------------------------------------------------------------------*/ | |
143 | #define AUDIO_ISOC_BUFFER_MANY 16 | |
a9855917 MT |
144 | #define AUDIO_ISOC_ORDER 1 |
145 | #define AUDIO_ISOC_FRAMESPERDESC 32 | |
702422bd T |
146 | #define AUDIO_ISOC_BUFFER_SIZE (PAGE_SIZE << AUDIO_ISOC_ORDER) |
147 | /*---------------------------------------------------------------------------*/ | |
148 | /* | |
149 | * AUDIO BUFFERS | |
150 | */ | |
151 | /*---------------------------------------------------------------------------*/ | |
152 | #define AUDIO_FRAGMENT_MANY 32 | |
a9855917 | 153 | #define PAGES_PER_AUDIO_FRAGMENT 4 |
702422bd | 154 | /*---------------------------------------------------------------------------*/ |
3d423e91 MT |
155 | /* |
156 | * IT IS ESSENTIAL THAT EVEN-NUMBERED STANDARDS ARE 25 FRAMES PER SECOND, | |
157 | * ODD-NUMBERED STANDARDS ARE 30 FRAMES PER SECOND. | |
158 | * THE NUMBERING OF STANDARDS MUST NOT BE CHANGED WITHOUT DUE CARE. NOT | |
159 | * ONLY MUST THE PARAMETER | |
160 | * STANDARD_MANY | |
161 | * BE CHANGED TO CORRESPOND TO THE NEW NUMBER OF STANDARDS, BUT ALSO THE | |
162 | * NUMBERING MUST REMAIN AN UNBROKEN ASCENDING SEQUENCE: DUMMY STANDARDS | |
163 | * MAY NEED TO BE ADDED. APPROPRIATE CHANGES WILL ALWAYS BE REQUIRED IN | |
164 | * ROUTINE fillin_formats() AND POSSIBLY ELSEWHERE. BEWARE. | |
165 | */ | |
166 | /*---------------------------------------------------------------------------*/ | |
167 | #define PAL_BGHIN 0 | |
168 | #define PAL_Nc 2 | |
169 | #define SECAM 4 | |
170 | #define NTSC_N 6 | |
171 | #define NTSC_N_443 8 | |
172 | #define NTSC_M 1 | |
173 | #define NTSC_443 3 | |
174 | #define NTSC_M_JP 5 | |
175 | #define PAL_60 7 | |
176 | #define PAL_M 9 | |
40b8d50a MT |
177 | #define PAL_BGHIN_SLOW 10 |
178 | #define PAL_Nc_SLOW 12 | |
179 | #define SECAM_SLOW 14 | |
180 | #define NTSC_N_SLOW 16 | |
181 | #define NTSC_N_443_SLOW 18 | |
182 | #define NTSC_M_SLOW 11 | |
183 | #define NTSC_443_SLOW 13 | |
184 | #define NTSC_M_JP_SLOW 15 | |
185 | #define PAL_60_SLOW 17 | |
186 | #define PAL_M_SLOW 19 | |
187 | #define STANDARD_MANY 20 | |
3d423e91 MT |
188 | /*---------------------------------------------------------------------------*/ |
189 | /* | |
190 | * ENUMS | |
191 | */ | |
192 | /*---------------------------------------------------------------------------*/ | |
193 | enum { | |
03389996 TW |
194 | AT_720x576, |
195 | AT_704x576, | |
196 | AT_640x480, | |
197 | AT_720x480, | |
198 | AT_360x288, | |
199 | AT_320x240, | |
200 | AT_360x240, | |
201 | RESOLUTION_MANY | |
3d423e91 MT |
202 | }; |
203 | enum { | |
03389996 TW |
204 | FMT_UYVY, |
205 | FMT_YUY2, | |
206 | FMT_RGB24, | |
207 | FMT_RGB32, | |
208 | FMT_BGR24, | |
209 | FMT_BGR32, | |
210 | PIXELFORMAT_MANY | |
3d423e91 MT |
211 | }; |
212 | enum { | |
03389996 TW |
213 | FIELD_NONE, |
214 | FIELD_INTERLACED, | |
215 | INTERLACE_MANY | |
3d423e91 MT |
216 | }; |
217 | #define SETTINGS_MANY (STANDARD_MANY * \ | |
218 | RESOLUTION_MANY * \ | |
219 | 2 * \ | |
220 | PIXELFORMAT_MANY * \ | |
221 | INTERLACE_MANY) | |
222 | /*---------------------------------------------------------------------------*/ | |
702422bd T |
223 | /* |
224 | * STRUCTURE DEFINITIONS | |
225 | */ | |
226 | /*---------------------------------------------------------------------------*/ | |
ae59dad4 | 227 | struct easycap_dongle { |
03389996 TW |
228 | struct easycap *peasycap; |
229 | struct mutex mutex_video; | |
230 | struct mutex mutex_audio; | |
ae59dad4 MT |
231 | }; |
232 | /*---------------------------------------------------------------------------*/ | |
702422bd | 233 | struct data_buffer { |
03389996 TW |
234 | struct list_head list_head; |
235 | void *pgo; | |
236 | void *pto; | |
055e3a3a TW |
237 | u16 kount; |
238 | u16 input; | |
702422bd T |
239 | }; |
240 | /*---------------------------------------------------------------------------*/ | |
241 | struct data_urb { | |
03389996 TW |
242 | struct list_head list_head; |
243 | struct urb *purb; | |
244 | int isbuf; | |
245 | int length; | |
702422bd T |
246 | }; |
247 | /*---------------------------------------------------------------------------*/ | |
3d423e91 | 248 | struct easycap_standard { |
055e3a3a | 249 | u16 mask; |
3d423e91 MT |
250 | struct v4l2_standard v4l2_standard; |
251 | }; | |
252 | struct easycap_format { | |
055e3a3a | 253 | u16 mask; |
03389996 | 254 | char name[128]; |
3d423e91 MT |
255 | struct v4l2_format v4l2_format; |
256 | }; | |
f36bc37a | 257 | struct inputset { |
03389996 TW |
258 | int input; |
259 | int input_ok; | |
260 | int standard_offset; | |
261 | int standard_offset_ok; | |
262 | int format_offset; | |
263 | int format_offset_ok; | |
264 | int brightness; | |
265 | int brightness_ok; | |
266 | int contrast; | |
267 | int contrast_ok; | |
268 | int saturation; | |
269 | int saturation_ok; | |
270 | int hue; | |
271 | int hue_ok; | |
f36bc37a | 272 | }; |
3d423e91 | 273 | /*---------------------------------------------------------------------------*/ |
702422bd T |
274 | /* |
275 | * easycap.ilk == 0 => CVBS+S-VIDEO HARDWARE, AUDIO wMaxPacketSize=256 | |
276 | * easycap.ilk == 2 => CVBS+S-VIDEO HARDWARE, AUDIO wMaxPacketSize=9 | |
277 | * easycap.ilk == 3 => FOUR-CVBS HARDWARE, AUDIO wMaxPacketSize=9 | |
278 | */ | |
279 | /*---------------------------------------------------------------------------*/ | |
280 | struct easycap { | |
03389996 TW |
281 | int isdongle; |
282 | int minor; | |
e68703cf | 283 | |
03389996 | 284 | struct video_device video_device; |
03389996 | 285 | struct v4l2_device v4l2_device; |
cb81fa07 | 286 | |
03389996 TW |
287 | int status; |
288 | unsigned int audio_pages_per_fragment; | |
289 | unsigned int audio_bytes_per_fragment; | |
290 | unsigned int audio_buffer_page_many; | |
3d423e91 MT |
291 | |
292 | #define UPSAMPLE | |
3fc0dae8 | 293 | #ifdef UPSAMPLE |
055e3a3a | 294 | s16 oldaudio; |
3d423e91 MT |
295 | #endif /*UPSAMPLE*/ |
296 | ||
03389996 TW |
297 | int ilk; |
298 | bool microphone; | |
299 | ||
300 | struct usb_device *pusb_device; | |
301 | struct usb_interface *pusb_interface; | |
302 | ||
303 | struct kref kref; | |
304 | ||
305 | int queued[FRAME_BUFFER_MANY]; | |
306 | int done[FRAME_BUFFER_MANY]; | |
307 | ||
308 | wait_queue_head_t wq_video; | |
309 | wait_queue_head_t wq_audio; | |
310 | wait_queue_head_t wq_trigger; | |
311 | ||
312 | int input; | |
313 | int polled; | |
314 | int standard_offset; | |
315 | int format_offset; | |
316 | struct inputset inputset[INPUT_MANY]; | |
317 | ||
318 | bool ntsc; | |
319 | int fps; | |
320 | int usec; | |
321 | int tolerate; | |
322 | int skip; | |
323 | int skipped; | |
324 | int lost[INPUT_MANY]; | |
325 | int merit[180]; | |
326 | ||
03389996 TW |
327 | int video_interface; |
328 | int video_altsetting_on; | |
329 | int video_altsetting_off; | |
330 | int video_endpointnumber; | |
331 | int video_isoc_maxframesize; | |
332 | int video_isoc_buffer_size; | |
333 | int video_isoc_framesperdesc; | |
334 | ||
335 | int video_isoc_streaming; | |
336 | int video_isoc_sequence; | |
337 | int video_idle; | |
338 | int video_eof; | |
339 | int video_junk; | |
340 | ||
341 | struct data_buffer video_isoc_buffer[VIDEO_ISOC_BUFFER_MANY]; | |
342 | struct data_buffer field_buffer[FIELD_BUFFER_MANY] | |
343 | [(FIELD_BUFFER_SIZE/PAGE_SIZE)]; | |
344 | struct data_buffer frame_buffer[FRAME_BUFFER_MANY] | |
345 | [(FRAME_BUFFER_SIZE/PAGE_SIZE)]; | |
346 | ||
347 | struct list_head urb_video_head; | |
348 | struct list_head *purb_video_head; | |
349 | ||
055e3a3a TW |
350 | u8 cache[8]; |
351 | u8 *pcache; | |
03389996 TW |
352 | int video_mt; |
353 | int audio_mt; | |
055e3a3a | 354 | u32 isequence; |
03389996 TW |
355 | |
356 | int vma_many; | |
702422bd T |
357 | /*---------------------------------------------------------------------------*/ |
358 | /* | |
359 | * BUFFER INDICATORS | |
360 | */ | |
361 | /*---------------------------------------------------------------------------*/ | |
03389996 | 362 | int field_fill; /* Field buffer being filled by easycap_complete(). */ |
702422bd | 363 | /* Bumped only by easycap_complete(). */ |
03389996 | 364 | int field_page; /* Page of field buffer page being filled by */ |
702422bd | 365 | /* easycap_complete(). */ |
03389996 | 366 | int field_read; /* Field buffer to be read by field2frame(). */ |
702422bd | 367 | /* Bumped only by easycap_complete(). */ |
03389996 | 368 | int frame_fill; /* Frame buffer being filled by field2frame(). */ |
702422bd T |
369 | /* Bumped only by easycap_dqbuf() when */ |
370 | /* field2frame() has created a complete frame. */ | |
03389996 | 371 | int frame_read; /* Frame buffer offered to user by DQBUF. */ |
702422bd | 372 | /* Set only by easycap_dqbuf() to trail frame_fill.*/ |
03389996 | 373 | int frame_lock; /* Flag set to 1 by DQBUF and cleared by QBUF */ |
702422bd T |
374 | /*---------------------------------------------------------------------------*/ |
375 | /* | |
376 | * IMAGE PROPERTIES | |
377 | */ | |
378 | /*---------------------------------------------------------------------------*/ | |
055e3a3a | 379 | u32 pixelformat; |
03389996 TW |
380 | int width; |
381 | int height; | |
382 | int bytesperpixel; | |
383 | bool byteswaporder; | |
384 | bool decimatepixel; | |
385 | bool offerfields; | |
386 | int frame_buffer_used; | |
387 | int frame_buffer_many; | |
388 | int videofieldamount; | |
389 | ||
390 | int brightness; | |
391 | int contrast; | |
392 | int saturation; | |
393 | int hue; | |
394 | ||
395 | int allocation_video_urb; | |
396 | int allocation_video_page; | |
397 | int allocation_video_struct; | |
398 | int registered_video; | |
702422bd | 399 | /*---------------------------------------------------------------------------*/ |
a9855917 MT |
400 | /* |
401 | * ALSA | |
402 | */ | |
403 | /*---------------------------------------------------------------------------*/ | |
03389996 TW |
404 | struct snd_pcm_hardware alsa_hardware; |
405 | struct snd_card *psnd_card; | |
406 | struct snd_pcm *psnd_pcm; | |
407 | struct snd_pcm_substream *psubstream; | |
408 | int dma_fill; | |
409 | int dma_next; | |
410 | int dma_read; | |
a9855917 | 411 | /*---------------------------------------------------------------------------*/ |
702422bd T |
412 | /* |
413 | * SOUND PROPERTIES | |
414 | */ | |
415 | /*---------------------------------------------------------------------------*/ | |
03389996 TW |
416 | int audio_interface; |
417 | int audio_altsetting_on; | |
418 | int audio_altsetting_off; | |
419 | int audio_endpointnumber; | |
420 | int audio_isoc_maxframesize; | |
421 | int audio_isoc_buffer_size; | |
422 | int audio_isoc_framesperdesc; | |
702422bd | 423 | |
03389996 TW |
424 | int audio_isoc_streaming; |
425 | int audio_idle; | |
426 | int audio_eof; | |
427 | int volume; | |
428 | int mute; | |
429 | s8 gain; | |
702422bd | 430 | |
03389996 | 431 | struct data_buffer audio_isoc_buffer[AUDIO_ISOC_BUFFER_MANY]; |
702422bd | 432 | |
03389996 TW |
433 | struct list_head urb_audio_head; |
434 | struct list_head *purb_audio_head; | |
702422bd T |
435 | /*---------------------------------------------------------------------------*/ |
436 | /* | |
437 | * BUFFER INDICATORS | |
438 | */ | |
439 | /*---------------------------------------------------------------------------*/ | |
03389996 | 440 | int audio_fill; /* Audio buffer being filled by easycap_complete(). */ |
a9855917 | 441 | /* Bumped only by easycap_complete(). */ |
03389996 | 442 | int audio_read; /* Audio buffer page being read by easycap_read(). */ |
a9855917 | 443 | /* Set by easycap_read() to trail audio_fill by */ |
702422bd T |
444 | /* one fragment. */ |
445 | /*---------------------------------------------------------------------------*/ | |
446 | /* | |
447 | * SOUND PROPERTIES | |
448 | */ | |
449 | /*---------------------------------------------------------------------------*/ | |
03389996 TW |
450 | int allocation_audio_urb; |
451 | int allocation_audio_page; | |
452 | int allocation_audio_struct; | |
453 | int registered_audio; | |
702422bd | 454 | |
03389996 TW |
455 | long long int audio_sample; |
456 | long long int audio_niveau; | |
457 | long long int audio_square; | |
702422bd | 458 | |
03389996 | 459 | struct data_buffer audio_buffer[]; |
702422bd T |
460 | }; |
461 | /*---------------------------------------------------------------------------*/ | |
702422bd T |
462 | /* |
463 | * VIDEO FUNCTION PROTOTYPES | |
464 | */ | |
702422bd | 465 | /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ |
f2b3c685 | 466 | long easycap_unlocked_ioctl(struct file *, unsigned int, unsigned long); |
98680557 TW |
467 | int easycap_dqbuf(struct easycap *, int); |
468 | int submit_video_urbs(struct easycap *); | |
8b1fad2f | 469 | int easycap_video_kill_urbs(struct easycap *); |
98680557 TW |
470 | void easycap_testcard(struct easycap *, int); |
471 | int fillin_formats(void); | |
472 | int newinput(struct easycap *, int); | |
473 | ||
474 | int adjust_standard(struct easycap *, v4l2_std_id); | |
475 | int adjust_format(struct easycap *, u32, u32, u32, int, bool); | |
476 | int adjust_brightness(struct easycap *, int); | |
477 | int adjust_contrast(struct easycap *, int); | |
478 | int adjust_saturation(struct easycap *, int); | |
479 | int adjust_hue(struct easycap *, int); | |
702422bd T |
480 | /*---------------------------------------------------------------------------*/ |
481 | /* | |
482 | * AUDIO FUNCTION PROTOTYPES | |
483 | */ | |
484 | /*---------------------------------------------------------------------------*/ | |
98680557 | 485 | int easycap_alsa_probe(struct easycap *); |
8b1fad2f | 486 | int easycap_audio_kill_urbs(struct easycap *); |
98680557 TW |
487 | void easycap_alsa_complete(struct urb *); |
488 | int audio_setup(struct easycap *); | |
702422bd T |
489 | /*---------------------------------------------------------------------------*/ |
490 | /* | |
491 | * LOW-LEVEL FUNCTION PROTOTYPES | |
492 | */ | |
493 | /*---------------------------------------------------------------------------*/ | |
98680557 TW |
494 | int audio_gainset(struct usb_device *, s8); |
495 | ||
496 | int wakeup_device(struct usb_device *); | |
497 | ||
498 | int setup_stk(struct usb_device *, bool); | |
499 | int setup_saa(struct usb_device *, bool); | |
500 | int ready_saa(struct usb_device *); | |
501 | int merit_saa(struct usb_device *); | |
502 | int check_vt(struct usb_device *); | |
503 | int select_input(struct usb_device *, int, int); | |
504 | int set_resolution(struct usb_device *, u16, u16, u16, u16); | |
505 | ||
506 | int read_saa(struct usb_device *, u16); | |
507 | int write_saa(struct usb_device *, u16, u16); | |
508 | int start_100(struct usb_device *); | |
509 | int stop_100(struct usb_device *); | |
510 | int isdongle(struct easycap *); | |
702422bd | 511 | /*---------------------------------------------------------------------------*/ |
2a9a05c4 TW |
512 | |
513 | ||
702422bd | 514 | /*---------------------------------------------------------------------------*/ |
e68703cf MT |
515 | /* |
516 | * MACROS SAM(...) AND JOM(...) ALLOW DIAGNOSTIC OUTPUT TO BE TAGGED WITH | |
517 | * THE IDENTITY OF THE DONGLE TO WHICH IT APPLIES, BUT IF INVOKED WHEN THE | |
518 | * POINTER peasycap IS INVALID AN Oops IS LIKELY, AND ITS CAUSE MAY NOT BE | |
519 | * IMMEDIATELY OBVIOUS FROM A CASUAL READING OF THE SOURCE CODE. BEWARE. | |
520 | */ | |
521 | /*---------------------------------------------------------------------------*/ | |
5c0c6c39 TW |
522 | const char *strerror(int err); |
523 | ||
702422bd | 524 | #define SAY(format, args...) do { \ |
e68703cf MT |
525 | printk(KERN_DEBUG "easycap:: %s: " \ |
526 | format, __func__, ##args); \ | |
527 | } while (0) | |
528 | #define SAM(format, args...) do { \ | |
529 | printk(KERN_DEBUG "easycap::%i%s: " \ | |
530 | format, peasycap->isdongle, __func__, ##args);\ | |
702422bd | 531 | } while (0) |
702422bd | 532 | |
02149cf7 TW |
533 | #ifdef CONFIG_EASYCAP_DEBUG |
534 | extern int easycap_debug; | |
702422bd | 535 | #define JOT(n, format, args...) do { \ |
62af33ec | 536 | if (n <= easycap_debug) { \ |
e68703cf MT |
537 | printk(KERN_DEBUG "easycap:: %s: " \ |
538 | format, __func__, ##args);\ | |
702422bd T |
539 | } \ |
540 | } while (0) | |
e68703cf | 541 | #define JOM(n, format, args...) do { \ |
62af33ec | 542 | if (n <= easycap_debug) { \ |
e68703cf MT |
543 | printk(KERN_DEBUG "easycap::%i%s: " \ |
544 | format, peasycap->isdongle, __func__, ##args);\ | |
545 | } \ | |
546 | } while (0) | |
547 | ||
702422bd T |
548 | #else |
549 | #define JOT(n, format, args...) do {} while (0) | |
e68703cf | 550 | #define JOM(n, format, args...) do {} while (0) |
02149cf7 | 551 | #endif /* CONFIG_EASYCAP_DEBUG */ |
702422bd | 552 | |
702422bd T |
553 | /*---------------------------------------------------------------------------*/ |
554 | ||
b4f63e9a TW |
555 | /*---------------------------------------------------------------------------*/ |
556 | /* globals | |
557 | */ | |
558 | /*---------------------------------------------------------------------------*/ | |
559 | ||
2ef0c05e | 560 | extern bool easycap_readback; |
b4f63e9a TW |
561 | extern const struct easycap_standard easycap_standard[]; |
562 | extern struct easycap_format easycap_format[]; | |
563 | extern struct v4l2_queryctrl easycap_control[]; | |
b4f63e9a | 564 | extern struct easycap_dongle easycapdc60_dongle[]; |
b4f63e9a | 565 | |
3dbab733 | 566 | #endif /* !__EASYCAP_H__ */ |