1a1c3bb0eSChiranjeevi Rapolu // SPDX-License-Identifier: GPL-2.0 2a1c3bb0eSChiranjeevi Rapolu // Copyright (c) 2017 Intel Corporation. 35de35c9bSChiranjeevi Rapolu 462ab1e32SJacopo Mondi #include <asm/unaligned.h> 55de35c9bSChiranjeevi Rapolu #include <linux/acpi.h> 68004c91eSJacopo Mondi #include <linux/clk.h> 762ab1e32SJacopo Mondi #include <linux/delay.h> 80a844ab7SJacopo Mondi #include <linux/gpio/consumer.h> 95de35c9bSChiranjeevi Rapolu #include <linux/i2c.h> 105635500aSJacopo Mondi #include <linux/mod_devicetable.h> 115de35c9bSChiranjeevi Rapolu #include <linux/module.h> 125635500aSJacopo Mondi #include <linux/of.h> 135de35c9bSChiranjeevi Rapolu #include <linux/pm_runtime.h> 14cf9ab879SJacopo Mondi #include <linux/regulator/consumer.h> 155de35c9bSChiranjeevi Rapolu #include <media/v4l2-ctrls.h> 165de35c9bSChiranjeevi Rapolu #include <media/v4l2-device.h> 17dce6dd44SRicardo Ribalda #include <media/v4l2-event.h> 18eba08021SJacopo Mondi #include <media/v4l2-fwnode.h> 195de35c9bSChiranjeevi Rapolu 208004c91eSJacopo Mondi #define OV5670_XVCLK_FREQ 19200000 218004c91eSJacopo Mondi 225de35c9bSChiranjeevi Rapolu #define OV5670_REG_CHIP_ID 0x300a 235de35c9bSChiranjeevi Rapolu #define OV5670_CHIP_ID 0x005670 245de35c9bSChiranjeevi Rapolu 255de35c9bSChiranjeevi Rapolu #define OV5670_REG_MODE_SELECT 0x0100 265de35c9bSChiranjeevi Rapolu #define OV5670_MODE_STANDBY 0x00 275de35c9bSChiranjeevi Rapolu #define OV5670_MODE_STREAMING 0x01 285de35c9bSChiranjeevi Rapolu 295de35c9bSChiranjeevi Rapolu #define OV5670_REG_SOFTWARE_RST 0x0103 305de35c9bSChiranjeevi Rapolu #define OV5670_SOFTWARE_RST 0x01 315de35c9bSChiranjeevi Rapolu 325de35c9bSChiranjeevi Rapolu /* vertical-timings from sensor */ 335de35c9bSChiranjeevi Rapolu #define OV5670_REG_VTS 0x380e 345de35c9bSChiranjeevi Rapolu #define OV5670_VTS_30FPS 0x0808 /* default for 30 fps */ 355de35c9bSChiranjeevi Rapolu #define OV5670_VTS_MAX 0xffff 365de35c9bSChiranjeevi Rapolu 375de35c9bSChiranjeevi Rapolu /* horizontal-timings from sensor */ 385de35c9bSChiranjeevi Rapolu #define OV5670_REG_HTS 0x380c 39f1425381SChiranjeevi Rapolu 40f1425381SChiranjeevi Rapolu /* 41f1425381SChiranjeevi Rapolu * Pixels-per-line(PPL) = Time-per-line * pixel-rate 42f1425381SChiranjeevi Rapolu * In OV5670, Time-per-line = HTS/SCLK. 43f1425381SChiranjeevi Rapolu * HTS is fixed for all resolutions, not recommended to change. 44f1425381SChiranjeevi Rapolu */ 45f1425381SChiranjeevi Rapolu #define OV5670_FIXED_PPL 2724 /* Pixels per line */ 465de35c9bSChiranjeevi Rapolu 475de35c9bSChiranjeevi Rapolu /* Exposure controls from sensor */ 485de35c9bSChiranjeevi Rapolu #define OV5670_REG_EXPOSURE 0x3500 495de35c9bSChiranjeevi Rapolu #define OV5670_EXPOSURE_MIN 4 505de35c9bSChiranjeevi Rapolu #define OV5670_EXPOSURE_STEP 1 515de35c9bSChiranjeevi Rapolu 525de35c9bSChiranjeevi Rapolu /* Analog gain controls from sensor */ 535de35c9bSChiranjeevi Rapolu #define OV5670_REG_ANALOG_GAIN 0x3508 545de35c9bSChiranjeevi Rapolu #define ANALOG_GAIN_MIN 0 555de35c9bSChiranjeevi Rapolu #define ANALOG_GAIN_MAX 8191 565de35c9bSChiranjeevi Rapolu #define ANALOG_GAIN_STEP 1 575de35c9bSChiranjeevi Rapolu #define ANALOG_GAIN_DEFAULT 128 585de35c9bSChiranjeevi Rapolu 595de35c9bSChiranjeevi Rapolu /* Digital gain controls from sensor */ 605de35c9bSChiranjeevi Rapolu #define OV5670_REG_R_DGTL_GAIN 0x5032 615de35c9bSChiranjeevi Rapolu #define OV5670_REG_G_DGTL_GAIN 0x5034 625de35c9bSChiranjeevi Rapolu #define OV5670_REG_B_DGTL_GAIN 0x5036 635de35c9bSChiranjeevi Rapolu #define OV5670_DGTL_GAIN_MIN 0 645de35c9bSChiranjeevi Rapolu #define OV5670_DGTL_GAIN_MAX 4095 655de35c9bSChiranjeevi Rapolu #define OV5670_DGTL_GAIN_STEP 1 665de35c9bSChiranjeevi Rapolu #define OV5670_DGTL_GAIN_DEFAULT 1024 675de35c9bSChiranjeevi Rapolu 685de35c9bSChiranjeevi Rapolu /* Test Pattern Control */ 695de35c9bSChiranjeevi Rapolu #define OV5670_REG_TEST_PATTERN 0x4303 705de35c9bSChiranjeevi Rapolu #define OV5670_TEST_PATTERN_ENABLE BIT(3) 715de35c9bSChiranjeevi Rapolu #define OV5670_REG_TEST_PATTERN_CTRL 0x4320 725de35c9bSChiranjeevi Rapolu 735de35c9bSChiranjeevi Rapolu #define OV5670_REG_VALUE_08BIT 1 745de35c9bSChiranjeevi Rapolu #define OV5670_REG_VALUE_16BIT 2 755de35c9bSChiranjeevi Rapolu #define OV5670_REG_VALUE_24BIT 3 765de35c9bSChiranjeevi Rapolu 772eadd98dSJean-Michel Hautbois /* Pixel Array */ 782eadd98dSJean-Michel Hautbois #define OV5670_NATIVE_WIDTH 2624 792eadd98dSJean-Michel Hautbois #define OV5670_NATIVE_HEIGHT 1980 802eadd98dSJean-Michel Hautbois 815de35c9bSChiranjeevi Rapolu /* Initial number of frames to skip to avoid possible garbage */ 825de35c9bSChiranjeevi Rapolu #define OV5670_NUM_OF_SKIP_FRAMES 2 835de35c9bSChiranjeevi Rapolu 845de35c9bSChiranjeevi Rapolu struct ov5670_reg { 855de35c9bSChiranjeevi Rapolu u16 address; 865de35c9bSChiranjeevi Rapolu u8 val; 875de35c9bSChiranjeevi Rapolu }; 885de35c9bSChiranjeevi Rapolu 895de35c9bSChiranjeevi Rapolu struct ov5670_reg_list { 905de35c9bSChiranjeevi Rapolu u32 num_of_regs; 915de35c9bSChiranjeevi Rapolu const struct ov5670_reg *regs; 925de35c9bSChiranjeevi Rapolu }; 935de35c9bSChiranjeevi Rapolu 945de35c9bSChiranjeevi Rapolu struct ov5670_link_freq_config { 955de35c9bSChiranjeevi Rapolu u32 pixel_rate; 965de35c9bSChiranjeevi Rapolu const struct ov5670_reg_list reg_list; 975de35c9bSChiranjeevi Rapolu }; 985de35c9bSChiranjeevi Rapolu 99cf9ab879SJacopo Mondi static const char * const ov5670_supply_names[] = { 100cf9ab879SJacopo Mondi "avdd", /* Analog power */ 101cf9ab879SJacopo Mondi "dvdd", /* Digital power */ 102cf9ab879SJacopo Mondi "dovdd", /* Digital output power */ 103cf9ab879SJacopo Mondi }; 104cf9ab879SJacopo Mondi 105cf9ab879SJacopo Mondi #define OV5670_NUM_SUPPLIES ARRAY_SIZE(ov5670_supply_names) 106cf9ab879SJacopo Mondi 1075de35c9bSChiranjeevi Rapolu struct ov5670_mode { 1085de35c9bSChiranjeevi Rapolu /* Frame width in pixels */ 1095de35c9bSChiranjeevi Rapolu u32 width; 1105de35c9bSChiranjeevi Rapolu 1115de35c9bSChiranjeevi Rapolu /* Frame height in pixels */ 1125de35c9bSChiranjeevi Rapolu u32 height; 1135de35c9bSChiranjeevi Rapolu 114ed351ad9SChiranjeevi Rapolu /* Default vertical timining size */ 115ed351ad9SChiranjeevi Rapolu u32 vts_def; 116ed351ad9SChiranjeevi Rapolu 117ed351ad9SChiranjeevi Rapolu /* Min vertical timining size */ 118ed351ad9SChiranjeevi Rapolu u32 vts_min; 1195de35c9bSChiranjeevi Rapolu 1205de35c9bSChiranjeevi Rapolu /* Link frequency needed for this resolution */ 1215de35c9bSChiranjeevi Rapolu u32 link_freq_index; 1225de35c9bSChiranjeevi Rapolu 1232eadd98dSJean-Michel Hautbois /* Analog crop rectangle */ 1242eadd98dSJean-Michel Hautbois const struct v4l2_rect *analog_crop; 1252eadd98dSJean-Michel Hautbois 1265de35c9bSChiranjeevi Rapolu /* Sensor register settings for this resolution */ 1275de35c9bSChiranjeevi Rapolu const struct ov5670_reg_list reg_list; 1285de35c9bSChiranjeevi Rapolu }; 1295de35c9bSChiranjeevi Rapolu 1302eadd98dSJean-Michel Hautbois /* 1312eadd98dSJean-Michel Hautbois * All the modes supported by the driver are obtained by subsampling the 1322eadd98dSJean-Michel Hautbois * full pixel array. The below values are reflected in registers from 1332eadd98dSJean-Michel Hautbois * 0x3800-0x3807 in the modes register-value tables. 1342eadd98dSJean-Michel Hautbois */ 1352eadd98dSJean-Michel Hautbois static const struct v4l2_rect ov5670_analog_crop = { 1362eadd98dSJean-Michel Hautbois .left = 12, 1372eadd98dSJean-Michel Hautbois .top = 4, 1382eadd98dSJean-Michel Hautbois .width = 2600, 1392eadd98dSJean-Michel Hautbois .height = 1952, 1402eadd98dSJean-Michel Hautbois }; 1412eadd98dSJean-Michel Hautbois 1425de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mipi_data_rate_840mbps[] = { 1435de35c9bSChiranjeevi Rapolu {0x0300, 0x04}, 1445de35c9bSChiranjeevi Rapolu {0x0301, 0x00}, 1455de35c9bSChiranjeevi Rapolu {0x0302, 0x84}, 1465de35c9bSChiranjeevi Rapolu {0x0303, 0x00}, 1475de35c9bSChiranjeevi Rapolu {0x0304, 0x03}, 1485de35c9bSChiranjeevi Rapolu {0x0305, 0x01}, 1495de35c9bSChiranjeevi Rapolu {0x0306, 0x01}, 1505de35c9bSChiranjeevi Rapolu {0x030a, 0x00}, 1515de35c9bSChiranjeevi Rapolu {0x030b, 0x00}, 1525de35c9bSChiranjeevi Rapolu {0x030c, 0x00}, 1535de35c9bSChiranjeevi Rapolu {0x030d, 0x26}, 1545de35c9bSChiranjeevi Rapolu {0x030e, 0x00}, 1555de35c9bSChiranjeevi Rapolu {0x030f, 0x06}, 1565de35c9bSChiranjeevi Rapolu {0x0312, 0x01}, 1575de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 1585de35c9bSChiranjeevi Rapolu }; 1595de35c9bSChiranjeevi Rapolu 1605de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mode_2592x1944_regs[] = { 1615de35c9bSChiranjeevi Rapolu {0x3000, 0x00}, 1625de35c9bSChiranjeevi Rapolu {0x3002, 0x21}, 1635de35c9bSChiranjeevi Rapolu {0x3005, 0xf0}, 1645de35c9bSChiranjeevi Rapolu {0x3007, 0x00}, 1655de35c9bSChiranjeevi Rapolu {0x3015, 0x0f}, 1665de35c9bSChiranjeevi Rapolu {0x3018, 0x32}, 1675de35c9bSChiranjeevi Rapolu {0x301a, 0xf0}, 1685de35c9bSChiranjeevi Rapolu {0x301b, 0xf0}, 1695de35c9bSChiranjeevi Rapolu {0x301c, 0xf0}, 1705de35c9bSChiranjeevi Rapolu {0x301d, 0xf0}, 1715de35c9bSChiranjeevi Rapolu {0x301e, 0xf0}, 1725de35c9bSChiranjeevi Rapolu {0x3030, 0x00}, 1735de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 1745de35c9bSChiranjeevi Rapolu {0x303c, 0xff}, 1755de35c9bSChiranjeevi Rapolu {0x303e, 0xff}, 1765de35c9bSChiranjeevi Rapolu {0x3040, 0xf0}, 1775de35c9bSChiranjeevi Rapolu {0x3041, 0x00}, 1785de35c9bSChiranjeevi Rapolu {0x3042, 0xf0}, 1795de35c9bSChiranjeevi Rapolu {0x3106, 0x11}, 1805de35c9bSChiranjeevi Rapolu {0x3500, 0x00}, 1815de35c9bSChiranjeevi Rapolu {0x3501, 0x80}, 1825de35c9bSChiranjeevi Rapolu {0x3502, 0x00}, 1835de35c9bSChiranjeevi Rapolu {0x3503, 0x04}, 1845de35c9bSChiranjeevi Rapolu {0x3504, 0x03}, 1855de35c9bSChiranjeevi Rapolu {0x3505, 0x83}, 1865de35c9bSChiranjeevi Rapolu {0x3508, 0x04}, 1875de35c9bSChiranjeevi Rapolu {0x3509, 0x00}, 1885de35c9bSChiranjeevi Rapolu {0x350e, 0x04}, 1895de35c9bSChiranjeevi Rapolu {0x350f, 0x00}, 1905de35c9bSChiranjeevi Rapolu {0x3510, 0x00}, 1915de35c9bSChiranjeevi Rapolu {0x3511, 0x02}, 1925de35c9bSChiranjeevi Rapolu {0x3512, 0x00}, 1935de35c9bSChiranjeevi Rapolu {0x3601, 0xc8}, 1945de35c9bSChiranjeevi Rapolu {0x3610, 0x88}, 1955de35c9bSChiranjeevi Rapolu {0x3612, 0x48}, 1965de35c9bSChiranjeevi Rapolu {0x3614, 0x5b}, 1975de35c9bSChiranjeevi Rapolu {0x3615, 0x96}, 1985de35c9bSChiranjeevi Rapolu {0x3621, 0xd0}, 1995de35c9bSChiranjeevi Rapolu {0x3622, 0x00}, 2005de35c9bSChiranjeevi Rapolu {0x3623, 0x00}, 2015de35c9bSChiranjeevi Rapolu {0x3633, 0x13}, 2025de35c9bSChiranjeevi Rapolu {0x3634, 0x13}, 2035de35c9bSChiranjeevi Rapolu {0x3635, 0x13}, 2045de35c9bSChiranjeevi Rapolu {0x3636, 0x13}, 2055de35c9bSChiranjeevi Rapolu {0x3645, 0x13}, 2065de35c9bSChiranjeevi Rapolu {0x3646, 0x82}, 2075de35c9bSChiranjeevi Rapolu {0x3650, 0x00}, 2085de35c9bSChiranjeevi Rapolu {0x3652, 0xff}, 2095de35c9bSChiranjeevi Rapolu {0x3655, 0x20}, 2105de35c9bSChiranjeevi Rapolu {0x3656, 0xff}, 2115de35c9bSChiranjeevi Rapolu {0x365a, 0xff}, 2125de35c9bSChiranjeevi Rapolu {0x365e, 0xff}, 2135de35c9bSChiranjeevi Rapolu {0x3668, 0x00}, 2145de35c9bSChiranjeevi Rapolu {0x366a, 0x07}, 2155de35c9bSChiranjeevi Rapolu {0x366e, 0x10}, 2165de35c9bSChiranjeevi Rapolu {0x366d, 0x00}, 2175de35c9bSChiranjeevi Rapolu {0x366f, 0x80}, 2185de35c9bSChiranjeevi Rapolu {0x3700, 0x28}, 2195de35c9bSChiranjeevi Rapolu {0x3701, 0x10}, 2205de35c9bSChiranjeevi Rapolu {0x3702, 0x3a}, 2215de35c9bSChiranjeevi Rapolu {0x3703, 0x19}, 2225de35c9bSChiranjeevi Rapolu {0x3704, 0x10}, 2235de35c9bSChiranjeevi Rapolu {0x3705, 0x00}, 2245de35c9bSChiranjeevi Rapolu {0x3706, 0x66}, 2255de35c9bSChiranjeevi Rapolu {0x3707, 0x08}, 2265de35c9bSChiranjeevi Rapolu {0x3708, 0x34}, 2275de35c9bSChiranjeevi Rapolu {0x3709, 0x40}, 2285de35c9bSChiranjeevi Rapolu {0x370a, 0x01}, 2295de35c9bSChiranjeevi Rapolu {0x370b, 0x1b}, 2305de35c9bSChiranjeevi Rapolu {0x3714, 0x24}, 2315de35c9bSChiranjeevi Rapolu {0x371a, 0x3e}, 2325de35c9bSChiranjeevi Rapolu {0x3733, 0x00}, 2335de35c9bSChiranjeevi Rapolu {0x3734, 0x00}, 2345de35c9bSChiranjeevi Rapolu {0x373a, 0x05}, 2355de35c9bSChiranjeevi Rapolu {0x373b, 0x06}, 2365de35c9bSChiranjeevi Rapolu {0x373c, 0x0a}, 2375de35c9bSChiranjeevi Rapolu {0x373f, 0xa0}, 2385de35c9bSChiranjeevi Rapolu {0x3755, 0x00}, 2395de35c9bSChiranjeevi Rapolu {0x3758, 0x00}, 2405de35c9bSChiranjeevi Rapolu {0x375b, 0x0e}, 2415de35c9bSChiranjeevi Rapolu {0x3766, 0x5f}, 2425de35c9bSChiranjeevi Rapolu {0x3768, 0x00}, 2435de35c9bSChiranjeevi Rapolu {0x3769, 0x22}, 2445de35c9bSChiranjeevi Rapolu {0x3773, 0x08}, 2455de35c9bSChiranjeevi Rapolu {0x3774, 0x1f}, 2465de35c9bSChiranjeevi Rapolu {0x3776, 0x06}, 2475de35c9bSChiranjeevi Rapolu {0x37a0, 0x88}, 2485de35c9bSChiranjeevi Rapolu {0x37a1, 0x5c}, 2495de35c9bSChiranjeevi Rapolu {0x37a7, 0x88}, 2505de35c9bSChiranjeevi Rapolu {0x37a8, 0x70}, 2515de35c9bSChiranjeevi Rapolu {0x37aa, 0x88}, 2525de35c9bSChiranjeevi Rapolu {0x37ab, 0x48}, 2535de35c9bSChiranjeevi Rapolu {0x37b3, 0x66}, 2545de35c9bSChiranjeevi Rapolu {0x37c2, 0x04}, 2555de35c9bSChiranjeevi Rapolu {0x37c5, 0x00}, 2565de35c9bSChiranjeevi Rapolu {0x37c8, 0x00}, 2575de35c9bSChiranjeevi Rapolu {0x3800, 0x00}, 2585de35c9bSChiranjeevi Rapolu {0x3801, 0x0c}, 2595de35c9bSChiranjeevi Rapolu {0x3802, 0x00}, 2605de35c9bSChiranjeevi Rapolu {0x3803, 0x04}, 2615de35c9bSChiranjeevi Rapolu {0x3804, 0x0a}, 2625de35c9bSChiranjeevi Rapolu {0x3805, 0x33}, 2635de35c9bSChiranjeevi Rapolu {0x3806, 0x07}, 2645de35c9bSChiranjeevi Rapolu {0x3807, 0xa3}, 2655de35c9bSChiranjeevi Rapolu {0x3808, 0x0a}, 2665de35c9bSChiranjeevi Rapolu {0x3809, 0x20}, 2675de35c9bSChiranjeevi Rapolu {0x380a, 0x07}, 2685de35c9bSChiranjeevi Rapolu {0x380b, 0x98}, 2695de35c9bSChiranjeevi Rapolu {0x380c, 0x06}, 2705de35c9bSChiranjeevi Rapolu {0x380d, 0x90}, 2715de35c9bSChiranjeevi Rapolu {0x380e, 0x08}, 2725de35c9bSChiranjeevi Rapolu {0x380f, 0x08}, 2735de35c9bSChiranjeevi Rapolu {0x3811, 0x04}, 2745de35c9bSChiranjeevi Rapolu {0x3813, 0x02}, 2755de35c9bSChiranjeevi Rapolu {0x3814, 0x01}, 2765de35c9bSChiranjeevi Rapolu {0x3815, 0x01}, 2775de35c9bSChiranjeevi Rapolu {0x3816, 0x00}, 2785de35c9bSChiranjeevi Rapolu {0x3817, 0x00}, 2795de35c9bSChiranjeevi Rapolu {0x3818, 0x00}, 2805de35c9bSChiranjeevi Rapolu {0x3819, 0x00}, 2815de35c9bSChiranjeevi Rapolu {0x3820, 0x84}, 2825de35c9bSChiranjeevi Rapolu {0x3821, 0x46}, 2835de35c9bSChiranjeevi Rapolu {0x3822, 0x48}, 2845de35c9bSChiranjeevi Rapolu {0x3826, 0x00}, 2855de35c9bSChiranjeevi Rapolu {0x3827, 0x08}, 2865de35c9bSChiranjeevi Rapolu {0x382a, 0x01}, 2875de35c9bSChiranjeevi Rapolu {0x382b, 0x01}, 2885de35c9bSChiranjeevi Rapolu {0x3830, 0x08}, 2895de35c9bSChiranjeevi Rapolu {0x3836, 0x02}, 2905de35c9bSChiranjeevi Rapolu {0x3837, 0x00}, 2915de35c9bSChiranjeevi Rapolu {0x3838, 0x10}, 2925de35c9bSChiranjeevi Rapolu {0x3841, 0xff}, 2935de35c9bSChiranjeevi Rapolu {0x3846, 0x48}, 2945de35c9bSChiranjeevi Rapolu {0x3861, 0x00}, 2955de35c9bSChiranjeevi Rapolu {0x3862, 0x04}, 2965de35c9bSChiranjeevi Rapolu {0x3863, 0x06}, 2975de35c9bSChiranjeevi Rapolu {0x3a11, 0x01}, 2985de35c9bSChiranjeevi Rapolu {0x3a12, 0x78}, 2995de35c9bSChiranjeevi Rapolu {0x3b00, 0x00}, 3005de35c9bSChiranjeevi Rapolu {0x3b02, 0x00}, 3015de35c9bSChiranjeevi Rapolu {0x3b03, 0x00}, 3025de35c9bSChiranjeevi Rapolu {0x3b04, 0x00}, 3035de35c9bSChiranjeevi Rapolu {0x3b05, 0x00}, 3045de35c9bSChiranjeevi Rapolu {0x3c00, 0x89}, 3055de35c9bSChiranjeevi Rapolu {0x3c01, 0xab}, 3065de35c9bSChiranjeevi Rapolu {0x3c02, 0x01}, 3075de35c9bSChiranjeevi Rapolu {0x3c03, 0x00}, 3085de35c9bSChiranjeevi Rapolu {0x3c04, 0x00}, 3095de35c9bSChiranjeevi Rapolu {0x3c05, 0x03}, 3105de35c9bSChiranjeevi Rapolu {0x3c06, 0x00}, 3115de35c9bSChiranjeevi Rapolu {0x3c07, 0x05}, 3125de35c9bSChiranjeevi Rapolu {0x3c0c, 0x00}, 3135de35c9bSChiranjeevi Rapolu {0x3c0d, 0x00}, 3145de35c9bSChiranjeevi Rapolu {0x3c0e, 0x00}, 3155de35c9bSChiranjeevi Rapolu {0x3c0f, 0x00}, 3165de35c9bSChiranjeevi Rapolu {0x3c40, 0x00}, 3175de35c9bSChiranjeevi Rapolu {0x3c41, 0xa3}, 3185de35c9bSChiranjeevi Rapolu {0x3c43, 0x7d}, 3195de35c9bSChiranjeevi Rapolu {0x3c45, 0xd7}, 3205de35c9bSChiranjeevi Rapolu {0x3c47, 0xfc}, 3215de35c9bSChiranjeevi Rapolu {0x3c50, 0x05}, 3225de35c9bSChiranjeevi Rapolu {0x3c52, 0xaa}, 3235de35c9bSChiranjeevi Rapolu {0x3c54, 0x71}, 3245de35c9bSChiranjeevi Rapolu {0x3c56, 0x80}, 3255de35c9bSChiranjeevi Rapolu {0x3d85, 0x17}, 3265de35c9bSChiranjeevi Rapolu {0x3f03, 0x00}, 3275de35c9bSChiranjeevi Rapolu {0x3f0a, 0x00}, 3285de35c9bSChiranjeevi Rapolu {0x3f0b, 0x00}, 3295de35c9bSChiranjeevi Rapolu {0x4001, 0x60}, 3305de35c9bSChiranjeevi Rapolu {0x4009, 0x0d}, 3315de35c9bSChiranjeevi Rapolu {0x4020, 0x00}, 3325de35c9bSChiranjeevi Rapolu {0x4021, 0x00}, 3335de35c9bSChiranjeevi Rapolu {0x4022, 0x00}, 3345de35c9bSChiranjeevi Rapolu {0x4023, 0x00}, 3355de35c9bSChiranjeevi Rapolu {0x4024, 0x00}, 3365de35c9bSChiranjeevi Rapolu {0x4025, 0x00}, 3375de35c9bSChiranjeevi Rapolu {0x4026, 0x00}, 3385de35c9bSChiranjeevi Rapolu {0x4027, 0x00}, 3395de35c9bSChiranjeevi Rapolu {0x4028, 0x00}, 3405de35c9bSChiranjeevi Rapolu {0x4029, 0x00}, 3415de35c9bSChiranjeevi Rapolu {0x402a, 0x00}, 3425de35c9bSChiranjeevi Rapolu {0x402b, 0x00}, 3435de35c9bSChiranjeevi Rapolu {0x402c, 0x00}, 3445de35c9bSChiranjeevi Rapolu {0x402d, 0x00}, 3455de35c9bSChiranjeevi Rapolu {0x402e, 0x00}, 3465de35c9bSChiranjeevi Rapolu {0x402f, 0x00}, 3475de35c9bSChiranjeevi Rapolu {0x4040, 0x00}, 3485de35c9bSChiranjeevi Rapolu {0x4041, 0x03}, 3495de35c9bSChiranjeevi Rapolu {0x4042, 0x00}, 3505de35c9bSChiranjeevi Rapolu {0x4043, 0x7A}, 3515de35c9bSChiranjeevi Rapolu {0x4044, 0x00}, 3525de35c9bSChiranjeevi Rapolu {0x4045, 0x7A}, 3535de35c9bSChiranjeevi Rapolu {0x4046, 0x00}, 3545de35c9bSChiranjeevi Rapolu {0x4047, 0x7A}, 3555de35c9bSChiranjeevi Rapolu {0x4048, 0x00}, 3565de35c9bSChiranjeevi Rapolu {0x4049, 0x7A}, 3575de35c9bSChiranjeevi Rapolu {0x4307, 0x30}, 3585de35c9bSChiranjeevi Rapolu {0x4500, 0x58}, 3595de35c9bSChiranjeevi Rapolu {0x4501, 0x04}, 3605de35c9bSChiranjeevi Rapolu {0x4502, 0x40}, 3615de35c9bSChiranjeevi Rapolu {0x4503, 0x10}, 3625de35c9bSChiranjeevi Rapolu {0x4508, 0xaa}, 3635de35c9bSChiranjeevi Rapolu {0x4509, 0xaa}, 3645de35c9bSChiranjeevi Rapolu {0x450a, 0x00}, 3655de35c9bSChiranjeevi Rapolu {0x450b, 0x00}, 3665de35c9bSChiranjeevi Rapolu {0x4600, 0x01}, 3675de35c9bSChiranjeevi Rapolu {0x4601, 0x03}, 3685de35c9bSChiranjeevi Rapolu {0x4700, 0xa4}, 3695de35c9bSChiranjeevi Rapolu {0x4800, 0x4c}, 3705de35c9bSChiranjeevi Rapolu {0x4816, 0x53}, 3715de35c9bSChiranjeevi Rapolu {0x481f, 0x40}, 3725de35c9bSChiranjeevi Rapolu {0x4837, 0x13}, 3735de35c9bSChiranjeevi Rapolu {0x5000, 0x56}, 3745de35c9bSChiranjeevi Rapolu {0x5001, 0x01}, 3755de35c9bSChiranjeevi Rapolu {0x5002, 0x28}, 3765de35c9bSChiranjeevi Rapolu {0x5004, 0x0c}, 3775de35c9bSChiranjeevi Rapolu {0x5006, 0x0c}, 3785de35c9bSChiranjeevi Rapolu {0x5007, 0xe0}, 3795de35c9bSChiranjeevi Rapolu {0x5008, 0x01}, 3805de35c9bSChiranjeevi Rapolu {0x5009, 0xb0}, 3815de35c9bSChiranjeevi Rapolu {0x5901, 0x00}, 3825de35c9bSChiranjeevi Rapolu {0x5a01, 0x00}, 3835de35c9bSChiranjeevi Rapolu {0x5a03, 0x00}, 3845de35c9bSChiranjeevi Rapolu {0x5a04, 0x0c}, 3855de35c9bSChiranjeevi Rapolu {0x5a05, 0xe0}, 3865de35c9bSChiranjeevi Rapolu {0x5a06, 0x09}, 3875de35c9bSChiranjeevi Rapolu {0x5a07, 0xb0}, 3885de35c9bSChiranjeevi Rapolu {0x5a08, 0x06}, 3895de35c9bSChiranjeevi Rapolu {0x5e00, 0x00}, 3905de35c9bSChiranjeevi Rapolu {0x3734, 0x40}, 3915de35c9bSChiranjeevi Rapolu {0x5b00, 0x01}, 3925de35c9bSChiranjeevi Rapolu {0x5b01, 0x10}, 3935de35c9bSChiranjeevi Rapolu {0x5b02, 0x01}, 3945de35c9bSChiranjeevi Rapolu {0x5b03, 0xdb}, 3955de35c9bSChiranjeevi Rapolu {0x3d8c, 0x71}, 3965de35c9bSChiranjeevi Rapolu {0x3d8d, 0xea}, 3975de35c9bSChiranjeevi Rapolu {0x4017, 0x08}, 3985de35c9bSChiranjeevi Rapolu {0x3618, 0x2a}, 3995de35c9bSChiranjeevi Rapolu {0x5780, 0x3e}, 4005de35c9bSChiranjeevi Rapolu {0x5781, 0x0f}, 4015de35c9bSChiranjeevi Rapolu {0x5782, 0x44}, 4025de35c9bSChiranjeevi Rapolu {0x5783, 0x02}, 4035de35c9bSChiranjeevi Rapolu {0x5784, 0x01}, 4045de35c9bSChiranjeevi Rapolu {0x5785, 0x01}, 4055de35c9bSChiranjeevi Rapolu {0x5786, 0x00}, 4065de35c9bSChiranjeevi Rapolu {0x5787, 0x04}, 4075de35c9bSChiranjeevi Rapolu {0x5788, 0x02}, 4085de35c9bSChiranjeevi Rapolu {0x5789, 0x0f}, 4095de35c9bSChiranjeevi Rapolu {0x578a, 0xfd}, 4105de35c9bSChiranjeevi Rapolu {0x578b, 0xf5}, 4115de35c9bSChiranjeevi Rapolu {0x578c, 0xf5}, 4125de35c9bSChiranjeevi Rapolu {0x578d, 0x03}, 4135de35c9bSChiranjeevi Rapolu {0x578e, 0x08}, 4145de35c9bSChiranjeevi Rapolu {0x578f, 0x0c}, 4155de35c9bSChiranjeevi Rapolu {0x5790, 0x08}, 4165de35c9bSChiranjeevi Rapolu {0x5791, 0x06}, 4175de35c9bSChiranjeevi Rapolu {0x5792, 0x00}, 4185de35c9bSChiranjeevi Rapolu {0x5793, 0x52}, 4195de35c9bSChiranjeevi Rapolu {0x5794, 0xa3}, 42099cd1242SChiranjeevi Rapolu {0x3503, 0x00}, 42199cd1242SChiranjeevi Rapolu {0x5045, 0x05}, 42299cd1242SChiranjeevi Rapolu {0x4003, 0x40}, 42399cd1242SChiranjeevi Rapolu {0x5048, 0x40} 4245de35c9bSChiranjeevi Rapolu }; 4255de35c9bSChiranjeevi Rapolu 4265de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mode_1296x972_regs[] = { 4275de35c9bSChiranjeevi Rapolu {0x3000, 0x00}, 4285de35c9bSChiranjeevi Rapolu {0x3002, 0x21}, 4295de35c9bSChiranjeevi Rapolu {0x3005, 0xf0}, 4305de35c9bSChiranjeevi Rapolu {0x3007, 0x00}, 4315de35c9bSChiranjeevi Rapolu {0x3015, 0x0f}, 4325de35c9bSChiranjeevi Rapolu {0x3018, 0x32}, 4335de35c9bSChiranjeevi Rapolu {0x301a, 0xf0}, 4345de35c9bSChiranjeevi Rapolu {0x301b, 0xf0}, 4355de35c9bSChiranjeevi Rapolu {0x301c, 0xf0}, 4365de35c9bSChiranjeevi Rapolu {0x301d, 0xf0}, 4375de35c9bSChiranjeevi Rapolu {0x301e, 0xf0}, 4385de35c9bSChiranjeevi Rapolu {0x3030, 0x00}, 4395de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 4405de35c9bSChiranjeevi Rapolu {0x303c, 0xff}, 4415de35c9bSChiranjeevi Rapolu {0x303e, 0xff}, 4425de35c9bSChiranjeevi Rapolu {0x3040, 0xf0}, 4435de35c9bSChiranjeevi Rapolu {0x3041, 0x00}, 4445de35c9bSChiranjeevi Rapolu {0x3042, 0xf0}, 4455de35c9bSChiranjeevi Rapolu {0x3106, 0x11}, 4465de35c9bSChiranjeevi Rapolu {0x3500, 0x00}, 4475de35c9bSChiranjeevi Rapolu {0x3501, 0x80}, 4485de35c9bSChiranjeevi Rapolu {0x3502, 0x00}, 4495de35c9bSChiranjeevi Rapolu {0x3503, 0x04}, 4505de35c9bSChiranjeevi Rapolu {0x3504, 0x03}, 4515de35c9bSChiranjeevi Rapolu {0x3505, 0x83}, 4525de35c9bSChiranjeevi Rapolu {0x3508, 0x07}, 4535de35c9bSChiranjeevi Rapolu {0x3509, 0x80}, 4545de35c9bSChiranjeevi Rapolu {0x350e, 0x04}, 4555de35c9bSChiranjeevi Rapolu {0x350f, 0x00}, 4565de35c9bSChiranjeevi Rapolu {0x3510, 0x00}, 4575de35c9bSChiranjeevi Rapolu {0x3511, 0x02}, 4585de35c9bSChiranjeevi Rapolu {0x3512, 0x00}, 4595de35c9bSChiranjeevi Rapolu {0x3601, 0xc8}, 4605de35c9bSChiranjeevi Rapolu {0x3610, 0x88}, 4615de35c9bSChiranjeevi Rapolu {0x3612, 0x48}, 4625de35c9bSChiranjeevi Rapolu {0x3614, 0x5b}, 4635de35c9bSChiranjeevi Rapolu {0x3615, 0x96}, 4645de35c9bSChiranjeevi Rapolu {0x3621, 0xd0}, 4655de35c9bSChiranjeevi Rapolu {0x3622, 0x00}, 4665de35c9bSChiranjeevi Rapolu {0x3623, 0x00}, 4675de35c9bSChiranjeevi Rapolu {0x3633, 0x13}, 4685de35c9bSChiranjeevi Rapolu {0x3634, 0x13}, 4695de35c9bSChiranjeevi Rapolu {0x3635, 0x13}, 4705de35c9bSChiranjeevi Rapolu {0x3636, 0x13}, 4715de35c9bSChiranjeevi Rapolu {0x3645, 0x13}, 4725de35c9bSChiranjeevi Rapolu {0x3646, 0x82}, 4735de35c9bSChiranjeevi Rapolu {0x3650, 0x00}, 4745de35c9bSChiranjeevi Rapolu {0x3652, 0xff}, 4755de35c9bSChiranjeevi Rapolu {0x3655, 0x20}, 4765de35c9bSChiranjeevi Rapolu {0x3656, 0xff}, 4775de35c9bSChiranjeevi Rapolu {0x365a, 0xff}, 4785de35c9bSChiranjeevi Rapolu {0x365e, 0xff}, 4795de35c9bSChiranjeevi Rapolu {0x3668, 0x00}, 4805de35c9bSChiranjeevi Rapolu {0x366a, 0x07}, 4815de35c9bSChiranjeevi Rapolu {0x366e, 0x08}, 4825de35c9bSChiranjeevi Rapolu {0x366d, 0x00}, 4835de35c9bSChiranjeevi Rapolu {0x366f, 0x80}, 4845de35c9bSChiranjeevi Rapolu {0x3700, 0x28}, 4855de35c9bSChiranjeevi Rapolu {0x3701, 0x10}, 4865de35c9bSChiranjeevi Rapolu {0x3702, 0x3a}, 4875de35c9bSChiranjeevi Rapolu {0x3703, 0x19}, 4885de35c9bSChiranjeevi Rapolu {0x3704, 0x10}, 4895de35c9bSChiranjeevi Rapolu {0x3705, 0x00}, 4905de35c9bSChiranjeevi Rapolu {0x3706, 0x66}, 4915de35c9bSChiranjeevi Rapolu {0x3707, 0x08}, 4925de35c9bSChiranjeevi Rapolu {0x3708, 0x34}, 4935de35c9bSChiranjeevi Rapolu {0x3709, 0x40}, 4945de35c9bSChiranjeevi Rapolu {0x370a, 0x01}, 4955de35c9bSChiranjeevi Rapolu {0x370b, 0x1b}, 4965de35c9bSChiranjeevi Rapolu {0x3714, 0x24}, 4975de35c9bSChiranjeevi Rapolu {0x371a, 0x3e}, 4985de35c9bSChiranjeevi Rapolu {0x3733, 0x00}, 4995de35c9bSChiranjeevi Rapolu {0x3734, 0x00}, 5005de35c9bSChiranjeevi Rapolu {0x373a, 0x05}, 5015de35c9bSChiranjeevi Rapolu {0x373b, 0x06}, 5025de35c9bSChiranjeevi Rapolu {0x373c, 0x0a}, 5035de35c9bSChiranjeevi Rapolu {0x373f, 0xa0}, 5045de35c9bSChiranjeevi Rapolu {0x3755, 0x00}, 5055de35c9bSChiranjeevi Rapolu {0x3758, 0x00}, 5065de35c9bSChiranjeevi Rapolu {0x375b, 0x0e}, 5075de35c9bSChiranjeevi Rapolu {0x3766, 0x5f}, 5085de35c9bSChiranjeevi Rapolu {0x3768, 0x00}, 5095de35c9bSChiranjeevi Rapolu {0x3769, 0x22}, 5105de35c9bSChiranjeevi Rapolu {0x3773, 0x08}, 5115de35c9bSChiranjeevi Rapolu {0x3774, 0x1f}, 5125de35c9bSChiranjeevi Rapolu {0x3776, 0x06}, 5135de35c9bSChiranjeevi Rapolu {0x37a0, 0x88}, 5145de35c9bSChiranjeevi Rapolu {0x37a1, 0x5c}, 5155de35c9bSChiranjeevi Rapolu {0x37a7, 0x88}, 5165de35c9bSChiranjeevi Rapolu {0x37a8, 0x70}, 5175de35c9bSChiranjeevi Rapolu {0x37aa, 0x88}, 5185de35c9bSChiranjeevi Rapolu {0x37ab, 0x48}, 5195de35c9bSChiranjeevi Rapolu {0x37b3, 0x66}, 5205de35c9bSChiranjeevi Rapolu {0x37c2, 0x04}, 5215de35c9bSChiranjeevi Rapolu {0x37c5, 0x00}, 5225de35c9bSChiranjeevi Rapolu {0x37c8, 0x00}, 5235de35c9bSChiranjeevi Rapolu {0x3800, 0x00}, 5245de35c9bSChiranjeevi Rapolu {0x3801, 0x0c}, 5255de35c9bSChiranjeevi Rapolu {0x3802, 0x00}, 5265de35c9bSChiranjeevi Rapolu {0x3803, 0x04}, 5275de35c9bSChiranjeevi Rapolu {0x3804, 0x0a}, 5285de35c9bSChiranjeevi Rapolu {0x3805, 0x33}, 5295de35c9bSChiranjeevi Rapolu {0x3806, 0x07}, 5305de35c9bSChiranjeevi Rapolu {0x3807, 0xa3}, 5315de35c9bSChiranjeevi Rapolu {0x3808, 0x05}, 5325de35c9bSChiranjeevi Rapolu {0x3809, 0x10}, 5335de35c9bSChiranjeevi Rapolu {0x380a, 0x03}, 5345de35c9bSChiranjeevi Rapolu {0x380b, 0xcc}, 5355de35c9bSChiranjeevi Rapolu {0x380c, 0x06}, 5365de35c9bSChiranjeevi Rapolu {0x380d, 0x90}, 5375de35c9bSChiranjeevi Rapolu {0x380e, 0x08}, 5385de35c9bSChiranjeevi Rapolu {0x380f, 0x08}, 5395de35c9bSChiranjeevi Rapolu {0x3811, 0x04}, 5405de35c9bSChiranjeevi Rapolu {0x3813, 0x04}, 5415de35c9bSChiranjeevi Rapolu {0x3814, 0x03}, 5425de35c9bSChiranjeevi Rapolu {0x3815, 0x01}, 5435de35c9bSChiranjeevi Rapolu {0x3816, 0x00}, 5445de35c9bSChiranjeevi Rapolu {0x3817, 0x00}, 5455de35c9bSChiranjeevi Rapolu {0x3818, 0x00}, 5465de35c9bSChiranjeevi Rapolu {0x3819, 0x00}, 5475de35c9bSChiranjeevi Rapolu {0x3820, 0x94}, 5485de35c9bSChiranjeevi Rapolu {0x3821, 0x47}, 5495de35c9bSChiranjeevi Rapolu {0x3822, 0x48}, 5505de35c9bSChiranjeevi Rapolu {0x3826, 0x00}, 5515de35c9bSChiranjeevi Rapolu {0x3827, 0x08}, 5525de35c9bSChiranjeevi Rapolu {0x382a, 0x03}, 5535de35c9bSChiranjeevi Rapolu {0x382b, 0x01}, 5545de35c9bSChiranjeevi Rapolu {0x3830, 0x08}, 5555de35c9bSChiranjeevi Rapolu {0x3836, 0x02}, 5565de35c9bSChiranjeevi Rapolu {0x3837, 0x00}, 5575de35c9bSChiranjeevi Rapolu {0x3838, 0x10}, 5585de35c9bSChiranjeevi Rapolu {0x3841, 0xff}, 5595de35c9bSChiranjeevi Rapolu {0x3846, 0x48}, 5605de35c9bSChiranjeevi Rapolu {0x3861, 0x00}, 5615de35c9bSChiranjeevi Rapolu {0x3862, 0x04}, 5625de35c9bSChiranjeevi Rapolu {0x3863, 0x06}, 5635de35c9bSChiranjeevi Rapolu {0x3a11, 0x01}, 5645de35c9bSChiranjeevi Rapolu {0x3a12, 0x78}, 5655de35c9bSChiranjeevi Rapolu {0x3b00, 0x00}, 5665de35c9bSChiranjeevi Rapolu {0x3b02, 0x00}, 5675de35c9bSChiranjeevi Rapolu {0x3b03, 0x00}, 5685de35c9bSChiranjeevi Rapolu {0x3b04, 0x00}, 5695de35c9bSChiranjeevi Rapolu {0x3b05, 0x00}, 5705de35c9bSChiranjeevi Rapolu {0x3c00, 0x89}, 5715de35c9bSChiranjeevi Rapolu {0x3c01, 0xab}, 5725de35c9bSChiranjeevi Rapolu {0x3c02, 0x01}, 5735de35c9bSChiranjeevi Rapolu {0x3c03, 0x00}, 5745de35c9bSChiranjeevi Rapolu {0x3c04, 0x00}, 5755de35c9bSChiranjeevi Rapolu {0x3c05, 0x03}, 5765de35c9bSChiranjeevi Rapolu {0x3c06, 0x00}, 5775de35c9bSChiranjeevi Rapolu {0x3c07, 0x05}, 5785de35c9bSChiranjeevi Rapolu {0x3c0c, 0x00}, 5795de35c9bSChiranjeevi Rapolu {0x3c0d, 0x00}, 5805de35c9bSChiranjeevi Rapolu {0x3c0e, 0x00}, 5815de35c9bSChiranjeevi Rapolu {0x3c0f, 0x00}, 5825de35c9bSChiranjeevi Rapolu {0x3c40, 0x00}, 5835de35c9bSChiranjeevi Rapolu {0x3c41, 0xa3}, 5845de35c9bSChiranjeevi Rapolu {0x3c43, 0x7d}, 5855de35c9bSChiranjeevi Rapolu {0x3c45, 0xd7}, 5865de35c9bSChiranjeevi Rapolu {0x3c47, 0xfc}, 5875de35c9bSChiranjeevi Rapolu {0x3c50, 0x05}, 5885de35c9bSChiranjeevi Rapolu {0x3c52, 0xaa}, 5895de35c9bSChiranjeevi Rapolu {0x3c54, 0x71}, 5905de35c9bSChiranjeevi Rapolu {0x3c56, 0x80}, 5915de35c9bSChiranjeevi Rapolu {0x3d85, 0x17}, 5925de35c9bSChiranjeevi Rapolu {0x3f03, 0x00}, 5935de35c9bSChiranjeevi Rapolu {0x3f0a, 0x00}, 5945de35c9bSChiranjeevi Rapolu {0x3f0b, 0x00}, 5955de35c9bSChiranjeevi Rapolu {0x4001, 0x60}, 5965de35c9bSChiranjeevi Rapolu {0x4009, 0x05}, 5975de35c9bSChiranjeevi Rapolu {0x4020, 0x00}, 5985de35c9bSChiranjeevi Rapolu {0x4021, 0x00}, 5995de35c9bSChiranjeevi Rapolu {0x4022, 0x00}, 6005de35c9bSChiranjeevi Rapolu {0x4023, 0x00}, 6015de35c9bSChiranjeevi Rapolu {0x4024, 0x00}, 6025de35c9bSChiranjeevi Rapolu {0x4025, 0x00}, 6035de35c9bSChiranjeevi Rapolu {0x4026, 0x00}, 6045de35c9bSChiranjeevi Rapolu {0x4027, 0x00}, 6055de35c9bSChiranjeevi Rapolu {0x4028, 0x00}, 6065de35c9bSChiranjeevi Rapolu {0x4029, 0x00}, 6075de35c9bSChiranjeevi Rapolu {0x402a, 0x00}, 6085de35c9bSChiranjeevi Rapolu {0x402b, 0x00}, 6095de35c9bSChiranjeevi Rapolu {0x402c, 0x00}, 6105de35c9bSChiranjeevi Rapolu {0x402d, 0x00}, 6115de35c9bSChiranjeevi Rapolu {0x402e, 0x00}, 6125de35c9bSChiranjeevi Rapolu {0x402f, 0x00}, 6135de35c9bSChiranjeevi Rapolu {0x4040, 0x00}, 6145de35c9bSChiranjeevi Rapolu {0x4041, 0x03}, 6155de35c9bSChiranjeevi Rapolu {0x4042, 0x00}, 6165de35c9bSChiranjeevi Rapolu {0x4043, 0x7A}, 6175de35c9bSChiranjeevi Rapolu {0x4044, 0x00}, 6185de35c9bSChiranjeevi Rapolu {0x4045, 0x7A}, 6195de35c9bSChiranjeevi Rapolu {0x4046, 0x00}, 6205de35c9bSChiranjeevi Rapolu {0x4047, 0x7A}, 6215de35c9bSChiranjeevi Rapolu {0x4048, 0x00}, 6225de35c9bSChiranjeevi Rapolu {0x4049, 0x7A}, 6235de35c9bSChiranjeevi Rapolu {0x4307, 0x30}, 6245de35c9bSChiranjeevi Rapolu {0x4500, 0x58}, 6255de35c9bSChiranjeevi Rapolu {0x4501, 0x04}, 6265de35c9bSChiranjeevi Rapolu {0x4502, 0x48}, 6275de35c9bSChiranjeevi Rapolu {0x4503, 0x10}, 6285de35c9bSChiranjeevi Rapolu {0x4508, 0x55}, 6295de35c9bSChiranjeevi Rapolu {0x4509, 0x55}, 6305de35c9bSChiranjeevi Rapolu {0x450a, 0x00}, 6315de35c9bSChiranjeevi Rapolu {0x450b, 0x00}, 6325de35c9bSChiranjeevi Rapolu {0x4600, 0x00}, 6335de35c9bSChiranjeevi Rapolu {0x4601, 0x81}, 6345de35c9bSChiranjeevi Rapolu {0x4700, 0xa4}, 6355de35c9bSChiranjeevi Rapolu {0x4800, 0x4c}, 6365de35c9bSChiranjeevi Rapolu {0x4816, 0x53}, 6375de35c9bSChiranjeevi Rapolu {0x481f, 0x40}, 6385de35c9bSChiranjeevi Rapolu {0x4837, 0x13}, 6395de35c9bSChiranjeevi Rapolu {0x5000, 0x56}, 6405de35c9bSChiranjeevi Rapolu {0x5001, 0x01}, 6415de35c9bSChiranjeevi Rapolu {0x5002, 0x28}, 6425de35c9bSChiranjeevi Rapolu {0x5004, 0x0c}, 6435de35c9bSChiranjeevi Rapolu {0x5006, 0x0c}, 6445de35c9bSChiranjeevi Rapolu {0x5007, 0xe0}, 6455de35c9bSChiranjeevi Rapolu {0x5008, 0x01}, 6465de35c9bSChiranjeevi Rapolu {0x5009, 0xb0}, 6475de35c9bSChiranjeevi Rapolu {0x5901, 0x00}, 6485de35c9bSChiranjeevi Rapolu {0x5a01, 0x00}, 6495de35c9bSChiranjeevi Rapolu {0x5a03, 0x00}, 6505de35c9bSChiranjeevi Rapolu {0x5a04, 0x0c}, 6515de35c9bSChiranjeevi Rapolu {0x5a05, 0xe0}, 6525de35c9bSChiranjeevi Rapolu {0x5a06, 0x09}, 6535de35c9bSChiranjeevi Rapolu {0x5a07, 0xb0}, 6545de35c9bSChiranjeevi Rapolu {0x5a08, 0x06}, 6555de35c9bSChiranjeevi Rapolu {0x5e00, 0x00}, 6565de35c9bSChiranjeevi Rapolu {0x3734, 0x40}, 6575de35c9bSChiranjeevi Rapolu {0x5b00, 0x01}, 6585de35c9bSChiranjeevi Rapolu {0x5b01, 0x10}, 6595de35c9bSChiranjeevi Rapolu {0x5b02, 0x01}, 6605de35c9bSChiranjeevi Rapolu {0x5b03, 0xdb}, 6615de35c9bSChiranjeevi Rapolu {0x3d8c, 0x71}, 6625de35c9bSChiranjeevi Rapolu {0x3d8d, 0xea}, 6635de35c9bSChiranjeevi Rapolu {0x4017, 0x10}, 6645de35c9bSChiranjeevi Rapolu {0x3618, 0x2a}, 6655de35c9bSChiranjeevi Rapolu {0x5780, 0x3e}, 6665de35c9bSChiranjeevi Rapolu {0x5781, 0x0f}, 6675de35c9bSChiranjeevi Rapolu {0x5782, 0x44}, 6685de35c9bSChiranjeevi Rapolu {0x5783, 0x02}, 6695de35c9bSChiranjeevi Rapolu {0x5784, 0x01}, 6705de35c9bSChiranjeevi Rapolu {0x5785, 0x01}, 6715de35c9bSChiranjeevi Rapolu {0x5786, 0x00}, 6725de35c9bSChiranjeevi Rapolu {0x5787, 0x04}, 6735de35c9bSChiranjeevi Rapolu {0x5788, 0x02}, 6745de35c9bSChiranjeevi Rapolu {0x5789, 0x0f}, 6755de35c9bSChiranjeevi Rapolu {0x578a, 0xfd}, 6765de35c9bSChiranjeevi Rapolu {0x578b, 0xf5}, 6775de35c9bSChiranjeevi Rapolu {0x578c, 0xf5}, 6785de35c9bSChiranjeevi Rapolu {0x578d, 0x03}, 6795de35c9bSChiranjeevi Rapolu {0x578e, 0x08}, 6805de35c9bSChiranjeevi Rapolu {0x578f, 0x0c}, 6815de35c9bSChiranjeevi Rapolu {0x5790, 0x08}, 6825de35c9bSChiranjeevi Rapolu {0x5791, 0x04}, 6835de35c9bSChiranjeevi Rapolu {0x5792, 0x00}, 6845de35c9bSChiranjeevi Rapolu {0x5793, 0x52}, 6855de35c9bSChiranjeevi Rapolu {0x5794, 0xa3}, 68699cd1242SChiranjeevi Rapolu {0x3503, 0x00}, 68799cd1242SChiranjeevi Rapolu {0x5045, 0x05}, 68899cd1242SChiranjeevi Rapolu {0x4003, 0x40}, 68999cd1242SChiranjeevi Rapolu {0x5048, 0x40} 6905de35c9bSChiranjeevi Rapolu }; 6915de35c9bSChiranjeevi Rapolu 6925de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mode_648x486_regs[] = { 6935de35c9bSChiranjeevi Rapolu {0x3000, 0x00}, 6945de35c9bSChiranjeevi Rapolu {0x3002, 0x21}, 6955de35c9bSChiranjeevi Rapolu {0x3005, 0xf0}, 6965de35c9bSChiranjeevi Rapolu {0x3007, 0x00}, 6975de35c9bSChiranjeevi Rapolu {0x3015, 0x0f}, 6985de35c9bSChiranjeevi Rapolu {0x3018, 0x32}, 6995de35c9bSChiranjeevi Rapolu {0x301a, 0xf0}, 7005de35c9bSChiranjeevi Rapolu {0x301b, 0xf0}, 7015de35c9bSChiranjeevi Rapolu {0x301c, 0xf0}, 7025de35c9bSChiranjeevi Rapolu {0x301d, 0xf0}, 7035de35c9bSChiranjeevi Rapolu {0x301e, 0xf0}, 7045de35c9bSChiranjeevi Rapolu {0x3030, 0x00}, 7055de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 7065de35c9bSChiranjeevi Rapolu {0x303c, 0xff}, 7075de35c9bSChiranjeevi Rapolu {0x303e, 0xff}, 7085de35c9bSChiranjeevi Rapolu {0x3040, 0xf0}, 7095de35c9bSChiranjeevi Rapolu {0x3041, 0x00}, 7105de35c9bSChiranjeevi Rapolu {0x3042, 0xf0}, 7115de35c9bSChiranjeevi Rapolu {0x3106, 0x11}, 7125de35c9bSChiranjeevi Rapolu {0x3500, 0x00}, 7135de35c9bSChiranjeevi Rapolu {0x3501, 0x80}, 7145de35c9bSChiranjeevi Rapolu {0x3502, 0x00}, 7155de35c9bSChiranjeevi Rapolu {0x3503, 0x04}, 7165de35c9bSChiranjeevi Rapolu {0x3504, 0x03}, 7175de35c9bSChiranjeevi Rapolu {0x3505, 0x83}, 7185de35c9bSChiranjeevi Rapolu {0x3508, 0x04}, 7195de35c9bSChiranjeevi Rapolu {0x3509, 0x00}, 7205de35c9bSChiranjeevi Rapolu {0x350e, 0x04}, 7215de35c9bSChiranjeevi Rapolu {0x350f, 0x00}, 7225de35c9bSChiranjeevi Rapolu {0x3510, 0x00}, 7235de35c9bSChiranjeevi Rapolu {0x3511, 0x02}, 7245de35c9bSChiranjeevi Rapolu {0x3512, 0x00}, 7255de35c9bSChiranjeevi Rapolu {0x3601, 0xc8}, 7265de35c9bSChiranjeevi Rapolu {0x3610, 0x88}, 7275de35c9bSChiranjeevi Rapolu {0x3612, 0x48}, 7285de35c9bSChiranjeevi Rapolu {0x3614, 0x5b}, 7295de35c9bSChiranjeevi Rapolu {0x3615, 0x96}, 7305de35c9bSChiranjeevi Rapolu {0x3621, 0xd0}, 7315de35c9bSChiranjeevi Rapolu {0x3622, 0x00}, 7325de35c9bSChiranjeevi Rapolu {0x3623, 0x04}, 7335de35c9bSChiranjeevi Rapolu {0x3633, 0x13}, 7345de35c9bSChiranjeevi Rapolu {0x3634, 0x13}, 7355de35c9bSChiranjeevi Rapolu {0x3635, 0x13}, 7365de35c9bSChiranjeevi Rapolu {0x3636, 0x13}, 7375de35c9bSChiranjeevi Rapolu {0x3645, 0x13}, 7385de35c9bSChiranjeevi Rapolu {0x3646, 0x82}, 7395de35c9bSChiranjeevi Rapolu {0x3650, 0x00}, 7405de35c9bSChiranjeevi Rapolu {0x3652, 0xff}, 7415de35c9bSChiranjeevi Rapolu {0x3655, 0x20}, 7425de35c9bSChiranjeevi Rapolu {0x3656, 0xff}, 7435de35c9bSChiranjeevi Rapolu {0x365a, 0xff}, 7445de35c9bSChiranjeevi Rapolu {0x365e, 0xff}, 7455de35c9bSChiranjeevi Rapolu {0x3668, 0x00}, 7465de35c9bSChiranjeevi Rapolu {0x366a, 0x07}, 7475de35c9bSChiranjeevi Rapolu {0x366e, 0x08}, 7485de35c9bSChiranjeevi Rapolu {0x366d, 0x00}, 7495de35c9bSChiranjeevi Rapolu {0x366f, 0x80}, 7505de35c9bSChiranjeevi Rapolu {0x3700, 0x28}, 7515de35c9bSChiranjeevi Rapolu {0x3701, 0x10}, 7525de35c9bSChiranjeevi Rapolu {0x3702, 0x3a}, 7535de35c9bSChiranjeevi Rapolu {0x3703, 0x19}, 7545de35c9bSChiranjeevi Rapolu {0x3704, 0x10}, 7555de35c9bSChiranjeevi Rapolu {0x3705, 0x00}, 7565de35c9bSChiranjeevi Rapolu {0x3706, 0x66}, 7575de35c9bSChiranjeevi Rapolu {0x3707, 0x08}, 7585de35c9bSChiranjeevi Rapolu {0x3708, 0x34}, 7595de35c9bSChiranjeevi Rapolu {0x3709, 0x40}, 7605de35c9bSChiranjeevi Rapolu {0x370a, 0x01}, 7615de35c9bSChiranjeevi Rapolu {0x370b, 0x1b}, 7625de35c9bSChiranjeevi Rapolu {0x3714, 0x24}, 7635de35c9bSChiranjeevi Rapolu {0x371a, 0x3e}, 7645de35c9bSChiranjeevi Rapolu {0x3733, 0x00}, 7655de35c9bSChiranjeevi Rapolu {0x3734, 0x00}, 7665de35c9bSChiranjeevi Rapolu {0x373a, 0x05}, 7675de35c9bSChiranjeevi Rapolu {0x373b, 0x06}, 7685de35c9bSChiranjeevi Rapolu {0x373c, 0x0a}, 7695de35c9bSChiranjeevi Rapolu {0x373f, 0xa0}, 7705de35c9bSChiranjeevi Rapolu {0x3755, 0x00}, 7715de35c9bSChiranjeevi Rapolu {0x3758, 0x00}, 7725de35c9bSChiranjeevi Rapolu {0x375b, 0x0e}, 7735de35c9bSChiranjeevi Rapolu {0x3766, 0x5f}, 7745de35c9bSChiranjeevi Rapolu {0x3768, 0x00}, 7755de35c9bSChiranjeevi Rapolu {0x3769, 0x22}, 7765de35c9bSChiranjeevi Rapolu {0x3773, 0x08}, 7775de35c9bSChiranjeevi Rapolu {0x3774, 0x1f}, 7785de35c9bSChiranjeevi Rapolu {0x3776, 0x06}, 7795de35c9bSChiranjeevi Rapolu {0x37a0, 0x88}, 7805de35c9bSChiranjeevi Rapolu {0x37a1, 0x5c}, 7815de35c9bSChiranjeevi Rapolu {0x37a7, 0x88}, 7825de35c9bSChiranjeevi Rapolu {0x37a8, 0x70}, 7835de35c9bSChiranjeevi Rapolu {0x37aa, 0x88}, 7845de35c9bSChiranjeevi Rapolu {0x37ab, 0x48}, 7855de35c9bSChiranjeevi Rapolu {0x37b3, 0x66}, 7865de35c9bSChiranjeevi Rapolu {0x37c2, 0x04}, 7875de35c9bSChiranjeevi Rapolu {0x37c5, 0x00}, 7885de35c9bSChiranjeevi Rapolu {0x37c8, 0x00}, 7895de35c9bSChiranjeevi Rapolu {0x3800, 0x00}, 7905de35c9bSChiranjeevi Rapolu {0x3801, 0x0c}, 7915de35c9bSChiranjeevi Rapolu {0x3802, 0x00}, 7925de35c9bSChiranjeevi Rapolu {0x3803, 0x04}, 7935de35c9bSChiranjeevi Rapolu {0x3804, 0x0a}, 7945de35c9bSChiranjeevi Rapolu {0x3805, 0x33}, 7955de35c9bSChiranjeevi Rapolu {0x3806, 0x07}, 7965de35c9bSChiranjeevi Rapolu {0x3807, 0xa3}, 7975de35c9bSChiranjeevi Rapolu {0x3808, 0x02}, 7985de35c9bSChiranjeevi Rapolu {0x3809, 0x88}, 7995de35c9bSChiranjeevi Rapolu {0x380a, 0x01}, 8005de35c9bSChiranjeevi Rapolu {0x380b, 0xe6}, 8015de35c9bSChiranjeevi Rapolu {0x380c, 0x06}, 8025de35c9bSChiranjeevi Rapolu {0x380d, 0x90}, 8035de35c9bSChiranjeevi Rapolu {0x380e, 0x08}, 8045de35c9bSChiranjeevi Rapolu {0x380f, 0x08}, 8055de35c9bSChiranjeevi Rapolu {0x3811, 0x04}, 8065de35c9bSChiranjeevi Rapolu {0x3813, 0x02}, 8075de35c9bSChiranjeevi Rapolu {0x3814, 0x07}, 8085de35c9bSChiranjeevi Rapolu {0x3815, 0x01}, 8095de35c9bSChiranjeevi Rapolu {0x3816, 0x00}, 8105de35c9bSChiranjeevi Rapolu {0x3817, 0x00}, 8115de35c9bSChiranjeevi Rapolu {0x3818, 0x00}, 8125de35c9bSChiranjeevi Rapolu {0x3819, 0x00}, 8135de35c9bSChiranjeevi Rapolu {0x3820, 0x94}, 8145de35c9bSChiranjeevi Rapolu {0x3821, 0xc6}, 8155de35c9bSChiranjeevi Rapolu {0x3822, 0x48}, 8165de35c9bSChiranjeevi Rapolu {0x3826, 0x00}, 8175de35c9bSChiranjeevi Rapolu {0x3827, 0x08}, 8185de35c9bSChiranjeevi Rapolu {0x382a, 0x07}, 8195de35c9bSChiranjeevi Rapolu {0x382b, 0x01}, 8205de35c9bSChiranjeevi Rapolu {0x3830, 0x08}, 8215de35c9bSChiranjeevi Rapolu {0x3836, 0x02}, 8225de35c9bSChiranjeevi Rapolu {0x3837, 0x00}, 8235de35c9bSChiranjeevi Rapolu {0x3838, 0x10}, 8245de35c9bSChiranjeevi Rapolu {0x3841, 0xff}, 8255de35c9bSChiranjeevi Rapolu {0x3846, 0x48}, 8265de35c9bSChiranjeevi Rapolu {0x3861, 0x00}, 8275de35c9bSChiranjeevi Rapolu {0x3862, 0x04}, 8285de35c9bSChiranjeevi Rapolu {0x3863, 0x06}, 8295de35c9bSChiranjeevi Rapolu {0x3a11, 0x01}, 8305de35c9bSChiranjeevi Rapolu {0x3a12, 0x78}, 8315de35c9bSChiranjeevi Rapolu {0x3b00, 0x00}, 8325de35c9bSChiranjeevi Rapolu {0x3b02, 0x00}, 8335de35c9bSChiranjeevi Rapolu {0x3b03, 0x00}, 8345de35c9bSChiranjeevi Rapolu {0x3b04, 0x00}, 8355de35c9bSChiranjeevi Rapolu {0x3b05, 0x00}, 8365de35c9bSChiranjeevi Rapolu {0x3c00, 0x89}, 8375de35c9bSChiranjeevi Rapolu {0x3c01, 0xab}, 8385de35c9bSChiranjeevi Rapolu {0x3c02, 0x01}, 8395de35c9bSChiranjeevi Rapolu {0x3c03, 0x00}, 8405de35c9bSChiranjeevi Rapolu {0x3c04, 0x00}, 8415de35c9bSChiranjeevi Rapolu {0x3c05, 0x03}, 8425de35c9bSChiranjeevi Rapolu {0x3c06, 0x00}, 8435de35c9bSChiranjeevi Rapolu {0x3c07, 0x05}, 8445de35c9bSChiranjeevi Rapolu {0x3c0c, 0x00}, 8455de35c9bSChiranjeevi Rapolu {0x3c0d, 0x00}, 8465de35c9bSChiranjeevi Rapolu {0x3c0e, 0x00}, 8475de35c9bSChiranjeevi Rapolu {0x3c0f, 0x00}, 8485de35c9bSChiranjeevi Rapolu {0x3c40, 0x00}, 8495de35c9bSChiranjeevi Rapolu {0x3c41, 0xa3}, 8505de35c9bSChiranjeevi Rapolu {0x3c43, 0x7d}, 8515de35c9bSChiranjeevi Rapolu {0x3c45, 0xd7}, 8525de35c9bSChiranjeevi Rapolu {0x3c47, 0xfc}, 8535de35c9bSChiranjeevi Rapolu {0x3c50, 0x05}, 8545de35c9bSChiranjeevi Rapolu {0x3c52, 0xaa}, 8555de35c9bSChiranjeevi Rapolu {0x3c54, 0x71}, 8565de35c9bSChiranjeevi Rapolu {0x3c56, 0x80}, 8575de35c9bSChiranjeevi Rapolu {0x3d85, 0x17}, 8585de35c9bSChiranjeevi Rapolu {0x3f03, 0x00}, 8595de35c9bSChiranjeevi Rapolu {0x3f0a, 0x00}, 8605de35c9bSChiranjeevi Rapolu {0x3f0b, 0x00}, 8615de35c9bSChiranjeevi Rapolu {0x4001, 0x60}, 8625de35c9bSChiranjeevi Rapolu {0x4009, 0x05}, 8635de35c9bSChiranjeevi Rapolu {0x4020, 0x00}, 8645de35c9bSChiranjeevi Rapolu {0x4021, 0x00}, 8655de35c9bSChiranjeevi Rapolu {0x4022, 0x00}, 8665de35c9bSChiranjeevi Rapolu {0x4023, 0x00}, 8675de35c9bSChiranjeevi Rapolu {0x4024, 0x00}, 8685de35c9bSChiranjeevi Rapolu {0x4025, 0x00}, 8695de35c9bSChiranjeevi Rapolu {0x4026, 0x00}, 8705de35c9bSChiranjeevi Rapolu {0x4027, 0x00}, 8715de35c9bSChiranjeevi Rapolu {0x4028, 0x00}, 8725de35c9bSChiranjeevi Rapolu {0x4029, 0x00}, 8735de35c9bSChiranjeevi Rapolu {0x402a, 0x00}, 8745de35c9bSChiranjeevi Rapolu {0x402b, 0x00}, 8755de35c9bSChiranjeevi Rapolu {0x402c, 0x00}, 8765de35c9bSChiranjeevi Rapolu {0x402d, 0x00}, 8775de35c9bSChiranjeevi Rapolu {0x402e, 0x00}, 8785de35c9bSChiranjeevi Rapolu {0x402f, 0x00}, 8795de35c9bSChiranjeevi Rapolu {0x4040, 0x00}, 8805de35c9bSChiranjeevi Rapolu {0x4041, 0x03}, 8815de35c9bSChiranjeevi Rapolu {0x4042, 0x00}, 8825de35c9bSChiranjeevi Rapolu {0x4043, 0x7A}, 8835de35c9bSChiranjeevi Rapolu {0x4044, 0x00}, 8845de35c9bSChiranjeevi Rapolu {0x4045, 0x7A}, 8855de35c9bSChiranjeevi Rapolu {0x4046, 0x00}, 8865de35c9bSChiranjeevi Rapolu {0x4047, 0x7A}, 8875de35c9bSChiranjeevi Rapolu {0x4048, 0x00}, 8885de35c9bSChiranjeevi Rapolu {0x4049, 0x7A}, 8895de35c9bSChiranjeevi Rapolu {0x4307, 0x30}, 8905de35c9bSChiranjeevi Rapolu {0x4500, 0x58}, 8915de35c9bSChiranjeevi Rapolu {0x4501, 0x04}, 8925de35c9bSChiranjeevi Rapolu {0x4502, 0x40}, 8935de35c9bSChiranjeevi Rapolu {0x4503, 0x10}, 8945de35c9bSChiranjeevi Rapolu {0x4508, 0x55}, 8955de35c9bSChiranjeevi Rapolu {0x4509, 0x55}, 8965de35c9bSChiranjeevi Rapolu {0x450a, 0x02}, 8975de35c9bSChiranjeevi Rapolu {0x450b, 0x00}, 8985de35c9bSChiranjeevi Rapolu {0x4600, 0x00}, 8995de35c9bSChiranjeevi Rapolu {0x4601, 0x40}, 9005de35c9bSChiranjeevi Rapolu {0x4700, 0xa4}, 9015de35c9bSChiranjeevi Rapolu {0x4800, 0x4c}, 9025de35c9bSChiranjeevi Rapolu {0x4816, 0x53}, 9035de35c9bSChiranjeevi Rapolu {0x481f, 0x40}, 9045de35c9bSChiranjeevi Rapolu {0x4837, 0x13}, 9055de35c9bSChiranjeevi Rapolu {0x5000, 0x56}, 9065de35c9bSChiranjeevi Rapolu {0x5001, 0x01}, 9075de35c9bSChiranjeevi Rapolu {0x5002, 0x28}, 9085de35c9bSChiranjeevi Rapolu {0x5004, 0x0c}, 9095de35c9bSChiranjeevi Rapolu {0x5006, 0x0c}, 9105de35c9bSChiranjeevi Rapolu {0x5007, 0xe0}, 9115de35c9bSChiranjeevi Rapolu {0x5008, 0x01}, 9125de35c9bSChiranjeevi Rapolu {0x5009, 0xb0}, 9135de35c9bSChiranjeevi Rapolu {0x5901, 0x00}, 9145de35c9bSChiranjeevi Rapolu {0x5a01, 0x00}, 9155de35c9bSChiranjeevi Rapolu {0x5a03, 0x00}, 9165de35c9bSChiranjeevi Rapolu {0x5a04, 0x0c}, 9175de35c9bSChiranjeevi Rapolu {0x5a05, 0xe0}, 9185de35c9bSChiranjeevi Rapolu {0x5a06, 0x09}, 9195de35c9bSChiranjeevi Rapolu {0x5a07, 0xb0}, 9205de35c9bSChiranjeevi Rapolu {0x5a08, 0x06}, 9215de35c9bSChiranjeevi Rapolu {0x5e00, 0x00}, 9225de35c9bSChiranjeevi Rapolu {0x3734, 0x40}, 9235de35c9bSChiranjeevi Rapolu {0x5b00, 0x01}, 9245de35c9bSChiranjeevi Rapolu {0x5b01, 0x10}, 9255de35c9bSChiranjeevi Rapolu {0x5b02, 0x01}, 9265de35c9bSChiranjeevi Rapolu {0x5b03, 0xdb}, 9275de35c9bSChiranjeevi Rapolu {0x3d8c, 0x71}, 9285de35c9bSChiranjeevi Rapolu {0x3d8d, 0xea}, 9295de35c9bSChiranjeevi Rapolu {0x4017, 0x10}, 9305de35c9bSChiranjeevi Rapolu {0x3618, 0x2a}, 9315de35c9bSChiranjeevi Rapolu {0x5780, 0x3e}, 9325de35c9bSChiranjeevi Rapolu {0x5781, 0x0f}, 9335de35c9bSChiranjeevi Rapolu {0x5782, 0x44}, 9345de35c9bSChiranjeevi Rapolu {0x5783, 0x02}, 9355de35c9bSChiranjeevi Rapolu {0x5784, 0x01}, 9365de35c9bSChiranjeevi Rapolu {0x5785, 0x01}, 9375de35c9bSChiranjeevi Rapolu {0x5786, 0x00}, 9385de35c9bSChiranjeevi Rapolu {0x5787, 0x04}, 9395de35c9bSChiranjeevi Rapolu {0x5788, 0x02}, 9405de35c9bSChiranjeevi Rapolu {0x5789, 0x0f}, 9415de35c9bSChiranjeevi Rapolu {0x578a, 0xfd}, 9425de35c9bSChiranjeevi Rapolu {0x578b, 0xf5}, 9435de35c9bSChiranjeevi Rapolu {0x578c, 0xf5}, 9445de35c9bSChiranjeevi Rapolu {0x578d, 0x03}, 9455de35c9bSChiranjeevi Rapolu {0x578e, 0x08}, 9465de35c9bSChiranjeevi Rapolu {0x578f, 0x0c}, 9475de35c9bSChiranjeevi Rapolu {0x5790, 0x08}, 9485de35c9bSChiranjeevi Rapolu {0x5791, 0x06}, 9495de35c9bSChiranjeevi Rapolu {0x5792, 0x00}, 9505de35c9bSChiranjeevi Rapolu {0x5793, 0x52}, 9515de35c9bSChiranjeevi Rapolu {0x5794, 0xa3}, 95299cd1242SChiranjeevi Rapolu {0x3503, 0x00}, 95399cd1242SChiranjeevi Rapolu {0x5045, 0x05}, 95499cd1242SChiranjeevi Rapolu {0x4003, 0x40}, 95599cd1242SChiranjeevi Rapolu {0x5048, 0x40} 9565de35c9bSChiranjeevi Rapolu }; 9575de35c9bSChiranjeevi Rapolu 9585de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mode_2560x1440_regs[] = { 9595de35c9bSChiranjeevi Rapolu {0x3000, 0x00}, 9605de35c9bSChiranjeevi Rapolu {0x3002, 0x21}, 9615de35c9bSChiranjeevi Rapolu {0x3005, 0xf0}, 9625de35c9bSChiranjeevi Rapolu {0x3007, 0x00}, 9635de35c9bSChiranjeevi Rapolu {0x3015, 0x0f}, 9645de35c9bSChiranjeevi Rapolu {0x3018, 0x32}, 9655de35c9bSChiranjeevi Rapolu {0x301a, 0xf0}, 9665de35c9bSChiranjeevi Rapolu {0x301b, 0xf0}, 9675de35c9bSChiranjeevi Rapolu {0x301c, 0xf0}, 9685de35c9bSChiranjeevi Rapolu {0x301d, 0xf0}, 9695de35c9bSChiranjeevi Rapolu {0x301e, 0xf0}, 9705de35c9bSChiranjeevi Rapolu {0x3030, 0x00}, 9715de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 9725de35c9bSChiranjeevi Rapolu {0x303c, 0xff}, 9735de35c9bSChiranjeevi Rapolu {0x303e, 0xff}, 9745de35c9bSChiranjeevi Rapolu {0x3040, 0xf0}, 9755de35c9bSChiranjeevi Rapolu {0x3041, 0x00}, 9765de35c9bSChiranjeevi Rapolu {0x3042, 0xf0}, 9775de35c9bSChiranjeevi Rapolu {0x3106, 0x11}, 9785de35c9bSChiranjeevi Rapolu {0x3500, 0x00}, 9795de35c9bSChiranjeevi Rapolu {0x3501, 0x80}, 9805de35c9bSChiranjeevi Rapolu {0x3502, 0x00}, 9815de35c9bSChiranjeevi Rapolu {0x3503, 0x04}, 9825de35c9bSChiranjeevi Rapolu {0x3504, 0x03}, 9835de35c9bSChiranjeevi Rapolu {0x3505, 0x83}, 9845de35c9bSChiranjeevi Rapolu {0x3508, 0x04}, 9855de35c9bSChiranjeevi Rapolu {0x3509, 0x00}, 9865de35c9bSChiranjeevi Rapolu {0x350e, 0x04}, 9875de35c9bSChiranjeevi Rapolu {0x350f, 0x00}, 9885de35c9bSChiranjeevi Rapolu {0x3510, 0x00}, 9895de35c9bSChiranjeevi Rapolu {0x3511, 0x02}, 9905de35c9bSChiranjeevi Rapolu {0x3512, 0x00}, 9915de35c9bSChiranjeevi Rapolu {0x3601, 0xc8}, 9925de35c9bSChiranjeevi Rapolu {0x3610, 0x88}, 9935de35c9bSChiranjeevi Rapolu {0x3612, 0x48}, 9945de35c9bSChiranjeevi Rapolu {0x3614, 0x5b}, 9955de35c9bSChiranjeevi Rapolu {0x3615, 0x96}, 9965de35c9bSChiranjeevi Rapolu {0x3621, 0xd0}, 9975de35c9bSChiranjeevi Rapolu {0x3622, 0x00}, 9985de35c9bSChiranjeevi Rapolu {0x3623, 0x00}, 9995de35c9bSChiranjeevi Rapolu {0x3633, 0x13}, 10005de35c9bSChiranjeevi Rapolu {0x3634, 0x13}, 10015de35c9bSChiranjeevi Rapolu {0x3635, 0x13}, 10025de35c9bSChiranjeevi Rapolu {0x3636, 0x13}, 10035de35c9bSChiranjeevi Rapolu {0x3645, 0x13}, 10045de35c9bSChiranjeevi Rapolu {0x3646, 0x82}, 10055de35c9bSChiranjeevi Rapolu {0x3650, 0x00}, 10065de35c9bSChiranjeevi Rapolu {0x3652, 0xff}, 10075de35c9bSChiranjeevi Rapolu {0x3655, 0x20}, 10085de35c9bSChiranjeevi Rapolu {0x3656, 0xff}, 10095de35c9bSChiranjeevi Rapolu {0x365a, 0xff}, 10105de35c9bSChiranjeevi Rapolu {0x365e, 0xff}, 10115de35c9bSChiranjeevi Rapolu {0x3668, 0x00}, 10125de35c9bSChiranjeevi Rapolu {0x366a, 0x07}, 10135de35c9bSChiranjeevi Rapolu {0x366e, 0x10}, 10145de35c9bSChiranjeevi Rapolu {0x366d, 0x00}, 10155de35c9bSChiranjeevi Rapolu {0x366f, 0x80}, 10165de35c9bSChiranjeevi Rapolu {0x3700, 0x28}, 10175de35c9bSChiranjeevi Rapolu {0x3701, 0x10}, 10185de35c9bSChiranjeevi Rapolu {0x3702, 0x3a}, 10195de35c9bSChiranjeevi Rapolu {0x3703, 0x19}, 10205de35c9bSChiranjeevi Rapolu {0x3704, 0x10}, 10215de35c9bSChiranjeevi Rapolu {0x3705, 0x00}, 10225de35c9bSChiranjeevi Rapolu {0x3706, 0x66}, 10235de35c9bSChiranjeevi Rapolu {0x3707, 0x08}, 10245de35c9bSChiranjeevi Rapolu {0x3708, 0x34}, 10255de35c9bSChiranjeevi Rapolu {0x3709, 0x40}, 10265de35c9bSChiranjeevi Rapolu {0x370a, 0x01}, 10275de35c9bSChiranjeevi Rapolu {0x370b, 0x1b}, 10285de35c9bSChiranjeevi Rapolu {0x3714, 0x24}, 10295de35c9bSChiranjeevi Rapolu {0x371a, 0x3e}, 10305de35c9bSChiranjeevi Rapolu {0x3733, 0x00}, 10315de35c9bSChiranjeevi Rapolu {0x3734, 0x00}, 10325de35c9bSChiranjeevi Rapolu {0x373a, 0x05}, 10335de35c9bSChiranjeevi Rapolu {0x373b, 0x06}, 10345de35c9bSChiranjeevi Rapolu {0x373c, 0x0a}, 10355de35c9bSChiranjeevi Rapolu {0x373f, 0xa0}, 10365de35c9bSChiranjeevi Rapolu {0x3755, 0x00}, 10375de35c9bSChiranjeevi Rapolu {0x3758, 0x00}, 10385de35c9bSChiranjeevi Rapolu {0x375b, 0x0e}, 10395de35c9bSChiranjeevi Rapolu {0x3766, 0x5f}, 10405de35c9bSChiranjeevi Rapolu {0x3768, 0x00}, 10415de35c9bSChiranjeevi Rapolu {0x3769, 0x22}, 10425de35c9bSChiranjeevi Rapolu {0x3773, 0x08}, 10435de35c9bSChiranjeevi Rapolu {0x3774, 0x1f}, 10445de35c9bSChiranjeevi Rapolu {0x3776, 0x06}, 10455de35c9bSChiranjeevi Rapolu {0x37a0, 0x88}, 10465de35c9bSChiranjeevi Rapolu {0x37a1, 0x5c}, 10475de35c9bSChiranjeevi Rapolu {0x37a7, 0x88}, 10485de35c9bSChiranjeevi Rapolu {0x37a8, 0x70}, 10495de35c9bSChiranjeevi Rapolu {0x37aa, 0x88}, 10505de35c9bSChiranjeevi Rapolu {0x37ab, 0x48}, 10515de35c9bSChiranjeevi Rapolu {0x37b3, 0x66}, 10525de35c9bSChiranjeevi Rapolu {0x37c2, 0x04}, 10535de35c9bSChiranjeevi Rapolu {0x37c5, 0x00}, 10545de35c9bSChiranjeevi Rapolu {0x37c8, 0x00}, 10555de35c9bSChiranjeevi Rapolu {0x3800, 0x00}, 10565de35c9bSChiranjeevi Rapolu {0x3801, 0x0c}, 10575de35c9bSChiranjeevi Rapolu {0x3802, 0x00}, 10585de35c9bSChiranjeevi Rapolu {0x3803, 0x04}, 10595de35c9bSChiranjeevi Rapolu {0x3804, 0x0a}, 10605de35c9bSChiranjeevi Rapolu {0x3805, 0x33}, 10615de35c9bSChiranjeevi Rapolu {0x3806, 0x07}, 10625de35c9bSChiranjeevi Rapolu {0x3807, 0xa3}, 10635de35c9bSChiranjeevi Rapolu {0x3808, 0x0a}, 10645de35c9bSChiranjeevi Rapolu {0x3809, 0x00}, 10655de35c9bSChiranjeevi Rapolu {0x380a, 0x05}, 10665de35c9bSChiranjeevi Rapolu {0x380b, 0xa0}, 10675de35c9bSChiranjeevi Rapolu {0x380c, 0x06}, 10685de35c9bSChiranjeevi Rapolu {0x380d, 0x90}, 10695de35c9bSChiranjeevi Rapolu {0x380e, 0x08}, 10705de35c9bSChiranjeevi Rapolu {0x380f, 0x08}, 10715de35c9bSChiranjeevi Rapolu {0x3811, 0x04}, 10725de35c9bSChiranjeevi Rapolu {0x3813, 0x02}, 10735de35c9bSChiranjeevi Rapolu {0x3814, 0x01}, 10745de35c9bSChiranjeevi Rapolu {0x3815, 0x01}, 10755de35c9bSChiranjeevi Rapolu {0x3816, 0x00}, 10765de35c9bSChiranjeevi Rapolu {0x3817, 0x00}, 10775de35c9bSChiranjeevi Rapolu {0x3818, 0x00}, 10785de35c9bSChiranjeevi Rapolu {0x3819, 0x00}, 10795de35c9bSChiranjeevi Rapolu {0x3820, 0x84}, 10805de35c9bSChiranjeevi Rapolu {0x3821, 0x46}, 10815de35c9bSChiranjeevi Rapolu {0x3822, 0x48}, 10825de35c9bSChiranjeevi Rapolu {0x3826, 0x00}, 10835de35c9bSChiranjeevi Rapolu {0x3827, 0x08}, 10845de35c9bSChiranjeevi Rapolu {0x382a, 0x01}, 10855de35c9bSChiranjeevi Rapolu {0x382b, 0x01}, 10865de35c9bSChiranjeevi Rapolu {0x3830, 0x08}, 10875de35c9bSChiranjeevi Rapolu {0x3836, 0x02}, 10885de35c9bSChiranjeevi Rapolu {0x3837, 0x00}, 10895de35c9bSChiranjeevi Rapolu {0x3838, 0x10}, 10905de35c9bSChiranjeevi Rapolu {0x3841, 0xff}, 10915de35c9bSChiranjeevi Rapolu {0x3846, 0x48}, 10925de35c9bSChiranjeevi Rapolu {0x3861, 0x00}, 10935de35c9bSChiranjeevi Rapolu {0x3862, 0x04}, 10945de35c9bSChiranjeevi Rapolu {0x3863, 0x06}, 10955de35c9bSChiranjeevi Rapolu {0x3a11, 0x01}, 10965de35c9bSChiranjeevi Rapolu {0x3a12, 0x78}, 10975de35c9bSChiranjeevi Rapolu {0x3b00, 0x00}, 10985de35c9bSChiranjeevi Rapolu {0x3b02, 0x00}, 10995de35c9bSChiranjeevi Rapolu {0x3b03, 0x00}, 11005de35c9bSChiranjeevi Rapolu {0x3b04, 0x00}, 11015de35c9bSChiranjeevi Rapolu {0x3b05, 0x00}, 11025de35c9bSChiranjeevi Rapolu {0x3c00, 0x89}, 11035de35c9bSChiranjeevi Rapolu {0x3c01, 0xab}, 11045de35c9bSChiranjeevi Rapolu {0x3c02, 0x01}, 11055de35c9bSChiranjeevi Rapolu {0x3c03, 0x00}, 11065de35c9bSChiranjeevi Rapolu {0x3c04, 0x00}, 11075de35c9bSChiranjeevi Rapolu {0x3c05, 0x03}, 11085de35c9bSChiranjeevi Rapolu {0x3c06, 0x00}, 11095de35c9bSChiranjeevi Rapolu {0x3c07, 0x05}, 11105de35c9bSChiranjeevi Rapolu {0x3c0c, 0x00}, 11115de35c9bSChiranjeevi Rapolu {0x3c0d, 0x00}, 11125de35c9bSChiranjeevi Rapolu {0x3c0e, 0x00}, 11135de35c9bSChiranjeevi Rapolu {0x3c0f, 0x00}, 11145de35c9bSChiranjeevi Rapolu {0x3c40, 0x00}, 11155de35c9bSChiranjeevi Rapolu {0x3c41, 0xa3}, 11165de35c9bSChiranjeevi Rapolu {0x3c43, 0x7d}, 11175de35c9bSChiranjeevi Rapolu {0x3c45, 0xd7}, 11185de35c9bSChiranjeevi Rapolu {0x3c47, 0xfc}, 11195de35c9bSChiranjeevi Rapolu {0x3c50, 0x05}, 11205de35c9bSChiranjeevi Rapolu {0x3c52, 0xaa}, 11215de35c9bSChiranjeevi Rapolu {0x3c54, 0x71}, 11225de35c9bSChiranjeevi Rapolu {0x3c56, 0x80}, 11235de35c9bSChiranjeevi Rapolu {0x3d85, 0x17}, 11245de35c9bSChiranjeevi Rapolu {0x3f03, 0x00}, 11255de35c9bSChiranjeevi Rapolu {0x3f0a, 0x00}, 11265de35c9bSChiranjeevi Rapolu {0x3f0b, 0x00}, 11275de35c9bSChiranjeevi Rapolu {0x4001, 0x60}, 11285de35c9bSChiranjeevi Rapolu {0x4009, 0x0d}, 11295de35c9bSChiranjeevi Rapolu {0x4020, 0x00}, 11305de35c9bSChiranjeevi Rapolu {0x4021, 0x00}, 11315de35c9bSChiranjeevi Rapolu {0x4022, 0x00}, 11325de35c9bSChiranjeevi Rapolu {0x4023, 0x00}, 11335de35c9bSChiranjeevi Rapolu {0x4024, 0x00}, 11345de35c9bSChiranjeevi Rapolu {0x4025, 0x00}, 11355de35c9bSChiranjeevi Rapolu {0x4026, 0x00}, 11365de35c9bSChiranjeevi Rapolu {0x4027, 0x00}, 11375de35c9bSChiranjeevi Rapolu {0x4028, 0x00}, 11385de35c9bSChiranjeevi Rapolu {0x4029, 0x00}, 11395de35c9bSChiranjeevi Rapolu {0x402a, 0x00}, 11405de35c9bSChiranjeevi Rapolu {0x402b, 0x00}, 11415de35c9bSChiranjeevi Rapolu {0x402c, 0x00}, 11425de35c9bSChiranjeevi Rapolu {0x402d, 0x00}, 11435de35c9bSChiranjeevi Rapolu {0x402e, 0x00}, 11445de35c9bSChiranjeevi Rapolu {0x402f, 0x00}, 11455de35c9bSChiranjeevi Rapolu {0x4040, 0x00}, 11465de35c9bSChiranjeevi Rapolu {0x4041, 0x03}, 11475de35c9bSChiranjeevi Rapolu {0x4042, 0x00}, 11485de35c9bSChiranjeevi Rapolu {0x4043, 0x7A}, 11495de35c9bSChiranjeevi Rapolu {0x4044, 0x00}, 11505de35c9bSChiranjeevi Rapolu {0x4045, 0x7A}, 11515de35c9bSChiranjeevi Rapolu {0x4046, 0x00}, 11525de35c9bSChiranjeevi Rapolu {0x4047, 0x7A}, 11535de35c9bSChiranjeevi Rapolu {0x4048, 0x00}, 11545de35c9bSChiranjeevi Rapolu {0x4049, 0x7A}, 11555de35c9bSChiranjeevi Rapolu {0x4307, 0x30}, 11565de35c9bSChiranjeevi Rapolu {0x4500, 0x58}, 11575de35c9bSChiranjeevi Rapolu {0x4501, 0x04}, 11585de35c9bSChiranjeevi Rapolu {0x4502, 0x40}, 11595de35c9bSChiranjeevi Rapolu {0x4503, 0x10}, 11605de35c9bSChiranjeevi Rapolu {0x4508, 0xaa}, 11615de35c9bSChiranjeevi Rapolu {0x4509, 0xaa}, 11625de35c9bSChiranjeevi Rapolu {0x450a, 0x00}, 11635de35c9bSChiranjeevi Rapolu {0x450b, 0x00}, 11645de35c9bSChiranjeevi Rapolu {0x4600, 0x01}, 11655de35c9bSChiranjeevi Rapolu {0x4601, 0x00}, 11665de35c9bSChiranjeevi Rapolu {0x4700, 0xa4}, 11675de35c9bSChiranjeevi Rapolu {0x4800, 0x4c}, 11685de35c9bSChiranjeevi Rapolu {0x4816, 0x53}, 11695de35c9bSChiranjeevi Rapolu {0x481f, 0x40}, 11705de35c9bSChiranjeevi Rapolu {0x4837, 0x13}, 11715de35c9bSChiranjeevi Rapolu {0x5000, 0x56}, 11725de35c9bSChiranjeevi Rapolu {0x5001, 0x01}, 11735de35c9bSChiranjeevi Rapolu {0x5002, 0x28}, 11745de35c9bSChiranjeevi Rapolu {0x5004, 0x0c}, 11755de35c9bSChiranjeevi Rapolu {0x5006, 0x0c}, 11765de35c9bSChiranjeevi Rapolu {0x5007, 0xe0}, 11775de35c9bSChiranjeevi Rapolu {0x5008, 0x01}, 11785de35c9bSChiranjeevi Rapolu {0x5009, 0xb0}, 11795de35c9bSChiranjeevi Rapolu {0x5901, 0x00}, 11805de35c9bSChiranjeevi Rapolu {0x5a01, 0x00}, 11815de35c9bSChiranjeevi Rapolu {0x5a03, 0x00}, 11825de35c9bSChiranjeevi Rapolu {0x5a04, 0x0c}, 11835de35c9bSChiranjeevi Rapolu {0x5a05, 0xe0}, 11845de35c9bSChiranjeevi Rapolu {0x5a06, 0x09}, 11855de35c9bSChiranjeevi Rapolu {0x5a07, 0xb0}, 11865de35c9bSChiranjeevi Rapolu {0x5a08, 0x06}, 11875de35c9bSChiranjeevi Rapolu {0x5e00, 0x00}, 11885de35c9bSChiranjeevi Rapolu {0x3734, 0x40}, 11895de35c9bSChiranjeevi Rapolu {0x5b00, 0x01}, 11905de35c9bSChiranjeevi Rapolu {0x5b01, 0x10}, 11915de35c9bSChiranjeevi Rapolu {0x5b02, 0x01}, 11925de35c9bSChiranjeevi Rapolu {0x5b03, 0xdb}, 11935de35c9bSChiranjeevi Rapolu {0x3d8c, 0x71}, 11945de35c9bSChiranjeevi Rapolu {0x3d8d, 0xea}, 11955de35c9bSChiranjeevi Rapolu {0x4017, 0x08}, 11965de35c9bSChiranjeevi Rapolu {0x3618, 0x2a}, 11975de35c9bSChiranjeevi Rapolu {0x5780, 0x3e}, 11985de35c9bSChiranjeevi Rapolu {0x5781, 0x0f}, 11995de35c9bSChiranjeevi Rapolu {0x5782, 0x44}, 12005de35c9bSChiranjeevi Rapolu {0x5783, 0x02}, 12015de35c9bSChiranjeevi Rapolu {0x5784, 0x01}, 12025de35c9bSChiranjeevi Rapolu {0x5785, 0x01}, 12035de35c9bSChiranjeevi Rapolu {0x5786, 0x00}, 12045de35c9bSChiranjeevi Rapolu {0x5787, 0x04}, 12055de35c9bSChiranjeevi Rapolu {0x5788, 0x02}, 12065de35c9bSChiranjeevi Rapolu {0x5789, 0x0f}, 12075de35c9bSChiranjeevi Rapolu {0x578a, 0xfd}, 12085de35c9bSChiranjeevi Rapolu {0x578b, 0xf5}, 12095de35c9bSChiranjeevi Rapolu {0x578c, 0xf5}, 12105de35c9bSChiranjeevi Rapolu {0x578d, 0x03}, 12115de35c9bSChiranjeevi Rapolu {0x578e, 0x08}, 12125de35c9bSChiranjeevi Rapolu {0x578f, 0x0c}, 12135de35c9bSChiranjeevi Rapolu {0x5790, 0x08}, 12145de35c9bSChiranjeevi Rapolu {0x5791, 0x06}, 12155de35c9bSChiranjeevi Rapolu {0x5792, 0x00}, 12165de35c9bSChiranjeevi Rapolu {0x5793, 0x52}, 121799cd1242SChiranjeevi Rapolu {0x5794, 0xa3}, 121899cd1242SChiranjeevi Rapolu {0x5045, 0x05}, 121999cd1242SChiranjeevi Rapolu {0x4003, 0x40}, 122099cd1242SChiranjeevi Rapolu {0x5048, 0x40} 12215de35c9bSChiranjeevi Rapolu }; 12225de35c9bSChiranjeevi Rapolu 12235de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mode_1280x720_regs[] = { 12245de35c9bSChiranjeevi Rapolu {0x3000, 0x00}, 12255de35c9bSChiranjeevi Rapolu {0x3002, 0x21}, 12265de35c9bSChiranjeevi Rapolu {0x3005, 0xf0}, 12275de35c9bSChiranjeevi Rapolu {0x3007, 0x00}, 12285de35c9bSChiranjeevi Rapolu {0x3015, 0x0f}, 12295de35c9bSChiranjeevi Rapolu {0x3018, 0x32}, 12305de35c9bSChiranjeevi Rapolu {0x301a, 0xf0}, 12315de35c9bSChiranjeevi Rapolu {0x301b, 0xf0}, 12325de35c9bSChiranjeevi Rapolu {0x301c, 0xf0}, 12335de35c9bSChiranjeevi Rapolu {0x301d, 0xf0}, 12345de35c9bSChiranjeevi Rapolu {0x301e, 0xf0}, 12355de35c9bSChiranjeevi Rapolu {0x3030, 0x00}, 12365de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 12375de35c9bSChiranjeevi Rapolu {0x303c, 0xff}, 12385de35c9bSChiranjeevi Rapolu {0x303e, 0xff}, 12395de35c9bSChiranjeevi Rapolu {0x3040, 0xf0}, 12405de35c9bSChiranjeevi Rapolu {0x3041, 0x00}, 12415de35c9bSChiranjeevi Rapolu {0x3042, 0xf0}, 12425de35c9bSChiranjeevi Rapolu {0x3106, 0x11}, 12435de35c9bSChiranjeevi Rapolu {0x3500, 0x00}, 12445de35c9bSChiranjeevi Rapolu {0x3501, 0x80}, 12455de35c9bSChiranjeevi Rapolu {0x3502, 0x00}, 12465de35c9bSChiranjeevi Rapolu {0x3503, 0x04}, 12475de35c9bSChiranjeevi Rapolu {0x3504, 0x03}, 12485de35c9bSChiranjeevi Rapolu {0x3505, 0x83}, 12495de35c9bSChiranjeevi Rapolu {0x3508, 0x04}, 12505de35c9bSChiranjeevi Rapolu {0x3509, 0x00}, 12515de35c9bSChiranjeevi Rapolu {0x350e, 0x04}, 12525de35c9bSChiranjeevi Rapolu {0x350f, 0x00}, 12535de35c9bSChiranjeevi Rapolu {0x3510, 0x00}, 12545de35c9bSChiranjeevi Rapolu {0x3511, 0x02}, 12555de35c9bSChiranjeevi Rapolu {0x3512, 0x00}, 12565de35c9bSChiranjeevi Rapolu {0x3601, 0xc8}, 12575de35c9bSChiranjeevi Rapolu {0x3610, 0x88}, 12585de35c9bSChiranjeevi Rapolu {0x3612, 0x48}, 12595de35c9bSChiranjeevi Rapolu {0x3614, 0x5b}, 12605de35c9bSChiranjeevi Rapolu {0x3615, 0x96}, 12615de35c9bSChiranjeevi Rapolu {0x3621, 0xd0}, 12625de35c9bSChiranjeevi Rapolu {0x3622, 0x00}, 12635de35c9bSChiranjeevi Rapolu {0x3623, 0x00}, 12645de35c9bSChiranjeevi Rapolu {0x3633, 0x13}, 12655de35c9bSChiranjeevi Rapolu {0x3634, 0x13}, 12665de35c9bSChiranjeevi Rapolu {0x3635, 0x13}, 12675de35c9bSChiranjeevi Rapolu {0x3636, 0x13}, 12685de35c9bSChiranjeevi Rapolu {0x3645, 0x13}, 12695de35c9bSChiranjeevi Rapolu {0x3646, 0x82}, 12705de35c9bSChiranjeevi Rapolu {0x3650, 0x00}, 12715de35c9bSChiranjeevi Rapolu {0x3652, 0xff}, 12725de35c9bSChiranjeevi Rapolu {0x3655, 0x20}, 12735de35c9bSChiranjeevi Rapolu {0x3656, 0xff}, 12745de35c9bSChiranjeevi Rapolu {0x365a, 0xff}, 12755de35c9bSChiranjeevi Rapolu {0x365e, 0xff}, 12765de35c9bSChiranjeevi Rapolu {0x3668, 0x00}, 12775de35c9bSChiranjeevi Rapolu {0x366a, 0x07}, 12785de35c9bSChiranjeevi Rapolu {0x366e, 0x08}, 12795de35c9bSChiranjeevi Rapolu {0x366d, 0x00}, 12805de35c9bSChiranjeevi Rapolu {0x366f, 0x80}, 12815de35c9bSChiranjeevi Rapolu {0x3700, 0x28}, 12825de35c9bSChiranjeevi Rapolu {0x3701, 0x10}, 12835de35c9bSChiranjeevi Rapolu {0x3702, 0x3a}, 12845de35c9bSChiranjeevi Rapolu {0x3703, 0x19}, 12855de35c9bSChiranjeevi Rapolu {0x3704, 0x10}, 12865de35c9bSChiranjeevi Rapolu {0x3705, 0x00}, 12875de35c9bSChiranjeevi Rapolu {0x3706, 0x66}, 12885de35c9bSChiranjeevi Rapolu {0x3707, 0x08}, 12895de35c9bSChiranjeevi Rapolu {0x3708, 0x34}, 12905de35c9bSChiranjeevi Rapolu {0x3709, 0x40}, 12915de35c9bSChiranjeevi Rapolu {0x370a, 0x01}, 12925de35c9bSChiranjeevi Rapolu {0x370b, 0x1b}, 12935de35c9bSChiranjeevi Rapolu {0x3714, 0x24}, 12945de35c9bSChiranjeevi Rapolu {0x371a, 0x3e}, 12955de35c9bSChiranjeevi Rapolu {0x3733, 0x00}, 12965de35c9bSChiranjeevi Rapolu {0x3734, 0x00}, 12975de35c9bSChiranjeevi Rapolu {0x373a, 0x05}, 12985de35c9bSChiranjeevi Rapolu {0x373b, 0x06}, 12995de35c9bSChiranjeevi Rapolu {0x373c, 0x0a}, 13005de35c9bSChiranjeevi Rapolu {0x373f, 0xa0}, 13015de35c9bSChiranjeevi Rapolu {0x3755, 0x00}, 13025de35c9bSChiranjeevi Rapolu {0x3758, 0x00}, 13035de35c9bSChiranjeevi Rapolu {0x375b, 0x0e}, 13045de35c9bSChiranjeevi Rapolu {0x3766, 0x5f}, 13055de35c9bSChiranjeevi Rapolu {0x3768, 0x00}, 13065de35c9bSChiranjeevi Rapolu {0x3769, 0x22}, 13075de35c9bSChiranjeevi Rapolu {0x3773, 0x08}, 13085de35c9bSChiranjeevi Rapolu {0x3774, 0x1f}, 13095de35c9bSChiranjeevi Rapolu {0x3776, 0x06}, 13105de35c9bSChiranjeevi Rapolu {0x37a0, 0x88}, 13115de35c9bSChiranjeevi Rapolu {0x37a1, 0x5c}, 13125de35c9bSChiranjeevi Rapolu {0x37a7, 0x88}, 13135de35c9bSChiranjeevi Rapolu {0x37a8, 0x70}, 13145de35c9bSChiranjeevi Rapolu {0x37aa, 0x88}, 13155de35c9bSChiranjeevi Rapolu {0x37ab, 0x48}, 13165de35c9bSChiranjeevi Rapolu {0x37b3, 0x66}, 13175de35c9bSChiranjeevi Rapolu {0x37c2, 0x04}, 13185de35c9bSChiranjeevi Rapolu {0x37c5, 0x00}, 13195de35c9bSChiranjeevi Rapolu {0x37c8, 0x00}, 13205de35c9bSChiranjeevi Rapolu {0x3800, 0x00}, 13215de35c9bSChiranjeevi Rapolu {0x3801, 0x0c}, 13225de35c9bSChiranjeevi Rapolu {0x3802, 0x00}, 13235de35c9bSChiranjeevi Rapolu {0x3803, 0x04}, 13245de35c9bSChiranjeevi Rapolu {0x3804, 0x0a}, 13255de35c9bSChiranjeevi Rapolu {0x3805, 0x33}, 13265de35c9bSChiranjeevi Rapolu {0x3806, 0x07}, 13275de35c9bSChiranjeevi Rapolu {0x3807, 0xa3}, 13285de35c9bSChiranjeevi Rapolu {0x3808, 0x05}, 13295de35c9bSChiranjeevi Rapolu {0x3809, 0x00}, 13305de35c9bSChiranjeevi Rapolu {0x380a, 0x02}, 13315de35c9bSChiranjeevi Rapolu {0x380b, 0xd0}, 13325de35c9bSChiranjeevi Rapolu {0x380c, 0x06}, 13335de35c9bSChiranjeevi Rapolu {0x380d, 0x90}, 13345de35c9bSChiranjeevi Rapolu {0x380e, 0x08}, 13355de35c9bSChiranjeevi Rapolu {0x380f, 0x08}, 13365de35c9bSChiranjeevi Rapolu {0x3811, 0x04}, 13375de35c9bSChiranjeevi Rapolu {0x3813, 0x02}, 13385de35c9bSChiranjeevi Rapolu {0x3814, 0x03}, 13395de35c9bSChiranjeevi Rapolu {0x3815, 0x01}, 13405de35c9bSChiranjeevi Rapolu {0x3816, 0x00}, 13415de35c9bSChiranjeevi Rapolu {0x3817, 0x00}, 13425de35c9bSChiranjeevi Rapolu {0x3818, 0x00}, 13435de35c9bSChiranjeevi Rapolu {0x3819, 0x00}, 13445de35c9bSChiranjeevi Rapolu {0x3820, 0x94}, 13455de35c9bSChiranjeevi Rapolu {0x3821, 0x47}, 13465de35c9bSChiranjeevi Rapolu {0x3822, 0x48}, 13475de35c9bSChiranjeevi Rapolu {0x3826, 0x00}, 13485de35c9bSChiranjeevi Rapolu {0x3827, 0x08}, 13495de35c9bSChiranjeevi Rapolu {0x382a, 0x03}, 13505de35c9bSChiranjeevi Rapolu {0x382b, 0x01}, 13515de35c9bSChiranjeevi Rapolu {0x3830, 0x08}, 13525de35c9bSChiranjeevi Rapolu {0x3836, 0x02}, 13535de35c9bSChiranjeevi Rapolu {0x3837, 0x00}, 13545de35c9bSChiranjeevi Rapolu {0x3838, 0x10}, 13555de35c9bSChiranjeevi Rapolu {0x3841, 0xff}, 13565de35c9bSChiranjeevi Rapolu {0x3846, 0x48}, 13575de35c9bSChiranjeevi Rapolu {0x3861, 0x00}, 13585de35c9bSChiranjeevi Rapolu {0x3862, 0x04}, 13595de35c9bSChiranjeevi Rapolu {0x3863, 0x06}, 13605de35c9bSChiranjeevi Rapolu {0x3a11, 0x01}, 13615de35c9bSChiranjeevi Rapolu {0x3a12, 0x78}, 13625de35c9bSChiranjeevi Rapolu {0x3b00, 0x00}, 13635de35c9bSChiranjeevi Rapolu {0x3b02, 0x00}, 13645de35c9bSChiranjeevi Rapolu {0x3b03, 0x00}, 13655de35c9bSChiranjeevi Rapolu {0x3b04, 0x00}, 13665de35c9bSChiranjeevi Rapolu {0x3b05, 0x00}, 13675de35c9bSChiranjeevi Rapolu {0x3c00, 0x89}, 13685de35c9bSChiranjeevi Rapolu {0x3c01, 0xab}, 13695de35c9bSChiranjeevi Rapolu {0x3c02, 0x01}, 13705de35c9bSChiranjeevi Rapolu {0x3c03, 0x00}, 13715de35c9bSChiranjeevi Rapolu {0x3c04, 0x00}, 13725de35c9bSChiranjeevi Rapolu {0x3c05, 0x03}, 13735de35c9bSChiranjeevi Rapolu {0x3c06, 0x00}, 13745de35c9bSChiranjeevi Rapolu {0x3c07, 0x05}, 13755de35c9bSChiranjeevi Rapolu {0x3c0c, 0x00}, 13765de35c9bSChiranjeevi Rapolu {0x3c0d, 0x00}, 13775de35c9bSChiranjeevi Rapolu {0x3c0e, 0x00}, 13785de35c9bSChiranjeevi Rapolu {0x3c0f, 0x00}, 13795de35c9bSChiranjeevi Rapolu {0x3c40, 0x00}, 13805de35c9bSChiranjeevi Rapolu {0x3c41, 0xa3}, 13815de35c9bSChiranjeevi Rapolu {0x3c43, 0x7d}, 13825de35c9bSChiranjeevi Rapolu {0x3c45, 0xd7}, 13835de35c9bSChiranjeevi Rapolu {0x3c47, 0xfc}, 13845de35c9bSChiranjeevi Rapolu {0x3c50, 0x05}, 13855de35c9bSChiranjeevi Rapolu {0x3c52, 0xaa}, 13865de35c9bSChiranjeevi Rapolu {0x3c54, 0x71}, 13875de35c9bSChiranjeevi Rapolu {0x3c56, 0x80}, 13885de35c9bSChiranjeevi Rapolu {0x3d85, 0x17}, 13895de35c9bSChiranjeevi Rapolu {0x3f03, 0x00}, 13905de35c9bSChiranjeevi Rapolu {0x3f0a, 0x00}, 13915de35c9bSChiranjeevi Rapolu {0x3f0b, 0x00}, 13925de35c9bSChiranjeevi Rapolu {0x4001, 0x60}, 13935de35c9bSChiranjeevi Rapolu {0x4009, 0x05}, 13945de35c9bSChiranjeevi Rapolu {0x4020, 0x00}, 13955de35c9bSChiranjeevi Rapolu {0x4021, 0x00}, 13965de35c9bSChiranjeevi Rapolu {0x4022, 0x00}, 13975de35c9bSChiranjeevi Rapolu {0x4023, 0x00}, 13985de35c9bSChiranjeevi Rapolu {0x4024, 0x00}, 13995de35c9bSChiranjeevi Rapolu {0x4025, 0x00}, 14005de35c9bSChiranjeevi Rapolu {0x4026, 0x00}, 14015de35c9bSChiranjeevi Rapolu {0x4027, 0x00}, 14025de35c9bSChiranjeevi Rapolu {0x4028, 0x00}, 14035de35c9bSChiranjeevi Rapolu {0x4029, 0x00}, 14045de35c9bSChiranjeevi Rapolu {0x402a, 0x00}, 14055de35c9bSChiranjeevi Rapolu {0x402b, 0x00}, 14065de35c9bSChiranjeevi Rapolu {0x402c, 0x00}, 14075de35c9bSChiranjeevi Rapolu {0x402d, 0x00}, 14085de35c9bSChiranjeevi Rapolu {0x402e, 0x00}, 14095de35c9bSChiranjeevi Rapolu {0x402f, 0x00}, 14105de35c9bSChiranjeevi Rapolu {0x4040, 0x00}, 14115de35c9bSChiranjeevi Rapolu {0x4041, 0x03}, 14125de35c9bSChiranjeevi Rapolu {0x4042, 0x00}, 14135de35c9bSChiranjeevi Rapolu {0x4043, 0x7A}, 14145de35c9bSChiranjeevi Rapolu {0x4044, 0x00}, 14155de35c9bSChiranjeevi Rapolu {0x4045, 0x7A}, 14165de35c9bSChiranjeevi Rapolu {0x4046, 0x00}, 14175de35c9bSChiranjeevi Rapolu {0x4047, 0x7A}, 14185de35c9bSChiranjeevi Rapolu {0x4048, 0x00}, 14195de35c9bSChiranjeevi Rapolu {0x4049, 0x7A}, 14205de35c9bSChiranjeevi Rapolu {0x4307, 0x30}, 14215de35c9bSChiranjeevi Rapolu {0x4500, 0x58}, 14225de35c9bSChiranjeevi Rapolu {0x4501, 0x04}, 14235de35c9bSChiranjeevi Rapolu {0x4502, 0x48}, 14245de35c9bSChiranjeevi Rapolu {0x4503, 0x10}, 14255de35c9bSChiranjeevi Rapolu {0x4508, 0x55}, 14265de35c9bSChiranjeevi Rapolu {0x4509, 0x55}, 14275de35c9bSChiranjeevi Rapolu {0x450a, 0x00}, 14285de35c9bSChiranjeevi Rapolu {0x450b, 0x00}, 14295de35c9bSChiranjeevi Rapolu {0x4600, 0x00}, 14305de35c9bSChiranjeevi Rapolu {0x4601, 0x80}, 14315de35c9bSChiranjeevi Rapolu {0x4700, 0xa4}, 14325de35c9bSChiranjeevi Rapolu {0x4800, 0x4c}, 14335de35c9bSChiranjeevi Rapolu {0x4816, 0x53}, 14345de35c9bSChiranjeevi Rapolu {0x481f, 0x40}, 14355de35c9bSChiranjeevi Rapolu {0x4837, 0x13}, 14365de35c9bSChiranjeevi Rapolu {0x5000, 0x56}, 14375de35c9bSChiranjeevi Rapolu {0x5001, 0x01}, 14385de35c9bSChiranjeevi Rapolu {0x5002, 0x28}, 14395de35c9bSChiranjeevi Rapolu {0x5004, 0x0c}, 14405de35c9bSChiranjeevi Rapolu {0x5006, 0x0c}, 14415de35c9bSChiranjeevi Rapolu {0x5007, 0xe0}, 14425de35c9bSChiranjeevi Rapolu {0x5008, 0x01}, 14435de35c9bSChiranjeevi Rapolu {0x5009, 0xb0}, 14445de35c9bSChiranjeevi Rapolu {0x5901, 0x00}, 14455de35c9bSChiranjeevi Rapolu {0x5a01, 0x00}, 14465de35c9bSChiranjeevi Rapolu {0x5a03, 0x00}, 14475de35c9bSChiranjeevi Rapolu {0x5a04, 0x0c}, 14485de35c9bSChiranjeevi Rapolu {0x5a05, 0xe0}, 14495de35c9bSChiranjeevi Rapolu {0x5a06, 0x09}, 14505de35c9bSChiranjeevi Rapolu {0x5a07, 0xb0}, 14515de35c9bSChiranjeevi Rapolu {0x5a08, 0x06}, 14525de35c9bSChiranjeevi Rapolu {0x5e00, 0x00}, 14535de35c9bSChiranjeevi Rapolu {0x3734, 0x40}, 14545de35c9bSChiranjeevi Rapolu {0x5b00, 0x01}, 14555de35c9bSChiranjeevi Rapolu {0x5b01, 0x10}, 14565de35c9bSChiranjeevi Rapolu {0x5b02, 0x01}, 14575de35c9bSChiranjeevi Rapolu {0x5b03, 0xdb}, 14585de35c9bSChiranjeevi Rapolu {0x3d8c, 0x71}, 14595de35c9bSChiranjeevi Rapolu {0x3d8d, 0xea}, 14605de35c9bSChiranjeevi Rapolu {0x4017, 0x10}, 14615de35c9bSChiranjeevi Rapolu {0x3618, 0x2a}, 14625de35c9bSChiranjeevi Rapolu {0x5780, 0x3e}, 14635de35c9bSChiranjeevi Rapolu {0x5781, 0x0f}, 14645de35c9bSChiranjeevi Rapolu {0x5782, 0x44}, 14655de35c9bSChiranjeevi Rapolu {0x5783, 0x02}, 14665de35c9bSChiranjeevi Rapolu {0x5784, 0x01}, 14675de35c9bSChiranjeevi Rapolu {0x5785, 0x01}, 14685de35c9bSChiranjeevi Rapolu {0x5786, 0x00}, 14695de35c9bSChiranjeevi Rapolu {0x5787, 0x04}, 14705de35c9bSChiranjeevi Rapolu {0x5788, 0x02}, 14715de35c9bSChiranjeevi Rapolu {0x5789, 0x0f}, 14725de35c9bSChiranjeevi Rapolu {0x578a, 0xfd}, 14735de35c9bSChiranjeevi Rapolu {0x578b, 0xf5}, 14745de35c9bSChiranjeevi Rapolu {0x578c, 0xf5}, 14755de35c9bSChiranjeevi Rapolu {0x578d, 0x03}, 14765de35c9bSChiranjeevi Rapolu {0x578e, 0x08}, 14775de35c9bSChiranjeevi Rapolu {0x578f, 0x0c}, 14785de35c9bSChiranjeevi Rapolu {0x5790, 0x08}, 14795de35c9bSChiranjeevi Rapolu {0x5791, 0x06}, 14805de35c9bSChiranjeevi Rapolu {0x5792, 0x00}, 14815de35c9bSChiranjeevi Rapolu {0x5793, 0x52}, 14825de35c9bSChiranjeevi Rapolu {0x5794, 0xa3}, 148399cd1242SChiranjeevi Rapolu {0x3503, 0x00}, 148499cd1242SChiranjeevi Rapolu {0x5045, 0x05}, 148599cd1242SChiranjeevi Rapolu {0x4003, 0x40}, 148699cd1242SChiranjeevi Rapolu {0x5048, 0x40} 14875de35c9bSChiranjeevi Rapolu }; 14885de35c9bSChiranjeevi Rapolu 14895de35c9bSChiranjeevi Rapolu static const struct ov5670_reg mode_640x360_regs[] = { 14905de35c9bSChiranjeevi Rapolu {0x3000, 0x00}, 14915de35c9bSChiranjeevi Rapolu {0x3002, 0x21}, 14925de35c9bSChiranjeevi Rapolu {0x3005, 0xf0}, 14935de35c9bSChiranjeevi Rapolu {0x3007, 0x00}, 14945de35c9bSChiranjeevi Rapolu {0x3015, 0x0f}, 14955de35c9bSChiranjeevi Rapolu {0x3018, 0x32}, 14965de35c9bSChiranjeevi Rapolu {0x301a, 0xf0}, 14975de35c9bSChiranjeevi Rapolu {0x301b, 0xf0}, 14985de35c9bSChiranjeevi Rapolu {0x301c, 0xf0}, 14995de35c9bSChiranjeevi Rapolu {0x301d, 0xf0}, 15005de35c9bSChiranjeevi Rapolu {0x301e, 0xf0}, 15015de35c9bSChiranjeevi Rapolu {0x3030, 0x00}, 15025de35c9bSChiranjeevi Rapolu {0x3031, 0x0a}, 15035de35c9bSChiranjeevi Rapolu {0x303c, 0xff}, 15045de35c9bSChiranjeevi Rapolu {0x303e, 0xff}, 15055de35c9bSChiranjeevi Rapolu {0x3040, 0xf0}, 15065de35c9bSChiranjeevi Rapolu {0x3041, 0x00}, 15075de35c9bSChiranjeevi Rapolu {0x3042, 0xf0}, 15085de35c9bSChiranjeevi Rapolu {0x3106, 0x11}, 15095de35c9bSChiranjeevi Rapolu {0x3500, 0x00}, 15105de35c9bSChiranjeevi Rapolu {0x3501, 0x80}, 15115de35c9bSChiranjeevi Rapolu {0x3502, 0x00}, 15125de35c9bSChiranjeevi Rapolu {0x3503, 0x04}, 15135de35c9bSChiranjeevi Rapolu {0x3504, 0x03}, 15145de35c9bSChiranjeevi Rapolu {0x3505, 0x83}, 15155de35c9bSChiranjeevi Rapolu {0x3508, 0x04}, 15165de35c9bSChiranjeevi Rapolu {0x3509, 0x00}, 15175de35c9bSChiranjeevi Rapolu {0x350e, 0x04}, 15185de35c9bSChiranjeevi Rapolu {0x350f, 0x00}, 15195de35c9bSChiranjeevi Rapolu {0x3510, 0x00}, 15205de35c9bSChiranjeevi Rapolu {0x3511, 0x02}, 15215de35c9bSChiranjeevi Rapolu {0x3512, 0x00}, 15225de35c9bSChiranjeevi Rapolu {0x3601, 0xc8}, 15235de35c9bSChiranjeevi Rapolu {0x3610, 0x88}, 15245de35c9bSChiranjeevi Rapolu {0x3612, 0x48}, 15255de35c9bSChiranjeevi Rapolu {0x3614, 0x5b}, 15265de35c9bSChiranjeevi Rapolu {0x3615, 0x96}, 15275de35c9bSChiranjeevi Rapolu {0x3621, 0xd0}, 15285de35c9bSChiranjeevi Rapolu {0x3622, 0x00}, 15295de35c9bSChiranjeevi Rapolu {0x3623, 0x04}, 15305de35c9bSChiranjeevi Rapolu {0x3633, 0x13}, 15315de35c9bSChiranjeevi Rapolu {0x3634, 0x13}, 15325de35c9bSChiranjeevi Rapolu {0x3635, 0x13}, 15335de35c9bSChiranjeevi Rapolu {0x3636, 0x13}, 15345de35c9bSChiranjeevi Rapolu {0x3645, 0x13}, 15355de35c9bSChiranjeevi Rapolu {0x3646, 0x82}, 15365de35c9bSChiranjeevi Rapolu {0x3650, 0x00}, 15375de35c9bSChiranjeevi Rapolu {0x3652, 0xff}, 15385de35c9bSChiranjeevi Rapolu {0x3655, 0x20}, 15395de35c9bSChiranjeevi Rapolu {0x3656, 0xff}, 15405de35c9bSChiranjeevi Rapolu {0x365a, 0xff}, 15415de35c9bSChiranjeevi Rapolu {0x365e, 0xff}, 15425de35c9bSChiranjeevi Rapolu {0x3668, 0x00}, 15435de35c9bSChiranjeevi Rapolu {0x366a, 0x07}, 15445de35c9bSChiranjeevi Rapolu {0x366e, 0x08}, 15455de35c9bSChiranjeevi Rapolu {0x366d, 0x00}, 15465de35c9bSChiranjeevi Rapolu {0x366f, 0x80}, 15475de35c9bSChiranjeevi Rapolu {0x3700, 0x28}, 15485de35c9bSChiranjeevi Rapolu {0x3701, 0x10}, 15495de35c9bSChiranjeevi Rapolu {0x3702, 0x3a}, 15505de35c9bSChiranjeevi Rapolu {0x3703, 0x19}, 15515de35c9bSChiranjeevi Rapolu {0x3704, 0x10}, 15525de35c9bSChiranjeevi Rapolu {0x3705, 0x00}, 15535de35c9bSChiranjeevi Rapolu {0x3706, 0x66}, 15545de35c9bSChiranjeevi Rapolu {0x3707, 0x08}, 15555de35c9bSChiranjeevi Rapolu {0x3708, 0x34}, 15565de35c9bSChiranjeevi Rapolu {0x3709, 0x40}, 15575de35c9bSChiranjeevi Rapolu {0x370a, 0x01}, 15585de35c9bSChiranjeevi Rapolu {0x370b, 0x1b}, 15595de35c9bSChiranjeevi Rapolu {0x3714, 0x24}, 15605de35c9bSChiranjeevi Rapolu {0x371a, 0x3e}, 15615de35c9bSChiranjeevi Rapolu {0x3733, 0x00}, 15625de35c9bSChiranjeevi Rapolu {0x3734, 0x00}, 15635de35c9bSChiranjeevi Rapolu {0x373a, 0x05}, 15645de35c9bSChiranjeevi Rapolu {0x373b, 0x06}, 15655de35c9bSChiranjeevi Rapolu {0x373c, 0x0a}, 15665de35c9bSChiranjeevi Rapolu {0x373f, 0xa0}, 15675de35c9bSChiranjeevi Rapolu {0x3755, 0x00}, 15685de35c9bSChiranjeevi Rapolu {0x3758, 0x00}, 15695de35c9bSChiranjeevi Rapolu {0x375b, 0x0e}, 15705de35c9bSChiranjeevi Rapolu {0x3766, 0x5f}, 15715de35c9bSChiranjeevi Rapolu {0x3768, 0x00}, 15725de35c9bSChiranjeevi Rapolu {0x3769, 0x22}, 15735de35c9bSChiranjeevi Rapolu {0x3773, 0x08}, 15745de35c9bSChiranjeevi Rapolu {0x3774, 0x1f}, 15755de35c9bSChiranjeevi Rapolu {0x3776, 0x06}, 15765de35c9bSChiranjeevi Rapolu {0x37a0, 0x88}, 15775de35c9bSChiranjeevi Rapolu {0x37a1, 0x5c}, 15785de35c9bSChiranjeevi Rapolu {0x37a7, 0x88}, 15795de35c9bSChiranjeevi Rapolu {0x37a8, 0x70}, 15805de35c9bSChiranjeevi Rapolu {0x37aa, 0x88}, 15815de35c9bSChiranjeevi Rapolu {0x37ab, 0x48}, 15825de35c9bSChiranjeevi Rapolu {0x37b3, 0x66}, 15835de35c9bSChiranjeevi Rapolu {0x37c2, 0x04}, 15845de35c9bSChiranjeevi Rapolu {0x37c5, 0x00}, 15855de35c9bSChiranjeevi Rapolu {0x37c8, 0x00}, 15865de35c9bSChiranjeevi Rapolu {0x3800, 0x00}, 15875de35c9bSChiranjeevi Rapolu {0x3801, 0x0c}, 15885de35c9bSChiranjeevi Rapolu {0x3802, 0x00}, 15895de35c9bSChiranjeevi Rapolu {0x3803, 0x04}, 15905de35c9bSChiranjeevi Rapolu {0x3804, 0x0a}, 15915de35c9bSChiranjeevi Rapolu {0x3805, 0x33}, 15925de35c9bSChiranjeevi Rapolu {0x3806, 0x07}, 15935de35c9bSChiranjeevi Rapolu {0x3807, 0xa3}, 15945de35c9bSChiranjeevi Rapolu {0x3808, 0x02}, 15955de35c9bSChiranjeevi Rapolu {0x3809, 0x80}, 15965de35c9bSChiranjeevi Rapolu {0x380a, 0x01}, 15975de35c9bSChiranjeevi Rapolu {0x380b, 0x68}, 15985de35c9bSChiranjeevi Rapolu {0x380c, 0x06}, 15995de35c9bSChiranjeevi Rapolu {0x380d, 0x90}, 16005de35c9bSChiranjeevi Rapolu {0x380e, 0x08}, 16015de35c9bSChiranjeevi Rapolu {0x380f, 0x08}, 16025de35c9bSChiranjeevi Rapolu {0x3811, 0x04}, 16035de35c9bSChiranjeevi Rapolu {0x3813, 0x02}, 16045de35c9bSChiranjeevi Rapolu {0x3814, 0x07}, 16055de35c9bSChiranjeevi Rapolu {0x3815, 0x01}, 16065de35c9bSChiranjeevi Rapolu {0x3816, 0x00}, 16075de35c9bSChiranjeevi Rapolu {0x3817, 0x00}, 16085de35c9bSChiranjeevi Rapolu {0x3818, 0x00}, 16095de35c9bSChiranjeevi Rapolu {0x3819, 0x00}, 16105de35c9bSChiranjeevi Rapolu {0x3820, 0x94}, 16115de35c9bSChiranjeevi Rapolu {0x3821, 0xc6}, 16125de35c9bSChiranjeevi Rapolu {0x3822, 0x48}, 16135de35c9bSChiranjeevi Rapolu {0x3826, 0x00}, 16145de35c9bSChiranjeevi Rapolu {0x3827, 0x08}, 16155de35c9bSChiranjeevi Rapolu {0x382a, 0x07}, 16165de35c9bSChiranjeevi Rapolu {0x382b, 0x01}, 16175de35c9bSChiranjeevi Rapolu {0x3830, 0x08}, 16185de35c9bSChiranjeevi Rapolu {0x3836, 0x02}, 16195de35c9bSChiranjeevi Rapolu {0x3837, 0x00}, 16205de35c9bSChiranjeevi Rapolu {0x3838, 0x10}, 16215de35c9bSChiranjeevi Rapolu {0x3841, 0xff}, 16225de35c9bSChiranjeevi Rapolu {0x3846, 0x48}, 16235de35c9bSChiranjeevi Rapolu {0x3861, 0x00}, 16245de35c9bSChiranjeevi Rapolu {0x3862, 0x04}, 16255de35c9bSChiranjeevi Rapolu {0x3863, 0x06}, 16265de35c9bSChiranjeevi Rapolu {0x3a11, 0x01}, 16275de35c9bSChiranjeevi Rapolu {0x3a12, 0x78}, 16285de35c9bSChiranjeevi Rapolu {0x3b00, 0x00}, 16295de35c9bSChiranjeevi Rapolu {0x3b02, 0x00}, 16305de35c9bSChiranjeevi Rapolu {0x3b03, 0x00}, 16315de35c9bSChiranjeevi Rapolu {0x3b04, 0x00}, 16325de35c9bSChiranjeevi Rapolu {0x3b05, 0x00}, 16335de35c9bSChiranjeevi Rapolu {0x3c00, 0x89}, 16345de35c9bSChiranjeevi Rapolu {0x3c01, 0xab}, 16355de35c9bSChiranjeevi Rapolu {0x3c02, 0x01}, 16365de35c9bSChiranjeevi Rapolu {0x3c03, 0x00}, 16375de35c9bSChiranjeevi Rapolu {0x3c04, 0x00}, 16385de35c9bSChiranjeevi Rapolu {0x3c05, 0x03}, 16395de35c9bSChiranjeevi Rapolu {0x3c06, 0x00}, 16405de35c9bSChiranjeevi Rapolu {0x3c07, 0x05}, 16415de35c9bSChiranjeevi Rapolu {0x3c0c, 0x00}, 16425de35c9bSChiranjeevi Rapolu {0x3c0d, 0x00}, 16435de35c9bSChiranjeevi Rapolu {0x3c0e, 0x00}, 16445de35c9bSChiranjeevi Rapolu {0x3c0f, 0x00}, 16455de35c9bSChiranjeevi Rapolu {0x3c40, 0x00}, 16465de35c9bSChiranjeevi Rapolu {0x3c41, 0xa3}, 16475de35c9bSChiranjeevi Rapolu {0x3c43, 0x7d}, 16485de35c9bSChiranjeevi Rapolu {0x3c45, 0xd7}, 16495de35c9bSChiranjeevi Rapolu {0x3c47, 0xfc}, 16505de35c9bSChiranjeevi Rapolu {0x3c50, 0x05}, 16515de35c9bSChiranjeevi Rapolu {0x3c52, 0xaa}, 16525de35c9bSChiranjeevi Rapolu {0x3c54, 0x71}, 16535de35c9bSChiranjeevi Rapolu {0x3c56, 0x80}, 16545de35c9bSChiranjeevi Rapolu {0x3d85, 0x17}, 16555de35c9bSChiranjeevi Rapolu {0x3f03, 0x00}, 16565de35c9bSChiranjeevi Rapolu {0x3f0a, 0x00}, 16575de35c9bSChiranjeevi Rapolu {0x3f0b, 0x00}, 16585de35c9bSChiranjeevi Rapolu {0x4001, 0x60}, 16595de35c9bSChiranjeevi Rapolu {0x4009, 0x05}, 16605de35c9bSChiranjeevi Rapolu {0x4020, 0x00}, 16615de35c9bSChiranjeevi Rapolu {0x4021, 0x00}, 16625de35c9bSChiranjeevi Rapolu {0x4022, 0x00}, 16635de35c9bSChiranjeevi Rapolu {0x4023, 0x00}, 16645de35c9bSChiranjeevi Rapolu {0x4024, 0x00}, 16655de35c9bSChiranjeevi Rapolu {0x4025, 0x00}, 16665de35c9bSChiranjeevi Rapolu {0x4026, 0x00}, 16675de35c9bSChiranjeevi Rapolu {0x4027, 0x00}, 16685de35c9bSChiranjeevi Rapolu {0x4028, 0x00}, 16695de35c9bSChiranjeevi Rapolu {0x4029, 0x00}, 16705de35c9bSChiranjeevi Rapolu {0x402a, 0x00}, 16715de35c9bSChiranjeevi Rapolu {0x402b, 0x00}, 16725de35c9bSChiranjeevi Rapolu {0x402c, 0x00}, 16735de35c9bSChiranjeevi Rapolu {0x402d, 0x00}, 16745de35c9bSChiranjeevi Rapolu {0x402e, 0x00}, 16755de35c9bSChiranjeevi Rapolu {0x402f, 0x00}, 16765de35c9bSChiranjeevi Rapolu {0x4040, 0x00}, 16775de35c9bSChiranjeevi Rapolu {0x4041, 0x03}, 16785de35c9bSChiranjeevi Rapolu {0x4042, 0x00}, 16795de35c9bSChiranjeevi Rapolu {0x4043, 0x7A}, 16805de35c9bSChiranjeevi Rapolu {0x4044, 0x00}, 16815de35c9bSChiranjeevi Rapolu {0x4045, 0x7A}, 16825de35c9bSChiranjeevi Rapolu {0x4046, 0x00}, 16835de35c9bSChiranjeevi Rapolu {0x4047, 0x7A}, 16845de35c9bSChiranjeevi Rapolu {0x4048, 0x00}, 16855de35c9bSChiranjeevi Rapolu {0x4049, 0x7A}, 16865de35c9bSChiranjeevi Rapolu {0x4307, 0x30}, 16875de35c9bSChiranjeevi Rapolu {0x4500, 0x58}, 16885de35c9bSChiranjeevi Rapolu {0x4501, 0x04}, 16895de35c9bSChiranjeevi Rapolu {0x4502, 0x40}, 16905de35c9bSChiranjeevi Rapolu {0x4503, 0x10}, 16915de35c9bSChiranjeevi Rapolu {0x4508, 0x55}, 16925de35c9bSChiranjeevi Rapolu {0x4509, 0x55}, 16935de35c9bSChiranjeevi Rapolu {0x450a, 0x02}, 16945de35c9bSChiranjeevi Rapolu {0x450b, 0x00}, 16955de35c9bSChiranjeevi Rapolu {0x4600, 0x00}, 16965de35c9bSChiranjeevi Rapolu {0x4601, 0x40}, 16975de35c9bSChiranjeevi Rapolu {0x4700, 0xa4}, 16985de35c9bSChiranjeevi Rapolu {0x4800, 0x4c}, 16995de35c9bSChiranjeevi Rapolu {0x4816, 0x53}, 17005de35c9bSChiranjeevi Rapolu {0x481f, 0x40}, 17015de35c9bSChiranjeevi Rapolu {0x4837, 0x13}, 17025de35c9bSChiranjeevi Rapolu {0x5000, 0x56}, 17035de35c9bSChiranjeevi Rapolu {0x5001, 0x01}, 17045de35c9bSChiranjeevi Rapolu {0x5002, 0x28}, 17055de35c9bSChiranjeevi Rapolu {0x5004, 0x0c}, 17065de35c9bSChiranjeevi Rapolu {0x5006, 0x0c}, 17075de35c9bSChiranjeevi Rapolu {0x5007, 0xe0}, 17085de35c9bSChiranjeevi Rapolu {0x5008, 0x01}, 17095de35c9bSChiranjeevi Rapolu {0x5009, 0xb0}, 17105de35c9bSChiranjeevi Rapolu {0x5901, 0x00}, 17115de35c9bSChiranjeevi Rapolu {0x5a01, 0x00}, 17125de35c9bSChiranjeevi Rapolu {0x5a03, 0x00}, 17135de35c9bSChiranjeevi Rapolu {0x5a04, 0x0c}, 17145de35c9bSChiranjeevi Rapolu {0x5a05, 0xe0}, 17155de35c9bSChiranjeevi Rapolu {0x5a06, 0x09}, 17165de35c9bSChiranjeevi Rapolu {0x5a07, 0xb0}, 17175de35c9bSChiranjeevi Rapolu {0x5a08, 0x06}, 17185de35c9bSChiranjeevi Rapolu {0x5e00, 0x00}, 17195de35c9bSChiranjeevi Rapolu {0x3734, 0x40}, 17205de35c9bSChiranjeevi Rapolu {0x5b00, 0x01}, 17215de35c9bSChiranjeevi Rapolu {0x5b01, 0x10}, 17225de35c9bSChiranjeevi Rapolu {0x5b02, 0x01}, 17235de35c9bSChiranjeevi Rapolu {0x5b03, 0xdb}, 17245de35c9bSChiranjeevi Rapolu {0x3d8c, 0x71}, 17255de35c9bSChiranjeevi Rapolu {0x3d8d, 0xea}, 17265de35c9bSChiranjeevi Rapolu {0x4017, 0x10}, 17275de35c9bSChiranjeevi Rapolu {0x3618, 0x2a}, 17285de35c9bSChiranjeevi Rapolu {0x5780, 0x3e}, 17295de35c9bSChiranjeevi Rapolu {0x5781, 0x0f}, 17305de35c9bSChiranjeevi Rapolu {0x5782, 0x44}, 17315de35c9bSChiranjeevi Rapolu {0x5783, 0x02}, 17325de35c9bSChiranjeevi Rapolu {0x5784, 0x01}, 17335de35c9bSChiranjeevi Rapolu {0x5785, 0x01}, 17345de35c9bSChiranjeevi Rapolu {0x5786, 0x00}, 17355de35c9bSChiranjeevi Rapolu {0x5787, 0x04}, 17365de35c9bSChiranjeevi Rapolu {0x5788, 0x02}, 17375de35c9bSChiranjeevi Rapolu {0x5789, 0x0f}, 17385de35c9bSChiranjeevi Rapolu {0x578a, 0xfd}, 17395de35c9bSChiranjeevi Rapolu {0x578b, 0xf5}, 17405de35c9bSChiranjeevi Rapolu {0x578c, 0xf5}, 17415de35c9bSChiranjeevi Rapolu {0x578d, 0x03}, 17425de35c9bSChiranjeevi Rapolu {0x578e, 0x08}, 17435de35c9bSChiranjeevi Rapolu {0x578f, 0x0c}, 17445de35c9bSChiranjeevi Rapolu {0x5790, 0x08}, 17455de35c9bSChiranjeevi Rapolu {0x5791, 0x06}, 17465de35c9bSChiranjeevi Rapolu {0x5792, 0x00}, 17475de35c9bSChiranjeevi Rapolu {0x5793, 0x52}, 17485de35c9bSChiranjeevi Rapolu {0x5794, 0xa3}, 174999cd1242SChiranjeevi Rapolu {0x3503, 0x00}, 175099cd1242SChiranjeevi Rapolu {0x5045, 0x05}, 175199cd1242SChiranjeevi Rapolu {0x4003, 0x40}, 175299cd1242SChiranjeevi Rapolu {0x5048, 0x40} 17535de35c9bSChiranjeevi Rapolu }; 17545de35c9bSChiranjeevi Rapolu 17555de35c9bSChiranjeevi Rapolu static const char * const ov5670_test_pattern_menu[] = { 17565de35c9bSChiranjeevi Rapolu "Disabled", 17575de35c9bSChiranjeevi Rapolu "Vertical Color Bar Type 1", 17585de35c9bSChiranjeevi Rapolu }; 17595de35c9bSChiranjeevi Rapolu 17605de35c9bSChiranjeevi Rapolu /* Supported link frequencies */ 1761f1425381SChiranjeevi Rapolu #define OV5670_LINK_FREQ_422MHZ 422400000 1762f1425381SChiranjeevi Rapolu #define OV5670_LINK_FREQ_422MHZ_INDEX 0 17635de35c9bSChiranjeevi Rapolu static const struct ov5670_link_freq_config link_freq_configs[] = { 17645de35c9bSChiranjeevi Rapolu { 17655de35c9bSChiranjeevi Rapolu /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */ 1766f1425381SChiranjeevi Rapolu .pixel_rate = (OV5670_LINK_FREQ_422MHZ * 2 * 2) / 10, 17675de35c9bSChiranjeevi Rapolu .reg_list = { 17685de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mipi_data_rate_840mbps), 17695de35c9bSChiranjeevi Rapolu .regs = mipi_data_rate_840mbps, 17705de35c9bSChiranjeevi Rapolu } 17715de35c9bSChiranjeevi Rapolu } 17725de35c9bSChiranjeevi Rapolu }; 17735de35c9bSChiranjeevi Rapolu 17745de35c9bSChiranjeevi Rapolu static const s64 link_freq_menu_items[] = { 1775f1425381SChiranjeevi Rapolu OV5670_LINK_FREQ_422MHZ 17765de35c9bSChiranjeevi Rapolu }; 17775de35c9bSChiranjeevi Rapolu 17785de35c9bSChiranjeevi Rapolu /* 17795de35c9bSChiranjeevi Rapolu * OV5670 sensor supports following resolutions with full FOV: 17805de35c9bSChiranjeevi Rapolu * 4:3 ==> {2592x1944, 1296x972, 648x486} 17815de35c9bSChiranjeevi Rapolu * 16:9 ==> {2560x1440, 1280x720, 640x360} 17825de35c9bSChiranjeevi Rapolu */ 17835de35c9bSChiranjeevi Rapolu static const struct ov5670_mode supported_modes[] = { 17845de35c9bSChiranjeevi Rapolu { 17855de35c9bSChiranjeevi Rapolu .width = 2592, 17865de35c9bSChiranjeevi Rapolu .height = 1944, 1787ed351ad9SChiranjeevi Rapolu .vts_def = OV5670_VTS_30FPS, 1788ed351ad9SChiranjeevi Rapolu .vts_min = OV5670_VTS_30FPS, 17892eadd98dSJean-Michel Hautbois .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 17902eadd98dSJean-Michel Hautbois .analog_crop = &ov5670_analog_crop, 17915de35c9bSChiranjeevi Rapolu .reg_list = { 17925de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mode_2592x1944_regs), 17935de35c9bSChiranjeevi Rapolu .regs = mode_2592x1944_regs, 17945de35c9bSChiranjeevi Rapolu }, 17955de35c9bSChiranjeevi Rapolu }, 17965de35c9bSChiranjeevi Rapolu { 17975de35c9bSChiranjeevi Rapolu .width = 1296, 17985de35c9bSChiranjeevi Rapolu .height = 972, 1799ed351ad9SChiranjeevi Rapolu .vts_def = OV5670_VTS_30FPS, 1800ed351ad9SChiranjeevi Rapolu .vts_min = 996, 18012eadd98dSJean-Michel Hautbois .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18022eadd98dSJean-Michel Hautbois .analog_crop = &ov5670_analog_crop, 18035de35c9bSChiranjeevi Rapolu .reg_list = { 18045de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mode_1296x972_regs), 18055de35c9bSChiranjeevi Rapolu .regs = mode_1296x972_regs, 18065de35c9bSChiranjeevi Rapolu }, 18075de35c9bSChiranjeevi Rapolu }, 18085de35c9bSChiranjeevi Rapolu { 18095de35c9bSChiranjeevi Rapolu .width = 648, 18105de35c9bSChiranjeevi Rapolu .height = 486, 1811ed351ad9SChiranjeevi Rapolu .vts_def = OV5670_VTS_30FPS, 1812ed351ad9SChiranjeevi Rapolu .vts_min = 516, 18132eadd98dSJean-Michel Hautbois .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18142eadd98dSJean-Michel Hautbois .analog_crop = &ov5670_analog_crop, 18155de35c9bSChiranjeevi Rapolu .reg_list = { 18165de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mode_648x486_regs), 18175de35c9bSChiranjeevi Rapolu .regs = mode_648x486_regs, 18185de35c9bSChiranjeevi Rapolu }, 18195de35c9bSChiranjeevi Rapolu }, 18205de35c9bSChiranjeevi Rapolu { 18215de35c9bSChiranjeevi Rapolu .width = 2560, 18225de35c9bSChiranjeevi Rapolu .height = 1440, 1823ed351ad9SChiranjeevi Rapolu .vts_def = OV5670_VTS_30FPS, 1824ed351ad9SChiranjeevi Rapolu .vts_min = OV5670_VTS_30FPS, 18252eadd98dSJean-Michel Hautbois .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18262eadd98dSJean-Michel Hautbois .analog_crop = &ov5670_analog_crop, 18275de35c9bSChiranjeevi Rapolu .reg_list = { 18285de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mode_2560x1440_regs), 18295de35c9bSChiranjeevi Rapolu .regs = mode_2560x1440_regs, 18305de35c9bSChiranjeevi Rapolu }, 18315de35c9bSChiranjeevi Rapolu }, 18325de35c9bSChiranjeevi Rapolu { 18335de35c9bSChiranjeevi Rapolu .width = 1280, 18345de35c9bSChiranjeevi Rapolu .height = 720, 1835ed351ad9SChiranjeevi Rapolu .vts_def = OV5670_VTS_30FPS, 1836ed351ad9SChiranjeevi Rapolu .vts_min = 1020, 18372eadd98dSJean-Michel Hautbois 18382eadd98dSJean-Michel Hautbois .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18392eadd98dSJean-Michel Hautbois .analog_crop = &ov5670_analog_crop, 18405de35c9bSChiranjeevi Rapolu .reg_list = { 18415de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mode_1280x720_regs), 18425de35c9bSChiranjeevi Rapolu .regs = mode_1280x720_regs, 18435de35c9bSChiranjeevi Rapolu }, 18445de35c9bSChiranjeevi Rapolu }, 18455de35c9bSChiranjeevi Rapolu { 18465de35c9bSChiranjeevi Rapolu .width = 640, 18475de35c9bSChiranjeevi Rapolu .height = 360, 1848ed351ad9SChiranjeevi Rapolu .vts_def = OV5670_VTS_30FPS, 1849ed351ad9SChiranjeevi Rapolu .vts_min = 510, 18502eadd98dSJean-Michel Hautbois .link_freq_index = OV5670_LINK_FREQ_422MHZ_INDEX, 18512eadd98dSJean-Michel Hautbois .analog_crop = &ov5670_analog_crop, 18525de35c9bSChiranjeevi Rapolu .reg_list = { 18535de35c9bSChiranjeevi Rapolu .num_of_regs = ARRAY_SIZE(mode_640x360_regs), 18545de35c9bSChiranjeevi Rapolu .regs = mode_640x360_regs, 18555de35c9bSChiranjeevi Rapolu }, 18565de35c9bSChiranjeevi Rapolu } 18575de35c9bSChiranjeevi Rapolu }; 18585de35c9bSChiranjeevi Rapolu 18595de35c9bSChiranjeevi Rapolu struct ov5670 { 18605de35c9bSChiranjeevi Rapolu struct v4l2_subdev sd; 18615de35c9bSChiranjeevi Rapolu struct media_pad pad; 18625de35c9bSChiranjeevi Rapolu 18635de35c9bSChiranjeevi Rapolu struct v4l2_ctrl_handler ctrl_handler; 18645de35c9bSChiranjeevi Rapolu /* V4L2 Controls */ 18655de35c9bSChiranjeevi Rapolu struct v4l2_ctrl *link_freq; 18665de35c9bSChiranjeevi Rapolu struct v4l2_ctrl *pixel_rate; 18675de35c9bSChiranjeevi Rapolu struct v4l2_ctrl *vblank; 18685de35c9bSChiranjeevi Rapolu struct v4l2_ctrl *hblank; 18695de35c9bSChiranjeevi Rapolu struct v4l2_ctrl *exposure; 18705de35c9bSChiranjeevi Rapolu 18715de35c9bSChiranjeevi Rapolu /* Current mode */ 18725de35c9bSChiranjeevi Rapolu const struct ov5670_mode *cur_mode; 18735de35c9bSChiranjeevi Rapolu 18748004c91eSJacopo Mondi /* xvclk input clock */ 18758004c91eSJacopo Mondi struct clk *xvclk; 18768004c91eSJacopo Mondi 1877cf9ab879SJacopo Mondi /* Regulators */ 1878cf9ab879SJacopo Mondi struct regulator_bulk_data supplies[OV5670_NUM_SUPPLIES]; 1879cf9ab879SJacopo Mondi 18800a844ab7SJacopo Mondi /* Power-down and reset gpios. */ 18810a844ab7SJacopo Mondi struct gpio_desc *pwdn_gpio; /* PWDNB pin. */ 18820a844ab7SJacopo Mondi struct gpio_desc *reset_gpio; /* XSHUTDOWN pin. */ 18830a844ab7SJacopo Mondi 18845de35c9bSChiranjeevi Rapolu /* To serialize asynchronus callbacks */ 18855de35c9bSChiranjeevi Rapolu struct mutex mutex; 18865de35c9bSChiranjeevi Rapolu 18875de35c9bSChiranjeevi Rapolu /* Streaming on/off */ 18885de35c9bSChiranjeevi Rapolu bool streaming; 18891e583b56SSakari Ailus /* True if the device has been identified */ 18901e583b56SSakari Ailus bool identified; 18915de35c9bSChiranjeevi Rapolu }; 18925de35c9bSChiranjeevi Rapolu 18935de35c9bSChiranjeevi Rapolu #define to_ov5670(_sd) container_of(_sd, struct ov5670, sd) 18945de35c9bSChiranjeevi Rapolu 18955de35c9bSChiranjeevi Rapolu /* Read registers up to 4 at a time */ 18965de35c9bSChiranjeevi Rapolu static int ov5670_read_reg(struct ov5670 *ov5670, u16 reg, unsigned int len, 18975de35c9bSChiranjeevi Rapolu u32 *val) 18985de35c9bSChiranjeevi Rapolu { 18995de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 19005de35c9bSChiranjeevi Rapolu struct i2c_msg msgs[2]; 19015de35c9bSChiranjeevi Rapolu u8 *data_be_p; 1902baa6f19bSMauro Carvalho Chehab __be32 data_be = 0; 1903baa6f19bSMauro Carvalho Chehab __be16 reg_addr_be = cpu_to_be16(reg); 19045de35c9bSChiranjeevi Rapolu int ret; 19055de35c9bSChiranjeevi Rapolu 19065de35c9bSChiranjeevi Rapolu if (len > 4) 19075de35c9bSChiranjeevi Rapolu return -EINVAL; 19085de35c9bSChiranjeevi Rapolu 19095de35c9bSChiranjeevi Rapolu data_be_p = (u8 *)&data_be; 19105de35c9bSChiranjeevi Rapolu /* Write register address */ 19115de35c9bSChiranjeevi Rapolu msgs[0].addr = client->addr; 19125de35c9bSChiranjeevi Rapolu msgs[0].flags = 0; 19135de35c9bSChiranjeevi Rapolu msgs[0].len = 2; 19145de35c9bSChiranjeevi Rapolu msgs[0].buf = (u8 *)®_addr_be; 19155de35c9bSChiranjeevi Rapolu 19165de35c9bSChiranjeevi Rapolu /* Read data from register */ 19175de35c9bSChiranjeevi Rapolu msgs[1].addr = client->addr; 19185de35c9bSChiranjeevi Rapolu msgs[1].flags = I2C_M_RD; 19195de35c9bSChiranjeevi Rapolu msgs[1].len = len; 19205de35c9bSChiranjeevi Rapolu msgs[1].buf = &data_be_p[4 - len]; 19215de35c9bSChiranjeevi Rapolu 19225de35c9bSChiranjeevi Rapolu ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 19235de35c9bSChiranjeevi Rapolu if (ret != ARRAY_SIZE(msgs)) 19245de35c9bSChiranjeevi Rapolu return -EIO; 19255de35c9bSChiranjeevi Rapolu 19265de35c9bSChiranjeevi Rapolu *val = be32_to_cpu(data_be); 19275de35c9bSChiranjeevi Rapolu 19285de35c9bSChiranjeevi Rapolu return 0; 19295de35c9bSChiranjeevi Rapolu } 19305de35c9bSChiranjeevi Rapolu 19315de35c9bSChiranjeevi Rapolu /* Write registers up to 4 at a time */ 19325de35c9bSChiranjeevi Rapolu static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len, 19335de35c9bSChiranjeevi Rapolu u32 val) 19345de35c9bSChiranjeevi Rapolu { 19355de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 19365de35c9bSChiranjeevi Rapolu int buf_i; 19375de35c9bSChiranjeevi Rapolu int val_i; 19385de35c9bSChiranjeevi Rapolu u8 buf[6]; 19395de35c9bSChiranjeevi Rapolu u8 *val_p; 1940baa6f19bSMauro Carvalho Chehab __be32 tmp; 19415de35c9bSChiranjeevi Rapolu 19425de35c9bSChiranjeevi Rapolu if (len > 4) 19435de35c9bSChiranjeevi Rapolu return -EINVAL; 19445de35c9bSChiranjeevi Rapolu 19455de35c9bSChiranjeevi Rapolu buf[0] = reg >> 8; 19465de35c9bSChiranjeevi Rapolu buf[1] = reg & 0xff; 19475de35c9bSChiranjeevi Rapolu 1948baa6f19bSMauro Carvalho Chehab tmp = cpu_to_be32(val); 1949baa6f19bSMauro Carvalho Chehab val_p = (u8 *)&tmp; 19505de35c9bSChiranjeevi Rapolu buf_i = 2; 19515de35c9bSChiranjeevi Rapolu val_i = 4 - len; 19525de35c9bSChiranjeevi Rapolu 19535de35c9bSChiranjeevi Rapolu while (val_i < 4) 19545de35c9bSChiranjeevi Rapolu buf[buf_i++] = val_p[val_i++]; 19555de35c9bSChiranjeevi Rapolu 19565de35c9bSChiranjeevi Rapolu if (i2c_master_send(client, buf, len + 2) != len + 2) 19575de35c9bSChiranjeevi Rapolu return -EIO; 19585de35c9bSChiranjeevi Rapolu 19595de35c9bSChiranjeevi Rapolu return 0; 19605de35c9bSChiranjeevi Rapolu } 19615de35c9bSChiranjeevi Rapolu 19625de35c9bSChiranjeevi Rapolu /* Write a list of registers */ 19635de35c9bSChiranjeevi Rapolu static int ov5670_write_regs(struct ov5670 *ov5670, 19645de35c9bSChiranjeevi Rapolu const struct ov5670_reg *regs, unsigned int len) 19655de35c9bSChiranjeevi Rapolu { 19665de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 19675de35c9bSChiranjeevi Rapolu unsigned int i; 19685de35c9bSChiranjeevi Rapolu int ret; 19695de35c9bSChiranjeevi Rapolu 19705de35c9bSChiranjeevi Rapolu for (i = 0; i < len; i++) { 19715de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, regs[i].address, 1, regs[i].val); 19725de35c9bSChiranjeevi Rapolu if (ret) { 19735de35c9bSChiranjeevi Rapolu dev_err_ratelimited( 19745de35c9bSChiranjeevi Rapolu &client->dev, 19755de35c9bSChiranjeevi Rapolu "Failed to write reg 0x%4.4x. error = %d\n", 19765de35c9bSChiranjeevi Rapolu regs[i].address, ret); 19775de35c9bSChiranjeevi Rapolu 19785de35c9bSChiranjeevi Rapolu return ret; 19795de35c9bSChiranjeevi Rapolu } 19805de35c9bSChiranjeevi Rapolu } 19815de35c9bSChiranjeevi Rapolu 19825de35c9bSChiranjeevi Rapolu return 0; 19835de35c9bSChiranjeevi Rapolu } 19845de35c9bSChiranjeevi Rapolu 19855de35c9bSChiranjeevi Rapolu static int ov5670_write_reg_list(struct ov5670 *ov5670, 19865de35c9bSChiranjeevi Rapolu const struct ov5670_reg_list *r_list) 19875de35c9bSChiranjeevi Rapolu { 19885de35c9bSChiranjeevi Rapolu return ov5670_write_regs(ov5670, r_list->regs, r_list->num_of_regs); 19895de35c9bSChiranjeevi Rapolu } 19905de35c9bSChiranjeevi Rapolu 19915de35c9bSChiranjeevi Rapolu static int ov5670_update_digital_gain(struct ov5670 *ov5670, u32 d_gain) 19925de35c9bSChiranjeevi Rapolu { 19935de35c9bSChiranjeevi Rapolu int ret; 19945de35c9bSChiranjeevi Rapolu 19955de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_R_DGTL_GAIN, 19965de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_16BIT, d_gain); 19975de35c9bSChiranjeevi Rapolu if (ret) 19985de35c9bSChiranjeevi Rapolu return ret; 19995de35c9bSChiranjeevi Rapolu 20005de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_G_DGTL_GAIN, 20015de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_16BIT, d_gain); 20025de35c9bSChiranjeevi Rapolu if (ret) 20035de35c9bSChiranjeevi Rapolu return ret; 20045de35c9bSChiranjeevi Rapolu 20055de35c9bSChiranjeevi Rapolu return ov5670_write_reg(ov5670, OV5670_REG_B_DGTL_GAIN, 20065de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_16BIT, d_gain); 20075de35c9bSChiranjeevi Rapolu } 20085de35c9bSChiranjeevi Rapolu 20095de35c9bSChiranjeevi Rapolu static int ov5670_enable_test_pattern(struct ov5670 *ov5670, u32 pattern) 20105de35c9bSChiranjeevi Rapolu { 20115de35c9bSChiranjeevi Rapolu u32 val; 20125de35c9bSChiranjeevi Rapolu int ret; 20135de35c9bSChiranjeevi Rapolu 20145de35c9bSChiranjeevi Rapolu /* Set the bayer order that we support */ 20155de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_TEST_PATTERN_CTRL, 20165de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_08BIT, 0); 20175de35c9bSChiranjeevi Rapolu if (ret) 20185de35c9bSChiranjeevi Rapolu return ret; 20195de35c9bSChiranjeevi Rapolu 20205de35c9bSChiranjeevi Rapolu ret = ov5670_read_reg(ov5670, OV5670_REG_TEST_PATTERN, 20215de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_08BIT, &val); 20225de35c9bSChiranjeevi Rapolu if (ret) 20235de35c9bSChiranjeevi Rapolu return ret; 20245de35c9bSChiranjeevi Rapolu 20255de35c9bSChiranjeevi Rapolu if (pattern) 20265de35c9bSChiranjeevi Rapolu val |= OV5670_TEST_PATTERN_ENABLE; 20275de35c9bSChiranjeevi Rapolu else 20285de35c9bSChiranjeevi Rapolu val &= ~OV5670_TEST_PATTERN_ENABLE; 20295de35c9bSChiranjeevi Rapolu 20305de35c9bSChiranjeevi Rapolu return ov5670_write_reg(ov5670, OV5670_REG_TEST_PATTERN, 20315de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_08BIT, val); 20325de35c9bSChiranjeevi Rapolu } 20335de35c9bSChiranjeevi Rapolu 20345de35c9bSChiranjeevi Rapolu /* Initialize control handlers */ 20355de35c9bSChiranjeevi Rapolu static int ov5670_set_ctrl(struct v4l2_ctrl *ctrl) 20365de35c9bSChiranjeevi Rapolu { 20375de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = container_of(ctrl->handler, 20385de35c9bSChiranjeevi Rapolu struct ov5670, ctrl_handler); 20395de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 20405de35c9bSChiranjeevi Rapolu s64 max; 2041c5b6f99cSJacopo Mondi int ret; 20425de35c9bSChiranjeevi Rapolu 20435de35c9bSChiranjeevi Rapolu /* Propagate change of current control to all related controls */ 20445de35c9bSChiranjeevi Rapolu switch (ctrl->id) { 20455de35c9bSChiranjeevi Rapolu case V4L2_CID_VBLANK: 20465de35c9bSChiranjeevi Rapolu /* Update max exposure while meeting expected vblanking */ 20475de35c9bSChiranjeevi Rapolu max = ov5670->cur_mode->height + ctrl->val - 8; 20485de35c9bSChiranjeevi Rapolu __v4l2_ctrl_modify_range(ov5670->exposure, 20495de35c9bSChiranjeevi Rapolu ov5670->exposure->minimum, max, 20505de35c9bSChiranjeevi Rapolu ov5670->exposure->step, max); 20515de35c9bSChiranjeevi Rapolu break; 20525de35c9bSChiranjeevi Rapolu } 20535de35c9bSChiranjeevi Rapolu 20545de35c9bSChiranjeevi Rapolu /* V4L2 controls values will be applied only when power is already up */ 20554d471563SSakari Ailus if (!pm_runtime_get_if_in_use(&client->dev)) 20565de35c9bSChiranjeevi Rapolu return 0; 20575de35c9bSChiranjeevi Rapolu 20585de35c9bSChiranjeevi Rapolu switch (ctrl->id) { 20595de35c9bSChiranjeevi Rapolu case V4L2_CID_ANALOGUE_GAIN: 20605de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_ANALOG_GAIN, 20615de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_16BIT, ctrl->val); 20625de35c9bSChiranjeevi Rapolu break; 20635de35c9bSChiranjeevi Rapolu case V4L2_CID_DIGITAL_GAIN: 20645de35c9bSChiranjeevi Rapolu ret = ov5670_update_digital_gain(ov5670, ctrl->val); 20655de35c9bSChiranjeevi Rapolu break; 20665de35c9bSChiranjeevi Rapolu case V4L2_CID_EXPOSURE: 20675de35c9bSChiranjeevi Rapolu /* 4 least significant bits of expsoure are fractional part */ 20685de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_EXPOSURE, 20695de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_24BIT, ctrl->val << 4); 20705de35c9bSChiranjeevi Rapolu break; 20715de35c9bSChiranjeevi Rapolu case V4L2_CID_VBLANK: 20725de35c9bSChiranjeevi Rapolu /* Update VTS that meets expected vertical blanking */ 20735de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_VTS, 20745de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_16BIT, 20755de35c9bSChiranjeevi Rapolu ov5670->cur_mode->height + ctrl->val); 20765de35c9bSChiranjeevi Rapolu break; 20775de35c9bSChiranjeevi Rapolu case V4L2_CID_TEST_PATTERN: 20785de35c9bSChiranjeevi Rapolu ret = ov5670_enable_test_pattern(ov5670, ctrl->val); 20795de35c9bSChiranjeevi Rapolu break; 2080c5b6f99cSJacopo Mondi case V4L2_CID_HBLANK: 2081c5b6f99cSJacopo Mondi case V4L2_CID_LINK_FREQ: 2082c5b6f99cSJacopo Mondi case V4L2_CID_PIXEL_RATE: 2083c5b6f99cSJacopo Mondi ret = 0; 2084c5b6f99cSJacopo Mondi break; 20855de35c9bSChiranjeevi Rapolu default: 2086c5b6f99cSJacopo Mondi ret = -EINVAL; 20875de35c9bSChiranjeevi Rapolu dev_info(&client->dev, "%s Unhandled id:0x%x, val:0x%x\n", 20885de35c9bSChiranjeevi Rapolu __func__, ctrl->id, ctrl->val); 20895de35c9bSChiranjeevi Rapolu break; 209005ad2b6dSkbuild test robot } 20915de35c9bSChiranjeevi Rapolu 20925de35c9bSChiranjeevi Rapolu pm_runtime_put(&client->dev); 20935de35c9bSChiranjeevi Rapolu 20945de35c9bSChiranjeevi Rapolu return ret; 20955de35c9bSChiranjeevi Rapolu } 20965de35c9bSChiranjeevi Rapolu 20975de35c9bSChiranjeevi Rapolu static const struct v4l2_ctrl_ops ov5670_ctrl_ops = { 20985de35c9bSChiranjeevi Rapolu .s_ctrl = ov5670_set_ctrl, 20995de35c9bSChiranjeevi Rapolu }; 21005de35c9bSChiranjeevi Rapolu 21015de35c9bSChiranjeevi Rapolu /* Initialize control handlers */ 21025de35c9bSChiranjeevi Rapolu static int ov5670_init_controls(struct ov5670 *ov5670) 21035de35c9bSChiranjeevi Rapolu { 2104eba08021SJacopo Mondi struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 2105eba08021SJacopo Mondi struct v4l2_fwnode_device_properties props; 21065de35c9bSChiranjeevi Rapolu struct v4l2_ctrl_handler *ctrl_hdlr; 21075de35c9bSChiranjeevi Rapolu s64 vblank_max; 21085de35c9bSChiranjeevi Rapolu s64 vblank_def; 2109ed351ad9SChiranjeevi Rapolu s64 vblank_min; 21105de35c9bSChiranjeevi Rapolu s64 exposure_max; 21115de35c9bSChiranjeevi Rapolu int ret; 21125de35c9bSChiranjeevi Rapolu 21135de35c9bSChiranjeevi Rapolu ctrl_hdlr = &ov5670->ctrl_handler; 2114eba08021SJacopo Mondi ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); 21155de35c9bSChiranjeevi Rapolu if (ret) 21165de35c9bSChiranjeevi Rapolu return ret; 21175de35c9bSChiranjeevi Rapolu 21185de35c9bSChiranjeevi Rapolu ctrl_hdlr->lock = &ov5670->mutex; 21195de35c9bSChiranjeevi Rapolu ov5670->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, 21205de35c9bSChiranjeevi Rapolu &ov5670_ctrl_ops, 21215de35c9bSChiranjeevi Rapolu V4L2_CID_LINK_FREQ, 21225de35c9bSChiranjeevi Rapolu 0, 0, link_freq_menu_items); 21235de35c9bSChiranjeevi Rapolu if (ov5670->link_freq) 21245de35c9bSChiranjeevi Rapolu ov5670->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; 21255de35c9bSChiranjeevi Rapolu 21265de35c9bSChiranjeevi Rapolu /* By default, V4L2_CID_PIXEL_RATE is read only */ 21275de35c9bSChiranjeevi Rapolu ov5670->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, 2128dc1eb7c9SJacopo Mondi V4L2_CID_PIXEL_RATE, 2129dc1eb7c9SJacopo Mondi link_freq_configs[0].pixel_rate, 21305de35c9bSChiranjeevi Rapolu link_freq_configs[0].pixel_rate, 21315de35c9bSChiranjeevi Rapolu 1, 21325de35c9bSChiranjeevi Rapolu link_freq_configs[0].pixel_rate); 21335de35c9bSChiranjeevi Rapolu 21345de35c9bSChiranjeevi Rapolu vblank_max = OV5670_VTS_MAX - ov5670->cur_mode->height; 2135ed351ad9SChiranjeevi Rapolu vblank_def = ov5670->cur_mode->vts_def - ov5670->cur_mode->height; 2136ed351ad9SChiranjeevi Rapolu vblank_min = ov5670->cur_mode->vts_min - ov5670->cur_mode->height; 21375de35c9bSChiranjeevi Rapolu ov5670->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, 2138ed351ad9SChiranjeevi Rapolu V4L2_CID_VBLANK, vblank_min, 21395de35c9bSChiranjeevi Rapolu vblank_max, 1, vblank_def); 21405de35c9bSChiranjeevi Rapolu 21415de35c9bSChiranjeevi Rapolu ov5670->hblank = v4l2_ctrl_new_std( 21425de35c9bSChiranjeevi Rapolu ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_HBLANK, 2143f1425381SChiranjeevi Rapolu OV5670_FIXED_PPL - ov5670->cur_mode->width, 2144f1425381SChiranjeevi Rapolu OV5670_FIXED_PPL - ov5670->cur_mode->width, 1, 2145f1425381SChiranjeevi Rapolu OV5670_FIXED_PPL - ov5670->cur_mode->width); 2146f1425381SChiranjeevi Rapolu if (ov5670->hblank) 2147f1425381SChiranjeevi Rapolu ov5670->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; 21485de35c9bSChiranjeevi Rapolu 21495de35c9bSChiranjeevi Rapolu /* Get min, max, step, default from sensor */ 21505de35c9bSChiranjeevi Rapolu v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_ANALOGUE_GAIN, 21515de35c9bSChiranjeevi Rapolu ANALOG_GAIN_MIN, ANALOG_GAIN_MAX, ANALOG_GAIN_STEP, 21525de35c9bSChiranjeevi Rapolu ANALOG_GAIN_DEFAULT); 21535de35c9bSChiranjeevi Rapolu 21545de35c9bSChiranjeevi Rapolu /* Digital gain */ 21555de35c9bSChiranjeevi Rapolu v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, V4L2_CID_DIGITAL_GAIN, 21565de35c9bSChiranjeevi Rapolu OV5670_DGTL_GAIN_MIN, OV5670_DGTL_GAIN_MAX, 21575de35c9bSChiranjeevi Rapolu OV5670_DGTL_GAIN_STEP, OV5670_DGTL_GAIN_DEFAULT); 21585de35c9bSChiranjeevi Rapolu 21595de35c9bSChiranjeevi Rapolu /* Get min, max, step, default from sensor */ 2160ed351ad9SChiranjeevi Rapolu exposure_max = ov5670->cur_mode->vts_def - 8; 21615de35c9bSChiranjeevi Rapolu ov5670->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov5670_ctrl_ops, 21625de35c9bSChiranjeevi Rapolu V4L2_CID_EXPOSURE, 21635de35c9bSChiranjeevi Rapolu OV5670_EXPOSURE_MIN, 21645de35c9bSChiranjeevi Rapolu exposure_max, OV5670_EXPOSURE_STEP, 21655de35c9bSChiranjeevi Rapolu exposure_max); 21665de35c9bSChiranjeevi Rapolu 21675de35c9bSChiranjeevi Rapolu v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &ov5670_ctrl_ops, 21685de35c9bSChiranjeevi Rapolu V4L2_CID_TEST_PATTERN, 21695de35c9bSChiranjeevi Rapolu ARRAY_SIZE(ov5670_test_pattern_menu) - 1, 21705de35c9bSChiranjeevi Rapolu 0, 0, ov5670_test_pattern_menu); 21715de35c9bSChiranjeevi Rapolu 21725de35c9bSChiranjeevi Rapolu if (ctrl_hdlr->error) { 21735de35c9bSChiranjeevi Rapolu ret = ctrl_hdlr->error; 21745de35c9bSChiranjeevi Rapolu goto error; 21755de35c9bSChiranjeevi Rapolu } 21765de35c9bSChiranjeevi Rapolu 2177eba08021SJacopo Mondi ret = v4l2_fwnode_device_parse(&client->dev, &props); 2178eba08021SJacopo Mondi if (ret) 2179eba08021SJacopo Mondi goto error; 2180eba08021SJacopo Mondi 2181eba08021SJacopo Mondi ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov5670_ctrl_ops, 2182eba08021SJacopo Mondi &props); 2183eba08021SJacopo Mondi if (ret) 2184eba08021SJacopo Mondi goto error; 2185eba08021SJacopo Mondi 21865de35c9bSChiranjeevi Rapolu ov5670->sd.ctrl_handler = ctrl_hdlr; 21875de35c9bSChiranjeevi Rapolu 21885de35c9bSChiranjeevi Rapolu return 0; 21895de35c9bSChiranjeevi Rapolu 21905de35c9bSChiranjeevi Rapolu error: 21915de35c9bSChiranjeevi Rapolu v4l2_ctrl_handler_free(ctrl_hdlr); 21925de35c9bSChiranjeevi Rapolu 21935de35c9bSChiranjeevi Rapolu return ret; 21945de35c9bSChiranjeevi Rapolu } 21955de35c9bSChiranjeevi Rapolu 2196bbc6071cSJacopo Mondi static int ov5670_init_cfg(struct v4l2_subdev *sd, 2197bbc6071cSJacopo Mondi struct v4l2_subdev_state *state) 2198bbc6071cSJacopo Mondi { 2199bbc6071cSJacopo Mondi struct v4l2_mbus_framefmt *fmt = 2200bbc6071cSJacopo Mondi v4l2_subdev_get_try_format(sd, state, 0); 2201bbc6071cSJacopo Mondi const struct ov5670_mode *default_mode = &supported_modes[0]; 22022eadd98dSJean-Michel Hautbois struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, state, 0); 2203bbc6071cSJacopo Mondi 2204bbc6071cSJacopo Mondi fmt->width = default_mode->width; 2205bbc6071cSJacopo Mondi fmt->height = default_mode->height; 2206bbc6071cSJacopo Mondi fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; 2207bbc6071cSJacopo Mondi fmt->field = V4L2_FIELD_NONE; 2208bbc6071cSJacopo Mondi fmt->colorspace = V4L2_COLORSPACE_SRGB; 2209bbc6071cSJacopo Mondi fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SRGB); 2210bbc6071cSJacopo Mondi fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; 2211bbc6071cSJacopo Mondi fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SRGB); 2212bbc6071cSJacopo Mondi 22132eadd98dSJean-Michel Hautbois *crop = *default_mode->analog_crop; 22142eadd98dSJean-Michel Hautbois 2215bbc6071cSJacopo Mondi return 0; 2216bbc6071cSJacopo Mondi } 2217bbc6071cSJacopo Mondi 22185de35c9bSChiranjeevi Rapolu static int ov5670_enum_mbus_code(struct v4l2_subdev *sd, 22190d346d2aSTomi Valkeinen struct v4l2_subdev_state *sd_state, 22205de35c9bSChiranjeevi Rapolu struct v4l2_subdev_mbus_code_enum *code) 22215de35c9bSChiranjeevi Rapolu { 22225de35c9bSChiranjeevi Rapolu /* Only one bayer order GRBG is supported */ 22235de35c9bSChiranjeevi Rapolu if (code->index > 0) 22245de35c9bSChiranjeevi Rapolu return -EINVAL; 22255de35c9bSChiranjeevi Rapolu 22265de35c9bSChiranjeevi Rapolu code->code = MEDIA_BUS_FMT_SGRBG10_1X10; 22275de35c9bSChiranjeevi Rapolu 22285de35c9bSChiranjeevi Rapolu return 0; 22295de35c9bSChiranjeevi Rapolu } 22305de35c9bSChiranjeevi Rapolu 22315de35c9bSChiranjeevi Rapolu static int ov5670_enum_frame_size(struct v4l2_subdev *sd, 22320d346d2aSTomi Valkeinen struct v4l2_subdev_state *sd_state, 22335de35c9bSChiranjeevi Rapolu struct v4l2_subdev_frame_size_enum *fse) 22345de35c9bSChiranjeevi Rapolu { 22355de35c9bSChiranjeevi Rapolu if (fse->index >= ARRAY_SIZE(supported_modes)) 22365de35c9bSChiranjeevi Rapolu return -EINVAL; 22375de35c9bSChiranjeevi Rapolu 22385de35c9bSChiranjeevi Rapolu if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) 22395de35c9bSChiranjeevi Rapolu return -EINVAL; 22405de35c9bSChiranjeevi Rapolu 22415de35c9bSChiranjeevi Rapolu fse->min_width = supported_modes[fse->index].width; 22425de35c9bSChiranjeevi Rapolu fse->max_width = fse->min_width; 22435de35c9bSChiranjeevi Rapolu fse->min_height = supported_modes[fse->index].height; 22445de35c9bSChiranjeevi Rapolu fse->max_height = fse->min_height; 22455de35c9bSChiranjeevi Rapolu 22465de35c9bSChiranjeevi Rapolu return 0; 22475de35c9bSChiranjeevi Rapolu } 22485de35c9bSChiranjeevi Rapolu 22495de35c9bSChiranjeevi Rapolu static void ov5670_update_pad_format(const struct ov5670_mode *mode, 22505de35c9bSChiranjeevi Rapolu struct v4l2_subdev_format *fmt) 22515de35c9bSChiranjeevi Rapolu { 22525de35c9bSChiranjeevi Rapolu fmt->format.width = mode->width; 22535de35c9bSChiranjeevi Rapolu fmt->format.height = mode->height; 22545de35c9bSChiranjeevi Rapolu fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 22555de35c9bSChiranjeevi Rapolu fmt->format.field = V4L2_FIELD_NONE; 22565de35c9bSChiranjeevi Rapolu } 22575de35c9bSChiranjeevi Rapolu 22585de35c9bSChiranjeevi Rapolu static int ov5670_do_get_pad_format(struct ov5670 *ov5670, 22590d346d2aSTomi Valkeinen struct v4l2_subdev_state *sd_state, 22605de35c9bSChiranjeevi Rapolu struct v4l2_subdev_format *fmt) 22615de35c9bSChiranjeevi Rapolu { 22625de35c9bSChiranjeevi Rapolu if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 22630d346d2aSTomi Valkeinen fmt->format = *v4l2_subdev_get_try_format(&ov5670->sd, 22640d346d2aSTomi Valkeinen sd_state, 22655de35c9bSChiranjeevi Rapolu fmt->pad); 22665de35c9bSChiranjeevi Rapolu else 22675de35c9bSChiranjeevi Rapolu ov5670_update_pad_format(ov5670->cur_mode, fmt); 22685de35c9bSChiranjeevi Rapolu 22695de35c9bSChiranjeevi Rapolu return 0; 22705de35c9bSChiranjeevi Rapolu } 22715de35c9bSChiranjeevi Rapolu 22725de35c9bSChiranjeevi Rapolu static int ov5670_get_pad_format(struct v4l2_subdev *sd, 22730d346d2aSTomi Valkeinen struct v4l2_subdev_state *sd_state, 22745de35c9bSChiranjeevi Rapolu struct v4l2_subdev_format *fmt) 22755de35c9bSChiranjeevi Rapolu { 22765de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = to_ov5670(sd); 22775de35c9bSChiranjeevi Rapolu int ret; 22785de35c9bSChiranjeevi Rapolu 22795de35c9bSChiranjeevi Rapolu mutex_lock(&ov5670->mutex); 22800d346d2aSTomi Valkeinen ret = ov5670_do_get_pad_format(ov5670, sd_state, fmt); 22815de35c9bSChiranjeevi Rapolu mutex_unlock(&ov5670->mutex); 22825de35c9bSChiranjeevi Rapolu 22835de35c9bSChiranjeevi Rapolu return ret; 22845de35c9bSChiranjeevi Rapolu } 22855de35c9bSChiranjeevi Rapolu 22865de35c9bSChiranjeevi Rapolu static int ov5670_set_pad_format(struct v4l2_subdev *sd, 22870d346d2aSTomi Valkeinen struct v4l2_subdev_state *sd_state, 22885de35c9bSChiranjeevi Rapolu struct v4l2_subdev_format *fmt) 22895de35c9bSChiranjeevi Rapolu { 22905de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = to_ov5670(sd); 22915de35c9bSChiranjeevi Rapolu const struct ov5670_mode *mode; 22925de35c9bSChiranjeevi Rapolu s32 vblank_def; 22935de35c9bSChiranjeevi Rapolu s32 h_blank; 22945de35c9bSChiranjeevi Rapolu 22955de35c9bSChiranjeevi Rapolu mutex_lock(&ov5670->mutex); 22965de35c9bSChiranjeevi Rapolu 22975de35c9bSChiranjeevi Rapolu fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 22985de35c9bSChiranjeevi Rapolu 2299d2dc57b1SSakari Ailus mode = v4l2_find_nearest_size(supported_modes, 2300d2dc57b1SSakari Ailus ARRAY_SIZE(supported_modes), 2301d2dc57b1SSakari Ailus width, height, 2302894de53bSSakari Ailus fmt->format.width, fmt->format.height); 23035de35c9bSChiranjeevi Rapolu ov5670_update_pad_format(mode, fmt); 23045de35c9bSChiranjeevi Rapolu if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 23050d346d2aSTomi Valkeinen *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 23065de35c9bSChiranjeevi Rapolu } else { 23075de35c9bSChiranjeevi Rapolu ov5670->cur_mode = mode; 23085de35c9bSChiranjeevi Rapolu __v4l2_ctrl_s_ctrl(ov5670->link_freq, mode->link_freq_index); 23095de35c9bSChiranjeevi Rapolu __v4l2_ctrl_s_ctrl_int64( 23105de35c9bSChiranjeevi Rapolu ov5670->pixel_rate, 23115de35c9bSChiranjeevi Rapolu link_freq_configs[mode->link_freq_index].pixel_rate); 23125de35c9bSChiranjeevi Rapolu /* Update limits and set FPS to default */ 2313ed351ad9SChiranjeevi Rapolu vblank_def = ov5670->cur_mode->vts_def - 2314ed351ad9SChiranjeevi Rapolu ov5670->cur_mode->height; 23155de35c9bSChiranjeevi Rapolu __v4l2_ctrl_modify_range( 2316ed351ad9SChiranjeevi Rapolu ov5670->vblank, 2317ed351ad9SChiranjeevi Rapolu ov5670->cur_mode->vts_min - ov5670->cur_mode->height, 23185de35c9bSChiranjeevi Rapolu OV5670_VTS_MAX - ov5670->cur_mode->height, 1, 23195de35c9bSChiranjeevi Rapolu vblank_def); 23205de35c9bSChiranjeevi Rapolu __v4l2_ctrl_s_ctrl(ov5670->vblank, vblank_def); 2321f1425381SChiranjeevi Rapolu h_blank = OV5670_FIXED_PPL - ov5670->cur_mode->width; 23225de35c9bSChiranjeevi Rapolu __v4l2_ctrl_modify_range(ov5670->hblank, h_blank, h_blank, 1, 23235de35c9bSChiranjeevi Rapolu h_blank); 23245de35c9bSChiranjeevi Rapolu } 23255de35c9bSChiranjeevi Rapolu 23265de35c9bSChiranjeevi Rapolu mutex_unlock(&ov5670->mutex); 23275de35c9bSChiranjeevi Rapolu 23285de35c9bSChiranjeevi Rapolu return 0; 23295de35c9bSChiranjeevi Rapolu } 23305de35c9bSChiranjeevi Rapolu 23315de35c9bSChiranjeevi Rapolu static int ov5670_get_skip_frames(struct v4l2_subdev *sd, u32 *frames) 23325de35c9bSChiranjeevi Rapolu { 23335de35c9bSChiranjeevi Rapolu *frames = OV5670_NUM_OF_SKIP_FRAMES; 23345de35c9bSChiranjeevi Rapolu 23355de35c9bSChiranjeevi Rapolu return 0; 23365de35c9bSChiranjeevi Rapolu } 23375de35c9bSChiranjeevi Rapolu 23381e583b56SSakari Ailus /* Verify chip ID */ 23391e583b56SSakari Ailus static int ov5670_identify_module(struct ov5670 *ov5670) 23401e583b56SSakari Ailus { 23411e583b56SSakari Ailus struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 23421e583b56SSakari Ailus int ret; 23431e583b56SSakari Ailus u32 val; 23441e583b56SSakari Ailus 23451e583b56SSakari Ailus if (ov5670->identified) 23461e583b56SSakari Ailus return 0; 23471e583b56SSakari Ailus 23481e583b56SSakari Ailus ret = ov5670_read_reg(ov5670, OV5670_REG_CHIP_ID, 23491e583b56SSakari Ailus OV5670_REG_VALUE_24BIT, &val); 23501e583b56SSakari Ailus if (ret) 23511e583b56SSakari Ailus return ret; 23521e583b56SSakari Ailus 23531e583b56SSakari Ailus if (val != OV5670_CHIP_ID) { 23541e583b56SSakari Ailus dev_err(&client->dev, "chip id mismatch: %x!=%x\n", 23551e583b56SSakari Ailus OV5670_CHIP_ID, val); 23561e583b56SSakari Ailus return -ENXIO; 23571e583b56SSakari Ailus } 23581e583b56SSakari Ailus 23591e583b56SSakari Ailus ov5670->identified = true; 23601e583b56SSakari Ailus 23611e583b56SSakari Ailus return 0; 23621e583b56SSakari Ailus } 23631e583b56SSakari Ailus 23645de35c9bSChiranjeevi Rapolu /* Prepare streaming by writing default values and customized values */ 23655de35c9bSChiranjeevi Rapolu static int ov5670_start_streaming(struct ov5670 *ov5670) 23665de35c9bSChiranjeevi Rapolu { 23675de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 23685de35c9bSChiranjeevi Rapolu const struct ov5670_reg_list *reg_list; 23695de35c9bSChiranjeevi Rapolu int link_freq_index; 23705de35c9bSChiranjeevi Rapolu int ret; 23715de35c9bSChiranjeevi Rapolu 23721e583b56SSakari Ailus ret = ov5670_identify_module(ov5670); 23731e583b56SSakari Ailus if (ret) 23741e583b56SSakari Ailus return ret; 23751e583b56SSakari Ailus 23765de35c9bSChiranjeevi Rapolu /* Get out of from software reset */ 23775de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_SOFTWARE_RST, 23785de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_08BIT, OV5670_SOFTWARE_RST); 23795de35c9bSChiranjeevi Rapolu if (ret) { 23805de35c9bSChiranjeevi Rapolu dev_err(&client->dev, "%s failed to set powerup registers\n", 23815de35c9bSChiranjeevi Rapolu __func__); 23825de35c9bSChiranjeevi Rapolu return ret; 23835de35c9bSChiranjeevi Rapolu } 23845de35c9bSChiranjeevi Rapolu 23855de35c9bSChiranjeevi Rapolu /* Setup PLL */ 23865de35c9bSChiranjeevi Rapolu link_freq_index = ov5670->cur_mode->link_freq_index; 23875de35c9bSChiranjeevi Rapolu reg_list = &link_freq_configs[link_freq_index].reg_list; 23885de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg_list(ov5670, reg_list); 23895de35c9bSChiranjeevi Rapolu if (ret) { 23905de35c9bSChiranjeevi Rapolu dev_err(&client->dev, "%s failed to set plls\n", __func__); 23915de35c9bSChiranjeevi Rapolu return ret; 23925de35c9bSChiranjeevi Rapolu } 23935de35c9bSChiranjeevi Rapolu 23945de35c9bSChiranjeevi Rapolu /* Apply default values of current mode */ 23955de35c9bSChiranjeevi Rapolu reg_list = &ov5670->cur_mode->reg_list; 23965de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg_list(ov5670, reg_list); 23975de35c9bSChiranjeevi Rapolu if (ret) { 23985de35c9bSChiranjeevi Rapolu dev_err(&client->dev, "%s failed to set mode\n", __func__); 23995de35c9bSChiranjeevi Rapolu return ret; 24005de35c9bSChiranjeevi Rapolu } 24015de35c9bSChiranjeevi Rapolu 24025de35c9bSChiranjeevi Rapolu ret = __v4l2_ctrl_handler_setup(ov5670->sd.ctrl_handler); 24035de35c9bSChiranjeevi Rapolu if (ret) 24045de35c9bSChiranjeevi Rapolu return ret; 24055de35c9bSChiranjeevi Rapolu 24065de35c9bSChiranjeevi Rapolu /* Write stream on list */ 24075de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_MODE_SELECT, 24085de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_08BIT, OV5670_MODE_STREAMING); 24095de35c9bSChiranjeevi Rapolu if (ret) { 24105de35c9bSChiranjeevi Rapolu dev_err(&client->dev, "%s failed to set stream\n", __func__); 24115de35c9bSChiranjeevi Rapolu return ret; 24125de35c9bSChiranjeevi Rapolu } 24135de35c9bSChiranjeevi Rapolu 24145de35c9bSChiranjeevi Rapolu return 0; 24155de35c9bSChiranjeevi Rapolu } 24165de35c9bSChiranjeevi Rapolu 24175de35c9bSChiranjeevi Rapolu static int ov5670_stop_streaming(struct ov5670 *ov5670) 24185de35c9bSChiranjeevi Rapolu { 24195de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 24205de35c9bSChiranjeevi Rapolu int ret; 24215de35c9bSChiranjeevi Rapolu 24225de35c9bSChiranjeevi Rapolu ret = ov5670_write_reg(ov5670, OV5670_REG_MODE_SELECT, 24235de35c9bSChiranjeevi Rapolu OV5670_REG_VALUE_08BIT, OV5670_MODE_STANDBY); 24245de35c9bSChiranjeevi Rapolu if (ret) 24255de35c9bSChiranjeevi Rapolu dev_err(&client->dev, "%s failed to set stream\n", __func__); 24265de35c9bSChiranjeevi Rapolu 24275de35c9bSChiranjeevi Rapolu /* Return success even if it was an error, as there is nothing the 24285de35c9bSChiranjeevi Rapolu * caller can do about it. 24295de35c9bSChiranjeevi Rapolu */ 24305de35c9bSChiranjeevi Rapolu return 0; 24315de35c9bSChiranjeevi Rapolu } 24325de35c9bSChiranjeevi Rapolu 24335de35c9bSChiranjeevi Rapolu static int ov5670_set_stream(struct v4l2_subdev *sd, int enable) 24345de35c9bSChiranjeevi Rapolu { 24355de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = to_ov5670(sd); 24365de35c9bSChiranjeevi Rapolu struct i2c_client *client = v4l2_get_subdevdata(sd); 24375de35c9bSChiranjeevi Rapolu int ret = 0; 24385de35c9bSChiranjeevi Rapolu 24395de35c9bSChiranjeevi Rapolu mutex_lock(&ov5670->mutex); 24405de35c9bSChiranjeevi Rapolu if (ov5670->streaming == enable) 24415de35c9bSChiranjeevi Rapolu goto unlock_and_return; 24425de35c9bSChiranjeevi Rapolu 24435de35c9bSChiranjeevi Rapolu if (enable) { 2444f151c230SMauro Carvalho Chehab ret = pm_runtime_resume_and_get(&client->dev); 2445f151c230SMauro Carvalho Chehab if (ret < 0) 24465de35c9bSChiranjeevi Rapolu goto unlock_and_return; 24475de35c9bSChiranjeevi Rapolu 24485de35c9bSChiranjeevi Rapolu ret = ov5670_start_streaming(ov5670); 24495de35c9bSChiranjeevi Rapolu if (ret) 24505de35c9bSChiranjeevi Rapolu goto error; 24515de35c9bSChiranjeevi Rapolu } else { 24525de35c9bSChiranjeevi Rapolu ret = ov5670_stop_streaming(ov5670); 24535de35c9bSChiranjeevi Rapolu pm_runtime_put(&client->dev); 24545de35c9bSChiranjeevi Rapolu } 24553eefbc69SChiranjeevi Rapolu ov5670->streaming = enable; 24565de35c9bSChiranjeevi Rapolu goto unlock_and_return; 24575de35c9bSChiranjeevi Rapolu 24585de35c9bSChiranjeevi Rapolu error: 24595de35c9bSChiranjeevi Rapolu pm_runtime_put(&client->dev); 24605de35c9bSChiranjeevi Rapolu 24615de35c9bSChiranjeevi Rapolu unlock_and_return: 24625de35c9bSChiranjeevi Rapolu mutex_unlock(&ov5670->mutex); 24635de35c9bSChiranjeevi Rapolu 24645de35c9bSChiranjeevi Rapolu return ret; 24655de35c9bSChiranjeevi Rapolu } 24665de35c9bSChiranjeevi Rapolu 246762ab1e32SJacopo Mondi static int __maybe_unused ov5670_runtime_resume(struct device *dev) 246862ab1e32SJacopo Mondi { 246962ab1e32SJacopo Mondi struct i2c_client *client = to_i2c_client(dev); 247062ab1e32SJacopo Mondi struct v4l2_subdev *sd = i2c_get_clientdata(client); 247162ab1e32SJacopo Mondi struct ov5670 *ov5670 = to_ov5670(sd); 247262ab1e32SJacopo Mondi unsigned long delay_us; 247362ab1e32SJacopo Mondi int ret; 247462ab1e32SJacopo Mondi 247562ab1e32SJacopo Mondi ret = clk_prepare_enable(ov5670->xvclk); 247662ab1e32SJacopo Mondi if (ret) 247762ab1e32SJacopo Mondi return ret; 247862ab1e32SJacopo Mondi 247962ab1e32SJacopo Mondi ret = regulator_bulk_enable(OV5670_NUM_SUPPLIES, ov5670->supplies); 248062ab1e32SJacopo Mondi if (ret) { 248162ab1e32SJacopo Mondi clk_disable_unprepare(ov5670->xvclk); 248262ab1e32SJacopo Mondi return ret; 248362ab1e32SJacopo Mondi } 248462ab1e32SJacopo Mondi 248562ab1e32SJacopo Mondi gpiod_set_value_cansleep(ov5670->pwdn_gpio, 0); 248662ab1e32SJacopo Mondi gpiod_set_value_cansleep(ov5670->reset_gpio, 0); 248762ab1e32SJacopo Mondi 248862ab1e32SJacopo Mondi /* 8192 * 2 clock pulses before the first SCCB transaction. */ 248962ab1e32SJacopo Mondi delay_us = DIV_ROUND_UP(8192 * 2 * 1000, 249062ab1e32SJacopo Mondi DIV_ROUND_UP(OV5670_XVCLK_FREQ, 1000)); 249162ab1e32SJacopo Mondi fsleep(delay_us); 249262ab1e32SJacopo Mondi 249362ab1e32SJacopo Mondi return 0; 249462ab1e32SJacopo Mondi } 249562ab1e32SJacopo Mondi 249662ab1e32SJacopo Mondi static int __maybe_unused ov5670_runtime_suspend(struct device *dev) 249762ab1e32SJacopo Mondi { 249862ab1e32SJacopo Mondi struct i2c_client *client = to_i2c_client(dev); 249962ab1e32SJacopo Mondi struct v4l2_subdev *sd = i2c_get_clientdata(client); 250062ab1e32SJacopo Mondi struct ov5670 *ov5670 = to_ov5670(sd); 250162ab1e32SJacopo Mondi 250262ab1e32SJacopo Mondi gpiod_set_value_cansleep(ov5670->reset_gpio, 1); 250362ab1e32SJacopo Mondi gpiod_set_value_cansleep(ov5670->pwdn_gpio, 1); 250462ab1e32SJacopo Mondi regulator_bulk_disable(OV5670_NUM_SUPPLIES, ov5670->supplies); 250562ab1e32SJacopo Mondi clk_disable_unprepare(ov5670->xvclk); 250662ab1e32SJacopo Mondi 250762ab1e32SJacopo Mondi return 0; 250862ab1e32SJacopo Mondi } 250962ab1e32SJacopo Mondi 25105de35c9bSChiranjeevi Rapolu static int __maybe_unused ov5670_suspend(struct device *dev) 25115de35c9bSChiranjeevi Rapolu { 2512bf396557SKrzysztof Kozlowski struct v4l2_subdev *sd = dev_get_drvdata(dev); 25135de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = to_ov5670(sd); 25145de35c9bSChiranjeevi Rapolu 25155de35c9bSChiranjeevi Rapolu if (ov5670->streaming) 25165de35c9bSChiranjeevi Rapolu ov5670_stop_streaming(ov5670); 25175de35c9bSChiranjeevi Rapolu 25185de35c9bSChiranjeevi Rapolu return 0; 25195de35c9bSChiranjeevi Rapolu } 25205de35c9bSChiranjeevi Rapolu 25215de35c9bSChiranjeevi Rapolu static int __maybe_unused ov5670_resume(struct device *dev) 25225de35c9bSChiranjeevi Rapolu { 2523bf396557SKrzysztof Kozlowski struct v4l2_subdev *sd = dev_get_drvdata(dev); 25245de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = to_ov5670(sd); 25255de35c9bSChiranjeevi Rapolu int ret; 25265de35c9bSChiranjeevi Rapolu 25275de35c9bSChiranjeevi Rapolu if (ov5670->streaming) { 25285de35c9bSChiranjeevi Rapolu ret = ov5670_start_streaming(ov5670); 25295de35c9bSChiranjeevi Rapolu if (ret) { 25305de35c9bSChiranjeevi Rapolu ov5670_stop_streaming(ov5670); 25315de35c9bSChiranjeevi Rapolu return ret; 25325de35c9bSChiranjeevi Rapolu } 25335de35c9bSChiranjeevi Rapolu } 25345de35c9bSChiranjeevi Rapolu 25355de35c9bSChiranjeevi Rapolu return 0; 25365de35c9bSChiranjeevi Rapolu } 25375de35c9bSChiranjeevi Rapolu 2538dce6dd44SRicardo Ribalda static const struct v4l2_subdev_core_ops ov5670_core_ops = { 2539dce6dd44SRicardo Ribalda .log_status = v4l2_ctrl_subdev_log_status, 2540dce6dd44SRicardo Ribalda .subscribe_event = v4l2_ctrl_subdev_subscribe_event, 2541dce6dd44SRicardo Ribalda .unsubscribe_event = v4l2_event_subdev_unsubscribe, 2542dce6dd44SRicardo Ribalda }; 2543dce6dd44SRicardo Ribalda 25442eadd98dSJean-Michel Hautbois static const struct v4l2_rect * 25452eadd98dSJean-Michel Hautbois __ov5670_get_pad_crop(struct ov5670 *sensor, struct v4l2_subdev_state *state, 25462eadd98dSJean-Michel Hautbois unsigned int pad, enum v4l2_subdev_format_whence which) 25472eadd98dSJean-Michel Hautbois { 25482eadd98dSJean-Michel Hautbois const struct ov5670_mode *mode = sensor->cur_mode; 25492eadd98dSJean-Michel Hautbois 25502eadd98dSJean-Michel Hautbois switch (which) { 25512eadd98dSJean-Michel Hautbois case V4L2_SUBDEV_FORMAT_TRY: 25522eadd98dSJean-Michel Hautbois return v4l2_subdev_get_try_crop(&sensor->sd, state, pad); 25532eadd98dSJean-Michel Hautbois case V4L2_SUBDEV_FORMAT_ACTIVE: 25542eadd98dSJean-Michel Hautbois return mode->analog_crop; 25552eadd98dSJean-Michel Hautbois } 25562eadd98dSJean-Michel Hautbois 25572eadd98dSJean-Michel Hautbois return NULL; 25582eadd98dSJean-Michel Hautbois } 25592eadd98dSJean-Michel Hautbois 25602eadd98dSJean-Michel Hautbois static int ov5670_get_selection(struct v4l2_subdev *subdev, 25612eadd98dSJean-Michel Hautbois struct v4l2_subdev_state *state, 25622eadd98dSJean-Michel Hautbois struct v4l2_subdev_selection *sel) 25632eadd98dSJean-Michel Hautbois { 25642eadd98dSJean-Michel Hautbois struct ov5670 *sensor = to_ov5670(subdev); 25652eadd98dSJean-Michel Hautbois 25662eadd98dSJean-Michel Hautbois switch (sel->target) { 25672eadd98dSJean-Michel Hautbois case V4L2_SEL_TGT_CROP: 25682eadd98dSJean-Michel Hautbois mutex_lock(&sensor->mutex); 25692eadd98dSJean-Michel Hautbois sel->r = *__ov5670_get_pad_crop(sensor, state, sel->pad, 25702eadd98dSJean-Michel Hautbois sel->which); 25712eadd98dSJean-Michel Hautbois mutex_unlock(&sensor->mutex); 25722eadd98dSJean-Michel Hautbois break; 25732eadd98dSJean-Michel Hautbois case V4L2_SEL_TGT_NATIVE_SIZE: 25742eadd98dSJean-Michel Hautbois case V4L2_SEL_TGT_CROP_BOUNDS: 25752eadd98dSJean-Michel Hautbois sel->r.top = 0; 25762eadd98dSJean-Michel Hautbois sel->r.left = 0; 25772eadd98dSJean-Michel Hautbois sel->r.width = OV5670_NATIVE_WIDTH; 25782eadd98dSJean-Michel Hautbois sel->r.height = OV5670_NATIVE_HEIGHT; 25792eadd98dSJean-Michel Hautbois break; 25802eadd98dSJean-Michel Hautbois case V4L2_SEL_TGT_CROP_DEFAULT: 25812eadd98dSJean-Michel Hautbois sel->r = ov5670_analog_crop; 25822eadd98dSJean-Michel Hautbois break; 25832eadd98dSJean-Michel Hautbois default: 25842eadd98dSJean-Michel Hautbois return -EINVAL; 25852eadd98dSJean-Michel Hautbois } 25862eadd98dSJean-Michel Hautbois 25872eadd98dSJean-Michel Hautbois return 0; 25882eadd98dSJean-Michel Hautbois } 25892eadd98dSJean-Michel Hautbois 25905de35c9bSChiranjeevi Rapolu static const struct v4l2_subdev_video_ops ov5670_video_ops = { 25915de35c9bSChiranjeevi Rapolu .s_stream = ov5670_set_stream, 25925de35c9bSChiranjeevi Rapolu }; 25935de35c9bSChiranjeevi Rapolu 25945de35c9bSChiranjeevi Rapolu static const struct v4l2_subdev_pad_ops ov5670_pad_ops = { 2595bbc6071cSJacopo Mondi .init_cfg = ov5670_init_cfg, 25965de35c9bSChiranjeevi Rapolu .enum_mbus_code = ov5670_enum_mbus_code, 25975de35c9bSChiranjeevi Rapolu .get_fmt = ov5670_get_pad_format, 25985de35c9bSChiranjeevi Rapolu .set_fmt = ov5670_set_pad_format, 25995de35c9bSChiranjeevi Rapolu .enum_frame_size = ov5670_enum_frame_size, 26002eadd98dSJean-Michel Hautbois .get_selection = ov5670_get_selection, 26012eadd98dSJean-Michel Hautbois .set_selection = ov5670_get_selection, 26025de35c9bSChiranjeevi Rapolu }; 26035de35c9bSChiranjeevi Rapolu 26045de35c9bSChiranjeevi Rapolu static const struct v4l2_subdev_sensor_ops ov5670_sensor_ops = { 26055de35c9bSChiranjeevi Rapolu .g_skip_frames = ov5670_get_skip_frames, 26065de35c9bSChiranjeevi Rapolu }; 26075de35c9bSChiranjeevi Rapolu 26085de35c9bSChiranjeevi Rapolu static const struct v4l2_subdev_ops ov5670_subdev_ops = { 2609dce6dd44SRicardo Ribalda .core = &ov5670_core_ops, 26105de35c9bSChiranjeevi Rapolu .video = &ov5670_video_ops, 26115de35c9bSChiranjeevi Rapolu .pad = &ov5670_pad_ops, 26125de35c9bSChiranjeevi Rapolu .sensor = &ov5670_sensor_ops, 26135de35c9bSChiranjeevi Rapolu }; 26145de35c9bSChiranjeevi Rapolu 26155de35c9bSChiranjeevi Rapolu static const struct media_entity_operations ov5670_subdev_entity_ops = { 26165de35c9bSChiranjeevi Rapolu .link_validate = v4l2_subdev_link_validate, 26175de35c9bSChiranjeevi Rapolu }; 26185de35c9bSChiranjeevi Rapolu 2619cf9ab879SJacopo Mondi static int ov5670_regulators_probe(struct ov5670 *ov5670) 2620cf9ab879SJacopo Mondi { 2621cf9ab879SJacopo Mondi struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 2622cf9ab879SJacopo Mondi unsigned int i; 2623cf9ab879SJacopo Mondi 2624cf9ab879SJacopo Mondi for (i = 0; i < OV5670_NUM_SUPPLIES; i++) 2625cf9ab879SJacopo Mondi ov5670->supplies[i].supply = ov5670_supply_names[i]; 2626cf9ab879SJacopo Mondi 2627cf9ab879SJacopo Mondi return devm_regulator_bulk_get(&client->dev, OV5670_NUM_SUPPLIES, 2628cf9ab879SJacopo Mondi ov5670->supplies); 2629cf9ab879SJacopo Mondi } 2630cf9ab879SJacopo Mondi 26310a844ab7SJacopo Mondi static int ov5670_gpio_probe(struct ov5670 *ov5670) 26320a844ab7SJacopo Mondi { 26330a844ab7SJacopo Mondi struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd); 26340a844ab7SJacopo Mondi 26350a844ab7SJacopo Mondi ov5670->pwdn_gpio = devm_gpiod_get_optional(&client->dev, "powerdown", 26360a844ab7SJacopo Mondi GPIOD_OUT_LOW); 26370a844ab7SJacopo Mondi if (IS_ERR(ov5670->pwdn_gpio)) 26380a844ab7SJacopo Mondi return PTR_ERR(ov5670->pwdn_gpio); 26390a844ab7SJacopo Mondi 26400a844ab7SJacopo Mondi ov5670->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", 26410a844ab7SJacopo Mondi GPIOD_OUT_LOW); 26420a844ab7SJacopo Mondi if (IS_ERR(ov5670->reset_gpio)) 26430a844ab7SJacopo Mondi return PTR_ERR(ov5670->reset_gpio); 26440a844ab7SJacopo Mondi 26450a844ab7SJacopo Mondi return 0; 26460a844ab7SJacopo Mondi } 26470a844ab7SJacopo Mondi 26485de35c9bSChiranjeevi Rapolu static int ov5670_probe(struct i2c_client *client) 26495de35c9bSChiranjeevi Rapolu { 26505de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670; 26515de35c9bSChiranjeevi Rapolu u32 input_clk = 0; 26521e583b56SSakari Ailus bool full_power; 26535de35c9bSChiranjeevi Rapolu int ret; 26545de35c9bSChiranjeevi Rapolu 26555de35c9bSChiranjeevi Rapolu ov5670 = devm_kzalloc(&client->dev, sizeof(*ov5670), GFP_KERNEL); 2656*4ed6627bSLuca Weiss if (!ov5670) 2657*4ed6627bSLuca Weiss return -ENOMEM; 26585de35c9bSChiranjeevi Rapolu 26598004c91eSJacopo Mondi ov5670->xvclk = devm_clk_get(&client->dev, NULL); 26608004c91eSJacopo Mondi if (!IS_ERR_OR_NULL(ov5670->xvclk)) 26618004c91eSJacopo Mondi input_clk = clk_get_rate(ov5670->xvclk); 26628004c91eSJacopo Mondi else if (PTR_ERR(ov5670->xvclk) == -ENOENT) 26638004c91eSJacopo Mondi device_property_read_u32(&client->dev, "clock-frequency", 26648004c91eSJacopo Mondi &input_clk); 26658004c91eSJacopo Mondi else 26668004c91eSJacopo Mondi return dev_err_probe(&client->dev, PTR_ERR(ov5670->xvclk), 26678004c91eSJacopo Mondi "error getting clock\n"); 26688004c91eSJacopo Mondi 26698004c91eSJacopo Mondi if (input_clk != OV5670_XVCLK_FREQ) { 26708004c91eSJacopo Mondi dev_err(&client->dev, 26718004c91eSJacopo Mondi "Unsupported clock frequency %u\n", input_clk); 26728004c91eSJacopo Mondi return -EINVAL; 26738004c91eSJacopo Mondi } 26748004c91eSJacopo Mondi 26755de35c9bSChiranjeevi Rapolu /* Initialize subdev */ 26765de35c9bSChiranjeevi Rapolu v4l2_i2c_subdev_init(&ov5670->sd, client, &ov5670_subdev_ops); 26775de35c9bSChiranjeevi Rapolu 2678cf9ab879SJacopo Mondi ret = ov5670_regulators_probe(ov5670); 2679*4ed6627bSLuca Weiss if (ret) 2680*4ed6627bSLuca Weiss return dev_err_probe(&client->dev, ret, "Regulators probe failed\n"); 2681cf9ab879SJacopo Mondi 26820a844ab7SJacopo Mondi ret = ov5670_gpio_probe(ov5670); 2683*4ed6627bSLuca Weiss if (ret) 2684*4ed6627bSLuca Weiss return dev_err_probe(&client->dev, ret, "GPIO probe failed\n"); 26850a844ab7SJacopo Mondi 26861e583b56SSakari Ailus full_power = acpi_dev_state_d0(&client->dev); 26871e583b56SSakari Ailus if (full_power) { 268862ab1e32SJacopo Mondi ret = ov5670_runtime_resume(&client->dev); 2689*4ed6627bSLuca Weiss if (ret) 2690*4ed6627bSLuca Weiss return dev_err_probe(&client->dev, ret, "Power up failed\n"); 269162ab1e32SJacopo Mondi 26925de35c9bSChiranjeevi Rapolu /* Check module identity */ 26935de35c9bSChiranjeevi Rapolu ret = ov5670_identify_module(ov5670); 26945de35c9bSChiranjeevi Rapolu if (ret) { 2695*4ed6627bSLuca Weiss dev_err_probe(&client->dev, ret, "ov5670_identify_module() error\n"); 269662ab1e32SJacopo Mondi goto error_power_off; 26975de35c9bSChiranjeevi Rapolu } 26981e583b56SSakari Ailus } 26995de35c9bSChiranjeevi Rapolu 27005de35c9bSChiranjeevi Rapolu mutex_init(&ov5670->mutex); 27015de35c9bSChiranjeevi Rapolu 27025de35c9bSChiranjeevi Rapolu /* Set default mode to max resolution */ 27035de35c9bSChiranjeevi Rapolu ov5670->cur_mode = &supported_modes[0]; 27045de35c9bSChiranjeevi Rapolu 27055de35c9bSChiranjeevi Rapolu ret = ov5670_init_controls(ov5670); 27065de35c9bSChiranjeevi Rapolu if (ret) { 2707*4ed6627bSLuca Weiss dev_err_probe(&client->dev, ret, "ov5670_init_controls() error\n"); 27085de35c9bSChiranjeevi Rapolu goto error_mutex_destroy; 27095de35c9bSChiranjeevi Rapolu } 27105de35c9bSChiranjeevi Rapolu 2711dce6dd44SRicardo Ribalda ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | 2712dce6dd44SRicardo Ribalda V4L2_SUBDEV_FL_HAS_EVENTS; 27135de35c9bSChiranjeevi Rapolu ov5670->sd.entity.ops = &ov5670_subdev_entity_ops; 27145de35c9bSChiranjeevi Rapolu ov5670->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; 27155de35c9bSChiranjeevi Rapolu 27165de35c9bSChiranjeevi Rapolu /* Source pad initialization */ 27175de35c9bSChiranjeevi Rapolu ov5670->pad.flags = MEDIA_PAD_FL_SOURCE; 27185de35c9bSChiranjeevi Rapolu ret = media_entity_pads_init(&ov5670->sd.entity, 1, &ov5670->pad); 27195de35c9bSChiranjeevi Rapolu if (ret) { 2720*4ed6627bSLuca Weiss dev_err_probe(&client->dev, ret, "media_entity_pads_init() error\n"); 27215de35c9bSChiranjeevi Rapolu goto error_handler_free; 27225de35c9bSChiranjeevi Rapolu } 27235de35c9bSChiranjeevi Rapolu 27245de35c9bSChiranjeevi Rapolu ov5670->streaming = false; 27255de35c9bSChiranjeevi Rapolu 27261e583b56SSakari Ailus /* Set the device's state to active if it's in D0 state. */ 27271e583b56SSakari Ailus if (full_power) 27285de35c9bSChiranjeevi Rapolu pm_runtime_set_active(&client->dev); 27295de35c9bSChiranjeevi Rapolu pm_runtime_enable(&client->dev); 273062ab1e32SJacopo Mondi 273162ab1e32SJacopo Mondi /* Async register for subdev */ 273262ab1e32SJacopo Mondi ret = v4l2_async_register_subdev_sensor(&ov5670->sd); 273362ab1e32SJacopo Mondi if (ret < 0) { 2734*4ed6627bSLuca Weiss dev_err_probe(&client->dev, ret, "v4l2_async_register_subdev() error\n"); 273562ab1e32SJacopo Mondi goto error_pm_disable; 273662ab1e32SJacopo Mondi } 273762ab1e32SJacopo Mondi 2738d508fffbSSakari Ailus pm_runtime_idle(&client->dev); 27395de35c9bSChiranjeevi Rapolu 27405de35c9bSChiranjeevi Rapolu return 0; 27415de35c9bSChiranjeevi Rapolu 274262ab1e32SJacopo Mondi error_pm_disable: 274362ab1e32SJacopo Mondi pm_runtime_disable(&client->dev); 274462ab1e32SJacopo Mondi 27455de35c9bSChiranjeevi Rapolu media_entity_cleanup(&ov5670->sd.entity); 27465de35c9bSChiranjeevi Rapolu 27475de35c9bSChiranjeevi Rapolu error_handler_free: 27485de35c9bSChiranjeevi Rapolu v4l2_ctrl_handler_free(ov5670->sd.ctrl_handler); 27495de35c9bSChiranjeevi Rapolu 27505de35c9bSChiranjeevi Rapolu error_mutex_destroy: 27515de35c9bSChiranjeevi Rapolu mutex_destroy(&ov5670->mutex); 27525de35c9bSChiranjeevi Rapolu 275362ab1e32SJacopo Mondi error_power_off: 275462ab1e32SJacopo Mondi if (full_power) 275562ab1e32SJacopo Mondi ov5670_runtime_suspend(&client->dev); 275662ab1e32SJacopo Mondi 27575de35c9bSChiranjeevi Rapolu return ret; 27585de35c9bSChiranjeevi Rapolu } 27595de35c9bSChiranjeevi Rapolu 2760ed5c2f5fSUwe Kleine-König static void ov5670_remove(struct i2c_client *client) 27615de35c9bSChiranjeevi Rapolu { 27625de35c9bSChiranjeevi Rapolu struct v4l2_subdev *sd = i2c_get_clientdata(client); 27635de35c9bSChiranjeevi Rapolu struct ov5670 *ov5670 = to_ov5670(sd); 27645de35c9bSChiranjeevi Rapolu 27655de35c9bSChiranjeevi Rapolu v4l2_async_unregister_subdev(sd); 27665de35c9bSChiranjeevi Rapolu media_entity_cleanup(&sd->entity); 27675de35c9bSChiranjeevi Rapolu v4l2_ctrl_handler_free(sd->ctrl_handler); 27685de35c9bSChiranjeevi Rapolu mutex_destroy(&ov5670->mutex); 27695de35c9bSChiranjeevi Rapolu 27705de35c9bSChiranjeevi Rapolu pm_runtime_disable(&client->dev); 277162ab1e32SJacopo Mondi ov5670_runtime_suspend(&client->dev); 27725de35c9bSChiranjeevi Rapolu } 27735de35c9bSChiranjeevi Rapolu 27745de35c9bSChiranjeevi Rapolu static const struct dev_pm_ops ov5670_pm_ops = { 27755de35c9bSChiranjeevi Rapolu SET_SYSTEM_SLEEP_PM_OPS(ov5670_suspend, ov5670_resume) 277662ab1e32SJacopo Mondi SET_RUNTIME_PM_OPS(ov5670_runtime_suspend, ov5670_runtime_resume, NULL) 27775de35c9bSChiranjeevi Rapolu }; 27785de35c9bSChiranjeevi Rapolu 27795de35c9bSChiranjeevi Rapolu #ifdef CONFIG_ACPI 27805de35c9bSChiranjeevi Rapolu static const struct acpi_device_id ov5670_acpi_ids[] = { 27815de35c9bSChiranjeevi Rapolu { "INT3479" }, 27825de35c9bSChiranjeevi Rapolu { /* sentinel */ } 27835de35c9bSChiranjeevi Rapolu }; 27845de35c9bSChiranjeevi Rapolu 27855de35c9bSChiranjeevi Rapolu MODULE_DEVICE_TABLE(acpi, ov5670_acpi_ids); 27865de35c9bSChiranjeevi Rapolu #endif 27875de35c9bSChiranjeevi Rapolu 27885635500aSJacopo Mondi static const struct of_device_id ov5670_of_ids[] = { 27895635500aSJacopo Mondi { .compatible = "ovti,ov5670" }, 27905635500aSJacopo Mondi { /* sentinel */ } 27915635500aSJacopo Mondi }; 27925635500aSJacopo Mondi MODULE_DEVICE_TABLE(of, ov5670_of_ids); 27935635500aSJacopo Mondi 27945de35c9bSChiranjeevi Rapolu static struct i2c_driver ov5670_i2c_driver = { 27955de35c9bSChiranjeevi Rapolu .driver = { 27965de35c9bSChiranjeevi Rapolu .name = "ov5670", 27975de35c9bSChiranjeevi Rapolu .pm = &ov5670_pm_ops, 27985de35c9bSChiranjeevi Rapolu .acpi_match_table = ACPI_PTR(ov5670_acpi_ids), 27995635500aSJacopo Mondi .of_match_table = ov5670_of_ids, 28005de35c9bSChiranjeevi Rapolu }, 28015de35c9bSChiranjeevi Rapolu .probe_new = ov5670_probe, 28025de35c9bSChiranjeevi Rapolu .remove = ov5670_remove, 28031e583b56SSakari Ailus .flags = I2C_DRV_ACPI_WAIVE_D0_PROBE, 28045de35c9bSChiranjeevi Rapolu }; 28055de35c9bSChiranjeevi Rapolu 28065de35c9bSChiranjeevi Rapolu module_i2c_driver(ov5670_i2c_driver); 28075de35c9bSChiranjeevi Rapolu 28085de35c9bSChiranjeevi Rapolu MODULE_AUTHOR("Rapolu, Chiranjeevi <chiranjeevi.rapolu@intel.com>"); 28095fcec420SSakari Ailus MODULE_AUTHOR("Yang, Hyungwoo"); 28105de35c9bSChiranjeevi Rapolu MODULE_DESCRIPTION("Omnivision ov5670 sensor driver"); 28115de35c9bSChiranjeevi Rapolu MODULE_LICENSE("GPL v2"); 2812