drivers/mipi: Add support for KD_KD110N11_51IE panel
[coreboot2.git] / src / soc / mediatek / mt8196 / mt6363.c
blobe41ce0ea4f33d064ac7f216ef978aa24fc9c3d1b
1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
3 /*
4 * These values are used by MediaTek internally.
5 * We can find these registers in "MT6363TP_PMIC_Design_Notice_for_MT8196G_V0.2".
6 * The setting values are provided by MeidaTek designers.
7 */
9 #include <console/console.h>
10 #include <soc/mt6363.h>
12 static const struct pmic_setting init_setting[] = {
13 {0x16, 0xA, 0xA},
14 {0x19, 0x1F, 0x1F},
15 {0x21, 0x1, 0x1},
16 {0x22, 0x1, 0x1},
17 {0x47, 0x0, 0xFF},
18 {0x4A, 0x0, 0x80},
19 {0x55, 0x5, 0x5},
20 {0x8E, 0x60, 0xFF},
21 {0x91, 0xC0, 0xFF},
22 {0xAD, 0x0, 0x38},
23 {0x10F, 0x10, 0x10},
24 {0x112, 0x4, 0x4},
25 {0x12D, 0x1, 0x1},
26 {0x139, 0x21, 0x21},
27 {0x230, 0x0, 0x1},
28 {0x413, 0x7, 0xFF},
29 {0x416, 0x12, 0xFF},
30 {0x417, 0x0, 0x7},
31 {0x90D, 0x10, 0x10},
32 {0x98A, 0x10, 0x10},
33 {0xA08, 0x1, 0x1},
34 {0xA0C, 0x78, 0x7F},
35 {0xA0E, 0x0, 0x2},
36 {0xA0F, 0x1, 0x1},
37 {0xA10, 0xE0, 0xE0},
38 {0xA14, 0x40, 0x60},
39 {0xA22, 0x80, 0x80},
40 {0xA26, 0xFF, 0xFF},
41 {0xA27, 0xFF, 0xFF},
42 {0xA28, 0xFF, 0xFF},
43 {0xA29, 0xFF, 0xFF},
44 {0xA2A, 0x1, 0x1},
45 {0xA39, 0x35, 0xFF},
46 {0xA3A, 0x1, 0xFF},
47 {0xA3B, 0x2, 0xFF},
48 {0xA3C, 0x1C, 0xFF},
49 {0xA3D, 0x20, 0xFF},
50 {0xA3E, 0x34, 0xFF},
51 {0xA3F, 0x34, 0xFF},
52 {0xA40, 0x3, 0xFF},
53 {0xA41, 0x1E, 0xFF},
54 {0xA42, 0x1C, 0xFF},
55 {0xA43, 0x2B, 0xFF},
56 {0xA44, 0x1F, 0xFF},
57 {0xA45, 0x1F, 0xFF},
58 {0xA46, 0x2, 0xFF},
59 {0xA47, 0x1F, 0xFF},
60 {0xA48, 0x22, 0xFF},
61 {0xA49, 0x22, 0xFF},
62 {0xA4A, 0x22, 0xFF},
63 {0xA4B, 0xFF, 0xFF},
64 {0xA4C, 0x21, 0xFF},
65 {0xA4D, 0x24, 0xFF},
66 {0xA4E, 0x34, 0xFF},
67 {0xA4F, 0x24, 0xFF},
68 {0xA50, 0x30, 0xFF},
69 {0xA51, 0x2A, 0xFF},
70 {0xA52, 0x2B, 0xFF},
71 {0xA53, 0x22, 0xFF},
72 {0xA54, 0x23, 0xFF},
73 {0xA55, 0xFF, 0xFF},
74 {0xA56, 0x34, 0xFF},
75 {0xA57, 0x5, 0xFF},
76 {0xA58, 0x20, 0xFF},
77 {0xA59, 0xFF, 0xFF},
78 {0xA5A, 0xFF, 0xFF},
79 {0xA5B, 0xFF, 0xFF},
80 {0xC88, 0x10, 0x10},
81 {0xC89, 0x18, 0xFE},
82 {0xC8A, 0x4, 0xFF},
83 {0xC90, 0x44, 0x7F},
84 {0xD08, 0x0, 0x1},
85 {0xDA1, 0x4, 0x7},
86 {0xE88, 0x0, 0x40},
87 {0xE89, 0x40, 0x40},
88 {0xF8C, 0x15, 0x15},
89 {0xF8D, 0x5, 0x5},
90 {0x1188, 0x0, 0x80},
91 {0x140E, 0x0, 0x40},
92 {0x1445, 0x0, 0xFF},
93 {0x1446, 0x0, 0xFF},
94 {0x1447, 0x0, 0xF},
95 {0x1487, 0x6C, 0xFF},
96 {0x1488, 0x0, 0x1},
97 {0x148A, 0x19, 0x7F},
98 {0x148B, 0x33, 0x7F},
99 {0x1507, 0x40, 0xFF},
100 {0x1508, 0x0, 0x1},
101 {0x150A, 0x5, 0x7F},
102 {0x150B, 0x19, 0x7F},
103 {0x1587, 0xA8, 0xFF},
104 {0x1588, 0x0, 0x1},
105 {0x158A, 0x5, 0x7F},
106 {0x158B, 0x19, 0x7F},
107 {0x1607, 0x40, 0xFF},
108 {0x1608, 0x0, 0x1},
109 {0x160A, 0x5, 0x7F},
110 {0x160B, 0x19, 0x7F},
111 {0x1687, 0x78, 0xFF},
112 {0x1688, 0x0, 0x1},
113 {0x168A, 0xC, 0x7F},
114 {0x168B, 0x19, 0x7F},
115 {0x1707, 0x40, 0xFF},
116 {0x1708, 0x0, 0x1},
117 {0x170A, 0xC, 0x7F},
118 {0x1787, 0x40, 0xFF},
119 {0x1788, 0x0, 0x1},
120 {0x178A, 0x5, 0x7F},
121 {0x1807, 0x40, 0xFF},
122 {0x1808, 0x0, 0x1},
123 {0x180A, 0x5, 0x7F},
124 {0x1887, 0x98, 0xFF},
125 {0x1888, 0x0, 0x1},
126 {0x188A, 0x19, 0x7F},
127 {0x188B, 0x33, 0x7F},
128 {0x1907, 0xA0, 0xFF},
129 {0x1908, 0x0, 0x1},
130 {0x190A, 0xC, 0x7F},
131 {0x190B, 0x19, 0x7F},
132 {0x198A, 0x2E, 0x2F},
133 {0x198C, 0xF8, 0xF8},
134 {0x198D, 0x32, 0x3F},
135 {0x198F, 0xC, 0xC},
136 {0x1990, 0xED, 0xFF},
137 {0x1991, 0x10, 0xFF},
138 {0x1992, 0x0, 0xF},
139 {0x1995, 0x60, 0x60},
140 {0x1996, 0x45, 0xFF},
141 {0x1997, 0x2, 0x2},
142 {0x1998, 0x10, 0x10},
143 {0x1999, 0x2D, 0x2F},
144 {0x199B, 0xF8, 0xF8},
145 {0x199C, 0x32, 0x3F},
146 {0x199E, 0xC, 0xC},
147 {0x199F, 0xED, 0xFF},
148 {0x19A0, 0x0, 0xFF},
149 {0x19A4, 0x60, 0x60},
150 {0x19A5, 0x45, 0xFF},
151 {0x19A6, 0x2, 0x2},
152 {0x19AC, 0x85, 0x87},
153 {0x19AF, 0x0, 0x1},
154 {0x19B4, 0x3, 0x87},
155 {0x19B7, 0x0, 0x1},
156 {0x1A08, 0x10, 0x10},
157 {0x1A09, 0x2D, 0x2F},
158 {0x1A0B, 0xF8, 0xF8},
159 {0x1A0C, 0x32, 0x3F},
160 {0x1A0E, 0xC, 0xC},
161 {0x1A0F, 0xED, 0xFF},
162 {0x1A10, 0x0, 0xFF},
163 {0x1A12, 0x10, 0x50},
164 {0x1A13, 0x2D, 0x2F},
165 {0x1A14, 0xC1, 0xC1},
166 {0x1A15, 0xFA, 0xFF},
167 {0x1A16, 0x32, 0x3F},
168 {0x1A18, 0xC, 0xC},
169 {0x1A19, 0x77, 0xFF},
170 {0x1A1A, 0xC0, 0xFF},
171 {0x1A1B, 0x2B, 0x7F},
172 {0x1A1C, 0x10, 0x50},
173 {0x1A1D, 0x2D, 0x2F},
174 {0x1A1E, 0xC1, 0xC1},
175 {0x1A1F, 0xFA, 0xFF},
176 {0x1A20, 0x32, 0x3F},
177 {0x1A22, 0xC, 0xC},
178 {0x1A23, 0x77, 0xFF},
179 {0x1A24, 0xC0, 0xFF},
180 {0x1A25, 0x2B, 0x7F},
181 {0x1A27, 0x2E, 0x2F},
182 {0x1A29, 0xF8, 0xF8},
183 {0x1A2A, 0x32, 0x3F},
184 {0x1A2C, 0xC, 0xC},
185 {0x1A2D, 0xED, 0xFF},
186 {0x1A2E, 0x10, 0xFF},
187 {0x1A2F, 0x0, 0xF},
188 {0x1A36, 0x4, 0xC},
189 {0x1A37, 0xFE, 0xFF},
190 {0x1A39, 0xCD, 0xFF},
191 {0x1A3A, 0x7F, 0xFF},
192 {0x1A3B, 0x7F, 0xFF},
193 {0x1A3C, 0x45, 0xFF},
194 {0x1A3D, 0xF0, 0xF0},
195 {0x1A45, 0x6, 0x87},
196 {0x1A4C, 0x6, 0x87},
197 {0x1A53, 0x6, 0x87},
198 {0x1A5A, 0x5, 0x87},
199 {0x1A5D, 0x0, 0x78},
200 {0x1A88, 0x10, 0x50},
201 {0x1A89, 0x2D, 0x2F},
202 {0x1A8B, 0xF8, 0xF8},
203 {0x1A8C, 0x32, 0x3F},
204 {0x1A8E, 0xC, 0xC},
205 {0x1A8F, 0xED, 0xFF},
206 {0x1A90, 0x0, 0xFF},
207 {0x1A92, 0x10, 0x50},
208 {0x1A93, 0x2D, 0x2F},
209 {0x1A94, 0x0, 0x1},
210 {0x1A95, 0xFC, 0xFF},
211 {0x1A96, 0x32, 0x3F},
212 {0x1A98, 0xC, 0xC},
213 {0x1A99, 0xED, 0xFF},
214 {0x1A9A, 0x0, 0xFF},
215 {0x1A9B, 0x0, 0xF},
216 {0x1A9C, 0x10, 0x10},
217 {0x1A9D, 0x2D, 0x2F},
218 {0x1A9E, 0xC1, 0xC1},
219 {0x1A9F, 0xFA, 0xFF},
220 {0x1AA0, 0x32, 0x3F},
221 {0x1AA2, 0xC, 0xC},
222 {0x1AA3, 0x77, 0xFF},
223 {0x1AA4, 0xC0, 0xFF},
224 {0x1AA5, 0x2B, 0x7F},
225 {0x1AA6, 0x10, 0x10},
226 {0x1AA7, 0x2D, 0x2F},
227 {0x1AA8, 0xC1, 0xC1},
228 {0x1AA9, 0xFA, 0xFF},
229 {0x1AAA, 0x32, 0x3F},
230 {0x1AAC, 0xC, 0xC},
231 {0x1AAD, 0x77, 0xFF},
232 {0x1AAE, 0xC0, 0xFF},
233 {0x1AAF, 0x2B, 0x7F},
234 {0x1AB7, 0xFC, 0xFE},
235 {0x1AB9, 0xCD, 0xFF},
236 {0x1ABA, 0xCD, 0xFF},
237 {0x1ABB, 0x7F, 0xFF},
238 {0x1ABC, 0x7F, 0xFF},
239 {0x1ABD, 0xF0, 0xF0},
240 {0x1ABE, 0x0, 0x20},
241 {0x1AC5, 0x6, 0x87},
242 {0x1ACC, 0x6, 0x87},
243 {0x1AD3, 0x6, 0x87},
244 {0x1ADA, 0x6, 0x87},
245 {0x1ADD, 0x10, 0x78},
246 {0x1B0D, 0xF, 0xF},
247 {0x1B0E, 0x1, 0x1},
248 {0x1B11, 0xFF, 0xFF},
249 {0x1B14, 0xFF, 0xFF},
250 {0x1B17, 0xFF, 0xFF},
251 {0x1B1A, 0x1, 0x1},
252 {0x1B33, 0x8, 0x8},
253 {0x1B88, 0x10, 0x10},
254 {0x1B89, 0x0, 0x80},
255 {0x1B96, 0x10, 0x10},
256 {0x1B97, 0x0, 0x80},
257 {0x1BA4, 0x10, 0x10},
258 {0x1BA5, 0x0, 0x80},
259 {0x1BB2, 0x10, 0x10},
260 {0x1BB3, 0x0, 0x80},
261 {0x1BC0, 0x10, 0x10},
262 {0x1BC1, 0x0, 0x80},
263 {0x1BCE, 0x10, 0x10},
264 {0x1BCF, 0x0, 0x80},
265 {0x1C08, 0x10, 0x10},
266 {0x1C09, 0x0, 0x80},
267 {0x1C0E, 0x40, 0x40},
268 {0x1C16, 0x10, 0x10},
269 {0x1C17, 0x0, 0x80},
270 {0x1C1C, 0x40, 0x40},
271 {0x1C24, 0x10, 0x10},
272 {0x1C25, 0x0, 0x80},
273 {0x1C32, 0x10, 0x10},
274 {0x1C33, 0x0, 0x80},
275 {0x1C40, 0x10, 0x10},
276 {0x1C41, 0x0, 0x80},
277 {0x1C4E, 0x10, 0x10},
278 {0x1C4F, 0x0, 0x80},
279 {0x1C88, 0x10, 0x10},
280 {0x1C89, 0x0, 0x80},
281 {0x1C96, 0x10, 0x10},
282 {0x1C97, 0x0, 0x80},
283 {0x1CA4, 0x10, 0x10},
284 {0x1CA5, 0x0, 0x80},
285 {0x1CB2, 0x10, 0x10},
286 {0x1CB3, 0x0, 0x80},
287 {0x1CC0, 0x10, 0x10},
288 {0x1CC1, 0x0, 0x80},
289 {0x1D08, 0x10, 0x10},
290 {0x1D09, 0x0, 0x80},
291 {0x1D1E, 0x10, 0x10},
292 {0x1D1F, 0x0, 0x80},
293 {0x1D23, 0x20, 0x7F},
294 {0x1D27, 0xC, 0x7F},
295 {0x1D28, 0x19, 0x7F},
296 {0x1D88, 0x10, 0x10},
297 {0x1D89, 0x0, 0x80},
298 {0x1D8D, 0x18, 0x7F},
299 {0x1D91, 0x5, 0x7F},
300 {0x1D92, 0x19, 0x7F},
301 {0x1DA3, 0x10, 0x10},
302 {0x1DA4, 0x0, 0x80},
303 {0x1DA8, 0x4C, 0x7F},
304 {0x1DAC, 0x5, 0x7F},
305 {0x1DAD, 0x19, 0x7F},
306 {0x1DB8, 0x14, 0x1C},
307 {0x1DB9, 0xF, 0xF},
308 {0x1DBA, 0xC0, 0xFF},
309 {0x1DBC, 0x60, 0xFF},
310 {0x1E08, 0x10, 0x10},
311 {0x1E09, 0x0, 0x80},
312 {0x1E0D, 0x7F, 0x7F},
313 {0x1E11, 0xF, 0x7F},
314 {0x1E12, 0x14, 0x7F},
315 {0x1E1E, 0x10, 0x10},
316 {0x1E1F, 0x0, 0x80},
317 {0x1E27, 0xF, 0x7F},
318 {0x1E28, 0x14, 0x7F},
319 {0x1E88, 0x10, 0x10},
320 {0x1E89, 0x0, 0x80},
321 {0x1E8D, 0x7F, 0x7F},
322 {0x1E91, 0x5, 0x7F},
323 {0x1E92, 0x19, 0x7F},
324 {0x1E9E, 0x10, 0x10},
325 {0x1E9F, 0x0, 0x80},
326 {0x1EA3, 0x58, 0x7F},
327 {0x1EA7, 0xC, 0x7F},
328 {0x1EA8, 0xC, 0x7F},
329 {0x1F16, 0x2, 0x3},
330 {0x1F17, 0x0, 0xF},
331 {0x1F1B, 0x2, 0xF},
332 {0x1F1E, 0x2, 0x3},
333 {0x1F2A, 0x2, 0x3},
334 {0x1F2E, 0x2, 0x3},
335 {0x1F8A, 0x8, 0xC},
336 {0x1F8C, 0x4, 0x6},
337 {0x1F8E, 0x4, 0x6},
338 {0x1F90, 0x4, 0x6},
339 {0x1F94, 0x2, 0x3},
340 {0x1F98, 0x1, 0x3},
341 {0x1F9C, 0x1, 0x3},
342 {0x1FA0, 0x2, 0x3},
343 {0x1FA4, 0x8, 0xC},
344 {0x1FAB, 0x8, 0xC},
345 {0x1FAD, 0x4, 0x6},
346 {0x1FB0, 0x0, 0x10},
347 {0x2207, 0xE0, 0xE0},
348 {0x2208, 0xE0, 0xE0},
349 {0x2209, 0xE0, 0xE0},
350 {0x220A, 0xE0, 0xE0},
351 {0x2214, 0xF0, 0xF0},
352 {0x2216, 0x0, 0x7},
354 /* Add UVLO 2.0 setting. also need to modify dts setting for main pmic */
355 {0xA5E, 0x2, 0x2},
356 {0xA89, 0x4, 0xF},
357 {0xA8A, 0x4, 0xF},
358 {0xA95, 0x40, 0x40},
360 * 1. Set VS1_VOTER_VOSEL = 1.8875V
361 * 2. Set VS1_VOTER_EN = 0x8 (bit3 for VS1 users)
363 {0x18A0, 0x97, 0xFF},
364 {0x189A, 0x8, 0xFF},
366 * 1. Set VS2_VOTER_VOSEL = 1.275V
367 * 2. Set VS2_VOTER_EN = 0x48 (bit6/3 for VS2 users)
369 {0x14A0, 0x66, 0xFF},
370 {0x149A, 0x48, 0xFF},
372 * 1. Set VS3_VOTER_VOSEL = 0.975V
373 * 2. Set VS3_VOTER_EN = 0x8 (bit3 for VS3 users)
375 {0x1920, 0x9C, 0xFF},
376 {0x191A, 0x8, 0xFF},
379 void pmic_init_setting(void)
381 for (int i = 0; i < ARRAY_SIZE(init_setting); i++)
382 mt6363_write_field(init_setting[i].addr, init_setting[i].val,
383 init_setting[i].mask, 0);
386 * TODO: Disable unused modem power in a separate function and
387 * call that function from mainboard folder.
389 printk(BIOS_INFO, "%s done\n", __func__);