18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci// Copyright (c) 2017 Intel Corporation. 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include <linux/acpi.h> 58c2ecf20Sopenharmony_ci#include <linux/i2c.h> 68c2ecf20Sopenharmony_ci#include <linux/module.h> 78c2ecf20Sopenharmony_ci#include <linux/pm_runtime.h> 88c2ecf20Sopenharmony_ci#include <media/v4l2-ctrls.h> 98c2ecf20Sopenharmony_ci#include <media/v4l2-device.h> 108c2ecf20Sopenharmony_ci#include <media/v4l2-fwnode.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define OV5670_REG_CHIP_ID 0x300a 138c2ecf20Sopenharmony_ci#define OV5670_CHIP_ID 0x005670 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define OV5670_REG_MODE_SELECT 0x0100 168c2ecf20Sopenharmony_ci#define OV5670_MODE_STANDBY 0x00 178c2ecf20Sopenharmony_ci#define OV5670_MODE_STREAMING 0x01 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define OV5670_REG_SOFTWARE_RST 0x0103 208c2ecf20Sopenharmony_ci#define OV5670_SOFTWARE_RST 0x01 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* vertical-timings from sensor */ 238c2ecf20Sopenharmony_ci#define OV5670_REG_VTS 0x380e 248c2ecf20Sopenharmony_ci#define OV5670_VTS_30FPS 0x0808 /* default for 30 fps */ 258c2ecf20Sopenharmony_ci#define OV5670_VTS_MAX 0xffff 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* horizontal-timings from sensor */ 288c2ecf20Sopenharmony_ci#define OV5670_REG_HTS 0x380c 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* 318c2ecf20Sopenharmony_ci * Pixels-per-line(PPL) = Time-per-line * pixel-rate 328c2ecf20Sopenharmony_ci * In OV5670, Time-per-line = HTS/SCLK. 338c2ecf20Sopenharmony_ci * HTS is fixed for all resolutions, not recommended to change. 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci#define OV5670_FIXED_PPL 2724 /* Pixels per line */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* Exposure controls from sensor */ 388c2ecf20Sopenharmony_ci#define OV5670_REG_EXPOSURE 0x3500 398c2ecf20Sopenharmony_ci#define OV5670_EXPOSURE_MIN 4 408c2ecf20Sopenharmony_ci#define OV5670_EXPOSURE_STEP 1 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* Analog gain controls from sensor */ 438c2ecf20Sopenharmony_ci#define OV5670_REG_ANALOG_GAIN 0x3508 448c2ecf20Sopenharmony_ci#define ANALOG_GAIN_MIN 0 458c2ecf20Sopenharmony_ci#define ANALOG_GAIN_MAX 8191 468c2ecf20Sopenharmony_ci#define ANALOG_GAIN_STEP 1 478c2ecf20Sopenharmony_ci#define ANALOG_GAIN_DEFAULT 128 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* Digital gain controls from sensor */ 508c2ecf20Sopenharmony_ci#define OV5670_REG_R_DGTL_GAIN 0x5032 518c2ecf20Sopenharmony_ci#define OV5670_REG_G_DGTL_GAIN 0x5034 528c2ecf20Sopenharmony_ci#define OV5670_REG_B_DGTL_GAIN 0x5036 538c2ecf20Sopenharmony_ci#define OV5670_DGTL_GAIN_MIN 0 548c2ecf20Sopenharmony_ci#define OV5670_DGTL_GAIN_MAX 4095 558c2ecf20Sopenharmony_ci#define OV5670_DGTL_GAIN_STEP 1 568c2ecf20Sopenharmony_ci#define OV5670_DGTL_GAIN_DEFAULT 1024 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* Test Pattern Control */ 598c2ecf20Sopenharmony_ci#define OV5670_REG_TEST_PATTERN 0x4303 608c2ecf20Sopenharmony_ci#define OV5670_TEST_PATTERN_ENABLE BIT(3) 618c2ecf20Sopenharmony_ci#define OV5670_REG_TEST_PATTERN_CTRL 0x4320 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#define OV5670_REG_VALUE_08BIT 1 648c2ecf20Sopenharmony_ci#define OV5670_REG_VALUE_16BIT 2 658c2ecf20Sopenharmony_ci#define OV5670_REG_VALUE_24BIT 3 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Initial number of frames to skip to avoid possible garbage */ 688c2ecf20Sopenharmony_ci#define OV5670_NUM_OF_SKIP_FRAMES 2 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistruct ov5670_reg { 718c2ecf20Sopenharmony_ci u16 address; 728c2ecf20Sopenharmony_ci u8 val; 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct ov5670_reg_list { 768c2ecf20Sopenharmony_ci u32 num_of_regs; 778c2ecf20Sopenharmony_ci const struct ov5670_reg *regs; 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cistruct ov5670_link_freq_config { 818c2ecf20Sopenharmony_ci u32 pixel_rate; 828c2ecf20Sopenharmony_ci const struct ov5670_reg_list reg_list; 838c2ecf20Sopenharmony_ci}; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_cistruct ov5670_mode { 868c2ecf20Sopenharmony_ci /* Frame width in pixels */ 878c2ecf20Sopenharmony_ci u32 width; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci /* Frame height in pixels */ 908c2ecf20Sopenharmony_ci u32 height; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci /* Default vertical timining size */ 938c2ecf20Sopenharmony_ci u32 vts_def; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci /* Min vertical timining size */ 968c2ecf20Sopenharmony_ci u32 vts_min; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci /* Link frequency needed for this resolution */ 998c2ecf20Sopenharmony_ci u32 link_freq_index; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci /* Sensor register settings for this resolution */ 1028c2ecf20Sopenharmony_ci const struct ov5670_reg_list reg_list; 1038c2ecf20Sopenharmony_ci}; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_cistatic const struct ov5670_reg mipi_data_rate_840mbps[] = { 1068c2ecf20Sopenharmony_ci {0x0300, 0x04}, 1078c2ecf20Sopenharmony_ci {0x0301, 0x00}, 1088c2ecf20Sopenharmony_ci {0x0302, 0x84}, 1098c2ecf20Sopenharmony_ci {0x0303, 0x00}, 1108c2ecf20Sopenharmony_ci {0x0304, 0x03}, 1118c2ecf20Sopenharmony_ci {0x0305, 0x01}, 1128c2ecf20Sopenharmony_ci {0x0306, 0x01}, 1138c2ecf20Sopenharmony_ci {0x030a, 0x00}, 1148c2ecf20Sopenharmony_ci {0x030b, 0x00}, 1158c2ecf20Sopenharmony_ci {0x030c, 0x00}, 1168c2ecf20Sopenharmony_ci {0x030d, 0x26}, 1178c2ecf20Sopenharmony_ci {0x030e, 0x00}, 1188c2ecf20Sopenharmony_ci {0x030f, 0x06}, 1198c2ecf20Sopenharmony_ci {0x0312, 0x01}, 1208c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 1218c2ecf20Sopenharmony_ci}; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_cistatic const struct ov5670_reg mode_2592x1944_regs[] = { 1248c2ecf20Sopenharmony_ci {0x3000, 0x00}, 1258c2ecf20Sopenharmony_ci {0x3002, 0x21}, 1268c2ecf20Sopenharmony_ci {0x3005, 0xf0}, 1278c2ecf20Sopenharmony_ci {0x3007, 0x00}, 1288c2ecf20Sopenharmony_ci {0x3015, 0x0f}, 1298c2ecf20Sopenharmony_ci {0x3018, 0x32}, 1308c2ecf20Sopenharmony_ci {0x301a, 0xf0}, 1318c2ecf20Sopenharmony_ci {0x301b, 0xf0}, 1328c2ecf20Sopenharmony_ci {0x301c, 0xf0}, 1338c2ecf20Sopenharmony_ci {0x301d, 0xf0}, 1348c2ecf20Sopenharmony_ci {0x301e, 0xf0}, 1358c2ecf20Sopenharmony_ci {0x3030, 0x00}, 1368c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 1378c2ecf20Sopenharmony_ci {0x303c, 0xff}, 1388c2ecf20Sopenharmony_ci {0x303e, 0xff}, 1398c2ecf20Sopenharmony_ci {0x3040, 0xf0}, 1408c2ecf20Sopenharmony_ci {0x3041, 0x00}, 1418c2ecf20Sopenharmony_ci {0x3042, 0xf0}, 1428c2ecf20Sopenharmony_ci {0x3106, 0x11}, 1438c2ecf20Sopenharmony_ci {0x3500, 0x00}, 1448c2ecf20Sopenharmony_ci {0x3501, 0x80}, 1458c2ecf20Sopenharmony_ci {0x3502, 0x00}, 1468c2ecf20Sopenharmony_ci {0x3503, 0x04}, 1478c2ecf20Sopenharmony_ci {0x3504, 0x03}, 1488c2ecf20Sopenharmony_ci {0x3505, 0x83}, 1498c2ecf20Sopenharmony_ci {0x3508, 0x04}, 1508c2ecf20Sopenharmony_ci {0x3509, 0x00}, 1518c2ecf20Sopenharmony_ci {0x350e, 0x04}, 1528c2ecf20Sopenharmony_ci {0x350f, 0x00}, 1538c2ecf20Sopenharmony_ci {0x3510, 0x00}, 1548c2ecf20Sopenharmony_ci {0x3511, 0x02}, 1558c2ecf20Sopenharmony_ci {0x3512, 0x00}, 1568c2ecf20Sopenharmony_ci {0x3601, 0xc8}, 1578c2ecf20Sopenharmony_ci {0x3610, 0x88}, 1588c2ecf20Sopenharmony_ci {0x3612, 0x48}, 1598c2ecf20Sopenharmony_ci {0x3614, 0x5b}, 1608c2ecf20Sopenharmony_ci {0x3615, 0x96}, 1618c2ecf20Sopenharmony_ci {0x3621, 0xd0}, 1628c2ecf20Sopenharmony_ci {0x3622, 0x00}, 1638c2ecf20Sopenharmony_ci {0x3623, 0x00}, 1648c2ecf20Sopenharmony_ci {0x3633, 0x13}, 1658c2ecf20Sopenharmony_ci {0x3634, 0x13}, 1668c2ecf20Sopenharmony_ci {0x3635, 0x13}, 1678c2ecf20Sopenharmony_ci {0x3636, 0x13}, 1688c2ecf20Sopenharmony_ci {0x3645, 0x13}, 1698c2ecf20Sopenharmony_ci {0x3646, 0x82}, 1708c2ecf20Sopenharmony_ci {0x3650, 0x00}, 1718c2ecf20Sopenharmony_ci {0x3652, 0xff}, 1728c2ecf20Sopenharmony_ci {0x3655, 0x20}, 1738c2ecf20Sopenharmony_ci {0x3656, 0xff}, 1748c2ecf20Sopenharmony_ci {0x365a, 0xff}, 1758c2ecf20Sopenharmony_ci {0x365e, 0xff}, 1768c2ecf20Sopenharmony_ci {0x3668, 0x00}, 1778c2ecf20Sopenharmony_ci {0x366a, 0x07}, 1788c2ecf20Sopenharmony_ci {0x366e, 0x10}, 1798c2ecf20Sopenharmony_ci {0x366d, 0x00}, 1808c2ecf20Sopenharmony_ci {0x366f, 0x80}, 1818c2ecf20Sopenharmony_ci {0x3700, 0x28}, 1828c2ecf20Sopenharmony_ci {0x3701, 0x10}, 1838c2ecf20Sopenharmony_ci {0x3702, 0x3a}, 1848c2ecf20Sopenharmony_ci {0x3703, 0x19}, 1858c2ecf20Sopenharmony_ci {0x3704, 0x10}, 1868c2ecf20Sopenharmony_ci {0x3705, 0x00}, 1878c2ecf20Sopenharmony_ci {0x3706, 0x66}, 1888c2ecf20Sopenharmony_ci {0x3707, 0x08}, 1898c2ecf20Sopenharmony_ci {0x3708, 0x34}, 1908c2ecf20Sopenharmony_ci {0x3709, 0x40}, 1918c2ecf20Sopenharmony_ci {0x370a, 0x01}, 1928c2ecf20Sopenharmony_ci {0x370b, 0x1b}, 1938c2ecf20Sopenharmony_ci {0x3714, 0x24}, 1948c2ecf20Sopenharmony_ci {0x371a, 0x3e}, 1958c2ecf20Sopenharmony_ci {0x3733, 0x00}, 1968c2ecf20Sopenharmony_ci {0x3734, 0x00}, 1978c2ecf20Sopenharmony_ci {0x373a, 0x05}, 1988c2ecf20Sopenharmony_ci {0x373b, 0x06}, 1998c2ecf20Sopenharmony_ci {0x373c, 0x0a}, 2008c2ecf20Sopenharmony_ci {0x373f, 0xa0}, 2018c2ecf20Sopenharmony_ci {0x3755, 0x00}, 2028c2ecf20Sopenharmony_ci {0x3758, 0x00}, 2038c2ecf20Sopenharmony_ci {0x375b, 0x0e}, 2048c2ecf20Sopenharmony_ci {0x3766, 0x5f}, 2058c2ecf20Sopenharmony_ci {0x3768, 0x00}, 2068c2ecf20Sopenharmony_ci {0x3769, 0x22}, 2078c2ecf20Sopenharmony_ci {0x3773, 0x08}, 2088c2ecf20Sopenharmony_ci {0x3774, 0x1f}, 2098c2ecf20Sopenharmony_ci {0x3776, 0x06}, 2108c2ecf20Sopenharmony_ci {0x37a0, 0x88}, 2118c2ecf20Sopenharmony_ci {0x37a1, 0x5c}, 2128c2ecf20Sopenharmony_ci {0x37a7, 0x88}, 2138c2ecf20Sopenharmony_ci {0x37a8, 0x70}, 2148c2ecf20Sopenharmony_ci {0x37aa, 0x88}, 2158c2ecf20Sopenharmony_ci {0x37ab, 0x48}, 2168c2ecf20Sopenharmony_ci {0x37b3, 0x66}, 2178c2ecf20Sopenharmony_ci {0x37c2, 0x04}, 2188c2ecf20Sopenharmony_ci {0x37c5, 0x00}, 2198c2ecf20Sopenharmony_ci {0x37c8, 0x00}, 2208c2ecf20Sopenharmony_ci {0x3800, 0x00}, 2218c2ecf20Sopenharmony_ci {0x3801, 0x0c}, 2228c2ecf20Sopenharmony_ci {0x3802, 0x00}, 2238c2ecf20Sopenharmony_ci {0x3803, 0x04}, 2248c2ecf20Sopenharmony_ci {0x3804, 0x0a}, 2258c2ecf20Sopenharmony_ci {0x3805, 0x33}, 2268c2ecf20Sopenharmony_ci {0x3806, 0x07}, 2278c2ecf20Sopenharmony_ci {0x3807, 0xa3}, 2288c2ecf20Sopenharmony_ci {0x3808, 0x0a}, 2298c2ecf20Sopenharmony_ci {0x3809, 0x20}, 2308c2ecf20Sopenharmony_ci {0x380a, 0x07}, 2318c2ecf20Sopenharmony_ci {0x380b, 0x98}, 2328c2ecf20Sopenharmony_ci {0x380c, 0x06}, 2338c2ecf20Sopenharmony_ci {0x380d, 0x90}, 2348c2ecf20Sopenharmony_ci {0x380e, 0x08}, 2358c2ecf20Sopenharmony_ci {0x380f, 0x08}, 2368c2ecf20Sopenharmony_ci {0x3811, 0x04}, 2378c2ecf20Sopenharmony_ci {0x3813, 0x02}, 2388c2ecf20Sopenharmony_ci {0x3814, 0x01}, 2398c2ecf20Sopenharmony_ci {0x3815, 0x01}, 2408c2ecf20Sopenharmony_ci {0x3816, 0x00}, 2418c2ecf20Sopenharmony_ci {0x3817, 0x00}, 2428c2ecf20Sopenharmony_ci {0x3818, 0x00}, 2438c2ecf20Sopenharmony_ci {0x3819, 0x00}, 2448c2ecf20Sopenharmony_ci {0x3820, 0x84}, 2458c2ecf20Sopenharmony_ci {0x3821, 0x46}, 2468c2ecf20Sopenharmony_ci {0x3822, 0x48}, 2478c2ecf20Sopenharmony_ci {0x3826, 0x00}, 2488c2ecf20Sopenharmony_ci {0x3827, 0x08}, 2498c2ecf20Sopenharmony_ci {0x382a, 0x01}, 2508c2ecf20Sopenharmony_ci {0x382b, 0x01}, 2518c2ecf20Sopenharmony_ci {0x3830, 0x08}, 2528c2ecf20Sopenharmony_ci {0x3836, 0x02}, 2538c2ecf20Sopenharmony_ci {0x3837, 0x00}, 2548c2ecf20Sopenharmony_ci {0x3838, 0x10}, 2558c2ecf20Sopenharmony_ci {0x3841, 0xff}, 2568c2ecf20Sopenharmony_ci {0x3846, 0x48}, 2578c2ecf20Sopenharmony_ci {0x3861, 0x00}, 2588c2ecf20Sopenharmony_ci {0x3862, 0x04}, 2598c2ecf20Sopenharmony_ci {0x3863, 0x06}, 2608c2ecf20Sopenharmony_ci {0x3a11, 0x01}, 2618c2ecf20Sopenharmony_ci {0x3a12, 0x78}, 2628c2ecf20Sopenharmony_ci {0x3b00, 0x00}, 2638c2ecf20Sopenharmony_ci {0x3b02, 0x00}, 2648c2ecf20Sopenharmony_ci {0x3b03, 0x00}, 2658c2ecf20Sopenharmony_ci {0x3b04, 0x00}, 2668c2ecf20Sopenharmony_ci {0x3b05, 0x00}, 2678c2ecf20Sopenharmony_ci {0x3c00, 0x89}, 2688c2ecf20Sopenharmony_ci {0x3c01, 0xab}, 2698c2ecf20Sopenharmony_ci {0x3c02, 0x01}, 2708c2ecf20Sopenharmony_ci {0x3c03, 0x00}, 2718c2ecf20Sopenharmony_ci {0x3c04, 0x00}, 2728c2ecf20Sopenharmony_ci {0x3c05, 0x03}, 2738c2ecf20Sopenharmony_ci {0x3c06, 0x00}, 2748c2ecf20Sopenharmony_ci {0x3c07, 0x05}, 2758c2ecf20Sopenharmony_ci {0x3c0c, 0x00}, 2768c2ecf20Sopenharmony_ci {0x3c0d, 0x00}, 2778c2ecf20Sopenharmony_ci {0x3c0e, 0x00}, 2788c2ecf20Sopenharmony_ci {0x3c0f, 0x00}, 2798c2ecf20Sopenharmony_ci {0x3c40, 0x00}, 2808c2ecf20Sopenharmony_ci {0x3c41, 0xa3}, 2818c2ecf20Sopenharmony_ci {0x3c43, 0x7d}, 2828c2ecf20Sopenharmony_ci {0x3c45, 0xd7}, 2838c2ecf20Sopenharmony_ci {0x3c47, 0xfc}, 2848c2ecf20Sopenharmony_ci {0x3c50, 0x05}, 2858c2ecf20Sopenharmony_ci {0x3c52, 0xaa}, 2868c2ecf20Sopenharmony_ci {0x3c54, 0x71}, 2878c2ecf20Sopenharmony_ci {0x3c56, 0x80}, 2888c2ecf20Sopenharmony_ci {0x3d85, 0x17}, 2898c2ecf20Sopenharmony_ci {0x3f03, 0x00}, 2908c2ecf20Sopenharmony_ci {0x3f0a, 0x00}, 2918c2ecf20Sopenharmony_ci {0x3f0b, 0x00}, 2928c2ecf20Sopenharmony_ci {0x4001, 0x60}, 2938c2ecf20Sopenharmony_ci {0x4009, 0x0d}, 2948c2ecf20Sopenharmony_ci {0x4020, 0x00}, 2958c2ecf20Sopenharmony_ci {0x4021, 0x00}, 2968c2ecf20Sopenharmony_ci {0x4022, 0x00}, 2978c2ecf20Sopenharmony_ci {0x4023, 0x00}, 2988c2ecf20Sopenharmony_ci {0x4024, 0x00}, 2998c2ecf20Sopenharmony_ci {0x4025, 0x00}, 3008c2ecf20Sopenharmony_ci {0x4026, 0x00}, 3018c2ecf20Sopenharmony_ci {0x4027, 0x00}, 3028c2ecf20Sopenharmony_ci {0x4028, 0x00}, 3038c2ecf20Sopenharmony_ci {0x4029, 0x00}, 3048c2ecf20Sopenharmony_ci {0x402a, 0x00}, 3058c2ecf20Sopenharmony_ci {0x402b, 0x00}, 3068c2ecf20Sopenharmony_ci {0x402c, 0x00}, 3078c2ecf20Sopenharmony_ci {0x402d, 0x00}, 3088c2ecf20Sopenharmony_ci {0x402e, 0x00}, 3098c2ecf20Sopenharmony_ci {0x402f, 0x00}, 3108c2ecf20Sopenharmony_ci {0x4040, 0x00}, 3118c2ecf20Sopenharmony_ci {0x4041, 0x03}, 3128c2ecf20Sopenharmony_ci {0x4042, 0x00}, 3138c2ecf20Sopenharmony_ci {0x4043, 0x7A}, 3148c2ecf20Sopenharmony_ci {0x4044, 0x00}, 3158c2ecf20Sopenharmony_ci {0x4045, 0x7A}, 3168c2ecf20Sopenharmony_ci {0x4046, 0x00}, 3178c2ecf20Sopenharmony_ci {0x4047, 0x7A}, 3188c2ecf20Sopenharmony_ci {0x4048, 0x00}, 3198c2ecf20Sopenharmony_ci {0x4049, 0x7A}, 3208c2ecf20Sopenharmony_ci {0x4307, 0x30}, 3218c2ecf20Sopenharmony_ci {0x4500, 0x58}, 3228c2ecf20Sopenharmony_ci {0x4501, 0x04}, 3238c2ecf20Sopenharmony_ci {0x4502, 0x40}, 3248c2ecf20Sopenharmony_ci {0x4503, 0x10}, 3258c2ecf20Sopenharmony_ci {0x4508, 0xaa}, 3268c2ecf20Sopenharmony_ci {0x4509, 0xaa}, 3278c2ecf20Sopenharmony_ci {0x450a, 0x00}, 3288c2ecf20Sopenharmony_ci {0x450b, 0x00}, 3298c2ecf20Sopenharmony_ci {0x4600, 0x01}, 3308c2ecf20Sopenharmony_ci {0x4601, 0x03}, 3318c2ecf20Sopenharmony_ci {0x4700, 0xa4}, 3328c2ecf20Sopenharmony_ci {0x4800, 0x4c}, 3338c2ecf20Sopenharmony_ci {0x4816, 0x53}, 3348c2ecf20Sopenharmony_ci {0x481f, 0x40}, 3358c2ecf20Sopenharmony_ci {0x4837, 0x13}, 3368c2ecf20Sopenharmony_ci {0x5000, 0x56}, 3378c2ecf20Sopenharmony_ci {0x5001, 0x01}, 3388c2ecf20Sopenharmony_ci {0x5002, 0x28}, 3398c2ecf20Sopenharmony_ci {0x5004, 0x0c}, 3408c2ecf20Sopenharmony_ci {0x5006, 0x0c}, 3418c2ecf20Sopenharmony_ci {0x5007, 0xe0}, 3428c2ecf20Sopenharmony_ci {0x5008, 0x01}, 3438c2ecf20Sopenharmony_ci {0x5009, 0xb0}, 3448c2ecf20Sopenharmony_ci {0x5901, 0x00}, 3458c2ecf20Sopenharmony_ci {0x5a01, 0x00}, 3468c2ecf20Sopenharmony_ci {0x5a03, 0x00}, 3478c2ecf20Sopenharmony_ci {0x5a04, 0x0c}, 3488c2ecf20Sopenharmony_ci {0x5a05, 0xe0}, 3498c2ecf20Sopenharmony_ci {0x5a06, 0x09}, 3508c2ecf20Sopenharmony_ci {0x5a07, 0xb0}, 3518c2ecf20Sopenharmony_ci {0x5a08, 0x06}, 3528c2ecf20Sopenharmony_ci {0x5e00, 0x00}, 3538c2ecf20Sopenharmony_ci {0x3734, 0x40}, 3548c2ecf20Sopenharmony_ci {0x5b00, 0x01}, 3558c2ecf20Sopenharmony_ci {0x5b01, 0x10}, 3568c2ecf20Sopenharmony_ci {0x5b02, 0x01}, 3578c2ecf20Sopenharmony_ci {0x5b03, 0xdb}, 3588c2ecf20Sopenharmony_ci {0x3d8c, 0x71}, 3598c2ecf20Sopenharmony_ci {0x3d8d, 0xea}, 3608c2ecf20Sopenharmony_ci {0x4017, 0x08}, 3618c2ecf20Sopenharmony_ci {0x3618, 0x2a}, 3628c2ecf20Sopenharmony_ci {0x5780, 0x3e}, 3638c2ecf20Sopenharmony_ci {0x5781, 0x0f}, 3648c2ecf20Sopenharmony_ci {0x5782, 0x44}, 3658c2ecf20Sopenharmony_ci {0x5783, 0x02}, 3668c2ecf20Sopenharmony_ci {0x5784, 0x01}, 3678c2ecf20Sopenharmony_ci {0x5785, 0x01}, 3688c2ecf20Sopenharmony_ci {0x5786, 0x00}, 3698c2ecf20Sopenharmony_ci {0x5787, 0x04}, 3708c2ecf20Sopenharmony_ci {0x5788, 0x02}, 3718c2ecf20Sopenharmony_ci {0x5789, 0x0f}, 3728c2ecf20Sopenharmony_ci {0x578a, 0xfd}, 3738c2ecf20Sopenharmony_ci {0x578b, 0xf5}, 3748c2ecf20Sopenharmony_ci {0x578c, 0xf5}, 3758c2ecf20Sopenharmony_ci {0x578d, 0x03}, 3768c2ecf20Sopenharmony_ci {0x578e, 0x08}, 3778c2ecf20Sopenharmony_ci {0x578f, 0x0c}, 3788c2ecf20Sopenharmony_ci {0x5790, 0x08}, 3798c2ecf20Sopenharmony_ci {0x5791, 0x06}, 3808c2ecf20Sopenharmony_ci {0x5792, 0x00}, 3818c2ecf20Sopenharmony_ci {0x5793, 0x52}, 3828c2ecf20Sopenharmony_ci {0x5794, 0xa3}, 3838c2ecf20Sopenharmony_ci {0x3503, 0x00}, 3848c2ecf20Sopenharmony_ci {0x5045, 0x05}, 3858c2ecf20Sopenharmony_ci {0x4003, 0x40}, 3868c2ecf20Sopenharmony_ci {0x5048, 0x40} 3878c2ecf20Sopenharmony_ci}; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_cistatic const struct ov5670_reg mode_1296x972_regs[] = { 3908c2ecf20Sopenharmony_ci {0x3000, 0x00}, 3918c2ecf20Sopenharmony_ci {0x3002, 0x21}, 3928c2ecf20Sopenharmony_ci {0x3005, 0xf0}, 3938c2ecf20Sopenharmony_ci {0x3007, 0x00}, 3948c2ecf20Sopenharmony_ci {0x3015, 0x0f}, 3958c2ecf20Sopenharmony_ci {0x3018, 0x32}, 3968c2ecf20Sopenharmony_ci {0x301a, 0xf0}, 3978c2ecf20Sopenharmony_ci {0x301b, 0xf0}, 3988c2ecf20Sopenharmony_ci {0x301c, 0xf0}, 3998c2ecf20Sopenharmony_ci {0x301d, 0xf0}, 4008c2ecf20Sopenharmony_ci {0x301e, 0xf0}, 4018c2ecf20Sopenharmony_ci {0x3030, 0x00}, 4028c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 4038c2ecf20Sopenharmony_ci {0x303c, 0xff}, 4048c2ecf20Sopenharmony_ci {0x303e, 0xff}, 4058c2ecf20Sopenharmony_ci {0x3040, 0xf0}, 4068c2ecf20Sopenharmony_ci {0x3041, 0x00}, 4078c2ecf20Sopenharmony_ci {0x3042, 0xf0}, 4088c2ecf20Sopenharmony_ci {0x3106, 0x11}, 4098c2ecf20Sopenharmony_ci {0x3500, 0x00}, 4108c2ecf20Sopenharmony_ci {0x3501, 0x80}, 4118c2ecf20Sopenharmony_ci {0x3502, 0x00}, 4128c2ecf20Sopenharmony_ci {0x3503, 0x04}, 4138c2ecf20Sopenharmony_ci {0x3504, 0x03}, 4148c2ecf20Sopenharmony_ci {0x3505, 0x83}, 4158c2ecf20Sopenharmony_ci {0x3508, 0x07}, 4168c2ecf20Sopenharmony_ci {0x3509, 0x80}, 4178c2ecf20Sopenharmony_ci {0x350e, 0x04}, 4188c2ecf20Sopenharmony_ci {0x350f, 0x00}, 4198c2ecf20Sopenharmony_ci {0x3510, 0x00}, 4208c2ecf20Sopenharmony_ci {0x3511, 0x02}, 4218c2ecf20Sopenharmony_ci {0x3512, 0x00}, 4228c2ecf20Sopenharmony_ci {0x3601, 0xc8}, 4238c2ecf20Sopenharmony_ci {0x3610, 0x88}, 4248c2ecf20Sopenharmony_ci {0x3612, 0x48}, 4258c2ecf20Sopenharmony_ci {0x3614, 0x5b}, 4268c2ecf20Sopenharmony_ci {0x3615, 0x96}, 4278c2ecf20Sopenharmony_ci {0x3621, 0xd0}, 4288c2ecf20Sopenharmony_ci {0x3622, 0x00}, 4298c2ecf20Sopenharmony_ci {0x3623, 0x00}, 4308c2ecf20Sopenharmony_ci {0x3633, 0x13}, 4318c2ecf20Sopenharmony_ci {0x3634, 0x13}, 4328c2ecf20Sopenharmony_ci {0x3635, 0x13}, 4338c2ecf20Sopenharmony_ci {0x3636, 0x13}, 4348c2ecf20Sopenharmony_ci {0x3645, 0x13}, 4358c2ecf20Sopenharmony_ci {0x3646, 0x82}, 4368c2ecf20Sopenharmony_ci {0x3650, 0x00}, 4378c2ecf20Sopenharmony_ci {0x3652, 0xff}, 4388c2ecf20Sopenharmony_ci {0x3655, 0x20}, 4398c2ecf20Sopenharmony_ci {0x3656, 0xff}, 4408c2ecf20Sopenharmony_ci {0x365a, 0xff}, 4418c2ecf20Sopenharmony_ci {0x365e, 0xff}, 4428c2ecf20Sopenharmony_ci {0x3668, 0x00}, 4438c2ecf20Sopenharmony_ci {0x366a, 0x07}, 4448c2ecf20Sopenharmony_ci {0x366e, 0x08}, 4458c2ecf20Sopenharmony_ci {0x366d, 0x00}, 4468c2ecf20Sopenharmony_ci {0x366f, 0x80}, 4478c2ecf20Sopenharmony_ci {0x3700, 0x28}, 4488c2ecf20Sopenharmony_ci {0x3701, 0x10}, 4498c2ecf20Sopenharmony_ci {0x3702, 0x3a}, 4508c2ecf20Sopenharmony_ci {0x3703, 0x19}, 4518c2ecf20Sopenharmony_ci {0x3704, 0x10}, 4528c2ecf20Sopenharmony_ci {0x3705, 0x00}, 4538c2ecf20Sopenharmony_ci {0x3706, 0x66}, 4548c2ecf20Sopenharmony_ci {0x3707, 0x08}, 4558c2ecf20Sopenharmony_ci {0x3708, 0x34}, 4568c2ecf20Sopenharmony_ci {0x3709, 0x40}, 4578c2ecf20Sopenharmony_ci {0x370a, 0x01}, 4588c2ecf20Sopenharmony_ci {0x370b, 0x1b}, 4598c2ecf20Sopenharmony_ci {0x3714, 0x24}, 4608c2ecf20Sopenharmony_ci {0x371a, 0x3e}, 4618c2ecf20Sopenharmony_ci {0x3733, 0x00}, 4628c2ecf20Sopenharmony_ci {0x3734, 0x00}, 4638c2ecf20Sopenharmony_ci {0x373a, 0x05}, 4648c2ecf20Sopenharmony_ci {0x373b, 0x06}, 4658c2ecf20Sopenharmony_ci {0x373c, 0x0a}, 4668c2ecf20Sopenharmony_ci {0x373f, 0xa0}, 4678c2ecf20Sopenharmony_ci {0x3755, 0x00}, 4688c2ecf20Sopenharmony_ci {0x3758, 0x00}, 4698c2ecf20Sopenharmony_ci {0x375b, 0x0e}, 4708c2ecf20Sopenharmony_ci {0x3766, 0x5f}, 4718c2ecf20Sopenharmony_ci {0x3768, 0x00}, 4728c2ecf20Sopenharmony_ci {0x3769, 0x22}, 4738c2ecf20Sopenharmony_ci {0x3773, 0x08}, 4748c2ecf20Sopenharmony_ci {0x3774, 0x1f}, 4758c2ecf20Sopenharmony_ci {0x3776, 0x06}, 4768c2ecf20Sopenharmony_ci {0x37a0, 0x88}, 4778c2ecf20Sopenharmony_ci {0x37a1, 0x5c}, 4788c2ecf20Sopenharmony_ci {0x37a7, 0x88}, 4798c2ecf20Sopenharmony_ci {0x37a8, 0x70}, 4808c2ecf20Sopenharmony_ci {0x37aa, 0x88}, 4818c2ecf20Sopenharmony_ci {0x37ab, 0x48}, 4828c2ecf20Sopenharmony_ci {0x37b3, 0x66}, 4838c2ecf20Sopenharmony_ci {0x37c2, 0x04}, 4848c2ecf20Sopenharmony_ci {0x37c5, 0x00}, 4858c2ecf20Sopenharmony_ci {0x37c8, 0x00}, 4868c2ecf20Sopenharmony_ci {0x3800, 0x00}, 4878c2ecf20Sopenharmony_ci {0x3801, 0x0c}, 4888c2ecf20Sopenharmony_ci {0x3802, 0x00}, 4898c2ecf20Sopenharmony_ci {0x3803, 0x04}, 4908c2ecf20Sopenharmony_ci {0x3804, 0x0a}, 4918c2ecf20Sopenharmony_ci {0x3805, 0x33}, 4928c2ecf20Sopenharmony_ci {0x3806, 0x07}, 4938c2ecf20Sopenharmony_ci {0x3807, 0xa3}, 4948c2ecf20Sopenharmony_ci {0x3808, 0x05}, 4958c2ecf20Sopenharmony_ci {0x3809, 0x10}, 4968c2ecf20Sopenharmony_ci {0x380a, 0x03}, 4978c2ecf20Sopenharmony_ci {0x380b, 0xcc}, 4988c2ecf20Sopenharmony_ci {0x380c, 0x06}, 4998c2ecf20Sopenharmony_ci {0x380d, 0x90}, 5008c2ecf20Sopenharmony_ci {0x380e, 0x08}, 5018c2ecf20Sopenharmony_ci {0x380f, 0x08}, 5028c2ecf20Sopenharmony_ci {0x3811, 0x04}, 5038c2ecf20Sopenharmony_ci {0x3813, 0x04}, 5048c2ecf20Sopenharmony_ci {0x3814, 0x03}, 5058c2ecf20Sopenharmony_ci {0x3815, 0x01}, 5068c2ecf20Sopenharmony_ci {0x3816, 0x00}, 5078c2ecf20Sopenharmony_ci {0x3817, 0x00}, 5088c2ecf20Sopenharmony_ci {0x3818, 0x00}, 5098c2ecf20Sopenharmony_ci {0x3819, 0x00}, 5108c2ecf20Sopenharmony_ci {0x3820, 0x94}, 5118c2ecf20Sopenharmony_ci {0x3821, 0x47}, 5128c2ecf20Sopenharmony_ci {0x3822, 0x48}, 5138c2ecf20Sopenharmony_ci {0x3826, 0x00}, 5148c2ecf20Sopenharmony_ci {0x3827, 0x08}, 5158c2ecf20Sopenharmony_ci {0x382a, 0x03}, 5168c2ecf20Sopenharmony_ci {0x382b, 0x01}, 5178c2ecf20Sopenharmony_ci {0x3830, 0x08}, 5188c2ecf20Sopenharmony_ci {0x3836, 0x02}, 5198c2ecf20Sopenharmony_ci {0x3837, 0x00}, 5208c2ecf20Sopenharmony_ci {0x3838, 0x10}, 5218c2ecf20Sopenharmony_ci {0x3841, 0xff}, 5228c2ecf20Sopenharmony_ci {0x3846, 0x48}, 5238c2ecf20Sopenharmony_ci {0x3861, 0x00}, 5248c2ecf20Sopenharmony_ci {0x3862, 0x04}, 5258c2ecf20Sopenharmony_ci {0x3863, 0x06}, 5268c2ecf20Sopenharmony_ci {0x3a11, 0x01}, 5278c2ecf20Sopenharmony_ci {0x3a12, 0x78}, 5288c2ecf20Sopenharmony_ci {0x3b00, 0x00}, 5298c2ecf20Sopenharmony_ci {0x3b02, 0x00}, 5308c2ecf20Sopenharmony_ci {0x3b03, 0x00}, 5318c2ecf20Sopenharmony_ci {0x3b04, 0x00}, 5328c2ecf20Sopenharmony_ci {0x3b05, 0x00}, 5338c2ecf20Sopenharmony_ci {0x3c00, 0x89}, 5348c2ecf20Sopenharmony_ci {0x3c01, 0xab}, 5358c2ecf20Sopenharmony_ci {0x3c02, 0x01}, 5368c2ecf20Sopenharmony_ci {0x3c03, 0x00}, 5378c2ecf20Sopenharmony_ci {0x3c04, 0x00}, 5388c2ecf20Sopenharmony_ci {0x3c05, 0x03}, 5398c2ecf20Sopenharmony_ci {0x3c06, 0x00}, 5408c2ecf20Sopenharmony_ci {0x3c07, 0x05}, 5418c2ecf20Sopenharmony_ci {0x3c0c, 0x00}, 5428c2ecf20Sopenharmony_ci {0x3c0d, 0x00}, 5438c2ecf20Sopenharmony_ci {0x3c0e, 0x00}, 5448c2ecf20Sopenharmony_ci {0x3c0f, 0x00}, 5458c2ecf20Sopenharmony_ci {0x3c40, 0x00}, 5468c2ecf20Sopenharmony_ci {0x3c41, 0xa3}, 5478c2ecf20Sopenharmony_ci {0x3c43, 0x7d}, 5488c2ecf20Sopenharmony_ci {0x3c45, 0xd7}, 5498c2ecf20Sopenharmony_ci {0x3c47, 0xfc}, 5508c2ecf20Sopenharmony_ci {0x3c50, 0x05}, 5518c2ecf20Sopenharmony_ci {0x3c52, 0xaa}, 5528c2ecf20Sopenharmony_ci {0x3c54, 0x71}, 5538c2ecf20Sopenharmony_ci {0x3c56, 0x80}, 5548c2ecf20Sopenharmony_ci {0x3d85, 0x17}, 5558c2ecf20Sopenharmony_ci {0x3f03, 0x00}, 5568c2ecf20Sopenharmony_ci {0x3f0a, 0x00}, 5578c2ecf20Sopenharmony_ci {0x3f0b, 0x00}, 5588c2ecf20Sopenharmony_ci {0x4001, 0x60}, 5598c2ecf20Sopenharmony_ci {0x4009, 0x05}, 5608c2ecf20Sopenharmony_ci {0x4020, 0x00}, 5618c2ecf20Sopenharmony_ci {0x4021, 0x00}, 5628c2ecf20Sopenharmony_ci {0x4022, 0x00}, 5638c2ecf20Sopenharmony_ci {0x4023, 0x00}, 5648c2ecf20Sopenharmony_ci {0x4024, 0x00}, 5658c2ecf20Sopenharmony_ci {0x4025, 0x00}, 5668c2ecf20Sopenharmony_ci {0x4026, 0x00}, 5678c2ecf20Sopenharmony_ci {0x4027, 0x00}, 5688c2ecf20Sopenharmony_ci {0x4028, 0x00}, 5698c2ecf20Sopenharmony_ci {0x4029, 0x00}, 5708c2ecf20Sopenharmony_ci {0x402a, 0x00}, 5718c2ecf20Sopenharmony_ci {0x402b, 0x00}, 5728c2ecf20Sopenharmony_ci {0x402c, 0x00}, 5738c2ecf20Sopenharmony_ci {0x402d, 0x00}, 5748c2ecf20Sopenharmony_ci {0x402e, 0x00}, 5758c2ecf20Sopenharmony_ci {0x402f, 0x00}, 5768c2ecf20Sopenharmony_ci {0x4040, 0x00}, 5778c2ecf20Sopenharmony_ci {0x4041, 0x03}, 5788c2ecf20Sopenharmony_ci {0x4042, 0x00}, 5798c2ecf20Sopenharmony_ci {0x4043, 0x7A}, 5808c2ecf20Sopenharmony_ci {0x4044, 0x00}, 5818c2ecf20Sopenharmony_ci {0x4045, 0x7A}, 5828c2ecf20Sopenharmony_ci {0x4046, 0x00}, 5838c2ecf20Sopenharmony_ci {0x4047, 0x7A}, 5848c2ecf20Sopenharmony_ci {0x4048, 0x00}, 5858c2ecf20Sopenharmony_ci {0x4049, 0x7A}, 5868c2ecf20Sopenharmony_ci {0x4307, 0x30}, 5878c2ecf20Sopenharmony_ci {0x4500, 0x58}, 5888c2ecf20Sopenharmony_ci {0x4501, 0x04}, 5898c2ecf20Sopenharmony_ci {0x4502, 0x48}, 5908c2ecf20Sopenharmony_ci {0x4503, 0x10}, 5918c2ecf20Sopenharmony_ci {0x4508, 0x55}, 5928c2ecf20Sopenharmony_ci {0x4509, 0x55}, 5938c2ecf20Sopenharmony_ci {0x450a, 0x00}, 5948c2ecf20Sopenharmony_ci {0x450b, 0x00}, 5958c2ecf20Sopenharmony_ci {0x4600, 0x00}, 5968c2ecf20Sopenharmony_ci {0x4601, 0x81}, 5978c2ecf20Sopenharmony_ci {0x4700, 0xa4}, 5988c2ecf20Sopenharmony_ci {0x4800, 0x4c}, 5998c2ecf20Sopenharmony_ci {0x4816, 0x53}, 6008c2ecf20Sopenharmony_ci {0x481f, 0x40}, 6018c2ecf20Sopenharmony_ci {0x4837, 0x13}, 6028c2ecf20Sopenharmony_ci {0x5000, 0x56}, 6038c2ecf20Sopenharmony_ci {0x5001, 0x01}, 6048c2ecf20Sopenharmony_ci {0x5002, 0x28}, 6058c2ecf20Sopenharmony_ci {0x5004, 0x0c}, 6068c2ecf20Sopenharmony_ci {0x5006, 0x0c}, 6078c2ecf20Sopenharmony_ci {0x5007, 0xe0}, 6088c2ecf20Sopenharmony_ci {0x5008, 0x01}, 6098c2ecf20Sopenharmony_ci {0x5009, 0xb0}, 6108c2ecf20Sopenharmony_ci {0x5901, 0x00}, 6118c2ecf20Sopenharmony_ci {0x5a01, 0x00}, 6128c2ecf20Sopenharmony_ci {0x5a03, 0x00}, 6138c2ecf20Sopenharmony_ci {0x5a04, 0x0c}, 6148c2ecf20Sopenharmony_ci {0x5a05, 0xe0}, 6158c2ecf20Sopenharmony_ci {0x5a06, 0x09}, 6168c2ecf20Sopenharmony_ci {0x5a07, 0xb0}, 6178c2ecf20Sopenharmony_ci {0x5a08, 0x06}, 6188c2ecf20Sopenharmony_ci {0x5e00, 0x00}, 6198c2ecf20Sopenharmony_ci {0x3734, 0x40}, 6208c2ecf20Sopenharmony_ci {0x5b00, 0x01}, 6218c2ecf20Sopenharmony_ci {0x5b01, 0x10}, 6228c2ecf20Sopenharmony_ci {0x5b02, 0x01}, 6238c2ecf20Sopenharmony_ci {0x5b03, 0xdb}, 6248c2ecf20Sopenharmony_ci {0x3d8c, 0x71}, 6258c2ecf20Sopenharmony_ci {0x3d8d, 0xea}, 6268c2ecf20Sopenharmony_ci {0x4017, 0x10}, 6278c2ecf20Sopenharmony_ci {0x3618, 0x2a}, 6288c2ecf20Sopenharmony_ci {0x5780, 0x3e}, 6298c2ecf20Sopenharmony_ci {0x5781, 0x0f}, 6308c2ecf20Sopenharmony_ci {0x5782, 0x44}, 6318c2ecf20Sopenharmony_ci {0x5783, 0x02}, 6328c2ecf20Sopenharmony_ci {0x5784, 0x01}, 6338c2ecf20Sopenharmony_ci {0x5785, 0x01}, 6348c2ecf20Sopenharmony_ci {0x5786, 0x00}, 6358c2ecf20Sopenharmony_ci {0x5787, 0x04}, 6368c2ecf20Sopenharmony_ci {0x5788, 0x02}, 6378c2ecf20Sopenharmony_ci {0x5789, 0x0f}, 6388c2ecf20Sopenharmony_ci {0x578a, 0xfd}, 6398c2ecf20Sopenharmony_ci {0x578b, 0xf5}, 6408c2ecf20Sopenharmony_ci {0x578c, 0xf5}, 6418c2ecf20Sopenharmony_ci {0x578d, 0x03}, 6428c2ecf20Sopenharmony_ci {0x578e, 0x08}, 6438c2ecf20Sopenharmony_ci {0x578f, 0x0c}, 6448c2ecf20Sopenharmony_ci {0x5790, 0x08}, 6458c2ecf20Sopenharmony_ci {0x5791, 0x04}, 6468c2ecf20Sopenharmony_ci {0x5792, 0x00}, 6478c2ecf20Sopenharmony_ci {0x5793, 0x52}, 6488c2ecf20Sopenharmony_ci {0x5794, 0xa3}, 6498c2ecf20Sopenharmony_ci {0x3503, 0x00}, 6508c2ecf20Sopenharmony_ci {0x5045, 0x05}, 6518c2ecf20Sopenharmony_ci {0x4003, 0x40}, 6528c2ecf20Sopenharmony_ci {0x5048, 0x40} 6538c2ecf20Sopenharmony_ci}; 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_cistatic const struct ov5670_reg mode_648x486_regs[] = { 6568c2ecf20Sopenharmony_ci {0x3000, 0x00}, 6578c2ecf20Sopenharmony_ci {0x3002, 0x21}, 6588c2ecf20Sopenharmony_ci {0x3005, 0xf0}, 6598c2ecf20Sopenharmony_ci {0x3007, 0x00}, 6608c2ecf20Sopenharmony_ci {0x3015, 0x0f}, 6618c2ecf20Sopenharmony_ci {0x3018, 0x32}, 6628c2ecf20Sopenharmony_ci {0x301a, 0xf0}, 6638c2ecf20Sopenharmony_ci {0x301b, 0xf0}, 6648c2ecf20Sopenharmony_ci {0x301c, 0xf0}, 6658c2ecf20Sopenharmony_ci {0x301d, 0xf0}, 6668c2ecf20Sopenharmony_ci {0x301e, 0xf0}, 6678c2ecf20Sopenharmony_ci {0x3030, 0x00}, 6688c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 6698c2ecf20Sopenharmony_ci {0x303c, 0xff}, 6708c2ecf20Sopenharmony_ci {0x303e, 0xff}, 6718c2ecf20Sopenharmony_ci {0x3040, 0xf0}, 6728c2ecf20Sopenharmony_ci {0x3041, 0x00}, 6738c2ecf20Sopenharmony_ci {0x3042, 0xf0}, 6748c2ecf20Sopenharmony_ci {0x3106, 0x11}, 6758c2ecf20Sopenharmony_ci {0x3500, 0x00}, 6768c2ecf20Sopenharmony_ci {0x3501, 0x80}, 6778c2ecf20Sopenharmony_ci {0x3502, 0x00}, 6788c2ecf20Sopenharmony_ci {0x3503, 0x04}, 6798c2ecf20Sopenharmony_ci {0x3504, 0x03}, 6808c2ecf20Sopenharmony_ci {0x3505, 0x83}, 6818c2ecf20Sopenharmony_ci {0x3508, 0x04}, 6828c2ecf20Sopenharmony_ci {0x3509, 0x00}, 6838c2ecf20Sopenharmony_ci {0x350e, 0x04}, 6848c2ecf20Sopenharmony_ci {0x350f, 0x00}, 6858c2ecf20Sopenharmony_ci {0x3510, 0x00}, 6868c2ecf20Sopenharmony_ci {0x3511, 0x02}, 6878c2ecf20Sopenharmony_ci {0x3512, 0x00}, 6888c2ecf20Sopenharmony_ci {0x3601, 0xc8}, 6898c2ecf20Sopenharmony_ci {0x3610, 0x88}, 6908c2ecf20Sopenharmony_ci {0x3612, 0x48}, 6918c2ecf20Sopenharmony_ci {0x3614, 0x5b}, 6928c2ecf20Sopenharmony_ci {0x3615, 0x96}, 6938c2ecf20Sopenharmony_ci {0x3621, 0xd0}, 6948c2ecf20Sopenharmony_ci {0x3622, 0x00}, 6958c2ecf20Sopenharmony_ci {0x3623, 0x04}, 6968c2ecf20Sopenharmony_ci {0x3633, 0x13}, 6978c2ecf20Sopenharmony_ci {0x3634, 0x13}, 6988c2ecf20Sopenharmony_ci {0x3635, 0x13}, 6998c2ecf20Sopenharmony_ci {0x3636, 0x13}, 7008c2ecf20Sopenharmony_ci {0x3645, 0x13}, 7018c2ecf20Sopenharmony_ci {0x3646, 0x82}, 7028c2ecf20Sopenharmony_ci {0x3650, 0x00}, 7038c2ecf20Sopenharmony_ci {0x3652, 0xff}, 7048c2ecf20Sopenharmony_ci {0x3655, 0x20}, 7058c2ecf20Sopenharmony_ci {0x3656, 0xff}, 7068c2ecf20Sopenharmony_ci {0x365a, 0xff}, 7078c2ecf20Sopenharmony_ci {0x365e, 0xff}, 7088c2ecf20Sopenharmony_ci {0x3668, 0x00}, 7098c2ecf20Sopenharmony_ci {0x366a, 0x07}, 7108c2ecf20Sopenharmony_ci {0x366e, 0x08}, 7118c2ecf20Sopenharmony_ci {0x366d, 0x00}, 7128c2ecf20Sopenharmony_ci {0x366f, 0x80}, 7138c2ecf20Sopenharmony_ci {0x3700, 0x28}, 7148c2ecf20Sopenharmony_ci {0x3701, 0x10}, 7158c2ecf20Sopenharmony_ci {0x3702, 0x3a}, 7168c2ecf20Sopenharmony_ci {0x3703, 0x19}, 7178c2ecf20Sopenharmony_ci {0x3704, 0x10}, 7188c2ecf20Sopenharmony_ci {0x3705, 0x00}, 7198c2ecf20Sopenharmony_ci {0x3706, 0x66}, 7208c2ecf20Sopenharmony_ci {0x3707, 0x08}, 7218c2ecf20Sopenharmony_ci {0x3708, 0x34}, 7228c2ecf20Sopenharmony_ci {0x3709, 0x40}, 7238c2ecf20Sopenharmony_ci {0x370a, 0x01}, 7248c2ecf20Sopenharmony_ci {0x370b, 0x1b}, 7258c2ecf20Sopenharmony_ci {0x3714, 0x24}, 7268c2ecf20Sopenharmony_ci {0x371a, 0x3e}, 7278c2ecf20Sopenharmony_ci {0x3733, 0x00}, 7288c2ecf20Sopenharmony_ci {0x3734, 0x00}, 7298c2ecf20Sopenharmony_ci {0x373a, 0x05}, 7308c2ecf20Sopenharmony_ci {0x373b, 0x06}, 7318c2ecf20Sopenharmony_ci {0x373c, 0x0a}, 7328c2ecf20Sopenharmony_ci {0x373f, 0xa0}, 7338c2ecf20Sopenharmony_ci {0x3755, 0x00}, 7348c2ecf20Sopenharmony_ci {0x3758, 0x00}, 7358c2ecf20Sopenharmony_ci {0x375b, 0x0e}, 7368c2ecf20Sopenharmony_ci {0x3766, 0x5f}, 7378c2ecf20Sopenharmony_ci {0x3768, 0x00}, 7388c2ecf20Sopenharmony_ci {0x3769, 0x22}, 7398c2ecf20Sopenharmony_ci {0x3773, 0x08}, 7408c2ecf20Sopenharmony_ci {0x3774, 0x1f}, 7418c2ecf20Sopenharmony_ci {0x3776, 0x06}, 7428c2ecf20Sopenharmony_ci {0x37a0, 0x88}, 7438c2ecf20Sopenharmony_ci {0x37a1, 0x5c}, 7448c2ecf20Sopenharmony_ci {0x37a7, 0x88}, 7458c2ecf20Sopenharmony_ci {0x37a8, 0x70}, 7468c2ecf20Sopenharmony_ci {0x37aa, 0x88}, 7478c2ecf20Sopenharmony_ci {0x37ab, 0x48}, 7488c2ecf20Sopenharmony_ci {0x37b3, 0x66}, 7498c2ecf20Sopenharmony_ci {0x37c2, 0x04}, 7508c2ecf20Sopenharmony_ci {0x37c5, 0x00}, 7518c2ecf20Sopenharmony_ci {0x37c8, 0x00}, 7528c2ecf20Sopenharmony_ci {0x3800, 0x00}, 7538c2ecf20Sopenharmony_ci {0x3801, 0x0c}, 7548c2ecf20Sopenharmony_ci {0x3802, 0x00}, 7558c2ecf20Sopenharmony_ci {0x3803, 0x04}, 7568c2ecf20Sopenharmony_ci {0x3804, 0x0a}, 7578c2ecf20Sopenharmony_ci {0x3805, 0x33}, 7588c2ecf20Sopenharmony_ci {0x3806, 0x07}, 7598c2ecf20Sopenharmony_ci {0x3807, 0xa3}, 7608c2ecf20Sopenharmony_ci {0x3808, 0x02}, 7618c2ecf20Sopenharmony_ci {0x3809, 0x88}, 7628c2ecf20Sopenharmony_ci {0x380a, 0x01}, 7638c2ecf20Sopenharmony_ci {0x380b, 0xe6}, 7648c2ecf20Sopenharmony_ci {0x380c, 0x06}, 7658c2ecf20Sopenharmony_ci {0x380d, 0x90}, 7668c2ecf20Sopenharmony_ci {0x380e, 0x08}, 7678c2ecf20Sopenharmony_ci {0x380f, 0x08}, 7688c2ecf20Sopenharmony_ci {0x3811, 0x04}, 7698c2ecf20Sopenharmony_ci {0x3813, 0x02}, 7708c2ecf20Sopenharmony_ci {0x3814, 0x07}, 7718c2ecf20Sopenharmony_ci {0x3815, 0x01}, 7728c2ecf20Sopenharmony_ci {0x3816, 0x00}, 7738c2ecf20Sopenharmony_ci {0x3817, 0x00}, 7748c2ecf20Sopenharmony_ci {0x3818, 0x00}, 7758c2ecf20Sopenharmony_ci {0x3819, 0x00}, 7768c2ecf20Sopenharmony_ci {0x3820, 0x94}, 7778c2ecf20Sopenharmony_ci {0x3821, 0xc6}, 7788c2ecf20Sopenharmony_ci {0x3822, 0x48}, 7798c2ecf20Sopenharmony_ci {0x3826, 0x00}, 7808c2ecf20Sopenharmony_ci {0x3827, 0x08}, 7818c2ecf20Sopenharmony_ci {0x382a, 0x07}, 7828c2ecf20Sopenharmony_ci {0x382b, 0x01}, 7838c2ecf20Sopenharmony_ci {0x3830, 0x08}, 7848c2ecf20Sopenharmony_ci {0x3836, 0x02}, 7858c2ecf20Sopenharmony_ci {0x3837, 0x00}, 7868c2ecf20Sopenharmony_ci {0x3838, 0x10}, 7878c2ecf20Sopenharmony_ci {0x3841, 0xff}, 7888c2ecf20Sopenharmony_ci {0x3846, 0x48}, 7898c2ecf20Sopenharmony_ci {0x3861, 0x00}, 7908c2ecf20Sopenharmony_ci {0x3862, 0x04}, 7918c2ecf20Sopenharmony_ci {0x3863, 0x06}, 7928c2ecf20Sopenharmony_ci {0x3a11, 0x01}, 7938c2ecf20Sopenharmony_ci {0x3a12, 0x78}, 7948c2ecf20Sopenharmony_ci {0x3b00, 0x00}, 7958c2ecf20Sopenharmony_ci {0x3b02, 0x00}, 7968c2ecf20Sopenharmony_ci {0x3b03, 0x00}, 7978c2ecf20Sopenharmony_ci {0x3b04, 0x00}, 7988c2ecf20Sopenharmony_ci {0x3b05, 0x00}, 7998c2ecf20Sopenharmony_ci {0x3c00, 0x89}, 8008c2ecf20Sopenharmony_ci {0x3c01, 0xab}, 8018c2ecf20Sopenharmony_ci {0x3c02, 0x01}, 8028c2ecf20Sopenharmony_ci {0x3c03, 0x00}, 8038c2ecf20Sopenharmony_ci {0x3c04, 0x00}, 8048c2ecf20Sopenharmony_ci {0x3c05, 0x03}, 8058c2ecf20Sopenharmony_ci {0x3c06, 0x00}, 8068c2ecf20Sopenharmony_ci {0x3c07, 0x05}, 8078c2ecf20Sopenharmony_ci {0x3c0c, 0x00}, 8088c2ecf20Sopenharmony_ci {0x3c0d, 0x00}, 8098c2ecf20Sopenharmony_ci {0x3c0e, 0x00}, 8108c2ecf20Sopenharmony_ci {0x3c0f, 0x00}, 8118c2ecf20Sopenharmony_ci {0x3c40, 0x00}, 8128c2ecf20Sopenharmony_ci {0x3c41, 0xa3}, 8138c2ecf20Sopenharmony_ci {0x3c43, 0x7d}, 8148c2ecf20Sopenharmony_ci {0x3c45, 0xd7}, 8158c2ecf20Sopenharmony_ci {0x3c47, 0xfc}, 8168c2ecf20Sopenharmony_ci {0x3c50, 0x05}, 8178c2ecf20Sopenharmony_ci {0x3c52, 0xaa}, 8188c2ecf20Sopenharmony_ci {0x3c54, 0x71}, 8198c2ecf20Sopenharmony_ci {0x3c56, 0x80}, 8208c2ecf20Sopenharmony_ci {0x3d85, 0x17}, 8218c2ecf20Sopenharmony_ci {0x3f03, 0x00}, 8228c2ecf20Sopenharmony_ci {0x3f0a, 0x00}, 8238c2ecf20Sopenharmony_ci {0x3f0b, 0x00}, 8248c2ecf20Sopenharmony_ci {0x4001, 0x60}, 8258c2ecf20Sopenharmony_ci {0x4009, 0x05}, 8268c2ecf20Sopenharmony_ci {0x4020, 0x00}, 8278c2ecf20Sopenharmony_ci {0x4021, 0x00}, 8288c2ecf20Sopenharmony_ci {0x4022, 0x00}, 8298c2ecf20Sopenharmony_ci {0x4023, 0x00}, 8308c2ecf20Sopenharmony_ci {0x4024, 0x00}, 8318c2ecf20Sopenharmony_ci {0x4025, 0x00}, 8328c2ecf20Sopenharmony_ci {0x4026, 0x00}, 8338c2ecf20Sopenharmony_ci {0x4027, 0x00}, 8348c2ecf20Sopenharmony_ci {0x4028, 0x00}, 8358c2ecf20Sopenharmony_ci {0x4029, 0x00}, 8368c2ecf20Sopenharmony_ci {0x402a, 0x00}, 8378c2ecf20Sopenharmony_ci {0x402b, 0x00}, 8388c2ecf20Sopenharmony_ci {0x402c, 0x00}, 8398c2ecf20Sopenharmony_ci {0x402d, 0x00}, 8408c2ecf20Sopenharmony_ci {0x402e, 0x00}, 8418c2ecf20Sopenharmony_ci {0x402f, 0x00}, 8428c2ecf20Sopenharmony_ci {0x4040, 0x00}, 8438c2ecf20Sopenharmony_ci {0x4041, 0x03}, 8448c2ecf20Sopenharmony_ci {0x4042, 0x00}, 8458c2ecf20Sopenharmony_ci {0x4043, 0x7A}, 8468c2ecf20Sopenharmony_ci {0x4044, 0x00}, 8478c2ecf20Sopenharmony_ci {0x4045, 0x7A}, 8488c2ecf20Sopenharmony_ci {0x4046, 0x00}, 8498c2ecf20Sopenharmony_ci {0x4047, 0x7A}, 8508c2ecf20Sopenharmony_ci {0x4048, 0x00}, 8518c2ecf20Sopenharmony_ci {0x4049, 0x7A}, 8528c2ecf20Sopenharmony_ci {0x4307, 0x30}, 8538c2ecf20Sopenharmony_ci {0x4500, 0x58}, 8548c2ecf20Sopenharmony_ci {0x4501, 0x04}, 8558c2ecf20Sopenharmony_ci {0x4502, 0x40}, 8568c2ecf20Sopenharmony_ci {0x4503, 0x10}, 8578c2ecf20Sopenharmony_ci {0x4508, 0x55}, 8588c2ecf20Sopenharmony_ci {0x4509, 0x55}, 8598c2ecf20Sopenharmony_ci {0x450a, 0x02}, 8608c2ecf20Sopenharmony_ci {0x450b, 0x00}, 8618c2ecf20Sopenharmony_ci {0x4600, 0x00}, 8628c2ecf20Sopenharmony_ci {0x4601, 0x40}, 8638c2ecf20Sopenharmony_ci {0x4700, 0xa4}, 8648c2ecf20Sopenharmony_ci {0x4800, 0x4c}, 8658c2ecf20Sopenharmony_ci {0x4816, 0x53}, 8668c2ecf20Sopenharmony_ci {0x481f, 0x40}, 8678c2ecf20Sopenharmony_ci {0x4837, 0x13}, 8688c2ecf20Sopenharmony_ci {0x5000, 0x56}, 8698c2ecf20Sopenharmony_ci {0x5001, 0x01}, 8708c2ecf20Sopenharmony_ci {0x5002, 0x28}, 8718c2ecf20Sopenharmony_ci {0x5004, 0x0c}, 8728c2ecf20Sopenharmony_ci {0x5006, 0x0c}, 8738c2ecf20Sopenharmony_ci {0x5007, 0xe0}, 8748c2ecf20Sopenharmony_ci {0x5008, 0x01}, 8758c2ecf20Sopenharmony_ci {0x5009, 0xb0}, 8768c2ecf20Sopenharmony_ci {0x5901, 0x00}, 8778c2ecf20Sopenharmony_ci {0x5a01, 0x00}, 8788c2ecf20Sopenharmony_ci {0x5a03, 0x00}, 8798c2ecf20Sopenharmony_ci {0x5a04, 0x0c}, 8808c2ecf20Sopenharmony_ci {0x5a05, 0xe0}, 8818c2ecf20Sopenharmony_ci {0x5a06, 0x09}, 8828c2ecf20Sopenharmony_ci {0x5a07, 0xb0}, 8838c2ecf20Sopenharmony_ci {0x5a08, 0x06}, 8848c2ecf20Sopenharmony_ci {0x5e00, 0x00}, 8858c2ecf20Sopenharmony_ci {0x3734, 0x40}, 8868c2ecf20Sopenharmony_ci {0x5b00, 0x01}, 8878c2ecf20Sopenharmony_ci {0x5b01, 0x10}, 8888c2ecf20Sopenharmony_ci {0x5b02, 0x01}, 8898c2ecf20Sopenharmony_ci {0x5b03, 0xdb}, 8908c2ecf20Sopenharmony_ci {0x3d8c, 0x71}, 8918c2ecf20Sopenharmony_ci {0x3d8d, 0xea}, 8928c2ecf20Sopenharmony_ci {0x4017, 0x10}, 8938c2ecf20Sopenharmony_ci {0x3618, 0x2a}, 8948c2ecf20Sopenharmony_ci {0x5780, 0x3e}, 8958c2ecf20Sopenharmony_ci {0x5781, 0x0f}, 8968c2ecf20Sopenharmony_ci {0x5782, 0x44}, 8978c2ecf20Sopenharmony_ci {0x5783, 0x02}, 8988c2ecf20Sopenharmony_ci {0x5784, 0x01}, 8998c2ecf20Sopenharmony_ci {0x5785, 0x01}, 9008c2ecf20Sopenharmony_ci {0x5786, 0x00}, 9018c2ecf20Sopenharmony_ci {0x5787, 0x04}, 9028c2ecf20Sopenharmony_ci {0x5788, 0x02}, 9038c2ecf20Sopenharmony_ci {0x5789, 0x0f}, 9048c2ecf20Sopenharmony_ci {0x578a, 0xfd}, 9058c2ecf20Sopenharmony_ci {0x578b, 0xf5}, 9068c2ecf20Sopenharmony_ci {0x578c, 0xf5}, 9078c2ecf20Sopenharmony_ci {0x578d, 0x03}, 9088c2ecf20Sopenharmony_ci {0x578e, 0x08}, 9098c2ecf20Sopenharmony_ci {0x578f, 0x0c}, 9108c2ecf20Sopenharmony_ci {0x5790, 0x08}, 9118c2ecf20Sopenharmony_ci {0x5791, 0x06}, 9128c2ecf20Sopenharmony_ci {0x5792, 0x00}, 9138c2ecf20Sopenharmony_ci {0x5793, 0x52}, 9148c2ecf20Sopenharmony_ci {0x5794, 0xa3}, 9158c2ecf20Sopenharmony_ci {0x3503, 0x00}, 9168c2ecf20Sopenharmony_ci {0x5045, 0x05}, 9178c2ecf20Sopenharmony_ci {0x4003, 0x40}, 9188c2ecf20Sopenharmony_ci {0x5048, 0x40} 9198c2ecf20Sopenharmony_ci}; 9208c2ecf20Sopenharmony_ci 9218c2ecf20Sopenharmony_cistatic const struct ov5670_reg mode_2560x1440_regs[] = { 9228c2ecf20Sopenharmony_ci {0x3000, 0x00}, 9238c2ecf20Sopenharmony_ci {0x3002, 0x21}, 9248c2ecf20Sopenharmony_ci {0x3005, 0xf0}, 9258c2ecf20Sopenharmony_ci {0x3007, 0x00}, 9268c2ecf20Sopenharmony_ci {0x3015, 0x0f}, 9278c2ecf20Sopenharmony_ci {0x3018, 0x32}, 9288c2ecf20Sopenharmony_ci {0x301a, 0xf0}, 9298c2ecf20Sopenharmony_ci {0x301b, 0xf0}, 9308c2ecf20Sopenharmony_ci {0x301c, 0xf0}, 9318c2ecf20Sopenharmony_ci {0x301d, 0xf0}, 9328c2ecf20Sopenharmony_ci {0x301e, 0xf0}, 9338c2ecf20Sopenharmony_ci {0x3030, 0x00}, 9348c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 9358c2ecf20Sopenharmony_ci {0x303c, 0xff}, 9368c2ecf20Sopenharmony_ci {0x303e, 0xff}, 9378c2ecf20Sopenharmony_ci {0x3040, 0xf0}, 9388c2ecf20Sopenharmony_ci {0x3041, 0x00}, 9398c2ecf20Sopenharmony_ci {0x3042, 0xf0}, 9408c2ecf20Sopenharmony_ci {0x3106, 0x11}, 9418c2ecf20Sopenharmony_ci {0x3500, 0x00}, 9428c2ecf20Sopenharmony_ci {0x3501, 0x80}, 9438c2ecf20Sopenharmony_ci {0x3502, 0x00}, 9448c2ecf20Sopenharmony_ci {0x3503, 0x04}, 9458c2ecf20Sopenharmony_ci {0x3504, 0x03}, 9468c2ecf20Sopenharmony_ci {0x3505, 0x83}, 9478c2ecf20Sopenharmony_ci {0x3508, 0x04}, 9488c2ecf20Sopenharmony_ci {0x3509, 0x00}, 9498c2ecf20Sopenharmony_ci {0x350e, 0x04}, 9508c2ecf20Sopenharmony_ci {0x350f, 0x00}, 9518c2ecf20Sopenharmony_ci {0x3510, 0x00}, 9528c2ecf20Sopenharmony_ci {0x3511, 0x02}, 9538c2ecf20Sopenharmony_ci {0x3512, 0x00}, 9548c2ecf20Sopenharmony_ci {0x3601, 0xc8}, 9558c2ecf20Sopenharmony_ci {0x3610, 0x88}, 9568c2ecf20Sopenharmony_ci {0x3612, 0x48}, 9578c2ecf20Sopenharmony_ci {0x3614, 0x5b}, 9588c2ecf20Sopenharmony_ci {0x3615, 0x96}, 9598c2ecf20Sopenharmony_ci {0x3621, 0xd0}, 9608c2ecf20Sopenharmony_ci {0x3622, 0x00}, 9618c2ecf20Sopenharmony_ci {0x3623, 0x00}, 9628c2ecf20Sopenharmony_ci {0x3633, 0x13}, 9638c2ecf20Sopenharmony_ci {0x3634, 0x13}, 9648c2ecf20Sopenharmony_ci {0x3635, 0x13}, 9658c2ecf20Sopenharmony_ci {0x3636, 0x13}, 9668c2ecf20Sopenharmony_ci {0x3645, 0x13}, 9678c2ecf20Sopenharmony_ci {0x3646, 0x82}, 9688c2ecf20Sopenharmony_ci {0x3650, 0x00}, 9698c2ecf20Sopenharmony_ci {0x3652, 0xff}, 9708c2ecf20Sopenharmony_ci {0x3655, 0x20}, 9718c2ecf20Sopenharmony_ci {0x3656, 0xff}, 9728c2ecf20Sopenharmony_ci {0x365a, 0xff}, 9738c2ecf20Sopenharmony_ci {0x365e, 0xff}, 9748c2ecf20Sopenharmony_ci {0x3668, 0x00}, 9758c2ecf20Sopenharmony_ci {0x366a, 0x07}, 9768c2ecf20Sopenharmony_ci {0x366e, 0x10}, 9778c2ecf20Sopenharmony_ci {0x366d, 0x00}, 9788c2ecf20Sopenharmony_ci {0x366f, 0x80}, 9798c2ecf20Sopenharmony_ci {0x3700, 0x28}, 9808c2ecf20Sopenharmony_ci {0x3701, 0x10}, 9818c2ecf20Sopenharmony_ci {0x3702, 0x3a}, 9828c2ecf20Sopenharmony_ci {0x3703, 0x19}, 9838c2ecf20Sopenharmony_ci {0x3704, 0x10}, 9848c2ecf20Sopenharmony_ci {0x3705, 0x00}, 9858c2ecf20Sopenharmony_ci {0x3706, 0x66}, 9868c2ecf20Sopenharmony_ci {0x3707, 0x08}, 9878c2ecf20Sopenharmony_ci {0x3708, 0x34}, 9888c2ecf20Sopenharmony_ci {0x3709, 0x40}, 9898c2ecf20Sopenharmony_ci {0x370a, 0x01}, 9908c2ecf20Sopenharmony_ci {0x370b, 0x1b}, 9918c2ecf20Sopenharmony_ci {0x3714, 0x24}, 9928c2ecf20Sopenharmony_ci {0x371a, 0x3e}, 9938c2ecf20Sopenharmony_ci {0x3733, 0x00}, 9948c2ecf20Sopenharmony_ci {0x3734, 0x00}, 9958c2ecf20Sopenharmony_ci {0x373a, 0x05}, 9968c2ecf20Sopenharmony_ci {0x373b, 0x06}, 9978c2ecf20Sopenharmony_ci {0x373c, 0x0a}, 9988c2ecf20Sopenharmony_ci {0x373f, 0xa0}, 9998c2ecf20Sopenharmony_ci {0x3755, 0x00}, 10008c2ecf20Sopenharmony_ci {0x3758, 0x00}, 10018c2ecf20Sopenharmony_ci {0x375b, 0x0e}, 10028c2ecf20Sopenharmony_ci {0x3766, 0x5f}, 10038c2ecf20Sopenharmony_ci {0x3768, 0x00}, 10048c2ecf20Sopenharmony_ci {0x3769, 0x22}, 10058c2ecf20Sopenharmony_ci {0x3773, 0x08}, 10068c2ecf20Sopenharmony_ci {0x3774, 0x1f}, 10078c2ecf20Sopenharmony_ci {0x3776, 0x06}, 10088c2ecf20Sopenharmony_ci {0x37a0, 0x88}, 10098c2ecf20Sopenharmony_ci {0x37a1, 0x5c}, 10108c2ecf20Sopenharmony_ci {0x37a7, 0x88}, 10118c2ecf20Sopenharmony_ci {0x37a8, 0x70}, 10128c2ecf20Sopenharmony_ci {0x37aa, 0x88}, 10138c2ecf20Sopenharmony_ci {0x37ab, 0x48}, 10148c2ecf20Sopenharmony_ci {0x37b3, 0x66}, 10158c2ecf20Sopenharmony_ci {0x37c2, 0x04}, 10168c2ecf20Sopenharmony_ci {0x37c5, 0x00}, 10178c2ecf20Sopenharmony_ci {0x37c8, 0x00}, 10188c2ecf20Sopenharmony_ci {0x3800, 0x00}, 10198c2ecf20Sopenharmony_ci {0x3801, 0x0c}, 10208c2ecf20Sopenharmony_ci {0x3802, 0x00}, 10218c2ecf20Sopenharmony_ci {0x3803, 0x04}, 10228c2ecf20Sopenharmony_ci {0x3804, 0x0a}, 10238c2ecf20Sopenharmony_ci {0x3805, 0x33}, 10248c2ecf20Sopenharmony_ci {0x3806, 0x07}, 10258c2ecf20Sopenharmony_ci {0x3807, 0xa3}, 10268c2ecf20Sopenharmony_ci {0x3808, 0x0a}, 10278c2ecf20Sopenharmony_ci {0x3809, 0x00}, 10288c2ecf20Sopenharmony_ci {0x380a, 0x05}, 10298c2ecf20Sopenharmony_ci {0x380b, 0xa0}, 10308c2ecf20Sopenharmony_ci {0x380c, 0x06}, 10318c2ecf20Sopenharmony_ci {0x380d, 0x90}, 10328c2ecf20Sopenharmony_ci {0x380e, 0x08}, 10338c2ecf20Sopenharmony_ci {0x380f, 0x08}, 10348c2ecf20Sopenharmony_ci {0x3811, 0x04}, 10358c2ecf20Sopenharmony_ci {0x3813, 0x02}, 10368c2ecf20Sopenharmony_ci {0x3814, 0x01}, 10378c2ecf20Sopenharmony_ci {0x3815, 0x01}, 10388c2ecf20Sopenharmony_ci {0x3816, 0x00}, 10398c2ecf20Sopenharmony_ci {0x3817, 0x00}, 10408c2ecf20Sopenharmony_ci {0x3818, 0x00}, 10418c2ecf20Sopenharmony_ci {0x3819, 0x00}, 10428c2ecf20Sopenharmony_ci {0x3820, 0x84}, 10438c2ecf20Sopenharmony_ci {0x3821, 0x46}, 10448c2ecf20Sopenharmony_ci {0x3822, 0x48}, 10458c2ecf20Sopenharmony_ci {0x3826, 0x00}, 10468c2ecf20Sopenharmony_ci {0x3827, 0x08}, 10478c2ecf20Sopenharmony_ci {0x382a, 0x01}, 10488c2ecf20Sopenharmony_ci {0x382b, 0x01}, 10498c2ecf20Sopenharmony_ci {0x3830, 0x08}, 10508c2ecf20Sopenharmony_ci {0x3836, 0x02}, 10518c2ecf20Sopenharmony_ci {0x3837, 0x00}, 10528c2ecf20Sopenharmony_ci {0x3838, 0x10}, 10538c2ecf20Sopenharmony_ci {0x3841, 0xff}, 10548c2ecf20Sopenharmony_ci {0x3846, 0x48}, 10558c2ecf20Sopenharmony_ci {0x3861, 0x00}, 10568c2ecf20Sopenharmony_ci {0x3862, 0x04}, 10578c2ecf20Sopenharmony_ci {0x3863, 0x06}, 10588c2ecf20Sopenharmony_ci {0x3a11, 0x01}, 10598c2ecf20Sopenharmony_ci {0x3a12, 0x78}, 10608c2ecf20Sopenharmony_ci {0x3b00, 0x00}, 10618c2ecf20Sopenharmony_ci {0x3b02, 0x00}, 10628c2ecf20Sopenharmony_ci {0x3b03, 0x00}, 10638c2ecf20Sopenharmony_ci {0x3b04, 0x00}, 10648c2ecf20Sopenharmony_ci {0x3b05, 0x00}, 10658c2ecf20Sopenharmony_ci {0x3c00, 0x89}, 10668c2ecf20Sopenharmony_ci {0x3c01, 0xab}, 10678c2ecf20Sopenharmony_ci {0x3c02, 0x01}, 10688c2ecf20Sopenharmony_ci {0x3c03, 0x00}, 10698c2ecf20Sopenharmony_ci {0x3c04, 0x00}, 10708c2ecf20Sopenharmony_ci {0x3c05, 0x03}, 10718c2ecf20Sopenharmony_ci {0x3c06, 0x00}, 10728c2ecf20Sopenharmony_ci {0x3c07, 0x05}, 10738c2ecf20Sopenharmony_ci {0x3c0c, 0x00}, 10748c2ecf20Sopenharmony_ci {0x3c0d, 0x00}, 10758c2ecf20Sopenharmony_ci {0x3c0e, 0x00}, 10768c2ecf20Sopenharmony_ci {0x3c0f, 0x00}, 10778c2ecf20Sopenharmony_ci {0x3c40, 0x00}, 10788c2ecf20Sopenharmony_ci {0x3c41, 0xa3}, 10798c2ecf20Sopenharmony_ci {0x3c43, 0x7d}, 10808c2ecf20Sopenharmony_ci {0x3c45, 0xd7}, 10818c2ecf20Sopenharmony_ci {0x3c47, 0xfc}, 10828c2ecf20Sopenharmony_ci {0x3c50, 0x05}, 10838c2ecf20Sopenharmony_ci {0x3c52, 0xaa}, 10848c2ecf20Sopenharmony_ci {0x3c54, 0x71}, 10858c2ecf20Sopenharmony_ci {0x3c56, 0x80}, 10868c2ecf20Sopenharmony_ci {0x3d85, 0x17}, 10878c2ecf20Sopenharmony_ci {0x3f03, 0x00}, 10888c2ecf20Sopenharmony_ci {0x3f0a, 0x00}, 10898c2ecf20Sopenharmony_ci {0x3f0b, 0x00}, 10908c2ecf20Sopenharmony_ci {0x4001, 0x60}, 10918c2ecf20Sopenharmony_ci {0x4009, 0x0d}, 10928c2ecf20Sopenharmony_ci {0x4020, 0x00}, 10938c2ecf20Sopenharmony_ci {0x4021, 0x00}, 10948c2ecf20Sopenharmony_ci {0x4022, 0x00}, 10958c2ecf20Sopenharmony_ci {0x4023, 0x00}, 10968c2ecf20Sopenharmony_ci {0x4024, 0x00}, 10978c2ecf20Sopenharmony_ci {0x4025, 0x00}, 10988c2ecf20Sopenharmony_ci {0x4026, 0x00}, 10998c2ecf20Sopenharmony_ci {0x4027, 0x00}, 11008c2ecf20Sopenharmony_ci {0x4028, 0x00}, 11018c2ecf20Sopenharmony_ci {0x4029, 0x00}, 11028c2ecf20Sopenharmony_ci {0x402a, 0x00}, 11038c2ecf20Sopenharmony_ci {0x402b, 0x00}, 11048c2ecf20Sopenharmony_ci {0x402c, 0x00}, 11058c2ecf20Sopenharmony_ci {0x402d, 0x00}, 11068c2ecf20Sopenharmony_ci {0x402e, 0x00}, 11078c2ecf20Sopenharmony_ci {0x402f, 0x00}, 11088c2ecf20Sopenharmony_ci {0x4040, 0x00}, 11098c2ecf20Sopenharmony_ci {0x4041, 0x03}, 11108c2ecf20Sopenharmony_ci {0x4042, 0x00}, 11118c2ecf20Sopenharmony_ci {0x4043, 0x7A}, 11128c2ecf20Sopenharmony_ci {0x4044, 0x00}, 11138c2ecf20Sopenharmony_ci {0x4045, 0x7A}, 11148c2ecf20Sopenharmony_ci {0x4046, 0x00}, 11158c2ecf20Sopenharmony_ci {0x4047, 0x7A}, 11168c2ecf20Sopenharmony_ci {0x4048, 0x00}, 11178c2ecf20Sopenharmony_ci {0x4049, 0x7A}, 11188c2ecf20Sopenharmony_ci {0x4307, 0x30}, 11198c2ecf20Sopenharmony_ci {0x4500, 0x58}, 11208c2ecf20Sopenharmony_ci {0x4501, 0x04}, 11218c2ecf20Sopenharmony_ci {0x4502, 0x40}, 11228c2ecf20Sopenharmony_ci {0x4503, 0x10}, 11238c2ecf20Sopenharmony_ci {0x4508, 0xaa}, 11248c2ecf20Sopenharmony_ci {0x4509, 0xaa}, 11258c2ecf20Sopenharmony_ci {0x450a, 0x00}, 11268c2ecf20Sopenharmony_ci {0x450b, 0x00}, 11278c2ecf20Sopenharmony_ci {0x4600, 0x01}, 11288c2ecf20Sopenharmony_ci {0x4601, 0x00}, 11298c2ecf20Sopenharmony_ci {0x4700, 0xa4}, 11308c2ecf20Sopenharmony_ci {0x4800, 0x4c}, 11318c2ecf20Sopenharmony_ci {0x4816, 0x53}, 11328c2ecf20Sopenharmony_ci {0x481f, 0x40}, 11338c2ecf20Sopenharmony_ci {0x4837, 0x13}, 11348c2ecf20Sopenharmony_ci {0x5000, 0x56}, 11358c2ecf20Sopenharmony_ci {0x5001, 0x01}, 11368c2ecf20Sopenharmony_ci {0x5002, 0x28}, 11378c2ecf20Sopenharmony_ci {0x5004, 0x0c}, 11388c2ecf20Sopenharmony_ci {0x5006, 0x0c}, 11398c2ecf20Sopenharmony_ci {0x5007, 0xe0}, 11408c2ecf20Sopenharmony_ci {0x5008, 0x01}, 11418c2ecf20Sopenharmony_ci {0x5009, 0xb0}, 11428c2ecf20Sopenharmony_ci {0x5901, 0x00}, 11438c2ecf20Sopenharmony_ci {0x5a01, 0x00}, 11448c2ecf20Sopenharmony_ci {0x5a03, 0x00}, 11458c2ecf20Sopenharmony_ci {0x5a04, 0x0c}, 11468c2ecf20Sopenharmony_ci {0x5a05, 0xe0}, 11478c2ecf20Sopenharmony_ci {0x5a06, 0x09}, 11488c2ecf20Sopenharmony_ci {0x5a07, 0xb0}, 11498c2ecf20Sopenharmony_ci {0x5a08, 0x06}, 11508c2ecf20Sopenharmony_ci {0x5e00, 0x00}, 11518c2ecf20Sopenharmony_ci {0x3734, 0x40}, 11528c2ecf20Sopenharmony_ci {0x5b00, 0x01}, 11538c2ecf20Sopenharmony_ci {0x5b01, 0x10}, 11548c2ecf20Sopenharmony_ci {0x5b02, 0x01}, 11558c2ecf20Sopenharmony_ci {0x5b03, 0xdb}, 11568c2ecf20Sopenharmony_ci {0x3d8c, 0x71}, 11578c2ecf20Sopenharmony_ci {0x3d8d, 0xea}, 11588c2ecf20Sopenharmony_ci {0x4017, 0x08}, 11598c2ecf20Sopenharmony_ci {0x3618, 0x2a}, 11608c2ecf20Sopenharmony_ci {0x5780, 0x3e}, 11618c2ecf20Sopenharmony_ci {0x5781, 0x0f}, 11628c2ecf20Sopenharmony_ci {0x5782, 0x44}, 11638c2ecf20Sopenharmony_ci {0x5783, 0x02}, 11648c2ecf20Sopenharmony_ci {0x5784, 0x01}, 11658c2ecf20Sopenharmony_ci {0x5785, 0x01}, 11668c2ecf20Sopenharmony_ci {0x5786, 0x00}, 11678c2ecf20Sopenharmony_ci {0x5787, 0x04}, 11688c2ecf20Sopenharmony_ci {0x5788, 0x02}, 11698c2ecf20Sopenharmony_ci {0x5789, 0x0f}, 11708c2ecf20Sopenharmony_ci {0x578a, 0xfd}, 11718c2ecf20Sopenharmony_ci {0x578b, 0xf5}, 11728c2ecf20Sopenharmony_ci {0x578c, 0xf5}, 11738c2ecf20Sopenharmony_ci {0x578d, 0x03}, 11748c2ecf20Sopenharmony_ci {0x578e, 0x08}, 11758c2ecf20Sopenharmony_ci {0x578f, 0x0c}, 11768c2ecf20Sopenharmony_ci {0x5790, 0x08}, 11778c2ecf20Sopenharmony_ci {0x5791, 0x06}, 11788c2ecf20Sopenharmony_ci {0x5792, 0x00}, 11798c2ecf20Sopenharmony_ci {0x5793, 0x52}, 11808c2ecf20Sopenharmony_ci {0x5794, 0xa3}, 11818c2ecf20Sopenharmony_ci {0x5045, 0x05}, 11828c2ecf20Sopenharmony_ci {0x4003, 0x40}, 11838c2ecf20Sopenharmony_ci {0x5048, 0x40} 11848c2ecf20Sopenharmony_ci}; 11858c2ecf20Sopenharmony_ci 11868c2ecf20Sopenharmony_cistatic const struct ov5670_reg mode_1280x720_regs[] = { 11878c2ecf20Sopenharmony_ci {0x3000, 0x00}, 11888c2ecf20Sopenharmony_ci {0x3002, 0x21}, 11898c2ecf20Sopenharmony_ci {0x3005, 0xf0}, 11908c2ecf20Sopenharmony_ci {0x3007, 0x00}, 11918c2ecf20Sopenharmony_ci {0x3015, 0x0f}, 11928c2ecf20Sopenharmony_ci {0x3018, 0x32}, 11938c2ecf20Sopenharmony_ci {0x301a, 0xf0}, 11948c2ecf20Sopenharmony_ci {0x301b, 0xf0}, 11958c2ecf20Sopenharmony_ci {0x301c, 0xf0}, 11968c2ecf20Sopenharmony_ci {0x301d, 0xf0}, 11978c2ecf20Sopenharmony_ci {0x301e, 0xf0}, 11988c2ecf20Sopenharmony_ci {0x3030, 0x00}, 11998c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 12008c2ecf20Sopenharmony_ci {0x303c, 0xff}, 12018c2ecf20Sopenharmony_ci {0x303e, 0xff}, 12028c2ecf20Sopenharmony_ci {0x3040, 0xf0}, 12038c2ecf20Sopenharmony_ci {0x3041, 0x00}, 12048c2ecf20Sopenharmony_ci {0x3042, 0xf0}, 12058c2ecf20Sopenharmony_ci {0x3106, 0x11}, 12068c2ecf20Sopenharmony_ci {0x3500, 0x00}, 12078c2ecf20Sopenharmony_ci {0x3501, 0x80}, 12088c2ecf20Sopenharmony_ci {0x3502, 0x00}, 12098c2ecf20Sopenharmony_ci {0x3503, 0x04}, 12108c2ecf20Sopenharmony_ci {0x3504, 0x03}, 12118c2ecf20Sopenharmony_ci {0x3505, 0x83}, 12128c2ecf20Sopenharmony_ci {0x3508, 0x04}, 12138c2ecf20Sopenharmony_ci {0x3509, 0x00}, 12148c2ecf20Sopenharmony_ci {0x350e, 0x04}, 12158c2ecf20Sopenharmony_ci {0x350f, 0x00}, 12168c2ecf20Sopenharmony_ci {0x3510, 0x00}, 12178c2ecf20Sopenharmony_ci {0x3511, 0x02}, 12188c2ecf20Sopenharmony_ci {0x3512, 0x00}, 12198c2ecf20Sopenharmony_ci {0x3601, 0xc8}, 12208c2ecf20Sopenharmony_ci {0x3610, 0x88}, 12218c2ecf20Sopenharmony_ci {0x3612, 0x48}, 12228c2ecf20Sopenharmony_ci {0x3614, 0x5b}, 12238c2ecf20Sopenharmony_ci {0x3615, 0x96}, 12248c2ecf20Sopenharmony_ci {0x3621, 0xd0}, 12258c2ecf20Sopenharmony_ci {0x3622, 0x00}, 12268c2ecf20Sopenharmony_ci {0x3623, 0x00}, 12278c2ecf20Sopenharmony_ci {0x3633, 0x13}, 12288c2ecf20Sopenharmony_ci {0x3634, 0x13}, 12298c2ecf20Sopenharmony_ci {0x3635, 0x13}, 12308c2ecf20Sopenharmony_ci {0x3636, 0x13}, 12318c2ecf20Sopenharmony_ci {0x3645, 0x13}, 12328c2ecf20Sopenharmony_ci {0x3646, 0x82}, 12338c2ecf20Sopenharmony_ci {0x3650, 0x00}, 12348c2ecf20Sopenharmony_ci {0x3652, 0xff}, 12358c2ecf20Sopenharmony_ci {0x3655, 0x20}, 12368c2ecf20Sopenharmony_ci {0x3656, 0xff}, 12378c2ecf20Sopenharmony_ci {0x365a, 0xff}, 12388c2ecf20Sopenharmony_ci {0x365e, 0xff}, 12398c2ecf20Sopenharmony_ci {0x3668, 0x00}, 12408c2ecf20Sopenharmony_ci {0x366a, 0x07}, 12418c2ecf20Sopenharmony_ci {0x366e, 0x08}, 12428c2ecf20Sopenharmony_ci {0x366d, 0x00}, 12438c2ecf20Sopenharmony_ci {0x366f, 0x80}, 12448c2ecf20Sopenharmony_ci {0x3700, 0x28}, 12458c2ecf20Sopenharmony_ci {0x3701, 0x10}, 12468c2ecf20Sopenharmony_ci {0x3702, 0x3a}, 12478c2ecf20Sopenharmony_ci {0x3703, 0x19}, 12488c2ecf20Sopenharmony_ci {0x3704, 0x10}, 12498c2ecf20Sopenharmony_ci {0x3705, 0x00}, 12508c2ecf20Sopenharmony_ci {0x3706, 0x66}, 12518c2ecf20Sopenharmony_ci {0x3707, 0x08}, 12528c2ecf20Sopenharmony_ci {0x3708, 0x34}, 12538c2ecf20Sopenharmony_ci {0x3709, 0x40}, 12548c2ecf20Sopenharmony_ci {0x370a, 0x01}, 12558c2ecf20Sopenharmony_ci {0x370b, 0x1b}, 12568c2ecf20Sopenharmony_ci {0x3714, 0x24}, 12578c2ecf20Sopenharmony_ci {0x371a, 0x3e}, 12588c2ecf20Sopenharmony_ci {0x3733, 0x00}, 12598c2ecf20Sopenharmony_ci {0x3734, 0x00}, 12608c2ecf20Sopenharmony_ci {0x373a, 0x05}, 12618c2ecf20Sopenharmony_ci {0x373b, 0x06}, 12628c2ecf20Sopenharmony_ci {0x373c, 0x0a}, 12638c2ecf20Sopenharmony_ci {0x373f, 0xa0}, 12648c2ecf20Sopenharmony_ci {0x3755, 0x00}, 12658c2ecf20Sopenharmony_ci {0x3758, 0x00}, 12668c2ecf20Sopenharmony_ci {0x375b, 0x0e}, 12678c2ecf20Sopenharmony_ci {0x3766, 0x5f}, 12688c2ecf20Sopenharmony_ci {0x3768, 0x00}, 12698c2ecf20Sopenharmony_ci {0x3769, 0x22}, 12708c2ecf20Sopenharmony_ci {0x3773, 0x08}, 12718c2ecf20Sopenharmony_ci {0x3774, 0x1f}, 12728c2ecf20Sopenharmony_ci {0x3776, 0x06}, 12738c2ecf20Sopenharmony_ci {0x37a0, 0x88}, 12748c2ecf20Sopenharmony_ci {0x37a1, 0x5c}, 12758c2ecf20Sopenharmony_ci {0x37a7, 0x88}, 12768c2ecf20Sopenharmony_ci {0x37a8, 0x70}, 12778c2ecf20Sopenharmony_ci {0x37aa, 0x88}, 12788c2ecf20Sopenharmony_ci {0x37ab, 0x48}, 12798c2ecf20Sopenharmony_ci {0x37b3, 0x66}, 12808c2ecf20Sopenharmony_ci {0x37c2, 0x04}, 12818c2ecf20Sopenharmony_ci {0x37c5, 0x00}, 12828c2ecf20Sopenharmony_ci {0x37c8, 0x00}, 12838c2ecf20Sopenharmony_ci {0x3800, 0x00}, 12848c2ecf20Sopenharmony_ci {0x3801, 0x0c}, 12858c2ecf20Sopenharmony_ci {0x3802, 0x00}, 12868c2ecf20Sopenharmony_ci {0x3803, 0x04}, 12878c2ecf20Sopenharmony_ci {0x3804, 0x0a}, 12888c2ecf20Sopenharmony_ci {0x3805, 0x33}, 12898c2ecf20Sopenharmony_ci {0x3806, 0x07}, 12908c2ecf20Sopenharmony_ci {0x3807, 0xa3}, 12918c2ecf20Sopenharmony_ci {0x3808, 0x05}, 12928c2ecf20Sopenharmony_ci {0x3809, 0x00}, 12938c2ecf20Sopenharmony_ci {0x380a, 0x02}, 12948c2ecf20Sopenharmony_ci {0x380b, 0xd0}, 12958c2ecf20Sopenharmony_ci {0x380c, 0x06}, 12968c2ecf20Sopenharmony_ci {0x380d, 0x90}, 12978c2ecf20Sopenharmony_ci {0x380e, 0x08}, 12988c2ecf20Sopenharmony_ci {0x380f, 0x08}, 12998c2ecf20Sopenharmony_ci {0x3811, 0x04}, 13008c2ecf20Sopenharmony_ci {0x3813, 0x02}, 13018c2ecf20Sopenharmony_ci {0x3814, 0x03}, 13028c2ecf20Sopenharmony_ci {0x3815, 0x01}, 13038c2ecf20Sopenharmony_ci {0x3816, 0x00}, 13048c2ecf20Sopenharmony_ci {0x3817, 0x00}, 13058c2ecf20Sopenharmony_ci {0x3818, 0x00}, 13068c2ecf20Sopenharmony_ci {0x3819, 0x00}, 13078c2ecf20Sopenharmony_ci {0x3820, 0x94}, 13088c2ecf20Sopenharmony_ci {0x3821, 0x47}, 13098c2ecf20Sopenharmony_ci {0x3822, 0x48}, 13108c2ecf20Sopenharmony_ci {0x3826, 0x00}, 13118c2ecf20Sopenharmony_ci {0x3827, 0x08}, 13128c2ecf20Sopenharmony_ci {0x382a, 0x03}, 13138c2ecf20Sopenharmony_ci {0x382b, 0x01}, 13148c2ecf20Sopenharmony_ci {0x3830, 0x08}, 13158c2ecf20Sopenharmony_ci {0x3836, 0x02}, 13168c2ecf20Sopenharmony_ci {0x3837, 0x00}, 13178c2ecf20Sopenharmony_ci {0x3838, 0x10}, 13188c2ecf20Sopenharmony_ci {0x3841, 0xff}, 13198c2ecf20Sopenharmony_ci {0x3846, 0x48}, 13208c2ecf20Sopenharmony_ci {0x3861, 0x00}, 13218c2ecf20Sopenharmony_ci {0x3862, 0x04}, 13228c2ecf20Sopenharmony_ci {0x3863, 0x06}, 13238c2ecf20Sopenharmony_ci {0x3a11, 0x01}, 13248c2ecf20Sopenharmony_ci {0x3a12, 0x78}, 13258c2ecf20Sopenharmony_ci {0x3b00, 0x00}, 13268c2ecf20Sopenharmony_ci {0x3b02, 0x00}, 13278c2ecf20Sopenharmony_ci {0x3b03, 0x00}, 13288c2ecf20Sopenharmony_ci {0x3b04, 0x00}, 13298c2ecf20Sopenharmony_ci {0x3b05, 0x00}, 13308c2ecf20Sopenharmony_ci {0x3c00, 0x89}, 13318c2ecf20Sopenharmony_ci {0x3c01, 0xab}, 13328c2ecf20Sopenharmony_ci {0x3c02, 0x01}, 13338c2ecf20Sopenharmony_ci {0x3c03, 0x00}, 13348c2ecf20Sopenharmony_ci {0x3c04, 0x00}, 13358c2ecf20Sopenharmony_ci {0x3c05, 0x03}, 13368c2ecf20Sopenharmony_ci {0x3c06, 0x00}, 13378c2ecf20Sopenharmony_ci {0x3c07, 0x05}, 13388c2ecf20Sopenharmony_ci {0x3c0c, 0x00}, 13398c2ecf20Sopenharmony_ci {0x3c0d, 0x00}, 13408c2ecf20Sopenharmony_ci {0x3c0e, 0x00}, 13418c2ecf20Sopenharmony_ci {0x3c0f, 0x00}, 13428c2ecf20Sopenharmony_ci {0x3c40, 0x00}, 13438c2ecf20Sopenharmony_ci {0x3c41, 0xa3}, 13448c2ecf20Sopenharmony_ci {0x3c43, 0x7d}, 13458c2ecf20Sopenharmony_ci {0x3c45, 0xd7}, 13468c2ecf20Sopenharmony_ci {0x3c47, 0xfc}, 13478c2ecf20Sopenharmony_ci {0x3c50, 0x05}, 13488c2ecf20Sopenharmony_ci {0x3c52, 0xaa}, 13498c2ecf20Sopenharmony_ci {0x3c54, 0x71}, 13508c2ecf20Sopenharmony_ci {0x3c56, 0x80}, 13518c2ecf20Sopenharmony_ci {0x3d85, 0x17}, 13528c2ecf20Sopenharmony_ci {0x3f03, 0x00}, 13538c2ecf20Sopenharmony_ci {0x3f0a, 0x00}, 13548c2ecf20Sopenharmony_ci {0x3f0b, 0x00}, 13558c2ecf20Sopenharmony_ci {0x4001, 0x60}, 13568c2ecf20Sopenharmony_ci {0x4009, 0x05}, 13578c2ecf20Sopenharmony_ci {0x4020, 0x00}, 13588c2ecf20Sopenharmony_ci {0x4021, 0x00}, 13598c2ecf20Sopenharmony_ci {0x4022, 0x00}, 13608c2ecf20Sopenharmony_ci {0x4023, 0x00}, 13618c2ecf20Sopenharmony_ci {0x4024, 0x00}, 13628c2ecf20Sopenharmony_ci {0x4025, 0x00}, 13638c2ecf20Sopenharmony_ci {0x4026, 0x00}, 13648c2ecf20Sopenharmony_ci {0x4027, 0x00}, 13658c2ecf20Sopenharmony_ci {0x4028, 0x00}, 13668c2ecf20Sopenharmony_ci {0x4029, 0x00}, 13678c2ecf20Sopenharmony_ci {0x402a, 0x00}, 13688c2ecf20Sopenharmony_ci {0x402b, 0x00}, 13698c2ecf20Sopenharmony_ci {0x402c, 0x00}, 13708c2ecf20Sopenharmony_ci {0x402d, 0x00}, 13718c2ecf20Sopenharmony_ci {0x402e, 0x00}, 13728c2ecf20Sopenharmony_ci {0x402f, 0x00}, 13738c2ecf20Sopenharmony_ci {0x4040, 0x00}, 13748c2ecf20Sopenharmony_ci {0x4041, 0x03}, 13758c2ecf20Sopenharmony_ci {0x4042, 0x00}, 13768c2ecf20Sopenharmony_ci {0x4043, 0x7A}, 13778c2ecf20Sopenharmony_ci {0x4044, 0x00}, 13788c2ecf20Sopenharmony_ci {0x4045, 0x7A}, 13798c2ecf20Sopenharmony_ci {0x4046, 0x00}, 13808c2ecf20Sopenharmony_ci {0x4047, 0x7A}, 13818c2ecf20Sopenharmony_ci {0x4048, 0x00}, 13828c2ecf20Sopenharmony_ci {0x4049, 0x7A}, 13838c2ecf20Sopenharmony_ci {0x4307, 0x30}, 13848c2ecf20Sopenharmony_ci {0x4500, 0x58}, 13858c2ecf20Sopenharmony_ci {0x4501, 0x04}, 13868c2ecf20Sopenharmony_ci {0x4502, 0x48}, 13878c2ecf20Sopenharmony_ci {0x4503, 0x10}, 13888c2ecf20Sopenharmony_ci {0x4508, 0x55}, 13898c2ecf20Sopenharmony_ci {0x4509, 0x55}, 13908c2ecf20Sopenharmony_ci {0x450a, 0x00}, 13918c2ecf20Sopenharmony_ci {0x450b, 0x00}, 13928c2ecf20Sopenharmony_ci {0x4600, 0x00}, 13938c2ecf20Sopenharmony_ci {0x4601, 0x80}, 13948c2ecf20Sopenharmony_ci {0x4700, 0xa4}, 13958c2ecf20Sopenharmony_ci {0x4800, 0x4c}, 13968c2ecf20Sopenharmony_ci {0x4816, 0x53}, 13978c2ecf20Sopenharmony_ci {0x481f, 0x40}, 13988c2ecf20Sopenharmony_ci {0x4837, 0x13}, 13998c2ecf20Sopenharmony_ci {0x5000, 0x56}, 14008c2ecf20Sopenharmony_ci {0x5001, 0x01}, 14018c2ecf20Sopenharmony_ci {0x5002, 0x28}, 14028c2ecf20Sopenharmony_ci {0x5004, 0x0c}, 14038c2ecf20Sopenharmony_ci {0x5006, 0x0c}, 14048c2ecf20Sopenharmony_ci {0x5007, 0xe0}, 14058c2ecf20Sopenharmony_ci {0x5008, 0x01}, 14068c2ecf20Sopenharmony_ci {0x5009, 0xb0}, 14078c2ecf20Sopenharmony_ci {0x5901, 0x00}, 14088c2ecf20Sopenharmony_ci {0x5a01, 0x00}, 14098c2ecf20Sopenharmony_ci {0x5a03, 0x00}, 14108c2ecf20Sopenharmony_ci {0x5a04, 0x0c}, 14118c2ecf20Sopenharmony_ci {0x5a05, 0xe0}, 14128c2ecf20Sopenharmony_ci {0x5a06, 0x09}, 14138c2ecf20Sopenharmony_ci {0x5a07, 0xb0}, 14148c2ecf20Sopenharmony_ci {0x5a08, 0x06}, 14158c2ecf20Sopenharmony_ci {0x5e00, 0x00}, 14168c2ecf20Sopenharmony_ci {0x3734, 0x40}, 14178c2ecf20Sopenharmony_ci {0x5b00, 0x01}, 14188c2ecf20Sopenharmony_ci {0x5b01, 0x10}, 14198c2ecf20Sopenharmony_ci {0x5b02, 0x01}, 14208c2ecf20Sopenharmony_ci {0x5b03, 0xdb}, 14218c2ecf20Sopenharmony_ci {0x3d8c, 0x71}, 14228c2ecf20Sopenharmony_ci {0x3d8d, 0xea}, 14238c2ecf20Sopenharmony_ci {0x4017, 0x10}, 14248c2ecf20Sopenharmony_ci {0x3618, 0x2a}, 14258c2ecf20Sopenharmony_ci {0x5780, 0x3e}, 14268c2ecf20Sopenharmony_ci {0x5781, 0x0f}, 14278c2ecf20Sopenharmony_ci {0x5782, 0x44}, 14288c2ecf20Sopenharmony_ci {0x5783, 0x02}, 14298c2ecf20Sopenharmony_ci {0x5784, 0x01}, 14308c2ecf20Sopenharmony_ci {0x5785, 0x01}, 14318c2ecf20Sopenharmony_ci {0x5786, 0x00}, 14328c2ecf20Sopenharmony_ci {0x5787, 0x04}, 14338c2ecf20Sopenharmony_ci {0x5788, 0x02}, 14348c2ecf20Sopenharmony_ci {0x5789, 0x0f}, 14358c2ecf20Sopenharmony_ci {0x578a, 0xfd}, 14368c2ecf20Sopenharmony_ci {0x578b, 0xf5}, 14378c2ecf20Sopenharmony_ci {0x578c, 0xf5}, 14388c2ecf20Sopenharmony_ci {0x578d, 0x03}, 14398c2ecf20Sopenharmony_ci {0x578e, 0x08}, 14408c2ecf20Sopenharmony_ci {0x578f, 0x0c}, 14418c2ecf20Sopenharmony_ci {0x5790, 0x08}, 14428c2ecf20Sopenharmony_ci {0x5791, 0x06}, 14438c2ecf20Sopenharmony_ci {0x5792, 0x00}, 14448c2ecf20Sopenharmony_ci {0x5793, 0x52}, 14458c2ecf20Sopenharmony_ci {0x5794, 0xa3}, 14468c2ecf20Sopenharmony_ci {0x3503, 0x00}, 14478c2ecf20Sopenharmony_ci {0x5045, 0x05}, 14488c2ecf20Sopenharmony_ci {0x4003, 0x40}, 14498c2ecf20Sopenharmony_ci {0x5048, 0x40} 14508c2ecf20Sopenharmony_ci}; 14518c2ecf20Sopenharmony_ci 14528c2ecf20Sopenharmony_cistatic const struct ov5670_reg mode_640x360_regs[] = { 14538c2ecf20Sopenharmony_ci {0x3000, 0x00}, 14548c2ecf20Sopenharmony_ci {0x3002, 0x21}, 14558c2ecf20Sopenharmony_ci {0x3005, 0xf0}, 14568c2ecf20Sopenharmony_ci {0x3007, 0x00}, 14578c2ecf20Sopenharmony_ci {0x3015, 0x0f}, 14588c2ecf20Sopenharmony_ci {0x3018, 0x32}, 14598c2ecf20Sopenharmony_ci {0x301a, 0xf0}, 14608c2ecf20Sopenharmony_ci {0x301b, 0xf0}, 14618c2ecf20Sopenharmony_ci {0x301c, 0xf0}, 14628c2ecf20Sopenharmony_ci {0x301d, 0xf0}, 14638c2ecf20Sopenharmony_ci {0x301e, 0xf0}, 14648c2ecf20Sopenharmony_ci {0x3030, 0x00}, 14658c2ecf20Sopenharmony_ci {0x3031, 0x0a}, 14668c2ecf20Sopenharmony_ci {0x303c, 0xff}, 14678c2ecf20Sopenharmony_ci {0x303e, 0xff}, 14688c2ecf20Sopenharmony_ci {0x3040, 0xf0}, 14698c2ecf20Sopenharmony_ci {0x3041, 0x00}, 14708c2ecf20Sopenharmony_ci {0x3042, 0xf0}, 14718c2ecf20Sopenharmony_ci {0x3106, 0x11}, 14728c2ecf20Sopenharmony_ci {0x3500, 0x00}, 14738c2ecf20Sopenharmony_ci {0x3501, 0x80}, 14748c2ecf20Sopenharmony_ci {0x3502, 0x00}, 14758c2ecf20Sopenharmony_ci {0x3503, 0x04}, 14768c2ecf20Sopenharmony_ci {0x3504, 0x03}, 14778c2ecf20Sopenharmony_ci {0x3505, 0x83}, 14788c2ecf20Sopenharmony_ci {0x3508, 0x04}, 14798c2ecf20Sopenharmony_ci {0x3509, 0x00}, 14808c2ecf20Sopenharmony_ci {0x350e, 0x04}, 14818c2ecf20Sopenharmony_ci {0x350f, 0x00}, 14828c2ecf20Sopenharmony_ci {0x3510, 0x00}, 14838c2ecf20Sopenharmony_ci {0x3511, 0x02}, 14848c2ecf20Sopenharmony_ci {0x3512, 0x00}, 14858c2ecf20Sopenharmony_ci {0x3601, 0xc8}, 14868c2ecf20Sopenharmony_ci {0x3610, 0x88}, 14878c2ecf20Sopenharmony_ci {0x3612, 0x48}, 14888c2ecf20Sopenharmony_ci {0x3614, 0x5b}, 14898c2ecf20Sopenharmony_ci {0x3615, 0x96}, 14908c2ecf20Sopenharmony_ci {0x3621, 0xd0}, 14918c2ecf20Sopenharmony_ci {0x3622, 0x00}, 14928c2ecf20Sopenharmony_ci {0x3623, 0x04}, 14938c2ecf20Sopenharmony_ci {0x3633, 0x13}, 14948c2ecf20Sopenharmony_ci {0x3634, 0x13}, 14958c2ecf20Sopenharmony_ci {0x3635, 0x13}, 14968c2ecf20Sopenharmony_ci {0x3636, 0x13}, 14978c2ecf20Sopenharmony_ci {0x3645, 0x13}, 14988c2ecf20Sopenharmony_ci {0x3646, 0x82}, 14998c2ecf20Sopenharmony_ci {0x3650, 0x00}, 15008c2ecf20Sopenharmony_ci {0x3652, 0xff}, 15018c2ecf20Sopenharmony_ci {0x3655, 0x20}, 15028c2ecf20Sopenharmony_ci {0x3656, 0xff}, 15038c2ecf20Sopenharmony_ci {0x365a, 0xff}, 15048c2ecf20Sopenharmony_ci {0x365e, 0xff}, 15058c2ecf20Sopenharmony_ci {0x3668, 0x00}, 15068c2ecf20Sopenharmony_ci {0x366a, 0x07}, 15078c2ecf20Sopenharmony_ci {0x366e, 0x08}, 15088c2ecf20Sopenharmony_ci {0x366d, 0x00}, 15098c2ecf20Sopenharmony_ci {0x366f, 0x80}, 15108c2ecf20Sopenharmony_ci {0x3700, 0x28}, 15118c2ecf20Sopenharmony_ci {0x3701, 0x10}, 15128c2ecf20Sopenharmony_ci {0x3702, 0x3a}, 15138c2ecf20Sopenharmony_ci {0x3703, 0x19}, 15148c2ecf20Sopenharmony_ci {0x3704, 0x10}, 15158c2ecf20Sopenharmony_ci {0x3705, 0x00}, 15168c2ecf20Sopenharmony_ci {0x3706, 0x66}, 15178c2ecf20Sopenharmony_ci {0x3707, 0x08}, 15188c2ecf20Sopenharmony_ci {0x3708, 0x34}, 15198c2ecf20Sopenharmony_ci {0x3709, 0x40}, 15208c2ecf20Sopenharmony_ci {0x370a, 0x01}, 15218c2ecf20Sopenharmony_ci {0x370b, 0x1b}, 15228c2ecf20Sopenharmony_ci {0x3714, 0x24}, 15238c2ecf20Sopenharmony_ci {0x371a, 0x3e}, 15248c2ecf20Sopenharmony_ci {0x3733, 0x00}, 15258c2ecf20Sopenharmony_ci {0x3734, 0x00}, 15268c2ecf20Sopenharmony_ci {0x373a, 0x05}, 15278c2ecf20Sopenharmony_ci {0x373b, 0x06}, 15288c2ecf20Sopenharmony_ci {0x373c, 0x0a}, 15298c2ecf20Sopenharmony_ci {0x373f, 0xa0}, 15308c2ecf20Sopenharmony_ci {0x3755, 0x00}, 15318c2ecf20Sopenharmony_ci {0x3758, 0x00}, 15328c2ecf20Sopenharmony_ci {0x375b, 0x0e}, 15338c2ecf20Sopenharmony_ci {0x3766, 0x5f}, 15348c2ecf20Sopenharmony_ci {0x3768, 0x00}, 15358c2ecf20Sopenharmony_ci {0x3769, 0x22}, 15368c2ecf20Sopenharmony_ci {0x3773, 0x08}, 15378c2ecf20Sopenharmony_ci {0x3774, 0x1f}, 15388c2ecf20Sopenharmony_ci {0x3776, 0x06}, 15398c2ecf20Sopenharmony_ci {0x37a0, 0x88}, 15408c2ecf20Sopenharmony_ci {0x37a1, 0x5c}, 15418c2ecf20Sopenharmony_ci {0x37a7, 0x88}, 15428c2ecf20Sopenharmony_ci {0x37a8, 0x70}, 15438c2ecf20Sopenharmony_ci {0x37aa, 0x88}, 15448c2ecf20Sopenharmony_ci {0x37ab, 0x48}, 15458c2ecf20Sopenharmony_ci {0x37b3, 0x66}, 15468c2ecf20Sopenharmony_ci {0x37c2, 0x04}, 15478c2ecf20Sopenharmony_ci {0x37c5, 0x00}, 15488c2ecf20Sopenharmony_ci {0x37c8, 0x00}, 15498c2ecf20Sopenharmony_ci {0x3800, 0x00}, 15508c2ecf20Sopenharmony_ci {0x3801, 0x0c}, 15518c2ecf20Sopenharmony_ci {0x3802, 0x00}, 15528c2ecf20Sopenharmony_ci {0x3803, 0x04}, 15538c2ecf20Sopenharmony_ci {0x3804, 0x0a}, 15548c2ecf20Sopenharmony_ci {0x3805, 0x33}, 15558c2ecf20Sopenharmony_ci {0x3806, 0x07}, 15568c2ecf20Sopenharmony_ci {0x3807, 0xa3}, 15578c2ecf20Sopenharmony_ci {0x3808, 0x02}, 15588c2ecf20Sopenharmony_ci {0x3809, 0x80}, 15598c2ecf20Sopenharmony_ci {0x380a, 0x01}, 15608c2ecf20Sopenharmony_ci {0x380b, 0x68}, 15618c2ecf20Sopenharmony_ci {0x380c, 0x06}, 15628c2ecf20Sopenharmony_ci {0x380d, 0x90}, 15638c2ecf20Sopenharmony_ci {0x380e, 0x08}, 15648c2ecf20Sopenharmony_ci {0x380f, 0x08}, 15658c2ecf20Sopenharmony_ci {0x3811, 0x04}, 15668c2ecf20Sopenharmony_ci {0x3813, 0x02}, 15678c2ecf20Sopenharmony_ci {0x3814, 0x07}, 15688c2ecf20Sopenharmony_ci {0x3815, 0x01}, 15698c2ecf20Sopenharmony_ci {0x3816, 0x00}, 15708c2ecf20Sopenharmony_ci {0x3817, 0x00}, 15718c2ecf20Sopenharmony_ci {0x3818, 0x00}, 15728c2ecf20Sopenharmony_ci {0x3819, 0x00}, 15738c2ecf20Sopenharmony_ci {0x3820, 0x94}, 15748c2ecf20Sopenharmony_ci {0x3821, 0xc6}, 15758c2ecf20Sopenharmony_ci {0x3822, 0x48}, 15768c2ecf20Sopenharmony_ci {0x3826, 0x00}, 15778c2ecf20Sopenharmony_ci {0x3827, 0x08}, 15788c2ecf20Sopenharmony_ci {0x382a, 0x07}, 15798c2ecf20Sopenharmony_ci {0x382b, 0x01}, 15808c2ecf20Sopenharmony_ci {0x3830, 0x08}, 15818c2ecf20Sopenharmony_ci {0x3836, 0x02}, 15828c2ecf20Sopenharmony_ci {0x3837, 0x00}, 15838c2ecf20Sopenharmony_ci {0x3838, 0x10}, 15848c2ecf20Sopenharmony_ci {0x3841, 0xff}, 15858c2ecf20Sopenharmony_ci {0x3846, 0x48}, 15868c2ecf20Sopenharmony_ci {0x3861, 0x00}, 15878c2ecf20Sopenharmony_ci {0x3862, 0x04}, 15888c2ecf20Sopenharmony_ci {0x3863, 0x06}, 15898c2ecf20Sopenharmony_ci {0x3a11, 0x01}, 15908c2ecf20Sopenharmony_ci {0x3a12, 0x78}, 15918c2ecf20Sopenharmony_ci {0x3b00, 0x00}, 15928c2ecf20Sopenharmony_ci {0x3b02, 0x00}, 15938c2ecf20Sopenharmony_ci {0x3b03, 0x00}, 15948c2ecf20Sopenharmony_ci {0x3b04, 0x00}, 15958c2ecf20Sopenharmony_ci {0x3b05, 0x00}, 15968c2ecf20Sopenharmony_ci {0x3c00, 0x89}, 15978c2ecf20Sopenharmony_ci {0x3c01, 0xab}, 15988c2ecf20Sopenharmony_ci {0x3c02, 0x01}, 15998c2ecf20Sopenharmony_ci {0x3c03, 0x00}, 16008c2ecf20Sopenharmony_ci {0x3c04, 0x00}, 16018c2ecf20Sopenharmony_ci {0x3c05, 0x03}, 16028c2ecf20Sopenharmony_ci {0x3c06, 0x00}, 16038c2ecf20Sopenharmony_ci {0x3c07, 0x05}, 16048c2ecf20Sopenharmony_ci {0x3c0c, 0x00}, 16058c2ecf20Sopenharmony_ci {0x3c0d, 0x00}, 16068c2ecf20Sopenharmony_ci {0x3c0e, 0x00}, 16078c2ecf20Sopenharmony_ci {0x3c0f, 0x00}, 16088c2ecf20Sopenharmony_ci {0x3c40, 0x00}, 16098c2ecf20Sopenharmony_ci {0x3c41, 0xa3}, 16108c2ecf20Sopenharmony_ci {0x3c43, 0x7d}, 16118c2ecf20Sopenharmony_ci {0x3c45, 0xd7}, 16128c2ecf20Sopenharmony_ci {0x3c47, 0xfc}, 16138c2ecf20Sopenharmony_ci {0x3c50, 0x05}, 16148c2ecf20Sopenharmony_ci {0x3c52, 0xaa}, 16158c2ecf20Sopenharmony_ci {0x3c54, 0x71}, 16168c2ecf20Sopenharmony_ci {0x3c56, 0x80}, 16178c2ecf20Sopenharmony_ci {0x3d85, 0x17}, 16188c2ecf20Sopenharmony_ci {0x3f03, 0x00}, 16198c2ecf20Sopenharmony_ci {0x3f0a, 0x00}, 16208c2ecf20Sopenharmony_ci {0x3f0b, 0x00}, 16218c2ecf20Sopenharmony_ci {0x4001, 0x60}, 16228c2ecf20Sopenharmony_ci {0x4009, 0x05}, 16238c2ecf20Sopenharmony_ci {0x4020, 0x00}, 16248c2ecf20Sopenharmony_ci {0x4021, 0x00}, 16258c2ecf20Sopenharmony_ci {0x4022, 0x00}, 16268c2ecf20Sopenharmony_ci {0x4023, 0x00}, 16278c2ecf20Sopenharmony_ci {0x4024, 0x00}, 16288c2ecf20Sopenharmony_ci {0x4025, 0x00}, 16298c2ecf20Sopenharmony_ci {0x4026, 0x00}, 16308c2ecf20Sopenharmony_ci {0x4027, 0x00}, 16318c2ecf20Sopenharmony_ci {0x4028, 0x00}, 16328c2ecf20Sopenharmony_ci {0x4029, 0x00}, 16338c2ecf20Sopenharmony_ci {0x402a, 0x00}, 16348c2ecf20Sopenharmony_ci {0x402b, 0x00}, 16358c2ecf20Sopenharmony_ci {0x402c, 0x00}, 16368c2ecf20Sopenharmony_ci {0x402d, 0x00}, 16378c2ecf20Sopenharmony_ci {0x402e, 0x00}, 16388c2ecf20Sopenharmony_ci {0x402f, 0x00}, 16398c2ecf20Sopenharmony_ci {0x4040, 0x00}, 16408c2ecf20Sopenharmony_ci {0x4041, 0x03}, 16418c2ecf20Sopenharmony_ci {0x4042, 0x00}, 16428c2ecf20Sopenharmony_ci {0x4043, 0x7A}, 16438c2ecf20Sopenharmony_ci {0x4044, 0x00}, 16448c2ecf20Sopenharmony_ci {0x4045, 0x7A}, 16458c2ecf20Sopenharmony_ci {0x4046, 0x00}, 16468c2ecf20Sopenharmony_ci {0x4047, 0x7A}, 16478c2ecf20Sopenharmony_ci {0x4048, 0x00}, 16488c2ecf20Sopenharmony_ci {0x4049, 0x7A}, 16498c2ecf20Sopenharmony_ci {0x4307, 0x30}, 16508c2ecf20Sopenharmony_ci {0x4500, 0x58}, 16518c2ecf20Sopenharmony_ci {0x4501, 0x04}, 16528c2ecf20Sopenharmony_ci {0x4502, 0x40}, 16538c2ecf20Sopenharmony_ci {0x4503, 0x10}, 16548c2ecf20Sopenharmony_ci {0x4508, 0x55}, 16558c2ecf20Sopenharmony_ci {0x4509, 0x55}, 16568c2ecf20Sopenharmony_ci {0x450a, 0x02}, 16578c2ecf20Sopenharmony_ci {0x450b, 0x00}, 16588c2ecf20Sopenharmony_ci {0x4600, 0x00}, 16598c2ecf20Sopenharmony_ci {0x4601, 0x40}, 16608c2ecf20Sopenharmony_ci {0x4700, 0xa4}, 16618c2ecf20Sopenharmony_ci {0x4800, 0x4c}, 16628c2ecf20Sopenharmony_ci {0x4816, 0x53}, 16638c2ecf20Sopenharmony_ci {0x481f, 0x40}, 16648c2ecf20Sopenharmony_ci {0x4837, 0x13}, 16658c2ecf20Sopenharmony_ci {0x5000, 0x56}, 16668c2ecf20Sopenharmony_ci {0x5001, 0x01}, 16678c2ecf20Sopenharmony_ci {0x5002, 0x28}, 16688c2ecf20Sopenharmony_ci {0x5004, 0x0c}, 16698c2ecf20Sopenharmony_ci {0x5006, 0x0c}, 16708c2ecf20Sopenharmony_ci {0x5007, 0xe0}, 16718c2ecf20Sopenharmony_ci {0x5008, 0x01}, 16728c2ecf20Sopenharmony_ci {0x5009, 0xb0}, 16738c2ecf20Sopenharmony_ci {0x5901, 0x00}, 16748c2ecf20Sopenharmony_ci {0x5a01, 0x00}, 16758c2ecf20Sopenharmony_ci {0x5a03, 0x00}, 16768c2ecf20Sopenharmony_ci {0x5a04, 0x0c}, 16778c2ecf20Sopenharmony_ci {0x5a05, 0xe0}, 16788c2ecf20Sopenharmony_ci {0x5a06, 0x09}, 16798c2ecf20Sopenharmony_ci {0x5a07, 0xb0}, 16808c2ecf20Sopenharmony_ci {0x5a08, 0x06}, 16818c2ecf20Sopenharmony_ci {0x5e00, 0x00}, 16828c2ecf20Sopenharmony_ci {0x3734, 0x40}, 16838c2ecf20Sopenharmony_ci {0x5b00, 0x01}, 16848c2ecf20Sopenharmony_ci {0x5b01, 0x10}, 16858c2ecf20Sopenharmony_ci {0x5b02, 0x01}, 16868c2ecf20Sopenharmony_ci {0x5b03, 0xdb}, 16878c2ecf20Sopenharmony_ci {0x3d8c, 0x71}, 16888c2ecf20Sopenharmony_ci {0x3d8d, 0xea}, 16898c2ecf20Sopenharmony_ci {0x4017, 0x10}, 16908c2ecf20Sopenharmony_ci {0x3618, 0x2a}, 16918c2ecf20Sopenharmony_ci {0x5780, 0x3e}, 16928c2ecf20Sopenharmony_ci {0x5781, 0x0f}, 16938c2ecf20Sopenharmony_ci {0x5782, 0x44}, 16948c2ecf20Sopenharmony_ci {0x5783, 0x02}, 16958c2ecf20Sopenharmony_ci {0x5784, 0x01}, 16968c2ecf20Sopenharmony_ci {0x5785, 0x01}, 16978c2ecf20Sopenharmony_ci {0x5786, 0x00}, 16988c2ecf20Sopenharmony_ci {0x5787, 0x04}, 16998c2ecf20Sopenharmony_ci {0x5788, 0x02}, 17008c2ecf20Sopenharmony_ci {0x5789, 0x0f}, 17018c2ecf20Sopenharmony_ci {0x578a, 0xfd}, 17028c2ecf20Sopenharmony_ci {0x578b, 0xf5}, 17038c2ecf20Sopenharmony_ci {0x578c, 0xf5}, 17048c2ecf20Sopenharmony_ci {0x578d, 0x03}, 17058c2ecf20Sopenharmony_ci {0x578e, 0x08}, 17068c2ecf20Sopenharmony_ci {0x578f, 0x0c}, 17078c2ecf20Sopenharmony_ci {0x5790, 0x08}, 17088c2ecf20Sopenharmony_ci {0x5791, 0x06}, 17098c2ecf20Sopenharmony_ci {0x5792, 0x00}, 17108c2ecf20Sopenharmony_ci {0x5793, 0x52}, 17118c2ecf20Sopenharmony_ci {0x5794, 0xa3}, 17128c2ecf20Sopenharmony_ci {0x3503, 0x00}, 17138c2ecf20Sopenharmony_ci {0x5045, 0x05}, 17148c2ecf20Sopenharmony_ci {0x4003, 0x40}, 17158c2ecf20Sopenharmony_ci {0x5048, 0x40} 17168c2ecf20Sopenharmony_ci}; 17178c2ecf20Sopenharmony_ci 17188c2ecf20Sopenharmony_cistatic const char * const ov5670_test_pattern_menu[] = { 17198c2ecf20Sopenharmony_ci "Disabled", 17208c2ecf20Sopenharmony_ci "Vertical Color Bar Type 1", 17218c2ecf20Sopenharmony_ci}; 17228c2ecf20Sopenharmony_ci 17238c2ecf20Sopenharmony_ci/* Supported link frequencies */ 17248c2ecf20Sopenharmony_ci#define OV5670_LINK_FREQ_422MHZ 422400000 17258c2ecf20Sopenharmony_ci#define OV5670_LINK_FREQ_422MHZ_INDEX 0 17268c2ecf20Sopenharmony_cistatic const struct ov5670_link_freq_config link_freq_configs[] = { 17278c2ecf20Sopenharmony_ci { 17288c2ecf20Sopenharmony_ci /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */ 17298c2ecf20Sopenharmony_ci .pixel_rate = (OV5670_LINK_FREQ_422MHZ * 2 * 2) / 10, 17308c2ecf20Sopenharmony_ci .reg_list = { 17318c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mipi_data_rate_840mbps), 17328c2ecf20Sopenharmony_ci .regs = mipi_data_rate_840mbps, 17338c2ecf20Sopenharmony_ci } 17348c2ecf20Sopenharmony_ci } 17358c2ecf20Sopenharmony_ci}; 17368c2ecf20Sopenharmony_ci 17378c2ecf20Sopenharmony_cistatic const s64 link_freq_menu_items[] = { 17388c2ecf20Sopenharmony_ci OV5670_LINK_FREQ_422MHZ 17398c2ecf20Sopenharmony_ci}; 17408c2ecf20Sopenharmony_ci 17418c2ecf20Sopenharmony_ci/* 17428c2ecf20Sopenharmony_ci * OV5670 sensor supports following resolutions with full FOV: 17438c2ecf20Sopenharmony_ci * 4:3 ==> {2592x1944, 1296x972, 648x486} 17448c2ecf20Sopenharmony_ci * 16:9 ==> {2560x1440, 1280x720, 640x360} 17458c2ecf20Sopenharmony_ci */ 17468c2ecf20Sopenharmony_cistatic const struct ov5670_mode supported_modes[] = { 17478c2ecf20Sopenharmony_ci { 17488c2ecf20Sopenharmony_ci .width = 2592, 17498c2ecf20Sopenharmony_ci .height = 1944, 17508c2ecf20Sopenharmony_ci .vts_def = OV5670_VTS_30FPS, 17518c2ecf20Sopenharmony_ci .vts_min = OV5670_VTS_30FPS, 17528c2ecf20Sopenharmony_ci .reg_list = { 17538c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mode_2592x1944_regs), 17548c2ecf20Sopenharmony_ci .regs = mode_2592x1944_regs, 17558c2ecf20Sopenharmony_ci }, 17568c2ecf20Sopenharmony_ci .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 17578c2ecf20Sopenharmony_ci }, 17588c2ecf20Sopenharmony_ci { 17598c2ecf20Sopenharmony_ci .width = 1296, 17608c2ecf20Sopenharmony_ci .height = 972, 17618c2ecf20Sopenharmony_ci .vts_def = OV5670_VTS_30FPS, 17628c2ecf20Sopenharmony_ci .vts_min = 996, 17638c2ecf20Sopenharmony_ci .reg_list = { 17648c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mode_1296x972_regs), 17658c2ecf20Sopenharmony_ci .regs = mode_1296x972_regs, 17668c2ecf20Sopenharmony_ci }, 17678c2ecf20Sopenharmony_ci .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 17688c2ecf20Sopenharmony_ci }, 17698c2ecf20Sopenharmony_ci { 17708c2ecf20Sopenharmony_ci .width = 648, 17718c2ecf20Sopenharmony_ci .height = 486, 17728c2ecf20Sopenharmony_ci .vts_def = OV5670_VTS_30FPS, 17738c2ecf20Sopenharmony_ci .vts_min = 516, 17748c2ecf20Sopenharmony_ci .reg_list = { 17758c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mode_648x486_regs), 17768c2ecf20Sopenharmony_ci .regs = mode_648x486_regs, 17778c2ecf20Sopenharmony_ci }, 17788c2ecf20Sopenharmony_ci .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 17798c2ecf20Sopenharmony_ci }, 17808c2ecf20Sopenharmony_ci { 17818c2ecf20Sopenharmony_ci .width = 2560, 17828c2ecf20Sopenharmony_ci .height = 1440, 17838c2ecf20Sopenharmony_ci .vts_def = OV5670_VTS_30FPS, 17848c2ecf20Sopenharmony_ci .vts_min = OV5670_VTS_30FPS, 17858c2ecf20Sopenharmony_ci .reg_list = { 17868c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mode_2560x1440_regs), 17878c2ecf20Sopenharmony_ci .regs = mode_2560x1440_regs, 17888c2ecf20Sopenharmony_ci }, 17898c2ecf20Sopenharmony_ci .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 17908c2ecf20Sopenharmony_ci }, 17918c2ecf20Sopenharmony_ci { 17928c2ecf20Sopenharmony_ci .width = 1280, 17938c2ecf20Sopenharmony_ci .height = 720, 17948c2ecf20Sopenharmony_ci .vts_def = OV5670_VTS_30FPS, 17958c2ecf20Sopenharmony_ci .vts_min = 1020, 17968c2ecf20Sopenharmony_ci .reg_list = { 17978c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mode_1280x720_regs), 17988c2ecf20Sopenharmony_ci .regs = mode_1280x720_regs, 17998c2ecf20Sopenharmony_ci }, 18008c2ecf20Sopenharmony_ci .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18018c2ecf20Sopenharmony_ci }, 18028c2ecf20Sopenharmony_ci { 18038c2ecf20Sopenharmony_ci .width = 640, 18048c2ecf20Sopenharmony_ci .height = 360, 18058c2ecf20Sopenharmony_ci .vts_def = OV5670_VTS_30FPS, 18068c2ecf20Sopenharmony_ci .vts_min = 510, 18078c2ecf20Sopenharmony_ci .reg_list = { 18088c2ecf20Sopenharmony_ci .num_of_regs = ARRAY_SIZE(mode_640x360_regs), 18098c2ecf20Sopenharmony_ci .regs = mode_640x360_regs, 18108c2ecf20Sopenharmony_ci }, 18118c2ecf20Sopenharmony_ci .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18128c2ecf20Sopenharmony_ci } 18138c2ecf20Sopenharmony_ci}; 18148c2ecf20Sopenharmony_ci 18158c2ecf20Sopenharmony_cistruct ov5670 { 18168c2ecf20Sopenharmony_ci struct v4l2_subdev sd; 18178c2ecf20Sopenharmony_ci struct media_pad pad; 18188c2ecf20Sopenharmony_ci 18198c2ecf20Sopenharmony_ci struct v4l2_ctrl_handler ctrl_handler; 18208c2ecf20Sopenharmony_ci /* V4L2 Controls */ 18218c2ecf20Sopenharmony_ci struct v4l2_ctrl *link_freq; 18228c2ecf20Sopenharmony_ci struct v4l2_ctrl *pixel_rate; 18238c2ecf20Sopenharmony_ci struct v4l2_ctrl *vblank; 18248c2ecf20Sopenharmony_ci struct v4l2_ctrl *hblank; 18258c2ecf20Sopenharmony_ci struct v4l2_ctrl *exposure; 18268c2ecf20Sopenharmony_ci 18278c2ecf20Sopenharmony_ci /* Current mode */ 18288c2ecf20Sopenharmony_ci const struct ov5670_mode *cur_mode; 18298c2ecf20Sopenharmony_ci 18308c2ecf20Sopenharmony_ci /* To serialize asynchronus callbacks */ 18318c2ecf20Sopenharmony_ci struct mutex mutex; 18328c2ecf20Sopenharmony_ci 18338c2ecf20Sopenharmony_ci /* Streaming on/off */ 18348c2ecf20Sopenharmony_ci bool streaming; 18358c2ecf20Sopenharmony_ci}; 18368c2ecf20Sopenharmony_ci 18378c2ecf20Sopenharmony_ci#define to_ov5670(_sd) container_of(_sd, struct ov5670, sd) 18388c2ecf20Sopenharmony_ci 18398c2ecf20Sopenharmony_ci/* Read registers up to 4 at a time */ 18408c2ecf20Sopenharmony_cistatic int ov5670_read_reg(struct ov5670 *ov5670, u16 reg, unsigned int len, 18418c2ecf20Sopenharmony_ci u32 *val) 18428c2ecf20Sopenharmony_ci{ 18438c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 18448c2ecf20Sopenharmony_ci struct i2c_msg msgs[2]; 18458c2ecf20Sopenharmony_ci u8 *data_be_p; 18468c2ecf20Sopenharmony_ci __be32 data_be = 0; 18478c2ecf20Sopenharmony_ci __be16 reg_addr_be = cpu_to_be16(reg); 18488c2ecf20Sopenharmony_ci int ret; 18498c2ecf20Sopenharmony_ci 18508c2ecf20Sopenharmony_ci if (len > 4) 18518c2ecf20Sopenharmony_ci return -EINVAL; 18528c2ecf20Sopenharmony_ci 18538c2ecf20Sopenharmony_ci data_be_p = (u8 *)&data_be; 18548c2ecf20Sopenharmony_ci /* Write register address */ 18558c2ecf20Sopenharmony_ci msgs[0].addr = client->addr; 18568c2ecf20Sopenharmony_ci msgs[0].flags = 0; 18578c2ecf20Sopenharmony_ci msgs[0].len = 2; 18588c2ecf20Sopenharmony_ci msgs[0].buf = (u8 *)®_addr_be; 18598c2ecf20Sopenharmony_ci 18608c2ecf20Sopenharmony_ci /* Read data from register */ 18618c2ecf20Sopenharmony_ci msgs[1].addr = client->addr; 18628c2ecf20Sopenharmony_ci msgs[1].flags = I2C_M_RD; 18638c2ecf20Sopenharmony_ci msgs[1].len = len; 18648c2ecf20Sopenharmony_ci msgs[1].buf = &data_be_p[4 - len]; 18658c2ecf20Sopenharmony_ci 18668c2ecf20Sopenharmony_ci ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 18678c2ecf20Sopenharmony_ci if (ret != ARRAY_SIZE(msgs)) 18688c2ecf20Sopenharmony_ci return -EIO; 18698c2ecf20Sopenharmony_ci 18708c2ecf20Sopenharmony_ci *val = be32_to_cpu(data_be); 18718c2ecf20Sopenharmony_ci 18728c2ecf20Sopenharmony_ci return 0; 18738c2ecf20Sopenharmony_ci} 18748c2ecf20Sopenharmony_ci 18758c2ecf20Sopenharmony_ci/* Write registers up to 4 at a time */ 18768c2ecf20Sopenharmony_cistatic int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len, 18778c2ecf20Sopenharmony_ci u32 val) 18788c2ecf20Sopenharmony_ci{ 18798c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 18808c2ecf20Sopenharmony_ci int buf_i; 18818c2ecf20Sopenharmony_ci int val_i; 18828c2ecf20Sopenharmony_ci u8 buf[6]; 18838c2ecf20Sopenharmony_ci u8 *val_p; 18848c2ecf20Sopenharmony_ci __be32 tmp; 18858c2ecf20Sopenharmony_ci 18868c2ecf20Sopenharmony_ci if (len > 4) 18878c2ecf20Sopenharmony_ci return -EINVAL; 18888c2ecf20Sopenharmony_ci 18898c2ecf20Sopenharmony_ci buf[0] = reg >> 8; 18908c2ecf20Sopenharmony_ci buf[1] = reg & 0xff; 18918c2ecf20Sopenharmony_ci 18928c2ecf20Sopenharmony_ci tmp = cpu_to_be32(val); 18938c2ecf20Sopenharmony_ci val_p = (u8 *)&tmp; 18948c2ecf20Sopenharmony_ci buf_i = 2; 18958c2ecf20Sopenharmony_ci val_i = 4 - len; 18968c2ecf20Sopenharmony_ci 18978c2ecf20Sopenharmony_ci while (val_i < 4) 18988c2ecf20Sopenharmony_ci buf[buf_i++] = val_p[val_i++]; 18998c2ecf20Sopenharmony_ci 19008c2ecf20Sopenharmony_ci if (i2c_master_send(client, buf, len + 2) != len + 2) 19018c2ecf20Sopenharmony_ci return -EIO; 19028c2ecf20Sopenharmony_ci 19038c2ecf20Sopenharmony_ci return 0; 19048c2ecf20Sopenharmony_ci} 19058c2ecf20Sopenharmony_ci 19068c2ecf20Sopenharmony_ci/* Write a list of registers */ 19078c2ecf20Sopenharmony_cistatic int ov5670_write_regs(struct ov5670 *ov5670, 19088c2ecf20Sopenharmony_ci const struct ov5670_reg *regs, unsigned int len) 19098c2ecf20Sopenharmony_ci{ 19108c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 19118c2ecf20Sopenharmony_ci unsigned int i; 19128c2ecf20Sopenharmony_ci int ret; 19138c2ecf20Sopenharmony_ci 19148c2ecf20Sopenharmony_ci for (i = 0; i < len; i++) { 19158c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, regs[i].address, 1, regs[i].val); 19168c2ecf20Sopenharmony_ci if (ret) { 19178c2ecf20Sopenharmony_ci dev_err_ratelimited( 19188c2ecf20Sopenharmony_ci &client->dev, 19198c2ecf20Sopenharmony_ci "Failed to write reg 0x%4.4x. error = %d\n", 19208c2ecf20Sopenharmony_ci regs[i].address, ret); 19218c2ecf20Sopenharmony_ci 19228c2ecf20Sopenharmony_ci return ret; 19238c2ecf20Sopenharmony_ci } 19248c2ecf20Sopenharmony_ci } 19258c2ecf20Sopenharmony_ci 19268c2ecf20Sopenharmony_ci return 0; 19278c2ecf20Sopenharmony_ci} 19288c2ecf20Sopenharmony_ci 19298c2ecf20Sopenharmony_cistatic int ov5670_write_reg_list(struct ov5670 *ov5670, 19308c2ecf20Sopenharmony_ci const struct ov5670_reg_list *r_list) 19318c2ecf20Sopenharmony_ci{ 19328c2ecf20Sopenharmony_ci return ov5670_write_regs(ov5670, r_list->regs, r_list->num_of_regs); 19338c2ecf20Sopenharmony_ci} 19348c2ecf20Sopenharmony_ci 19358c2ecf20Sopenharmony_ci/* Open sub-device */ 19368c2ecf20Sopenharmony_cistatic int ov5670_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 19378c2ecf20Sopenharmony_ci{ 19388c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 19398c2ecf20Sopenharmony_ci struct v4l2_mbus_framefmt *try_fmt = 19408c2ecf20Sopenharmony_ci v4l2_subdev_get_try_format(sd, fh->pad, 0); 19418c2ecf20Sopenharmony_ci 19428c2ecf20Sopenharmony_ci mutex_lock(&ov5670->mutex); 19438c2ecf20Sopenharmony_ci 19448c2ecf20Sopenharmony_ci /* Initialize try_fmt */ 19458c2ecf20Sopenharmony_ci try_fmt->width = ov5670->cur_mode->width; 19468c2ecf20Sopenharmony_ci try_fmt->height = ov5670->cur_mode->height; 19478c2ecf20Sopenharmony_ci try_fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; 19488c2ecf20Sopenharmony_ci try_fmt->field = V4L2_FIELD_NONE; 19498c2ecf20Sopenharmony_ci 19508c2ecf20Sopenharmony_ci /* No crop or compose */ 19518c2ecf20Sopenharmony_ci mutex_unlock(&ov5670->mutex); 19528c2ecf20Sopenharmony_ci 19538c2ecf20Sopenharmony_ci return 0; 19548c2ecf20Sopenharmony_ci} 19558c2ecf20Sopenharmony_ci 19568c2ecf20Sopenharmony_cistatic int ov5670_update_digital_gain(struct ov5670 *ov5670, u32 d_gain) 19578c2ecf20Sopenharmony_ci{ 19588c2ecf20Sopenharmony_ci int ret; 19598c2ecf20Sopenharmony_ci 19608c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_R_DGTL_GAIN, 19618c2ecf20Sopenharmony_ci OV5670_REG_VALUE_16BIT, d_gain); 19628c2ecf20Sopenharmony_ci if (ret) 19638c2ecf20Sopenharmony_ci return ret; 19648c2ecf20Sopenharmony_ci 19658c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_G_DGTL_GAIN, 19668c2ecf20Sopenharmony_ci OV5670_REG_VALUE_16BIT, d_gain); 19678c2ecf20Sopenharmony_ci if (ret) 19688c2ecf20Sopenharmony_ci return ret; 19698c2ecf20Sopenharmony_ci 19708c2ecf20Sopenharmony_ci return ov5670_write_reg(ov5670, OV5670_REG_B_DGTL_GAIN, 19718c2ecf20Sopenharmony_ci OV5670_REG_VALUE_16BIT, d_gain); 19728c2ecf20Sopenharmony_ci} 19738c2ecf20Sopenharmony_ci 19748c2ecf20Sopenharmony_cistatic int ov5670_enable_test_pattern(struct ov5670 *ov5670, u32 pattern) 19758c2ecf20Sopenharmony_ci{ 19768c2ecf20Sopenharmony_ci u32 val; 19778c2ecf20Sopenharmony_ci int ret; 19788c2ecf20Sopenharmony_ci 19798c2ecf20Sopenharmony_ci /* Set the bayer order that we support */ 19808c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_TEST_PATTERN_CTRL, 19818c2ecf20Sopenharmony_ci OV5670_REG_VALUE_08BIT, 0); 19828c2ecf20Sopenharmony_ci if (ret) 19838c2ecf20Sopenharmony_ci return ret; 19848c2ecf20Sopenharmony_ci 19858c2ecf20Sopenharmony_ci ret = ov5670_read_reg(ov5670, OV5670_REG_TEST_PATTERN, 19868c2ecf20Sopenharmony_ci OV5670_REG_VALUE_08BIT, &val); 19878c2ecf20Sopenharmony_ci if (ret) 19888c2ecf20Sopenharmony_ci return ret; 19898c2ecf20Sopenharmony_ci 19908c2ecf20Sopenharmony_ci if (pattern) 19918c2ecf20Sopenharmony_ci val |= OV5670_TEST_PATTERN_ENABLE; 19928c2ecf20Sopenharmony_ci else 19938c2ecf20Sopenharmony_ci val &= ~OV5670_TEST_PATTERN_ENABLE; 19948c2ecf20Sopenharmony_ci 19958c2ecf20Sopenharmony_ci return ov5670_write_reg(ov5670, OV5670_REG_TEST_PATTERN, 19968c2ecf20Sopenharmony_ci OV5670_REG_VALUE_08BIT, val); 19978c2ecf20Sopenharmony_ci} 19988c2ecf20Sopenharmony_ci 19998c2ecf20Sopenharmony_ci/* Initialize control handlers */ 20008c2ecf20Sopenharmony_cistatic int ov5670_set_ctrl(struct v4l2_ctrl *ctrl) 20018c2ecf20Sopenharmony_ci{ 20028c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = container_of(ctrl->handler, 20038c2ecf20Sopenharmony_ci struct ov5670, ctrl_handler); 20048c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 20058c2ecf20Sopenharmony_ci s64 max; 20068c2ecf20Sopenharmony_ci int ret = 0; 20078c2ecf20Sopenharmony_ci 20088c2ecf20Sopenharmony_ci /* Propagate change of current control to all related controls */ 20098c2ecf20Sopenharmony_ci switch (ctrl->id) { 20108c2ecf20Sopenharmony_ci case V4L2_CID_VBLANK: 20118c2ecf20Sopenharmony_ci /* Update max exposure while meeting expected vblanking */ 20128c2ecf20Sopenharmony_ci max = ov5670->cur_mode->height + ctrl->val - 8; 20138c2ecf20Sopenharmony_ci __v4l2_ctrl_modify_range(ov5670->exposure, 20148c2ecf20Sopenharmony_ci ov5670->exposure->minimum, max, 20158c2ecf20Sopenharmony_ci ov5670->exposure->step, max); 20168c2ecf20Sopenharmony_ci break; 20178c2ecf20Sopenharmony_ci } 20188c2ecf20Sopenharmony_ci 20198c2ecf20Sopenharmony_ci /* V4L2 controls values will be applied only when power is already up */ 20208c2ecf20Sopenharmony_ci if (!pm_runtime_get_if_in_use(&client->dev)) 20218c2ecf20Sopenharmony_ci return 0; 20228c2ecf20Sopenharmony_ci 20238c2ecf20Sopenharmony_ci switch (ctrl->id) { 20248c2ecf20Sopenharmony_ci case V4L2_CID_ANALOGUE_GAIN: 20258c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_ANALOG_GAIN, 20268c2ecf20Sopenharmony_ci OV5670_REG_VALUE_16BIT, ctrl->val); 20278c2ecf20Sopenharmony_ci break; 20288c2ecf20Sopenharmony_ci case V4L2_CID_DIGITAL_GAIN: 20298c2ecf20Sopenharmony_ci ret = ov5670_update_digital_gain(ov5670, ctrl->val); 20308c2ecf20Sopenharmony_ci break; 20318c2ecf20Sopenharmony_ci case V4L2_CID_EXPOSURE: 20328c2ecf20Sopenharmony_ci /* 4 least significant bits of expsoure are fractional part */ 20338c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_EXPOSURE, 20348c2ecf20Sopenharmony_ci OV5670_REG_VALUE_24BIT, ctrl->val << 4); 20358c2ecf20Sopenharmony_ci break; 20368c2ecf20Sopenharmony_ci case V4L2_CID_VBLANK: 20378c2ecf20Sopenharmony_ci /* Update VTS that meets expected vertical blanking */ 20388c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_VTS, 20398c2ecf20Sopenharmony_ci OV5670_REG_VALUE_16BIT, 20408c2ecf20Sopenharmony_ci ov5670->cur_mode->height + ctrl->val); 20418c2ecf20Sopenharmony_ci break; 20428c2ecf20Sopenharmony_ci case V4L2_CID_TEST_PATTERN: 20438c2ecf20Sopenharmony_ci ret = ov5670_enable_test_pattern(ov5670, ctrl->val); 20448c2ecf20Sopenharmony_ci break; 20458c2ecf20Sopenharmony_ci default: 20468c2ecf20Sopenharmony_ci dev_info(&client->dev, "%s Unhandled id:0x%x, val:0x%x\n", 20478c2ecf20Sopenharmony_ci __func__, ctrl->id, ctrl->val); 20488c2ecf20Sopenharmony_ci break; 20498c2ecf20Sopenharmony_ci } 20508c2ecf20Sopenharmony_ci 20518c2ecf20Sopenharmony_ci pm_runtime_put(&client->dev); 20528c2ecf20Sopenharmony_ci 20538c2ecf20Sopenharmony_ci return ret; 20548c2ecf20Sopenharmony_ci} 20558c2ecf20Sopenharmony_ci 20568c2ecf20Sopenharmony_cistatic const struct v4l2_ctrl_ops ov5670_ctrl_ops = { 20578c2ecf20Sopenharmony_ci .s_ctrl = ov5670_set_ctrl, 20588c2ecf20Sopenharmony_ci}; 20598c2ecf20Sopenharmony_ci 20608c2ecf20Sopenharmony_ci/* Initialize control handlers */ 20618c2ecf20Sopenharmony_cistatic int ov5670_init_controls(struct ov5670 *ov5670) 20628c2ecf20Sopenharmony_ci{ 20638c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 20648c2ecf20Sopenharmony_ci struct v4l2_fwnode_device_properties props; 20658c2ecf20Sopenharmony_ci struct v4l2_ctrl_handler *ctrl_hdlr; 20668c2ecf20Sopenharmony_ci s64 vblank_max; 20678c2ecf20Sopenharmony_ci s64 vblank_def; 20688c2ecf20Sopenharmony_ci s64 vblank_min; 20698c2ecf20Sopenharmony_ci s64 exposure_max; 20708c2ecf20Sopenharmony_ci int ret; 20718c2ecf20Sopenharmony_ci 20728c2ecf20Sopenharmony_ci ctrl_hdlr = &ov5670->ctrl_handler; 20738c2ecf20Sopenharmony_ci ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); 20748c2ecf20Sopenharmony_ci if (ret) 20758c2ecf20Sopenharmony_ci return ret; 20768c2ecf20Sopenharmony_ci 20778c2ecf20Sopenharmony_ci ctrl_hdlr->lock = &ov5670->mutex; 20788c2ecf20Sopenharmony_ci ov5670->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, 20798c2ecf20Sopenharmony_ci &ov5670_ctrl_ops, 20808c2ecf20Sopenharmony_ci V4L2_CID_LINK_FREQ, 20818c2ecf20Sopenharmony_ci 0, 0, link_freq_menu_items); 20828c2ecf20Sopenharmony_ci if (ov5670->link_freq) 20838c2ecf20Sopenharmony_ci ov5670->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; 20848c2ecf20Sopenharmony_ci 20858c2ecf20Sopenharmony_ci /* By default, V4L2_CID_PIXEL_RATE is read only */ 20868c2ecf20Sopenharmony_ci ov5670->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, 20878c2ecf20Sopenharmony_ci V4L2_CID_PIXEL_RATE, 20888c2ecf20Sopenharmony_ci link_freq_configs[0].pixel_rate, 20898c2ecf20Sopenharmony_ci link_freq_configs[0].pixel_rate, 20908c2ecf20Sopenharmony_ci 1, 20918c2ecf20Sopenharmony_ci link_freq_configs[0].pixel_rate); 20928c2ecf20Sopenharmony_ci 20938c2ecf20Sopenharmony_ci vblank_max = OV5670_VTS_MAX - ov5670->cur_mode->height; 20948c2ecf20Sopenharmony_ci vblank_def = ov5670->cur_mode->vts_def - ov5670->cur_mode->height; 20958c2ecf20Sopenharmony_ci vblank_min = ov5670->cur_mode->vts_min - ov5670->cur_mode->height; 20968c2ecf20Sopenharmony_ci ov5670->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, 20978c2ecf20Sopenharmony_ci V4L2_CID_VBLANK, vblank_min, 20988c2ecf20Sopenharmony_ci vblank_max, 1, vblank_def); 20998c2ecf20Sopenharmony_ci 21008c2ecf20Sopenharmony_ci ov5670->hblank = v4l2_ctrl_new_std( 21018c2ecf20Sopenharmony_ci ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_HBLANK, 21028c2ecf20Sopenharmony_ci OV5670_FIXED_PPL - ov5670->cur_mode->width, 21038c2ecf20Sopenharmony_ci OV5670_FIXED_PPL - ov5670->cur_mode->width, 1, 21048c2ecf20Sopenharmony_ci OV5670_FIXED_PPL - ov5670->cur_mode->width); 21058c2ecf20Sopenharmony_ci if (ov5670->hblank) 21068c2ecf20Sopenharmony_ci ov5670->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; 21078c2ecf20Sopenharmony_ci 21088c2ecf20Sopenharmony_ci /* Get min, max, step, default from sensor */ 21098c2ecf20Sopenharmony_ci v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_ANALOGUE_GAIN, 21108c2ecf20Sopenharmony_ci ANALOG_GAIN_MIN, ANALOG_GAIN_MAX, ANALOG_GAIN_STEP, 21118c2ecf20Sopenharmony_ci ANALOG_GAIN_DEFAULT); 21128c2ecf20Sopenharmony_ci 21138c2ecf20Sopenharmony_ci /* Digital gain */ 21148c2ecf20Sopenharmony_ci v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_DIGITAL_GAIN, 21158c2ecf20Sopenharmony_ci OV5670_DGTL_GAIN_MIN, OV5670_DGTL_GAIN_MAX, 21168c2ecf20Sopenharmony_ci OV5670_DGTL_GAIN_STEP, OV5670_DGTL_GAIN_DEFAULT); 21178c2ecf20Sopenharmony_ci 21188c2ecf20Sopenharmony_ci /* Get min, max, step, default from sensor */ 21198c2ecf20Sopenharmony_ci exposure_max = ov5670->cur_mode->vts_def - 8; 21208c2ecf20Sopenharmony_ci ov5670->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, 21218c2ecf20Sopenharmony_ci V4L2_CID_EXPOSURE, 21228c2ecf20Sopenharmony_ci OV5670_EXPOSURE_MIN, 21238c2ecf20Sopenharmony_ci exposure_max, OV5670_EXPOSURE_STEP, 21248c2ecf20Sopenharmony_ci exposure_max); 21258c2ecf20Sopenharmony_ci 21268c2ecf20Sopenharmony_ci v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &ov5670_ctrl_ops, 21278c2ecf20Sopenharmony_ci V4L2_CID_TEST_PATTERN, 21288c2ecf20Sopenharmony_ci ARRAY_SIZE(ov5670_test_pattern_menu) - 1, 21298c2ecf20Sopenharmony_ci 0, 0, ov5670_test_pattern_menu); 21308c2ecf20Sopenharmony_ci 21318c2ecf20Sopenharmony_ci if (ctrl_hdlr->error) { 21328c2ecf20Sopenharmony_ci ret = ctrl_hdlr->error; 21338c2ecf20Sopenharmony_ci goto error; 21348c2ecf20Sopenharmony_ci } 21358c2ecf20Sopenharmony_ci 21368c2ecf20Sopenharmony_ci ret = v4l2_fwnode_device_parse(&client->dev, &props); 21378c2ecf20Sopenharmony_ci if (ret) 21388c2ecf20Sopenharmony_ci goto error; 21398c2ecf20Sopenharmony_ci 21408c2ecf20Sopenharmony_ci ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov5670_ctrl_ops, 21418c2ecf20Sopenharmony_ci &props); 21428c2ecf20Sopenharmony_ci if (ret) 21438c2ecf20Sopenharmony_ci goto error; 21448c2ecf20Sopenharmony_ci 21458c2ecf20Sopenharmony_ci ov5670->sd.ctrl_handler = ctrl_hdlr; 21468c2ecf20Sopenharmony_ci 21478c2ecf20Sopenharmony_ci return 0; 21488c2ecf20Sopenharmony_ci 21498c2ecf20Sopenharmony_cierror: 21508c2ecf20Sopenharmony_ci v4l2_ctrl_handler_free(ctrl_hdlr); 21518c2ecf20Sopenharmony_ci 21528c2ecf20Sopenharmony_ci return ret; 21538c2ecf20Sopenharmony_ci} 21548c2ecf20Sopenharmony_ci 21558c2ecf20Sopenharmony_cistatic int ov5670_enum_mbus_code(struct v4l2_subdev *sd, 21568c2ecf20Sopenharmony_ci struct v4l2_subdev_pad_config *cfg, 21578c2ecf20Sopenharmony_ci struct v4l2_subdev_mbus_code_enum *code) 21588c2ecf20Sopenharmony_ci{ 21598c2ecf20Sopenharmony_ci /* Only one bayer order GRBG is supported */ 21608c2ecf20Sopenharmony_ci if (code->index > 0) 21618c2ecf20Sopenharmony_ci return -EINVAL; 21628c2ecf20Sopenharmony_ci 21638c2ecf20Sopenharmony_ci code->code = MEDIA_BUS_FMT_SGRBG10_1X10; 21648c2ecf20Sopenharmony_ci 21658c2ecf20Sopenharmony_ci return 0; 21668c2ecf20Sopenharmony_ci} 21678c2ecf20Sopenharmony_ci 21688c2ecf20Sopenharmony_cistatic int ov5670_enum_frame_size(struct v4l2_subdev *sd, 21698c2ecf20Sopenharmony_ci struct v4l2_subdev_pad_config *cfg, 21708c2ecf20Sopenharmony_ci struct v4l2_subdev_frame_size_enum *fse) 21718c2ecf20Sopenharmony_ci{ 21728c2ecf20Sopenharmony_ci if (fse->index >= ARRAY_SIZE(supported_modes)) 21738c2ecf20Sopenharmony_ci return -EINVAL; 21748c2ecf20Sopenharmony_ci 21758c2ecf20Sopenharmony_ci if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) 21768c2ecf20Sopenharmony_ci return -EINVAL; 21778c2ecf20Sopenharmony_ci 21788c2ecf20Sopenharmony_ci fse->min_width = supported_modes[fse->index].width; 21798c2ecf20Sopenharmony_ci fse->max_width = fse->min_width; 21808c2ecf20Sopenharmony_ci fse->min_height = supported_modes[fse->index].height; 21818c2ecf20Sopenharmony_ci fse->max_height = fse->min_height; 21828c2ecf20Sopenharmony_ci 21838c2ecf20Sopenharmony_ci return 0; 21848c2ecf20Sopenharmony_ci} 21858c2ecf20Sopenharmony_ci 21868c2ecf20Sopenharmony_cistatic void ov5670_update_pad_format(const struct ov5670_mode *mode, 21878c2ecf20Sopenharmony_ci struct v4l2_subdev_format *fmt) 21888c2ecf20Sopenharmony_ci{ 21898c2ecf20Sopenharmony_ci fmt->format.width = mode->width; 21908c2ecf20Sopenharmony_ci fmt->format.height = mode->height; 21918c2ecf20Sopenharmony_ci fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 21928c2ecf20Sopenharmony_ci fmt->format.field = V4L2_FIELD_NONE; 21938c2ecf20Sopenharmony_ci} 21948c2ecf20Sopenharmony_ci 21958c2ecf20Sopenharmony_cistatic int ov5670_do_get_pad_format(struct ov5670 *ov5670, 21968c2ecf20Sopenharmony_ci struct v4l2_subdev_pad_config *cfg, 21978c2ecf20Sopenharmony_ci struct v4l2_subdev_format *fmt) 21988c2ecf20Sopenharmony_ci{ 21998c2ecf20Sopenharmony_ci if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 22008c2ecf20Sopenharmony_ci fmt->format = *v4l2_subdev_get_try_format(&ov5670->sd, cfg, 22018c2ecf20Sopenharmony_ci fmt->pad); 22028c2ecf20Sopenharmony_ci else 22038c2ecf20Sopenharmony_ci ov5670_update_pad_format(ov5670->cur_mode, fmt); 22048c2ecf20Sopenharmony_ci 22058c2ecf20Sopenharmony_ci return 0; 22068c2ecf20Sopenharmony_ci} 22078c2ecf20Sopenharmony_ci 22088c2ecf20Sopenharmony_cistatic int ov5670_get_pad_format(struct v4l2_subdev *sd, 22098c2ecf20Sopenharmony_ci struct v4l2_subdev_pad_config *cfg, 22108c2ecf20Sopenharmony_ci struct v4l2_subdev_format *fmt) 22118c2ecf20Sopenharmony_ci{ 22128c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 22138c2ecf20Sopenharmony_ci int ret; 22148c2ecf20Sopenharmony_ci 22158c2ecf20Sopenharmony_ci mutex_lock(&ov5670->mutex); 22168c2ecf20Sopenharmony_ci ret = ov5670_do_get_pad_format(ov5670, cfg, fmt); 22178c2ecf20Sopenharmony_ci mutex_unlock(&ov5670->mutex); 22188c2ecf20Sopenharmony_ci 22198c2ecf20Sopenharmony_ci return ret; 22208c2ecf20Sopenharmony_ci} 22218c2ecf20Sopenharmony_ci 22228c2ecf20Sopenharmony_cistatic int ov5670_set_pad_format(struct v4l2_subdev *sd, 22238c2ecf20Sopenharmony_ci struct v4l2_subdev_pad_config *cfg, 22248c2ecf20Sopenharmony_ci struct v4l2_subdev_format *fmt) 22258c2ecf20Sopenharmony_ci{ 22268c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 22278c2ecf20Sopenharmony_ci const struct ov5670_mode *mode; 22288c2ecf20Sopenharmony_ci s32 vblank_def; 22298c2ecf20Sopenharmony_ci s32 h_blank; 22308c2ecf20Sopenharmony_ci 22318c2ecf20Sopenharmony_ci mutex_lock(&ov5670->mutex); 22328c2ecf20Sopenharmony_ci 22338c2ecf20Sopenharmony_ci fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 22348c2ecf20Sopenharmony_ci 22358c2ecf20Sopenharmony_ci mode = v4l2_find_nearest_size(supported_modes, 22368c2ecf20Sopenharmony_ci ARRAY_SIZE(supported_modes), 22378c2ecf20Sopenharmony_ci width, height, 22388c2ecf20Sopenharmony_ci fmt->format.width, fmt->format.height); 22398c2ecf20Sopenharmony_ci ov5670_update_pad_format(mode, fmt); 22408c2ecf20Sopenharmony_ci if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 22418c2ecf20Sopenharmony_ci *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 22428c2ecf20Sopenharmony_ci } else { 22438c2ecf20Sopenharmony_ci ov5670->cur_mode = mode; 22448c2ecf20Sopenharmony_ci __v4l2_ctrl_s_ctrl(ov5670->link_freq, mode->link_freq_index); 22458c2ecf20Sopenharmony_ci __v4l2_ctrl_s_ctrl_int64( 22468c2ecf20Sopenharmony_ci ov5670->pixel_rate, 22478c2ecf20Sopenharmony_ci link_freq_configs[mode->link_freq_index].pixel_rate); 22488c2ecf20Sopenharmony_ci /* Update limits and set FPS to default */ 22498c2ecf20Sopenharmony_ci vblank_def = ov5670->cur_mode->vts_def - 22508c2ecf20Sopenharmony_ci ov5670->cur_mode->height; 22518c2ecf20Sopenharmony_ci __v4l2_ctrl_modify_range( 22528c2ecf20Sopenharmony_ci ov5670->vblank, 22538c2ecf20Sopenharmony_ci ov5670->cur_mode->vts_min - ov5670->cur_mode->height, 22548c2ecf20Sopenharmony_ci OV5670_VTS_MAX - ov5670->cur_mode->height, 1, 22558c2ecf20Sopenharmony_ci vblank_def); 22568c2ecf20Sopenharmony_ci __v4l2_ctrl_s_ctrl(ov5670->vblank, vblank_def); 22578c2ecf20Sopenharmony_ci h_blank = OV5670_FIXED_PPL - ov5670->cur_mode->width; 22588c2ecf20Sopenharmony_ci __v4l2_ctrl_modify_range(ov5670->hblank, h_blank, h_blank, 1, 22598c2ecf20Sopenharmony_ci h_blank); 22608c2ecf20Sopenharmony_ci } 22618c2ecf20Sopenharmony_ci 22628c2ecf20Sopenharmony_ci mutex_unlock(&ov5670->mutex); 22638c2ecf20Sopenharmony_ci 22648c2ecf20Sopenharmony_ci return 0; 22658c2ecf20Sopenharmony_ci} 22668c2ecf20Sopenharmony_ci 22678c2ecf20Sopenharmony_cistatic int ov5670_get_skip_frames(struct v4l2_subdev *sd, u32 *frames) 22688c2ecf20Sopenharmony_ci{ 22698c2ecf20Sopenharmony_ci *frames = OV5670_NUM_OF_SKIP_FRAMES; 22708c2ecf20Sopenharmony_ci 22718c2ecf20Sopenharmony_ci return 0; 22728c2ecf20Sopenharmony_ci} 22738c2ecf20Sopenharmony_ci 22748c2ecf20Sopenharmony_ci/* Prepare streaming by writing default values and customized values */ 22758c2ecf20Sopenharmony_cistatic int ov5670_start_streaming(struct ov5670 *ov5670) 22768c2ecf20Sopenharmony_ci{ 22778c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 22788c2ecf20Sopenharmony_ci const struct ov5670_reg_list *reg_list; 22798c2ecf20Sopenharmony_ci int link_freq_index; 22808c2ecf20Sopenharmony_ci int ret; 22818c2ecf20Sopenharmony_ci 22828c2ecf20Sopenharmony_ci /* Get out of from software reset */ 22838c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_SOFTWARE_RST, 22848c2ecf20Sopenharmony_ci OV5670_REG_VALUE_08BIT, OV5670_SOFTWARE_RST); 22858c2ecf20Sopenharmony_ci if (ret) { 22868c2ecf20Sopenharmony_ci dev_err(&client->dev, "%s failed to set powerup registers\n", 22878c2ecf20Sopenharmony_ci __func__); 22888c2ecf20Sopenharmony_ci return ret; 22898c2ecf20Sopenharmony_ci } 22908c2ecf20Sopenharmony_ci 22918c2ecf20Sopenharmony_ci /* Setup PLL */ 22928c2ecf20Sopenharmony_ci link_freq_index = ov5670->cur_mode->link_freq_index; 22938c2ecf20Sopenharmony_ci reg_list = &link_freq_configs[link_freq_index].reg_list; 22948c2ecf20Sopenharmony_ci ret = ov5670_write_reg_list(ov5670, reg_list); 22958c2ecf20Sopenharmony_ci if (ret) { 22968c2ecf20Sopenharmony_ci dev_err(&client->dev, "%s failed to set plls\n", __func__); 22978c2ecf20Sopenharmony_ci return ret; 22988c2ecf20Sopenharmony_ci } 22998c2ecf20Sopenharmony_ci 23008c2ecf20Sopenharmony_ci /* Apply default values of current mode */ 23018c2ecf20Sopenharmony_ci reg_list = &ov5670->cur_mode->reg_list; 23028c2ecf20Sopenharmony_ci ret = ov5670_write_reg_list(ov5670, reg_list); 23038c2ecf20Sopenharmony_ci if (ret) { 23048c2ecf20Sopenharmony_ci dev_err(&client->dev, "%s failed to set mode\n", __func__); 23058c2ecf20Sopenharmony_ci return ret; 23068c2ecf20Sopenharmony_ci } 23078c2ecf20Sopenharmony_ci 23088c2ecf20Sopenharmony_ci ret = __v4l2_ctrl_handler_setup(ov5670->sd.ctrl_handler); 23098c2ecf20Sopenharmony_ci if (ret) 23108c2ecf20Sopenharmony_ci return ret; 23118c2ecf20Sopenharmony_ci 23128c2ecf20Sopenharmony_ci /* Write stream on list */ 23138c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_MODE_SELECT, 23148c2ecf20Sopenharmony_ci OV5670_REG_VALUE_08BIT, OV5670_MODE_STREAMING); 23158c2ecf20Sopenharmony_ci if (ret) { 23168c2ecf20Sopenharmony_ci dev_err(&client->dev, "%s failed to set stream\n", __func__); 23178c2ecf20Sopenharmony_ci return ret; 23188c2ecf20Sopenharmony_ci } 23198c2ecf20Sopenharmony_ci 23208c2ecf20Sopenharmony_ci return 0; 23218c2ecf20Sopenharmony_ci} 23228c2ecf20Sopenharmony_ci 23238c2ecf20Sopenharmony_cistatic int ov5670_stop_streaming(struct ov5670 *ov5670) 23248c2ecf20Sopenharmony_ci{ 23258c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 23268c2ecf20Sopenharmony_ci int ret; 23278c2ecf20Sopenharmony_ci 23288c2ecf20Sopenharmony_ci ret = ov5670_write_reg(ov5670, OV5670_REG_MODE_SELECT, 23298c2ecf20Sopenharmony_ci OV5670_REG_VALUE_08BIT, OV5670_MODE_STANDBY); 23308c2ecf20Sopenharmony_ci if (ret) 23318c2ecf20Sopenharmony_ci dev_err(&client->dev, "%s failed to set stream\n", __func__); 23328c2ecf20Sopenharmony_ci 23338c2ecf20Sopenharmony_ci /* Return success even if it was an error, as there is nothing the 23348c2ecf20Sopenharmony_ci * caller can do about it. 23358c2ecf20Sopenharmony_ci */ 23368c2ecf20Sopenharmony_ci return 0; 23378c2ecf20Sopenharmony_ci} 23388c2ecf20Sopenharmony_ci 23398c2ecf20Sopenharmony_cistatic int ov5670_set_stream(struct v4l2_subdev *sd, int enable) 23408c2ecf20Sopenharmony_ci{ 23418c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 23428c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(sd); 23438c2ecf20Sopenharmony_ci int ret = 0; 23448c2ecf20Sopenharmony_ci 23458c2ecf20Sopenharmony_ci mutex_lock(&ov5670->mutex); 23468c2ecf20Sopenharmony_ci if (ov5670->streaming == enable) 23478c2ecf20Sopenharmony_ci goto unlock_and_return; 23488c2ecf20Sopenharmony_ci 23498c2ecf20Sopenharmony_ci if (enable) { 23508c2ecf20Sopenharmony_ci ret = pm_runtime_get_sync(&client->dev); 23518c2ecf20Sopenharmony_ci if (ret < 0) { 23528c2ecf20Sopenharmony_ci pm_runtime_put_noidle(&client->dev); 23538c2ecf20Sopenharmony_ci goto unlock_and_return; 23548c2ecf20Sopenharmony_ci } 23558c2ecf20Sopenharmony_ci 23568c2ecf20Sopenharmony_ci ret = ov5670_start_streaming(ov5670); 23578c2ecf20Sopenharmony_ci if (ret) 23588c2ecf20Sopenharmony_ci goto error; 23598c2ecf20Sopenharmony_ci } else { 23608c2ecf20Sopenharmony_ci ret = ov5670_stop_streaming(ov5670); 23618c2ecf20Sopenharmony_ci pm_runtime_put(&client->dev); 23628c2ecf20Sopenharmony_ci } 23638c2ecf20Sopenharmony_ci ov5670->streaming = enable; 23648c2ecf20Sopenharmony_ci goto unlock_and_return; 23658c2ecf20Sopenharmony_ci 23668c2ecf20Sopenharmony_cierror: 23678c2ecf20Sopenharmony_ci pm_runtime_put(&client->dev); 23688c2ecf20Sopenharmony_ci 23698c2ecf20Sopenharmony_ciunlock_and_return: 23708c2ecf20Sopenharmony_ci mutex_unlock(&ov5670->mutex); 23718c2ecf20Sopenharmony_ci 23728c2ecf20Sopenharmony_ci return ret; 23738c2ecf20Sopenharmony_ci} 23748c2ecf20Sopenharmony_ci 23758c2ecf20Sopenharmony_cistatic int __maybe_unused ov5670_suspend(struct device *dev) 23768c2ecf20Sopenharmony_ci{ 23778c2ecf20Sopenharmony_ci struct i2c_client *client = to_i2c_client(dev); 23788c2ecf20Sopenharmony_ci struct v4l2_subdev *sd = i2c_get_clientdata(client); 23798c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 23808c2ecf20Sopenharmony_ci 23818c2ecf20Sopenharmony_ci if (ov5670->streaming) 23828c2ecf20Sopenharmony_ci ov5670_stop_streaming(ov5670); 23838c2ecf20Sopenharmony_ci 23848c2ecf20Sopenharmony_ci return 0; 23858c2ecf20Sopenharmony_ci} 23868c2ecf20Sopenharmony_ci 23878c2ecf20Sopenharmony_cistatic int __maybe_unused ov5670_resume(struct device *dev) 23888c2ecf20Sopenharmony_ci{ 23898c2ecf20Sopenharmony_ci struct i2c_client *client = to_i2c_client(dev); 23908c2ecf20Sopenharmony_ci struct v4l2_subdev *sd = i2c_get_clientdata(client); 23918c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 23928c2ecf20Sopenharmony_ci int ret; 23938c2ecf20Sopenharmony_ci 23948c2ecf20Sopenharmony_ci if (ov5670->streaming) { 23958c2ecf20Sopenharmony_ci ret = ov5670_start_streaming(ov5670); 23968c2ecf20Sopenharmony_ci if (ret) { 23978c2ecf20Sopenharmony_ci ov5670_stop_streaming(ov5670); 23988c2ecf20Sopenharmony_ci return ret; 23998c2ecf20Sopenharmony_ci } 24008c2ecf20Sopenharmony_ci } 24018c2ecf20Sopenharmony_ci 24028c2ecf20Sopenharmony_ci return 0; 24038c2ecf20Sopenharmony_ci} 24048c2ecf20Sopenharmony_ci 24058c2ecf20Sopenharmony_ci/* Verify chip ID */ 24068c2ecf20Sopenharmony_cistatic int ov5670_identify_module(struct ov5670 *ov5670) 24078c2ecf20Sopenharmony_ci{ 24088c2ecf20Sopenharmony_ci struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 24098c2ecf20Sopenharmony_ci int ret; 24108c2ecf20Sopenharmony_ci u32 val; 24118c2ecf20Sopenharmony_ci 24128c2ecf20Sopenharmony_ci ret = ov5670_read_reg(ov5670, OV5670_REG_CHIP_ID, 24138c2ecf20Sopenharmony_ci OV5670_REG_VALUE_24BIT, &val); 24148c2ecf20Sopenharmony_ci if (ret) 24158c2ecf20Sopenharmony_ci return ret; 24168c2ecf20Sopenharmony_ci 24178c2ecf20Sopenharmony_ci if (val != OV5670_CHIP_ID) { 24188c2ecf20Sopenharmony_ci dev_err(&client->dev, "chip id mismatch: %x!=%x\n", 24198c2ecf20Sopenharmony_ci OV5670_CHIP_ID, val); 24208c2ecf20Sopenharmony_ci return -ENXIO; 24218c2ecf20Sopenharmony_ci } 24228c2ecf20Sopenharmony_ci 24238c2ecf20Sopenharmony_ci return 0; 24248c2ecf20Sopenharmony_ci} 24258c2ecf20Sopenharmony_ci 24268c2ecf20Sopenharmony_cistatic const struct v4l2_subdev_video_ops ov5670_video_ops = { 24278c2ecf20Sopenharmony_ci .s_stream = ov5670_set_stream, 24288c2ecf20Sopenharmony_ci}; 24298c2ecf20Sopenharmony_ci 24308c2ecf20Sopenharmony_cistatic const struct v4l2_subdev_pad_ops ov5670_pad_ops = { 24318c2ecf20Sopenharmony_ci .enum_mbus_code = ov5670_enum_mbus_code, 24328c2ecf20Sopenharmony_ci .get_fmt = ov5670_get_pad_format, 24338c2ecf20Sopenharmony_ci .set_fmt = ov5670_set_pad_format, 24348c2ecf20Sopenharmony_ci .enum_frame_size = ov5670_enum_frame_size, 24358c2ecf20Sopenharmony_ci}; 24368c2ecf20Sopenharmony_ci 24378c2ecf20Sopenharmony_cistatic const struct v4l2_subdev_sensor_ops ov5670_sensor_ops = { 24388c2ecf20Sopenharmony_ci .g_skip_frames = ov5670_get_skip_frames, 24398c2ecf20Sopenharmony_ci}; 24408c2ecf20Sopenharmony_ci 24418c2ecf20Sopenharmony_cistatic const struct v4l2_subdev_ops ov5670_subdev_ops = { 24428c2ecf20Sopenharmony_ci .video = &ov5670_video_ops, 24438c2ecf20Sopenharmony_ci .pad = &ov5670_pad_ops, 24448c2ecf20Sopenharmony_ci .sensor = &ov5670_sensor_ops, 24458c2ecf20Sopenharmony_ci}; 24468c2ecf20Sopenharmony_ci 24478c2ecf20Sopenharmony_cistatic const struct media_entity_operations ov5670_subdev_entity_ops = { 24488c2ecf20Sopenharmony_ci .link_validate = v4l2_subdev_link_validate, 24498c2ecf20Sopenharmony_ci}; 24508c2ecf20Sopenharmony_ci 24518c2ecf20Sopenharmony_cistatic const struct v4l2_subdev_internal_ops ov5670_internal_ops = { 24528c2ecf20Sopenharmony_ci .open = ov5670_open, 24538c2ecf20Sopenharmony_ci}; 24548c2ecf20Sopenharmony_ci 24558c2ecf20Sopenharmony_cistatic int ov5670_probe(struct i2c_client *client) 24568c2ecf20Sopenharmony_ci{ 24578c2ecf20Sopenharmony_ci struct ov5670 *ov5670; 24588c2ecf20Sopenharmony_ci const char *err_msg; 24598c2ecf20Sopenharmony_ci u32 input_clk = 0; 24608c2ecf20Sopenharmony_ci int ret; 24618c2ecf20Sopenharmony_ci 24628c2ecf20Sopenharmony_ci device_property_read_u32(&client->dev, "clock-frequency", &input_clk); 24638c2ecf20Sopenharmony_ci if (input_clk != 19200000) 24648c2ecf20Sopenharmony_ci return -EINVAL; 24658c2ecf20Sopenharmony_ci 24668c2ecf20Sopenharmony_ci ov5670 = devm_kzalloc(&client->dev, sizeof(*ov5670), GFP_KERNEL); 24678c2ecf20Sopenharmony_ci if (!ov5670) { 24688c2ecf20Sopenharmony_ci ret = -ENOMEM; 24698c2ecf20Sopenharmony_ci err_msg = "devm_kzalloc() error"; 24708c2ecf20Sopenharmony_ci goto error_print; 24718c2ecf20Sopenharmony_ci } 24728c2ecf20Sopenharmony_ci 24738c2ecf20Sopenharmony_ci /* Initialize subdev */ 24748c2ecf20Sopenharmony_ci v4l2_i2c_subdev_init(&ov5670->sd, client, &ov5670_subdev_ops); 24758c2ecf20Sopenharmony_ci 24768c2ecf20Sopenharmony_ci /* Check module identity */ 24778c2ecf20Sopenharmony_ci ret = ov5670_identify_module(ov5670); 24788c2ecf20Sopenharmony_ci if (ret) { 24798c2ecf20Sopenharmony_ci err_msg = "ov5670_identify_module() error"; 24808c2ecf20Sopenharmony_ci goto error_print; 24818c2ecf20Sopenharmony_ci } 24828c2ecf20Sopenharmony_ci 24838c2ecf20Sopenharmony_ci mutex_init(&ov5670->mutex); 24848c2ecf20Sopenharmony_ci 24858c2ecf20Sopenharmony_ci /* Set default mode to max resolution */ 24868c2ecf20Sopenharmony_ci ov5670->cur_mode = &supported_modes[0]; 24878c2ecf20Sopenharmony_ci 24888c2ecf20Sopenharmony_ci ret = ov5670_init_controls(ov5670); 24898c2ecf20Sopenharmony_ci if (ret) { 24908c2ecf20Sopenharmony_ci err_msg = "ov5670_init_controls() error"; 24918c2ecf20Sopenharmony_ci goto error_mutex_destroy; 24928c2ecf20Sopenharmony_ci } 24938c2ecf20Sopenharmony_ci 24948c2ecf20Sopenharmony_ci ov5670->sd.internal_ops = &ov5670_internal_ops; 24958c2ecf20Sopenharmony_ci ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 24968c2ecf20Sopenharmony_ci ov5670->sd.entity.ops = &ov5670_subdev_entity_ops; 24978c2ecf20Sopenharmony_ci ov5670->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; 24988c2ecf20Sopenharmony_ci 24998c2ecf20Sopenharmony_ci /* Source pad initialization */ 25008c2ecf20Sopenharmony_ci ov5670->pad.flags = MEDIA_PAD_FL_SOURCE; 25018c2ecf20Sopenharmony_ci ret = media_entity_pads_init(&ov5670->sd.entity, 1, &ov5670->pad); 25028c2ecf20Sopenharmony_ci if (ret) { 25038c2ecf20Sopenharmony_ci err_msg = "media_entity_pads_init() error"; 25048c2ecf20Sopenharmony_ci goto error_handler_free; 25058c2ecf20Sopenharmony_ci } 25068c2ecf20Sopenharmony_ci 25078c2ecf20Sopenharmony_ci /* Async register for subdev */ 25088c2ecf20Sopenharmony_ci ret = v4l2_async_register_subdev_sensor_common(&ov5670->sd); 25098c2ecf20Sopenharmony_ci if (ret < 0) { 25108c2ecf20Sopenharmony_ci err_msg = "v4l2_async_register_subdev() error"; 25118c2ecf20Sopenharmony_ci goto error_entity_cleanup; 25128c2ecf20Sopenharmony_ci } 25138c2ecf20Sopenharmony_ci 25148c2ecf20Sopenharmony_ci ov5670->streaming = false; 25158c2ecf20Sopenharmony_ci 25168c2ecf20Sopenharmony_ci /* 25178c2ecf20Sopenharmony_ci * Device is already turned on by i2c-core with ACPI domain PM. 25188c2ecf20Sopenharmony_ci * Enable runtime PM and turn off the device. 25198c2ecf20Sopenharmony_ci */ 25208c2ecf20Sopenharmony_ci pm_runtime_set_active(&client->dev); 25218c2ecf20Sopenharmony_ci pm_runtime_enable(&client->dev); 25228c2ecf20Sopenharmony_ci pm_runtime_idle(&client->dev); 25238c2ecf20Sopenharmony_ci 25248c2ecf20Sopenharmony_ci return 0; 25258c2ecf20Sopenharmony_ci 25268c2ecf20Sopenharmony_cierror_entity_cleanup: 25278c2ecf20Sopenharmony_ci media_entity_cleanup(&ov5670->sd.entity); 25288c2ecf20Sopenharmony_ci 25298c2ecf20Sopenharmony_cierror_handler_free: 25308c2ecf20Sopenharmony_ci v4l2_ctrl_handler_free(ov5670->sd.ctrl_handler); 25318c2ecf20Sopenharmony_ci 25328c2ecf20Sopenharmony_cierror_mutex_destroy: 25338c2ecf20Sopenharmony_ci mutex_destroy(&ov5670->mutex); 25348c2ecf20Sopenharmony_ci 25358c2ecf20Sopenharmony_cierror_print: 25368c2ecf20Sopenharmony_ci dev_err(&client->dev, "%s: %s %d\n", __func__, err_msg, ret); 25378c2ecf20Sopenharmony_ci 25388c2ecf20Sopenharmony_ci return ret; 25398c2ecf20Sopenharmony_ci} 25408c2ecf20Sopenharmony_ci 25418c2ecf20Sopenharmony_cistatic int ov5670_remove(struct i2c_client *client) 25428c2ecf20Sopenharmony_ci{ 25438c2ecf20Sopenharmony_ci struct v4l2_subdev *sd = i2c_get_clientdata(client); 25448c2ecf20Sopenharmony_ci struct ov5670 *ov5670 = to_ov5670(sd); 25458c2ecf20Sopenharmony_ci 25468c2ecf20Sopenharmony_ci v4l2_async_unregister_subdev(sd); 25478c2ecf20Sopenharmony_ci media_entity_cleanup(&sd->entity); 25488c2ecf20Sopenharmony_ci v4l2_ctrl_handler_free(sd->ctrl_handler); 25498c2ecf20Sopenharmony_ci mutex_destroy(&ov5670->mutex); 25508c2ecf20Sopenharmony_ci 25518c2ecf20Sopenharmony_ci pm_runtime_disable(&client->dev); 25528c2ecf20Sopenharmony_ci 25538c2ecf20Sopenharmony_ci return 0; 25548c2ecf20Sopenharmony_ci} 25558c2ecf20Sopenharmony_ci 25568c2ecf20Sopenharmony_cistatic const struct dev_pm_ops ov5670_pm_ops = { 25578c2ecf20Sopenharmony_ci SET_SYSTEM_SLEEP_PM_OPS(ov5670_suspend, ov5670_resume) 25588c2ecf20Sopenharmony_ci}; 25598c2ecf20Sopenharmony_ci 25608c2ecf20Sopenharmony_ci#ifdef CONFIG_ACPI 25618c2ecf20Sopenharmony_cistatic const struct acpi_device_id ov5670_acpi_ids[] = { 25628c2ecf20Sopenharmony_ci {"INT3479"}, 25638c2ecf20Sopenharmony_ci { /* sentinel */ } 25648c2ecf20Sopenharmony_ci}; 25658c2ecf20Sopenharmony_ci 25668c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(acpi, ov5670_acpi_ids); 25678c2ecf20Sopenharmony_ci#endif 25688c2ecf20Sopenharmony_ci 25698c2ecf20Sopenharmony_cistatic struct i2c_driver ov5670_i2c_driver = { 25708c2ecf20Sopenharmony_ci .driver = { 25718c2ecf20Sopenharmony_ci .name = "ov5670", 25728c2ecf20Sopenharmony_ci .pm = &ov5670_pm_ops, 25738c2ecf20Sopenharmony_ci .acpi_match_table = ACPI_PTR(ov5670_acpi_ids), 25748c2ecf20Sopenharmony_ci }, 25758c2ecf20Sopenharmony_ci .probe_new = ov5670_probe, 25768c2ecf20Sopenharmony_ci .remove = ov5670_remove, 25778c2ecf20Sopenharmony_ci}; 25788c2ecf20Sopenharmony_ci 25798c2ecf20Sopenharmony_cimodule_i2c_driver(ov5670_i2c_driver); 25808c2ecf20Sopenharmony_ci 25818c2ecf20Sopenharmony_ciMODULE_AUTHOR("Rapolu, Chiranjeevi <chiranjeevi.rapolu@intel.com>"); 25828c2ecf20Sopenharmony_ciMODULE_AUTHOR("Yang, Hyungwoo <hyungwoo.yang@intel.com>"); 25838c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Omnivision ov5670 sensor driver"); 25848c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 2585