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"
25 static int ov7630_init(struct sn9c102_device
* cam
)
29 switch (sn9c102_get_bridge(cam
)) {
32 err
= sn9c102_write_const_regs(cam
, {0x00, 0x14}, {0x60, 0x17},
33 {0x0f, 0x18}, {0x50, 0x19});
35 err
+= sn9c102_i2c_write(cam
, 0x12, 0x8d);
36 err
+= sn9c102_i2c_write(cam
, 0x12, 0x0d);
37 err
+= sn9c102_i2c_write(cam
, 0x11, 0x00);
38 err
+= sn9c102_i2c_write(cam
, 0x15, 0x35);
39 err
+= sn9c102_i2c_write(cam
, 0x16, 0x03);
40 err
+= sn9c102_i2c_write(cam
, 0x17, 0x1c);
41 err
+= sn9c102_i2c_write(cam
, 0x18, 0xbd);
42 err
+= sn9c102_i2c_write(cam
, 0x19, 0x06);
43 err
+= sn9c102_i2c_write(cam
, 0x1a, 0xf6);
44 err
+= sn9c102_i2c_write(cam
, 0x1b, 0x04);
45 err
+= sn9c102_i2c_write(cam
, 0x20, 0x44);
46 err
+= sn9c102_i2c_write(cam
, 0x23, 0xee);
47 err
+= sn9c102_i2c_write(cam
, 0x26, 0xa0);
48 err
+= sn9c102_i2c_write(cam
, 0x27, 0x9a);
49 err
+= sn9c102_i2c_write(cam
, 0x28, 0x20);
50 err
+= sn9c102_i2c_write(cam
, 0x29, 0x30);
51 err
+= sn9c102_i2c_write(cam
, 0x2f, 0x3d);
52 err
+= sn9c102_i2c_write(cam
, 0x30, 0x24);
53 err
+= sn9c102_i2c_write(cam
, 0x32, 0x86);
54 err
+= sn9c102_i2c_write(cam
, 0x60, 0xa9);
55 err
+= sn9c102_i2c_write(cam
, 0x61, 0x42);
56 err
+= sn9c102_i2c_write(cam
, 0x65, 0x00);
57 err
+= sn9c102_i2c_write(cam
, 0x69, 0x38);
58 err
+= sn9c102_i2c_write(cam
, 0x6f, 0x88);
59 err
+= sn9c102_i2c_write(cam
, 0x70, 0x0b);
60 err
+= sn9c102_i2c_write(cam
, 0x71, 0x00);
61 err
+= sn9c102_i2c_write(cam
, 0x74, 0x21);
62 err
+= sn9c102_i2c_write(cam
, 0x7d, 0xf7);
65 err
= sn9c102_write_const_regs(cam
, {0x00, 0x02}, {0x00, 0x03},
66 {0x1a, 0x04}, {0x20, 0x05},
67 {0x20, 0x06}, {0x20, 0x07},
68 {0x03, 0x10}, {0x0a, 0x14},
69 {0x60, 0x17}, {0x0f, 0x18},
70 {0x50, 0x19}, {0x1d, 0x1a},
71 {0x10, 0x1b}, {0x02, 0x1c},
72 {0x03, 0x1d}, {0x0f, 0x1e},
73 {0x0c, 0x1f}, {0x00, 0x20},
74 {0x10, 0x21}, {0x20, 0x22},
75 {0x30, 0x23}, {0x40, 0x24},
76 {0x50, 0x25}, {0x60, 0x26},
77 {0x70, 0x27}, {0x80, 0x28},
78 {0x90, 0x29}, {0xa0, 0x2a},
79 {0xb0, 0x2b}, {0xc0, 0x2c},
80 {0xd0, 0x2d}, {0xe0, 0x2e},
81 {0xf0, 0x2f}, {0xff, 0x30});
83 err
+= sn9c102_i2c_write(cam
, 0x12, 0x8d);
84 err
+= sn9c102_i2c_write(cam
, 0x12, 0x0d);
85 err
+= sn9c102_i2c_write(cam
, 0x15, 0x34);
86 err
+= sn9c102_i2c_write(cam
, 0x11, 0x01);
87 err
+= sn9c102_i2c_write(cam
, 0x1b, 0x04);
88 err
+= sn9c102_i2c_write(cam
, 0x20, 0x44);
89 err
+= sn9c102_i2c_write(cam
, 0x23, 0xee);
90 err
+= sn9c102_i2c_write(cam
, 0x26, 0xa0);
91 err
+= sn9c102_i2c_write(cam
, 0x27, 0x9a);
92 err
+= sn9c102_i2c_write(cam
, 0x28, 0x20);
93 err
+= sn9c102_i2c_write(cam
, 0x29, 0x30);
94 err
+= sn9c102_i2c_write(cam
, 0x2f, 0x3d);
95 err
+= sn9c102_i2c_write(cam
, 0x30, 0x24);
96 err
+= sn9c102_i2c_write(cam
, 0x32, 0x86);
97 err
+= sn9c102_i2c_write(cam
, 0x60, 0xa9);
98 err
+= sn9c102_i2c_write(cam
, 0x61, 0x42);
99 err
+= sn9c102_i2c_write(cam
, 0x65, 0x00);
100 err
+= sn9c102_i2c_write(cam
, 0x69, 0x38);
101 err
+= sn9c102_i2c_write(cam
, 0x6f, 0x88);
102 err
+= sn9c102_i2c_write(cam
, 0x70, 0x0b);
103 err
+= sn9c102_i2c_write(cam
, 0x71, 0x00);
104 err
+= sn9c102_i2c_write(cam
, 0x74, 0x21);
105 err
+= sn9c102_i2c_write(cam
, 0x7d, 0xf7);
109 err
= sn9c102_write_const_regs(cam
, {0x40, 0x02}, {0x00, 0x03},
110 {0x1a, 0x04}, {0x03, 0x10},
111 {0x0a, 0x14}, {0xe2, 0x17},
112 {0x0b, 0x18}, {0x00, 0x19},
113 {0x1d, 0x1a}, {0x10, 0x1b},
114 {0x02, 0x1c}, {0x03, 0x1d},
115 {0x0f, 0x1e}, {0x0c, 0x1f},
116 {0x00, 0x20}, {0x24, 0x21},
117 {0x3b, 0x22}, {0x47, 0x23},
118 {0x60, 0x24}, {0x71, 0x25},
119 {0x80, 0x26}, {0x8f, 0x27},
120 {0x9d, 0x28}, {0xaa, 0x29},
121 {0xb8, 0x2a}, {0xc4, 0x2b},
122 {0xd1, 0x2c}, {0xdd, 0x2d},
123 {0xe8, 0x2e}, {0xf4, 0x2f},
124 {0xff, 0x30}, {0x00, 0x3f},
125 {0xc7, 0x40}, {0x01, 0x41},
126 {0x44, 0x42}, {0x00, 0x43},
127 {0x44, 0x44}, {0x00, 0x45},
128 {0x44, 0x46}, {0x00, 0x47},
129 {0xc7, 0x48}, {0x01, 0x49},
130 {0xc7, 0x4a}, {0x01, 0x4b},
131 {0xc7, 0x4c}, {0x01, 0x4d},
132 {0x44, 0x4e}, {0x00, 0x4f},
133 {0x44, 0x50}, {0x00, 0x51},
134 {0x44, 0x52}, {0x00, 0x53},
135 {0xc7, 0x54}, {0x01, 0x55},
136 {0xc7, 0x56}, {0x01, 0x57},
137 {0xc7, 0x58}, {0x01, 0x59},
138 {0x44, 0x5a}, {0x00, 0x5b},
139 {0x44, 0x5c}, {0x00, 0x5d},
140 {0x44, 0x5e}, {0x00, 0x5f},
141 {0xc7, 0x60}, {0x01, 0x61},
142 {0xc7, 0x62}, {0x01, 0x63},
143 {0xc7, 0x64}, {0x01, 0x65},
144 {0x44, 0x66}, {0x00, 0x67},
145 {0x44, 0x68}, {0x00, 0x69},
146 {0x44, 0x6a}, {0x00, 0x6b},
147 {0xc7, 0x6c}, {0x01, 0x6d},
148 {0xc7, 0x6e}, {0x01, 0x6f},
149 {0xc7, 0x70}, {0x01, 0x71},
150 {0x44, 0x72}, {0x00, 0x73},
151 {0x44, 0x74}, {0x00, 0x75},
152 {0x44, 0x76}, {0x00, 0x77},
153 {0xc7, 0x78}, {0x01, 0x79},
154 {0xc7, 0x7a}, {0x01, 0x7b},
155 {0xc7, 0x7c}, {0x01, 0x7d},
156 {0x44, 0x7e}, {0x00, 0x7f},
157 {0x17, 0x84}, {0x00, 0x85},
158 {0x2e, 0x86}, {0x00, 0x87},
159 {0x09, 0x88}, {0x00, 0x89},
160 {0xe8, 0x8a}, {0x0f, 0x8b},
161 {0xda, 0x8c}, {0x0f, 0x8d},
162 {0x40, 0x8e}, {0x00, 0x8f},
163 {0x37, 0x90}, {0x00, 0x91},
164 {0xcf, 0x92}, {0x0f, 0x93},
165 {0xfa, 0x94}, {0x0f, 0x95},
166 {0x00, 0x96}, {0x00, 0x97},
167 {0x00, 0x98}, {0x66, 0x99},
168 {0x00, 0x9a}, {0x40, 0x9b},
169 {0x20, 0x9c}, {0x00, 0x9d},
170 {0x00, 0x9e}, {0x00, 0x9f},
171 {0x2d, 0xc0}, {0x2d, 0xc1},
172 {0x3a, 0xc2}, {0x00, 0xc3},
173 {0x04, 0xc4}, {0x3f, 0xc5},
174 {0x00, 0xc6}, {0x00, 0xc7},
175 {0x50, 0xc8}, {0x3c, 0xc9},
176 {0x28, 0xca}, {0xd8, 0xcb},
177 {0x14, 0xcc}, {0xec, 0xcd},
178 {0x32, 0xce}, {0xdd, 0xcf},
179 {0x32, 0xd0}, {0xdd, 0xd1},
180 {0x6a, 0xd2}, {0x50, 0xd3},
181 {0x60, 0xd4}, {0x00, 0xd5},
184 err
+= sn9c102_i2c_write(cam
, 0x12, 0x80);
185 err
+= sn9c102_i2c_write(cam
, 0x12, 0x48);
186 err
+= sn9c102_i2c_write(cam
, 0x01, 0x80);
187 err
+= sn9c102_i2c_write(cam
, 0x02, 0x80);
188 err
+= sn9c102_i2c_write(cam
, 0x03, 0x80);
189 err
+= sn9c102_i2c_write(cam
, 0x04, 0x10);
190 err
+= sn9c102_i2c_write(cam
, 0x05, 0x20);
191 err
+= sn9c102_i2c_write(cam
, 0x06, 0x80);
192 err
+= sn9c102_i2c_write(cam
, 0x11, 0x00);
193 err
+= sn9c102_i2c_write(cam
, 0x0c, 0x20);
194 err
+= sn9c102_i2c_write(cam
, 0x0d, 0x20);
195 err
+= sn9c102_i2c_write(cam
, 0x15, 0x80);
196 err
+= sn9c102_i2c_write(cam
, 0x16, 0x03);
197 err
+= sn9c102_i2c_write(cam
, 0x17, 0x1b);
198 err
+= sn9c102_i2c_write(cam
, 0x18, 0xbd);
199 err
+= sn9c102_i2c_write(cam
, 0x19, 0x05);
200 err
+= sn9c102_i2c_write(cam
, 0x1a, 0xf6);
201 err
+= sn9c102_i2c_write(cam
, 0x1b, 0x04);
202 err
+= sn9c102_i2c_write(cam
, 0x21, 0x1b);
203 err
+= sn9c102_i2c_write(cam
, 0x22, 0x00);
204 err
+= sn9c102_i2c_write(cam
, 0x23, 0xde);
205 err
+= sn9c102_i2c_write(cam
, 0x24, 0x10);
206 err
+= sn9c102_i2c_write(cam
, 0x25, 0x8a);
207 err
+= sn9c102_i2c_write(cam
, 0x26, 0xa0);
208 err
+= sn9c102_i2c_write(cam
, 0x27, 0xca);
209 err
+= sn9c102_i2c_write(cam
, 0x28, 0xa2);
210 err
+= sn9c102_i2c_write(cam
, 0x29, 0x74);
211 err
+= sn9c102_i2c_write(cam
, 0x2a, 0x88);
212 err
+= sn9c102_i2c_write(cam
, 0x2b, 0x34);
213 err
+= sn9c102_i2c_write(cam
, 0x2c, 0x88);
214 err
+= sn9c102_i2c_write(cam
, 0x2e, 0x00);
215 err
+= sn9c102_i2c_write(cam
, 0x2f, 0x00);
216 err
+= sn9c102_i2c_write(cam
, 0x30, 0x00);
217 err
+= sn9c102_i2c_write(cam
, 0x32, 0xc2);
218 err
+= sn9c102_i2c_write(cam
, 0x33, 0x08);
219 err
+= sn9c102_i2c_write(cam
, 0x4c, 0x40);
220 err
+= sn9c102_i2c_write(cam
, 0x4d, 0xf3);
221 err
+= sn9c102_i2c_write(cam
, 0x60, 0x05);
222 err
+= sn9c102_i2c_write(cam
, 0x61, 0x40);
223 err
+= sn9c102_i2c_write(cam
, 0x62, 0x12);
224 err
+= sn9c102_i2c_write(cam
, 0x63, 0x57);
225 err
+= sn9c102_i2c_write(cam
, 0x64, 0x73);
226 err
+= sn9c102_i2c_write(cam
, 0x65, 0x00);
227 err
+= sn9c102_i2c_write(cam
, 0x66, 0x55);
228 err
+= sn9c102_i2c_write(cam
, 0x67, 0x01);
229 err
+= sn9c102_i2c_write(cam
, 0x68, 0xac);
230 err
+= sn9c102_i2c_write(cam
, 0x69, 0x38);
231 err
+= sn9c102_i2c_write(cam
, 0x6f, 0x1f);
232 err
+= sn9c102_i2c_write(cam
, 0x70, 0x01);
233 err
+= sn9c102_i2c_write(cam
, 0x71, 0x00);
234 err
+= sn9c102_i2c_write(cam
, 0x72, 0x10);
235 err
+= sn9c102_i2c_write(cam
, 0x73, 0x50);
236 err
+= sn9c102_i2c_write(cam
, 0x74, 0x20);
237 err
+= sn9c102_i2c_write(cam
, 0x76, 0x01);
238 err
+= sn9c102_i2c_write(cam
, 0x77, 0xf3);
239 err
+= sn9c102_i2c_write(cam
, 0x78, 0x90);
240 err
+= sn9c102_i2c_write(cam
, 0x79, 0x98);
241 err
+= sn9c102_i2c_write(cam
, 0x7a, 0x98);
242 err
+= sn9c102_i2c_write(cam
, 0x7b, 0x00);
243 err
+= sn9c102_i2c_write(cam
, 0x7c, 0x38);
244 err
+= sn9c102_i2c_write(cam
, 0x7d, 0xff);
254 static int ov7630_get_ctrl(struct sn9c102_device
* cam
,
255 struct v4l2_control
* ctrl
)
257 enum sn9c102_bridge bridge
= sn9c102_get_bridge(cam
);
261 case V4L2_CID_EXPOSURE
:
262 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x10)) < 0)
265 case V4L2_CID_RED_BALANCE
:
266 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
267 ctrl
->value
= sn9c102_pread_reg(cam
, 0x05);
269 ctrl
->value
= sn9c102_pread_reg(cam
, 0x07);
271 case V4L2_CID_BLUE_BALANCE
:
272 ctrl
->value
= sn9c102_pread_reg(cam
, 0x06);
274 case SN9C102_V4L2_CID_GREEN_BALANCE
:
275 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
276 ctrl
->value
= sn9c102_pread_reg(cam
, 0x07);
278 ctrl
->value
= sn9c102_pread_reg(cam
, 0x05);
282 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x00)) < 0)
286 case V4L2_CID_DO_WHITE_BALANCE
:
287 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x0c)) < 0)
291 case V4L2_CID_WHITENESS
:
292 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x0d)) < 0)
296 case V4L2_CID_AUTOGAIN
:
297 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x13)) < 0)
302 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x75)) < 0)
304 ctrl
->value
= (ctrl
->value
& 0x80) ? 1 : 0;
306 case SN9C102_V4L2_CID_GAMMA
:
307 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x14)) < 0)
309 ctrl
->value
= (ctrl
->value
& 0x02) ? 1 : 0;
311 case SN9C102_V4L2_CID_BAND_FILTER
:
312 if ((ctrl
->value
= sn9c102_i2c_read(cam
, 0x2d)) < 0)
314 ctrl
->value
= (ctrl
->value
& 0x02) ? 1 : 0;
320 return err
? -EIO
: 0;
324 static int ov7630_set_ctrl(struct sn9c102_device
* cam
,
325 const struct v4l2_control
* ctrl
)
327 enum sn9c102_bridge bridge
= sn9c102_get_bridge(cam
);
331 case V4L2_CID_EXPOSURE
:
332 err
+= sn9c102_i2c_write(cam
, 0x10, ctrl
->value
);
334 case V4L2_CID_RED_BALANCE
:
335 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
336 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x05);
338 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x07);
340 case V4L2_CID_BLUE_BALANCE
:
341 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x06);
343 case SN9C102_V4L2_CID_GREEN_BALANCE
:
344 if (bridge
== BRIDGE_SN9C105
|| bridge
== BRIDGE_SN9C120
)
345 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x07);
347 err
+= sn9c102_write_reg(cam
, ctrl
->value
, 0x05);
350 err
+= sn9c102_i2c_write(cam
, 0x00, ctrl
->value
);
352 case V4L2_CID_DO_WHITE_BALANCE
:
353 err
+= sn9c102_i2c_write(cam
, 0x0c, ctrl
->value
);
355 case V4L2_CID_WHITENESS
:
356 err
+= sn9c102_i2c_write(cam
, 0x0d, ctrl
->value
);
358 case V4L2_CID_AUTOGAIN
:
359 err
+= sn9c102_i2c_write(cam
, 0x13, ctrl
->value
|
363 err
+= sn9c102_i2c_write(cam
, 0x75, 0x0e | (ctrl
->value
<< 7));
365 case SN9C102_V4L2_CID_GAMMA
:
366 err
+= sn9c102_i2c_write(cam
, 0x14, ctrl
->value
<< 2);
368 case SN9C102_V4L2_CID_BAND_FILTER
:
369 err
+= sn9c102_i2c_write(cam
, 0x2d, ctrl
->value
<< 2);
375 return err
? -EIO
: 0;
379 static int ov7630_set_crop(struct sn9c102_device
* cam
,
380 const struct v4l2_rect
* rect
)
382 struct sn9c102_sensor
* s
= sn9c102_get_sensor(cam
);
384 u8 h_start
= 0, v_start
= (u8
)(rect
->top
- s
->cropcap
.bounds
.top
) + 1;
386 switch (sn9c102_get_bridge(cam
)) {
390 h_start
= (u8
)(rect
->left
- s
->cropcap
.bounds
.left
) + 1;
394 h_start
= (u8
)(rect
->left
- s
->cropcap
.bounds
.left
) + 4;
400 err
+= sn9c102_write_reg(cam
, h_start
, 0x12);
401 err
+= sn9c102_write_reg(cam
, v_start
, 0x13);
407 static int ov7630_set_pix_format(struct sn9c102_device
* cam
,
408 const struct v4l2_pix_format
* pix
)
412 switch (sn9c102_get_bridge(cam
)) {
416 if (pix
->pixelformat
== V4L2_PIX_FMT_SBGGR8
)
417 err
+= sn9c102_write_reg(cam
, 0x50, 0x19);
419 err
+= sn9c102_write_reg(cam
, 0x20, 0x19);
423 if (pix
->pixelformat
== V4L2_PIX_FMT_SBGGR8
) {
424 err
+= sn9c102_write_reg(cam
, 0xe5, 0x17);
425 err
+= sn9c102_i2c_write(cam
, 0x11, 0x04);
427 err
+= sn9c102_write_reg(cam
, 0xe2, 0x17);
428 err
+= sn9c102_i2c_write(cam
, 0x11, 0x02);
439 static const struct sn9c102_sensor ov7630
= {
441 .maintainer
= "Luca Risolia <luca.risolia@studio.unibo.it>",
442 .supported_bridge
= BRIDGE_SN9C101
| BRIDGE_SN9C102
| BRIDGE_SN9C103
|
443 BRIDGE_SN9C105
| BRIDGE_SN9C120
,
444 .sysfs_ops
= SN9C102_I2C_READ
| SN9C102_I2C_WRITE
,
445 .frequency
= SN9C102_I2C_100KHZ
,
446 .interface
= SN9C102_I2C_2WIRES
,
447 .i2c_slave_id
= 0x21,
448 .init
= &ov7630_init
,
452 .type
= V4L2_CTRL_TYPE_INTEGER
,
453 .name
= "global gain",
457 .default_value
= 0x14,
461 .id
= V4L2_CID_EXPOSURE
,
462 .type
= V4L2_CTRL_TYPE_INTEGER
,
467 .default_value
= 0x60,
471 .id
= V4L2_CID_WHITENESS
,
472 .type
= V4L2_CTRL_TYPE_INTEGER
,
473 .name
= "white balance background: red",
477 .default_value
= 0x20,
481 .id
= V4L2_CID_DO_WHITE_BALANCE
,
482 .type
= V4L2_CTRL_TYPE_INTEGER
,
483 .name
= "white balance background: blue",
487 .default_value
= 0x20,
491 .id
= V4L2_CID_RED_BALANCE
,
492 .type
= V4L2_CTRL_TYPE_INTEGER
,
493 .name
= "red balance",
497 .default_value
= 0x20,
501 .id
= V4L2_CID_BLUE_BALANCE
,
502 .type
= V4L2_CTRL_TYPE_INTEGER
,
503 .name
= "blue balance",
507 .default_value
= 0x20,
511 .id
= V4L2_CID_AUTOGAIN
,
512 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
513 .name
= "auto adjust",
517 .default_value
= 0x00,
521 .id
= V4L2_CID_VFLIP
,
522 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
523 .name
= "vertical flip",
527 .default_value
= 0x01,
531 .id
= SN9C102_V4L2_CID_GREEN_BALANCE
,
532 .type
= V4L2_CTRL_TYPE_INTEGER
,
533 .name
= "green balance",
537 .default_value
= 0x20,
541 .id
= SN9C102_V4L2_CID_BAND_FILTER
,
542 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
543 .name
= "band filter",
547 .default_value
= 0x00,
551 .id
= SN9C102_V4L2_CID_GAMMA
,
552 .type
= V4L2_CTRL_TYPE_BOOLEAN
,
557 .default_value
= 0x00,
561 .get_ctrl
= &ov7630_get_ctrl
,
562 .set_ctrl
= &ov7630_set_ctrl
,
577 .set_crop
= &ov7630_set_crop
,
581 .pixelformat
= V4L2_PIX_FMT_SN9C10X
,
584 .set_pix_format
= &ov7630_set_pix_format
588 int sn9c102_probe_ov7630(struct sn9c102_device
* cam
)
590 int pid
, ver
, err
= 0;
592 switch (sn9c102_get_bridge(cam
)) {
595 err
= sn9c102_write_const_regs(cam
, {0x01, 0x01}, {0x00, 0x01},
598 case BRIDGE_SN9C103
: /* do _not_ change anything! */
599 err
= sn9c102_write_const_regs(cam
, {0x09, 0x01}, {0x42, 0x01},
600 {0x28, 0x17}, {0x44, 0x02});
601 pid
= sn9c102_i2c_try_read(cam
, &ov7630
, 0x0a);
602 if (err
|| pid
< 0) /* try a different initialization */
603 err
+= sn9c102_write_const_regs(cam
, {0x01, 0x01},
608 err
= sn9c102_write_const_regs(cam
, {0x01, 0xf1}, {0x00, 0xf1},
609 {0x29, 0x01}, {0x74, 0x02},
610 {0x0e, 0x01}, {0x44, 0x01});
616 pid
= sn9c102_i2c_try_read(cam
, &ov7630
, 0x0a);
617 ver
= sn9c102_i2c_try_read(cam
, &ov7630
, 0x0b);
618 if (err
|| pid
< 0 || ver
< 0)
620 if (pid
!= 0x76 || ver
!= 0x31)
622 sn9c102_attach_sensor(cam
, &ov7630
);