Reenable 624e (sensor SOI968)
[microdia.git] / ov965x.h
blob9801fd49fb1866c49630c9f4895d23efb19d4ffc
1 /**
2 * @file ov965x.h
3 * @author Dave Neuer
4 * @date 2008-03-02
6 * @brief Common functions and data for the Omnivision OV965x sensor series.
8 * @note Copyright (C) Dave Neuer
10 * @par Licences
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef OV965X_H
28 #define OV965X_H
30 #define OV965X_CTL_GAIN 0x00
31 #define OV965X_CTL_BLUE 0x01
32 #define OV965X_CTL_RED 0x02
33 #define OV965X_CTL_VREF 0x03
34 #define OV965X_CTL_COM1 0x04
35 #define OV965X_CTL_BAVE 0x05
36 #define OV965X_CTL_GEAVE 0x06
37 #define OV965X_CTL_RAVE 0x08
38 #define OV965X_CTL_COM2 0x09
39 #define OV965X_CTL_PID 0x0a
40 #define OV965X_CTL_VER 0x0b
41 #define OV965X_CTL_COM3 0x0c
42 #define OV965X_CTL_COM4 0x0d
43 #define OV965X_CTL_COM5 0x0e
44 #define OV965X_CTL_COM6 0x0f
45 #define OV965X_CTL_AECH 0x10
46 #define OV965X_CTL_CLKRC 0x11
47 #define OV965X_CTL_COM7 0x12
48 #define OV965X_CTL_COM8 0x13
49 #define OV965X_CTL_COM9 0x14
50 #define OV965X_CTL_COM10 0x15
51 #define OV965X_CTL_HSTART 0x17
52 #define OV965X_CTL_HSTOP 0x18
53 #define OV965X_CTL_VSTRT 0x19
54 #define OV965X_CTL_VSTOP 0x1a
55 #define OV965X_CTL_PSHIFT 0x1b
56 #define OV965X_CTL_MIDH 0x1c
57 #define OV965X_CTL_MIDL 0x1d
58 #define OV965X_CTL_MVFP 0x1e
59 #define OV965X_CTL_LAEC 0x1f
60 #define OV965X_CTL_BOS 0x20
61 #define OV965X_CTL_GBOS 0x21
62 #define OV965X_CTL_GROS 0x22
63 #define OV965X_CTL_ROS 0x23
64 #define OV965X_CTL_AEW 0x24
65 #define OV965X_CTL_AEB 0x25
66 #define OV965X_CTL_VPT 0x26
67 #define OV965X_CTL_BBIAS 0x27
68 #define OV965X_CTL_GbBIAS 0x28
69 #define OV965X_CTL_Gr_COM 0x29
70 #define OV965X_CTL_EXHCH 0x2a
71 #define OV965X_CTL_EXHCL 0x2b
72 #define OV965X_CTL_RBIAS 0x2c
73 #define OV965X_CTL_ADVFL 0x2d
74 #define OV965X_CTL_ADVFH 0x2e
75 #define OV965X_CTL_YAVE 0x2f
76 #define OV965X_CTL_HSYST 0x30
77 #define OV965X_CTL_HSYEN 0x31
78 #define OV965X_CTL_HREF 0x32
79 #define OV965X_CTL_CHLF 0x33
80 #define OV965X_CTL_ARBLM 0x34
81 #define OV965X_CTL_ADC 0x37
82 #define OV965X_CTL_ACOM 0x38
83 #define OV965X_CTL_OFON 0x39
84 #define OV965X_CTL_TSLB 0x3a
85 #define OV965X_CTL_COM11 0x3b
86 #define OV965X_CTL_COM12 0x3c
87 #define OV965X_CTL_COM13 0x3d
88 #define OV965X_CTL_COM14 0x3e
89 #define OV965X_CTL_EDGE 0x3f
90 #define OV965X_CTL_COM15 0x40
91 #define OV965X_CTL_COM16 0x41
92 #define OV965X_CTL_COM17 0x42
93 #define OV965X_CTL_MTX1 0x4f
94 #define OV965X_CTL_MTX2 0x50
95 #define OV965X_CTL_MTX3 0x51
96 #define OV965X_CTL_MTX4 0x52
97 #define OV965X_CTL_MTX5 0x53
98 #define OV965X_CTL_MTX6 0x54
99 #define OV965X_CTL_MTX7 0x55
100 #define OV965X_CTL_MTX8 0x56
101 #define OV965X_CTL_MTX9 0x57
102 #define OV965X_CTL_LCC1 0x62
103 #define OV965X_CTL_LCC2 0x63
104 #define OV965X_CTL_LCC3 0x64
105 #define OV965X_CTL_LCC4 0x65
106 #define OV965X_CTL_LCC5 0x66
107 #define OV965X_CTL_MANU 0x67
108 #define OV965X_CTL_MANV 0x68
109 #define OV965X_CTL_HV 0x69
110 #define OV965X_CTL_MBD 0x6a
111 #define OV965X_CTL_DBLV 0x6b
112 #define OV965X_CTL_COM21 0x8b
113 #define OV965X_CTL_COM22 0x8c
114 #define OV965X_CTL_COM23 0x8d
115 #define OV965X_CTL_COM24 0x8e
116 #define OV965X_CTL_DBLC1 0x8f
117 #define OV965X_CTL_DBLC_B 0x90
118 #define OV965X_CTL_DBLC_R 0x91
119 #define OV965X_CTL_DM_LNL 0x92
120 #define OV965X_CTL_DM_LNH 0x93
121 #define OV965X_CTL_LCCFB 0x9d
122 #define OV965X_CTL_LCCFR 0x9e
123 #define OV965X_CTL_DBLC_Gb 0x9f
124 #define OV965X_CTL_DBLC_Gr 0xa0
125 #define OV965X_CTL_AECHM 0xa1
126 #define OV965X_CTL_COM25 0xa4 /* all bits reserved */
127 #define OV965X_CTL_COM26 0xa5 /* all bits reserved */
128 #define OV965X_CTL_G_GAIN 0xa6 /* reserved */
129 #define OV965X_CTL_VGA_ST 0xa7 /* reserved */
130 #define OV965X_CTL_ACOM2 0xa8 /* reserved */
132 #define OV965X_COM7_SCCB_RESET 0x80
133 #define OV965X_COM7_OUTPUT_VGA 0x40
134 #define OV965X_COM7_OUTPUT_CIF 0x20
135 #define OV965X_COM7_OUTPUT_QVGA 0x10
136 #define OV965X_COM7_OUTPUT_QCIF 0x08
137 #define OV965X_COM7_OUTPUT_RGB 0x04
138 #define OV965X_COM7_OUTPUT_RAW_RGB 0x05
140 #define OV965X_VREF_ADC_HIGH2(x) ((x) << 6)
141 #define OV965X_VREF_VSTOP_LOW3(x) (0x38 & ((x) << 3))
142 #define OV965X_VREF_VSTART_LOW3(x) (0x07 & (x))
144 #define OV965X_COM2_OUTPUT_DRIVE_CAP_1X 0x00
145 #define OV965X_COM2_OUTPUT_DRIVE_CAP_2X 0x01
146 #define OV965X_COM2_OUTPUT_DRIVE_CAP_3X 0x02
147 #define OV965X_COM2_OUTPUT_DRIVE_CAP_4X 0x03
148 #define OV965X_COM2_SOFT_SLEEP 0x10
150 #define OV965X_COM5_15FPS_48MHZ_RGB 0x80
151 #define OV965X_COM5_SLAM_MODE 0x10
153 #define OV965X_COM6_BLACK_LINE_HREF_ENABLE 0x80
154 #define OV965X_COM6_ADBLC_BIAS_ENABLE 0x08
155 #define OV965X_COM6_ADBLC_OFFSET_2_CHANNEL 0x04 /* else 4-channel */
156 #define OV965X_COM6_TIMING_RESET_ON_FMT_CHANGE 0x02
157 #define OV965X_COM6_ADBLC_ENABLE 0x01
159 #define OV965X_CLKRC_DBL_CLK_ENABLE 0x80
160 #define OV965X_CLKRC_INPUT_CLK_NO_SCALE 0x40
162 #define OV965X_COM8_FAST_AGC_AEC 0x80
163 #define OV965X_COM8_AEC_STEP_SIZE_NOLIMIT 0x40 /* otherwise VSYNC */
164 #define OV965X_COM8_BANDING_FILTER_ON 0x20
165 #define OV965X_COM8_AGC_ENABLE 0x04
166 #define OV965X_COM8_AWB_ENABLE 0x02
167 #define OV965X_COM8_AEC_ENABLE 0x01
169 #define OV965X_COM9_MAX_AGC_128X (0x06 << 4)
170 #define OV965X_COM9_MAX_AGC_64X (0x05 << 4)
171 #define OV965X_COM9_MAX_AGC_32X (0x04 << 4)
172 #define OV965X_COM9_MAX_AGC_16X (0x03 << 4)
173 #define OV965X_COM9_MAX_AGC_8X (0x02 << 4)
174 #define OV965X_COM9_MAX_AGC_4X (0x01 << 4)
175 #define OV965X_COM9_RELAX_EXPOSURE_TIMING 0x08
176 #define OV965X_COM9_DROP_VSYNC_ON_FRAME_DROP 0x04
177 #define OV965X_COM9_DROP_FRAME_ON_BIG_AEC 0x02
178 #define OV965X_COM9_FREEZE_AGC_AEC 0x01
180 #define OV965X_MVFP_MIRROR 0x20
181 #define OV965X_MVFP_VFLIP 0x10
183 #define OV965X_Gr_COM_BYPASS_ANALOG_BLC 0x20
184 #define OV965X_Gr_COM_BYPASS_REGULATOR 0x10
186 #define OV965X_BIAS_SUBTRACT 0x80
187 #define OV965X_BIAS_VALUE(x) ((~0x80) & (x))
189 #define OV965X_HREF_EDGE_OFT_TO_DATA_OUT(x) ((x) << 6)
190 #define OV965X_HREF_HSTOP_LOW3(x) ((~0xc0) & ((x) << 3))
191 #define OV965X_HREF_HSTART_LOW3(x) ((~0xf8) & (x))
193 #define OV965X_TSLB_BITWISE_REVERSE 0x20
194 #define OV965X_TSLB_FIXED_UV_OUTPUT 0x10
195 #define OV965X_TSLB_OUTPUT_SEQ_YUYV 0x00
196 #define OV965X_TSLB_OUTPUT_SEQ_YVYU 0x04
197 #define OV965X_TSLB_OUTPUT_SEQ_VYUY 0x08
198 #define OV965X_TSLB_OUTPUT_SEQ_UYVY 0x0c
199 #define OV965X_TSLB_DIGITAL_BLC_ENABLE 0x01
201 #define OV965X_COM11_NIGHT_MODE_ENABLE 0x80
202 #define OV965X_COM11_NM_NORMAL_FRAME_RATE 0x00
203 #define OV965X_COM11_NM_HALF_FRAME_RATE 0x20
204 #define OV965X_COM11_NM_QUARTER_FRAME_RATE 0x40
205 #define OV965X_COM11_NM_EIGHTH_FRAME_RATE 0x60
206 #define OV965X_COM11_FULL_FRAME_CALC_WIND 0x00
207 #define OV965X_COM11_HALF_FRAME_CALC_WIND 0x08
208 #define OV965X_COM11_QUARTER_FRAME_CALC_WIND 0x10
209 #define OV965X_COM11_MANUAL_BANDING_FILTER 0x01
211 #define OV965X_COM13_ONLY_Y_CHANNEL_GAMMA 0x40
212 #define OV965X_COM13_GAMMA_RAW_PRE_INTERP 0x80
213 #define OV965X_COM13_ENABLE_COLOR_MATRIX 0x10
214 #define OV965X_COM13_DELAY_UV_CHANNEL 0x00
215 #define OV965X_COM13_DELAY_Y_CHANNEL 0x08
216 #define OV965X_COM13_OUTPUT_DELAY(x) ((~0xf8) & (x))
218 #define OV965X_COM14_YUV_EDGE_ENHANCE 0x02
219 #define OV965X_COM14_EDGE_ENHANCE_FACTOR_DBL 0x01
221 #define OV965X_EDGE_EDGE_ENHANCE_LOW4(x) ((x) << 4)
222 #define OV965X_EDGE_EDGE_ENHANCE_FACTOR(x) (0xf0 & (x))
224 #define OV965X_COM15_OUTPUT_RANGE_10_TO_F0 0x00
225 #define OV965X_COM15_OUTPUT_RANGE_O1_TO_FE 0x80
226 #define OV965X_COM15_OUTPUT_RANGE_O0_TO_FF 0xc0
227 #define OV965X_COM15_OUTPUT_RGB_565 0x10
228 #define OV965X_COM15_OUTPUT_RGB_555 0x30
229 #define OV965X_COM15_SWAP_R_AND_B 0x08
232 int soi968_set_exposure(struct usb_microdia *dev);
233 int soi968_initialize(struct usb_microdia *dev);
234 int ov965x_initialize(struct usb_microdia *);
235 int ov965x_probe(struct usb_microdia *);
236 int ov965x_set_hvflip(struct usb_microdia *);
237 int ov965x_set_exposure(struct usb_microdia *);
238 int ov965x_set_autoexposure(struct usb_microdia *dev);
239 #endif