diff options
Diffstat (limited to 'drivers/media/video/ov511.h')
-rw-r--r-- | drivers/media/video/ov511.h | 568 |
1 files changed, 568 insertions, 0 deletions
diff --git a/drivers/media/video/ov511.h b/drivers/media/video/ov511.h new file mode 100644 index 000000000000..bce9b3633889 --- /dev/null +++ b/drivers/media/video/ov511.h | |||
@@ -0,0 +1,568 @@ | |||
1 | #ifndef __LINUX_OV511_H | ||
2 | #define __LINUX_OV511_H | ||
3 | |||
4 | #include <asm/uaccess.h> | ||
5 | #include <linux/videodev.h> | ||
6 | #include <linux/smp_lock.h> | ||
7 | #include <linux/usb.h> | ||
8 | #include <linux/mutex.h> | ||
9 | |||
10 | #define OV511_DEBUG /* Turn on debug messages */ | ||
11 | |||
12 | #ifdef OV511_DEBUG | ||
13 | #define PDEBUG(level, fmt, args...) \ | ||
14 | if (debug >= (level)) info("[%s:%d] " fmt, \ | ||
15 | __FUNCTION__, __LINE__ , ## args) | ||
16 | #else | ||
17 | #define PDEBUG(level, fmt, args...) do {} while(0) | ||
18 | #endif | ||
19 | |||
20 | /* This macro restricts an int variable to an inclusive range */ | ||
21 | #define RESTRICT_TO_RANGE(v,mi,ma) { \ | ||
22 | if ((v) < (mi)) (v) = (mi); \ | ||
23 | else if ((v) > (ma)) (v) = (ma); \ | ||
24 | } | ||
25 | |||
26 | /* --------------------------------- */ | ||
27 | /* DEFINES FOR OV511 AND OTHER CHIPS */ | ||
28 | /* --------------------------------- */ | ||
29 | |||
30 | /* USB IDs */ | ||
31 | #define VEND_OMNIVISION 0x05A9 | ||
32 | #define PROD_OV511 0x0511 | ||
33 | #define PROD_OV511PLUS 0xA511 | ||
34 | #define PROD_OV518 0x0518 | ||
35 | #define PROD_OV518PLUS 0xA518 | ||
36 | |||
37 | #define VEND_MATTEL 0x0813 | ||
38 | #define PROD_ME2CAM 0x0002 | ||
39 | |||
40 | /* --------------------------------- */ | ||
41 | /* OV51x REGISTER MNEMONICS */ | ||
42 | /* --------------------------------- */ | ||
43 | |||
44 | /* Camera interface register numbers */ | ||
45 | #define R511_CAM_DELAY 0x10 | ||
46 | #define R511_CAM_EDGE 0x11 | ||
47 | #define R511_CAM_PXCNT 0x12 | ||
48 | #define R511_CAM_LNCNT 0x13 | ||
49 | #define R511_CAM_PXDIV 0x14 | ||
50 | #define R511_CAM_LNDIV 0x15 | ||
51 | #define R511_CAM_UV_EN 0x16 | ||
52 | #define R511_CAM_LINE_MODE 0x17 | ||
53 | #define R511_CAM_OPTS 0x18 | ||
54 | |||
55 | /* Snapshot mode camera interface register numbers */ | ||
56 | #define R511_SNAP_FRAME 0x19 | ||
57 | #define R511_SNAP_PXCNT 0x1A | ||
58 | #define R511_SNAP_LNCNT 0x1B | ||
59 | #define R511_SNAP_PXDIV 0x1C | ||
60 | #define R511_SNAP_LNDIV 0x1D | ||
61 | #define R511_SNAP_UV_EN 0x1E | ||
62 | #define R511_SNAP_OPTS 0x1F | ||
63 | |||
64 | /* DRAM register numbers */ | ||
65 | #define R511_DRAM_FLOW_CTL 0x20 | ||
66 | #define R511_DRAM_ARCP 0x21 | ||
67 | #define R511_DRAM_MRC 0x22 | ||
68 | #define R511_DRAM_RFC 0x23 | ||
69 | |||
70 | /* ISO FIFO register numbers */ | ||
71 | #define R51x_FIFO_PSIZE 0x30 /* 2 bytes wide w/ OV518(+) */ | ||
72 | #define R511_FIFO_OPTS 0x31 | ||
73 | |||
74 | /* Parallel IO register numbers */ | ||
75 | #define R511_PIO_OPTS 0x38 | ||
76 | #define R511_PIO_DATA 0x39 | ||
77 | #define R511_PIO_BIST 0x3E | ||
78 | #define R518_GPIO_IN 0x55 /* OV518(+) only */ | ||
79 | #define R518_GPIO_OUT 0x56 /* OV518(+) only */ | ||
80 | #define R518_GPIO_CTL 0x57 /* OV518(+) only */ | ||
81 | #define R518_GPIO_PULSE_IN 0x58 /* OV518(+) only */ | ||
82 | #define R518_GPIO_PULSE_CLEAR 0x59 /* OV518(+) only */ | ||
83 | #define R518_GPIO_PULSE_POL 0x5a /* OV518(+) only */ | ||
84 | #define R518_GPIO_PULSE_EN 0x5b /* OV518(+) only */ | ||
85 | #define R518_GPIO_RESET 0x5c /* OV518(+) only */ | ||
86 | |||
87 | /* I2C registers */ | ||
88 | #define R511_I2C_CTL 0x40 | ||
89 | #define R518_I2C_CTL 0x47 /* OV518(+) only */ | ||
90 | #define R51x_I2C_W_SID 0x41 | ||
91 | #define R51x_I2C_SADDR_3 0x42 | ||
92 | #define R51x_I2C_SADDR_2 0x43 | ||
93 | #define R51x_I2C_R_SID 0x44 | ||
94 | #define R51x_I2C_DATA 0x45 | ||
95 | #define R51x_I2C_CLOCK 0x46 | ||
96 | #define R51x_I2C_TIMEOUT 0x47 | ||
97 | |||
98 | /* I2C snapshot registers */ | ||
99 | #define R511_SI2C_SADDR_3 0x48 | ||
100 | #define R511_SI2C_DATA 0x49 | ||
101 | |||
102 | /* System control registers */ | ||
103 | #define R51x_SYS_RESET 0x50 | ||
104 | /* Reset type definitions */ | ||
105 | #define OV511_RESET_UDC 0x01 | ||
106 | #define OV511_RESET_I2C 0x02 | ||
107 | #define OV511_RESET_FIFO 0x04 | ||
108 | #define OV511_RESET_OMNICE 0x08 | ||
109 | #define OV511_RESET_DRAM 0x10 | ||
110 | #define OV511_RESET_CAM_INT 0x20 | ||
111 | #define OV511_RESET_OV511 0x40 | ||
112 | #define OV511_RESET_NOREGS 0x3F /* All but OV511 & regs */ | ||
113 | #define OV511_RESET_ALL 0x7F | ||
114 | |||
115 | #define R511_SYS_CLOCK_DIV 0x51 | ||
116 | #define R51x_SYS_SNAP 0x52 | ||
117 | #define R51x_SYS_INIT 0x53 | ||
118 | #define R511_SYS_PWR_CLK 0x54 /* OV511+/OV518(+) only */ | ||
119 | #define R511_SYS_LED_CTL 0x55 /* OV511+ only */ | ||
120 | #define R511_SYS_USER 0x5E | ||
121 | #define R511_SYS_CUST_ID 0x5F | ||
122 | |||
123 | /* OmniCE (compression) registers */ | ||
124 | #define R511_COMP_PHY 0x70 | ||
125 | #define R511_COMP_PHUV 0x71 | ||
126 | #define R511_COMP_PVY 0x72 | ||
127 | #define R511_COMP_PVUV 0x73 | ||
128 | #define R511_COMP_QHY 0x74 | ||
129 | #define R511_COMP_QHUV 0x75 | ||
130 | #define R511_COMP_QVY 0x76 | ||
131 | #define R511_COMP_QVUV 0x77 | ||
132 | #define R511_COMP_EN 0x78 | ||
133 | #define R511_COMP_LUT_EN 0x79 | ||
134 | #define R511_COMP_LUT_BEGIN 0x80 | ||
135 | |||
136 | /* --------------------------------- */ | ||
137 | /* ALTERNATE NUMBERS */ | ||
138 | /* --------------------------------- */ | ||
139 | |||
140 | /* Alternate numbers for various max packet sizes (OV511 only) */ | ||
141 | #define OV511_ALT_SIZE_992 0 | ||
142 | #define OV511_ALT_SIZE_993 1 | ||
143 | #define OV511_ALT_SIZE_768 2 | ||
144 | #define OV511_ALT_SIZE_769 3 | ||
145 | #define OV511_ALT_SIZE_512 4 | ||
146 | #define OV511_ALT_SIZE_513 5 | ||
147 | #define OV511_ALT_SIZE_257 6 | ||
148 | #define OV511_ALT_SIZE_0 7 | ||
149 | |||
150 | /* Alternate numbers for various max packet sizes (OV511+ only) */ | ||
151 | #define OV511PLUS_ALT_SIZE_0 0 | ||
152 | #define OV511PLUS_ALT_SIZE_33 1 | ||
153 | #define OV511PLUS_ALT_SIZE_129 2 | ||
154 | #define OV511PLUS_ALT_SIZE_257 3 | ||
155 | #define OV511PLUS_ALT_SIZE_385 4 | ||
156 | #define OV511PLUS_ALT_SIZE_513 5 | ||
157 | #define OV511PLUS_ALT_SIZE_769 6 | ||
158 | #define OV511PLUS_ALT_SIZE_961 7 | ||
159 | |||
160 | /* Alternate numbers for various max packet sizes (OV518(+) only) */ | ||
161 | #define OV518_ALT_SIZE_0 0 | ||
162 | #define OV518_ALT_SIZE_128 1 | ||
163 | #define OV518_ALT_SIZE_256 2 | ||
164 | #define OV518_ALT_SIZE_384 3 | ||
165 | #define OV518_ALT_SIZE_512 4 | ||
166 | #define OV518_ALT_SIZE_640 5 | ||
167 | #define OV518_ALT_SIZE_768 6 | ||
168 | #define OV518_ALT_SIZE_896 7 | ||
169 | |||
170 | /* --------------------------------- */ | ||
171 | /* OV7610 REGISTER MNEMONICS */ | ||
172 | /* --------------------------------- */ | ||
173 | |||
174 | /* OV7610 registers */ | ||
175 | #define OV7610_REG_GAIN 0x00 /* gain setting (5:0) */ | ||
176 | #define OV7610_REG_BLUE 0x01 /* blue channel balance */ | ||
177 | #define OV7610_REG_RED 0x02 /* red channel balance */ | ||
178 | #define OV7610_REG_SAT 0x03 /* saturation */ | ||
179 | /* 04 reserved */ | ||
180 | #define OV7610_REG_CNT 0x05 /* Y contrast */ | ||
181 | #define OV7610_REG_BRT 0x06 /* Y brightness */ | ||
182 | /* 08-0b reserved */ | ||
183 | #define OV7610_REG_BLUE_BIAS 0x0C /* blue channel bias (5:0) */ | ||
184 | #define OV7610_REG_RED_BIAS 0x0D /* read channel bias (5:0) */ | ||
185 | #define OV7610_REG_GAMMA_COEFF 0x0E /* gamma settings */ | ||
186 | #define OV7610_REG_WB_RANGE 0x0F /* AEC/ALC/S-AWB settings */ | ||
187 | #define OV7610_REG_EXP 0x10 /* manual exposure setting */ | ||
188 | #define OV7610_REG_CLOCK 0x11 /* polarity/clock prescaler */ | ||
189 | #define OV7610_REG_COM_A 0x12 /* misc common regs */ | ||
190 | #define OV7610_REG_COM_B 0x13 /* misc common regs */ | ||
191 | #define OV7610_REG_COM_C 0x14 /* misc common regs */ | ||
192 | #define OV7610_REG_COM_D 0x15 /* misc common regs */ | ||
193 | #define OV7610_REG_FIELD_DIVIDE 0x16 /* field interval/mode settings */ | ||
194 | #define OV7610_REG_HWIN_START 0x17 /* horizontal window start */ | ||
195 | #define OV7610_REG_HWIN_END 0x18 /* horizontal window end */ | ||
196 | #define OV7610_REG_VWIN_START 0x19 /* vertical window start */ | ||
197 | #define OV7610_REG_VWIN_END 0x1A /* vertical window end */ | ||
198 | #define OV7610_REG_PIXEL_SHIFT 0x1B /* pixel shift */ | ||
199 | #define OV7610_REG_ID_HIGH 0x1C /* manufacturer ID MSB */ | ||
200 | #define OV7610_REG_ID_LOW 0x1D /* manufacturer ID LSB */ | ||
201 | /* 0e-0f reserved */ | ||
202 | #define OV7610_REG_COM_E 0x20 /* misc common regs */ | ||
203 | #define OV7610_REG_YOFFSET 0x21 /* Y channel offset */ | ||
204 | #define OV7610_REG_UOFFSET 0x22 /* U channel offset */ | ||
205 | /* 23 reserved */ | ||
206 | #define OV7610_REG_ECW 0x24 /* Exposure white level for AEC */ | ||
207 | #define OV7610_REG_ECB 0x25 /* Exposure black level for AEC */ | ||
208 | #define OV7610_REG_COM_F 0x26 /* misc settings */ | ||
209 | #define OV7610_REG_COM_G 0x27 /* misc settings */ | ||
210 | #define OV7610_REG_COM_H 0x28 /* misc settings */ | ||
211 | #define OV7610_REG_COM_I 0x29 /* misc settings */ | ||
212 | #define OV7610_REG_FRAMERATE_H 0x2A /* frame rate MSB + misc */ | ||
213 | #define OV7610_REG_FRAMERATE_L 0x2B /* frame rate LSB */ | ||
214 | #define OV7610_REG_ALC 0x2C /* Auto Level Control settings */ | ||
215 | #define OV7610_REG_COM_J 0x2D /* misc settings */ | ||
216 | #define OV7610_REG_VOFFSET 0x2E /* V channel offset adjustment */ | ||
217 | #define OV7610_REG_ARRAY_BIAS 0x2F /* Array bias -- don't change */ | ||
218 | /* 30-32 reserved */ | ||
219 | #define OV7610_REG_YGAMMA 0x33 /* misc gamma settings (7:6) */ | ||
220 | #define OV7610_REG_BIAS_ADJUST 0x34 /* misc bias settings */ | ||
221 | #define OV7610_REG_COM_L 0x35 /* misc settings */ | ||
222 | /* 36-37 reserved */ | ||
223 | #define OV7610_REG_COM_K 0x38 /* misc registers */ | ||
224 | |||
225 | /* --------------------------------- */ | ||
226 | /* I2C ADDRESSES */ | ||
227 | /* --------------------------------- */ | ||
228 | |||
229 | #define OV7xx0_SID 0x42 | ||
230 | #define OV6xx0_SID 0xC0 | ||
231 | #define OV8xx0_SID 0xA0 | ||
232 | #define KS0127_SID 0xD8 | ||
233 | #define SAA7111A_SID 0x48 | ||
234 | |||
235 | /* --------------------------------- */ | ||
236 | /* MISCELLANEOUS DEFINES */ | ||
237 | /* --------------------------------- */ | ||
238 | |||
239 | #define I2C_CLOCK_PRESCALER 0x03 | ||
240 | |||
241 | #define FRAMES_PER_DESC 10 /* FIXME - What should this be? */ | ||
242 | #define MAX_FRAME_SIZE_PER_DESC 993 /* For statically allocated stuff */ | ||
243 | #define PIXELS_PER_SEG 256 /* Pixels per segment */ | ||
244 | |||
245 | #define OV511_ENDPOINT_ADDRESS 1 /* Isoc endpoint number */ | ||
246 | |||
247 | #define OV511_NUMFRAMES 2 | ||
248 | #if OV511_NUMFRAMES > VIDEO_MAX_FRAME | ||
249 | #error "OV511_NUMFRAMES is too high" | ||
250 | #endif | ||
251 | |||
252 | #define OV511_NUMSBUF 2 | ||
253 | |||
254 | /* Control transfers use up to 4 bytes */ | ||
255 | #define OV511_CBUF_SIZE 4 | ||
256 | |||
257 | /* Size of usb_make_path() buffer */ | ||
258 | #define OV511_USB_PATH_LEN 64 | ||
259 | |||
260 | /* Bridge types */ | ||
261 | enum { | ||
262 | BRG_UNKNOWN, | ||
263 | BRG_OV511, | ||
264 | BRG_OV511PLUS, | ||
265 | BRG_OV518, | ||
266 | BRG_OV518PLUS, | ||
267 | }; | ||
268 | |||
269 | /* Bridge classes */ | ||
270 | enum { | ||
271 | BCL_UNKNOWN, | ||
272 | BCL_OV511, | ||
273 | BCL_OV518, | ||
274 | }; | ||
275 | |||
276 | /* Sensor types */ | ||
277 | enum { | ||
278 | SEN_UNKNOWN, | ||
279 | SEN_OV76BE, | ||
280 | SEN_OV7610, | ||
281 | SEN_OV7620, | ||
282 | SEN_OV7620AE, | ||
283 | SEN_OV6620, | ||
284 | SEN_OV6630, | ||
285 | SEN_OV6630AE, | ||
286 | SEN_OV6630AF, | ||
287 | SEN_OV8600, | ||
288 | SEN_KS0127, | ||
289 | SEN_KS0127B, | ||
290 | SEN_SAA7111A, | ||
291 | }; | ||
292 | |||
293 | enum { | ||
294 | STATE_SCANNING, /* Scanning for start */ | ||
295 | STATE_HEADER, /* Parsing header */ | ||
296 | STATE_LINES, /* Parsing lines */ | ||
297 | }; | ||
298 | |||
299 | /* Buffer states */ | ||
300 | enum { | ||
301 | BUF_NOT_ALLOCATED, | ||
302 | BUF_ALLOCATED, | ||
303 | }; | ||
304 | |||
305 | /* --------- Definition of ioctl interface --------- */ | ||
306 | |||
307 | #define OV511_INTERFACE_VER 101 | ||
308 | |||
309 | /* LED options */ | ||
310 | enum { | ||
311 | LED_OFF, | ||
312 | LED_ON, | ||
313 | LED_AUTO, | ||
314 | }; | ||
315 | |||
316 | /* Raw frame formats */ | ||
317 | enum { | ||
318 | RAWFMT_INVALID, | ||
319 | RAWFMT_YUV400, | ||
320 | RAWFMT_YUV420, | ||
321 | RAWFMT_YUV422, | ||
322 | RAWFMT_GBR422, | ||
323 | }; | ||
324 | |||
325 | struct ov511_i2c_struct { | ||
326 | unsigned char slave; /* Write slave ID (read ID - 1) */ | ||
327 | unsigned char reg; /* Index of register */ | ||
328 | unsigned char value; /* User sets this w/ write, driver does w/ read */ | ||
329 | unsigned char mask; /* Bits to be changed. Not used with read ops */ | ||
330 | }; | ||
331 | |||
332 | /* ioctls */ | ||
333 | #define OV511IOC_WI2C _IOW('v', BASE_VIDIOCPRIVATE + 5, \ | ||
334 | struct ov511_i2c_struct) | ||
335 | #define OV511IOC_RI2C _IOWR('v', BASE_VIDIOCPRIVATE + 6, \ | ||
336 | struct ov511_i2c_struct) | ||
337 | /* ------------- End IOCTL interface -------------- */ | ||
338 | |||
339 | struct usb_ov511; /* Forward declaration */ | ||
340 | |||
341 | struct ov511_sbuf { | ||
342 | struct usb_ov511 *ov; | ||
343 | unsigned char *data; | ||
344 | struct urb *urb; | ||
345 | spinlock_t lock; | ||
346 | int n; | ||
347 | }; | ||
348 | |||
349 | enum { | ||
350 | FRAME_UNUSED, /* Unused (no MCAPTURE) */ | ||
351 | FRAME_READY, /* Ready to start grabbing */ | ||
352 | FRAME_GRABBING, /* In the process of being grabbed into */ | ||
353 | FRAME_DONE, /* Finished grabbing, but not been synced yet */ | ||
354 | FRAME_ERROR, /* Something bad happened while processing */ | ||
355 | }; | ||
356 | |||
357 | struct ov511_regvals { | ||
358 | enum { | ||
359 | OV511_DONE_BUS, | ||
360 | OV511_REG_BUS, | ||
361 | OV511_I2C_BUS, | ||
362 | } bus; | ||
363 | unsigned char reg; | ||
364 | unsigned char val; | ||
365 | }; | ||
366 | |||
367 | struct ov511_frame { | ||
368 | int framenum; /* Index of this frame */ | ||
369 | unsigned char *data; /* Frame buffer */ | ||
370 | unsigned char *tempdata; /* Temp buffer for multi-stage conversions */ | ||
371 | unsigned char *rawdata; /* Raw camera data buffer */ | ||
372 | unsigned char *compbuf; /* Temp buffer for decompressor */ | ||
373 | |||
374 | int depth; /* Bytes per pixel */ | ||
375 | int width; /* Width application is expecting */ | ||
376 | int height; /* Height application is expecting */ | ||
377 | |||
378 | int rawwidth; /* Actual width of frame sent from camera */ | ||
379 | int rawheight; /* Actual height of frame sent from camera */ | ||
380 | |||
381 | int sub_flag; /* Sub-capture mode for this frame? */ | ||
382 | unsigned int format; /* Format for this frame */ | ||
383 | int compressed; /* Is frame compressed? */ | ||
384 | |||
385 | volatile int grabstate; /* State of grabbing */ | ||
386 | int scanstate; /* State of scanning */ | ||
387 | |||
388 | int bytes_recvd; /* Number of image bytes received from camera */ | ||
389 | |||
390 | long bytes_read; /* Amount that has been read() */ | ||
391 | |||
392 | wait_queue_head_t wq; /* Processes waiting */ | ||
393 | |||
394 | int snapshot; /* True if frame was a snapshot */ | ||
395 | }; | ||
396 | |||
397 | #define DECOMP_INTERFACE_VER 4 | ||
398 | |||
399 | /* Compression module operations */ | ||
400 | struct ov51x_decomp_ops { | ||
401 | int (*decomp_400)(unsigned char *, unsigned char *, unsigned char *, | ||
402 | int, int, int); | ||
403 | int (*decomp_420)(unsigned char *, unsigned char *, unsigned char *, | ||
404 | int, int, int); | ||
405 | int (*decomp_422)(unsigned char *, unsigned char *, unsigned char *, | ||
406 | int, int, int); | ||
407 | struct module *owner; | ||
408 | }; | ||
409 | |||
410 | struct usb_ov511 { | ||
411 | struct video_device *vdev; | ||
412 | struct usb_device *dev; | ||
413 | |||
414 | int customid; | ||
415 | char *desc; | ||
416 | unsigned char iface; | ||
417 | char usb_path[OV511_USB_PATH_LEN]; | ||
418 | |||
419 | /* Determined by sensor type */ | ||
420 | int maxwidth; | ||
421 | int maxheight; | ||
422 | int minwidth; | ||
423 | int minheight; | ||
424 | |||
425 | int brightness; | ||
426 | int colour; | ||
427 | int contrast; | ||
428 | int hue; | ||
429 | int whiteness; | ||
430 | int exposure; | ||
431 | int auto_brt; /* Auto brightness enabled flag */ | ||
432 | int auto_gain; /* Auto gain control enabled flag */ | ||
433 | int auto_exp; /* Auto exposure enabled flag */ | ||
434 | int backlight; /* Backlight exposure algorithm flag */ | ||
435 | int mirror; /* Image is reversed horizontally */ | ||
436 | |||
437 | int led_policy; /* LED: off|on|auto; OV511+ only */ | ||
438 | |||
439 | struct mutex lock; /* Serializes user-accessible operations */ | ||
440 | int user; /* user count for exclusive use */ | ||
441 | |||
442 | int streaming; /* Are we streaming Isochronous? */ | ||
443 | int grabbing; /* Are we grabbing? */ | ||
444 | |||
445 | int compress; /* Should the next frame be compressed? */ | ||
446 | int compress_inited; /* Are compression params uploaded? */ | ||
447 | |||
448 | int lightfreq; /* Power (lighting) frequency */ | ||
449 | int bandfilt; /* Banding filter enabled flag */ | ||
450 | |||
451 | unsigned char *fbuf; /* Videodev buffer area */ | ||
452 | unsigned char *tempfbuf; /* Temporary (intermediate) buffer area */ | ||
453 | unsigned char *rawfbuf; /* Raw camera data buffer area */ | ||
454 | |||
455 | int sub_flag; /* Pix Array subcapture on flag */ | ||
456 | int subx; /* Pix Array subcapture x offset */ | ||
457 | int suby; /* Pix Array subcapture y offset */ | ||
458 | int subw; /* Pix Array subcapture width */ | ||
459 | int subh; /* Pix Array subcapture height */ | ||
460 | |||
461 | int curframe; /* Current receiving sbuf */ | ||
462 | struct ov511_frame frame[OV511_NUMFRAMES]; | ||
463 | |||
464 | struct ov511_sbuf sbuf[OV511_NUMSBUF]; | ||
465 | |||
466 | wait_queue_head_t wq; /* Processes waiting */ | ||
467 | |||
468 | int snap_enabled; /* Snapshot mode enabled */ | ||
469 | |||
470 | int bridge; /* Type of bridge (BRG_*) */ | ||
471 | int bclass; /* Class of bridge (BCL_*) */ | ||
472 | int sensor; /* Type of image sensor chip (SEN_*) */ | ||
473 | |||
474 | int packet_size; /* Frame size per isoc desc */ | ||
475 | int packet_numbering; /* Is ISO frame numbering enabled? */ | ||
476 | |||
477 | /* Framebuffer/sbuf management */ | ||
478 | int buf_state; | ||
479 | struct mutex buf_lock; | ||
480 | |||
481 | struct ov51x_decomp_ops *decomp_ops; | ||
482 | |||
483 | /* Stop streaming while changing picture settings */ | ||
484 | int stop_during_set; | ||
485 | |||
486 | int stopped; /* Streaming is temporarily paused */ | ||
487 | |||
488 | /* Video decoder stuff */ | ||
489 | int input; /* Composite, S-VIDEO, etc... */ | ||
490 | int num_inputs; /* Number of inputs */ | ||
491 | int norm; /* NTSC / PAL / SECAM */ | ||
492 | int has_decoder; /* Device has a video decoder */ | ||
493 | int pal; /* Device is designed for PAL resolution */ | ||
494 | |||
495 | /* I2C interface */ | ||
496 | struct mutex i2c_lock; /* Protect I2C controller regs */ | ||
497 | unsigned char primary_i2c_slave; /* I2C write id of sensor */ | ||
498 | |||
499 | /* Control transaction stuff */ | ||
500 | unsigned char *cbuf; /* Buffer for payload */ | ||
501 | struct mutex cbuf_lock; | ||
502 | }; | ||
503 | |||
504 | /* Used to represent a list of values and their respective symbolic names */ | ||
505 | struct symbolic_list { | ||
506 | int num; | ||
507 | char *name; | ||
508 | }; | ||
509 | |||
510 | #define NOT_DEFINED_STR "Unknown" | ||
511 | |||
512 | /* Returns the name of the matching element in the symbolic_list array. The | ||
513 | * end of the list must be marked with an element that has a NULL name. | ||
514 | */ | ||
515 | static inline char * | ||
516 | symbolic(struct symbolic_list list[], int num) | ||
517 | { | ||
518 | int i; | ||
519 | |||
520 | for (i = 0; list[i].name != NULL; i++) | ||
521 | if (list[i].num == num) | ||
522 | return (list[i].name); | ||
523 | |||
524 | return (NOT_DEFINED_STR); | ||
525 | } | ||
526 | |||
527 | /* Compression stuff */ | ||
528 | |||
529 | #define OV511_QUANTABLESIZE 64 | ||
530 | #define OV518_QUANTABLESIZE 32 | ||
531 | |||
532 | #define OV511_YQUANTABLE { \ | ||
533 | 0, 1, 1, 2, 2, 3, 3, 4, \ | ||
534 | 1, 1, 1, 2, 2, 3, 4, 4, \ | ||
535 | 1, 1, 2, 2, 3, 4, 4, 4, \ | ||
536 | 2, 2, 2, 3, 4, 4, 4, 4, \ | ||
537 | 2, 2, 3, 4, 4, 5, 5, 5, \ | ||
538 | 3, 3, 4, 4, 5, 5, 5, 5, \ | ||
539 | 3, 4, 4, 4, 5, 5, 5, 5, \ | ||
540 | 4, 4, 4, 4, 5, 5, 5, 5 \ | ||
541 | } | ||
542 | |||
543 | #define OV511_UVQUANTABLE { \ | ||
544 | 0, 2, 2, 3, 4, 4, 4, 4, \ | ||
545 | 2, 2, 2, 4, 4, 4, 4, 4, \ | ||
546 | 2, 2, 3, 4, 4, 4, 4, 4, \ | ||
547 | 3, 4, 4, 4, 4, 4, 4, 4, \ | ||
548 | 4, 4, 4, 4, 4, 4, 4, 4, \ | ||
549 | 4, 4, 4, 4, 4, 4, 4, 4, \ | ||
550 | 4, 4, 4, 4, 4, 4, 4, 4, \ | ||
551 | 4, 4, 4, 4, 4, 4, 4, 4 \ | ||
552 | } | ||
553 | |||
554 | #define OV518_YQUANTABLE { \ | ||
555 | 5, 4, 5, 6, 6, 7, 7, 7, \ | ||
556 | 5, 5, 5, 5, 6, 7, 7, 7, \ | ||
557 | 6, 6, 6, 6, 7, 7, 7, 8, \ | ||
558 | 7, 7, 6, 7, 7, 7, 8, 8 \ | ||
559 | } | ||
560 | |||
561 | #define OV518_UVQUANTABLE { \ | ||
562 | 6, 6, 6, 7, 7, 7, 7, 7, \ | ||
563 | 6, 6, 6, 7, 7, 7, 7, 7, \ | ||
564 | 6, 6, 6, 7, 7, 7, 7, 8, \ | ||
565 | 7, 7, 7, 7, 7, 7, 8, 8 \ | ||
566 | } | ||
567 | |||
568 | #endif | ||