18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2014 48c2ecf20Sopenharmony_ci * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/debugfs.h> 88c2ecf20Sopenharmony_ci#include <linux/pm_runtime.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include "bdisp.h" 118c2ecf20Sopenharmony_ci#include "bdisp-filter.h" 128c2ecf20Sopenharmony_ci#include "bdisp-reg.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_civoid bdisp_dbg_perf_begin(struct bdisp_dev *bdisp) 158c2ecf20Sopenharmony_ci{ 168c2ecf20Sopenharmony_ci bdisp->dbg.hw_start = ktime_get(); 178c2ecf20Sopenharmony_ci} 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_civoid bdisp_dbg_perf_end(struct bdisp_dev *bdisp) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci s64 time_us; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci time_us = ktime_us_delta(ktime_get(), bdisp->dbg.hw_start); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci if (!bdisp->dbg.min_duration) 268c2ecf20Sopenharmony_ci bdisp->dbg.min_duration = time_us; 278c2ecf20Sopenharmony_ci else 288c2ecf20Sopenharmony_ci bdisp->dbg.min_duration = min(time_us, bdisp->dbg.min_duration); 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci bdisp->dbg.last_duration = time_us; 318c2ecf20Sopenharmony_ci bdisp->dbg.max_duration = max(time_us, bdisp->dbg.max_duration); 328c2ecf20Sopenharmony_ci bdisp->dbg.tot_duration += time_us; 338c2ecf20Sopenharmony_ci} 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_ins(struct seq_file *s, u32 val) 368c2ecf20Sopenharmony_ci{ 378c2ecf20Sopenharmony_ci seq_printf(s, "INS\t0x%08X\t", val); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci switch (val & BLT_INS_S1_MASK) { 408c2ecf20Sopenharmony_ci case BLT_INS_S1_OFF: 418c2ecf20Sopenharmony_ci break; 428c2ecf20Sopenharmony_ci case BLT_INS_S1_MEM: 438c2ecf20Sopenharmony_ci seq_puts(s, "SRC1=mem - "); 448c2ecf20Sopenharmony_ci break; 458c2ecf20Sopenharmony_ci case BLT_INS_S1_CF: 468c2ecf20Sopenharmony_ci seq_puts(s, "SRC1=ColorFill - "); 478c2ecf20Sopenharmony_ci break; 488c2ecf20Sopenharmony_ci case BLT_INS_S1_COPY: 498c2ecf20Sopenharmony_ci seq_puts(s, "SRC1=copy - "); 508c2ecf20Sopenharmony_ci break; 518c2ecf20Sopenharmony_ci case BLT_INS_S1_FILL: 528c2ecf20Sopenharmony_ci seq_puts(s, "SRC1=fil - "); 538c2ecf20Sopenharmony_ci break; 548c2ecf20Sopenharmony_ci default: 558c2ecf20Sopenharmony_ci seq_puts(s, "SRC1=??? - "); 568c2ecf20Sopenharmony_ci break; 578c2ecf20Sopenharmony_ci } 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci switch (val & BLT_INS_S2_MASK) { 608c2ecf20Sopenharmony_ci case BLT_INS_S2_OFF: 618c2ecf20Sopenharmony_ci break; 628c2ecf20Sopenharmony_ci case BLT_INS_S2_MEM: 638c2ecf20Sopenharmony_ci seq_puts(s, "SRC2=mem - "); 648c2ecf20Sopenharmony_ci break; 658c2ecf20Sopenharmony_ci case BLT_INS_S2_CF: 668c2ecf20Sopenharmony_ci seq_puts(s, "SRC2=ColorFill - "); 678c2ecf20Sopenharmony_ci break; 688c2ecf20Sopenharmony_ci default: 698c2ecf20Sopenharmony_ci seq_puts(s, "SRC2=??? - "); 708c2ecf20Sopenharmony_ci break; 718c2ecf20Sopenharmony_ci } 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci if ((val & BLT_INS_S3_MASK) == BLT_INS_S3_MEM) 748c2ecf20Sopenharmony_ci seq_puts(s, "SRC3=mem - "); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci if (val & BLT_INS_IVMX) 778c2ecf20Sopenharmony_ci seq_puts(s, "IVMX - "); 788c2ecf20Sopenharmony_ci if (val & BLT_INS_CLUT) 798c2ecf20Sopenharmony_ci seq_puts(s, "CLUT - "); 808c2ecf20Sopenharmony_ci if (val & BLT_INS_SCALE) 818c2ecf20Sopenharmony_ci seq_puts(s, "Scale - "); 828c2ecf20Sopenharmony_ci if (val & BLT_INS_FLICK) 838c2ecf20Sopenharmony_ci seq_puts(s, "Flicker - "); 848c2ecf20Sopenharmony_ci if (val & BLT_INS_CLIP) 858c2ecf20Sopenharmony_ci seq_puts(s, "Clip - "); 868c2ecf20Sopenharmony_ci if (val & BLT_INS_CKEY) 878c2ecf20Sopenharmony_ci seq_puts(s, "ColorKey - "); 888c2ecf20Sopenharmony_ci if (val & BLT_INS_OVMX) 898c2ecf20Sopenharmony_ci seq_puts(s, "OVMX - "); 908c2ecf20Sopenharmony_ci if (val & BLT_INS_DEI) 918c2ecf20Sopenharmony_ci seq_puts(s, "Deint - "); 928c2ecf20Sopenharmony_ci if (val & BLT_INS_PMASK) 938c2ecf20Sopenharmony_ci seq_puts(s, "PlaneMask - "); 948c2ecf20Sopenharmony_ci if (val & BLT_INS_VC1R) 958c2ecf20Sopenharmony_ci seq_puts(s, "VC1R - "); 968c2ecf20Sopenharmony_ci if (val & BLT_INS_ROTATE) 978c2ecf20Sopenharmony_ci seq_puts(s, "Rotate - "); 988c2ecf20Sopenharmony_ci if (val & BLT_INS_GRAD) 998c2ecf20Sopenharmony_ci seq_puts(s, "GradFill - "); 1008c2ecf20Sopenharmony_ci if (val & BLT_INS_AQLOCK) 1018c2ecf20Sopenharmony_ci seq_puts(s, "AQLock - "); 1028c2ecf20Sopenharmony_ci if (val & BLT_INS_PACE) 1038c2ecf20Sopenharmony_ci seq_puts(s, "Pace - "); 1048c2ecf20Sopenharmony_ci if (val & BLT_INS_IRQ) 1058c2ecf20Sopenharmony_ci seq_puts(s, "IRQ - "); 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 1088c2ecf20Sopenharmony_ci} 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_tty(struct seq_file *s, u32 val) 1118c2ecf20Sopenharmony_ci{ 1128c2ecf20Sopenharmony_ci seq_printf(s, "TTY\t0x%08X\t", val); 1138c2ecf20Sopenharmony_ci seq_printf(s, "Pitch=%d - ", val & 0xFFFF); 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci switch ((val & BLT_TTY_COL_MASK) >> BLT_TTY_COL_SHIFT) { 1168c2ecf20Sopenharmony_ci case BDISP_RGB565: 1178c2ecf20Sopenharmony_ci seq_puts(s, "RGB565 - "); 1188c2ecf20Sopenharmony_ci break; 1198c2ecf20Sopenharmony_ci case BDISP_RGB888: 1208c2ecf20Sopenharmony_ci seq_puts(s, "RGB888 - "); 1218c2ecf20Sopenharmony_ci break; 1228c2ecf20Sopenharmony_ci case BDISP_XRGB8888: 1238c2ecf20Sopenharmony_ci seq_puts(s, "xRGB888 - "); 1248c2ecf20Sopenharmony_ci break; 1258c2ecf20Sopenharmony_ci case BDISP_ARGB8888: 1268c2ecf20Sopenharmony_ci seq_puts(s, "ARGB8888 - "); 1278c2ecf20Sopenharmony_ci break; 1288c2ecf20Sopenharmony_ci case BDISP_NV12: 1298c2ecf20Sopenharmony_ci seq_puts(s, "NV12 - "); 1308c2ecf20Sopenharmony_ci break; 1318c2ecf20Sopenharmony_ci case BDISP_YUV_3B: 1328c2ecf20Sopenharmony_ci seq_puts(s, "YUV420P - "); 1338c2ecf20Sopenharmony_ci break; 1348c2ecf20Sopenharmony_ci default: 1358c2ecf20Sopenharmony_ci seq_puts(s, "ColorFormat ??? - "); 1368c2ecf20Sopenharmony_ci break; 1378c2ecf20Sopenharmony_ci } 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci if (val & BLT_TTY_ALPHA_R) 1408c2ecf20Sopenharmony_ci seq_puts(s, "AlphaRange - "); 1418c2ecf20Sopenharmony_ci if (val & BLT_TTY_CR_NOT_CB) 1428c2ecf20Sopenharmony_ci seq_puts(s, "CrNotCb - "); 1438c2ecf20Sopenharmony_ci if (val & BLT_TTY_MB) 1448c2ecf20Sopenharmony_ci seq_puts(s, "MB - "); 1458c2ecf20Sopenharmony_ci if (val & BLT_TTY_HSO) 1468c2ecf20Sopenharmony_ci seq_puts(s, "HSO inverse - "); 1478c2ecf20Sopenharmony_ci if (val & BLT_TTY_VSO) 1488c2ecf20Sopenharmony_ci seq_puts(s, "VSO inverse - "); 1498c2ecf20Sopenharmony_ci if (val & BLT_TTY_DITHER) 1508c2ecf20Sopenharmony_ci seq_puts(s, "Dither - "); 1518c2ecf20Sopenharmony_ci if (val & BLT_TTY_CHROMA) 1528c2ecf20Sopenharmony_ci seq_puts(s, "Write CHROMA - "); 1538c2ecf20Sopenharmony_ci if (val & BLT_TTY_BIG_END) 1548c2ecf20Sopenharmony_ci seq_puts(s, "BigEndian - "); 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 1578c2ecf20Sopenharmony_ci} 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_xy(struct seq_file *s, u32 val, char *name) 1608c2ecf20Sopenharmony_ci{ 1618c2ecf20Sopenharmony_ci seq_printf(s, "%s\t0x%08X\t", name, val); 1628c2ecf20Sopenharmony_ci seq_printf(s, "(%d,%d)\n", val & 0xFFFF, (val >> 16)); 1638c2ecf20Sopenharmony_ci} 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_sz(struct seq_file *s, u32 val, char *name) 1668c2ecf20Sopenharmony_ci{ 1678c2ecf20Sopenharmony_ci seq_printf(s, "%s\t0x%08X\t", name, val); 1688c2ecf20Sopenharmony_ci seq_printf(s, "%dx%d\n", val & 0x1FFF, (val >> 16) & 0x1FFF); 1698c2ecf20Sopenharmony_ci} 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_sty(struct seq_file *s, 1728c2ecf20Sopenharmony_ci u32 val, u32 addr, char *name) 1738c2ecf20Sopenharmony_ci{ 1748c2ecf20Sopenharmony_ci bool s1, s2, s3; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci seq_printf(s, "%s\t0x%08X\t", name, val); 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci if (!addr || !name || (strlen(name) < 2)) 1798c2ecf20Sopenharmony_ci goto done; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci s1 = name[strlen(name) - 1] == '1'; 1828c2ecf20Sopenharmony_ci s2 = name[strlen(name) - 1] == '2'; 1838c2ecf20Sopenharmony_ci s3 = name[strlen(name) - 1] == '3'; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci seq_printf(s, "Pitch=%d - ", val & 0xFFFF); 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci switch ((val & BLT_TTY_COL_MASK) >> BLT_TTY_COL_SHIFT) { 1888c2ecf20Sopenharmony_ci case BDISP_RGB565: 1898c2ecf20Sopenharmony_ci seq_puts(s, "RGB565 - "); 1908c2ecf20Sopenharmony_ci break; 1918c2ecf20Sopenharmony_ci case BDISP_RGB888: 1928c2ecf20Sopenharmony_ci seq_puts(s, "RGB888 - "); 1938c2ecf20Sopenharmony_ci break; 1948c2ecf20Sopenharmony_ci case BDISP_XRGB8888: 1958c2ecf20Sopenharmony_ci seq_puts(s, "xRGB888 - "); 1968c2ecf20Sopenharmony_ci break; 1978c2ecf20Sopenharmony_ci case BDISP_ARGB8888: 1988c2ecf20Sopenharmony_ci seq_puts(s, "ARGB888 - "); 1998c2ecf20Sopenharmony_ci break; 2008c2ecf20Sopenharmony_ci case BDISP_NV12: 2018c2ecf20Sopenharmony_ci seq_puts(s, "NV12 - "); 2028c2ecf20Sopenharmony_ci break; 2038c2ecf20Sopenharmony_ci case BDISP_YUV_3B: 2048c2ecf20Sopenharmony_ci seq_puts(s, "YUV420P - "); 2058c2ecf20Sopenharmony_ci break; 2068c2ecf20Sopenharmony_ci default: 2078c2ecf20Sopenharmony_ci seq_puts(s, "ColorFormat ??? - "); 2088c2ecf20Sopenharmony_ci break; 2098c2ecf20Sopenharmony_ci } 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci if ((val & BLT_TTY_ALPHA_R) && !s3) 2128c2ecf20Sopenharmony_ci seq_puts(s, "AlphaRange - "); 2138c2ecf20Sopenharmony_ci if ((val & BLT_S1TY_A1_SUBSET) && !s3) 2148c2ecf20Sopenharmony_ci seq_puts(s, "A1SubSet - "); 2158c2ecf20Sopenharmony_ci if ((val & BLT_TTY_MB) && !s1) 2168c2ecf20Sopenharmony_ci seq_puts(s, "MB - "); 2178c2ecf20Sopenharmony_ci if (val & BLT_TTY_HSO) 2188c2ecf20Sopenharmony_ci seq_puts(s, "HSO inverse - "); 2198c2ecf20Sopenharmony_ci if (val & BLT_TTY_VSO) 2208c2ecf20Sopenharmony_ci seq_puts(s, "VSO inverse - "); 2218c2ecf20Sopenharmony_ci if ((val & BLT_S1TY_CHROMA_EXT) && (s1 || s2)) 2228c2ecf20Sopenharmony_ci seq_puts(s, "ChromaExt - "); 2238c2ecf20Sopenharmony_ci if ((val & BLT_S3TY_BLANK_ACC) && s3) 2248c2ecf20Sopenharmony_ci seq_puts(s, "Blank Acc - "); 2258c2ecf20Sopenharmony_ci if ((val & BTL_S1TY_SUBBYTE) && !s3) 2268c2ecf20Sopenharmony_ci seq_puts(s, "SubByte - "); 2278c2ecf20Sopenharmony_ci if ((val & BLT_S1TY_RGB_EXP) && !s3) 2288c2ecf20Sopenharmony_ci seq_puts(s, "RGBExpand - "); 2298c2ecf20Sopenharmony_ci if ((val & BLT_TTY_BIG_END) && !s3) 2308c2ecf20Sopenharmony_ci seq_puts(s, "BigEndian - "); 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cidone: 2338c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 2348c2ecf20Sopenharmony_ci} 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_fctl(struct seq_file *s, u32 val) 2378c2ecf20Sopenharmony_ci{ 2388c2ecf20Sopenharmony_ci seq_printf(s, "FCTL\t0x%08X\t", val); 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci if ((val & BLT_FCTL_Y_HV_SCALE) == BLT_FCTL_Y_HV_SCALE) 2418c2ecf20Sopenharmony_ci seq_puts(s, "Resize Luma - "); 2428c2ecf20Sopenharmony_ci else if ((val & BLT_FCTL_Y_HV_SCALE) == BLT_FCTL_Y_HV_SAMPLE) 2438c2ecf20Sopenharmony_ci seq_puts(s, "Sample Luma - "); 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci if ((val & BLT_FCTL_HV_SCALE) == BLT_FCTL_HV_SCALE) 2468c2ecf20Sopenharmony_ci seq_puts(s, "Resize Chroma"); 2478c2ecf20Sopenharmony_ci else if ((val & BLT_FCTL_HV_SCALE) == BLT_FCTL_HV_SAMPLE) 2488c2ecf20Sopenharmony_ci seq_puts(s, "Sample Chroma"); 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 2518c2ecf20Sopenharmony_ci} 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_rsf(struct seq_file *s, u32 val, char *name) 2548c2ecf20Sopenharmony_ci{ 2558c2ecf20Sopenharmony_ci u32 inc; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci seq_printf(s, "%s\t0x%08X\t", name, val); 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci if (!val) 2608c2ecf20Sopenharmony_ci goto done; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci inc = val & 0xFFFF; 2638c2ecf20Sopenharmony_ci seq_printf(s, "H: %d(6.10) / scale~%dx0.1 - ", inc, 1024 * 10 / inc); 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci inc = val >> 16; 2668c2ecf20Sopenharmony_ci seq_printf(s, "V: %d(6.10) / scale~%dx0.1", inc, 1024 * 10 / inc); 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_cidone: 2698c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 2708c2ecf20Sopenharmony_ci} 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_rzi(struct seq_file *s, u32 val, char *name) 2738c2ecf20Sopenharmony_ci{ 2748c2ecf20Sopenharmony_ci seq_printf(s, "%s\t0x%08X\t", name, val); 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci if (!val) 2778c2ecf20Sopenharmony_ci goto done; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci seq_printf(s, "H: init=%d repeat=%d - ", val & 0x3FF, (val >> 12) & 7); 2808c2ecf20Sopenharmony_ci val >>= 16; 2818c2ecf20Sopenharmony_ci seq_printf(s, "V: init=%d repeat=%d", val & 0x3FF, (val >> 12) & 7); 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cidone: 2848c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 2858c2ecf20Sopenharmony_ci} 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistatic void bdisp_dbg_dump_ivmx(struct seq_file *s, 2888c2ecf20Sopenharmony_ci u32 c0, u32 c1, u32 c2, u32 c3) 2898c2ecf20Sopenharmony_ci{ 2908c2ecf20Sopenharmony_ci seq_printf(s, "IVMX0\t0x%08X\n", c0); 2918c2ecf20Sopenharmony_ci seq_printf(s, "IVMX1\t0x%08X\n", c1); 2928c2ecf20Sopenharmony_ci seq_printf(s, "IVMX2\t0x%08X\n", c2); 2938c2ecf20Sopenharmony_ci seq_printf(s, "IVMX3\t0x%08X\t", c3); 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci if (!c0 && !c1 && !c2 && !c3) { 2968c2ecf20Sopenharmony_ci seq_putc(s, '\n'); 2978c2ecf20Sopenharmony_ci return; 2988c2ecf20Sopenharmony_ci } 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci if ((c0 == bdisp_rgb_to_yuv[0]) && 3018c2ecf20Sopenharmony_ci (c1 == bdisp_rgb_to_yuv[1]) && 3028c2ecf20Sopenharmony_ci (c2 == bdisp_rgb_to_yuv[2]) && 3038c2ecf20Sopenharmony_ci (c3 == bdisp_rgb_to_yuv[3])) { 3048c2ecf20Sopenharmony_ci seq_puts(s, "RGB to YUV\n"); 3058c2ecf20Sopenharmony_ci return; 3068c2ecf20Sopenharmony_ci } 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci if ((c0 == bdisp_yuv_to_rgb[0]) && 3098c2ecf20Sopenharmony_ci (c1 == bdisp_yuv_to_rgb[1]) && 3108c2ecf20Sopenharmony_ci (c2 == bdisp_yuv_to_rgb[2]) && 3118c2ecf20Sopenharmony_ci (c3 == bdisp_yuv_to_rgb[3])) { 3128c2ecf20Sopenharmony_ci seq_puts(s, "YUV to RGB\n"); 3138c2ecf20Sopenharmony_ci return; 3148c2ecf20Sopenharmony_ci } 3158c2ecf20Sopenharmony_ci seq_puts(s, "Unknown conversion\n"); 3168c2ecf20Sopenharmony_ci} 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistatic int last_nodes_show(struct seq_file *s, void *data) 3198c2ecf20Sopenharmony_ci{ 3208c2ecf20Sopenharmony_ci /* Not dumping all fields, focusing on significant ones */ 3218c2ecf20Sopenharmony_ci struct bdisp_dev *bdisp = s->private; 3228c2ecf20Sopenharmony_ci struct bdisp_node *node; 3238c2ecf20Sopenharmony_ci int i = 0; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci if (!bdisp->dbg.copy_node[0]) { 3268c2ecf20Sopenharmony_ci seq_puts(s, "No node built yet\n"); 3278c2ecf20Sopenharmony_ci return 0; 3288c2ecf20Sopenharmony_ci } 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci do { 3318c2ecf20Sopenharmony_ci node = bdisp->dbg.copy_node[i]; 3328c2ecf20Sopenharmony_ci if (!node) 3338c2ecf20Sopenharmony_ci break; 3348c2ecf20Sopenharmony_ci seq_printf(s, "--------\nNode %d:\n", i); 3358c2ecf20Sopenharmony_ci seq_puts(s, "-- General --\n"); 3368c2ecf20Sopenharmony_ci seq_printf(s, "NIP\t0x%08X\n", node->nip); 3378c2ecf20Sopenharmony_ci seq_printf(s, "CIC\t0x%08X\n", node->cic); 3388c2ecf20Sopenharmony_ci bdisp_dbg_dump_ins(s, node->ins); 3398c2ecf20Sopenharmony_ci seq_printf(s, "ACK\t0x%08X\n", node->ack); 3408c2ecf20Sopenharmony_ci seq_puts(s, "-- Target --\n"); 3418c2ecf20Sopenharmony_ci seq_printf(s, "TBA\t0x%08X\n", node->tba); 3428c2ecf20Sopenharmony_ci bdisp_dbg_dump_tty(s, node->tty); 3438c2ecf20Sopenharmony_ci bdisp_dbg_dump_xy(s, node->txy, "TXY"); 3448c2ecf20Sopenharmony_ci bdisp_dbg_dump_sz(s, node->tsz, "TSZ"); 3458c2ecf20Sopenharmony_ci /* Color Fill not dumped */ 3468c2ecf20Sopenharmony_ci seq_puts(s, "-- Source 1 --\n"); 3478c2ecf20Sopenharmony_ci seq_printf(s, "S1BA\t0x%08X\n", node->s1ba); 3488c2ecf20Sopenharmony_ci bdisp_dbg_dump_sty(s, node->s1ty, node->s1ba, "S1TY"); 3498c2ecf20Sopenharmony_ci bdisp_dbg_dump_xy(s, node->s1xy, "S1XY"); 3508c2ecf20Sopenharmony_ci seq_puts(s, "-- Source 2 --\n"); 3518c2ecf20Sopenharmony_ci seq_printf(s, "S2BA\t0x%08X\n", node->s2ba); 3528c2ecf20Sopenharmony_ci bdisp_dbg_dump_sty(s, node->s2ty, node->s2ba, "S2TY"); 3538c2ecf20Sopenharmony_ci bdisp_dbg_dump_xy(s, node->s2xy, "S2XY"); 3548c2ecf20Sopenharmony_ci bdisp_dbg_dump_sz(s, node->s2sz, "S2SZ"); 3558c2ecf20Sopenharmony_ci seq_puts(s, "-- Source 3 --\n"); 3568c2ecf20Sopenharmony_ci seq_printf(s, "S3BA\t0x%08X\n", node->s3ba); 3578c2ecf20Sopenharmony_ci bdisp_dbg_dump_sty(s, node->s3ty, node->s3ba, "S3TY"); 3588c2ecf20Sopenharmony_ci bdisp_dbg_dump_xy(s, node->s3xy, "S3XY"); 3598c2ecf20Sopenharmony_ci bdisp_dbg_dump_sz(s, node->s3sz, "S3SZ"); 3608c2ecf20Sopenharmony_ci /* Clipping not dumped */ 3618c2ecf20Sopenharmony_ci /* CLUT not dumped */ 3628c2ecf20Sopenharmony_ci seq_puts(s, "-- Filter & Mask --\n"); 3638c2ecf20Sopenharmony_ci bdisp_dbg_dump_fctl(s, node->fctl); 3648c2ecf20Sopenharmony_ci /* PMK not dumped */ 3658c2ecf20Sopenharmony_ci seq_puts(s, "-- Chroma Filter --\n"); 3668c2ecf20Sopenharmony_ci bdisp_dbg_dump_rsf(s, node->rsf, "RSF"); 3678c2ecf20Sopenharmony_ci bdisp_dbg_dump_rzi(s, node->rzi, "RZI"); 3688c2ecf20Sopenharmony_ci seq_printf(s, "HFP\t0x%08X\n", node->hfp); 3698c2ecf20Sopenharmony_ci seq_printf(s, "VFP\t0x%08X\n", node->vfp); 3708c2ecf20Sopenharmony_ci seq_puts(s, "-- Luma Filter --\n"); 3718c2ecf20Sopenharmony_ci bdisp_dbg_dump_rsf(s, node->y_rsf, "Y_RSF"); 3728c2ecf20Sopenharmony_ci bdisp_dbg_dump_rzi(s, node->y_rzi, "Y_RZI"); 3738c2ecf20Sopenharmony_ci seq_printf(s, "Y_HFP\t0x%08X\n", node->y_hfp); 3748c2ecf20Sopenharmony_ci seq_printf(s, "Y_VFP\t0x%08X\n", node->y_vfp); 3758c2ecf20Sopenharmony_ci /* Flicker not dumped */ 3768c2ecf20Sopenharmony_ci /* Color key not dumped */ 3778c2ecf20Sopenharmony_ci /* Reserved not dumped */ 3788c2ecf20Sopenharmony_ci /* Static Address & User not dumped */ 3798c2ecf20Sopenharmony_ci seq_puts(s, "-- Input Versatile Matrix --\n"); 3808c2ecf20Sopenharmony_ci bdisp_dbg_dump_ivmx(s, node->ivmx0, node->ivmx1, 3818c2ecf20Sopenharmony_ci node->ivmx2, node->ivmx3); 3828c2ecf20Sopenharmony_ci /* Output Versatile Matrix not dumped */ 3838c2ecf20Sopenharmony_ci /* Pace not dumped */ 3848c2ecf20Sopenharmony_ci /* VC1R & DEI not dumped */ 3858c2ecf20Sopenharmony_ci /* Gradient Fill not dumped */ 3868c2ecf20Sopenharmony_ci } while ((++i < MAX_NB_NODE) && node->nip); 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci return 0; 3898c2ecf20Sopenharmony_ci} 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_cistatic int last_nodes_raw_show(struct seq_file *s, void *data) 3928c2ecf20Sopenharmony_ci{ 3938c2ecf20Sopenharmony_ci struct bdisp_dev *bdisp = s->private; 3948c2ecf20Sopenharmony_ci struct bdisp_node *node; 3958c2ecf20Sopenharmony_ci u32 *val; 3968c2ecf20Sopenharmony_ci int j, i = 0; 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci if (!bdisp->dbg.copy_node[0]) { 3998c2ecf20Sopenharmony_ci seq_puts(s, "No node built yet\n"); 4008c2ecf20Sopenharmony_ci return 0; 4018c2ecf20Sopenharmony_ci } 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci do { 4048c2ecf20Sopenharmony_ci node = bdisp->dbg.copy_node[i]; 4058c2ecf20Sopenharmony_ci if (!node) 4068c2ecf20Sopenharmony_ci break; 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci seq_printf(s, "--------\nNode %d:\n", i); 4098c2ecf20Sopenharmony_ci val = (u32 *)node; 4108c2ecf20Sopenharmony_ci for (j = 0; j < sizeof(struct bdisp_node) / sizeof(u32); j++) 4118c2ecf20Sopenharmony_ci seq_printf(s, "0x%08X\n", *val++); 4128c2ecf20Sopenharmony_ci } while ((++i < MAX_NB_NODE) && node->nip); 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ci return 0; 4158c2ecf20Sopenharmony_ci} 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_cistatic const char *bdisp_fmt_to_str(struct bdisp_frame frame) 4188c2ecf20Sopenharmony_ci{ 4198c2ecf20Sopenharmony_ci switch (frame.fmt->pixelformat) { 4208c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_YUV420: 4218c2ecf20Sopenharmony_ci return "YUV420P"; 4228c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV12: 4238c2ecf20Sopenharmony_ci if (frame.field == V4L2_FIELD_INTERLACED) 4248c2ecf20Sopenharmony_ci return "NV12 interlaced"; 4258c2ecf20Sopenharmony_ci else 4268c2ecf20Sopenharmony_ci return "NV12"; 4278c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_RGB565: 4288c2ecf20Sopenharmony_ci return "RGB16"; 4298c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_RGB24: 4308c2ecf20Sopenharmony_ci return "RGB24"; 4318c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_XBGR32: 4328c2ecf20Sopenharmony_ci return "XRGB"; 4338c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_ABGR32: 4348c2ecf20Sopenharmony_ci return "ARGB"; 4358c2ecf20Sopenharmony_ci default: 4368c2ecf20Sopenharmony_ci return "????"; 4378c2ecf20Sopenharmony_ci } 4388c2ecf20Sopenharmony_ci} 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_cistatic int last_request_show(struct seq_file *s, void *data) 4418c2ecf20Sopenharmony_ci{ 4428c2ecf20Sopenharmony_ci struct bdisp_dev *bdisp = s->private; 4438c2ecf20Sopenharmony_ci struct bdisp_request *request = &bdisp->dbg.copy_request; 4448c2ecf20Sopenharmony_ci struct bdisp_frame src, dst; 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci if (!request->nb_req) { 4478c2ecf20Sopenharmony_ci seq_puts(s, "No request\n"); 4488c2ecf20Sopenharmony_ci return 0; 4498c2ecf20Sopenharmony_ci } 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci src = request->src; 4528c2ecf20Sopenharmony_ci dst = request->dst; 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci seq_printf(s, "\nRequest #%d\n", request->nb_req); 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci seq_printf(s, "Format: %s\t\t\t%s\n", 4578c2ecf20Sopenharmony_ci bdisp_fmt_to_str(src), bdisp_fmt_to_str(dst)); 4588c2ecf20Sopenharmony_ci seq_printf(s, "Crop area: %dx%d @ %d,%d ==>\t%dx%d @ %d,%d\n", 4598c2ecf20Sopenharmony_ci src.crop.width, src.crop.height, 4608c2ecf20Sopenharmony_ci src.crop.left, src.crop.top, 4618c2ecf20Sopenharmony_ci dst.crop.width, dst.crop.height, 4628c2ecf20Sopenharmony_ci dst.crop.left, dst.crop.top); 4638c2ecf20Sopenharmony_ci seq_printf(s, "Buff size: %dx%d\t\t%dx%d\n\n", 4648c2ecf20Sopenharmony_ci src.width, src.height, dst.width, dst.height); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci if (request->hflip) 4678c2ecf20Sopenharmony_ci seq_puts(s, "Horizontal flip\n\n"); 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci if (request->vflip) 4708c2ecf20Sopenharmony_ci seq_puts(s, "Vertical flip\n\n"); 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci return 0; 4738c2ecf20Sopenharmony_ci} 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_ci#define DUMP(reg) seq_printf(s, #reg " \t0x%08X\n", readl(bdisp->regs + reg)) 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_cistatic int regs_show(struct seq_file *s, void *data) 4788c2ecf20Sopenharmony_ci{ 4798c2ecf20Sopenharmony_ci struct bdisp_dev *bdisp = s->private; 4808c2ecf20Sopenharmony_ci int ret; 4818c2ecf20Sopenharmony_ci unsigned int i; 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ci ret = pm_runtime_resume_and_get(bdisp->dev); 4848c2ecf20Sopenharmony_ci if (ret < 0) { 4858c2ecf20Sopenharmony_ci seq_puts(s, "Cannot wake up IP\n"); 4868c2ecf20Sopenharmony_ci return 0; 4878c2ecf20Sopenharmony_ci } 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci seq_printf(s, "Reg @ = 0x%p\n", bdisp->regs); 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci seq_puts(s, "\nStatic:\n"); 4928c2ecf20Sopenharmony_ci DUMP(BLT_CTL); 4938c2ecf20Sopenharmony_ci DUMP(BLT_ITS); 4948c2ecf20Sopenharmony_ci DUMP(BLT_STA1); 4958c2ecf20Sopenharmony_ci DUMP(BLT_AQ1_CTL); 4968c2ecf20Sopenharmony_ci DUMP(BLT_AQ1_IP); 4978c2ecf20Sopenharmony_ci DUMP(BLT_AQ1_LNA); 4988c2ecf20Sopenharmony_ci DUMP(BLT_AQ1_STA); 4998c2ecf20Sopenharmony_ci DUMP(BLT_ITM0); 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_ci seq_puts(s, "\nPlugs:\n"); 5028c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS1_OP2); 5038c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS1_CHZ); 5048c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS1_MSZ); 5058c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS1_PGZ); 5068c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS2_OP2); 5078c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS2_CHZ); 5088c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS2_MSZ); 5098c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS2_PGZ); 5108c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS3_OP2); 5118c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS3_CHZ); 5128c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS3_MSZ); 5138c2ecf20Sopenharmony_ci DUMP(BLT_PLUGS3_PGZ); 5148c2ecf20Sopenharmony_ci DUMP(BLT_PLUGT_OP2); 5158c2ecf20Sopenharmony_ci DUMP(BLT_PLUGT_CHZ); 5168c2ecf20Sopenharmony_ci DUMP(BLT_PLUGT_MSZ); 5178c2ecf20Sopenharmony_ci DUMP(BLT_PLUGT_PGZ); 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci seq_puts(s, "\nNode:\n"); 5208c2ecf20Sopenharmony_ci DUMP(BLT_NIP); 5218c2ecf20Sopenharmony_ci DUMP(BLT_CIC); 5228c2ecf20Sopenharmony_ci DUMP(BLT_INS); 5238c2ecf20Sopenharmony_ci DUMP(BLT_ACK); 5248c2ecf20Sopenharmony_ci DUMP(BLT_TBA); 5258c2ecf20Sopenharmony_ci DUMP(BLT_TTY); 5268c2ecf20Sopenharmony_ci DUMP(BLT_TXY); 5278c2ecf20Sopenharmony_ci DUMP(BLT_TSZ); 5288c2ecf20Sopenharmony_ci DUMP(BLT_S1BA); 5298c2ecf20Sopenharmony_ci DUMP(BLT_S1TY); 5308c2ecf20Sopenharmony_ci DUMP(BLT_S1XY); 5318c2ecf20Sopenharmony_ci DUMP(BLT_S2BA); 5328c2ecf20Sopenharmony_ci DUMP(BLT_S2TY); 5338c2ecf20Sopenharmony_ci DUMP(BLT_S2XY); 5348c2ecf20Sopenharmony_ci DUMP(BLT_S2SZ); 5358c2ecf20Sopenharmony_ci DUMP(BLT_S3BA); 5368c2ecf20Sopenharmony_ci DUMP(BLT_S3TY); 5378c2ecf20Sopenharmony_ci DUMP(BLT_S3XY); 5388c2ecf20Sopenharmony_ci DUMP(BLT_S3SZ); 5398c2ecf20Sopenharmony_ci DUMP(BLT_FCTL); 5408c2ecf20Sopenharmony_ci DUMP(BLT_RSF); 5418c2ecf20Sopenharmony_ci DUMP(BLT_RZI); 5428c2ecf20Sopenharmony_ci DUMP(BLT_HFP); 5438c2ecf20Sopenharmony_ci DUMP(BLT_VFP); 5448c2ecf20Sopenharmony_ci DUMP(BLT_Y_RSF); 5458c2ecf20Sopenharmony_ci DUMP(BLT_Y_RZI); 5468c2ecf20Sopenharmony_ci DUMP(BLT_Y_HFP); 5478c2ecf20Sopenharmony_ci DUMP(BLT_Y_VFP); 5488c2ecf20Sopenharmony_ci DUMP(BLT_IVMX0); 5498c2ecf20Sopenharmony_ci DUMP(BLT_IVMX1); 5508c2ecf20Sopenharmony_ci DUMP(BLT_IVMX2); 5518c2ecf20Sopenharmony_ci DUMP(BLT_IVMX3); 5528c2ecf20Sopenharmony_ci DUMP(BLT_OVMX0); 5538c2ecf20Sopenharmony_ci DUMP(BLT_OVMX1); 5548c2ecf20Sopenharmony_ci DUMP(BLT_OVMX2); 5558c2ecf20Sopenharmony_ci DUMP(BLT_OVMX3); 5568c2ecf20Sopenharmony_ci DUMP(BLT_DEI); 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci seq_puts(s, "\nFilter:\n"); 5598c2ecf20Sopenharmony_ci for (i = 0; i < BLT_NB_H_COEF; i++) { 5608c2ecf20Sopenharmony_ci seq_printf(s, "BLT_HFC%d \t0x%08X\n", i, 5618c2ecf20Sopenharmony_ci readl(bdisp->regs + BLT_HFC_N + i * 4)); 5628c2ecf20Sopenharmony_ci } 5638c2ecf20Sopenharmony_ci for (i = 0; i < BLT_NB_V_COEF; i++) { 5648c2ecf20Sopenharmony_ci seq_printf(s, "BLT_VFC%d \t0x%08X\n", i, 5658c2ecf20Sopenharmony_ci readl(bdisp->regs + BLT_VFC_N + i * 4)); 5668c2ecf20Sopenharmony_ci } 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci seq_puts(s, "\nLuma filter:\n"); 5698c2ecf20Sopenharmony_ci for (i = 0; i < BLT_NB_H_COEF; i++) { 5708c2ecf20Sopenharmony_ci seq_printf(s, "BLT_Y_HFC%d \t0x%08X\n", i, 5718c2ecf20Sopenharmony_ci readl(bdisp->regs + BLT_Y_HFC_N + i * 4)); 5728c2ecf20Sopenharmony_ci } 5738c2ecf20Sopenharmony_ci for (i = 0; i < BLT_NB_V_COEF; i++) { 5748c2ecf20Sopenharmony_ci seq_printf(s, "BLT_Y_VFC%d \t0x%08X\n", i, 5758c2ecf20Sopenharmony_ci readl(bdisp->regs + BLT_Y_VFC_N + i * 4)); 5768c2ecf20Sopenharmony_ci } 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci pm_runtime_put(bdisp->dev); 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci return 0; 5818c2ecf20Sopenharmony_ci} 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_ci#define SECOND 1000000 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_cistatic int perf_show(struct seq_file *s, void *data) 5868c2ecf20Sopenharmony_ci{ 5878c2ecf20Sopenharmony_ci struct bdisp_dev *bdisp = s->private; 5888c2ecf20Sopenharmony_ci struct bdisp_request *request = &bdisp->dbg.copy_request; 5898c2ecf20Sopenharmony_ci s64 avg_time_us; 5908c2ecf20Sopenharmony_ci int avg_fps, min_fps, max_fps, last_fps; 5918c2ecf20Sopenharmony_ci 5928c2ecf20Sopenharmony_ci if (!request->nb_req) { 5938c2ecf20Sopenharmony_ci seq_puts(s, "No request\n"); 5948c2ecf20Sopenharmony_ci return 0; 5958c2ecf20Sopenharmony_ci } 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci avg_time_us = div64_s64(bdisp->dbg.tot_duration, request->nb_req); 5988c2ecf20Sopenharmony_ci if (avg_time_us > SECOND) 5998c2ecf20Sopenharmony_ci avg_fps = 0; 6008c2ecf20Sopenharmony_ci else 6018c2ecf20Sopenharmony_ci avg_fps = SECOND / (s32)avg_time_us; 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci if (bdisp->dbg.min_duration > SECOND) 6048c2ecf20Sopenharmony_ci min_fps = 0; 6058c2ecf20Sopenharmony_ci else 6068c2ecf20Sopenharmony_ci min_fps = SECOND / (s32)bdisp->dbg.min_duration; 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_ci if (bdisp->dbg.max_duration > SECOND) 6098c2ecf20Sopenharmony_ci max_fps = 0; 6108c2ecf20Sopenharmony_ci else 6118c2ecf20Sopenharmony_ci max_fps = SECOND / (s32)bdisp->dbg.max_duration; 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci if (bdisp->dbg.last_duration > SECOND) 6148c2ecf20Sopenharmony_ci last_fps = 0; 6158c2ecf20Sopenharmony_ci else 6168c2ecf20Sopenharmony_ci last_fps = SECOND / (s32)bdisp->dbg.last_duration; 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci seq_printf(s, "HW processing (%d requests):\n", request->nb_req); 6198c2ecf20Sopenharmony_ci seq_printf(s, " Average: %5lld us (%3d fps)\n", 6208c2ecf20Sopenharmony_ci avg_time_us, avg_fps); 6218c2ecf20Sopenharmony_ci seq_printf(s, " Min-Max: %5lld us (%3d fps) - %5lld us (%3d fps)\n", 6228c2ecf20Sopenharmony_ci bdisp->dbg.min_duration, min_fps, 6238c2ecf20Sopenharmony_ci bdisp->dbg.max_duration, max_fps); 6248c2ecf20Sopenharmony_ci seq_printf(s, " Last: %5lld us (%3d fps)\n", 6258c2ecf20Sopenharmony_ci bdisp->dbg.last_duration, last_fps); 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci return 0; 6288c2ecf20Sopenharmony_ci} 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci#define bdisp_dbg_create_entry(name) \ 6318c2ecf20Sopenharmony_ci debugfs_create_file(#name, S_IRUGO, bdisp->dbg.debugfs_entry, bdisp, \ 6328c2ecf20Sopenharmony_ci &name##_fops) 6338c2ecf20Sopenharmony_ci 6348c2ecf20Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(regs); 6358c2ecf20Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(last_nodes); 6368c2ecf20Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(last_nodes_raw); 6378c2ecf20Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(last_request); 6388c2ecf20Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(perf); 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_civoid bdisp_debugfs_create(struct bdisp_dev *bdisp) 6418c2ecf20Sopenharmony_ci{ 6428c2ecf20Sopenharmony_ci char dirname[16]; 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_ci snprintf(dirname, sizeof(dirname), "%s%d", BDISP_NAME, bdisp->id); 6458c2ecf20Sopenharmony_ci bdisp->dbg.debugfs_entry = debugfs_create_dir(dirname, NULL); 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ci bdisp_dbg_create_entry(regs); 6488c2ecf20Sopenharmony_ci bdisp_dbg_create_entry(last_nodes); 6498c2ecf20Sopenharmony_ci bdisp_dbg_create_entry(last_nodes_raw); 6508c2ecf20Sopenharmony_ci bdisp_dbg_create_entry(last_request); 6518c2ecf20Sopenharmony_ci bdisp_dbg_create_entry(perf); 6528c2ecf20Sopenharmony_ci} 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_civoid bdisp_debugfs_remove(struct bdisp_dev *bdisp) 6558c2ecf20Sopenharmony_ci{ 6568c2ecf20Sopenharmony_ci debugfs_remove_recursive(bdisp->dbg.debugfs_entry); 6578c2ecf20Sopenharmony_ci bdisp->dbg.debugfs_entry = NULL; 6588c2ecf20Sopenharmony_ci} 659