1 /*
2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19 #include "drv_hdmi_proc.h"
20 #include "hdmi_osal.h"
21 #include "drv_hdmi_intf.h"
22 #include "drv_hdmi_common.h"
23 #include "drv_hdmi_event.h"
24 #include "drv_hdmi_edid.h"
25 #include "drv_hdmi_compatibility.h"
26
27 #define PROC_FEILD_RATE_DEVIATION 50
28 #define PROC_PIXL_FREQ_DEVIATION 100
29 #define HDMI_VIC_PC_BASE ((HDMI_VIC_VIRTUAL_BASE) + 0x100)
30 #define STR_YES "YES"
31 #define STR_NO "NO"
32 #define STR_NA "N/A"
33 #define STR_ERROR "ERROR"
34 #define STR_RUN "RUN"
35 #define STR_STOP "STOP"
36 #define STR_ON "ON"
37 #define STR_OFF "OFF"
38 #define STR_LINE_COUNT 8
39 #define STR_LEN_SUPERADDITION 4
40 #define PROC_LENGTH_SIZE 21
41 #define PROC_ONE_LINE_STR_COUNT 4
42 #define PROC_TEMP_STR_LEN 25
43
44 typedef union {
45 struct {
46 hi_u8 scan_info : 2; // [0..1]
47 hi_u8 bar_data_present : 2; // [2..3]
48 hi_u8 act_fmt_info_present : 1; // [5]
49 hi_u8 color_space : 3; // [6..7]
50 } bits;
51 hi_u8 u8;
52 } hdmi_avi_info_byte1;
53
54 typedef union {
55 struct {
56 hi_u8 act_asp_ratio : 4; // [0..3]
57 hi_u8 picture_aspect_ratio : 2; // [4..5]
58 hi_u8 colorimetry : 2; // [6..7]
59 } bits;
60 hi_u8 u8;
61 } hdmi_avi_info_byte2;
62
63 typedef union {
64 struct {
65 hi_u8 picture_scaling : 2; // [0..1]
66 hi_u8 rgb_quantization : 2; // [2..3]
67 hi_u8 ext_colorimetry : 3; // [4..6]
68 hi_u8 it_content_valid : 1; // [7]
69 } bits;
70 hi_u8 u8;
71 } hdmi_avi_info_byte3;
72
73 typedef union {
74 struct {
75 hi_u8 pixel_repetition : 4; // [0..3]
76 hi_u8 it_content_type : 2; // [4..5]
77 hi_u8 ycc_quantization_range : 2; // [6..7]
78 } bits;
79 hi_u8 u8;
80 } hdmi_avi_info_byte5;
81
82 typedef union {
83 struct {
84 hi_u8 audio_chanel_cnt : 3; // [0..2]
85 hi_u8 f13 : 1; // [3]
86 hi_u8 audio_coding_type : 4; // [4..7]
87 } bits;
88 hi_u8 u8;
89 } hdmi_audio_info_byte1;
90
91 typedef union {
92 struct {
93 hi_u8 audio_samping_size : 2; // [0..1]
94 hi_u8 audio_samping_freq : 3; // [2..4]
95 hi_u8 f25to_f27 : 3; // [5..7]
96 } bits;
97 hi_u8 u8;
98 } hdmi_audio_info_byte2;
99
100 /* EIA-CEA-861-F P66 */
101 typedef union {
102 struct {
103 hi_u8 lfe_play_back : 2; // [0..1]
104 hi_u8 f52 : 1; // [2]
105 hi_u8 level_shift_value : 4; // [3..6]
106 hi_u8 down_mix_inhibit : 1; // [7]
107 } bits;
108 hi_u8 u8;
109 } hdmi_audio_info_byte5;
110
111 typedef struct {
112 hi_u32 vic;
113 hi_u32 pixl_freq; /* khz */
114 hi_u32 hor_active;
115 hi_u32 ver_active;
116 hi_u32 field_rate; /* 0.01hz */
117 hi_char *format;
118 } hdmi_fmt_name_param;
119
120 static const hi_char *g_deep_color[] = { "24", "30", "36", "48", "OFF", "UNKNOWN" };
121 static const hi_char *g_scan_info_str[] = { "NONE", "OVER_SCAN", "UNDERS_SCAN", "Reserved" };
122 static const hi_char *g_dither_mode_str[] = { "12_10", "12_8", "10_8", "disable" };
123 static const hi_char *g_lfe_playback_str[] = { "UNKNOWN", "0 dB", "+10 dB", "Reserved" };
124 static const hi_char *g_audio_chn_str[] = { "STR_HEADER", "2_CH", "3_CH", "4_CH", "5_CH", "6_CH", "7_CH", "8_CH" };
125 static const hi_char *g_run_state_str[] = { "INIT", "OPEN", "START", "STOP", "CLOSE", "DEINIT" };
126 static const hi_char *g_tmds_mode_str[] = { "NONE", "DVI", "HDMI1.4", "HDMI2.0", "AUTO", "HDMI2.1", "UNKNOWN" };
127 static const hi_char *g_color_space_str[] = { "RGB", "YCbCr422", "YCbCr444", "YCbCr420", "UNKNOWN" };
128 static const hi_char *g_sound_intf_str[] = { "I2S", "SPDIF", "HBRA", "UNKNOWN" };
129 static const hi_char *g_colorimetry_str[] = { "No Data", "SMPTE 170M", "ITU-R BT.709", "Extended" };
130 static const hi_char *g_bit_depth_str[] = { "08 Bit", "10 Bit", "12 Bit", "16 Bit", "08 Bit", "UNKNOWN" };
131 static const hi_char *g_deep_color_str[] = { "24 Bit", "30 Bit", "36 Bit", "48 Bit", "24 Bit(OFF)", "UNKNOWN" };
132
133 static const hi_char *g_default_action_str[] = { "NONE", "HDMI", "DVI", "UNKNOWN" };
134 static const hi_char *g_transition_sate_str[] = { "BOOT->MCE", "MCE->APP", "BOOT->APP" };
135 static const hi_char *g_picture_scaling_str[] = { "UNKNOWN", "HpVn", "HnVp ", "HpVp" };
136 static const hi_char *g_rgb_quantization_str[] = { "DEFAULT", "LIMITED", "FULL", "UNKNOWN" };
137 static const hi_char *g_pic_aspect_ratio_str[] = { "NONE", "4:3", "16:9", "64:27", "256:135", "FUTURE", "UNKNOWN" };
138 static const hi_char *g_bar_data_present_str[] = { "NONE", "HnVp", "HpVn", "HpVp" };
139 static const hi_char *g_it_content_type_str[] = { "GRAPHICS", "PHOTO", "CINEMA", "GAME" };
140 static const hi_char *g_ycc_quantization_str[] = { "LIMITED", "FULL", "UNKNOWN", "UNKNOWN" };
141 static const hi_char *g_audio_samping_size_str[] = { "STR_HEADER", "16 bit", "20 bit", "24 bit" };
142
143 static const hi_char *g_act_aspect_ratio_str[] = {
144 "Reserved",
145 "Reserved",
146 "16:9_TOP",
147 "14:9_TOP",
148 "16:9_CENTER",
149 "Reserved",
150 "Reserved",
151 "Reserved",
152 "PICTURE",
153 "4:3",
154 "16:9",
155 "14:9",
156 "Reserved",
157 "4:3_SP_14_9",
158 "16:9_SP_14_9",
159 "16:9_SP_4_3",
160 "UNKNOWN"
161 };
162
163 static const hi_char *g_pixel_repetition_str[] = {
164 "No Repetition",
165 "2 Times",
166 "3 Times",
167 "4 Times",
168 "5 Times",
169 "6 Times",
170 "7 Times",
171 "8 Times",
172 "9 Times",
173 "10 Times",
174 "Reserved",
175 "Reserved",
176 "Reserved",
177 "Reserved",
178 "Reserved",
179 "Reserved"
180 };
181
182 static const hi_char *g_audio_code_type_str[] = {
183 "STREAM",
184 "L-PCM",
185 "AC3",
186 "MPEG1",
187 "MP3",
188 "MPEG2",
189 "AAC_LC",
190 "DTS",
191 "ATRAC",
192 "OneBitAudio",
193 "EAC3",
194 "DTS-HD",
195 "MAT",
196 "DST",
197 "WMA_PRO",
198 "Reserved",
199 "UNKNOWN"
200 };
201
202 static const hi_char *g_audio_samping_freq_str[] = {
203 "STR_HEADER",
204 "32 KHz",
205 "44.1 kHz",
206 "48 KHz",
207 "88.2 KHz",
208 "96 KHz",
209 "176.4 KHz",
210 "192 KHz"
211 };
212
213 static const hi_char *g_ext_colorimetry_str[] = {
214 "XV_YCC601",
215 "XV_YCC709",
216 "S_YCC601",
217 "ADOBE_YCC601",
218 "ADOBE_RGB",
219 "BT2020_cYCC",
220 "BT2020_RGB/YCC",
221 "ADDITIONAL",
222 "UNKNOWN"
223 };
224
225 static const hi_char *g_str_speaker_str[] = {
226 "FL_FR",
227 "LFE",
228 "FC",
229 "RL_RR",
230 "RC",
231 "FLC_FRC",
232 "RLC_RRC",
233 "FLW_FRW",
234 "FLH_FRH",
235 "TC",
236 "FCH",
237 "UNKNOWN"
238 };
239
240 static const hi_char *g_stere_mode_str[] = {
241 "FRAME_PACK", /* 3d type:Frame Packing */
242 "FIELD_ALTER", /* 3d type:Field alternative */
243 "LINE_ALTERN", /* 3d type:Line alternative */
244 "SBS_FULL", /* 3d type:Side by side full */
245 "L_DEPTH", /* 3d type:L+depth */
246 "L_DEPTH_GGD", /* 3d type:L+depth+Graphics+Graphics-depth */
247 "TAndB", /* 3d type:Top and Bottom */
248 "Reserved",
249 "SByS_HALF", /* HDMI_EDID_3D_SIDE_BY_SIDE_HALF */
250 "NONE" /* HDMI_3D_BUTT */
251 };
252
253 static const hi_char *g_estab_timing_str[] = {
254 "V800X600_60",
255 "V800X600_56",
256 "V640X480_75",
257 "V640X480_72",
258 "V640X480_67",
259 "V640X480_60",
260 "V720X400_88",
261 "V720X400_70",
262 "V1280X1024_75",
263 "V1024X768_75",
264 "V1024X768_70",
265 "V1024X768_60",
266 "V1024X768_87",
267 "V832X624_75",
268 "V800X600_75",
269 "V800X600_72",
270 "V1152X870_75",
271 "UNKNOWN"
272 };
273
274 static const hi_char *g_disp_fmt_str[] = {
275 "1080P@60",
276 "1080P@50",
277 "1080P@30",
278 "1080P@25",
279 "1080P@24",
280 "1080I@60",
281 "1080I@50",
282 "720P@60",
283 "720P@50",
284 "576P@50",
285 "480P@60",
286 "PAL",
287 "PAL_N",
288 "PAL_NC",
289 "NTSC",
290 "NTSC_J",
291 "PAL_M",
292 "SECAM_SIN",
293 "SECAM_COS",
294 "640X480@60",
295 "800X600@60",
296 "1024X768@60",
297 "1280X720@60",
298 "1280X800@60",
299 "1280X1024@60",
300 "1366X768@60",
301 "1440X900@60",
302 "1440X900@60_RB",
303 "1600X900@60_RB",
304 "1600X1200@60",
305 "1680X1050@60",
306 "1920X1080@60",
307 "1920X1200@60",
308 "2048X1152@60",
309 "2560x1440@30",
310 "2560x1440@60",
311 "2560x1600@60",
312 "1920x2160@30",
313 "3840X2160P@24",
314 "3840X2160P@25",
315 "3840X2160P@30",
316 "3840X2160P@50",
317 "3840X2160P@60",
318 "4096X2160P@24",
319 "4096X2160P@25",
320 "4096X2160P@30",
321 "4096X2160P@50",
322 "4096X2160P@60",
323 "3840X2160P@120",
324 "4096X2160P@120",
325 "7680X4320P@30",
326 "CUSTOMER_DEFINE",
327 "FMT_UNKNOWN"
328 };
329
330 static const hi_char *g_audio_channel_str[] = {
331 "Reserved",
332 "Reserved",
333 "2_CH",
334 "3_CH",
335 "4_CH",
336 "5_CH",
337 "6_CH",
338 "7_CH",
339 "8_CH",
340 "UNKNOWN"
341 };
342
343 #ifdef HDMI_HDR_SUPPORT
344 static const hi_char *g_hdr_user_mode_str[] = { "SDR", "HDR10", "HLG", "DOLBY", "UNKNOWN" };
345 static const hi_char *g_hdr_debug_mode_str[] = { "DISABLE", "OE", "AVMUTE", "UNKNOWN" };
346 static const hi_char *g_hdr_eotf_type_str[] = { "SDR_LUMIN", "HDR_LUMIN", "SMPTE_ST_2084", "HLG", "FUTURE", "UNKNOWN" };
347
348 static const hi_char *g_hdr_mode_str[] = {
349 "DISABLE",
350 "DOLBY_NORMAL",
351 "DOLBY_TUNNELING",
352 "HDR",
353 "HDR_AUTHEN",
354 "UNKNOWN"
355 };
356
357 static const hi_char *g_hdr_colorimetry_str[] = {
358 "NONE",
359 "ITU_601",
360 "ITU_709",
361 "EXTENDED",
362 "XV_YCC_601",
363 "XV_YCC_709",
364 "S_YCC_601",
365 "ADOBE_YCC_601",
366 "ADOBE_RGB",
367 "2020_const_luminous",
368 "2020_nconst_luminous"
369 };
370 #endif
371
372 #ifdef HDMI_FRL_SUPPORT
373 static const hi_char *g_train_status_str[] = { "NONE", "FAIL", "SUCCESS", "BUSY", "BUTT" };
374 static const hi_char *g_rate_sel_str[] = { "LITTLE", "BIG", "BUTT" };
375 static const hi_char *g_frl_sratepy_str[] = { ">600M", ">340M", "N-INTR", "BUTT" };
376 static const hi_char *g_work_mode_str[] = { "NONE", "3L3G", "3L6G", "4L6G", "4L8G", "4L10G", "4L12G", "BUTT" };
377 static const hi_char *g_frl_mach_mode_str[] = { "Step", "Timeout", "BUTT" };
378 static const hi_char *g_frl_rate_str[] = { "NONE", "3L3G", "3L6G", "4L6G", "4L8G", "4L10G", "4L12G", "BUTT" };
379 static const hi_char *g_frl_sw_train_mode_str[] = { "Delay", "Timer", "BUTT" };
380
381 static const hi_char *g_train_mach_str[] = {
382 "ReadyCheck",
383 "TrainStart",
384 "ResultChk",
385 "RateChange",
386 "ResultHan",
387 "RetrainChk",
388 "Stop",
389 "BUTT"
390 };
391 #endif
392
393 static const hdmi_fmt_name_param g_fmt_param[] = {
394 /* VIC pix_ffeq HACT VACT fld_rate fmt */
395 { 1, 25175, 640, 480, 6000, "640X480_60 4:3" },
396 { 2, 27000, 720, 480, 6000, "480P_60 4:3" },
397 { 3, 27000, 720, 480, 6000, "480P_60 16:9" },
398 { 4, 74170, 1280, 720, 6000, "720P_60 16:9" },
399 { 5, 74170, 1920, 1080, 6000, "1080i_60 16:9" },
400 { 6, 27000, 720, 480, 6000, "NTSC 4:3" },
401 { 7, 27000, 720, 480, 6000, "NTSC 16:9" },
402 { 8, 27000, 1440, 240, 6000, "240P_60 4:3" },
403 { 9, 27000, 1440, 240, 6000, "240P_60 16:9" },
404 { 10, 54000, 720, 480, 6000, "2880_x480i_60 4:3" },
405 { 11, 54000, 720, 480, 6000, "2880_x480i_60 16:9" },
406 { 12, 54000, 2880, 240, 6000, "2880X240P_60 4:3" },
407 { 13, 54000, 2880, 240, 6000, "2880X240P_60 16:9" },
408 { 14, 54000, 1440, 480, 6000, "1440X480P_60 4:3" },
409 { 15, 54000, 1440, 480, 6000, "1440X480P_60 16:9" },
410 { 16, 148500, 1920, 1080, 6000, "1080P_60 16:9" },
411 { 17, 27000, 720, 576, 5000, "576P_50 4:3" },
412 { 18, 27000, 720, 576, 5000, "576P_50 16:9" },
413 { 19, 74250, 1280, 720, 5000, "720P_50 16:9" },
414 { 20, 74250, 1920, 1080, 5000, "1080i_50 16:9" },
415 { 21, 27000, 1440, 576, 5000, "PAL 4:3" },
416 { 22, 27000, 1440, 576, 5000, "PAL 16:9" },
417 { 31, 148500, 1920, 1080, 5000, "1080P_50 16:9" },
418 { 32, 74250, 1920, 1080, 2400, "1080P_24 16:9" },
419 { 33, 74250, 1920, 1080, 2500, "1080P_25 16:9" },
420 { 34, 74250, 1920, 1080, 3000, "1080P_30 16:9" },
421 { 60, 59400, 1280, 720, 2400, "720P_24 16:9" },
422 { 61, 74250, 1280, 720, 2500, "720P_25 16:9" },
423 { 62, 74250, 1280, 720, 3000, "720P_30 16:9" },
424 { 93, 297000, 3840, 2160, 2400, "3840X2160P24 16:9" },
425 { 94, 297000, 3840, 2160, 2500, "3840X2160P25 16:9" },
426 { 95, 297000, 3840, 2160, 3000, "3840X2160P30 16:9" },
427 { 96, 594000, 3840, 2160, 5000, "3840X2160P50 16:9" },
428 { 97, 594000, 3840, 2160, 6000, "3840X2160P60 16:9" },
429 { 98, 297000, 4096, 2160, 2400, "4096X2160P24 256:135" },
430 { 99, 297000, 4096, 2160, 2500, "4096X2160P25 256:135" },
431 { 100, 297000, 4096, 2160, 3000, "4096X2160P30 256:135" },
432 { 101, 594000, 4096, 2160, 5000, "4096X2160P50 256:135" },
433 { 102, 594000, 4096, 2160, 6000, "4096X2160P60 256:135" },
434 { 103, 297000, 3840, 2160, 2400, "3840X2160P24 64:27" },
435 { 104, 297000, 3840, 2160, 2500, "3840X2160P25 64:27" },
436 { 105, 297000, 3840, 2160, 3000, "3840X2160P30 64:27" },
437 { 106, 594000, 3840, 2160, 5000, "3840X2160P50 64:27" },
438 { 107, 594000, 3840, 2160, 6000, "3840X2160P60 64:27" },
439 { 194, 1188000, 7680, 4320, 2400, "7680X4320P24 16:9" },
440 { 195, 1188000, 7680, 4320, 2500, "7680X4320P25 16:9" },
441 { 196, 1188000, 7680, 4320, 3000, "7680X4320P30 16:9" },
442 { 198, 2376000, 7680, 4320, 5000, "7680X4320P50 16:9" },
443 { 199, 2376000, 7680, 4320, 6000, "7680X4320P60 16:9" },
444 #ifdef DVI_SUPPORT
445 { HDMI_VIC_PC_BASE + 9, 40000, 800, 600, 6000, "800X600_60" },
446 { HDMI_VIC_PC_BASE + 13, 65000, 1024, 768, 6000, "1024X768_60" },
447 { HDMI_VIC_PC_BASE + 18, 162000, 1600, 1200, 6000, "1600X1200_60" },
448 { HDMI_VIC_PC_BASE + 25, 108000, 1280, 1024, 6000, "1280X1024_60" },
449 { HDMI_VIC_PC_BASE + 28, 85500, 1360, 768, 6000, "1366X768_60" },
450 { HDMI_VIC_PC_BASE + 41, 154000, 1920, 1200, 6000, "1920X1200_60" },
451 #endif
452 /* for 2k & 4k ,we use VIRTUAL VIC */
453 { HDMI_EDID_VIRTUAL_VIC_3840X2160_30, 297000, 3840, 2160, 3000, "3840X2160P_30" },
454 { HDMI_EDID_VIRTUAL_VIC_3840X2160_25, 297000, 3840, 2160, 2500, "3840X2160P_25" },
455 { HDMI_EDID_VIRTUAL_VIC_3840X2160_24, 297000, 3840, 2160, 2400, "3840X2160P_24" },
456 { HDMI_EDID_VIRTUAL_VIC_4096X2160_24, 297000, 4096, 2160, 2400, "4096X2160P_24" }
457 };
458
459 static const hi_char *g_sz_version = "HDMI version: " MAKE_VERSION;
460
proc_vicformat(hi_u32 vic)461 static hi_char *proc_vicformat(hi_u32 vic)
462 {
463 hi_u32 i;
464 hdmi_fmt_name_param *fmt_param = HI_NULL;
465
466 for (i = 0; i < hdmi_array_size(g_fmt_param); i++) {
467 fmt_param = (hdmi_fmt_name_param *)&g_fmt_param[i];
468 if ((fmt_param != HI_NULL) && (fmt_param->vic == vic)) {
469 return fmt_param->format;
470 }
471 }
472
473 return HI_NULL;
474 }
475
proc_std_timingformat(const hdmi_edid_std_timing * std_timing)476 static hi_char *proc_std_timingformat(const hdmi_edid_std_timing *std_timing)
477 {
478 hi_u32 i;
479 hdmi_fmt_name_param *fmt_param = HI_NULL;
480
481 for (i = 0; i < hdmi_array_size(g_fmt_param); i++) {
482 fmt_param = (hdmi_fmt_name_param *)&g_fmt_param[i];
483 if ((fmt_param != HI_NULL) &&
484 (fmt_param->hor_active == std_timing->hor_active) &&
485 (fmt_param->ver_active == std_timing->ver_active) &&
486 (fmt_param->field_rate >= std_timing->refresh_rate) &&
487 ((fmt_param->field_rate - PROC_FEILD_RATE_DEVIATION) <= std_timing->refresh_rate)) {
488 return fmt_param->format;
489 }
490 }
491
492 return HI_NULL;
493 }
494
proc_sw_version(hdmi_proc_entry * file)495 static hi_void proc_sw_version(hdmi_proc_entry *file)
496 {
497 osal_seq_printf(file, "%s\n", g_sz_version);
498 return;
499 }
500
proc_app_attr_info(hdmi_proc_entry * file,hdmi_device_id hdmi_id)501 static hi_void proc_app_attr_info(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
502 {
503 hi_u32 index;
504 hdmi_device *hdmi_dev = HI_NULL;
505 hdmi_app_attr *app_attr = HI_NULL;
506
507 hdmi_dev = get_hdmi_device(hdmi_id);
508 hdmi_if_null_warn_return_void(hdmi_dev);
509
510 app_attr = &(hdmi_dev->attr.app_attr);
511 osal_seq_printf(file, "-------------------------- APPAttr -----------------------------\n");
512 /* line 1 */
513 osal_seq_printf(file, "%-15s: %-20s ", "HDMIEnable", app_attr->enable_hdmi ? STR_YES : STR_NO);
514 index = min((hi_s32)app_attr->hdmi_action, HDMI_DEFAULT_ACTION_BUTT);
515 osal_seq_printf(file, "%-15s: %-20s \n", "DefaultAction", g_default_action_str[index]);
516
517 /* line 2 */
518 osal_seq_printf(file, "%-15s: %-20s ", "VideoEnable", app_attr->enable_video ? STR_YES : STR_NO);
519 osal_seq_printf(file, "%-15s: %-20s \n", "AudioInfoEnable", app_attr->enable_audio ? STR_YES : STR_NO);
520
521 /* line 3 */
522 osal_seq_printf(file, "%-15s: %-20s ", "avi_info_enable", app_attr->enable_avi_infoframe ? STR_YES : STR_NO);
523 osal_seq_printf(file, "%-15s: %-20s \n", "audio_info_enable", app_attr->enable_aud_infoframe ? STR_YES : STR_NO);
524
525 /* line 4 */
526 osal_seq_printf(file, "%-15s: %-20s ", "xvYCCMode", app_attr->xvycc_mode ? STR_YES : STR_NO);
527 osal_seq_printf(file, "\n");
528 /* line 5 */
529 index = min((hi_s32)app_attr->deep_color_mode, HDMI_DEEP_COLOR_48BIT + 1);
530 osal_seq_printf(file, "%-15s: %-20s ", "DeepColorMode", g_deep_color[index]);
531 osal_seq_printf(file, "%-15s: %-20s \n", "SpdInfoEnable", app_attr->enable_spd_infoframe ? STR_YES : STR_NO);
532
533 /* line 6 */
534 index = min((hi_s32)app_attr->out_color_space, HDMI_COLORSPACE_BUTT);
535 osal_seq_printf(file, "%-15s: %-20s ", "OutColorSpace", g_color_space_str[index]);
536 osal_seq_printf(file, "%-15s: %-20s \n", "MpegInfoEnable", app_attr->enable_mpeg_infoframe ? STR_YES : STR_NO);
537
538 /* line 7 */
539 osal_seq_printf(file, "%-15s: %-20s ", "ColorSpaceAdapt", app_attr->enable_clr_space_adapt ? STR_YES : STR_NO);
540 osal_seq_printf(file, "%-15s: %-20s \n", "DeepColorAdapt", app_attr->enable_deep_clr_adapt ? STR_YES : STR_NO);
541
542 /* line 8 */
543 osal_seq_printf(file, "%-15s: %-20s ", "DebugEnable", app_attr->debug_flag ? STR_YES : STR_NO);
544 osal_seq_printf(file, "%-15s: %-20s \n", "CtsAuthEnable", app_attr->auth_mode ? STR_YES : STR_NO);
545 #ifdef HDMI_HDR_SUPPORT
546 osal_seq_printf(file, "%-15s: %-20s ", "DrmInfoEnable", app_attr->enable_drm_infoframe ? STR_YES : STR_NO);
547 #endif
548 osal_seq_printf(file, "\n");
549
550 return;
551 }
552
proc_run_state(hdmi_proc_entry * file,hi_u32 state)553 static hi_void proc_run_state(hdmi_proc_entry *file, hi_u32 state)
554 {
555 hi_u32 i;
556
557 if (state > 0) {
558 for (i = 0; i < hdmi_array_size(g_run_state_str); i++) {
559 if (state & (1 << i)) {
560 osal_seq_printf(file, " %s", g_run_state_str[i]);
561 }
562 }
563 } else {
564 osal_seq_printf(file, " %s", "NONE");
565 }
566 }
567
proc_transition_state(hdmi_proc_entry * file,hi_u32 state)568 static hi_void proc_transition_state(hdmi_proc_entry *file, hi_u32 state)
569 {
570 hi_u32 i;
571
572 if (state > 0) {
573 for (i = 0; i < hdmi_array_size(g_transition_sate_str); i++) {
574 if (state & (1 << i)) {
575 osal_seq_printf(file, " %s", g_transition_sate_str[i]);
576 }
577 }
578 } else {
579 osal_seq_printf(file, " %s", "NONE");
580 }
581 }
582
proc_sw_status(hdmi_proc_entry * file,hdmi_device_id hdmi_id)583 static hi_void proc_sw_status(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
584 {
585 hi_u32 index;
586 hdmi_device *hdmi_dev = HI_NULL;
587 #ifdef HDMI_FRL_SUPPORT
588 hdmi_frl_info *frl = HI_NULL;
589 #endif
590 hdmi_dev = get_hdmi_device(hdmi_id);
591 hdmi_if_null_warn_return_void(hdmi_dev);
592 #ifdef HDMI_FRL_SUPPORT
593 frl = &hdmi_dev->frl_info;
594 #endif
595
596 osal_seq_printf(file, "-------------------------- SWStatus ----------------------------\n");
597 /* line 1 */
598 osal_seq_printf(file, "%-15s: %-20s ", "ThreadRun",
599 (hdmi_dev->thread_info.thread_timer_sate == HDMI_THREAD_STATE_RUN) ? STR_YES : STR_NO);
600 osal_seq_printf(file, "%-15s:", "RunStatus");
601 proc_run_state(file, hdmi_dev->run_state);
602 osal_seq_printf(file, "\n");
603
604 /* line 2 */
605 #ifdef HDMI_FRL_SUPPORT
606 index = (frl->mode == HDMI_FRL_MODE_FRL) ? HDMI_TMDS_MODE_HDMI_2_1 : hdmi_dev->tmds_mode;
607 index = min((hi_s32)index, HDMI_TMDS_MODE_BUTT);
608 #else
609 index = min((hi_s32)hdmi_dev->tmds_mode, HDMI_TMDS_MODE_BUTT);
610 #endif
611 osal_seq_printf(file, "%-15s: %-20s \n", "TMDSMode", g_tmds_mode_str[index]);
612 /* line 3 */
613 osal_seq_printf(file, "%-15s: %-20d ", "KernelCnt", hdmi_dev->kernel_cnt);
614 osal_seq_printf(file, "%-15s: %-20d \n", "UserCnt", hdmi_dev->user_cnt);
615 /* line 4 */
616 osal_seq_printf(file, "%-15s: %-20s ", "KCallBack", (hdmi_dev->k_callback != HI_NULL) ? STR_YES : STR_NO);
617 osal_seq_printf(file, "%-15s: %-20d \n", "UCallBackCnt", hdmi_dev->user_callback_cnt);
618 /* line 5 */
619 osal_seq_printf(file, "%-15s:", "TransitState");
620 proc_transition_state(file, hdmi_dev->transition_state);
621 osal_seq_printf(file, "\n");
622 /* line 6 */
623 osal_seq_printf(file, "%-15s: %-20s ", "EmiEnable", hdmi_dev->emi_enable ? STR_YES : STR_NO);
624 osal_seq_printf(file, "%-15s: %-20d \n", "PcbLen", hdmi_dev->mode_param.trace_len);
625
626 return;
627 }
628
629 #if defined HDMI_HDR_SUPPORT
proc_hdr_status(hdmi_proc_entry * file,hdmi_device_id hdmi_id)630 static hi_void proc_hdr_status(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
631 {
632 hi_u32 index;
633 hdmi_device *hdmi_dev = HI_NULL;
634 drv_hdmi_hdr_info *hdr_info = HI_NULL;
635
636 hdmi_dev = get_hdmi_device(hdmi_id);
637 hdmi_if_null_warn_return_void(hdmi_dev);
638 hdr_info = &(hdmi_dev->hdr_info);
639
640 /* line 1 */
641 index = min((hi_s32)hdr_info->hdr_debug_mode, HDMI_HDR_DEBUG_MODE_BUTT);
642 osal_seq_printf(file, "%-15s: %-20s ", "HdrDebugMode", g_hdr_debug_mode_str[index]);
643 osal_seq_printf(file, "%-15s: %-20d \n", "ZeroDrmSendTime", hdr_info->zero_drm_if_timer.time);
644 /* line 2 */
645 osal_seq_printf(file, "%-15s: %-20d ", "HdrModeChnTime", hdr_info->hdr_mode_chn_timer.time);
646 osal_seq_printf(file, "\n");
647
648 return;
649 }
650 #endif
651
652 #ifdef HDMI_FRL_SUPPORT
proc_frl_status(hdmi_proc_entry * file,hdmi_device_id hdmi_id)653 static hi_void proc_frl_status(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
654 {
655 hi_u32 index;
656 hdmi_device *hdmi_dev = HI_NULL;
657 hdmi_frl_info *frl = HI_NULL;
658 compatibility_info *compat_info = HI_NULL;
659 hdmi_frl_state_mach_info *mach_info = HI_NULL;
660
661 compat_info = compat_info_get(hdmi_id);
662 hdmi_if_null_warn_return_void(compat_info);
663 hdmi_dev = get_hdmi_device(hdmi_id);
664 hdmi_if_null_warn_return_void(hdmi_dev);
665 frl = &hdmi_dev->frl_info;
666 mach_info = &frl->state_mach_info;
667
668 /* line 1 */
669 osal_seq_printf(file, "%-15s: %-20s ", "MachRun", mach_info->start_mach ? STR_YES : STR_NO);
670 osal_seq_printf(file, "%-15s: %-20s \n", "FRLEnable", frl->start ? STR_YES : STR_NO);
671 /* line 2 */
672 index = min((hi_s32)frl->state_mach_info.mach_mode, HDMI_FRL_MACH_MODE_BUTT);
673 osal_seq_printf(file, "%-15s: %-20s ", "MachMode", g_frl_mach_mode_str[index]);
674 index = min((hi_s32)frl->state_mach_info.sw_train_mode, FRL_SW_TRAIN_BUTT);
675 osal_seq_printf(file, "%-15s: %-20s \n", "SwTrainMode", g_frl_sw_train_mode_str[index]);
676 /* line 3 */
677 index = min((hi_s32)frl->rate_select, HDMI_FRL_RATE_SELECT_BUTT);
678 osal_seq_printf(file, "%-15s: %-20s ", "RateSelect", g_rate_sel_str[index]);
679 index = min((hi_s32)frl->strategy_mode, HDMI_FRL_STRATEGY_MODE_BUTT);
680 osal_seq_printf(file, "%-15s: %-20s \n", "FrlStrategy", g_frl_sratepy_str[index]);
681 /* line 4 */
682 osal_seq_printf(file, "%-15s: %-20d ", "MaxFailTime", frl->max_fail_times);
683 osal_seq_printf(file, "%-15s: %-20d \n", "WaitHandTime", mach_info->wait_handle_ms);
684 /* line 5 */
685 osal_seq_printf(file, "%-15s: %-20d ", "WaitReadyTime", mach_info->wait_ready_ms);
686 osal_seq_printf(file, "%-15s: %-20d \n", "WaitRetrainTime", mach_info->wait_retrain_ms);
687 /* line 6 */
688 index = min((hi_s32)frl->rate_info.cur_rate, FRL_WORK_MODE_BUTT);
689 osal_seq_printf(file, "%-15s: %-20s ", "CurFrlRate", g_frl_rate_str[index]);
690 osal_seq_printf(file, "%-15s: %-20s \n", "DscEnable", frl->dsc_enable ? STR_YES : STR_NO);
691 /* line 7 */
692 osal_seq_printf(file, "%-15s: %-20s ", "FrlCtsEnable", frl->cts_mode ? STR_YES : STR_NO);
693 index = min((hi_s32)mach_info->train_status, HDMI_FRL_TRAIN_STEP_BUTT);
694 osal_seq_printf(file, "%-15s: %-20s \n", "MachStatus", g_train_mach_str[index]);
695 /* line 8 */
696 index = min((hi_s32)frl->train_status.frl_train_status, HDMI_FRL_TRAIN_BUTT);
697 osal_seq_printf(file, "%-15s: %-20s ", "TrainStatus", g_train_status_str[index]);
698 osal_seq_printf(file, "%-15s: %-20s \n", "AviSend", (compat_info->avi_use_gen5 == HI_FALSE) ? "DEFAULT" : "GEN5");
699 }
700 #endif
701
proc_detail_timing(hdmi_proc_entry * file,const hdmi_video_status * video_status)702 static hi_void proc_detail_timing(hdmi_proc_entry *file, const hdmi_video_status *video_status)
703 {
704 #if defined(HDMI_SUPPORT_LOGIC_HISIV100)
705 osal_seq_printf(file, "-------------------------- Detect Timming -----------------------\n");
706 osal_seq_printf(file, "%-15s: %-20s ", "SyncSwEnable", video_status->sync_sw_enable ? STR_YES : STR_NO);
707 osal_seq_printf(file, "%-15s: %-20s \n", "HsyncPolarity", video_status->hsync_polarity ? "P" : "N");
708 osal_seq_printf(file, "%-15s: %-20s ", "Progressive", video_status->progressive ? STR_YES : STR_NO);
709 osal_seq_printf(file, "%-15s: %-20s \n", "VsyncPolarity", video_status->vsync_polarity ? "P" : "N");
710 osal_seq_printf(file, "%-15s: %-20u ", "HsyncTotal", video_status->hsync_total);
711 osal_seq_printf(file, "%-15s: %-20u \n", "HactiveCnt", video_status->hactive_cnt);
712 osal_seq_printf(file, "%-15s: %-20u ", "VsyncTotal", video_status->vsync_total);
713 osal_seq_printf(file, "%-15s: %-20u \n", "VactiveCnt", video_status->vactive_cnt);
714 #endif
715
716 return;
717 }
718
proc_hw_status(hdmi_proc_entry * file,hdmi_device_id hdmi_id)719 static hi_void proc_hw_status(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
720 {
721 hi_u32 index;
722 hdmi_device *hdmi_dev = HI_NULL;
723 hdmi_common_status *com_status = HI_NULL;
724 hdmi_phy_status *curr_phy_status = HI_NULL;
725 hdmi_emi_status emi_status = {0};
726 hdmi_hardware_status hw_status = {0};
727
728 #ifdef HDMI_FRL_SUPPORT
729 hdmi_frl_status *frl_status = HI_NULL;
730 #endif
731 hdmi_dev = get_hdmi_device(hdmi_id);
732 hdmi_if_null_warn_return_void(hdmi_dev);
733
734 hal_call_void(hal_hdmi_hardware_status_get, hdmi_dev->hal, &hw_status);
735 com_status = &(hw_status.common_status);
736 curr_phy_status = &(hw_status.phy_status);
737
738 osal_seq_printf(file, "-------------------------- HWStatus ----------------------------\n");
739 /* line 1 */
740 osal_seq_printf(file, "%-15s: %-20s ", "HotPlug", com_status->hotplug ? STR_YES : STR_NO);
741 osal_seq_printf(file, "%-15s: %-20s \n", "Rsen", com_status->rsen ? STR_YES : STR_NO);
742 /* line 2 */
743 osal_seq_printf(file, "%-15s: %-20s ", "PhyOutputEnable", curr_phy_status->phy_oe ? STR_YES : STR_NO);
744 osal_seq_printf(file, "%-15s: %-20s \n", "PhyPowerEnable", curr_phy_status->phy_power_on ? STR_YES : STR_NO);
745 /* line 3 */
746 #ifdef HDMI_FRL_SUPPORT
747 frl_status = &hw_status.frl_status;
748 osal_seq_printf(file, "%-15s: %-20s ", "WorkEn", frl_status->work_en ? STR_YES : STR_NO);
749 index = min((hi_s32)frl_status->work_mode, FRL_WORK_MODE_BUTT);
750 osal_seq_printf(file, "%-15s: %-20s \n", "WorkMode", g_work_mode_str[index]);
751 /* tmds_mode is HDMI2.1 when phy work at FRL mode. */
752 if (frl_status->frl_start == HI_TRUE) {
753 com_status->tmds_mode = HDMI_TMDS_MODE_HDMI_2_1;
754 }
755 #endif
756 index = min((hi_s32)com_status->tmds_mode, HDMI_TMDS_MODE_BUTT);
757 osal_seq_printf(file, "%-15s: %-20s ", "TMDSMode", g_tmds_mode_str[index]);
758 osal_seq_printf(file, "%-15s: %-20s \n", "AvMute", com_status->avmute ? STR_YES : STR_NO);
759 proc_detail_timing(file, &hw_status.video_status);
760 hal_call_void(hal_hdmi_emi_status_get, hdmi_dev->hal, &emi_status);
761 osal_seq_printf(file, "%-15s: %-20s \n", "EmiEnable", emi_status.hw_emi_enable ? STR_YES : STR_NO);
762 osal_seq_printf(file, "%-15s: %-20s ", "EmiDebugEnable", emi_status.debug_enable ? STR_YES : STR_NO);
763 osal_seq_printf(file, "\n");
764
765 return;
766 }
767
proc_if_raw_data(hdmi_proc_entry * file,hi_u32 * index,hi_u32 * line,hi_u8 * data)768 static hi_void proc_if_raw_data(hdmi_proc_entry *file, hi_u32 *index, hi_u32 *line, hi_u8 *data)
769 {
770 hi_u32 len = data[AVI_OFFSET_LENGTH] + STR_LEN_SUPERADDITION;
771
772 for (; ((*index) < len) && ((*index) < HDMI_INFO_FRAME_MAX_SIZE); (*index)++) {
773 if ((*index) >= *line) {
774 *line += STR_LINE_COUNT;
775 break;
776 } else if ((*index) % 4 == 0) { /* 4, " " is printed every 4 index */
777 osal_seq_printf(file, " ");
778 }
779 osal_seq_printf(file, "%02x ", data[(*index)]);
780 }
781 osal_seq_printf(file, "\n");
782
783 return;
784 }
785
proc_vic_timing(hdmi_proc_entry * file,const hdmi_vo_attr * vo_attr,const hdmi_infoframe_status * info_status)786 static hi_void proc_vic_timing(hdmi_proc_entry *file, const hdmi_vo_attr *vo_attr,
787 const hdmi_infoframe_status *info_status)
788 {
789 hi_u32 i, index;
790 hi_u32 vic, hdmi_vic;
791 enum hdmi_video_format format;
792 hi_char *fmt_str = HI_NULL;
793 hi_char *vsif_fmt_str = HI_NULL;
794 hdmi_video_def *video = HI_NULL;
795 hdmi_video_4k_def *video_4k = HI_NULL;
796
797 /* line 1 */
798 index = min((hi_s32)vo_attr->video_timing, HDMI_VIDEO_TIMING_BUTT);
799 vic = drv_hdmi_vic_search(index, vo_attr->picture_aspect, HI_FALSE); // search vic
800 i = drv_hdmi_vic_to_index(vic);
801 video = drv_hdmi_comm_format_param_get(vic);
802 if (video != HI_NULL && i < CEA_VIDEO_CODE_MAX) {
803 osal_seq_printf(file, "%-15s: %-20s |", "VideoTiming", (video->fmt_str != HI_NULL) ? video->fmt_str : "NONE");
804 } else {
805 osal_seq_printf(file, "%-15s: %-20s |", "VideoTiming", "NONE");
806 }
807 osal_seq_printf(file, "%-15s: %-20s \n", "AVIInfoEnable", info_status->avi_enable ? STR_YES : STR_NO);
808 /* line 2 */
809 index = min((hi_s32)vo_attr->disp_fmt, (hi_s32)(hdmi_array_size(g_disp_fmt_str) - 1));
810 osal_seq_printf(file, "%-15s: %-20s |", "DispFmt", g_disp_fmt_str[index]);
811
812 /*
813 * to modify the proc info when the video format is 4k x 2k
814 * find vic according to info_frame
815 * 4k x 2k
816 */
817 format = (info_status->vsif[7] >> 5) & 0x3; /* 5'b, BIT[3:1] */
818 if (format == HDMI_VIDEO_FORMAT_4K) {
819 hdmi_vic = info_status->vsif[8]; // HDMI_VIC
820 video_4k = drv_hdmi_video_codes_4k_get(hdmi_vic);
821 if (video_4k != HI_NULL && hdmi_vic >= 1 && hdmi_vic <= CEA861_F_VIDEO_CODES_MAX_4K) {
822 vsif_fmt_str = video_4k->fmt_str;
823 }
824 } else {
825 i = drv_hdmi_vic_to_index(info_status->avi[7]);
826 if (video != HI_NULL && i < CEA_VIDEO_CODE_MAX) {
827 fmt_str = video->fmt_str;
828 } else {
829 fmt_str = 0;
830 }
831 }
832 osal_seq_printf(file, "%-15s: %s(VIC=%2d)\n", "CurrentFormat",
833 (fmt_str == HI_NULL) ? "" : fmt_str, info_status->avi[7]);
834
835 /* line 3 */
836 osal_seq_printf(file, "%-15s: %-20d |", "PixelClk", vo_attr->clk_fs);
837 osal_seq_printf(file, "%-15s: %s(HDMI_VIC=%2d)\n", "VSIFormat", (vsif_fmt_str == HI_NULL) ? "" : vsif_fmt_str,
838 (format == HDMI_VIDEO_FORMAT_4K) ? info_status->vsif[8] : 0);
839
840 return;
841 }
842
proc_video_attr(hdmi_proc_entry * file,const hdmi_vo_attr * vo_attr,const hdmi_infoframe_status * info_status)843 static hi_void proc_video_attr(hdmi_proc_entry *file, const hdmi_vo_attr *vo_attr,
844 const hdmi_infoframe_status *info_status)
845 {
846 hi_u32 index;
847 hdmi_avi_info_byte1 byte1;
848 hdmi_avi_info_byte2 byte2;
849 hdmi_avi_info_byte3 byte3;
850 hdmi_avi_info_byte5 byte5;
851
852 byte1.u8 = info_status->avi[4];
853 byte2.u8 = info_status->avi[5];
854 byte3.u8 = info_status->avi[6];
855 byte5.u8 = info_status->avi[8];
856
857 index = min((hi_s32)vo_attr->in_bit_depth, HDMI_VIDEO_BITDEPTH_BUTT);
858 osal_seq_printf(file, "%-15s: %-20s |", "InBitDepth", g_bit_depth_str[index]);
859 osal_seq_printf(file, "%-15s: %-20s \n", "BarDataPresent",
860 g_bar_data_present_str[byte1.bits.bar_data_present]);
861 /* line 5 */
862 index = min((hi_s32)vo_attr->in_color_space, HDMI_COLORSPACE_BUTT);
863 osal_seq_printf(file, "%-15s: %-20s |", "InColorSpace", g_color_space_str[index]);
864 index = byte1.bits.color_space & 0x3;
865 osal_seq_printf(file, "%-15s: %-20s \n", "ColorSpace", g_color_space_str[index]);
866 /* line 6 */
867 index = min((hi_s32)vo_attr->colorimetry, HDMI_COLORIMETRY_EXTEND);
868 osal_seq_printf(file, "%-15s: %-20s |", "Colorimetry", g_colorimetry_str[index]);
869 osal_seq_printf(file, "%-15s: %-20s \n", "Colorimetry", g_colorimetry_str[byte2.bits.colorimetry]);
870 /* line 7 */
871 index = min((hi_s32)vo_attr->picture_aspect, HDMI_PICTURE_ASPECT_BUTT);
872 osal_seq_printf(file, "%-15s: %-20s |", "PicAspectRatio", g_pic_aspect_ratio_str[index]);
873 osal_seq_printf(file, "%-15s: %-20s \n", "PicAspectRatio",
874 g_pic_aspect_ratio_str[byte2.bits.picture_aspect_ratio]);
875 /* line 8 */
876 index = min((hi_s32)vo_attr->active_aspect, HDMI_ACTIVE_ASPECT_BUTT);
877 osal_seq_printf(file, "%-15s: %-20s |", "ActAspectRatio", g_act_aspect_ratio_str[index]);
878 osal_seq_printf(file, "%-15s: %-20s \n", "ActAspectRatio", g_act_aspect_ratio_str[byte2.bits.act_asp_ratio]);
879 /* line 9 */
880 osal_seq_printf(file, "%-15s: %-20d |", "PixelRepeat", vo_attr->pixel_repeat);
881 osal_seq_printf(file, "%-15s: %-20s \n", "PixelRepeat", g_pixel_repetition_str[byte5.bits.pixel_repetition]);
882 /* line 10 */
883 index = min((hi_s32)vo_attr->ycc_quantization, HDMI_YCC_QUANTIZATION_RANGE_BUTT);
884 osal_seq_printf(file, "%-15s: %-20s |", "YCCQuantization", g_ycc_quantization_str[index]);
885 osal_seq_printf(file, "%-15s: %-20s \n", "YCCQuantization",
886 g_ycc_quantization_str[byte5.bits.ycc_quantization_range]);
887 /* line 11 */
888 index = min((hi_s32)vo_attr->rgb_quantization, HDMI_QUANTIZATION_RANGE_BUTT);
889 osal_seq_printf(file, "%-15s: %-20s |", "RGBQuantization", g_rgb_quantization_str[index]);
890 osal_seq_printf(file, "%-15s: %-20s \n", "RGBQuantization", g_rgb_quantization_str[byte3.bits.rgb_quantization]);
891 /* line 12 */
892 index = min((hi_s32)vo_attr->extended_colorimetry, HDMI_EXTENDED_COLORIMETRY_BUTT);
893 osal_seq_printf(file, "%-15s: %-20s |", "ExtColorimetry", g_ext_colorimetry_str[index]);
894 osal_seq_printf(file, "%-15s: %-20s \n", "ExtColorimetry", g_ext_colorimetry_str[byte3.bits.ext_colorimetry]);
895 /* line 13 */
896 index = min((hi_s32)vo_attr->stereo_mode, HDMI_3D_BUTT);
897 osal_seq_printf(file, "%-15s: %-20s |", "StereoMode", g_stere_mode_str[index]);
898 osal_seq_printf(file, "%-15s: %-20s \n", "ItContentValid", byte3.bits.it_content_valid ? STR_YES : STR_NO);
899 /* line 14 */
900 osal_seq_printf(file, "%-15s: %-20d |", "bVSyncPol", vo_attr->v_sync_pol);
901 osal_seq_printf(file, "%-15s: %-20d \n", "bHSyncPol", vo_attr->h_sync_pol);
902
903 return;
904 }
905
proc_video_path(hdmi_proc_entry * file,hdmi_hardware_status * hw_status)906 static hi_void proc_video_path(hdmi_proc_entry *file, hdmi_hardware_status *hw_status)
907 {
908 hi_u32 i, index, line;
909 hdmi_avi_info_byte1 un_avi_byte1;
910 hdmi_avi_info_byte3 un_avi_byte3;
911 hdmi_avi_info_byte5 un_avi_byte5;
912 hi_u8 *data = HI_NULL;
913
914 un_avi_byte1.u8 = hw_status->info_frame_status.avi[4];
915 un_avi_byte3.u8 = hw_status->info_frame_status.avi[6];
916 un_avi_byte5.u8 = hw_status->info_frame_status.avi[8];
917
918 osal_seq_printf(file, "%-15s: %-20s \n", "ITContentType", g_it_content_type_str[un_avi_byte5.bits.it_content_type]);
919 /* line 16 */
920 osal_seq_printf(file, "%-15s: %-20s |", "VideoMute", hw_status->video_status.video_mute ? STR_YES : STR_NO);
921 osal_seq_printf(file, "%-15s: %-20s \n", "PicScaling", g_picture_scaling_str[un_avi_byte3.bits.picture_scaling]);
922 /* line 17 */
923 index = min((hi_s32)hw_status->video_status.out_bit_depth, HDMI_VIDEO_BITDEPTH_BUTT);
924 if (hw_status->video_status.out_color_space == HDMI_COLORSPACE_YCBCR422) {
925 index = HDMI_VIDEO_BITDEPTH_12;
926 }
927 osal_seq_printf(file, "%-15s: %-20s |", "OutBitDepth", g_bit_depth_str[index]);
928 osal_seq_printf(file, "%-15s: %-20s \n", "ActFmtPresent",
929 un_avi_byte1.bits.act_fmt_info_present ? STR_YES : STR_NO);
930 /* line 18 */
931 index = min((hi_s32)hw_status->video_status.out_color_space, HDMI_COLORSPACE_BUTT);
932
933 osal_seq_printf(file, "%-15s: %-20s |", "OutColorSpace", g_color_space_str[index]);
934 osal_seq_printf(file, "%-15s: %-20s \n", "ScanInfo", g_scan_info_str[un_avi_byte1.bits.scan_info]);
935 /* line 19 */
936 osal_seq_printf(file, "%-15s: %-20s |", "YCbCr420_422", hw_status->video_status.ycbcr420_422 ? STR_YES : STR_NO);
937 osal_seq_printf(file, "%-15s:\n", "AVIInfoRawData");
938 /* line 20 */
939 osal_seq_printf(file, "%-15s: %-20s |", "YCbCr422_444", hw_status->video_status.ycbcr422_444 ? STR_YES : STR_NO);
940 data = hw_status->info_frame_status.avi;
941 line = STR_LINE_COUNT;
942 i = 0;
943 proc_if_raw_data(file, &i, &line, data);
944 /* line 21 */
945 osal_seq_printf(file, "%-15s: %-20s |", "YCbCr444_422", hw_status->video_status.ycbcr444_422 ? STR_YES : STR_NO);
946 proc_if_raw_data(file, &i, &line, data);
947 /* line 22 */
948 osal_seq_printf(file, "%-15s: %-20s |", "YCbCr422_420", hw_status->video_status.ycbcr422_420 ? STR_YES : STR_NO);
949 proc_if_raw_data(file, &i, &line, data);
950 /* line 23 */
951 osal_seq_printf(file, "%-15s: %-20s |", "RGB2YCbCr", hw_status->video_status.rgb2ycbcr ? STR_YES : STR_NO);
952 osal_seq_printf(file, "%-15s:\n", "VSInfoRawData");
953 /* line 24 */
954 osal_seq_printf(file, "%-15s: %-20s |", "YCbCr2RGB", hw_status->video_status.ycbcr2rgb ? STR_YES : STR_NO);
955 data = hw_status->info_frame_status.vsif;
956 line = STR_LINE_COUNT;
957 i = 0;
958 proc_if_raw_data(file, &i, &line, data);
959 /* line 25 */
960 index = min((hi_s32)hw_status->video_status.dither, HDMI_VIDEO_DITHER_DISABLE);
961 osal_seq_printf(file, "%-15s: %-20s |", "Dither", g_dither_mode_str[index]);
962 proc_if_raw_data(file, &i, &line, data);
963 index = min((hi_s32)hw_status->video_status.out_bit_depth, HDMI_VIDEO_BITDEPTH_BUTT);
964 osal_seq_printf(file, "%-15s: %-20s |\n", "DeepColorMode", g_deep_color_str[index]);
965
966 return;
967 }
968
proc_video_info(hdmi_proc_entry * file,hdmi_device_id hdmi_id)969 static hi_void proc_video_info(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
970 {
971 hdmi_vo_attr *vo_attr = HI_NULL;
972 hdmi_device *hdmi_dev = HI_NULL;
973 static hdmi_hardware_status hw_status;
974
975 hdmi_dev = get_hdmi_device(hdmi_id);
976 hdmi_if_null_warn_return_void(hdmi_dev);
977 vo_attr = &(hdmi_dev->attr.vo_attr);
978 (hi_void)memset_s(&hw_status, sizeof(hdmi_hardware_status), 0, sizeof(hdmi_hardware_status));
979 hal_call_void(hal_hdmi_hardware_status_get, hdmi_dev->hal, &hw_status);
980
981 osal_seq_printf(file, "------------ VideoAttr --------------------------- AVIInfo --------------\n");
982 /* line 1~3 */
983 proc_vic_timing(file, vo_attr, &hw_status.info_frame_status);
984 /* line 4~14 */
985 proc_video_attr(file, vo_attr, &hw_status.info_frame_status);
986 /* line 15~25 */
987 osal_seq_printf(file, "------------ VideoPath ---------------|");
988 proc_video_path(file, &hw_status);
989
990 return;
991 }
992
993 #ifdef HDMI_HDR_SUPPORT
proc_hdr_of_data(hdmi_proc_entry * file,hi_u8 * data)994 static hi_void proc_hdr_of_data(hdmi_proc_entry *file, hi_u8 *data)
995 {
996 hi_u8 i;
997 hi_u8 len = data[2] + STR_LEN_SUPERADDITION;
998
999 for (i = 0; (i < len) && (i < HDMI_INFO_FRAME_MAX_SIZE); i++) {
1000 if ((i % STR_LEN_SUPERADDITION == 0) && (i != 0)) {
1001 osal_seq_printf(file, " ");
1002 }
1003 osal_seq_printf(file, "%02x ", data[i]);
1004 if (i % 15 == 0 && i != 0) { /* about the 15 length proc log */
1005 osal_seq_printf(file, "\n ");
1006 }
1007 }
1008
1009 return;
1010 }
1011
proc_hdr_info(hdmi_proc_entry * file,hdmi_device_id hdmi_id)1012 static hi_void proc_hdr_info(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
1013 {
1014 hi_u8 index;
1015 hi_u8 *data = HI_NULL;
1016 hdmi_hal *hal = HI_NULL;
1017 hdmi_device *hdmi_dev = HI_NULL;
1018 drv_hdmi_hdr_attr *hdr_attr = HI_NULL;
1019 hdmi_hardware_status hw_status = {0};
1020
1021 hdmi_dev = get_hdmi_device(hdmi_id);
1022 hdmi_if_null_warn_return_void(hdmi_dev);
1023 hdr_attr = &hdmi_dev->attr.hdr_attr;
1024 hal = hdmi_dev->hal;
1025 hdmi_if_null_warn_return_void(hal);
1026
1027 hal->hal_hdmi_hardware_status_get(hal, &hw_status);
1028 osal_seq_printf(file, "--------------------------------- HDRAttr -------------------------------\n");
1029 /* line 1 */
1030 index = min((hi_s32)hdr_attr->user_hdr_mode, HDMI_HDR_USERMODE_BUTT);
1031 osal_seq_printf(file, "%-15s: %-20s \n", "UserHdrMode", g_hdr_user_mode_str[index]);
1032 /* line 2 */
1033 index = min((hi_s32)hdr_attr->hdr_mode, HDMI_HDR_MODE_BUTT);
1034 osal_seq_printf(file, "%-15s: %-20s ", "HdrMode", g_hdr_mode_str[index]);
1035 index = min((hi_s32)hdr_attr->eotf_type, HDMI_EOTF_BUTT);
1036 osal_seq_printf(file, "%-15s: %-20s \n", "HdrEotfType", g_hdr_eotf_type_str[index]);
1037 /* line 3 */
1038 osal_seq_printf(file, "%-15s: %-20d ", "HdrMetaDataID", hdr_attr->metadata_id);
1039 index = min((hi_s32)hdr_attr->colorimetry, HDMI_HDR_EXTENDED_COLORIMETRY_2020_NON_CONST_LUMINOUW);
1040 osal_seq_printf(file, "%-15s: %-20s \n", "HdrColorimetry", g_hdr_colorimetry_str[index]);
1041 /* line 4 */
1042 osal_seq_printf(file, "%-15s: %-20d ", "DispPrim0_X", hdr_attr->un_descriptor.type1.primaries0_x);
1043 osal_seq_printf(file, "%-15s: %-20d \n", "DispPrim0_Y", hdr_attr->un_descriptor.type1.primaries0_y);
1044 /* line 5 */
1045 osal_seq_printf(file, "%-15s: %-20d ", "DispPrim1_X", hdr_attr->un_descriptor.type1.primaries1_x);
1046 osal_seq_printf(file, "%-15s: %-20d \n", "DispPrim1_Y", hdr_attr->un_descriptor.type1.primaries1_y);
1047 /* line 6 */
1048 osal_seq_printf(file, "%-15s: %-20d ", "DispPrim2_X", hdr_attr->un_descriptor.type1.primaries2_x);
1049 osal_seq_printf(file, "%-15s: %-20d \n", "DispPrim2_Y", hdr_attr->un_descriptor.type1.primaries2_y);
1050 /* line 7 */
1051 osal_seq_printf(file, "%-15s: %-20d ", "WhitePoint_X", hdr_attr->un_descriptor.type1.white_point_x);
1052 osal_seq_printf(file, "%-15s: %-20d \n", "WhitePoint_Y", hdr_attr->un_descriptor.type1.white_point_y);
1053 /* line 8 */
1054 osal_seq_printf(file, "%-15s: %-20d ", "MaxLuminance", hdr_attr->un_descriptor.type1.max_luminance);
1055 osal_seq_printf(file, "%-15s: %-20d \n", "MinLuminance", hdr_attr->un_descriptor.type1.min_luminance);
1056 /* line 9 */
1057 osal_seq_printf(file, "%-15s: %-20d ", "MaxLightLevel", hdr_attr->un_descriptor.type1.max_light_level);
1058 osal_seq_printf(file, "%-15s: %-20d \n", "AverLightLevel", hdr_attr->un_descriptor.type1.average_light_level);
1059 osal_seq_printf(file, "--------------------------------- DRMInfo -------------------------------\n");
1060 /* line 10 */
1061 osal_seq_printf(file, "%-15s: %-20s ", "DRMInfoEnable", hw_status.info_frame_status.drm_enable ? STR_YES : STR_NO);
1062 index = min((hi_s32)hw_status.info_frame_status.drm[4], HDMI_EOTF_BUTT);
1063 osal_seq_printf(file, "%-15s: %-20s \n", "EotfType", g_hdr_eotf_type_str[index]);
1064 /* line 11 */
1065 osal_seq_printf(file, "%-15s: %-20d \n", "MetadataID", hw_status.info_frame_status.drm[5]);
1066 /* line 12 */
1067 osal_seq_printf(file, "%-15s: ", "DRMInfoRawData");
1068 data = hw_status.info_frame_status.drm;
1069 proc_hdr_of_data(file, data);
1070 osal_seq_printf(file, "\n");
1071 }
1072 #endif
1073
porc_auido_attr(hdmi_proc_entry * file,const hdmi_ao_attr * ao_attr,const hdmi_hardware_status * hw_status)1074 static hi_void porc_auido_attr(hdmi_proc_entry *file, const hdmi_ao_attr *ao_attr,
1075 const hdmi_hardware_status *hw_status)
1076 {
1077 hi_u32 index;
1078 hdmi_audio_info_byte1 un_audio_byte1;
1079 hdmi_audio_info_byte2 un_audio_byte2;
1080
1081 un_audio_byte1.u8 = hw_status->info_frame_status.audio[4];
1082 un_audio_byte2.u8 = hw_status->info_frame_status.audio[5];
1083
1084 /* line 1 */
1085 index = min((hi_s32)ao_attr->sound_intf, HDMI_AUDIO_INTF_BUTT);
1086 osal_seq_printf(file, "%-15s: %-20s |", "SoundIntf", g_sound_intf_str[index]);
1087 osal_seq_printf(file, "%-15s: %-20s \n", "AudioInfoEnable",
1088 hw_status->info_frame_status.audio_enable ? STR_YES : STR_NO);
1089 /* line 2 */
1090 index = min((hi_s32)ao_attr->audio_code, HDMI_AUDIO_CODING_TYPE_BUTT);
1091 osal_seq_printf(file, "%-15s: %-20s |", "CodeType", g_audio_code_type_str[index]);
1092 osal_seq_printf(file, "%-15s: %-20s \n", "CodeType", g_audio_code_type_str[un_audio_byte1.bits.audio_coding_type]);
1093 /* line 3 */
1094 index = min((hi_s32)ao_attr->channels, HDMI_AUDIO_FORMAT_BUTT);
1095 osal_seq_printf(file, "%-15s: %-20s |", "ChannelCnt", g_audio_channel_str[index]);
1096 osal_seq_printf(file, "%-15s: %-20s \n", "ChannelCnt", g_audio_chn_str[un_audio_byte1.bits.audio_chanel_cnt]);
1097 /* line 4 */
1098 osal_seq_printf(file, "%-15s: %-20d |", "SampleFreq", ao_attr->sample_fs);
1099 osal_seq_printf(file, "%-15s: %-20s \n", "SampleFreq",
1100 g_audio_samping_freq_str[un_audio_byte2.bits.audio_samping_freq]);
1101 /* line 5 */
1102 osal_seq_printf(file, "%-15s: %-20d |", "SampleDepth", ao_attr->sample_depth);
1103 osal_seq_printf(file, "%-15s: %-20d \n", "SampleDepth", hw_status->audio_status.sample_depth);
1104 /* line 6 */
1105 osal_seq_printf(file, "%-15s: %-20s |", "DownSample", ao_attr->down_sample ? STR_YES : STR_NO);
1106 osal_seq_printf(file, "%-15s: %-20s \n", "SampleSize",
1107 g_audio_samping_size_str[un_audio_byte2.bits.audio_samping_size]);
1108
1109 return;
1110 }
1111
proc_audio_path(hdmi_proc_entry * file,hdmi_hardware_status * hw_status)1112 static hi_void proc_audio_path(hdmi_proc_entry *file, hdmi_hardware_status *hw_status)
1113 {
1114 hi_u8 i;
1115 hi_u32 index;
1116 hi_u8 *data = HI_NULL;
1117 hdmi_audio_info_byte5 un_audio_byte5;
1118
1119 un_audio_byte5.u8 = hw_status->info_frame_status.audio[8];
1120
1121 osal_seq_printf(file, "%-15s: %-20s \n", "DownMixInhibit", un_audio_byte5.bits.down_mix_inhibit ? STR_YES : STR_NO);
1122 /* line 8 */
1123 osal_seq_printf(file, "%-15s: %-20s |", "AudioEnable",
1124 hw_status->info_frame_status.audio_enable ? STR_YES : STR_NO);
1125 osal_seq_printf(file, "%-15s: %-20d \n", "LevelShiftValue", un_audio_byte5.bits.level_shift_value);
1126 /* line 9 */
1127 osal_seq_printf(file, "%-15s: %-20s |", "AudioMute", hw_status->audio_status.audio_mute ? STR_YES : STR_NO);
1128 osal_seq_printf(file, "%-15s: %-20s \n", "LFEPlayBack", g_lfe_playback_str[un_audio_byte5.bits.lfe_play_back]);
1129
1130 /* line 10 */
1131 index = min((hi_s32)hw_status->audio_status.sound_intf, HDMI_AUDIO_INTF_BUTT);
1132 osal_seq_printf(file, "%-15s: %-20s |", "SoundIntf", g_sound_intf_str[index]);
1133 osal_seq_printf(file, "%-15s: 0x%02x (%u)\n", "Channel/SpeakerAlloc", hw_status->info_frame_status.audio[7],
1134 hw_status->info_frame_status.audio[7]);
1135 /* line 11 */
1136 index = min((hi_s32)hw_status->audio_status.layout, HDMI_AUDIO_FORMAT_BUTT);
1137 osal_seq_printf(file, "%-15s: %-20s |", "ChannelCnt", g_audio_channel_str[index]);
1138 osal_seq_printf(file, "%-15s: \n", "AudioInfoRawData");
1139 /* line 12 */
1140 osal_seq_printf(file, "%-15s: %-20d |", "SampleFreq", hw_status->audio_status.sample_fs);
1141 data = hw_status->info_frame_status.audio;
1142 for (i = 0; (i < (data[2] + STR_LEN_SUPERADDITION)) && (i < HDMI_INFO_FRAME_MAX_SIZE); i++) {
1143 if (i >= 8) { /* the 8~31 chars length proc log none " " */
1144 break;
1145 } else if ((i % STR_LEN_SUPERADDITION) == 0) {
1146 osal_seq_printf(file, " ");
1147 }
1148 osal_seq_printf(file, "%02x ", data[i]);
1149 }
1150 osal_seq_printf(file, "\n");
1151 /* line 13 */
1152 osal_seq_printf(file, "%-15s: %-20d |", "SampleDepth", hw_status->audio_status.sample_depth);
1153 for (; (i < (data[2] + STR_LEN_SUPERADDITION)) && (i < HDMI_INFO_FRAME_MAX_SIZE); i++) {
1154 if (i >= 16) { /* the 16~31 chars length proc log none " " */
1155 break;
1156 } else if ((i % STR_LEN_SUPERADDITION) == 0) {
1157 osal_seq_printf(file, " ");
1158 }
1159 osal_seq_printf(file, "%02x ", data[i]);
1160 }
1161 osal_seq_printf(file, "\n");
1162 /* line 14 */
1163 osal_seq_printf(file, "%-15s: %-20s |\n", "DownSample", hw_status->audio_status.down_sample ? STR_YES : STR_NO);
1164 #if defined(HDMI_SUPPORT_LOGIC_HISIV100)
1165 /* line 15 */
1166 osal_seq_printf(file, "%-15s: %-20u |\n", "Ref_CTS", hw_status->audio_status.ref_cts);
1167 /* line 16 */
1168 osal_seq_printf(file, "%-15s: %-20u |\n", "Reg_CTS", hw_status->audio_status.reg_cts);
1169 /* line 17 */
1170 osal_seq_printf(file, "%-15s: %-20u |\n", "Ref_N", hw_status->audio_status.ref_n);
1171 /* line 18 */
1172 osal_seq_printf(file, "%-15s: %-20u |\n", "Reg_N", hw_status->audio_status.reg_n);
1173 #endif
1174
1175 return;
1176 }
1177
proc_audio_info(hdmi_proc_entry * file,hdmi_device_id hdmi_id)1178 static hi_void proc_audio_info(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
1179 {
1180 hdmi_device *hdmi_dev = HI_NULL;
1181 hdmi_ao_attr *ao_attr = HI_NULL;
1182 static hdmi_hardware_status hw_status;
1183
1184 hdmi_dev = get_hdmi_device(hdmi_id);
1185 hdmi_if_null_warn_return_void(hdmi_dev);
1186 ao_attr = &(hdmi_dev->attr.ao_attr);
1187 hal_call_void(hal_hdmi_hardware_status_get, hdmi_dev->hal, &hw_status);
1188
1189 osal_seq_printf(file, "------------ AudioAttr --------------------------- AudioIfno ------------\n");
1190 /* line 1~6 */
1191 porc_auido_attr(file, ao_attr, &hw_status);
1192 /* line 7~18 */
1193 osal_seq_printf(file, "------------ AudioPath ---------------|");
1194 proc_audio_path(file, &hw_status);
1195
1196 return;
1197 }
1198
proc_event_info(hdmi_proc_entry * file,hdmi_device_id hdmi_id)1199 static hi_void proc_event_info(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
1200 {
1201 hi_s32 ret;
1202 hi_u32 i, j;
1203 hi_u32 total_pool = 0;
1204 hdmi_device *hdmi_dev = HI_NULL;
1205 hdmi_event_run_cnt run_cnt = {0};
1206 hdmi_event_run_ctrl ctrl = {0};
1207
1208 hdmi_dev = get_hdmi_device(hdmi_id);
1209 hdmi_if_null_warn_return_void(hdmi_dev);
1210 ret = drv_hdmi_event_pool_total_get(hdmi_id, &total_pool);
1211 hdmi_if_failure_warn_return_void(ret);
1212
1213 if (total_pool >= HDMI_EVENT_POOL_CNT) {
1214 hdmi_err("u32TotalPool(%u) must less than %u.\n", total_pool, HDMI_EVENT_POOL_CNT);
1215 return;
1216 }
1217
1218 for (i = 0; i < total_pool; i++) {
1219 if (drv_hdmi_event_pool_status_get(hdmi_id, i + 1, &ctrl, &run_cnt) != HI_SUCCESS) {
1220 continue;
1221 }
1222 osal_seq_printf(file,
1223 "----------------- TaskID=%u Event Pool[%u] Status ----------------------\n", ctrl.pool_id, i);
1224 /* line1 */
1225 osal_seq_printf(file, "CNT|%-8s|%-3s|%-5s|%-8s|%-8s|%-8s|%-7s|%-7s|%-7s\n",
1226 "ErrTotal", "HPD", "UnHPD", "EdidFail", "HdcpFail", "HdcpSucc", "RsenCon", "RsenDis", "HdcpUsr");
1227 /* line2 */
1228 osal_seq_printf(file, "WR:|%-8u|%-3u|%-5u|%-8u|%-8u|%-8u|%-7u|%-7u|%-7u\n",
1229 run_cnt.err_wd_cnt, run_cnt.hpd_wr_cnt, run_cnt.unhpd_wr_cnt,
1230 run_cnt.edid_fail_wr_cnt, 0, 0, run_cnt.rsen_con_wr_cnt, run_cnt.rsen_dis_wr_cnt, 0);
1231 /* line3 */
1232 osal_seq_printf(file, "RD:|%-8u|%-3u|%-5u|%-8u|%-8u|%-8u|%-7u|%-7u|%-7u\n",
1233 run_cnt.err_rd_cnt, run_cnt.hpd_rd_cnt, run_cnt.unhpd_rd_cnt,
1234 run_cnt.edid_fail_rd_cnt, 0, 0, run_cnt.rsen_con_rd_cnt, run_cnt.rsen_dis_rd_cnt, 0);
1235 /* line4 */
1236 osal_seq_printf(file, "Memory[WkFlg=%1d |RdAble=%2d| RdPtr=%-2d| WrPtr=%-2d]:",
1237 ctrl.wakeup_flag, ctrl.readable_cnt, ctrl.read_ptr, ctrl.write_ptr);
1238 for (j = 0; j < hdmi_array_size(ctrl.event_pool); j++) {
1239 if (ctrl.event_pool[j] < HDMI_EVENT_BUTT) {
1240 osal_seq_printf(file, " 0x%02x", ctrl.event_pool[j]);
1241 }
1242 }
1243 osal_seq_printf(file, "\n");
1244 }
1245
1246 return;
1247 }
1248
proc_edid_raw_data(hdmi_proc_entry * file,hdmi_device_id hdmi_id)1249 static hi_void proc_edid_raw_data(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
1250 {
1251 hi_u32 i, raw_len;
1252 hi_s32 ret;
1253 hi_u8 *edid_raw = HI_NULL;
1254 hdmi_device *hdmi_dev = HI_NULL;
1255 hdmi_edid_info *edid_info = HI_NULL;
1256
1257 hdmi_dev = get_hdmi_device(hdmi_id);
1258 hdmi_if_null_warn_return_void(hdmi_dev);
1259 edid_info = &hdmi_dev->edid_info;
1260 edid_raw = (hi_u8 *)osal_vmalloc(HDMI_EDID_TOTAL_SIZE);
1261 hdmi_if_null_warn_return_void(edid_raw);
1262 (hi_void)memset_s(edid_raw, HDMI_EDID_TOTAL_SIZE, 0, HDMI_EDID_TOTAL_SIZE);
1263
1264 raw_len = HDMI_EDID_TOTAL_SIZE;
1265 ret = drv_hdmi_edid_raw_get(edid_info, edid_raw, raw_len);
1266 if (ret == HI_ERR_HDMI_NUL_PTR || ret == HI_ERR_HDMI_INVALID_PARA || ret == HI_FAILURE) {
1267 hdmi_err("edid raw get fail!\n");
1268 osal_vfree(edid_raw);
1269 return;
1270 }
1271 raw_len = (hi_u32)ret;
1272
1273 /* raw data */
1274 osal_seq_printf(file,
1275 "--------------------------------------- EDIDRawData -----------------------------------------\n");
1276 if (raw_len != 0xffffffff) {
1277 for (i = 0; i < raw_len && i < HDMI_EDID_TOTAL_SIZE; i++) {
1278 if (i == 0) {
1279 osal_seq_printf(file, "/* %02xH: */ ", i);
1280 }
1281 osal_seq_printf(file, "0x%02x,", edid_raw[i]);
1282 if ((((i + 1) % STR_LEN_SUPERADDITION) == 0) && ((i + 1) < raw_len)) {
1283 osal_seq_printf(file, " ");
1284 }
1285 if ((((i + 1) % 16) == 0) && ((i + 1) < raw_len)) { /* 16 eq 4*4, means oneline display 4 EDID format */
1286 osal_seq_printf(file, "\n/* %02xH: */ ", i);
1287 }
1288 }
1289 osal_seq_printf(file, "\n");
1290 }
1291 osal_vfree(edid_raw);
1292
1293 return;
1294 }
1295
proc_edid_status(hdmi_proc_entry * file,hdmi_device_id hdmi_id)1296 static hi_void proc_edid_status(hdmi_proc_entry *file, hdmi_device_id hdmi_id)
1297 {
1298 hi_s32 ret;
1299 hdmi_edid_status status = {0};
1300 hdmi_device *hdmi_dev = HI_NULL;
1301 hdmi_edid_info *edid_info = HI_NULL;
1302
1303 hdmi_dev = get_hdmi_device(hdmi_id);
1304 hdmi_if_null_warn_return_void(hdmi_dev);
1305 edid_info = &hdmi_dev->edid_info;
1306 ret = dfrv_hdmi_edid_status_get(edid_info, &status);
1307 if (ret != HI_SUCCESS) {
1308 hdmi_err("dfrv_hdmi_edid_status_get failed!!!\n");
1309 return;
1310 }
1311
1312 osal_seq_printf(file, "------------------------------ SWStatus -------------------------------------------\n");
1313 /* line 1 */
1314 osal_seq_printf(file, "%-20s: %-20s ", "CapFromSink", status.cap_sink ? STR_YES : STR_NO);
1315 osal_seq_printf(file, "%-20s: %-20d \n", "RawUpdateErrCnt", status.raw_update_err_cnt);
1316 /* line 2 */
1317 osal_seq_printf(file, "%-20s: %-20s ", "CapIsValid", status.cap_valid ? STR_YES : STR_NO);
1318 osal_seq_printf(file, "%-20s: %-20d \n", "ParseErrorType", status.parse_err);
1319 /* line 3 */
1320 osal_seq_printf(file, "%-20s: %-20s ", "RawIsValid", status.raw_valid ? STR_YES : STR_NO);
1321 osal_seq_printf(file, "%-20s: 0x%08x\n", "ParseWarnType", status.parse_warn);
1322 /* line 4 */
1323 osal_seq_printf(file, "%-20s: %-20d ", "RawGetErrCnt", status.raw_get_err_cnt);
1324 osal_seq_printf(file, "%-20s: %-20d \n", "RawLength", status.raw_len);
1325
1326 return;
1327 }
1328
proc_get_cap_info(hdmi_device_id hdmi_id,hdmi_sink_capability ** cap)1329 static hi_s32 proc_get_cap_info(hdmi_device_id hdmi_id, hdmi_sink_capability **cap)
1330 {
1331 hi_s32 ret;
1332 hdmi_device *hdmi_dev = HI_NULL;
1333 hdmi_edid_info *edid_info = HI_NULL;
1334
1335 hdmi_dev = get_hdmi_device(hdmi_id);
1336 if (hdmi_dev == HI_NULL) {
1337 hdmi_err("get hdmi_dev=null!\n");
1338 return HI_FAILURE;
1339 }
1340
1341 edid_info = &hdmi_dev->edid_info;
1342 ret = drv_hdmi_edid_capability_get(edid_info, cap);
1343 if (ret == HDMI_EDID_DATA_INVALID) {
1344 hdmi_warn("current capability invalid, force to get raw!!!\n");
1345 ret = drv_hdmi_edid_update(edid_info, HDMI_EDID_UPDATE_SINK);
1346 if (ret != HI_SUCCESS) {
1347 hdmi_warn("please make sure HDMI cable connected & start!\n");
1348 return HI_FAILURE;
1349 }
1350
1351 ret = drv_hdmi_edid_capability_get(edid_info, cap);
1352 if (ret == HDMI_EDID_DATA_INVALID) {
1353 hdmi_warn("get the edid capability error, ret=%d, cap=%p!\n", ret, cap);
1354 return HI_FAILURE;
1355 }
1356 }
1357
1358 return HI_SUCCESS;
1359 }
1360
proc_sink_basic_cap(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1361 static hi_void proc_sink_basic_cap(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1362 {
1363 hi_u32 i;
1364 errno_t ret;
1365 hi_char str_tmp_array[PROC_TEMP_STR_LEN];
1366
1367 /* basic */
1368 osal_seq_printf(file, "------------------------------ BasicCap -------------------------------------------\n");
1369 /* line 1 */
1370 osal_seq_printf(file, "%-20s: %-20s ", "HDMI1.4Support", cap->support_hdmi ? STR_YES : STR_NO);
1371 osal_seq_printf(file, "%-20s: %-1d.%-1d\n", "1stBlockVersion", cap->version, cap->revision);
1372 /* line 2 */
1373 osal_seq_printf(file, "%-20s: %-20s ", "HDMI2.0Support", cap->support_hdmi_20 ? STR_YES : STR_NO);
1374 (hi_void)memset_s(str_tmp_array, sizeof(str_tmp_array), '\0', sizeof(str_tmp_array));
1375 ret = strncpy_s(str_tmp_array, PROC_TEMP_STR_LEN, cap->mfrs_info.mfrs_name, 4); /* 4, mfrs_name[4] size 4 type */
1376 hdmi_unequal_eok_return_void(ret);
1377 osal_seq_printf(file, "%-20s: %-20s \n", "ManufacturerName", str_tmp_array);
1378 /* line 3 */
1379 osal_seq_printf(file, "%-20s: %-20d ", "MaxTMDSClock(MHz)", cap->max_tmds_clock);
1380 osal_seq_printf(file, "%-20s: %-20u \n", "ProductCode", cap->mfrs_info.product_code);
1381 /* line 4 */
1382 osal_seq_printf(file, "%-20s: %-20u ", "SerialNumber", cap->mfrs_info.serial_number);
1383 osal_seq_printf(file, "%-20s: %-20u \n", "WeekOfManufacture", cap->mfrs_info.week);
1384 /* line 5 */
1385 osal_seq_printf(file, "%-20s: %-20u ", "MaxDispWidth", cap->basic_disp_para.max_image_width);
1386 osal_seq_printf(file, "%-20s: %-20u \n", "MaxDispHeight", cap->basic_disp_para.max_image_height);
1387 /* line 6 */
1388 osal_seq_printf(file, "%-20s: %-20s ", "SCDCSupport", cap->support_scdc ? STR_YES : STR_NO);
1389 osal_seq_printf(file, "%-20s: %-20u \n", "YearOfManufacture", cap->mfrs_info.year);
1390 /* line 7 */
1391 osal_seq_printf(file, "%-20s: %-20s ", "DVIDualSupport", cap->support_dvi_dual ? STR_YES : STR_NO);
1392 osal_seq_printf(file, "%-20s: %-20s \n", "CECAddrIsValid", cap->cec_addr.phy_addr_valid ? STR_YES : STR_NO);
1393 /* line 8 */
1394 osal_seq_printf(file, "%-20s: %-20s ", "AISupport", cap->supports_ai ? STR_YES : STR_NO);
1395 osal_seq_printf(file, "%-20s: %02x.%02x.%02x.%02x\n", "CECAddr", cap->cec_addr.phy_addr_a,
1396 cap->cec_addr.phy_addr_b, cap->cec_addr.phy_addr_c, cap->cec_addr.phy_addr_d);
1397 /* line 9 */
1398 osal_seq_printf(file, "%-20s: %-20u ", "ExtBlockCnt", cap->ext_block_num);
1399 /* speaker */
1400 osal_seq_printf(file, "%-20s:", "SpeakerSupport");
1401 for (i = 0; i < hdmi_array_size(cap->support_audio_speaker); i++) {
1402 if (i < hdmi_array_size(g_str_speaker_str)) {
1403 osal_seq_printf(file, " %s", cap->support_audio_speaker[i] ? g_str_speaker_str[i] : "");
1404 }
1405 }
1406 osal_seq_printf(file, "\n");
1407 /* line 10 */
1408 osal_seq_printf(file, "%-20s: %-20s ", "RgbQrangeSelectable", cap->rgb_qrange_selectable ? STR_YES : STR_NO);
1409 osal_seq_printf(file, "%-20s: %-20s \n", "YccQrangeSelectable", cap->ycc_qrange_selectable ? STR_YES : STR_NO);
1410
1411 return;
1412 }
1413
proc_sink_video_deepcolor(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1414 static hi_void proc_sink_video_deepcolor(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1415 {
1416 /* line 3 deep_color */
1417 osal_seq_printf(file, "%-20s:", "DeepColor");
1418 if (cap->deep_color.deep_color30_bit) {
1419 osal_seq_printf(file, " %-s", "RGB_30Bit");
1420 }
1421 if (cap->deep_color.deep_color36_bit) {
1422 osal_seq_printf(file, " %-s", "RGB_36Bit");
1423 }
1424 if (cap->deep_color.deep_color48_bit) {
1425 osal_seq_printf(file, " %-s", "RGB_48Bit");
1426 }
1427 if (cap->deep_color.deep_color_y444) {
1428 osal_seq_printf(file, " %-s", "YCbCr444_SameRGB");
1429 }
1430 osal_seq_printf(file, "\n");
1431 /* line 4 deep_color_y420 */
1432 osal_seq_printf(file, "%-20s:", "YCbCr420DeepColor");
1433 if (cap->deep_color_y420.deep_color30_bit) {
1434 osal_seq_printf(file, " %-s", "30Bit");
1435 }
1436 if (cap->deep_color_y420.deep_color36_bit) {
1437 osal_seq_printf(file, " %-s", "36Bit");
1438 }
1439 if (cap->deep_color_y420.deep_color48_bit) {
1440 osal_seq_printf(file, " %-s", "48Bit");
1441 }
1442 osal_seq_printf(file, "\n");
1443
1444 return;
1445 }
1446
proc_sink_video_colorimetry(hdmi_proc_entry * file,const hdmi_edid_colorimetry * colorimetry)1447 static hi_void proc_sink_video_colorimetry(hdmi_proc_entry *file, const hdmi_edid_colorimetry *colorimetry)
1448 {
1449 osal_seq_printf(file, "%-20s:", "Colorimetry");
1450 if (colorimetry->xvycc601) {
1451 osal_seq_printf(file, " %-s", "xvYCC601");
1452 }
1453 if (colorimetry->xvycc709) {
1454 osal_seq_printf(file, " %-s", "xvYCC709");
1455 }
1456 if (colorimetry->sycc601) {
1457 osal_seq_printf(file, " %-s", "sYCC601");
1458 }
1459 if (colorimetry->adoble_ycc601) {
1460 osal_seq_printf(file, " %-s", "AdobleYCC601");
1461 }
1462 if (colorimetry->adoble_rgb) {
1463 osal_seq_printf(file, " %-s", "AdobleRGB");
1464 }
1465 if (colorimetry->bt2020c_ycc) {
1466 osal_seq_printf(file, " %-s", "BT2020cYCC");
1467 }
1468 if (colorimetry->bt2020_ycc) {
1469 osal_seq_printf(file, " %-s", "BT2020YCC");
1470 }
1471 if (colorimetry->bt2020_rgb) {
1472 osal_seq_printf(file, " %-s", "BT2020RGB");
1473 }
1474 osal_seq_printf(file, "\n");
1475
1476 return;
1477 }
1478
proc_sink_video_cap(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1479 static hi_void proc_sink_video_cap(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1480 {
1481 hi_u32 i;
1482 hi_char *tmp_fmt = HI_NULL;
1483
1484 tmp_fmt = proc_vicformat(cap->native_format);
1485 hdmi_if_null_warn_return_void(tmp_fmt);
1486
1487 osal_seq_printf(file, "------------------------------ VidoCap --------------------------------------------\n");
1488 /* line 1 */
1489 osal_seq_printf(file, "%-20s: %-s(VIC %2d)\n", "NativeFormat",
1490 (tmp_fmt == HI_NULL ? "" : tmp_fmt), cap->native_format);
1491 /* line 2 color_space */
1492 osal_seq_printf(file, "%-20s:", "ColorSpace");
1493 if (cap->color_space.rgb444) {
1494 osal_seq_printf(file, " %-s", "RGB444");
1495 }
1496 if (cap->color_space.ycbcr444) {
1497 osal_seq_printf(file, " %-s", "YCbCr444");
1498 }
1499 if (cap->color_space.ycbcr422) {
1500 osal_seq_printf(file, " %-s", "YCbCr422");
1501 }
1502 if (cap->only_support_y420_vic_num || cap->support_y420_vic_num) {
1503 osal_seq_printf(file, " %-s", "YCbCr420");
1504 }
1505 osal_seq_printf(file, "\n");
1506 /* line 3~4 deep_color */
1507 proc_sink_video_deepcolor(file, cap);
1508
1509 /* line 5 y420_format[also] */
1510 osal_seq_printf(file, "%-20s:", "YCbCr420[Also]");
1511 for (i = 0; (i < cap->support_y420_vic_num) && (i < HDMI_EDID_MAX_VIC_COUNT); i++) {
1512 osal_seq_printf(file, " %u", cap->support_y420_format[i]);
1513 }
1514 osal_seq_printf(file, "\n");
1515 /* line 6 y420_format[only] */
1516 osal_seq_printf(file, "%-20s:", "YCbCr420[Only]");
1517 for (i = 0; (i < cap->only_support_y420_vic_num) && (i < HDMI_EDID_MAX_VIC_COUNT); i++) {
1518 osal_seq_printf(file, " %u", cap->only_support_y420_format[i]);
1519 }
1520 osal_seq_printf(file, "\n");
1521 /* line 7 colorimetry */
1522 proc_sink_video_colorimetry(file, &cap->color_metry);
1523
1524 return;
1525 }
1526
proc_sink_std_format(hdmi_proc_entry * file,const hdmi_edid_std_timing * std_timing)1527 static hi_bool proc_sink_std_format(hdmi_proc_entry *file, const hdmi_edid_std_timing *std_timing)
1528 {
1529 errno_t ret;
1530 hi_bool line_feed = HI_FALSE;
1531 hi_char *fmt_str = HI_NULL;
1532 hi_char tmp_array[PROC_TEMP_STR_LEN];
1533
1534 fmt_str = proc_std_timingformat(std_timing);
1535 if (fmt_str != HI_NULL) {
1536 osal_seq_printf(file, "%-20s ", fmt_str);
1537 line_feed = HI_TRUE;
1538 } else if ((std_timing->hor_active != 0) && (std_timing->ver_active != 0)) {
1539 int n;
1540 (hi_void)memset_s(tmp_array, sizeof(tmp_array), '\0', sizeof(tmp_array));
1541 n = snprintf_s(tmp_array, PROC_TEMP_STR_LEN, PROC_TEMP_STR_LEN - 1, "%ux%u",
1542 std_timing->hor_active, std_timing->ver_active);
1543 if (n < 0) {
1544 hdmi_err("snprintf_s err\n");
1545 return HI_FALSE;
1546 }
1547 if ((std_timing->refresh_rate) != 0) {
1548 ret = snprintf_s(tmp_array + n, PROC_LENGTH_SIZE - n,
1549 PROC_LENGTH_SIZE - n - 1, "_%u", std_timing->refresh_rate);
1550 if (ret < 0) {
1551 hdmi_err("snprintf_s err\n");
1552 return HI_FALSE;
1553 }
1554 }
1555 osal_seq_printf(file, "%-20s ", tmp_array);
1556 line_feed = HI_TRUE;
1557 }
1558
1559 return line_feed;
1560 }
1561
proc_sink_format_cap(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1562 static hi_void proc_sink_format_cap(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1563 {
1564 hi_u32 i;
1565 hi_s32 j = 0;
1566 hi_char *fmt_str = HI_NULL;
1567
1568 fmt_str = proc_vicformat(cap->native_format);
1569 hdmi_if_null_warn_return_void(fmt_str);
1570
1571 osal_seq_printf(file, "------------------------------ FormatCap ------------------------------------------\n");
1572 /* line 1 */
1573 for (i = 0; (i < cap->support_vic_num) && (i < HDMI_EDID_MAX_VIC_COUNT); i++) {
1574 fmt_str = proc_vicformat(cap->support_format[i]);
1575 if (fmt_str != HI_NULL) {
1576 osal_seq_printf(file, "%-20s ", fmt_str);
1577 } else {
1578 osal_seq_printf(file, "(VIC)%-15u ", cap->support_format[i]);
1579 }
1580 j++;
1581 if ((j % PROC_ONE_LINE_STR_COUNT) == 0) {
1582 osal_seq_printf(file, "\n");
1583 }
1584 }
1585
1586 for (i = 0; i < hdmi_array_size(cap->std_timing); i++) {
1587 if (proc_sink_std_format(file, &cap->std_timing[i]) == HI_TRUE) {
1588 j++;
1589 if ((j % PROC_ONE_LINE_STR_COUNT) == 0) {
1590 osal_seq_printf(file, "\n");
1591 }
1592 }
1593 }
1594
1595 /* VESA enhanced EDID standard release A, rev.1 page 16 */
1596 for (i = 0;
1597 (i < cap->estab_num) && (i < HDMI_EDID_ESTABTIMG_BUTT) &&
1598 (cap->estab_timing[i] < hdmi_array_size(g_estab_timing_str));
1599 i++) {
1600 osal_seq_printf(file, "%-20s ", g_estab_timing_str[i]);
1601 j++;
1602 if ((j % PROC_ONE_LINE_STR_COUNT) == 0) {
1603 osal_seq_printf(file, "\n");
1604 }
1605 }
1606 if ((j % PROC_ONE_LINE_STR_COUNT) != 0) {
1607 osal_seq_printf(file, "\n");
1608 }
1609
1610 return;
1611 }
1612
1613 #ifdef HDMI_3D_SUPPORT
proc_sink_3d_cap(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1614 static hi_void proc_sink_3d_cap(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1615 {
1616 hi_u32 i;
1617
1618 osal_seq_printf(file, "------------------------------ 3DCap ----------------------------------------------\n");
1619 /* line 1 */
1620 osal_seq_printf(file, "%-20s: %-20s ", "3DSupport", cap->_3d_info.support3_d ? STR_YES : STR_NO);
1621 osal_seq_printf(file, "%-20s: %-20s \n", "3DOsdDisparity", cap->support3d_osd_disparity ? STR_YES : STR_NO);
1622 /* line 2 */
1623 osal_seq_printf(file, "%-20s: %-20s ", "3DDualView ", cap->support3d_dual_view ? STR_YES : STR_NO);
1624 osal_seq_printf(file, "%-20s: %-20s \n", "3DIndepView", cap->support3d_independent_view ? STR_YES : STR_NO);
1625 /* line 3 */
1626 osal_seq_printf(file, "%-20s:", "3DTypeSupport");
1627 for (i = 0; i < hdmi_array_size(cap->_3d_info.support3_d_type); i++) {
1628 if (cap->_3d_info.support3_d_type[i] && i < hdmi_array_size(g_stere_mode_str)) {
1629 osal_seq_printf(file, " %s", g_stere_mode_str[i]);
1630 }
1631 }
1632 osal_seq_printf(file, "\n");
1633 }
1634 #endif
1635
proc_sink_audio_cap(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1636 static hi_void proc_sink_audio_cap(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1637 {
1638 hi_u32 i, j;
1639 hdmi_audio_format_code aud_fmt_code;
1640 const hdmi_edid_audio_info *audio_info = HI_NULL;
1641
1642 osal_seq_printf(file, "------------------------------ AudioCap -------------------------------------------\n");
1643 /* audio info */
1644 for (i = 0; (i < cap->audio_info_num) && (i < HDMI_EDID_MAX_AUDIO_CAP_COUNT); i++) {
1645 /* line 1 */
1646 osal_seq_printf(file, "%s.%-d: \n", "NO", i);
1647 aud_fmt_code = cap->audio_info[i].aud_fmt_code;
1648 audio_info = &cap->audio_info[i];
1649 /* line 2 */
1650 osal_seq_printf(file, "%-20s: %-20s ", "CodeType", g_audio_code_type_str[aud_fmt_code]);
1651 osal_seq_printf(file, "%-20s: %-20d \n", "MaxChannelNum", audio_info->aud_channel);
1652 /* line 3 */
1653 if (audio_info->max_bit_rate) {
1654 osal_seq_printf(file, "%-20s: %-20d ", "MaxBitRate(KHz)", audio_info->max_bit_rate);
1655 } else {
1656 osal_seq_printf(file, "%-20s: %-20s ", "MaxBitRate(KHz)", STR_NA);
1657 }
1658 osal_seq_printf(file, "%-20s:", "BitDepth");
1659 if (audio_info->support_bit_depth_num == 0) {
1660 osal_seq_printf(file, " %s", STR_NA);
1661 }
1662 for (j = 0; (j < audio_info->support_bit_depth_num) && (j < HDMI_EDID_MAX_BIT_DEPTH_NUM); j++) {
1663 osal_seq_printf(file, " %u", audio_info->support_bit_depth[j]);
1664 }
1665 osal_seq_printf(file, "\n");
1666 /* line 4 */
1667 osal_seq_printf(file, "%-20s:", "SampleRate(Hz)");
1668 for (j = 0; (j < audio_info->support_sample_rate_num) && (j < HDMI_EDID_MAX_SAMPE_RATE_NUM); j++) {
1669 osal_seq_printf(file, " %u", audio_info->support_sample_rate[j]);
1670 }
1671 osal_seq_printf(file, "\n");
1672 }
1673
1674 return;
1675 }
1676
1677 #ifdef HDMI_HDR_SUPPORT
proc_sink_hdr_cap(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1678 static hi_void proc_sink_hdr_cap(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1679 {
1680 osal_seq_printf(file, "------------------------------- HdrCap -------------------------------------------\n");
1681 /* line 1 */
1682 osal_seq_printf(file, "%-20s: %-20s ", "HdrEotfSdr", cap->hdr_cap.eotf.eotf_sdr ? STR_YES : STR_NO);
1683 osal_seq_printf(file, "%-20s: %-20s \n", "HdrEotfHdr", cap->hdr_cap.eotf.eotf_hdr ? STR_YES : STR_NO);
1684 /* line 2 */
1685 osal_seq_printf(file, "%-20s: %-20s ", "HdrEotfSt2084", cap->hdr_cap.eotf.eotf_smpte_st2084 ? STR_YES : STR_NO);
1686 osal_seq_printf(file, "%-20s: %-20s \n", "HdrEotfHLG", cap->hdr_cap.eotf.eotf_hlg ? STR_YES : STR_NO);
1687 /* line 3 */
1688 osal_seq_printf(file, "%-20s: %-20d ", "MaxLum", cap->hdr_cap.max_luminance_cv);
1689 osal_seq_printf(file, "%-20s: %-20d \n", "AvgLum", cap->hdr_cap.average_lumin_cv);
1690 /* line 4 */
1691 osal_seq_printf(file, "%-20s: %-20d \n", "MinLum", cap->hdr_cap.min_luminance_cv);
1692 osal_seq_printf(file, "------------------------------- DolbyCap -----------------------------------------\n");
1693 osal_seq_printf(file, "%-20s: 0x%-18x ", "DolbyOUI", cap->dolby_cap.dolby_oui);
1694 osal_seq_printf(file, "%-20s: %-20d\n", "DolbyCapsVer", cap->dolby_cap.vsvdb_version);
1695 /* line 1 */
1696 osal_seq_printf(file, "%-20s: %-20s ", "DolbySu_Y422", cap->dolby_cap.yuv422_12_bit ? STR_YES : STR_NO);
1697 osal_seq_printf(file, "%-20s: %-20s\n", "DolbySu_2160P60", cap->dolby_cap.b2160_p60 ? STR_YES : STR_NO);
1698 /* line 2 */
1699 osal_seq_printf(file, "%-20s: %-20d ", "DolbyRed_X", cap->dolby_cap.red_x);
1700 osal_seq_printf(file, "%-20s: %-20d\n", "DolbyRed_Y", cap->dolby_cap.red_y);
1701 /* line 3 */
1702 osal_seq_printf(file, "%-20s: %-20d ", "DolbyGreen_X", cap->dolby_cap.green_x);
1703 osal_seq_printf(file, "%-20s: %-20d\n", "DolbyGreen_Y", cap->dolby_cap.green_y);
1704 /* line 4 */
1705 osal_seq_printf(file, "%-20s: %-20d ", "DolbyBlue_X", cap->dolby_cap.blue_x);
1706 osal_seq_printf(file, "%-20s: %-20d\n", "DolbyBlue_Y", cap->dolby_cap.blue_y);
1707 /* line 5 */
1708 osal_seq_printf(file, "%-20s: %-20d ", "DolbyMinLum", cap->dolby_cap.min_luminance);
1709 osal_seq_printf(file, "%-20s: %-20d\n", "DolbyMaxLum", cap->dolby_cap.max_luminance);
1710 if (cap->dolby_cap.vsvdb_version == 0) {
1711 /* line 6 */
1712 osal_seq_printf(file, "%-20s: %-20d ", "DolbyWhite_X", cap->dolby_cap.un_other_caps.dolby_caps_ver0.white_x);
1713 osal_seq_printf(file, "%-20s: %-20d\n", "DolbyWhite_Y", cap->dolby_cap.un_other_caps.dolby_caps_ver0.white_y);
1714 /* line 7 */
1715 osal_seq_printf(file, "%-20s: %-20d ", "DMmajorVer",
1716 cap->dolby_cap.un_other_caps.dolby_caps_ver0.d_mmajor_version);
1717 osal_seq_printf(file, "%-20s: %-20d\n", "DMminorVer",
1718 cap->dolby_cap.un_other_caps.dolby_caps_ver0.d_mminor_version);
1719 } else if (cap->dolby_cap.vsvdb_version == 1) {
1720 /* line 8 */
1721 osal_seq_printf(file, "%-20s: %-20d ", "DMVersion", cap->dolby_cap.un_other_caps.dolby_caps_ver1.dm_version);
1722 osal_seq_printf(file, "%-20s: %-20d\n", "Colorimetry",
1723 cap->dolby_cap.un_other_caps.dolby_caps_ver1.colorimetry);
1724 }
1725 }
1726 #endif
1727
1728 #ifdef HDMI_FRL_SUPPORT
proc_sink_frl_caps(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1729 static hi_void proc_sink_frl_caps(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1730 {
1731 hi_u32 index;
1732 index = min((hi_s32)cap->max_frl_rate, FRL_WORK_MODE_BUTT);
1733 osal_seq_printf(file, "%-20s: %-20s ", "MaxFrlRate", g_frl_rate_str[index]);
1734 osal_seq_printf(file, "%-20s: %-20s\n", "DSCSupport", cap->dsc_info.dsc_1p2 ? STR_YES : STR_NO);
1735 }
1736 #endif
1737
proc_sink_detail_timing(hdmi_proc_entry * file,const hdmi_sink_capability * cap)1738 static hi_void proc_sink_detail_timing(hdmi_proc_entry *file, const hdmi_sink_capability *cap)
1739 {
1740 hi_u32 i;
1741
1742 /* detail timing */
1743 if (cap->perfer_timing_num > 0) {
1744 /* line1 */
1745 osal_seq_printf(file,
1746 "------------------------------ DetailTiming ------------------------------------------\n");
1747 /* line2 */
1748 osal_seq_printf(file,
1749 "%-5s:%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s|%-4s\n",
1750 "[NO.]", "HACT", "VACT", "P/I", "PClk", "AspW", "AspH",
1751 "HFB", "HPW", "HBB", "VFB", "VPW", "VBB", "img_w", "img_h", "IHS", "IVS", "IDV");
1752 for (i = 0; (i < cap->perfer_timing_num) && (i < HDMI_EDID_MAX_DETAIL_TIMING_COUNT); i++) {
1753 osal_seq_printf(file,
1754 "[%3u]:%-4u|%-4u|%-4c|%-3uM|%-4u|%-4u|%-4u|%-4u|%-4u|%-4u|%-4u|%-4u|%-4u|%-4u|%-4s|%-4s|%-4s\n",
1755 i,
1756 cap->perfer_timing[i].hact,
1757 cap->perfer_timing[i].vact,
1758 cap->perfer_timing[i].interlace ? 'I' : 'P',
1759 cap->perfer_timing[i].pixel_clk / HDMI_THOUSAND,
1760 cap->perfer_timing[i].aspect_ratio_w,
1761 cap->perfer_timing[i].aspect_ratio_h,
1762 cap->perfer_timing[i].hfb,
1763 cap->perfer_timing[i].hpw,
1764 cap->perfer_timing[i].hbb,
1765 cap->perfer_timing[i].vfb,
1766 cap->perfer_timing[i].vpw,
1767 cap->perfer_timing[i].vbb,
1768 cap->perfer_timing[i].image_width,
1769 cap->perfer_timing[i].image_height,
1770 cap->perfer_timing[i].ihs ? STR_YES : STR_NO,
1771 cap->perfer_timing[i].ivs ? STR_YES : STR_NO,
1772 cap->perfer_timing[i].idv ? STR_YES : STR_NO);
1773 }
1774 }
1775
1776 return;
1777 }
1778
drv_hdmi_read_proc(hdmi_proc_entry * file)1779 hi_s32 drv_hdmi_read_proc(hdmi_proc_entry *file)
1780 {
1781 hdmi_device *hdmi_dev = HI_NULL;
1782
1783 hdmi_if_null_warn_return(file, HI_FAILURE);
1784 hdmi_dev = get_hdmi_device(HDMI_DEVICE_ID0);
1785 hdmi_if_null_warn_return(hdmi_dev, HI_FAILURE);
1786 /* to avoid the hal pointer is null when call the proc and deinit at the same time. */
1787 hdmi_mutex_lock(hdmi_dev->mutex_proc);
1788
1789 osal_seq_printf(file, "\n%s\n\n", VERSION_STRING);
1790 proc_sw_version(file);
1791 proc_app_attr_info(file, HDMI_DEVICE_ID0);
1792 proc_sw_status(file, HDMI_DEVICE_ID0);
1793 #if defined HDMI_HDR_SUPPORT
1794 proc_hdr_status(file, HDMI_DEVICE_ID0);
1795 #endif
1796 #ifdef HDMI_FRL_SUPPORT
1797 proc_frl_status(file, HDMI_DEVICE_ID0);
1798 #endif
1799 proc_hw_status(file, HDMI_DEVICE_ID0);
1800 proc_event_info(file, HDMI_DEVICE_ID0);
1801 hdmi_mutex_unlock(hdmi_dev->mutex_proc);
1802
1803 return HI_SUCCESS;
1804 }
1805
drv_hdmi_vo_read_proc(hdmi_proc_entry * file)1806 hi_s32 drv_hdmi_vo_read_proc(hdmi_proc_entry *file)
1807 {
1808 hdmi_device *hdmi_dev = HI_NULL;
1809
1810 hdmi_if_null_warn_return(file, HI_FAILURE);
1811 hdmi_dev = get_hdmi_device(HDMI_DEVICE_ID0);
1812 hdmi_if_null_warn_return(hdmi_dev, HI_FAILURE);
1813 /* to avoid the hal pointer is null when call the proc and deinit at the same time. */
1814 hdmi_mutex_lock(hdmi_dev->mutex_proc);
1815 osal_seq_printf(file, "\n%s\n\n", VERSION_STRING);
1816
1817 proc_sw_version(file);
1818 proc_video_info(file, HDMI_DEVICE_ID0);
1819 #ifdef HDMI_HDR_SUPPORT
1820 proc_hdr_info(file, HDMI_DEVICE_ID0);
1821 #endif
1822 hdmi_mutex_unlock(hdmi_dev->mutex_proc);
1823
1824 return HI_SUCCESS;
1825 }
1826
drv_hdmi_ao_read_proc(osal_proc_entry_t * file)1827 hi_s32 drv_hdmi_ao_read_proc(osal_proc_entry_t *file)
1828 {
1829 hdmi_device *hdmi_dev = HI_NULL;
1830
1831 hdmi_if_null_warn_return(file, HI_FAILURE);
1832 hdmi_dev = get_hdmi_device(HDMI_DEVICE_ID0);
1833 hdmi_if_null_warn_return(hdmi_dev, HI_FAILURE);
1834 /* to avoid the hal pointer is null when call the proc and deinit at the same time. */
1835 hdmi_mutex_lock(hdmi_dev->mutex_proc);
1836 osal_seq_printf(file, "\n%s\n\n", VERSION_STRING);
1837
1838 proc_sw_version(file);
1839 proc_audio_info(file, HDMI_DEVICE_ID0);
1840
1841 hdmi_mutex_unlock(hdmi_dev->mutex_proc);
1842
1843 return HI_SUCCESS;
1844 }
1845
drv_hdmi_sink_read_proc(osal_proc_entry_t * file)1846 hi_s32 drv_hdmi_sink_read_proc(osal_proc_entry_t *file)
1847 {
1848 hi_s32 ret;
1849 hdmi_device *hdmi_dev = HI_NULL;
1850 hdmi_sink_capability *cap = HI_NULL;
1851
1852 hdmi_if_null_warn_return(file, HI_FAILURE);
1853 hdmi_dev = get_hdmi_device(HDMI_DEVICE_ID0);
1854 hdmi_if_null_warn_return(hdmi_dev, HI_FAILURE);
1855 /* to avoid the hal pointer is null when call the proc and deinit at the same time. */
1856 hdmi_mutex_lock(hdmi_dev->mutex_proc);
1857
1858 osal_seq_printf(file, "\n%s\n\n", VERSION_STRING);
1859
1860 proc_sw_version(file);
1861 proc_edid_raw_data(file, HDMI_DEVICE_ID0);
1862 proc_edid_status(file, HDMI_DEVICE_ID0);
1863 ret = proc_get_cap_info(HDMI_DEVICE_ID0, &cap);
1864 if (ret == HI_SUCCESS && cap != HI_NULL) {
1865 proc_sink_basic_cap(file, cap);
1866 #ifdef HDMI_FRL_SUPPORT
1867 proc_sink_frl_caps(file, cap);
1868 #endif
1869 proc_sink_video_cap(file, cap);
1870 proc_sink_format_cap(file, cap);
1871 #ifdef HDMI_3D_SUPPORT
1872 proc_sink_3d_cap(file, cap);
1873 #endif
1874 proc_sink_audio_cap(file, cap);
1875 #ifdef HDMI_HDR_SUPPORT
1876 proc_sink_hdr_cap(file, cap);
1877 #endif
1878 proc_sink_detail_timing(file, cap);
1879 } else {
1880 hdmi_warn("call proc_get_cap_info failed! ret: %d, cap: %p\n", ret, cap);
1881 }
1882 hdmi_mutex_unlock(hdmi_dev->mutex_proc);
1883
1884 return HI_SUCCESS;
1885 }
1886
1887