3ad377dfbee9a1287465eb498f05052ca716f727
[openwrt/staging/adrian.git] /
1 From d8b1f6de10d7bd64d73b1c3099ad5e69e6fd7d9b Mon Sep 17 00:00:00 2001
2 From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
3 Date: Tue, 10 Mar 2020 14:17:09 +0100
4 Subject: [PATCH] media: i2c: imx219: Add support for cropped 640x480
5 resolution
6
7 Commit 25130b8ad409d5532f3763bcf891af74f550a70d upstream.
8
9 This patch adds mode table entry for capturing cropped 640x480 resolution
10
11 Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
12 Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
14 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
15 ---
16 drivers/media/i2c/imx219.c | 70 +++++++++++++++++++++++++++++++++++++-
17 1 file changed, 69 insertions(+), 1 deletion(-)
18
19 --- a/drivers/media/i2c/imx219.c
20 +++ b/drivers/media/i2c/imx219.c
21 @@ -54,6 +54,7 @@
22 #define IMX219_VTS_15FPS 0x0dc6
23 #define IMX219_VTS_30FPS_1080P 0x06e3
24 #define IMX219_VTS_30FPS_BINNED 0x06e3
25 +#define IMX219_VTS_30FPS_640x480 0x06e3
26 #define IMX219_VTS_MAX 0xffff
27
28 #define IMX219_VBLANK_MIN 4
29 @@ -138,7 +139,7 @@ struct imx219_mode {
30 /*
31 * Register sets lifted off the i2C interface from the Raspberry Pi firmware
32 * driver.
33 - * 3280x2464 = mode 2, 1920x1080 = mode 1, and 1640x1232 = mode 4.
34 + * 3280x2464 = mode 2, 1920x1080 = mode 1, 1640x1232 = mode 4, 640x480 = mode 7.
35 */
36 static const struct imx219_reg mode_3280x2464_regs[] = {
37 {0x0100, 0x00},
38 @@ -313,6 +314,63 @@ static const struct imx219_reg mode_1640
39 {0x0163, 0x78},
40 };
41
42 +static const struct imx219_reg mode_640_480_regs[] = {
43 + {0x0100, 0x00},
44 + {0x30eb, 0x05},
45 + {0x30eb, 0x0c},
46 + {0x300a, 0xff},
47 + {0x300b, 0xff},
48 + {0x30eb, 0x05},
49 + {0x30eb, 0x09},
50 + {0x0114, 0x01},
51 + {0x0128, 0x00},
52 + {0x012a, 0x18},
53 + {0x012b, 0x00},
54 + {0x0162, 0x0d},
55 + {0x0163, 0x78},
56 + {0x0164, 0x03},
57 + {0x0165, 0xe8},
58 + {0x0166, 0x08},
59 + {0x0167, 0xe7},
60 + {0x0168, 0x02},
61 + {0x0169, 0xf0},
62 + {0x016a, 0x06},
63 + {0x016b, 0xaf},
64 + {0x016c, 0x02},
65 + {0x016d, 0x80},
66 + {0x016e, 0x01},
67 + {0x016f, 0xe0},
68 + {0x0170, 0x01},
69 + {0x0171, 0x01},
70 + {0x0174, 0x03},
71 + {0x0175, 0x03},
72 + {0x0301, 0x05},
73 + {0x0303, 0x01},
74 + {0x0304, 0x03},
75 + {0x0305, 0x03},
76 + {0x0306, 0x00},
77 + {0x0307, 0x39},
78 + {0x030b, 0x01},
79 + {0x030c, 0x00},
80 + {0x030d, 0x72},
81 + {0x0624, 0x06},
82 + {0x0625, 0x68},
83 + {0x0626, 0x04},
84 + {0x0627, 0xd0},
85 + {0x455e, 0x00},
86 + {0x471e, 0x4b},
87 + {0x4767, 0x0f},
88 + {0x4750, 0x14},
89 + {0x4540, 0x00},
90 + {0x47b4, 0x14},
91 + {0x4713, 0x30},
92 + {0x478b, 0x10},
93 + {0x478f, 0x10},
94 + {0x4793, 0x10},
95 + {0x4797, 0x0e},
96 + {0x479b, 0x0e},
97 +};
98 +
99 static const struct imx219_reg raw8_framefmt_regs[] = {
100 {0x018c, 0x08},
101 {0x018d, 0x08},
102 @@ -431,6 +489,16 @@ static const struct imx219_mode supporte
103 .regs = mode_1640_1232_regs,
104 },
105 },
106 + {
107 + /* 640x480 30fps mode */
108 + .width = 640,
109 + .height = 480,
110 + .vts_def = IMX219_VTS_30FPS_640x480,
111 + .reg_list = {
112 + .num_of_regs = ARRAY_SIZE(mode_640_480_regs),
113 + .regs = mode_640_480_regs,
114 + },
115 + },
116 };
117
118 struct imx219 {