1 /***************************************************************************
2 * Plug-in for OV7630 image sensor connected to the SN9C1xx PC Camera *
5 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
20 ***************************************************************************/
22 #include "sn9c102_sensor.h"
23 #include "sn9c102_devtable.h"
26 static int ov7630_init(struct sn9c102_device
* cam
)
30 switch (sn9c102_get_bridge(cam
)) {
33 err
= sn9c102_write_const_regs(cam
, {0x00, 0x14}, {0x60, 0x17},
34 {0x0f, 0x18}, {0x50, 0x19});
36 err
+= sn9c102_i2c_write(cam
, 0x12, 0x8d);
37 err
+= sn9c102_i2c_write(cam
, 0x12, 0x0d);
38 err
+= sn9c102_i2c_write(cam
, 0x11, 0x00);
39 err
+= sn9c102_i2c_write(cam
, 0x15, 0x35);
40 err
+= sn9c102_i2c_write(cam
, 0x16, 0x03);
41 err
+= sn9c102_i2c_write(cam
, 0x17, 0x1c);
42 err
+= sn9c102_i2c_write(cam
, 0x18, 0xbd);
43 err
+= sn9c102_i2c_write(cam
, 0x19, 0x06);
44 err
+= sn9c102_i2c_write(cam
, 0x1a, 0xf6);
45 err
+= sn9c102_i2c_write(cam
, 0x1b, 0x04);
46 err
+= sn9c102_i2c_write(cam
, 0x20, 0x44);
47 err
+= sn9c102_i2c_write(cam
, 0x23, 0xee);
48 err
+= sn9c102_i2c_write(cam
, 0x26, 0xa0);
49 err
+= sn9c102_i2c_write(cam
, 0x27, 0x9a);
50 err
+= sn9c102_i2c_write(cam
, 0x28, 0x20);
51 err
+= sn9c102_i2c_write(cam
, 0x29, 0x30);
52 err
+= sn9c102_i2c_write(cam
, 0x2f, 0x3d);
53 err
+= sn9c102_i2c_write(cam
, 0x30, 0x24);
54 err
+= sn9c102_i2c_write(cam
, 0x32, 0x86);
55 err
+= sn9c102_i2c_write(cam
, 0x60, 0xa9);
56 err
+= sn9c102_i2c_write(cam
, 0x61, 0x42);
57 err
+= sn9c102_i2c_write(cam
, 0x65, 0x00);
58 err
+= sn9c102_i2c_write(cam
, 0x69, 0x38);
59 err
+= sn9c102_i2c_write(cam
, 0x6f, 0x88);
60 err
+= sn9c102_i2c_write(cam
, 0x70, 0x0b);
61 err
+= sn9c102_i2c_write(cam
, 0x71, 0x00);
62 err
+= sn9c102_i2c_write(cam
, 0x74, 0x21);
63 err
+= sn9c102_i2c_write(cam
, 0x7d, 0xf7);
66 err
= sn9c102_write_const_regs(cam
, {0x00, 0x02}, {0x00, 0x03},
67 {0x1a, 0x04}, {0x20, 0x05},
68 {0x20, 0x06}, {0x20, 0x07},
69 {0x03, 0x10}, {0x0a, 0x14},
70 {0x60, 0x17}, {0x0f, 0x18},
71 {0x50, 0x19}, {0x1d, 0x1a},
72 {0x10, 0x1b}, {0x02, 0x1c},
73 {0x03, 0x1d}, {0x0f, 0x1e},
74 {0x0c, 0x1f}, {0x00, 0x20},
75 {0x10, 0x21}, {0x20, 0x22},
76 {0x30, 0x23}, {0x40, 0x24},
77 {0x50, 0x25}, {0x60, 0x26},
78 {0x70, 0x27}, {0x80, 0x28},
79 {0x90, 0x29}, {0xa0, 0x2a},
80 {0xb0, 0x2b}, {0xc0, 0x2c},
81 {0xd0, 0x2d}, {0xe0, 0x2e},
82 {0xf0, 0x2f}, {0xff, 0x30});
84 err
+= sn9c102_i2c_write(cam
, 0x12, 0x8d);
85 err
+= sn9c102_i2c_write(cam
, 0x12, 0x0d);
86 err
+= sn9c102_i2c_write(cam
, 0x15, 0x34);
87 err
+= sn9c102_i2c_write(cam
, 0x11, 0x01);
88 err
+= sn9c102_i2c_write(cam
, 0x1b, 0x04);
89 err
+= sn9c102_i2c_write(cam
, 0x20, 0x44);
90 err
+= sn9c102_i2c_write(cam
, 0x23, 0xee);
91 err
+= sn9c102_i2c_write(cam
, 0x26, 0xa0);
92 err
+= sn9c102_i2c_write(cam
, 0x27, 0x9a);
93 err
+= sn9c102_i2c_write(cam
, 0x28, 0x20);
94 err
+= sn9c102_i2c_write(cam
, 0x29, 0x30);
95 err
+= sn9c102_i2c_write(cam
, 0x2f, 0x3d);
96 err
+= sn9c102_i2c_write(cam
, 0x30, 0x24);
97 err
+= sn9c102_i2c_write(cam
, 0x32, 0x86);
98 err
+= sn9c102_i2c_write(cam
, 0x60, 0xa9);
99 err
+= sn9c102_i2c_write(cam
, 0x61, 0x42);
100 err
+= sn9c102_i2c_write(cam
, 0x65, 0x00);
101 err
+= sn9c102_i2c_write(cam
, 0x69, 0x38);
102 err
+= sn9c102_i2c_write(cam
, 0x6f, 0x88);
103 err
+= sn9c102_i2c_write(cam
, 0x70, 0x0b);
104 err
+= sn9c102_i2c_write(cam
, 0x71, 0x00);
105 err
+= sn9c102_i2c_write(cam
, 0x74, 0x21);
106 err
+= sn9c102_i2c_write(cam
, 0x7d, 0xf7);
110 err
= sn9c102_write_const_regs(cam
, {0x40, 0x02}, {0x00, 0x03},
111 {0x1a, 0x04}, {0x03, 0x10},
112 {0x0a, 0x14}, {0xe2, 0x17},
113 {0x0b, 0x18}, {0x00, 0x19},
114 {0x1d, 0x1a}, {0x10, 0x1b},
115 {0x02, 0x1c}, {0x03, 0x1d},
116 {0x0f, 0x1e}, {0x0c, 0x1f},
117 {0x00, 0x20}, {0x24, 0x21},
118 {0x3b, 0x22}, {0x47, 0x23},
119 {0x60, 0x24}, {0x71, 0x25},
120 {0x80, 0x26}, {0x8f, 0x27},
121 {0x9d, 0x28}, {0xaa, 0x29},
122 {0xb8, 0x2a}, {0xc4, 0x2b},
123 {0xd1, 0x2c}, {0xdd, 0x2d},
124 {0xe8, 0x2e}, {0xf4, 0x2f},
125 {0xff, 0x30}, {0x00, 0x3f},
126 {0xc7, 0x40}, {0x01, 0x41},
127 {0x44, 0x42}, {0x00, 0x43},
128 {0x44, 0x44}, {0x00, 0x45},
129 {0x44, 0x46}, {0x00, 0x47},
130 {0xc7, 0x48}, {0x01, 0x49},
131 {0xc7, 0x4a}, {0x01, 0x4b},
132 {0xc7, 0x4c}, {0x01, 0x4d},
133 {0x44, 0x4e}, {0x00, 0x4f},
134 {0x44, 0x50}, {0x00, 0x51},
135 {0x44, 0x52}, {0x00, 0x53},
136 {0xc7, 0x54}, {0x01, 0x55},
137 {0xc7, 0x56}, {0x01, 0x57},
138 {0xc7, 0x58}, {0x01, 0x59},
139 {0x44, 0x5a}, {0x00, 0x5b},
140 {0x44, 0x5c}, {0x00, 0x5d},
141 {0x44, 0x5e}, {0x00, 0x5f},
142 {0xc7, 0x60}, {0x01, 0x61},
143 {0xc7, 0x62}, {0x01, 0x63},
144 {0xc7, 0x64}, {0x01, 0x65},
145 {0x44, 0x66}, {0x00, 0x67},
146 {0x44, 0x68}, {0x00, 0x69},
147 {0x44, 0x6a}, {0x00, 0x6b},
148 {0xc7, 0x6c}, {0x01, 0x6d},
149 {0xc7, 0x6e}, {0x01, 0x6f},
150 {0xc7, 0x70}, {0x01, 0x71},
151 {0x44, 0x72}, {0x00, 0x73},
152 {0x44, 0x74}, {0x00, 0x75},
153 {0x44, 0x76}, {0x00, 0x77},
154 {0xc7, 0x78}, {0x01, 0x79},
155 {0xc7, 0x7a}, {0x01, 0x7b},
156 {0xc7, 0x7c}, {0x01, 0x7d},
157 {0x44, 0x7e}, {0x00, 0x7f},
158 {0x17, 0x84}, {0x00, 0x85},
159 {0x2e, 0x86}, {0x00, 0x87},
160 {0x09, 0x88}, {0x00, 0x89},
161 {0xe8, 0x8a}, {0x0f, 0x8b},
162 {0xda, 0x8c}, {0x0f, 0x8d},
163 {0x40, 0x8e}, {0x00, 0x8f},
164 {0x37, 0x90}, {0x00, 0x91},
165 {0xcf, 0x92}, {0x0f, 0x93},
166 {0xfa, 0x94}, {0x0f, 0x95},
167 {0x00, 0x96}, {0x00, 0x97},
168 {0x00, 0x98}, {0x66, 0x99},
169 {0x00, 0x9a}, {0x40, 0x9b},
170 {0x20, 0x9c}, {0x00, 0x9d},
171 {0x00, 0x9e}, {0x00, 0x9f},
172 {0x2d, 0xc0}, {0x2d, 0xc1},
173 {0x3a, 0xc2}, {0x00, 0xc3},
174 {0x04, 0xc4}, {0x3f, 0xc5},
175 {0x00, 0xc6}, {0x00, 0xc7},
176 {0x50, 0xc8}, {0x3c, 0xc9},
177 {0x28, 0xca}, {0xd8, 0xcb},
178 {0x14, 0xcc}, {0xec, 0xcd},
179 {0x32, 0xce}, {0xdd, 0xcf},
180 {0x32, 0xd0}, {0xdd, 0xd1},
181 {0x6a, 0xd2}, {0x50, 0xd3},
182 {0x60, 0xd4}, {0x00, 0xd5},
185 err
+= sn9c102_i2c_write(cam
, 0x12, 0x80);
186 err
+= sn9c102_i2c_write(cam
, 0x12, 0x48);
187 err
+= sn9c102_i2c_write(cam
, 0x01, 0x80);
188 err
+= sn9c102_i2c_write(cam
, 0x02, 0x80);
189 err
+= sn9c102_i2c_write(cam
, 0x03, 0x80);
190 err
+= sn9c102_i2c_write(cam
, 0x04, 0x10);
191 err
+= sn9c102_i2c_write(cam
, 0x05, 0x20);
192 err
+= sn9c102_i2c_write(cam
, 0x06, 0x80);
193 err
+= sn9c102_i2c_write(cam
, 0x11, 0x00);
194 err
+= sn9c102_i2c_write(cam
, 0x0c, 0x20);
195 err
+= sn9c102_i2c_write(cam
, 0x0d, 0x20);
196 err
+= sn9c102_i2c_write(cam
, 0x15, 0x80);
197 err
+= sn9c102_i2c_write(cam
, 0x16, 0x03);
198 err
+= sn9c102_i2c_write(cam
, 0x17, 0x1b);
199 err
+= sn9c102_i2c_write(cam
, 0x18, 0xbd);
200 err
+= sn9c102_i2c_write(cam
, 0x19, 0x05);
201 err
+= sn9c102_i2c_write(cam
, 0x1a, 0xf6);
202 err
+= sn9c102_i2c_write(cam
, 0x1b, 0x04);
203 err
+= sn9c102_i2c_write(cam
, 0x21, 0x1b);
204 err
+= sn9c102_i2c_write(cam
, 0x22, 0x00);
205 err
+= sn9c102_i2c_write(cam
, 0x23, 0xde);
206 err
+= sn9c102_i2c_write(cam
, 0x24, 0x10);
207 err
+= sn9c102_i2c_write(cam
, 0x25, 0x8a);
208 err
+= sn9c102_i2c_write(cam
, 0x26, 0xa0);
209 err
+= sn9c102_i2c_write(cam
, 0x27, 0xca);
210 err
+= sn9c102_i2c_write(cam
, 0x28, 0xa2);
211 err
+= sn9c102_i2c_write(cam
, 0x29, 0x74);
212 err
+= sn9c102_i2c_write(cam
, 0x2a, 0x88);
213 err
+= sn9c102_i2c_write(cam
, 0x2b, 0x34);
214 err
+= sn9c102_i2c_write(cam
, 0x2c, 0x88);
215 err
+= sn9c102_i2c_write(cam
, 0x2e, 0x00);
216 err
+= sn9c102_i2c_write(cam
, 0x2f, 0x00);
217 err
+= sn9c102_i2c_write(cam
, 0x30, 0x00);
218 err
+= sn9c102_i2c_write(cam
, 0x32, 0xc2);
219 err
+= sn9c102_i2c_write(cam
, 0x33, 0x08);
220 err
+= sn9c102_i2c_write(cam
, 0x4c, 0x40);
221 err
+= sn9c102_i2c_write(cam
, 0x4d, 0xf3);
222 err
+= sn9c102_i2c_write(cam
, 0x60, 0x05);
223 err
+= sn9c102_i2c_write(cam
, 0x61, 0x40);
224 err
+= sn9c102_i2c_write(cam
, 0x62, 0x12);
225 err
+= sn9c102_i2c_write(cam
, 0x63, 0x57);
226 err
+= sn9c102_i2c_write(cam
, 0x64, 0x73);
227 err
+= sn9c102_i2c_write(cam
, 0x65, 0x00);
228 err
+= sn9c102_i2c_write(cam
, 0x66, 0x55);
229 err
+= sn9c102_i2c_write(cam
, 0x67, 0x01);
230 err
+= sn9c102_i2c_write(cam
, 0x68, 0xac);
231 err
+= sn9c102_i2c_write(cam
, 0x69, 0x38);
232 err
+= sn9c102_i2c_write(cam
, 0x6f, 0x1f);
233 err
+= sn9c102_i2c_write(cam
, 0x70, 0x01);
234 err
+= sn9c102_i2c_write(cam
, 0x71, 0x00);
235 err
+= sn9c102_i2c_write(cam
, 0x72, 0x10);
236 err
+= sn9c102_i2c_write(cam
, 0x73, 0x50);
237 err
+= sn9c102_i2c_write(cam
, 0x74, 0x20);
238 err
+= sn9c102_i2c_write(cam
, 0x76, 0x01);
239 err
+= sn9c102_i2c_write(cam
, 0x77, 0xf3);
240 err
+= sn9c102_i2c_write(cam
, 0x78, 0x90);
241 err
+= sn9c102_i2c_write(cam
, 0x79, 0x98);
242 err
+= sn9c102_i2c_write(cam
, 0x7a, 0x98);
243 err
+= sn9c102_i2c_write(cam
, 0x7b, 0x00);
244 err
+= sn9c102_i2c_write(cam
, 0x7c, 0x38);
245 err
+= sn9c102_i2c_write(cam
, 0x7d, 0xff);
255 static int ov7630_get_ctrl(struct sn9c102_device
* cam
,
256 struct v4l2_control
* ctrl
)
258 enum sn9c102_bridge bridge
= sn9c102_get_bridge(cam
);
262 case V4L2_CID_EXPOSURE
:
263 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x10)) < 0)
266 case V4L2_CID_RED_BALANCE
:
267 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
268 ctrl
->value
= sn9c102_pread_reg(cam
, 0x05);
270 ctrl
->value
= sn9c102_pread_reg(cam
, 0x07);
272 case V4L2_CID_BLUE_BALANCE
:
273 ctrl
->value
= sn9c102_pread_reg(cam
, 0x06);
275 case SN9C102_V4L2_CID_GREEN_BALANCE
:
276 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
277 ctrl
->value
= sn9c102_pread_reg(cam
, 0x07);
279 ctrl
->value
= sn9c102_pread_reg(cam
, 0x05);
283 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x00)) < 0)
287 case V4L2_CID_DO_WHITE_BALANCE
:
288 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x0c)) < 0)
292 case V4L2_CID_WHITENESS
:
293 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x0d)) < 0)
297 case V4L2_CID_AUTOGAIN
:
298 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x13)) < 0)
303 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x75)) < 0)
305 ctrl
->value
= (ctrl
->value
& 0x80) ? 1 : 0;
307 case SN9C102_V4L2_CID_GAMMA
:
308 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x14)) < 0)
310 ctrl
->value
= (ctrl
->value
& 0x02) ? 1 : 0;
312 case SN9C102_V4L2_CID_BAND_FILTER
:
313 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x2d)) < 0)
315 ctrl
->value
= (ctrl
->value
& 0x02) ? 1 : 0;
321 return err
? -EIO
: 0;
325 static int ov7630_set_ctrl(struct sn9c102_device
* cam
,
326 const struct v4l2_control
* ctrl
)
328 enum sn9c102_bridge bridge
= sn9c102_get_bridge(cam
);
332 case V4L2_CID_EXPOSURE
:
333 err
+= sn9c102_i2c_write(cam
, 0x10, ctrl
->value
);
335 case V4L2_CID_RED_BALANCE
:
336 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
337 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x05);
339 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x07);
341 case V4L2_CID_BLUE_BALANCE
:
342 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x06);
344 case SN9C102_V4L2_CID_GREEN_BALANCE
:
345 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
346 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x07);
348 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x05);
351 err
+= sn9c102_i2c_write(cam
, 0x00, ctrl
->value
);
353 case V4L2_CID_DO_WHITE_BALANCE
:
354 err
+= sn9c102_i2c_write(cam
, 0x0c, ctrl
->value
);
356 case V4L2_CID_WHITENESS
:
357 err
+= sn9c102_i2c_write(cam
, 0x0d, ctrl
->value
);
359 case V4L2_CID_AUTOGAIN
:
360 err
+= sn9c102_i2c_write(cam
, 0x13, ctrl
->value
|
364 err
+= sn9c102_i2c_write(cam
, 0x75, 0x0e | (ctrl
->value
<< 7));
366 case SN9C102_V4L2_CID_GAMMA
:
367 err
+= sn9c102_i2c_write(cam
, 0x14, ctrl
->value
<< 2);
369 case SN9C102_V4L2_CID_BAND_FILTER
:
370 err
+= sn9c102_i2c_write(cam
, 0x2d, ctrl
->value
<< 2);
376 return err
? -EIO
: 0;
380 static int ov7630_set_crop(struct sn9c102_device
* cam
,
381 const struct v4l2_rect
* rect
)
383 struct sn9c102_sensor
* s
= sn9c102_get_sensor(cam
);
385 u8 h_start
= 0, v_start
= (u8
)(rect
->top
- s
->cropcap
.bounds
.top
) + 1;
387 switch (sn9c102_get_bridge(cam
)) {
391 h_start
= (u8
)(rect
->left
- s
->cropcap
.bounds
.left
) + 1;
395 h_start
= (u8
)(rect
->left
- s
->cropcap
.bounds
.left
) + 4;
401 err
+= sn9c102_write_reg(cam
, h_start
, 0x12);
402 err
+= sn9c102_write_reg(cam
, v_start
, 0x13);
408 static int ov7630_set_pix_format(struct sn9c102_device
* cam
,
409 const struct v4l2_pix_format
* pix
)
413 switch (sn9c102_get_bridge(cam
)) {
417 if (pix
->pixelformat
== V4L2_PIX_FMT_SBGGR8
)
418 err
+= sn9c102_write_reg(cam
, 0x50, 0x19);
420 err
+= sn9c102_write_reg(cam
, 0x20, 0x19);
424 if (pix
->pixelformat
== V4L2_PIX_FMT_SBGGR8
) {
425 err
+= sn9c102_write_reg(cam
, 0xe5, 0x17);
426 err
+= sn9c102_i2c_write(cam
, 0x11, 0x04);
428 err
+= sn9c102_write_reg(cam
, 0xe2, 0x17);
429 err
+= sn9c102_i2c_write(cam
, 0x11, 0x02);
440 static const struct sn9c102_sensor ov7630
= {
442 .maintainer
= "Luca Risolia <luca.risolia@studio.unibo.it>",
443 .supported_bridge
= BRIDGE_SN9C101
| BRIDGE_SN9C102
| BRIDGE_SN9C103
|
444 BRIDGE_SN9C105
| BRIDGE_SN9C120
,
445 .sysfs_ops
= SN9C102_I2C_READ
| SN9C102_I2C_WRITE
,
446 .frequency
= SN9C102_I2C_100KHZ
,
447 .interface
= SN9C102_I2C_2WIRES
,
448 .i2c_slave_id
= 0x21,
449 .init
= &ov7630_init
,
453 .type
= V4L2_CTRL_TYPE_INTEGER
,
454 .name
= "global gain",
458 .default_value
= 0x14,
462 .id
= V4L2_CID_EXPOSURE
,
463 .type
= V4L2_CTRL_TYPE_INTEGER
,
468 .default_value
= 0x60,
472 .id
= V4L2_CID_WHITENESS
,
473 .type
= V4L2_CTRL_TYPE_INTEGER
,
474 .name
= "white balance background: red",
478 .default_value
= 0x20,
482 .id
= V4L2_CID_DO_WHITE_BALANCE
,
483 .type
= V4L2_CTRL_TYPE_INTEGER
,
484 .name
= "white balance background: blue",
488 .default_value
= 0x20,
492 .id
= V4L2_CID_RED_BALANCE
,
493 .type
= V4L2_CTRL_TYPE_INTEGER
,
494 .name
= "red balance",
498 .default_value
= 0x20,
502 .id
= V4L2_CID_BLUE_BALANCE
,
503 .type
= V4L2_CTRL_TYPE_INTEGER
,
504 .name
= "blue balance",
508 .default_value
= 0x20,
512 .id
= V4L2_CID_AUTOGAIN
,
513 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
514 .name
= "auto adjust",
518 .default_value
= 0x00,
522 .id
= V4L2_CID_VFLIP
,
523 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
524 .name
= "vertical flip",
528 .default_value
= 0x01,
532 .id
= SN9C102_V4L2_CID_GREEN_BALANCE
,
533 .type
= V4L2_CTRL_TYPE_INTEGER
,
534 .name
= "green balance",
538 .default_value
= 0x20,
542 .id
= SN9C102_V4L2_CID_BAND_FILTER
,
543 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
544 .name
= "band filter",
548 .default_value
= 0x00,
552 .id
= SN9C102_V4L2_CID_GAMMA
,
553 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
558 .default_value
= 0x00,
562 .get_ctrl
= &ov7630_get_ctrl
,
563 .set_ctrl
= &ov7630_set_ctrl
,
578 .set_crop
= &ov7630_set_crop
,
582 .pixelformat
= V4L2_PIX_FMT_SN9C10X
,
585 .set_pix_format
= &ov7630_set_pix_format
589 int sn9c102_probe_ov7630(struct sn9c102_device
* cam
)
591 int pid
, ver
, err
= 0;
593 switch (sn9c102_get_bridge(cam
)) {
596 err
= sn9c102_write_const_regs(cam
, {0x01, 0x01}, {0x00, 0x01},
599 case BRIDGE_SN9C103
: /* do _not_ change anything! */
600 err
= sn9c102_write_const_regs(cam
, {0x09, 0x01}, {0x42, 0x01},
601 {0x28, 0x17}, {0x44, 0x02});
602 pid
= sn9c102_i2c_try_read(cam
, &ov7630
, 0x0a);
603 if (err
|| pid
< 0) /* try a different initialization */
604 err
+= sn9c102_write_const_regs(cam
, {0x01, 0x01},
609 err
= sn9c102_write_const_regs(cam
, {0x01, 0xf1}, {0x00, 0xf1},
610 {0x29, 0x01}, {0x74, 0x02},
611 {0x0e, 0x01}, {0x44, 0x01});
617 pid
= sn9c102_i2c_try_read(cam
, &ov7630
, 0x0a);
618 ver
= sn9c102_i2c_try_read(cam
, &ov7630
, 0x0b);
619 if (err
|| pid
< 0 || ver
< 0)
621 if (pid
!= 0x76 || ver
!= 0x31)
623 sn9c102_attach_sensor(cam
, &ov7630
);