blob: d24ff532ac317042ab96ad97d174ecdfcb2bfad2 [file] [log] [blame]
Sachin Bhayareeeb88892018-01-02 16:36:01 +05301/*
2 * Copyright (c) 2014-2016, 2018, The Linux Foundation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/debugfs.h>
15#include <linux/time.h>
16#include <linux/seq_file.h>
17
18#include "mdss_mdp.h"
19#include "mdss_panel.h"
20#include "mdss_debug.h"
21#include "mdss_mdp_debug.h"
22
23#define BUF_DUMP_LAST_N 10
24
25static struct debug_bus dbg_bus_8996[] = {
26
27 /*
28 * sspp0 - 0x188
29 * sspp1 - 0x298
30 * dspp - 0x348
31 * periph - 0x418
32 */
33
34 /* Unpack 0 sspp 0*/
35 { 0x188, 50, 2 },
36 { 0x188, 60, 2 },
37 { 0x188, 54, 2 },
38 { 0x188, 64, 2 },
39 { 0x188, 70, 2 },
40 { 0x188, 85, 2 },
41 /* Upack 0 sspp 1*/
42 { 0x298, 50, 2 },
43 { 0x298, 60, 2 },
44 { 0x298, 54, 2 },
45 { 0x298, 64, 2 },
46 { 0x298, 70, 2 },
47 { 0x298, 85, 2 },
48 /* scheduler */
49 { 0x348, 130, 0 },
50 { 0x348, 130, 1 },
51 { 0x348, 130, 2 },
52 { 0x348, 130, 3 },
53 { 0x348, 130, 4 },
54 { 0x348, 130, 5 },
55
56 /* qseed */
57 {0x188, 6, 0},
58 {0x188, 6, 1},
59 {0x188, 26, 0},
60 {0x188, 26, 1},
61 {0x298, 6, 0},
62 {0x298, 6, 1},
63 {0x298, 26, 0},
64 {0x298, 26, 1},
65
66 /* scale */
67 {0x188, 16, 0},
68 {0x188, 16, 1},
69 {0x188, 36, 0},
70 {0x188, 36, 1},
71 {0x298, 16, 0},
72 {0x298, 16, 1},
73 {0x298, 36, 0},
74 {0x298, 36, 1},
75
76 /* fetch sspp0 */
77
78 /* vig 0 */
79 { 0x188, 0, 0 },
80 { 0x188, 0, 1 },
81 { 0x188, 0, 2 },
82 { 0x188, 0, 3 },
83 { 0x188, 0, 4 },
84 { 0x188, 0, 5 },
85 { 0x188, 0, 6 },
86 { 0x188, 0, 7 },
87
88 { 0x188, 1, 0 },
89 { 0x188, 1, 1 },
90 { 0x188, 1, 2 },
91 { 0x188, 1, 3 },
92 { 0x188, 1, 4 },
93 { 0x188, 1, 5 },
94 { 0x188, 1, 6 },
95 { 0x188, 1, 7 },
96
97 { 0x188, 2, 0 },
98 { 0x188, 2, 1 },
99 { 0x188, 2, 2 },
100 { 0x188, 2, 3 },
101 { 0x188, 2, 4 },
102 { 0x188, 2, 5 },
103 { 0x188, 2, 6 },
104 { 0x188, 2, 7 },
105
106 { 0x188, 4, 0 },
107 { 0x188, 4, 1 },
108 { 0x188, 4, 2 },
109 { 0x188, 4, 3 },
110 { 0x188, 4, 4 },
111 { 0x188, 4, 5 },
112 { 0x188, 4, 6 },
113 { 0x188, 4, 7 },
114
115 { 0x188, 5, 0 },
116 { 0x188, 5, 1 },
117 { 0x188, 5, 2 },
118 { 0x188, 5, 3 },
119 { 0x188, 5, 4 },
120 { 0x188, 5, 5 },
121 { 0x188, 5, 6 },
122 { 0x188, 5, 7 },
123
124 /* vig 2 */
125 { 0x188, 20, 0 },
126 { 0x188, 20, 1 },
127 { 0x188, 20, 2 },
128 { 0x188, 20, 3 },
129 { 0x188, 20, 4 },
130 { 0x188, 20, 5 },
131 { 0x188, 20, 6 },
132 { 0x188, 20, 7 },
133
134 { 0x188, 21, 0 },
135 { 0x188, 21, 1 },
136 { 0x188, 21, 2 },
137 { 0x188, 21, 3 },
138 { 0x188, 21, 4 },
139 { 0x188, 21, 5 },
140 { 0x188, 21, 6 },
141 { 0x188, 21, 7 },
142
143 { 0x188, 22, 0 },
144 { 0x188, 22, 1 },
145 { 0x188, 22, 2 },
146 { 0x188, 22, 3 },
147 { 0x188, 22, 4 },
148 { 0x188, 22, 5 },
149 { 0x188, 22, 6 },
150 { 0x188, 22, 7 },
151
152 { 0x188, 24, 0 },
153 { 0x188, 24, 1 },
154 { 0x188, 24, 2 },
155 { 0x188, 24, 3 },
156 { 0x188, 24, 4 },
157 { 0x188, 24, 5 },
158 { 0x188, 24, 6 },
159 { 0x188, 24, 7 },
160
161 { 0x188, 25, 0 },
162 { 0x188, 25, 1 },
163 { 0x188, 25, 2 },
164 { 0x188, 25, 3 },
165 { 0x188, 25, 4 },
166 { 0x188, 25, 5 },
167 { 0x188, 25, 6 },
168 { 0x188, 25, 7 },
169
170 /* rgb 0 */
171 { 0x188, 10, 0 },
172 { 0x188, 10, 1 },
173 { 0x188, 10, 2 },
174 { 0x188, 10, 3 },
175 { 0x188, 10, 4 },
176 { 0x188, 10, 5 },
177 { 0x188, 10, 6 },
178 { 0x188, 10, 7 },
179
180 { 0x188, 11, 0 },
181 { 0x188, 11, 1 },
182 { 0x188, 11, 2 },
183 { 0x188, 11, 3 },
184 { 0x188, 11, 4 },
185 { 0x188, 11, 5 },
186 { 0x188, 11, 6 },
187 { 0x188, 11, 7 },
188
189 { 0x188, 12, 0 },
190 { 0x188, 12, 1 },
191 { 0x188, 12, 2 },
192 { 0x188, 12, 3 },
193 { 0x188, 12, 4 },
194 { 0x188, 12, 5 },
195 { 0x188, 12, 6 },
196 { 0x188, 12, 7 },
197
198 { 0x188, 14, 0 },
199 { 0x188, 14, 1 },
200 { 0x188, 14, 2 },
201 { 0x188, 14, 3 },
202 { 0x188, 14, 4 },
203 { 0x188, 14, 5 },
204 { 0x188, 14, 6 },
205 { 0x188, 14, 7 },
206
207 { 0x188, 15, 0 },
208 { 0x188, 15, 1 },
209 { 0x188, 15, 2 },
210 { 0x188, 15, 3 },
211 { 0x188, 15, 4 },
212 { 0x188, 15, 5 },
213 { 0x188, 15, 6 },
214 { 0x188, 15, 7 },
215
216 /* rgb 2 */
217 { 0x188, 30, 0 },
218 { 0x188, 30, 1 },
219 { 0x188, 30, 2 },
220 { 0x188, 30, 3 },
221 { 0x188, 30, 4 },
222 { 0x188, 30, 5 },
223 { 0x188, 30, 6 },
224 { 0x188, 30, 7 },
225
226 { 0x188, 31, 0 },
227 { 0x188, 31, 1 },
228 { 0x188, 31, 2 },
229 { 0x188, 31, 3 },
230 { 0x188, 31, 4 },
231 { 0x188, 31, 5 },
232 { 0x188, 31, 6 },
233 { 0x188, 31, 7 },
234
235 { 0x188, 32, 0 },
236 { 0x188, 32, 1 },
237 { 0x188, 32, 2 },
238 { 0x188, 32, 3 },
239 { 0x188, 32, 4 },
240 { 0x188, 32, 5 },
241 { 0x188, 32, 6 },
242 { 0x188, 32, 7 },
243
244 { 0x188, 34, 0 },
245 { 0x188, 34, 1 },
246 { 0x188, 34, 2 },
247 { 0x188, 34, 3 },
248 { 0x188, 34, 4 },
249 { 0x188, 34, 5 },
250 { 0x188, 34, 6 },
251 { 0x188, 34, 7 },
252
253 { 0x188, 35, 0 },
254 { 0x188, 35, 1 },
255 { 0x188, 35, 2 },
256 { 0x188, 35, 3 },
257 { 0x188, 35, 4 },
258 { 0x188, 35, 5 },
259 { 0x188, 35, 6 },
260 { 0x188, 35, 7 },
261
262 /* dma 0 */
263 { 0x188, 40, 0 },
264 { 0x188, 40, 1 },
265 { 0x188, 40, 2 },
266 { 0x188, 40, 3 },
267 { 0x188, 40, 4 },
268 { 0x188, 40, 5 },
269 { 0x188, 40, 6 },
270 { 0x188, 40, 7 },
271
272 { 0x188, 41, 0 },
273 { 0x188, 41, 1 },
274 { 0x188, 41, 2 },
275 { 0x188, 41, 3 },
276 { 0x188, 41, 4 },
277 { 0x188, 41, 5 },
278 { 0x188, 41, 6 },
279 { 0x188, 41, 7 },
280
281 { 0x188, 42, 0 },
282 { 0x188, 42, 1 },
283 { 0x188, 42, 2 },
284 { 0x188, 42, 3 },
285 { 0x188, 42, 4 },
286 { 0x188, 42, 5 },
287 { 0x188, 42, 6 },
288 { 0x188, 42, 7 },
289
290 { 0x188, 44, 0 },
291 { 0x188, 44, 1 },
292 { 0x188, 44, 2 },
293 { 0x188, 44, 3 },
294 { 0x188, 44, 4 },
295 { 0x188, 44, 5 },
296 { 0x188, 44, 6 },
297 { 0x188, 44, 7 },
298
299 { 0x188, 45, 0 },
300 { 0x188, 45, 1 },
301 { 0x188, 45, 2 },
302 { 0x188, 45, 3 },
303 { 0x188, 45, 4 },
304 { 0x188, 45, 5 },
305 { 0x188, 45, 6 },
306 { 0x188, 45, 7 },
307
308 /* cursor 0 */
309 { 0x188, 80, 0 },
310 { 0x188, 80, 1 },
311 { 0x188, 80, 2 },
312 { 0x188, 80, 3 },
313 { 0x188, 80, 4 },
314 { 0x188, 80, 5 },
315 { 0x188, 80, 6 },
316 { 0x188, 80, 7 },
317
318 { 0x188, 81, 0 },
319 { 0x188, 81, 1 },
320 { 0x188, 81, 2 },
321 { 0x188, 81, 3 },
322 { 0x188, 81, 4 },
323 { 0x188, 81, 5 },
324 { 0x188, 81, 6 },
325 { 0x188, 81, 7 },
326
327 { 0x188, 82, 0 },
328 { 0x188, 82, 1 },
329 { 0x188, 82, 2 },
330 { 0x188, 82, 3 },
331 { 0x188, 82, 4 },
332 { 0x188, 82, 5 },
333 { 0x188, 82, 6 },
334 { 0x188, 82, 7 },
335
336 { 0x188, 83, 0 },
337 { 0x188, 83, 1 },
338 { 0x188, 83, 2 },
339 { 0x188, 83, 3 },
340 { 0x188, 83, 4 },
341 { 0x188, 83, 5 },
342 { 0x188, 83, 6 },
343 { 0x188, 83, 7 },
344
345 { 0x188, 84, 0 },
346 { 0x188, 84, 1 },
347 { 0x188, 84, 2 },
348 { 0x188, 84, 3 },
349 { 0x188, 84, 4 },
350 { 0x188, 84, 5 },
351 { 0x188, 84, 6 },
352 { 0x188, 84, 7 },
353
354 /* fetch sspp1 */
355 /* vig 1 */
356 { 0x298, 0, 0 },
357 { 0x298, 0, 1 },
358 { 0x298, 0, 2 },
359 { 0x298, 0, 3 },
360 { 0x298, 0, 4 },
361 { 0x298, 0, 5 },
362 { 0x298, 0, 6 },
363 { 0x298, 0, 7 },
364
365 { 0x298, 1, 0 },
366 { 0x298, 1, 1 },
367 { 0x298, 1, 2 },
368 { 0x298, 1, 3 },
369 { 0x298, 1, 4 },
370 { 0x298, 1, 5 },
371 { 0x298, 1, 6 },
372 { 0x298, 1, 7 },
373
374 { 0x298, 2, 0 },
375 { 0x298, 2, 1 },
376 { 0x298, 2, 2 },
377 { 0x298, 2, 3 },
378 { 0x298, 2, 4 },
379 { 0x298, 2, 5 },
380 { 0x298, 2, 6 },
381 { 0x298, 2, 7 },
382
383 { 0x298, 4, 0 },
384 { 0x298, 4, 1 },
385 { 0x298, 4, 2 },
386 { 0x298, 4, 3 },
387 { 0x298, 4, 4 },
388 { 0x298, 4, 5 },
389 { 0x298, 4, 6 },
390 { 0x298, 4, 7 },
391
392 { 0x298, 5, 0 },
393 { 0x298, 5, 1 },
394 { 0x298, 5, 2 },
395 { 0x298, 5, 3 },
396 { 0x298, 5, 4 },
397 { 0x298, 5, 5 },
398 { 0x298, 5, 6 },
399 { 0x298, 5, 7 },
400
401 /* vig 3 */
402 { 0x298, 20, 0 },
403 { 0x298, 20, 1 },
404 { 0x298, 20, 2 },
405 { 0x298, 20, 3 },
406 { 0x298, 20, 4 },
407 { 0x298, 20, 5 },
408 { 0x298, 20, 6 },
409 { 0x298, 20, 7 },
410
411 { 0x298, 21, 0 },
412 { 0x298, 21, 1 },
413 { 0x298, 21, 2 },
414 { 0x298, 21, 3 },
415 { 0x298, 21, 4 },
416 { 0x298, 21, 5 },
417 { 0x298, 21, 6 },
418 { 0x298, 21, 7 },
419
420 { 0x298, 22, 0 },
421 { 0x298, 22, 1 },
422 { 0x298, 22, 2 },
423 { 0x298, 22, 3 },
424 { 0x298, 22, 4 },
425 { 0x298, 22, 5 },
426 { 0x298, 22, 6 },
427 { 0x298, 22, 7 },
428
429 { 0x298, 24, 0 },
430 { 0x298, 24, 1 },
431 { 0x298, 24, 2 },
432 { 0x298, 24, 3 },
433 { 0x298, 24, 4 },
434 { 0x298, 24, 5 },
435 { 0x298, 24, 6 },
436 { 0x298, 24, 7 },
437
438 { 0x298, 25, 0 },
439 { 0x298, 25, 1 },
440 { 0x298, 25, 2 },
441 { 0x298, 25, 3 },
442 { 0x298, 25, 4 },
443 { 0x298, 25, 5 },
444 { 0x298, 25, 6 },
445 { 0x298, 25, 7 },
446
447 /* rgb 1 */
448 { 0x298, 10, 0 },
449 { 0x298, 10, 1 },
450 { 0x298, 10, 2 },
451 { 0x298, 10, 3 },
452 { 0x298, 10, 4 },
453 { 0x298, 10, 5 },
454 { 0x298, 10, 6 },
455 { 0x298, 10, 7 },
456
457 { 0x298, 11, 0 },
458 { 0x298, 11, 1 },
459 { 0x298, 11, 2 },
460 { 0x298, 11, 3 },
461 { 0x298, 11, 4 },
462 { 0x298, 11, 5 },
463 { 0x298, 11, 6 },
464 { 0x298, 11, 7 },
465
466 { 0x298, 12, 0 },
467 { 0x298, 12, 1 },
468 { 0x298, 12, 2 },
469 { 0x298, 12, 3 },
470 { 0x298, 12, 4 },
471 { 0x298, 12, 5 },
472 { 0x298, 12, 6 },
473 { 0x298, 12, 7 },
474
475 { 0x298, 14, 0 },
476 { 0x298, 14, 1 },
477 { 0x298, 14, 2 },
478 { 0x298, 14, 3 },
479 { 0x298, 14, 4 },
480 { 0x298, 14, 5 },
481 { 0x298, 14, 6 },
482 { 0x298, 14, 7 },
483
484 { 0x298, 15, 0 },
485 { 0x298, 15, 1 },
486 { 0x298, 15, 2 },
487 { 0x298, 15, 3 },
488 { 0x298, 15, 4 },
489 { 0x298, 15, 5 },
490 { 0x298, 15, 6 },
491 { 0x298, 15, 7 },
492
493 /* rgb 3 */
494 { 0x298, 30, 0 },
495 { 0x298, 30, 1 },
496 { 0x298, 30, 2 },
497 { 0x298, 30, 3 },
498 { 0x298, 30, 4 },
499 { 0x298, 30, 5 },
500 { 0x298, 30, 6 },
501 { 0x298, 30, 7 },
502
503 { 0x298, 31, 0 },
504 { 0x298, 31, 1 },
505 { 0x298, 31, 2 },
506 { 0x298, 31, 3 },
507 { 0x298, 31, 4 },
508 { 0x298, 31, 5 },
509 { 0x298, 31, 6 },
510 { 0x298, 31, 7 },
511
512 { 0x298, 32, 0 },
513 { 0x298, 32, 1 },
514 { 0x298, 32, 2 },
515 { 0x298, 32, 3 },
516 { 0x298, 32, 4 },
517 { 0x298, 32, 5 },
518 { 0x298, 32, 6 },
519 { 0x298, 32, 7 },
520
521 { 0x298, 34, 0 },
522 { 0x298, 34, 1 },
523 { 0x298, 34, 2 },
524 { 0x298, 34, 3 },
525 { 0x298, 34, 4 },
526 { 0x298, 34, 5 },
527 { 0x298, 34, 6 },
528 { 0x298, 34, 7 },
529
530 { 0x298, 35, 0 },
531 { 0x298, 35, 1 },
532 { 0x298, 35, 2 },
533 { 0x298, 35, 3 },
534 { 0x298, 35, 4 },
535 { 0x298, 35, 5 },
536 { 0x298, 35, 6 },
537 { 0x298, 35, 7 },
538
539 /* dma 1 */
540 { 0x298, 40, 0 },
541 { 0x298, 40, 1 },
542 { 0x298, 40, 2 },
543 { 0x298, 40, 3 },
544 { 0x298, 40, 4 },
545 { 0x298, 40, 5 },
546 { 0x298, 40, 6 },
547 { 0x298, 40, 7 },
548
549 { 0x298, 41, 0 },
550 { 0x298, 41, 1 },
551 { 0x298, 41, 2 },
552 { 0x298, 41, 3 },
553 { 0x298, 41, 4 },
554 { 0x298, 41, 5 },
555 { 0x298, 41, 6 },
556 { 0x298, 41, 7 },
557
558 { 0x298, 42, 0 },
559 { 0x298, 42, 1 },
560 { 0x298, 42, 2 },
561 { 0x298, 42, 3 },
562 { 0x298, 42, 4 },
563 { 0x298, 42, 5 },
564 { 0x298, 42, 6 },
565 { 0x298, 42, 7 },
566
567 { 0x298, 44, 0 },
568 { 0x298, 44, 1 },
569 { 0x298, 44, 2 },
570 { 0x298, 44, 3 },
571 { 0x298, 44, 4 },
572 { 0x298, 44, 5 },
573 { 0x298, 44, 6 },
574 { 0x298, 44, 7 },
575
576 { 0x298, 45, 0 },
577 { 0x298, 45, 1 },
578 { 0x298, 45, 2 },
579 { 0x298, 45, 3 },
580 { 0x298, 45, 4 },
581 { 0x298, 45, 5 },
582 { 0x298, 45, 6 },
583 { 0x298, 45, 7 },
584
585 /* cursor 1 */
586 { 0x298, 80, 0 },
587 { 0x298, 80, 1 },
588 { 0x298, 80, 2 },
589 { 0x298, 80, 3 },
590 { 0x298, 80, 4 },
591 { 0x298, 80, 5 },
592 { 0x298, 80, 6 },
593 { 0x298, 80, 7 },
594
595 { 0x298, 81, 0 },
596 { 0x298, 81, 1 },
597 { 0x298, 81, 2 },
598 { 0x298, 81, 3 },
599 { 0x298, 81, 4 },
600 { 0x298, 81, 5 },
601 { 0x298, 81, 6 },
602 { 0x298, 81, 7 },
603
604 { 0x298, 82, 0 },
605 { 0x298, 82, 1 },
606 { 0x298, 82, 2 },
607 { 0x298, 82, 3 },
608 { 0x298, 82, 4 },
609 { 0x298, 82, 5 },
610 { 0x298, 82, 6 },
611 { 0x298, 82, 7 },
612
613 { 0x298, 83, 0 },
614 { 0x298, 83, 1 },
615 { 0x298, 83, 2 },
616 { 0x298, 83, 3 },
617 { 0x298, 83, 4 },
618 { 0x298, 83, 5 },
619 { 0x298, 83, 6 },
620 { 0x298, 83, 7 },
621
622 { 0x298, 84, 0 },
623 { 0x298, 84, 1 },
624 { 0x298, 84, 2 },
625 { 0x298, 84, 3 },
626 { 0x298, 84, 4 },
627 { 0x298, 84, 5 },
628 { 0x298, 84, 6 },
629 { 0x298, 84, 7 },
630
631 /* dspp */
632 { 0x348, 13, 0 },
633 { 0x348, 19, 0 },
634 { 0x348, 14, 0 },
635 { 0x348, 14, 1 },
636 { 0x348, 14, 3 },
637 { 0x348, 20, 0 },
638 { 0x348, 20, 1 },
639 { 0x348, 20, 3 },
640
641 /* dither */
642 { 0x348, 18, 1 },
643 { 0x348, 24, 1 },
644
645 /* ppb_0 */
646 { 0x348, 31, 0 },
647 { 0x348, 33, 0 },
648 { 0x348, 35, 0 },
649 { 0x348, 42, 0 },
650
651 /* ppb_1 */
652 { 0x348, 32, 0 },
653 { 0x348, 34, 0 },
654 { 0x348, 36, 0 },
655 { 0x348, 43, 0 },
656
657 /* lm_lut */
658 { 0x348, 109, 0 },
659 { 0x348, 105, 0 },
660 { 0x348, 103, 0 },
661 { 0x348, 101, 0 },
662 { 0x348, 99, 0 },
663
664 /* tear-check */
665 { 0x418, 63, 0 },
666 { 0x418, 64, 0 },
667 { 0x418, 65, 0 },
668 { 0x418, 73, 0 },
669 { 0x418, 74, 0 },
670
671 /* crossbar */
672 { 0x348, 0, 0},
673
674 /* blend */
675 /* LM0 */
676 { 0x348, 63, 0},
677 { 0x348, 63, 1},
678 { 0x348, 63, 2},
679 { 0x348, 63, 3},
680 { 0x348, 63, 4},
681 { 0x348, 63, 5},
682 { 0x348, 63, 6},
683 { 0x348, 63, 7},
684
685 { 0x348, 64, 0},
686 { 0x348, 64, 1},
687 { 0x348, 64, 2},
688 { 0x348, 64, 3},
689 { 0x348, 64, 4},
690 { 0x348, 64, 5},
691 { 0x348, 64, 6},
692 { 0x348, 64, 7},
693
694 { 0x348, 65, 0},
695 { 0x348, 65, 1},
696 { 0x348, 65, 2},
697 { 0x348, 65, 3},
698 { 0x348, 65, 4},
699 { 0x348, 65, 5},
700 { 0x348, 65, 6},
701 { 0x348, 65, 7},
702
703 { 0x348, 66, 0},
704 { 0x348, 66, 1},
705 { 0x348, 66, 2},
706 { 0x348, 66, 3},
707 { 0x348, 66, 4},
708 { 0x348, 66, 5},
709 { 0x348, 66, 6},
710 { 0x348, 66, 7},
711
712 { 0x348, 67, 0},
713 { 0x348, 67, 1},
714 { 0x348, 67, 2},
715 { 0x348, 67, 3},
716 { 0x348, 67, 4},
717 { 0x348, 67, 5},
718 { 0x348, 67, 6},
719 { 0x348, 67, 7},
720
721 { 0x348, 68, 0},
722 { 0x348, 68, 1},
723 { 0x348, 68, 2},
724 { 0x348, 68, 3},
725 { 0x348, 68, 4},
726 { 0x348, 68, 5},
727 { 0x348, 68, 6},
728 { 0x348, 68, 7},
729
730 { 0x348, 69, 0},
731 { 0x348, 69, 1},
732 { 0x348, 69, 2},
733 { 0x348, 69, 3},
734 { 0x348, 69, 4},
735 { 0x348, 69, 5},
736 { 0x348, 69, 6},
737 { 0x348, 69, 7},
738
739 /* LM1 */
740 { 0x348, 70, 0},
741 { 0x348, 70, 1},
742 { 0x348, 70, 2},
743 { 0x348, 70, 3},
744 { 0x348, 70, 4},
745 { 0x348, 70, 5},
746 { 0x348, 70, 6},
747 { 0x348, 70, 7},
748
749 { 0x348, 71, 0},
750 { 0x348, 71, 1},
751 { 0x348, 71, 2},
752 { 0x348, 71, 3},
753 { 0x348, 71, 4},
754 { 0x348, 71, 5},
755 { 0x348, 71, 6},
756 { 0x348, 71, 7},
757
758 { 0x348, 72, 0},
759 { 0x348, 72, 1},
760 { 0x348, 72, 2},
761 { 0x348, 72, 3},
762 { 0x348, 72, 4},
763 { 0x348, 72, 5},
764 { 0x348, 72, 6},
765 { 0x348, 72, 7},
766
767 { 0x348, 73, 0},
768 { 0x348, 73, 1},
769 { 0x348, 73, 2},
770 { 0x348, 73, 3},
771 { 0x348, 73, 4},
772 { 0x348, 73, 5},
773 { 0x348, 73, 6},
774 { 0x348, 73, 7},
775
776 { 0x348, 74, 0},
777 { 0x348, 74, 1},
778 { 0x348, 74, 2},
779 { 0x348, 74, 3},
780 { 0x348, 74, 4},
781 { 0x348, 74, 5},
782 { 0x348, 74, 6},
783 { 0x348, 74, 7},
784
785 { 0x348, 75, 0},
786 { 0x348, 75, 1},
787 { 0x348, 75, 2},
788 { 0x348, 75, 3},
789 { 0x348, 75, 4},
790 { 0x348, 75, 5},
791 { 0x348, 75, 6},
792 { 0x348, 75, 7},
793
794 { 0x348, 76, 0},
795 { 0x348, 76, 1},
796 { 0x348, 76, 2},
797 { 0x348, 76, 3},
798 { 0x348, 76, 4},
799 { 0x348, 76, 5},
800 { 0x348, 76, 6},
801 { 0x348, 76, 7},
802
803 /* LM2 */
804 { 0x348, 77, 0},
805 { 0x348, 77, 1},
806 { 0x348, 77, 2},
807 { 0x348, 77, 3},
808 { 0x348, 77, 4},
809 { 0x348, 77, 5},
810 { 0x348, 77, 6},
811 { 0x348, 77, 7},
812
813 { 0x348, 78, 0},
814 { 0x348, 78, 1},
815 { 0x348, 78, 2},
816 { 0x348, 78, 3},
817 { 0x348, 78, 4},
818 { 0x348, 78, 5},
819 { 0x348, 78, 6},
820 { 0x348, 78, 7},
821
822 { 0x348, 79, 0},
823 { 0x348, 79, 1},
824 { 0x348, 79, 2},
825 { 0x348, 79, 3},
826 { 0x348, 79, 4},
827 { 0x348, 79, 5},
828 { 0x348, 79, 6},
829 { 0x348, 79, 7},
830
831 { 0x348, 80, 0},
832 { 0x348, 80, 1},
833 { 0x348, 80, 2},
834 { 0x348, 80, 3},
835 { 0x348, 80, 4},
836 { 0x348, 80, 5},
837 { 0x348, 80, 6},
838 { 0x348, 80, 7},
839
840 { 0x348, 81, 0},
841 { 0x348, 81, 1},
842 { 0x348, 81, 2},
843 { 0x348, 81, 3},
844 { 0x348, 81, 4},
845 { 0x348, 81, 5},
846 { 0x348, 81, 6},
847 { 0x348, 81, 7},
848
849 { 0x348, 82, 0},
850 { 0x348, 82, 1},
851 { 0x348, 82, 2},
852 { 0x348, 82, 3},
853 { 0x348, 82, 4},
854 { 0x348, 82, 5},
855 { 0x348, 82, 6},
856 { 0x348, 82, 7},
857
858 { 0x348, 83, 0},
859 { 0x348, 83, 1},
860 { 0x348, 83, 2},
861 { 0x348, 83, 3},
862 { 0x348, 83, 4},
863 { 0x348, 83, 5},
864 { 0x348, 83, 6},
865 { 0x348, 83, 7},
866
867 /* csc */
868 {0x188, 7, 0},
869 {0x188, 7, 1},
870 {0x188, 27, 0},
871 {0x188, 27, 1},
872 {0x298, 7, 0},
873 {0x298, 7, 1},
874 {0x298, 27, 0},
875 {0x298, 27, 1},
876
877 /* pcc */
878 { 0x188, 3, 3},
879 { 0x188, 23, 3},
880 { 0x188, 13, 3},
881 { 0x188, 33, 3},
882 { 0x188, 43, 3},
883 { 0x298, 3, 3},
884 { 0x298, 23, 3},
885 { 0x298, 13, 3},
886 { 0x298, 33, 3},
887 { 0x298, 43, 3},
888
889 /* spa */
890 { 0x188, 8, 0},
891 { 0x188, 28, 0},
892 { 0x298, 8, 0},
893 { 0x298, 28, 0},
894 { 0x348, 13, 0},
895 { 0x348, 19, 0},
896
897 /* igc */
898 { 0x188, 9, 0},
899 { 0x188, 9, 1},
900 { 0x188, 9, 3},
901 { 0x188, 29, 0},
902 { 0x188, 29, 1},
903 { 0x188, 29, 3},
904 { 0x188, 17, 0},
905 { 0x188, 17, 1},
906 { 0x188, 17, 3},
907 { 0x188, 37, 0},
908 { 0x188, 37, 1},
909 { 0x188, 37, 3},
910 { 0x188, 46, 0},
911 { 0x188, 46, 1},
912 { 0x188, 46, 3},
913
914 { 0x298, 9, 0},
915 { 0x298, 9, 1},
916 { 0x298, 9, 3},
917 { 0x298, 29, 0},
918 { 0x298, 29, 1},
919 { 0x298, 29, 3},
920 { 0x298, 17, 0},
921 { 0x298, 17, 1},
922 { 0x298, 17, 3},
923 { 0x298, 37, 0},
924 { 0x298, 37, 1},
925 { 0x298, 37, 3},
926 { 0x298, 46, 0},
927 { 0x298, 46, 1},
928 { 0x298, 46, 3},
929
930 { 0x348, 14, 0},
931 { 0x348, 14, 1},
932 { 0x348, 14, 3},
933 { 0x348, 20, 0},
934 { 0x348, 20, 1},
935 { 0x348, 20, 3},
936
937 { 0x418, 60, 0},
938};
939
940static struct vbif_debug_bus vbif_dbg_bus_8996[] = {
941 {0x214, 0x21c, 16, 2, 0x10}, /* arb clients */
942 {0x214, 0x21c, 0, 14, 0x13}, /* xin blocks - axi side */
943 {0x21c, 0x214, 0, 14, 0xc}, /* xin blocks - clock side */
944};
945
946static struct vbif_debug_bus nrt_vbif_dbg_bus_8996[] = {
947 {0x214, 0x21c, 16, 1, 0x10}, /* arb clients */
948 {0x214, 0x21c, 0, 12, 0x13}, /* xin blocks - axi side */
949 {0x21c, 0x214, 0, 12, 0xc}, /* xin blocks - clock side */
950};
951
952void mdss_mdp_hw_rev_debug_caps_init(struct mdss_data_type *mdata)
953{
954 mdata->dbg_bus = NULL;
955 mdata->dbg_bus_size = 0;
956
957 switch (mdata->mdp_rev) {
958 case MDSS_MDP_HW_REV_107:
959 case MDSS_MDP_HW_REV_107_1:
960 case MDSS_MDP_HW_REV_107_2:
961 mdata->dbg_bus = dbg_bus_8996;
962 mdata->dbg_bus_size = ARRAY_SIZE(dbg_bus_8996);
963 mdata->vbif_dbg_bus = vbif_dbg_bus_8996;
964 mdata->vbif_dbg_bus_size = ARRAY_SIZE(vbif_dbg_bus_8996);
965 mdata->nrt_vbif_dbg_bus = nrt_vbif_dbg_bus_8996;
966 mdata->nrt_vbif_dbg_bus_size =
967 ARRAY_SIZE(nrt_vbif_dbg_bus_8996);
968 break;
969 default:
970 break;
971 }
972}
973
974void mdss_mdp_debug_mid(u32 mid)
975{
976 struct mdss_data_type *mdata = mdss_mdp_get_mdata();
977 struct mdss_debug_data *mdd = mdata->debug_inf.debug_data;
978 struct range_dump_node *xlog_node;
979 struct mdss_debug_base *blk_base;
980 char *addr;
981 u32 len;
982
983 list_for_each_entry(blk_base, &mdd->base_list, head) {
984 list_for_each_entry(xlog_node, &blk_base->dump_list, head) {
985 if (xlog_node->xin_id != mid)
986 continue;
987
988 len = get_dump_range(&xlog_node->offset,
989 blk_base->max_offset);
990 addr = blk_base->base + xlog_node->offset.start;
991 pr_info("%s: mid:%d range_base=0x%pK start=0x%x end=0x%x\n",
992 xlog_node->range_name, mid, addr,
993 xlog_node->offset.start, xlog_node->offset.end);
994
995 /*
996 * Next instruction assumes that MDP clocks are ON
997 * because it is called from interrupt context
998 */
999 mdss_dump_reg((const char *)xlog_node->range_name,
1000 MDSS_DBG_DUMP_IN_LOG, addr, len,
1001 &xlog_node->reg_dump, true);
1002 }
1003 }
1004}
1005
1006static void __print_time(char *buf, u32 size, u64 ts)
1007{
1008 unsigned long rem_ns = do_div(ts, NSEC_PER_SEC);
1009
1010 snprintf(buf, size, "%llu.%06lu", ts, rem_ns);
1011}
1012
1013static void __print_buf(struct seq_file *s, struct mdss_mdp_data *buf,
1014 bool show_pipe)
1015{
1016 char tmpbuf[20];
1017 int i;
1018 const char * const buf_stat_stmap[] = {
1019 [MDP_BUF_STATE_UNUSED] = "UNUSED ",
1020 [MDP_BUF_STATE_READY] = "READY ",
1021 [MDP_BUF_STATE_ACTIVE] = "ACTIVE ",
1022 [MDP_BUF_STATE_CLEANUP] = "CLEANUP",
1023 };
1024 const char * const domain_stmap[] = {
1025 [MDSS_IOMMU_DOMAIN_UNSECURE] = "mdp_unsecure",
1026 [MDSS_IOMMU_DOMAIN_ROT_UNSECURE] = "rot_unsecure",
1027 [MDSS_IOMMU_DOMAIN_SECURE] = "mdp_secure",
1028 [MDSS_IOMMU_DOMAIN_ROT_SECURE] = "rot_secure",
1029 [MDSS_IOMMU_MAX_DOMAIN] = "undefined",
1030 };
1031 const char * const dma_data_dir_stmap[] = {
1032 [DMA_BIDIRECTIONAL] = "read/write",
1033 [DMA_TO_DEVICE] = "read",
1034 [DMA_FROM_DEVICE] = "read/write",
1035 [DMA_NONE] = "????",
1036 };
1037
1038 seq_puts(s, "\t");
1039 if (show_pipe && buf->last_pipe)
1040 seq_printf(s, "pnum=%d ", buf->last_pipe->num);
1041
1042 seq_printf(s, "state=%s addr=%pa size=%lu ",
1043 buf->state < ARRAY_SIZE(buf_stat_stmap) &&
1044 buf_stat_stmap[buf->state] ? buf_stat_stmap[buf->state] : "?",
1045 &buf->p[0].addr, buf->p[0].len);
1046
1047 __print_time(tmpbuf, sizeof(tmpbuf), buf->last_alloc);
1048 seq_printf(s, "alloc_time=%s ", tmpbuf);
1049 if (buf->state == MDP_BUF_STATE_UNUSED) {
1050 __print_time(tmpbuf, sizeof(tmpbuf), buf->last_freed);
1051 seq_printf(s, "freed_time=%s ", tmpbuf);
1052 } else {
1053 for (i = 0; i < buf->num_planes; i++) {
1054 seq_puts(s, "\n\t\t");
1055 seq_printf(s, "plane[%d] domain=%s ", i,
1056 domain_stmap[buf->p[i].domain]);
1057 seq_printf(s, "permission=%s ",
1058 dma_data_dir_stmap[buf->p[i].dir]);
1059 }
1060 }
1061 seq_puts(s, "\n");
1062}
1063
1064static void __dump_pipe(struct seq_file *s, struct mdss_mdp_pipe *pipe)
1065{
1066 struct mdss_mdp_data *buf;
1067 int format;
1068 int smps[4];
1069 int i;
1070
1071 seq_printf(s, "\nSSPP #%d type=%s ndx=%x flags=0x%08x play_cnt=%u xin_id=%d\n",
1072 pipe->num, mdss_mdp_pipetype2str(pipe->type),
1073 pipe->ndx, pipe->flags, pipe->play_cnt, pipe->xin_id);
1074 seq_printf(s, "\tstage=%d alpha=0x%x transp=0x%x blend_op=%d\n",
1075 pipe->mixer_stage, pipe->alpha,
1076 pipe->transp, pipe->blend_op);
1077 if (pipe->multirect.max_rects > 1) {
1078 const char * const fmodes[] = {
1079 [MDSS_MDP_PIPE_MULTIRECT_PARALLEL] = "parallel",
1080 [MDSS_MDP_PIPE_MULTIRECT_SERIAL] = "serial",
1081 [MDSS_MDP_PIPE_MULTIRECT_NONE] = "single",
1082 };
1083 const char *mode = NULL;
1084
1085 if (pipe->multirect.mode < ARRAY_SIZE(fmodes))
1086 mode = fmodes[pipe->multirect.mode];
1087 if (!mode)
1088 mode = "invalid";
1089
1090 seq_printf(s, "\trect=%d/%d fetch_mode=%s\n",
1091 pipe->multirect.num, pipe->multirect.max_rects,
1092 mode);
1093 }
1094
1095 format = pipe->src_fmt->format;
1096 seq_printf(s, "\tsrc w=%d h=%d format=%d (%s)\n",
1097 pipe->img_width, pipe->img_height, format,
1098 mdss_mdp_format2str(format));
1099 seq_printf(s, "\tsrc_rect x=%d y=%d w=%d h=%d H.dec=%d V.dec=%d\n",
1100 pipe->src.x, pipe->src.y, pipe->src.w, pipe->src.h,
1101 pipe->horz_deci, pipe->vert_deci);
1102 seq_printf(s, "\tdst_rect x=%d y=%d w=%d h=%d\n",
1103 pipe->dst.x, pipe->dst.y, pipe->dst.w, pipe->dst.h);
1104
1105 smps[0] = bitmap_weight(pipe->smp_map[0].allocated,
1106 MAX_DRV_SUP_MMB_BLKS);
1107 smps[1] = bitmap_weight(pipe->smp_map[1].allocated,
1108 MAX_DRV_SUP_MMB_BLKS);
1109 smps[2] = bitmap_weight(pipe->smp_map[0].reserved,
1110 MAX_DRV_SUP_MMB_BLKS);
1111 smps[3] = bitmap_weight(pipe->smp_map[1].reserved,
1112 MAX_DRV_SUP_MMB_BLKS);
1113
1114 seq_printf(s, "\tSMP allocated=[%d %d] reserved=[%d %d]\n",
1115 smps[0], smps[1], smps[2], smps[3]);
1116
1117 seq_puts(s, "\tSupported formats = ");
1118 for (i = 0; i < BITS_TO_BYTES(MDP_IMGTYPE_LIMIT1); i++)
1119 seq_printf(s, "0x%02X ", pipe->supported_formats[i]);
1120 seq_puts(s, "\n");
1121
1122 seq_puts(s, "Data:\n");
1123
1124 list_for_each_entry(buf, &pipe->buf_queue, pipe_list)
1125 __print_buf(s, buf, false);
1126}
1127
1128static void __dump_mixer(struct seq_file *s, struct mdss_mdp_mixer *mixer)
1129{
1130 struct mdss_mdp_pipe *pipe;
1131 int i, cnt = 0;
1132
1133 if (!mixer)
1134 return;
1135
1136 seq_printf(s, "\n%s Mixer #%d res=%dx%d roi[%d, %d, %d, %d] %s\n",
1137 mixer->type == MDSS_MDP_MIXER_TYPE_INTF ? "Intf" : "Writeback",
1138 mixer->num, mixer->width, mixer->height,
1139 mixer->roi.x, mixer->roi.y, mixer->roi.w, mixer->roi.h,
1140 mixer->cursor_enabled ? "w/cursor" : "");
1141
1142 for (i = 0; i < ARRAY_SIZE(mixer->stage_pipe); i++) {
1143 pipe = mixer->stage_pipe[i];
1144 if (pipe) {
1145 __dump_pipe(s, pipe);
1146 cnt++;
1147 }
1148 }
1149
1150 seq_printf(s, "\nTotal pipes=%d\n", cnt);
1151}
1152
1153static void __dump_timings(struct seq_file *s, struct mdss_mdp_ctl *ctl)
1154{
1155 struct mdss_panel_info *pinfo;
1156
1157 if (!ctl || !ctl->panel_data)
1158 return;
1159
1160 pinfo = &ctl->panel_data->panel_info;
1161 seq_printf(s, "Panel #%d %dx%dp%d\n",
1162 pinfo->pdest, pinfo->xres, pinfo->yres,
1163 mdss_panel_get_framerate(pinfo, FPS_RESOLUTION_HZ));
1164 seq_printf(s, "\tvbp=%d vfp=%d vpw=%d hbp=%d hfp=%d hpw=%d\n",
1165 pinfo->lcdc.v_back_porch,
1166 pinfo->lcdc.v_front_porch,
1167 pinfo->lcdc.v_pulse_width,
1168 pinfo->lcdc.h_back_porch,
1169 pinfo->lcdc.h_front_porch,
1170 pinfo->lcdc.h_pulse_width);
1171
1172 if (pinfo->lcdc.border_bottom || pinfo->lcdc.border_top ||
1173 pinfo->lcdc.border_left ||
1174 pinfo->lcdc.border_right) {
1175 seq_printf(s, "\tborder (l,t,r,b):[%d,%d,%d,%d] off xy:%d,%d\n",
1176 pinfo->lcdc.border_left,
1177 pinfo->lcdc.border_top,
1178 pinfo->lcdc.border_right,
1179 pinfo->lcdc.border_bottom,
1180 ctl->border_x_off,
1181 ctl->border_y_off);
1182 }
1183}
1184
1185static void __dump_ctl(struct seq_file *s, struct mdss_mdp_ctl *ctl)
1186{
1187 struct mdss_mdp_perf_params *perf;
1188
1189 if (!mdss_mdp_ctl_is_power_on(ctl))
1190 return;
1191
1192 seq_printf(s, "\n--[ Control path #%d - ", ctl->num);
1193
1194 if (ctl->panel_data) {
1195 struct mdss_mdp_ctl *sctl = mdss_mdp_get_split_ctl(ctl);
1196
1197 seq_printf(s, "%s%s]--\n",
1198 sctl && sctl->panel_data ? "DUAL " : "",
1199 mdss_panel2str(ctl->panel_data->panel_info.type));
1200 __dump_timings(s, ctl);
1201 __dump_timings(s, sctl);
1202 } else {
1203 struct mdss_mdp_mixer *mixer;
1204
1205 mixer = ctl->mixer_left;
1206 if (mixer) {
1207 seq_printf(s, "%s%d",
1208 (mixer->rotator_mode ? "rot" : "wb"),
1209 mixer->num);
1210 } else {
1211 seq_puts(s, "unknown");
1212 }
1213 seq_puts(s, "]--\n");
1214 }
1215 perf = &ctl->cur_perf;
1216 seq_printf(s, "MDP Clk=%u Final BW=%llu\n",
1217 perf->mdp_clk_rate,
1218 perf->bw_ctl);
1219 seq_printf(s, "Play Count=%u Underrun Count=%u\n",
1220 ctl->play_cnt, ctl->underrun_cnt);
1221
1222 __dump_mixer(s, ctl->mixer_left);
1223 __dump_mixer(s, ctl->mixer_right);
1224}
1225
1226static int __dump_mdp(struct seq_file *s, struct mdss_data_type *mdata)
1227{
1228 struct mdss_mdp_ctl *ctl;
1229 int i, ignore_ndx = -1;
1230
1231 for (i = 0; i < mdata->nctl; i++) {
1232 ctl = mdata->ctl_off + i;
1233 /* ignore slave ctl in split display case */
1234 if (ctl->num == ignore_ndx)
1235 continue;
1236 if (ctl->mixer_right && (ctl->mixer_right->ctl != ctl))
1237 ignore_ndx = ctl->mixer_right->ctl->num;
1238 __dump_ctl(s, ctl);
1239 }
1240 return 0;
1241}
1242
1243#define DUMP_CHUNK 256
1244#define DUMP_SIZE SZ_32K
1245void mdss_mdp_dump(struct mdss_data_type *mdata)
1246{
1247 struct seq_file s = {
1248 .size = DUMP_SIZE - 1,
1249 };
1250 int i;
1251
1252 s.buf = kzalloc(DUMP_SIZE, GFP_KERNEL);
1253 if (!s.buf)
1254 return;
1255
1256 __dump_mdp(&s, mdata);
1257 seq_puts(&s, "\n");
1258
1259 pr_info("MDP DUMP\n------------------------\n");
1260 for (i = 0; i < s.count; i += DUMP_CHUNK) {
1261 if ((s.count - i) > DUMP_CHUNK) {
1262 char c = s.buf[i + DUMP_CHUNK];
1263
1264 s.buf[i + DUMP_CHUNK] = 0;
1265 pr_cont("%s", s.buf + i);
1266 s.buf[i + DUMP_CHUNK] = c;
1267 } else {
1268 s.buf[s.count] = 0;
1269 pr_cont("%s", s.buf + i);
1270 }
1271 }
1272
1273 kfree(s.buf);
1274}
1275
1276#ifdef CONFIG_DEBUG_FS
1277static void __dump_buf_data(struct seq_file *s, struct msm_fb_data_type *mfd)
1278{
1279 struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);
1280 struct mdss_mdp_data *buf;
1281 int i = 0;
1282
1283 seq_printf(s, "List of buffers for fb%d\n", mfd->index);
1284
1285 mutex_lock(&mdp5_data->list_lock);
1286 if (!list_empty(&mdp5_data->bufs_used)) {
1287 seq_puts(s, " Buffers used:\n");
1288 list_for_each_entry(buf, &mdp5_data->bufs_used, buf_list)
1289 __print_buf(s, buf, true);
1290 }
1291
1292 if (!list_empty(&mdp5_data->bufs_freelist)) {
1293 seq_puts(s, " Buffers in free list:\n");
1294 list_for_each_entry(buf, &mdp5_data->bufs_freelist, buf_list)
1295 __print_buf(s, buf, true);
1296 }
1297
1298 if (!list_empty(&mdp5_data->bufs_pool)) {
1299 seq_printf(s, " Last %d buffers used:\n", BUF_DUMP_LAST_N);
1300
1301 list_for_each_entry_reverse(buf, &mdp5_data->bufs_pool,
1302 buf_list) {
1303 if (buf->last_freed == 0 || i == BUF_DUMP_LAST_N)
1304 break;
1305 __print_buf(s, buf, true);
1306 i++;
1307 }
1308 }
1309 mutex_unlock(&mdp5_data->list_lock);
1310}
1311
1312static int __dump_buffers(struct seq_file *s, struct mdss_data_type *mdata)
1313{
1314 struct mdss_mdp_ctl *ctl;
1315 int i, ignore_ndx = -1;
1316
1317 for (i = 0; i < mdata->nctl; i++) {
1318 ctl = mdata->ctl_off + i;
1319 /* ignore slave ctl in split display case */
1320 if (ctl->num == ignore_ndx)
1321 continue;
1322 if (ctl->mixer_right && (ctl->mixer_right->ctl != ctl))
1323 ignore_ndx = ctl->mixer_right->ctl->num;
1324
1325 if (ctl->mfd)
1326 __dump_buf_data(s, ctl->mfd);
1327 }
1328 return 0;
1329}
1330
1331static int mdss_debugfs_dump_show(struct seq_file *s, void *v)
1332{
1333 struct mdss_data_type *mdata = (struct mdss_data_type *)s->private;
1334
1335 return __dump_mdp(s, mdata);
1336}
1337DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_dump);
1338
1339static int mdss_debugfs_buffers_show(struct seq_file *s, void *v)
1340{
1341 struct mdss_data_type *mdata = (struct mdss_data_type *)s->private;
1342
1343 return __dump_buffers(s, mdata);
1344}
1345DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_buffers);
1346
1347static int __danger_safe_signal_status(struct seq_file *s, bool danger_status)
1348{
1349 struct mdss_data_type *mdata = (struct mdss_data_type *)s->private;
1350 u32 status;
1351 int i, j;
1352
1353 mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
1354 if (danger_status) {
1355 seq_puts(s, "\nDanger signal status:\n");
1356 status = readl_relaxed(mdata->mdp_base +
1357 MDSS_MDP_DANGER_STATUS);
1358 } else {
1359 seq_puts(s, "\nSafe signal status:\n");
1360 status = readl_relaxed(mdata->mdp_base +
1361 MDSS_MDP_SAFE_STATUS);
1362 }
1363 mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
1364
1365 seq_printf(s, "MDP : 0x%lx\n",
1366 DANGER_SAFE_STATUS(status, MDP_DANGER_SAFE_BIT_OFFSET));
1367
1368 for (i = 0, j = VIG_DANGER_SAFE_BIT_OFFSET; i < mdata->nvig_pipes;
1369 i++, j += 2)
1370 seq_printf(s, "VIG%d : 0x%lx \t", i,
1371 DANGER_SAFE_STATUS(status, j));
1372 seq_puts(s, "\n");
1373
1374 for (i = 0, j = RGB_DANGER_SAFE_BIT_OFFSET; i < mdata->nrgb_pipes;
1375 i++, j += 2)
1376 seq_printf(s, "RGB%d : 0x%lx \t", i,
1377 DANGER_SAFE_STATUS(status, j));
1378 seq_puts(s, "\n");
1379 for (i = 0, j = DMA_DANGER_SAFE_BIT_OFFSET; i < mdata->ndma_pipes;
1380 i++, j += 2)
1381 seq_printf(s, "DMA%d : 0x%lx \t", i,
1382 DANGER_SAFE_STATUS(status, j));
1383 seq_puts(s, "\n");
1384
1385 for (i = 0, j = CURSOR_DANGER_SAFE_BIT_OFFSET; i < mdata->ncursor_pipes;
1386 i++, j += 2)
1387 seq_printf(s, "CURSOR%d : 0x%lx \t", i,
1388 DANGER_SAFE_STATUS(status, j));
1389 seq_puts(s, "\n");
1390
1391 return 0;
1392}
1393
1394static int mdss_debugfs_danger_stats_show(struct seq_file *s, void *v)
1395{
1396 return __danger_safe_signal_status(s, true);
1397}
1398DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_danger_stats);
1399
1400static int mdss_debugfs_safe_stats_show(struct seq_file *s, void *v)
1401{
1402 return __danger_safe_signal_status(s, false);
1403}
1404DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_safe_stats);
1405
1406static void __stats_ctl_dump(struct mdss_mdp_ctl *ctl, struct seq_file *s)
1407{
1408 if (!ctl->ref_cnt)
1409 return;
1410
1411 if (ctl->intf_num) {
1412 seq_printf(s, "intf%d: play: %08u \t",
1413 ctl->intf_num, ctl->play_cnt);
1414 seq_printf(s, "vsync: %08u \tunderrun: %08u\n",
1415 ctl->vsync_cnt, ctl->underrun_cnt);
1416 if (ctl->mfd) {
1417 seq_printf(s, "user_bl: %08u \tmod_bl: %08u\n",
1418 ctl->mfd->bl_level, ctl->mfd->bl_level_scaled);
1419 }
1420 } else {
1421 seq_printf(s, "wb: \tmode=%x \tplay: %08u\n",
1422 ctl->opmode, ctl->play_cnt);
1423 }
1424}
1425
1426static void __dump_stat(struct seq_file *s, char *ptypestr,
1427 struct mdss_mdp_pipe *pipe_list, int count)
1428{
1429 struct mdss_mdp_pipe *pipe;
1430 int i = 0, ndx = 0;
1431 u32 rects_per_pipe = 1;
1432
1433 while (i < count) {
1434 pipe = pipe_list + ndx;
1435 rects_per_pipe = pipe->multirect.max_rects;
1436
1437 if (rects_per_pipe == 1)
1438 seq_printf(s, "%s%d", ptypestr, i);
1439 else
1440 seq_printf(s, "%s%d.%d", ptypestr, i,
1441 ndx % rects_per_pipe);
1442
1443 seq_printf(s, " : %08u\t", pipe->play_cnt);
1444
1445 if ((++ndx % rects_per_pipe) == 0)
1446 i++;
1447
1448 if ((ndx % 4) == 0)
1449 seq_puts(s, "\n");
1450 }
1451
1452 if ((ndx % 4) != 0)
1453 seq_puts(s, "\n");
1454}
1455
1456static int mdss_debugfs_stats_show(struct seq_file *s, void *v)
1457{
1458 struct mdss_data_type *mdata = (struct mdss_data_type *)s->private;
1459 int i;
1460
1461 seq_puts(s, "\nmdp:\n");
1462
1463 for (i = 0; i < mdata->nctl; i++)
1464 __stats_ctl_dump(mdata->ctl_off + i, s);
1465 seq_puts(s, "\n");
1466
1467 __dump_stat(s, "VIG", mdata->vig_pipes, mdata->nvig_pipes);
1468 __dump_stat(s, "RGB", mdata->rgb_pipes, mdata->nrgb_pipes);
1469 __dump_stat(s, "DMA", mdata->dma_pipes, mdata->ndma_pipes);
1470 __dump_stat(s, "CURSOR", mdata->cursor_pipes, mdata->ncursor_pipes);
1471
1472 return 0;
1473}
1474DEFINE_MDSS_DEBUGFS_SEQ_FOPS(mdss_debugfs_stats);
1475
1476int mdss_mdp_debugfs_init(struct mdss_data_type *mdata)
1477{
1478 struct mdss_debug_data *mdd;
1479
1480 if (!mdata)
1481 return -ENODEV;
1482
1483 mdd = mdata->debug_inf.debug_data;
1484 if (!mdd)
1485 return -ENOENT;
1486
1487 debugfs_create_file("dump", 0644, mdd->root, mdata,
1488 &mdss_debugfs_dump_fops);
1489 debugfs_create_file("buffers", 0644, mdd->root, mdata,
1490 &mdss_debugfs_buffers_fops);
1491 debugfs_create_file("stat", 0644, mdd->root, mdata,
1492 &mdss_debugfs_stats_fops);
1493 debugfs_create_file("danger_stat", 0644, mdd->root, mdata,
1494 &mdss_debugfs_danger_stats_fops);
1495 debugfs_create_file("safe_stat", 0644, mdd->root, mdata,
1496 &mdss_debugfs_safe_stats_fops);
1497 debugfs_create_bool("serialize_wait4pp", 0644, mdd->root,
Sachin Bhayare3d3767e2018-01-02 21:10:57 +05301498 (bool *)&mdata->serialize_wait4pp);
Sachin Bhayareeeb88892018-01-02 16:36:01 +05301499 debugfs_create_bool("wait4autorefresh", 0644, mdd->root,
Sachin Bhayare3d3767e2018-01-02 21:10:57 +05301500 (bool *)&mdata->wait4autorefresh);
Sachin Bhayareeeb88892018-01-02 16:36:01 +05301501 debugfs_create_bool("enable_gate", 0644, mdd->root,
Sachin Bhayare3d3767e2018-01-02 21:10:57 +05301502 (bool *)&mdata->enable_gate);
Sachin Bhayareeeb88892018-01-02 16:36:01 +05301503
1504 debugfs_create_u32("color0", 0644, mdd->bordercolor,
1505 (u32 *)&mdata->bcolor0);
1506 debugfs_create_u32("color1", 0644, mdd->bordercolor,
1507 (u32 *)&mdata->bcolor1);
1508 debugfs_create_u32("color2", 0644, mdd->bordercolor,
1509 (u32 *)&mdata->bcolor2);
1510 debugfs_create_u32("ad_debugen", 0644, mdd->postproc,
1511 (u32 *)&mdata->ad_debugen);
1512
1513 return 0;
1514}
1515#endif