aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.10/950-0490-media-i2c-imx477-Replace-existing-1012x760-mode.patch
blob: 512cd6ae54dc2254af9816d79f9d25039ff546a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
From f90f60490c5f5f944077a42b2394c0b51c393ce1 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Thu, 18 Feb 2021 15:23:11 +0000
Subject: [PATCH] media: i2c: imx477: Replace existing 1012x760 mode

The existing 1012x760 120 fps mode has significant IQ problem using
the internal sensor scaler. Replace this mode with a 1332x990 120 fps
mode instead. This new mode has a smaller field of view, but does not
suffer from the bad IQ of the original mode.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 drivers/media/i2c/imx477.c | 97 ++++++++++++++++++++------------------
 1 file changed, 50 insertions(+), 47 deletions(-)

--- a/drivers/media/i2c/imx477.c
+++ b/drivers/media/i2c/imx477.c
@@ -770,7 +770,7 @@ static const struct imx477_reg mode_2028
 };
 
 /* 4x4 binned. 120fps */
-static const struct imx477_reg mode_1012x760_regs[] = {
+static const struct imx477_reg mode_1332x990_regs[] = {
 	{0x420b, 0x01},
 	{0x990c, 0x00},
 	{0x990d, 0x08},
@@ -786,28 +786,31 @@ static const struct imx477_reg mode_1012
 	{0x0112, 0x0a},
 	{0x0113, 0x0a},
 	{0x0114, 0x01},
-	{0x0342, 0x14},
-	{0x0343, 0x60},
+	{0x0342, 0x1a},
+	{0x0343, 0x08},
+	{0x0340, 0x04},
+	{0x0341, 0x1a},
 	{0x0344, 0x00},
 	{0x0345, 0x00},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
+	{0x0346, 0x02},
+	{0x0347, 0x10},
 	{0x0348, 0x0f},
-	{0x0349, 0xd3},
-	{0x034a, 0x0b},
-	{0x034b, 0xdf},
+	{0x0349, 0xd7},
+	{0x034a, 0x09},
+	{0x034b, 0xcf},
 	{0x00e3, 0x00},
 	{0x00e4, 0x00},
 	{0x00fc, 0x0a},
 	{0x00fd, 0x0a},
 	{0x00fe, 0x0a},
 	{0x00ff, 0x0a},
+	{0xe013, 0x00},
 	{0x0220, 0x00},
 	{0x0221, 0x11},
 	{0x0381, 0x01},
 	{0x0383, 0x01},
 	{0x0385, 0x01},
-	{0x0387, 0x03},
+	{0x0387, 0x01},
 	{0x0900, 0x01},
 	{0x0901, 0x22},
 	{0x0902, 0x02},
@@ -831,29 +834,29 @@ static const struct imx477_reg mode_1012
 	{0x936d, 0x5f},
 	{0x9304, 0x03},
 	{0x9305, 0x80},
-	{0x9e9a, 0x3f},
-	{0x9e9b, 0x3f},
-	{0x9e9c, 0x3f},
-	{0x9e9d, 0x27},
-	{0x9e9e, 0x27},
-	{0x9e9f, 0x27},
+	{0x9e9a, 0x2f},
+	{0x9e9b, 0x2f},
+	{0x9e9c, 0x2f},
+	{0x9e9d, 0x00},
+	{0x9e9e, 0x00},
+	{0x9e9f, 0x00},
 	{0xa2a9, 0x27},
 	{0xa2b7, 0x03},
-	{0x0401, 0x01},
+	{0x0401, 0x00},
 	{0x0404, 0x00},
-	{0x0405, 0x20},
-	{0x0408, 0x00},
-	{0x0409, 0x00},
+	{0x0405, 0x10},
+	{0x0408, 0x01},
+	{0x0409, 0x5c},
 	{0x040a, 0x00},
 	{0x040b, 0x00},
-	{0x040c, 0x07},
-	{0x040d, 0xea},
-	{0x040e, 0x02},
-	{0x040f, 0xf8},
-	{0x034c, 0x03},
-	{0x034d, 0xf4},
-	{0x034e, 0x02},
-	{0x034f, 0xf8},
+	{0x040c, 0x05},
+	{0x040d, 0x34},
+	{0x040e, 0x03},
+	{0x040f, 0xde},
+	{0x034c, 0x05},
+	{0x034d, 0x34},
+	{0x034e, 0x03},
+	{0x034f, 0xde},
 	{0x0301, 0x05},
 	{0x0303, 0x02},
 	{0x0305, 0x02},
@@ -870,21 +873,21 @@ static const struct imx477_reg mode_1012
 	{0x0822, 0x00},
 	{0x0823, 0x00},
 	{0x080a, 0x00},
-	{0x080b, 0x6f},
+	{0x080b, 0x7f},
 	{0x080c, 0x00},
-	{0x080d, 0x3f},
+	{0x080d, 0x4f},
 	{0x080e, 0x00},
-	{0x080f, 0xff},
+	{0x080f, 0x77},
 	{0x0810, 0x00},
-	{0x0811, 0x4f},
+	{0x0811, 0x5f},
 	{0x0812, 0x00},
-	{0x0813, 0x47},
+	{0x0813, 0x57},
 	{0x0814, 0x00},
-	{0x0815, 0x37},
-	{0x0816, 0x00},
-	{0x0817, 0xe7},
+	{0x0815, 0x4f},
+	{0x0816, 0x01},
+	{0x0817, 0x27},
 	{0x0818, 0x00},
-	{0x0819, 0x2f},
+	{0x0819, 0x3f},
 	{0xe04c, 0x00},
 	{0xe04d, 0x5f},
 	{0xe04e, 0x00},
@@ -893,7 +896,7 @@ static const struct imx477_reg mode_1012
 	{0x3e37, 0x00},
 	{0x3f50, 0x00},
 	{0x3f56, 0x00},
-	{0x3f57, 0x96},
+	{0x3f57, 0xbf},
 };
 
 /* Mode configs */
@@ -974,9 +977,9 @@ static const struct imx477_mode supporte
 
 static const struct imx477_mode supported_modes_10bit[] = {
 	{
-		/* 720P 120fps. 4x4 binned */
-		.width = 1012,
-		.height = 760,
+		/* 120fps. 2x2 binned and cropped */
+		.width = 1332,
+		.height = 990,
 		.line_length_pix = 0x1460,
 		.crop = {
 			/*
@@ -987,10 +990,10 @@ static const struct imx477_mode supporte
 			 * rectangle once the driver is expanded to represent
 			 * its processing blocks with multiple subdevs.
 			 */
-			.left = IMX477_PIXEL_ARRAY_LEFT + 4,
-			.top = IMX477_PIXEL_ARRAY_TOP,
-			.width = 4052,
-			.height = 3040,
+			.left = IMX477_PIXEL_ARRAY_LEFT + 696,
+			.top = IMX477_PIXEL_ARRAY_TOP + 528,
+			.width = 2664,
+			.height = 1980,
 		},
 		.timeperframe_min = {
 			.numerator = 100,
@@ -998,11 +1001,11 @@ static const struct imx477_mode supporte
 		},
 		.timeperframe_default = {
 			.numerator = 100,
-			.denominator = 60000
+			.denominator = 12000
 		},
 		.reg_list = {
-			.num_of_regs = ARRAY_SIZE(mode_1012x760_regs),
-			.regs = mode_1012x760_regs,
+			.num_of_regs = ARRAY_SIZE(mode_1332x990_regs),
+			.regs = mode_1332x990_regs,
 		}
 	}
 };