2 * Support for GalaxyCore GC2235 2M camera sensor.
4 * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
22 #include <linux/kernel.h>
23 #include <linux/types.h>
24 #include <linux/i2c.h>
25 #include <linux/delay.h>
26 #include <linux/videodev2.h>
27 #include <linux/spinlock.h>
28 #include <media/v4l2-subdev.h>
29 #include <media/v4l2-device.h>
30 #include <media/v4l2-ctrls.h>
31 #include <linux/v4l2-mediabus.h>
32 #include <media/media-entity.h>
34 #include <linux/atomisp_platform.h>
36 #define GC2235_NAME "gc2235"
38 /* Defines for register writes and register array processing */
39 #define I2C_MSG_LENGTH 0x2
40 #define I2C_RETRY_COUNT 5
42 #define GC2235_FOCAL_LENGTH_NUM 278 /*2.78mm*/
43 #define GC2235_FOCAL_LENGTH_DEM 100
44 #define GC2235_F_NUMBER_DEFAULT_NUM 26
45 #define GC2235_F_NUMBER_DEM 10
50 * focal length bits definition:
51 * bits 31-16: numerator, bits 15-0: denominator
53 #define GC2235_FOCAL_LENGTH_DEFAULT 0x1160064
56 * current f-number bits definition:
57 * bits 31-16: numerator, bits 15-0: denominator
59 #define GC2235_F_NUMBER_DEFAULT 0x1a000a
62 * f-number range bits definition:
63 * bits 31-24: max f-number numerator
64 * bits 23-16: max f-number denominator
65 * bits 15-8: min f-number numerator
66 * bits 7-0: min f-number denominator
68 #define GC2235_F_NUMBER_RANGE 0x1a0a1a0a
69 #define GC2235_ID 0x2235
71 #define GC2235_FINE_INTG_TIME_MIN 0
72 #define GC2235_FINE_INTG_TIME_MAX_MARGIN 0
73 #define GC2235_COARSE_INTG_TIME_MIN 1
74 #define GC2235_COARSE_INTG_TIME_MAX_MARGIN 6
77 * GC2235 System control registers
80 * GC2235 System control registers
82 #define GC2235_SENSOR_ID_H 0xF0
83 #define GC2235_SENSOR_ID_L 0xF1
84 #define GC2235_RESET_RELATED 0xFE
85 #define GC2235_SW_RESET 0x8
86 #define GC2235_MIPI_RESET 0x3
87 #define GC2235_RESET_BIT 0x4
88 #define GC2235_REGISTER_PAGE_0 0x0
89 #define GC2235_REGISTER_PAGE_3 0x3
91 #define GC2235_V_CROP_START_H 0x91
92 #define GC2235_V_CROP_START_L 0x92
93 #define GC2235_H_CROP_START_H 0x93
94 #define GC2235_H_CROP_START_L 0x94
95 #define GC2235_V_OUTSIZE_H 0x95
96 #define GC2235_V_OUTSIZE_L 0x96
97 #define GC2235_H_OUTSIZE_H 0x97
98 #define GC2235_H_OUTSIZE_L 0x98
100 #define GC2235_HB_H 0x5
101 #define GC2235_HB_L 0x6
102 #define GC2235_VB_H 0x7
103 #define GC2235_VB_L 0x8
104 #define GC2235_SH_DELAY_H 0x11
105 #define GC2235_SH_DELAY_L 0x12
107 #define GC2235_CSI2_MODE 0x10
109 #define GC2235_EXPOSURE_H 0x3
110 #define GC2235_EXPOSURE_L 0x4
111 #define GC2235_GLOBAL_GAIN 0xB0
112 #define GC2235_PRE_GAIN 0xB1
113 #define GC2235_AWB_R_GAIN 0xB3
114 #define GC2235_AWB_G_GAIN 0xB4
115 #define GC2235_AWB_B_GAIN 0xB5
117 #define GC2235_START_STREAMING 0x91
118 #define GC2235_STOP_STREAMING 0x0
125 struct gc2235_resolution
{
127 const struct gc2235_reg
*regs
;
142 struct gc2235_format
{
145 struct gc2235_reg
*regs
;
149 * gc2235 device structure.
151 struct gc2235_device
{
152 struct v4l2_subdev sd
;
153 struct media_pad pad
;
154 struct v4l2_mbus_framefmt format
;
155 struct mutex input_lock
;
156 struct v4l2_ctrl_handler ctrl_handler
;
158 struct camera_sensor_platform_data
*platform_data
;
159 int vt_pix_clk_freq_mhz
;
166 enum gc2235_tok_type
{
167 GC2235_8BIT
= 0x0001,
168 GC2235_16BIT
= 0x0002,
169 GC2235_32BIT
= 0x0004,
170 GC2235_TOK_TERM
= 0xf000, /* terminating token for reg list */
171 GC2235_TOK_DELAY
= 0xfe00, /* delay token for reg list */
172 GC2235_TOK_MASK
= 0xfff0
176 * struct gc2235_reg - MI sensor register format
177 * @type: type of the register
178 * @reg: 8-bit offset to register
179 * @val: 8/16/32-bit register value
181 * Define a structure for sensor register initialization values
184 enum gc2235_tok_type type
;
186 u32 val
; /* @set value for read/mod/write, @mask */
189 #define to_gc2235_sensor(x) container_of(x, struct gc2235_device, sd)
191 #define GC2235_MAX_WRITE_BUF_SIZE 30
193 struct gc2235_write_buffer
{
195 u8 data
[GC2235_MAX_WRITE_BUF_SIZE
];
198 struct gc2235_write_ctrl
{
200 struct gc2235_write_buffer buffer
;
203 static const struct i2c_device_id gc2235_id
[] = {
208 static struct gc2235_reg
const gc2235_stream_on
[] = {
209 { GC2235_8BIT
, 0xfe, 0x03}, /* switch to P3 */
210 { GC2235_8BIT
, 0x10, 0x91}, /* start mipi */
211 { GC2235_8BIT
, 0xfe, 0x00}, /* switch to P0 */
212 { GC2235_TOK_TERM
, 0, 0 }
215 static struct gc2235_reg
const gc2235_stream_off
[] = {
216 { GC2235_8BIT
, 0xfe, 0x03}, /* switch to P3 */
217 { GC2235_8BIT
, 0x10, 0x01}, /* stop mipi */
218 { GC2235_8BIT
, 0xfe, 0x00}, /* switch to P0 */
219 { GC2235_TOK_TERM
, 0, 0 }
222 static struct gc2235_reg
const gc2235_init_settings
[] = {
224 { GC2235_8BIT
, 0xfe, 0x80 },
225 { GC2235_8BIT
, 0xfe, 0x80 },
226 { GC2235_8BIT
, 0xfe, 0x80 },
227 { GC2235_8BIT
, 0xf2, 0x00 },
228 { GC2235_8BIT
, 0xf6, 0x00 },
229 { GC2235_8BIT
, 0xfc, 0x06 },
230 { GC2235_8BIT
, 0xf7, 0x15 },
231 { GC2235_8BIT
, 0xf8, 0x84 },
232 { GC2235_8BIT
, 0xf9, 0xfe },
233 { GC2235_8BIT
, 0xfa, 0x00 },
234 { GC2235_8BIT
, 0xfe, 0x00 },
235 /* Analog & cisctl */
236 { GC2235_8BIT
, 0x03, 0x04 },
237 { GC2235_8BIT
, 0x04, 0x9E },
238 { GC2235_8BIT
, 0x05, 0x00 },
239 { GC2235_8BIT
, 0x06, 0xfd },
240 { GC2235_8BIT
, 0x07, 0x00 },
241 { GC2235_8BIT
, 0x08, 0x14 },
242 { GC2235_8BIT
, 0x0a, 0x02 }, /* row start */
243 { GC2235_8BIT
, 0x0c, 0x00 }, /* col start */
244 { GC2235_8BIT
, 0x0d, 0x04 }, /* win height 1232 */
245 { GC2235_8BIT
, 0x0e, 0xd0 },
246 { GC2235_8BIT
, 0x0f, 0x06 }, /* win width: 1616 */
247 { GC2235_8BIT
, 0x10, 0x60 },
248 { GC2235_8BIT
, 0x17, 0x15 }, /* mirror flip */
249 { GC2235_8BIT
, 0x18, 0x1a },
250 { GC2235_8BIT
, 0x19, 0x06 },
251 { GC2235_8BIT
, 0x1a, 0x01 },
252 { GC2235_8BIT
, 0x1b, 0x4d },
253 { GC2235_8BIT
, 0x1e, 0x88 },
254 { GC2235_8BIT
, 0x1f, 0x48 },
255 { GC2235_8BIT
, 0x20, 0x03 },
256 { GC2235_8BIT
, 0x21, 0x7f },
257 { GC2235_8BIT
, 0x22, 0x83 },
258 { GC2235_8BIT
, 0x23, 0x42 },
259 { GC2235_8BIT
, 0x24, 0x16 },
260 { GC2235_8BIT
, 0x26, 0x01 }, /*analog gain*/
261 { GC2235_8BIT
, 0x27, 0x30 },
262 { GC2235_8BIT
, 0x3f, 0x00 }, /* PRC */
264 { GC2235_8BIT
, 0x40, 0xa3 },
265 { GC2235_8BIT
, 0x41, 0x82 },
266 { GC2235_8BIT
, 0x43, 0x20 },
267 { GC2235_8BIT
, 0x5e, 0x18 },
268 { GC2235_8BIT
, 0x5f, 0x18 },
269 { GC2235_8BIT
, 0x60, 0x18 },
270 { GC2235_8BIT
, 0x61, 0x18 },
271 { GC2235_8BIT
, 0x62, 0x18 },
272 { GC2235_8BIT
, 0x63, 0x18 },
273 { GC2235_8BIT
, 0x64, 0x18 },
274 { GC2235_8BIT
, 0x65, 0x18 },
275 { GC2235_8BIT
, 0x66, 0x20 },
276 { GC2235_8BIT
, 0x67, 0x20 },
277 { GC2235_8BIT
, 0x68, 0x20 },
278 { GC2235_8BIT
, 0x69, 0x20 },
280 { GC2235_8BIT
, 0xb2, 0x00 },
281 { GC2235_8BIT
, 0xb3, 0x40 },
282 { GC2235_8BIT
, 0xb4, 0x40 },
283 { GC2235_8BIT
, 0xb5, 0x40 },
285 { GC2235_8BIT
, 0xbc, 0x00 },
287 { GC2235_8BIT
, 0xfe, 0x03 },
288 { GC2235_8BIT
, 0x10, 0x01 }, /* disable mipi */
289 { GC2235_8BIT
, 0xfe, 0x00 }, /* switch to P0 */
290 { GC2235_TOK_TERM
, 0, 0 }
293 * Register settings for various resolution
295 static struct gc2235_reg
const gc2235_1296_736_30fps
[] = {
296 { GC2235_8BIT
, 0x8b, 0xa0 },
297 { GC2235_8BIT
, 0x8c, 0x02 },
299 { GC2235_8BIT
, 0x07, 0x01 }, /* VBI */
300 { GC2235_8BIT
, 0x08, 0x44 },
301 { GC2235_8BIT
, 0x09, 0x00 }, /* row start */
302 { GC2235_8BIT
, 0x0a, 0xf0 },
303 { GC2235_8BIT
, 0x0b, 0x00 }, /* col start */
304 { GC2235_8BIT
, 0x0c, 0xa0 },
305 { GC2235_8BIT
, 0x0d, 0x02 }, /* win height 736 */
306 { GC2235_8BIT
, 0x0e, 0xf0 },
307 { GC2235_8BIT
, 0x0f, 0x05 }, /* win width: 1296 */
308 { GC2235_8BIT
, 0x10, 0x20 },
310 { GC2235_8BIT
, 0x90, 0x01 },
311 { GC2235_8BIT
, 0x92, 0x08 },
312 { GC2235_8BIT
, 0x94, 0x08 },
313 { GC2235_8BIT
, 0x95, 0x02 }, /* crop win height 736 */
314 { GC2235_8BIT
, 0x96, 0xe0 },
315 { GC2235_8BIT
, 0x97, 0x05 }, /* crop win width 1296 */
316 { GC2235_8BIT
, 0x98, 0x10 },
318 { GC2235_8BIT
, 0xfe, 0x03 }, /* switch to P3 */
319 { GC2235_8BIT
, 0x01, 0x07 },
320 { GC2235_8BIT
, 0x02, 0x11 },
321 { GC2235_8BIT
, 0x03, 0x11 },
322 { GC2235_8BIT
, 0x06, 0x80 },
323 { GC2235_8BIT
, 0x11, 0x2b },
324 /* set mipi buffer */
325 { GC2235_8BIT
, 0x12, 0x54 }, /* val_low = (width * 10 / 8) & 0xFF */
326 { GC2235_8BIT
, 0x13, 0x06 }, /* val_high = (width * 10 / 8) >> 8 */
328 { GC2235_8BIT
, 0x15, 0x12 }, /* DPHY mode*/
329 { GC2235_8BIT
, 0x04, 0x10 },
330 { GC2235_8BIT
, 0x05, 0x00 },
331 { GC2235_8BIT
, 0x17, 0x01 },
333 { GC2235_8BIT
, 0x22, 0x01 },
334 { GC2235_8BIT
, 0x23, 0x05 },
335 { GC2235_8BIT
, 0x24, 0x10 },
336 { GC2235_8BIT
, 0x25, 0x10 },
337 { GC2235_8BIT
, 0x26, 0x02 },
338 { GC2235_8BIT
, 0x21, 0x10 },
339 { GC2235_8BIT
, 0x29, 0x01 },
340 { GC2235_8BIT
, 0x2a, 0x02 },
341 { GC2235_8BIT
, 0x2b, 0x02 },
343 { GC2235_8BIT
, 0x10, 0x01 }, /* disable mipi */
344 { GC2235_8BIT
, 0xfe, 0x00 }, /* switch to P0 */
345 { GC2235_TOK_TERM
, 0, 0 }
348 static struct gc2235_reg
const gc2235_960_640_30fps
[] = {
349 { GC2235_8BIT
, 0x8b, 0xa0 },
350 { GC2235_8BIT
, 0x8c, 0x02 },
352 { GC2235_8BIT
, 0x07, 0x02 }, /* VBI */
353 { GC2235_8BIT
, 0x08, 0xA4 },
354 { GC2235_8BIT
, 0x09, 0x01 }, /* row start */
355 { GC2235_8BIT
, 0x0a, 0x18 },
356 { GC2235_8BIT
, 0x0b, 0x01 }, /* col start */
357 { GC2235_8BIT
, 0x0c, 0x40 },
358 { GC2235_8BIT
, 0x0d, 0x02 }, /* win height 656 */
359 { GC2235_8BIT
, 0x0e, 0x90 },
360 { GC2235_8BIT
, 0x0f, 0x03 }, /* win width: 976 */
361 { GC2235_8BIT
, 0x10, 0xd0 },
363 { GC2235_8BIT
, 0x90, 0x01 },
364 { GC2235_8BIT
, 0x92, 0x02 },
365 { GC2235_8BIT
, 0x94, 0x06 },
366 { GC2235_8BIT
, 0x95, 0x02 }, /* crop win height 640 */
367 { GC2235_8BIT
, 0x96, 0x80 },
368 { GC2235_8BIT
, 0x97, 0x03 }, /* crop win width 960 */
369 { GC2235_8BIT
, 0x98, 0xc0 },
371 { GC2235_8BIT
, 0xfe, 0x03 }, /* switch to P3 */
372 { GC2235_8BIT
, 0x01, 0x07 },
373 { GC2235_8BIT
, 0x02, 0x11 },
374 { GC2235_8BIT
, 0x03, 0x11 },
375 { GC2235_8BIT
, 0x06, 0x80 },
376 { GC2235_8BIT
, 0x11, 0x2b },
377 /* set mipi buffer */
378 { GC2235_8BIT
, 0x12, 0xb0 }, /* val_low = (width * 10 / 8) & 0xFF */
379 { GC2235_8BIT
, 0x13, 0x04 }, /* val_high = (width * 10 / 8) >> 8 */
381 { GC2235_8BIT
, 0x15, 0x12 }, /* DPHY mode*/
382 { GC2235_8BIT
, 0x04, 0x10 },
383 { GC2235_8BIT
, 0x05, 0x00 },
384 { GC2235_8BIT
, 0x17, 0x01 },
385 { GC2235_8BIT
, 0x22, 0x01 },
386 { GC2235_8BIT
, 0x23, 0x05 },
387 { GC2235_8BIT
, 0x24, 0x10 },
388 { GC2235_8BIT
, 0x25, 0x10 },
389 { GC2235_8BIT
, 0x26, 0x02 },
390 { GC2235_8BIT
, 0x21, 0x10 },
391 { GC2235_8BIT
, 0x29, 0x01 },
392 { GC2235_8BIT
, 0x2a, 0x02 },
393 { GC2235_8BIT
, 0x2b, 0x02 },
394 { GC2235_8BIT
, 0x10, 0x01 }, /* disable mipi */
395 { GC2235_8BIT
, 0xfe, 0x00 }, /* switch to P0 */
396 { GC2235_TOK_TERM
, 0, 0 }
399 static struct gc2235_reg
const gc2235_1600_900_30fps
[] = {
400 { GC2235_8BIT
, 0x8b, 0xa0 },
401 { GC2235_8BIT
, 0x8c, 0x02 },
403 { GC2235_8BIT
, 0x0d, 0x03 }, /* win height 932 */
404 { GC2235_8BIT
, 0x0e, 0xa4 },
405 { GC2235_8BIT
, 0x0f, 0x06 }, /* win width: 1632 */
406 { GC2235_8BIT
, 0x10, 0x50 },
408 { GC2235_8BIT
, 0x90, 0x01 },
409 { GC2235_8BIT
, 0x92, 0x02 },
410 { GC2235_8BIT
, 0x94, 0x06 },
411 { GC2235_8BIT
, 0x95, 0x03 }, /* crop win height 900 */
412 { GC2235_8BIT
, 0x96, 0x84 },
413 { GC2235_8BIT
, 0x97, 0x06 }, /* crop win width 1600 */
414 { GC2235_8BIT
, 0x98, 0x40 },
416 { GC2235_8BIT
, 0xfe, 0x03 }, /* switch to P3 */
417 { GC2235_8BIT
, 0x01, 0x07 },
418 { GC2235_8BIT
, 0x02, 0x11 },
419 { GC2235_8BIT
, 0x03, 0x11 },
420 { GC2235_8BIT
, 0x06, 0x80 },
421 { GC2235_8BIT
, 0x11, 0x2b },
422 /* set mipi buffer */
423 { GC2235_8BIT
, 0x12, 0xd0 }, /* val_low = (width * 10 / 8) & 0xFF */
424 { GC2235_8BIT
, 0x13, 0x07 }, /* val_high = (width * 10 / 8) >> 8 */
426 { GC2235_8BIT
, 0x15, 0x12 }, /* DPHY mode*/
427 { GC2235_8BIT
, 0x04, 0x10 },
428 { GC2235_8BIT
, 0x05, 0x00 },
429 { GC2235_8BIT
, 0x17, 0x01 },
430 { GC2235_8BIT
, 0x22, 0x01 },
431 { GC2235_8BIT
, 0x23, 0x05 },
432 { GC2235_8BIT
, 0x24, 0x10 },
433 { GC2235_8BIT
, 0x25, 0x10 },
434 { GC2235_8BIT
, 0x26, 0x02 },
435 { GC2235_8BIT
, 0x21, 0x10 },
436 { GC2235_8BIT
, 0x29, 0x01 },
437 { GC2235_8BIT
, 0x2a, 0x02 },
438 { GC2235_8BIT
, 0x2b, 0x02 },
439 { GC2235_8BIT
, 0x10, 0x01 }, /* disable mipi */
440 { GC2235_8BIT
, 0xfe, 0x00 }, /* switch to P0 */
441 { GC2235_TOK_TERM
, 0, 0 }
444 static struct gc2235_reg
const gc2235_1616_1082_30fps
[] = {
445 { GC2235_8BIT
, 0x8b, 0xa0 },
446 { GC2235_8BIT
, 0x8c, 0x02 },
448 { GC2235_8BIT
, 0x0d, 0x04 }, /* win height 1232 */
449 { GC2235_8BIT
, 0x0e, 0xd0 },
450 { GC2235_8BIT
, 0x0f, 0x06 }, /* win width: 1616 */
451 { GC2235_8BIT
, 0x10, 0x50 },
453 { GC2235_8BIT
, 0x90, 0x01 },
454 { GC2235_8BIT
, 0x92, 0x4a },
455 { GC2235_8BIT
, 0x94, 0x00 },
456 { GC2235_8BIT
, 0x95, 0x04 }, /* crop win height 1082 */
457 { GC2235_8BIT
, 0x96, 0x3a },
458 { GC2235_8BIT
, 0x97, 0x06 }, /* crop win width 1616 */
459 { GC2235_8BIT
, 0x98, 0x50 },
461 { GC2235_8BIT
, 0xfe, 0x03 }, /* switch to P3 */
462 { GC2235_8BIT
, 0x01, 0x07 },
463 { GC2235_8BIT
, 0x02, 0x11 },
464 { GC2235_8BIT
, 0x03, 0x11 },
465 { GC2235_8BIT
, 0x06, 0x80 },
466 { GC2235_8BIT
, 0x11, 0x2b },
467 /* set mipi buffer */
468 { GC2235_8BIT
, 0x12, 0xe4 }, /* val_low = (width * 10 / 8) & 0xFF */
469 { GC2235_8BIT
, 0x13, 0x07 }, /* val_high = (width * 10 / 8) >> 8 */
471 { GC2235_8BIT
, 0x15, 0x12 }, /* DPHY mode*/
472 { GC2235_8BIT
, 0x04, 0x10 },
473 { GC2235_8BIT
, 0x05, 0x00 },
474 { GC2235_8BIT
, 0x17, 0x01 },
475 { GC2235_8BIT
, 0x22, 0x01 },
476 { GC2235_8BIT
, 0x23, 0x05 },
477 { GC2235_8BIT
, 0x24, 0x10 },
478 { GC2235_8BIT
, 0x25, 0x10 },
479 { GC2235_8BIT
, 0x26, 0x02 },
480 { GC2235_8BIT
, 0x21, 0x10 },
481 { GC2235_8BIT
, 0x29, 0x01 },
482 { GC2235_8BIT
, 0x2a, 0x02 },
483 { GC2235_8BIT
, 0x2b, 0x02 },
484 { GC2235_8BIT
, 0x10, 0x01 }, /* disable mipi */
485 { GC2235_8BIT
, 0xfe, 0x00 }, /* switch to P0 */
486 { GC2235_TOK_TERM
, 0, 0 }
489 static struct gc2235_reg
const gc2235_1616_1216_30fps
[] = {
490 { GC2235_8BIT
, 0x8b, 0xa0 },
491 { GC2235_8BIT
, 0x8c, 0x02 },
493 { GC2235_8BIT
, 0x0d, 0x04 }, /* win height 1232 */
494 { GC2235_8BIT
, 0x0e, 0xd0 },
495 { GC2235_8BIT
, 0x0f, 0x06 }, /* win width: 1616 */
496 { GC2235_8BIT
, 0x10, 0x50 },
498 { GC2235_8BIT
, 0x90, 0x01 },
499 { GC2235_8BIT
, 0x92, 0x02 },
500 { GC2235_8BIT
, 0x94, 0x00 },
501 { GC2235_8BIT
, 0x95, 0x04 }, /* crop win height 1216 */
502 { GC2235_8BIT
, 0x96, 0xc0 },
503 { GC2235_8BIT
, 0x97, 0x06 }, /* crop win width 1616 */
504 { GC2235_8BIT
, 0x98, 0x50 },
506 { GC2235_8BIT
, 0xfe, 0x03 }, /* switch to P3 */
507 { GC2235_8BIT
, 0x01, 0x07 },
508 { GC2235_8BIT
, 0x02, 0x11 },
509 { GC2235_8BIT
, 0x03, 0x11 },
510 { GC2235_8BIT
, 0x06, 0x80 },
511 { GC2235_8BIT
, 0x11, 0x2b },
512 /* set mipi buffer */
513 { GC2235_8BIT
, 0x12, 0xe4 }, /* val_low = (width * 10 / 8) & 0xFF */
514 { GC2235_8BIT
, 0x13, 0x07 }, /* val_high = (width * 10 / 8) >> 8 */
515 { GC2235_8BIT
, 0x15, 0x12 }, /* DPHY mode*/
516 { GC2235_8BIT
, 0x04, 0x10 },
517 { GC2235_8BIT
, 0x05, 0x00 },
518 { GC2235_8BIT
, 0x17, 0x01 },
519 { GC2235_8BIT
, 0x22, 0x01 },
520 { GC2235_8BIT
, 0x23, 0x05 },
521 { GC2235_8BIT
, 0x24, 0x10 },
522 { GC2235_8BIT
, 0x25, 0x10 },
523 { GC2235_8BIT
, 0x26, 0x02 },
524 { GC2235_8BIT
, 0x21, 0x10 },
525 { GC2235_8BIT
, 0x29, 0x01 },
526 { GC2235_8BIT
, 0x2a, 0x02 },
527 { GC2235_8BIT
, 0x2b, 0x02 },
528 { GC2235_8BIT
, 0x10, 0x01 }, /* disable mipi */
529 { GC2235_8BIT
, 0xfe, 0x00 }, /* switch to P0 */
530 { GC2235_TOK_TERM
, 0, 0 }
533 struct gc2235_resolution gc2235_res_preview
[] = {
536 .desc
= "gc2235_1600_900_30fps",
542 .pixels_per_line
= 2132,
543 .lines_per_frame
= 1068,
548 .regs
= gc2235_1600_900_30fps
,
552 .desc
= "gc2235_1600_1066_30fps",
558 .pixels_per_line
= 2132,
559 .lines_per_frame
= 1368,
564 .regs
= gc2235_1616_1082_30fps
,
567 .desc
= "gc2235_1600_1200_30fps",
573 .pixels_per_line
= 2132,
574 .lines_per_frame
= 1368,
579 .regs
= gc2235_1616_1216_30fps
,
583 #define N_RES_PREVIEW (ARRAY_SIZE(gc2235_res_preview))
585 struct gc2235_resolution gc2235_res_still
[] = {
587 .desc
= "gc2235_1600_900_30fps",
593 .pixels_per_line
= 2132,
594 .lines_per_frame
= 1068,
599 .regs
= gc2235_1600_900_30fps
,
602 .desc
= "gc2235_1600_1066_30fps",
608 .pixels_per_line
= 2132,
609 .lines_per_frame
= 1368,
614 .regs
= gc2235_1616_1082_30fps
,
617 .desc
= "gc2235_1600_1200_30fps",
623 .pixels_per_line
= 2132,
624 .lines_per_frame
= 1368,
629 .regs
= gc2235_1616_1216_30fps
,
633 #define N_RES_STILL (ARRAY_SIZE(gc2235_res_still))
635 struct gc2235_resolution gc2235_res_video
[] = {
637 .desc
= "gc2235_1296_736_30fps",
643 .pixels_per_line
= 1828,
644 .lines_per_frame
= 888,
649 .regs
= gc2235_1296_736_30fps
,
652 .desc
= "gc2235_960_640_30fps",
658 .pixels_per_line
= 1492,
659 .lines_per_frame
= 792,
664 .regs
= gc2235_960_640_30fps
,
668 #define N_RES_VIDEO (ARRAY_SIZE(gc2235_res_video))
670 static struct gc2235_resolution
*gc2235_res
= gc2235_res_preview
;
671 static int N_RES
= N_RES_PREVIEW
;