1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for OmniVision OV2680 5M camera sensor. 4 * 5 * Copyright (c) 2013 Intel Corporation. All Rights Reserved. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License version 9 * 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * 17 */ 18 19 #ifndef __OV2680_H__ 20 #define __OV2680_H__ 21 #include <linux/kernel.h> 22 #include <linux/types.h> 23 #include <linux/i2c.h> 24 #include <linux/delay.h> 25 #include <linux/videodev2.h> 26 #include <linux/spinlock.h> 27 #include <media/v4l2-subdev.h> 28 #include <media/v4l2-device.h> 29 #include <media/v4l2-ctrls.h> 30 #include <linux/v4l2-mediabus.h> 31 #include <media/media-entity.h> 32 33 #include "../include/linux/atomisp_platform.h" 34 35 /* Defines for register writes and register array processing */ 36 #define I2C_MSG_LENGTH 0x2 37 #define I2C_RETRY_COUNT 5 38 39 #define OV2680_FOCAL_LENGTH_NUM 334 /*3.34mm*/ 40 #define OV2680_FOCAL_LENGTH_DEM 100 41 #define OV2680_F_NUMBER_DEFAULT_NUM 24 42 #define OV2680_F_NUMBER_DEM 10 43 44 #define OV2680_BIN_FACTOR_MAX 4 45 46 #define MAX_FMTS 1 47 48 /* sensor_mode_data read_mode adaptation */ 49 #define OV2680_READ_MODE_BINNING_ON 0x0400 50 #define OV2680_READ_MODE_BINNING_OFF 0x00 51 #define OV2680_INTEGRATION_TIME_MARGIN 8 52 53 #define OV2680_MAX_EXPOSURE_VALUE 0xFFF1 54 #define OV2680_MAX_GAIN_VALUE 0xFF 55 56 /* 57 * focal length bits definition: 58 * bits 31-16: numerator, bits 15-0: denominator 59 */ 60 #define OV2680_FOCAL_LENGTH_DEFAULT 0x1B70064 61 62 /* 63 * current f-number bits definition: 64 * bits 31-16: numerator, bits 15-0: denominator 65 */ 66 #define OV2680_F_NUMBER_DEFAULT 0x18000a 67 68 /* 69 * f-number range bits definition: 70 * bits 31-24: max f-number numerator 71 * bits 23-16: max f-number denominator 72 * bits 15-8: min f-number numerator 73 * bits 7-0: min f-number denominator 74 */ 75 #define OV2680_F_NUMBER_RANGE 0x180a180a 76 #define OV2680_ID 0x2680 77 78 #define OV2680_FINE_INTG_TIME_MIN 0 79 #define OV2680_FINE_INTG_TIME_MAX_MARGIN 0 80 #define OV2680_COARSE_INTG_TIME_MIN 1 81 #define OV2680_COARSE_INTG_TIME_MAX_MARGIN 6 82 83 /* 84 * OV2680 System control registers 85 */ 86 #define OV2680_SW_SLEEP 0x0100 87 #define OV2680_SW_RESET 0x0103 88 #define OV2680_SW_STREAM 0x0100 89 90 #define OV2680_SC_CMMN_CHIP_ID_H 0x300A 91 #define OV2680_SC_CMMN_CHIP_ID_L 0x300B 92 #define OV2680_SC_CMMN_SCCB_ID 0x302B /* 0x300C*/ 93 #define OV2680_SC_CMMN_SUB_ID 0x302A /* process, version*/ 94 95 #define OV2680_GROUP_ACCESS 0x3208 /*Bit[7:4] Group control, Bit[3:0] Group ID*/ 96 97 #define OV2680_EXPOSURE_H 0x3500 /*Bit[3:0] Bit[19:16] of exposure, remaining 16 bits lies in Reg0x3501&Reg0x3502*/ 98 #define OV2680_EXPOSURE_M 0x3501 99 #define OV2680_EXPOSURE_L 0x3502 100 #define OV2680_AGC_H 0x350A /*Bit[1:0] means Bit[9:8] of gain*/ 101 #define OV2680_AGC_L 0x350B /*Bit[7:0] of gain*/ 102 103 #define OV2680_HORIZONTAL_START_H 0x3800 /*Bit[11:8]*/ 104 #define OV2680_HORIZONTAL_START_L 0x3801 /*Bit[7:0]*/ 105 #define OV2680_VERTICAL_START_H 0x3802 /*Bit[11:8]*/ 106 #define OV2680_VERTICAL_START_L 0x3803 /*Bit[7:0]*/ 107 #define OV2680_HORIZONTAL_END_H 0x3804 /*Bit[11:8]*/ 108 #define OV2680_HORIZONTAL_END_L 0x3805 /*Bit[7:0]*/ 109 #define OV2680_VERTICAL_END_H 0x3806 /*Bit[11:8]*/ 110 #define OV2680_VERTICAL_END_L 0x3807 /*Bit[7:0]*/ 111 #define OV2680_HORIZONTAL_OUTPUT_SIZE_H 0x3808 /*Bit[3:0]*/ 112 #define OV2680_HORIZONTAL_OUTPUT_SIZE_L 0x3809 /*Bit[7:0]*/ 113 #define OV2680_VERTICAL_OUTPUT_SIZE_H 0x380a /*Bit[3:0]*/ 114 #define OV2680_VERTICAL_OUTPUT_SIZE_L 0x380b /*Bit[7:0]*/ 115 #define OV2680_TIMING_HTS_H 0x380C /*High 8-bit, and low 8-bit HTS address is 0x380d*/ 116 #define OV2680_TIMING_HTS_L 0x380D /*High 8-bit, and low 8-bit HTS address is 0x380d*/ 117 #define OV2680_TIMING_VTS_H 0x380e /*High 8-bit, and low 8-bit HTS address is 0x380f*/ 118 #define OV2680_TIMING_VTS_L 0x380f /*High 8-bit, and low 8-bit HTS address is 0x380f*/ 119 #define OV2680_FRAME_OFF_NUM 0x4202 120 121 /*Flip/Mirror*/ 122 #define OV2680_FLIP_REG 0x3820 123 #define OV2680_MIRROR_REG 0x3821 124 #define OV2680_FLIP_BIT 1 125 #define OV2680_MIRROR_BIT 2 126 #define OV2680_FLIP_MIRROR_BIT_ENABLE 4 127 128 #define OV2680_MWB_RED_GAIN_H 0x5004/*0x3400*/ 129 #define OV2680_MWB_GREEN_GAIN_H 0x5006/*0x3402*/ 130 #define OV2680_MWB_BLUE_GAIN_H 0x5008/*0x3404*/ 131 #define OV2680_MWB_GAIN_MAX 0x0fff 132 133 #define OV2680_START_STREAMING 0x01 134 #define OV2680_STOP_STREAMING 0x00 135 136 #define OV2680_INVALID_CONFIG 0xffffffff 137 138 struct regval_list { 139 u16 reg_num; 140 u8 value; 141 }; 142 143 struct ov2680_resolution { 144 u8 *desc; 145 const struct ov2680_reg *regs; 146 int res; 147 int width; 148 int height; 149 int fps; 150 int pix_clk_freq; 151 u32 skip_frames; 152 u16 pixels_per_line; 153 u16 lines_per_frame; 154 u8 bin_factor_x; 155 u8 bin_factor_y; 156 u8 bin_mode; 157 bool used; 158 }; 159 160 struct ov2680_format { 161 u8 *desc; 162 u32 pixelformat; 163 struct ov2680_reg *regs; 164 }; 165 166 /* 167 * ov2680 device structure. 168 */ 169 struct ov2680_device { 170 struct v4l2_subdev sd; 171 struct media_pad pad; 172 struct v4l2_mbus_framefmt format; 173 struct mutex input_lock; 174 struct v4l2_ctrl_handler ctrl_handler; 175 struct camera_sensor_platform_data *platform_data; 176 int vt_pix_clk_freq_mhz; 177 int fmt_idx; 178 int run_mode; 179 u8 res; 180 u8 type; 181 }; 182 183 /** 184 * struct ov2680_reg - MI sensor register format 185 * @type: type of the register 186 * @reg: 16-bit offset to register 187 * @val: 8/16/32-bit register value 188 * 189 * Define a structure for sensor register initialization values 190 */ 191 struct ov2680_reg { 192 u16 reg; 193 u32 val; /* @set value for read/mod/write, @mask */ 194 }; 195 196 #define to_ov2680_sensor(x) container_of(x, struct ov2680_device, sd) 197 198 #define OV2680_MAX_WRITE_BUF_SIZE 30 199 200 struct ov2680_write_buffer { 201 u16 addr; 202 u8 data[OV2680_MAX_WRITE_BUF_SIZE]; 203 }; 204 205 struct ov2680_write_ctrl { 206 int index; 207 struct ov2680_write_buffer buffer; 208 }; 209 210 static struct ov2680_reg const ov2680_global_setting[] = { 211 {0x0103, 0x01}, 212 {0x3002, 0x00}, 213 {0x3016, 0x1c}, 214 {0x3018, 0x44}, 215 {0x3020, 0x00}, 216 {0x3080, 0x02}, 217 {0x3082, 0x45}, 218 {0x3084, 0x09}, 219 {0x3085, 0x04}, 220 {0x3503, 0x03}, 221 {0x350b, 0x36}, 222 {0x3600, 0xb4}, 223 {0x3603, 0x39}, 224 {0x3604, 0x24}, 225 {0x3605, 0x00}, 226 {0x3620, 0x26}, 227 {0x3621, 0x37}, 228 {0x3622, 0x04}, 229 {0x3628, 0x00}, 230 {0x3705, 0x3c}, 231 {0x370c, 0x50}, 232 {0x370d, 0xc0}, 233 {0x3718, 0x88}, 234 {0x3720, 0x00}, 235 {0x3721, 0x00}, 236 {0x3722, 0x00}, 237 {0x3723, 0x00}, 238 {0x3738, 0x00}, 239 {0x3717, 0x58}, 240 {0x3781, 0x80}, 241 {0x3789, 0x60}, 242 {0x3800, 0x00}, 243 {0x3819, 0x04}, 244 {0x4000, 0x81}, 245 {0x4001, 0x40}, 246 {0x4602, 0x02}, 247 {0x481f, 0x36}, 248 {0x4825, 0x36}, 249 {0x4837, 0x18}, 250 {0x5002, 0x30}, 251 {0x5004, 0x04},//manual awb 1x 252 {0x5005, 0x00}, 253 {0x5006, 0x04}, 254 {0x5007, 0x00}, 255 {0x5008, 0x04}, 256 {0x5009, 0x00}, 257 {0x5080, 0x00}, 258 {0x3701, 0x64}, //add on 14/05/13 259 {0x3784, 0x0c}, //based OV2680_R1A_AM10.ovt add on 14/06/13 260 {0x5780, 0x3e}, //based OV2680_R1A_AM10.ovt,Adjust DPC setting (57xx) on 14/06/13 261 {0x5781, 0x0f}, 262 {0x5782, 0x04}, 263 {0x5783, 0x02}, 264 {0x5784, 0x01}, 265 {0x5785, 0x01}, 266 {0x5786, 0x00}, 267 {0x5787, 0x04}, 268 {0x5788, 0x02}, 269 {0x5789, 0x00}, 270 {0x578a, 0x01}, 271 {0x578b, 0x02}, 272 {0x578c, 0x03}, 273 {0x578d, 0x03}, 274 {0x578e, 0x08}, 275 {0x578f, 0x0c}, 276 {0x5790, 0x08}, 277 {0x5791, 0x04}, 278 {0x5792, 0x00}, 279 {0x5793, 0x00}, 280 {0x5794, 0x03}, //based OV2680_R1A_AM10.ovt,Adjust DPC setting (57xx) on 14/06/13 281 {0x0100, 0x00}, //stream off 282 283 {} 284 }; 285 286 #if 0 /* None of the definitions below are used currently */ 287 /* 288 * 176x144 30fps VBlanking 1lane 10Bit (binning) 289 */ 290 static struct ov2680_reg const ov2680_QCIF_30fps[] = { 291 {0x3086, 0x01}, 292 {0x370a, 0x23}, 293 {0x3801, 0xa0}, 294 {0x3802, 0x00}, 295 {0x3803, 0x78}, 296 {0x3804, 0x05}, 297 {0x3805, 0xaf}, 298 {0x3806, 0x04}, 299 {0x3807, 0x47}, 300 {0x3808, 0x00}, 301 {0x3809, 0xC0}, 302 {0x380a, 0x00}, 303 {0x380b, 0xa0}, 304 {0x380c, 0x06}, 305 {0x380d, 0xb0}, 306 {0x380e, 0x02}, 307 {0x380f, 0x84}, 308 {0x3810, 0x00}, 309 {0x3811, 0x04}, 310 {0x3812, 0x00}, 311 {0x3813, 0x04}, 312 {0x3814, 0x31}, 313 {0x3815, 0x31}, 314 {0x4000, 0x81}, 315 {0x4001, 0x40}, 316 {0x4008, 0x00}, 317 {0x4009, 0x03}, 318 {0x5081, 0x41}, 319 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 320 {0x5704, 0x10}, 321 {0x5705, 0xa0}, 322 {0x5706, 0x0c}, 323 {0x5707, 0x78}, 324 {0x3820, 0xc2}, 325 {0x3821, 0x01}, 326 // {0x5090, 0x0c}, 327 {} 328 }; 329 330 /* 331 * 352x288 30fps VBlanking 1lane 10Bit (binning) 332 */ 333 static struct ov2680_reg const ov2680_CIF_30fps[] = { 334 {0x3086, 0x01}, 335 {0x370a, 0x23}, 336 {0x3801, 0xa0}, 337 {0x3802, 0x00}, 338 {0x3803, 0x78}, 339 {0x3804, 0x03}, 340 {0x3805, 0x8f}, 341 {0x3806, 0x02}, 342 {0x3807, 0xe7}, 343 {0x3808, 0x01}, 344 {0x3809, 0x70}, 345 {0x380a, 0x01}, 346 {0x380b, 0x30}, 347 {0x380c, 0x06}, 348 {0x380d, 0xb0}, 349 {0x380e, 0x02}, 350 {0x380f, 0x84}, 351 {0x3810, 0x00}, 352 {0x3811, 0x04}, 353 {0x3812, 0x00}, 354 {0x3813, 0x04}, 355 {0x3814, 0x31}, 356 {0x3815, 0x31}, 357 {0x4008, 0x00}, 358 {0x4009, 0x03}, 359 {0x5081, 0x41}, 360 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 361 {0x5704, 0x10}, 362 {0x5705, 0xa0}, 363 {0x5706, 0x0c}, 364 {0x5707, 0x78}, 365 {0x3820, 0xc2}, 366 {0x3821, 0x01}, 367 // {0x5090, 0x0c}, 368 {} 369 }; 370 371 /* 372 * 336x256 30fps VBlanking 1lane 10Bit (binning) 373 */ 374 static struct ov2680_reg const ov2680_QVGA_30fps[] = { 375 {0x3086, 0x01}, 376 {0x370a, 0x23}, 377 {0x3801, 0xa0}, 378 {0x3802, 0x00}, 379 {0x3803, 0x78}, 380 {0x3804, 0x03}, 381 {0x3805, 0x4f}, 382 {0x3806, 0x02}, 383 {0x3807, 0x87}, 384 {0x3808, 0x01}, 385 {0x3809, 0x50}, 386 {0x380a, 0x01}, 387 {0x380b, 0x00}, 388 {0x380c, 0x06}, 389 {0x380d, 0xb0}, 390 {0x380e, 0x02}, 391 {0x380f, 0x84}, 392 {0x3810, 0x00}, 393 {0x3811, 0x04}, 394 {0x3812, 0x00}, 395 {0x3813, 0x04}, 396 {0x3814, 0x31}, 397 {0x3815, 0x31}, 398 {0x4008, 0x00}, 399 {0x4009, 0x03}, 400 {0x5081, 0x41}, 401 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 402 {0x5704, 0x10}, 403 {0x5705, 0xa0}, 404 {0x5706, 0x0c}, 405 {0x5707, 0x78}, 406 {0x3820, 0xc2}, 407 {0x3821, 0x01}, 408 // {0x5090, 0x0c}, 409 {} 410 }; 411 412 /* 413 * 656x496 30fps VBlanking 1lane 10Bit (binning) 414 */ 415 static struct ov2680_reg const ov2680_656x496_30fps[] = { 416 {0x3086, 0x01}, 417 {0x370a, 0x23}, 418 {0x3801, 0xa0}, 419 {0x3802, 0x00}, 420 {0x3803, 0x78}, 421 {0x3804, 0x05}, 422 {0x3805, 0xcf}, 423 {0x3806, 0x04}, 424 {0x3807, 0x67}, 425 {0x3808, 0x02}, 426 {0x3809, 0x90}, 427 {0x380a, 0x01}, 428 {0x380b, 0xf0}, 429 {0x380c, 0x06}, 430 {0x380d, 0xb0}, 431 {0x380e, 0x02}, 432 {0x380f, 0x84}, 433 {0x3810, 0x00}, 434 {0x3811, 0x04}, 435 {0x3812, 0x00}, 436 {0x3813, 0x04}, 437 {0x3814, 0x31}, 438 {0x3815, 0x31}, 439 {0x4008, 0x00}, 440 {0x4009, 0x03}, 441 {0x5081, 0x41}, 442 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 443 {0x5704, 0x10}, 444 {0x5705, 0xa0}, 445 {0x5706, 0x0c}, 446 {0x5707, 0x78}, 447 {0x3820, 0xc2}, 448 {0x3821, 0x01}, 449 // {0x5090, 0x0c}, 450 {} 451 }; 452 453 /* 454 * 800x600 30fps VBlanking 1lane 10Bit (binning) 455 */ 456 static struct ov2680_reg const ov2680_720x592_30fps[] = { 457 {0x3086, 0x01}, 458 {0x370a, 0x23}, 459 {0x3801, 0x00}, // X_ADDR_START; 460 {0x3802, 0x00}, 461 {0x3803, 0x00}, // Y_ADDR_START; 462 {0x3804, 0x05}, 463 {0x3805, 0xaf}, // X_ADDR_END; 464 {0x3806, 0x04}, 465 {0x3807, 0xaf}, // Y_ADDR_END; 466 {0x3808, 0x02}, 467 {0x3809, 0xd0}, // X_OUTPUT_SIZE; 468 {0x380a, 0x02}, 469 {0x380b, 0x50}, // Y_OUTPUT_SIZE; 470 {0x380c, 0x06}, 471 {0x380d, 0xac}, // HTS; 472 {0x380e, 0x02}, 473 {0x380f, 0x84}, // VTS; 474 {0x3810, 0x00}, 475 {0x3811, 0x00}, 476 {0x3812, 0x00}, 477 {0x3813, 0x00}, 478 {0x3814, 0x31}, 479 {0x3815, 0x31}, 480 {0x4008, 0x00}, 481 {0x4009, 0x03}, 482 {0x5708, 0x00}, 483 {0x5704, 0x02}, 484 {0x5705, 0xd0}, // X_WIN; 485 {0x5706, 0x02}, 486 {0x5707, 0x50}, // Y_WIN; 487 {0x3820, 0xc2}, // FLIP_FORMAT; 488 {0x3821, 0x01}, // MIRROR_FORMAT; 489 {0x5090, 0x00}, // PRE ISP CTRL16, default value is 0x0C; 490 // BIT[3]: Mirror order, BG or GB; 491 // BIT[2]: Flip order, BR or RB; 492 {0x5081, 0x41}, 493 {} 494 }; 495 496 /* 497 * 800x600 30fps VBlanking 1lane 10Bit (binning) 498 */ 499 static struct ov2680_reg const ov2680_800x600_30fps[] = { 500 {0x3086, 0x01}, 501 {0x370a, 0x23}, 502 {0x3801, 0x00}, 503 {0x3802, 0x00}, 504 {0x3803, 0x00}, 505 {0x3804, 0x06}, 506 {0x3805, 0x4f}, 507 {0x3806, 0x04}, 508 {0x3807, 0xbf}, 509 {0x3808, 0x03}, 510 {0x3809, 0x20}, 511 {0x380a, 0x02}, 512 {0x380b, 0x58}, 513 {0x380c, 0x06}, 514 {0x380d, 0xac}, 515 {0x380e, 0x02}, 516 {0x380f, 0x84}, 517 {0x3810, 0x00}, 518 {0x3811, 0x00}, 519 {0x3812, 0x00}, 520 {0x3813, 0x00}, 521 {0x3814, 0x31}, 522 {0x3815, 0x31}, 523 {0x5708, 0x00}, 524 {0x5704, 0x03}, 525 {0x5705, 0x20}, 526 {0x5706, 0x02}, 527 {0x5707, 0x58}, 528 {0x3820, 0xc2}, 529 {0x3821, 0x01}, 530 {0x5090, 0x00}, 531 {0x4008, 0x00}, 532 {0x4009, 0x03}, 533 {0x5081, 0x41}, 534 {} 535 }; 536 537 /* 538 * 720p=1280*720 30fps VBlanking 1lane 10Bit (no-Scaling) 539 */ 540 static struct ov2680_reg const ov2680_720p_30fps[] = { 541 {0x3086, 0x00}, 542 {0x370a, 0x21}, 543 {0x3801, 0xa0}, 544 {0x3802, 0x00}, 545 {0x3803, 0xf2}, 546 {0x3804, 0x05}, 547 {0x3805, 0xbf}, 548 {0x3806, 0x03}, 549 {0x3807, 0xdd}, 550 {0x3808, 0x05}, 551 {0x3809, 0x10}, 552 {0x380a, 0x02}, 553 {0x380b, 0xe0}, 554 {0x380c, 0x06}, 555 {0x380d, 0xa8}, 556 {0x380e, 0x05}, 557 {0x380f, 0x0e}, 558 {0x3810, 0x00}, 559 {0x3811, 0x08}, 560 {0x3812, 0x00}, 561 {0x3813, 0x06}, 562 {0x3814, 0x11}, 563 {0x3815, 0x11}, 564 {0x4008, 0x02}, 565 {0x4009, 0x09}, 566 {0x5081, 0x41}, 567 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 568 {0x5704, 0x10}, 569 {0x5705, 0xa0}, 570 {0x5706, 0x0c}, 571 {0x5707, 0x78}, 572 {0x3820, 0xc0}, 573 {0x3821, 0x00}, 574 // {0x5090, 0x0c}, 575 {} 576 }; 577 578 /* 579 * 1296x976 30fps VBlanking 1lane 10Bit(no-scaling) 580 */ 581 static struct ov2680_reg const ov2680_1296x976_30fps[] = { 582 {0x3086, 0x00}, 583 {0x370a, 0x21}, 584 {0x3801, 0xa0}, 585 {0x3802, 0x00}, 586 {0x3803, 0x78}, 587 {0x3804, 0x05}, 588 {0x3805, 0xbf}, 589 {0x3806, 0x04}, 590 {0x3807, 0x57}, 591 {0x3808, 0x05}, 592 {0x3809, 0x10}, 593 {0x380a, 0x03}, 594 {0x380b, 0xd0}, 595 {0x380c, 0x06}, 596 {0x380d, 0xa8}, 597 {0x380e, 0x05}, 598 {0x380f, 0x0e}, 599 {0x3810, 0x00}, 600 {0x3811, 0x08}, 601 {0x3812, 0x00}, 602 {0x3813, 0x08}, 603 {0x3814, 0x11}, 604 {0x3815, 0x11}, 605 {0x4008, 0x02}, 606 {0x4009, 0x09}, 607 {0x5081, 0x41}, 608 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 609 {0x5704, 0x10}, 610 {0x5705, 0xa0}, 611 {0x5706, 0x0c}, 612 {0x5707, 0x78}, 613 {0x3820, 0xc0}, 614 {0x3821, 0x00}, //mirror/flip 615 // {0x5090, 0x0c}, 616 {} 617 }; 618 619 /* 620 * 1456*1096 30fps VBlanking 1lane 10bit(no-scaling) 621 */ 622 static struct ov2680_reg const ov2680_1456x1096_30fps[] = { 623 {0x3086, 0x00}, 624 {0x370a, 0x21}, 625 {0x3801, 0x90}, 626 {0x3802, 0x00}, 627 {0x3803, 0x78}, 628 {0x3804, 0x06}, 629 {0x3805, 0x4f}, 630 {0x3806, 0x04}, 631 {0x3807, 0xC0}, 632 {0x3808, 0x05}, 633 {0x3809, 0xb0}, 634 {0x380a, 0x04}, 635 {0x380b, 0x48}, 636 {0x380c, 0x06}, 637 {0x380d, 0xa8}, 638 {0x380e, 0x05}, 639 {0x380f, 0x0e}, 640 {0x3810, 0x00}, 641 {0x3811, 0x08}, 642 {0x3812, 0x00}, 643 {0x3813, 0x00}, 644 {0x3814, 0x11}, 645 {0x3815, 0x11}, 646 {0x4008, 0x02}, 647 {0x4009, 0x09}, 648 {0x5081, 0x41}, 649 {0x5708, 0x00}, //add for full size flip off and mirror off 2014/09/11 650 {0x5704, 0x10}, 651 {0x5705, 0xa0}, 652 {0x5706, 0x0c}, 653 {0x5707, 0x78}, 654 {0x3820, 0xc0}, 655 {0x3821, 0x00}, 656 // {0x5090, 0x0c}, 657 {} 658 }; 659 #endif 660 661 /* 662 *1616x916 30fps VBlanking 1lane 10bit 663 */ 664 665 static struct ov2680_reg const ov2680_1616x916_30fps[] = { 666 {0x3086, 0x00}, 667 {0x370a, 0x21}, 668 {0x3801, 0x00}, 669 {0x3802, 0x00}, 670 {0x3803, 0x96}, 671 {0x3804, 0x06}, 672 {0x3805, 0x4f}, 673 {0x3806, 0x04}, 674 {0x3807, 0x39}, 675 {0x3808, 0x06}, 676 {0x3809, 0x50}, 677 {0x380a, 0x03}, 678 {0x380b, 0x94}, 679 {0x380c, 0x06}, 680 {0x380d, 0xa8}, 681 {0x380e, 0x05}, 682 {0x380f, 0x0e}, 683 {0x3810, 0x00}, 684 {0x3811, 0x00}, 685 {0x3812, 0x00}, 686 {0x3813, 0x08}, 687 {0x3814, 0x11}, 688 {0x3815, 0x11}, 689 {0x4008, 0x02}, 690 {0x4009, 0x09}, 691 {0x5081, 0x41}, 692 {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11 693 {0x5704, 0x06}, 694 {0x5705, 0x50}, 695 {0x5706, 0x03}, 696 {0x5707, 0x94}, 697 {0x3820, 0xc0}, 698 {0x3821, 0x00}, 699 // {0x5090, 0x0C}, 700 {} 701 }; 702 703 /* 704 * 1612x1212 30fps VBlanking 1lane 10Bit 705 */ 706 #if 0 707 static struct ov2680_reg const ov2680_1616x1082_30fps[] = { 708 {0x3086, 0x00}, 709 {0x370a, 0x21}, 710 {0x3801, 0x00}, 711 {0x3802, 0x00}, 712 {0x3803, 0x86}, 713 {0x3804, 0x06}, 714 {0x3805, 0x4f}, 715 {0x3806, 0x04}, 716 {0x3807, 0xbf}, 717 {0x3808, 0x06}, 718 {0x3809, 0x50}, 719 {0x380a, 0x04}, 720 {0x380b, 0x3a}, 721 {0x380c, 0x06}, 722 {0x380d, 0xa8}, 723 {0x380e, 0x05}, 724 {0x380f, 0x0e}, 725 {0x3810, 0x00}, 726 {0x3811, 0x00}, 727 {0x3812, 0x00}, 728 {0x3813, 0x00}, 729 {0x3814, 0x11}, 730 {0x3815, 0x11}, 731 {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11 732 {0x5704, 0x06}, 733 {0x5705, 0x50}, 734 {0x5706, 0x04}, 735 {0x5707, 0x3a}, 736 {0x3820, 0xc0}, 737 {0x3821, 0x00}, 738 // {0x5090, 0x0C}, 739 {0x4008, 0x02}, 740 {0x4009, 0x09}, 741 {0x5081, 0x41}, 742 {} 743 }; 744 #endif 745 /* 746 * 1616x1216 30fps VBlanking 1lane 10Bit 747 */ 748 static struct ov2680_reg const ov2680_1616x1216_30fps[] = { 749 {0x3086, 0x00}, 750 {0x370a, 0x21}, 751 {0x3801, 0x00}, 752 {0x3802, 0x00}, 753 {0x3803, 0x00}, 754 {0x3804, 0x06}, 755 {0x3805, 0x4f}, 756 {0x3806, 0x04}, 757 {0x3807, 0xbf}, 758 {0x3808, 0x06}, 759 {0x3809, 0x50},//50},//4line for mirror and flip 760 {0x380a, 0x04}, 761 {0x380b, 0xc0},//c0}, 762 {0x380c, 0x06}, 763 {0x380d, 0xa8}, 764 {0x380e, 0x05}, 765 {0x380f, 0x0e}, 766 {0x3810, 0x00}, 767 {0x3811, 0x00}, 768 {0x3812, 0x00}, 769 {0x3813, 0x00}, 770 {0x3814, 0x11}, 771 {0x3815, 0x11}, 772 {0x4008, 0x00}, 773 {0x4009, 0x0b}, 774 {0x5081, 0x01}, 775 {0x5708, 0x01}, //add for full size flip off and mirror off 2014/09/11 776 {0x5704, 0x06}, 777 {0x5705, 0x50}, 778 {0x5706, 0x04}, 779 {0x5707, 0xcc}, 780 {0x3820, 0xc0}, 781 {0x3821, 0x00}, 782 // {0x5090, 0x0C}, 783 {} 784 }; 785 786 static struct ov2680_resolution ov2680_res_preview[] = { 787 { 788 .desc = "ov2680_1616x1216_30fps", 789 .width = 1616, 790 .height = 1216, 791 .pix_clk_freq = 66, 792 .fps = 30, 793 .used = 0, 794 .pixels_per_line = 1698,//1704, 795 .lines_per_frame = 1294, 796 .bin_factor_x = 0, 797 .bin_factor_y = 0, 798 .bin_mode = 0, 799 .skip_frames = 3, 800 .regs = ov2680_1616x1216_30fps, 801 }, 802 { 803 .desc = "ov2680_1616x916_30fps", 804 .width = 1616, 805 .height = 916, 806 .fps = 30, 807 .pix_clk_freq = 66, 808 .used = 0, 809 .pixels_per_line = 1698,//1704, 810 .lines_per_frame = 1294, 811 .bin_factor_x = 0, 812 .bin_factor_y = 0, 813 .bin_mode = 0, 814 .skip_frames = 3, 815 .regs = ov2680_1616x916_30fps, 816 }, 817 }; 818 819 #define N_RES_PREVIEW (ARRAY_SIZE(ov2680_res_preview)) 820 821 static struct ov2680_resolution *ov2680_res = ov2680_res_preview; 822 static unsigned long N_RES = N_RES_PREVIEW; 823 824 #endif 825