• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef __DRV_HDMI_INFOFRAME_H__
20 #define __DRV_HDMI_INFOFRAME_H__
21 
22 #include "hi_type.h"
23 #include "autoconf.h"
24 
25 #define HDMI_INFOFRAME_HEADER_SIZE    4
26 #define HDMI_AVI_INFOFRAME_SIZE       13
27 #define HDMI_SPD_INFOFRAME_SIZE       25
28 #define HDMI_AUDIO_INFOFRAME_SIZE     10
29 /* user data len:31 - 4(pkt header) - 5(4K- the length must be 0x05)  */
30 #define HDMI_VENDOR_USER_DATA_MAX_LEN 22
31 
32 enum hdmi_infoframe_type {
33     HDMI_INFOFRAME_TYPE_NULL,
34     HDMI_INFOFRAME_TYPE_VENDOR = 0x81,
35     HDMI_INFOFRAME_TYPE_AVI,
36     HDMI_INFOFRAME_TYPE_SPD,
37     HDMI_INFOFRAME_TYPE_AUDIO,
38     HDMI_INFOFRAME_TYPE_MPEG,
39     HDMI_INFOFRAME_TYPE_GBD,
40     HDMI_INFOFRAME_TYPE_DRM,
41     HDMI_INFOFRAME_TYPE_BUTT
42 };
43 
44 typedef enum {
45     HDMI_COLORSPACE_RGB,
46     HDMI_COLORSPACE_YCBCR422,
47     HDMI_COLORSPACE_YCBCR444,
48     HDMI_COLORSPACE_YCBCR420,
49     HDMI_COLORSPACE_BUTT
50 } hdmi_colorspace;
51 
52 enum hdmi_scan_mode {
53     HDMI_SCAN_MODE_NONE,
54     HDMI_SCAN_MODE_OVERSCAN,
55     HDMI_SCAN_MODE_UNDERSCAN,
56     HDMI_SCAN_MODE_FUTURE,
57     HDMI_SCAN_MODE_BUTT
58 };
59 
60 enum hdmi_colorimetry {
61     HDMI_COLORIMETRY_NONE,
62     HDMI_COLORIMETRY_ITU_601,
63     HDMI_COLORIMETRY_ITU_709,
64     HDMI_COLORIMETRY_EXTEND
65 };
66 
67 typedef enum {
68     HDMI_PICTURE_ASPECT_NONE,
69     HDMI_PICTURE_ASPECT_4_3,
70     HDMI_PICTURE_ASPECT_16_9,
71     HDMI_PICTURE_ASPECT_64_27,
72     HDMI_PICTURE_ASPECT_256_135,
73     HDMI_PICTURE_ASPECT_FUTURE,
74     HDMI_PICTURE_ASPECT_BUTT
75 } hdmi_picture_aspect;
76 
77 typedef enum {
78     HDMI_ACTIVE_ASPECT_16_9_TOP = 2,
79     HDMI_ACTIVE_ASPECT_14_9_TOP,
80     HDMI_ACTIVE_ASPECT_16_9_CENTER,
81     HDMI_ACTIVE_ASPECT_PICTURE = 8,
82     HDMI_ACTIVE_ASPECT_4_3,
83     HDMI_ACTIVE_ASPECT_16_9,
84     HDMI_ACTIVE_ASPECT_14_9,
85     HDMI_ACTIVE_ASPECT_4_3_SP_14_9 = 13,
86     HDMI_ACTIVE_ASPECT_16_9_SP_14_9,
87     HDMI_ACTIVE_ASPECT_16_9_SP_4_3,
88     HDMI_ACTIVE_ASPECT_BUTT
89 } hdmi_active_aspect;
90 
91 typedef enum {
92     HDMI_EXTENDED_COLORIMETRY_XV_YCC_601,
93     HDMI_EXTENDED_COLORIMETRY_XV_YCC_709,
94     HDMI_EXTENDED_COLORIMETRY_S_YCC_601,
95     HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601,
96     HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB,
97     HDMI_EXTENDED_COLORIMETRY_2020_CONST_LUMINOUS,
98     HDMI_EXTENDED_COLORIMETRY_2020_NON_CONST_LUMINOUS,
99     HDMI_EXTENDED_COLORIMETRY_ADDITIONAL,
100     HDMI_EXTENDED_COLORIMETRY_BUTT
101 } hdmi_extended_colormetry;
102 
103 typedef enum {
104     HDMI_QUANTIZATION_RANGE_DEFAULT,
105     HDMI_QUANTIZATION_RANGE_LIMITED,
106     HDMI_QUANTIZATION_RANGE_FULL,
107     HDMI_QUANTIZATION_RANGE_BUTT
108 } hdmi_quantization_range;
109 
110 enum hdmi_nups {
111     HDMI_NUPS_UNKNOWN,
112     HDMI_NUPS_HORIZONTAL,
113     HDMI_NUPS_VERTICAL,
114     HDMI_NUPS_BOTH
115 };
116 
117 typedef enum {
118     HDMI_YCC_QUANTIZATION_RANGE_LIMITED,
119     HDMI_YCC_QUANTIZATION_RANGE_FULL,
120     HDMI_YCC_QUANTIZATION_RANGE_BUTT
121 } hdmi_ycc_quantization_range;
122 
123 enum hdmi_content_type {
124     HDMI_CONTENT_TYPE_NONE,
125     HDMI_CONTENT_TYPE_PHOTO,
126     HDMI_CONTENT_TYPE_CINEMA,
127     HDMI_CONTENT_TYPE_GAME
128 };
129 
130 typedef enum {
131     HDMI_640X480P60_4_3 = 1,
132     HDMI_720X480P60_4_3,
133     HDMI_720X480P60_16_9,
134     HDMI_1280X720P60_16_9,
135     HDMI_1920X1080I60_16_9,
136     HDMI_1440X480I60_4_3,
137     HDMI_1440X480I60_16_9,  // 7
138     HDMI_1440X240P60_4_3,
139     HDMI_1440X240P60_16_9,
140     HDMI_2880X480I60_4_3,
141     HDMI_2880X480I60_16_9,
142     HDMI_2880X240P60_4_3,   // 12
143     HDMI_2880X240P60_16_9,
144     HDMI_1440X480P60_4_3,
145     HDMI_1440X480P60_16_9,
146     HDMI_1920X1080P60_16_9,
147     HDMI_720X576P50_4_3,
148     HDMI_720X576P50_16_9,
149     HDMI_1280X720P50_16_9,
150     HDMI_1920X1080I50_16_9,
151     HDMI_1440X576I50_4_3,
152     HDMI_1440X576I50_16_9,
153     HDMI_1440X288P50_4_3,
154     HDMI_1440X288P50_16_9,  // 24
155     HDMI_2880X576I50_4_3,
156     HDMI_2880X576I50_16_9,
157     HDMI_2880X288P50_4_3,
158     HDMI_2880X288P50_16_9,
159     HDMI_1440X576P50_4_3,
160     HDMI_1440X576P50_16_9,  // 30
161     HDMI_1920X1080P50_16_9,
162     HDMI_1920X1080P24_16_9,
163     HDMI_1920X1080P25_16_9,
164     HDMI_1920X1080P30_16_9,
165     HDMI_2880X480P60_4_3,
166     HDMI_2880X480P60_16_9,
167     HDMI_2880X576P50_4_3,
168     HDMI_2880X576P50_16_9,  // 38
169     HDMI_1920X1080I50_16_9_1250,
170     HDMI_1920X1080I100_16_9,
171     HDMI_1280X720P100_16_9,
172     HDMI_720X576P100_4_3,
173     HDMI_720X576P100_16_9,
174     HDMI_1440X576I100_4_3,
175     HDMI_1440X576I100_16_9, // 45
176     HDMI_1920X1080I120_16_9,
177     HDMI_1280X720P120_16_9,
178     HDMI_720X480P120_4_3,
179     HDMI_720X480P120_16_9,
180     HDMI_1440X480I120_4_3,
181     HDMI_1440X480I120_16_9, // 51
182     HDMI_720X576P200_4_3,
183     HDMI_720X576P200_16_9,
184     HDMI_1440X576I200_4_3,
185     HDMI_1440X576I200_16_9,
186     HDMI_720X480P240_4_3,
187     HDMI_720X480P240_16_9,
188     HDMI_1440X480I240_4_3,
189     HDMI_1440X480I240_16_9, // 59
190     HDMI_1280X720P24_16_9,
191     HDMI_1280X720P25_16_9,
192     HDMI_1280X720P30_16_9,
193     HDMI_1920X1080P120_16_9,
194     HDMI_1920X1080P100_16_9,
195     HDMI_1280X720P24_64_27,
196     HDMI_1280X720P25_64_27,
197     HDMI_1280X720P30_64_27,
198     HDMI_1280X720P50_64_27,
199     HDMI_1280X720P60_64_27, // 69
200     HDMI_1280X720P100_64_27,
201     HDMI_1280X720P120_64_27,
202     HDMI_1920X1080P24_64_27,
203     HDMI_1920X1080P25_64_27,
204     HDMI_1920X1080P30_64_27,
205     HDMI_1920X1080P50_64_27,
206     HDMI_1920X1080P60_64_27, // 76
207     HDMI_1920X1080P100_64_27,
208     HDMI_1920X1080P120_64_27,
209     HDMI_1680X720P24_64_27,
210     HDMI_1680X720P25_64_27,
211     HDMI_1680X720P30_64_27,
212     HDMI_1680X720P50_64_27,
213     HDMI_1680X720P60_64_27, // 83
214     HDMI_1680X720P100_64_27,
215     HDMI_1680X720P120_64_27,
216     HDMI_2560X1080P24_64_27,
217     HDMI_2560X1080P25_64_27,
218     HDMI_2560X1080P30_64_27,
219     HDMI_2560X1080P50_64_27,
220     HDMI_2560X1080P60_64_27,
221     HDMI_2560X1080P100_64_27,
222     HDMI_2560X1080P120_64_27, // 92
223     HDMI_3840X2160P24_16_9,
224     HDMI_3840X2160P25_16_9,
225     HDMI_3840X2160P30_16_9,
226     HDMI_3840X2160P50_16_9,
227     HDMI_3840X2160P60_16_9,
228     HDMI_4096X2160P24_256_135,
229     HDMI_4096X2160P25_256_135,
230     HDMI_4096X2160P30_256_135,
231     HDMI_4096X2160P50_256_135,
232     HDMI_4096X2160P60_256_135,
233     HDMI_3840X2160P24_64_27,
234     HDMI_3840X2160P25_64_27,
235     HDMI_3840X2160P30_64_27,
236     HDMI_3840X2160P50_64_27,
237     HDMI_3840X2160P60_64_27, // 107
238     HDMI_1280X720P48_16_9,
239     HDMI_1280X720P48_64_27,
240     HDMI_1680X720P48_64_27,
241     HDMI_1920X1080P48_16_9,
242     HDMI_1920X1080P48_64_27,
243     HDMI_2560X1080P48_64_27,
244     HDMI_3840X2160P48_16_9,
245     HDMI_4096X2160P48_256_135,
246     HDMI_3840X2160P48_64_27,
247     HDMI_3840X2160P100_16_9,
248     HDMI_3840X2160P120_16_9,
249     HDMI_3840X2160P100_64_27,
250     HDMI_3840X2160P120_64_27,
251     HDMI_5120X2160P24_64_27, // 121
252     HDMI_5120X2160P25_64_27,
253     HDMI_5120X2160P30_64_27,
254     HDMI_5120X2160P48_64_27,
255     HDMI_5120X2160P50_64_27,
256     HDMI_5120X2160P60_64_27,
257     HDMI_5120X2160P100_64_27, // 127
258     HDMI_5120X2160P120_64_27 = 193,
259     HDMI_7680X4320P24_16_9,
260     HDMI_7680X4320P25_16_9,
261     HDMI_7680X4320P30_16_9,
262     HDMI_7680X4320P48_16_9,
263     HDMI_7680X4320P50_16_9,
264     HDMI_7680X4320P60_16_9,
265     HDMI_7680X4320P100_16_9, // 200
266     HDMI_7680X4320P120_16_9,
267     HDMI_7680X4320P24_64_27,
268     HDMI_7680X4320P25_64_27,
269     HDMI_7680X4320P30_64_27,
270     HDMI_7680X4320P48_64_27,
271     HDMI_7680X4320P50_64_27,
272     HDMI_7680X4320P60_64_27,
273     HDMI_7680X4320P100_64_27,
274     HDMI_7680X4320P120_64_27,
275     HDMI_10240X4320P24_64_27,
276     HDMI_10240X4320P25_64_27,
277     HDMI_10240X4320P30_64_27,
278     HDMI_10240X4320P48_64_27,
279     HDMI_10240X4320P50_64_27, // 214
280     HDMI_10240X4320P60_64_27,
281     HDMI_10240X4320P100_64_27,
282     HDMI_10240X4320P120_64_27,
283     HDMI_4096X2160P100_256_135,
284     HDMI_4096X2160P120_256_135, // 219
285     HDMI_VIDEO_CODE_BUTT
286 } hdmi_video_code_vic;
287 
288 typedef enum {
289     HDMI_VIDEO_TIMING_UNKNOWN,
290     HDMI_VIDEO_TIMING_640X480P_60000,
291     HDMI_VIDEO_TIMING_720X480P_60000,
292     HDMI_VIDEO_TIMING_720X480P_120000,
293     HDMI_VIDEO_TIMING_720X480P_240000,  // 4
294     HDMI_VIDEO_TIMING_720X576P_50000,
295     HDMI_VIDEO_TIMING_720X576P_100000,
296     HDMI_VIDEO_TIMING_720X576P_200000,  // 7
297     HDMI_VIDEO_TIMING_1280X720P_24000,
298     HDMI_VIDEO_TIMING_1280X720P_25000,
299     HDMI_VIDEO_TIMING_1280X720P_30000,  // 10
300     HDMI_VIDEO_TIMING_1280X720P_48000,
301     HDMI_VIDEO_TIMING_1280X720P_50000,
302     HDMI_VIDEO_TIMING_1280X720P_60000,
303     HDMI_VIDEO_TIMING_1280X720P_100000,
304     HDMI_VIDEO_TIMING_1280X720P_120000,
305     HDMI_VIDEO_TIMING_1440X240P_60000,  // 15
306     HDMI_VIDEO_TIMING_1440X288P_50000,
307     HDMI_VIDEO_TIMING_1440X480I_60000,
308     HDMI_VIDEO_TIMING_1440X480P_60000,
309     HDMI_VIDEO_TIMING_1440X480I_120000,
310     HDMI_VIDEO_TIMING_1440X480I_240000,
311     HDMI_VIDEO_TIMING_1440X576I_50000,  // 21
312     HDMI_VIDEO_TIMING_1440X576P_50000,
313     HDMI_VIDEO_TIMING_1440X576I_60000,
314     HDMI_VIDEO_TIMING_1440X576I_100000,
315     HDMI_VIDEO_TIMING_1440X576I_200000,
316     HDMI_VIDEO_TIMING_2880X288P_50000,  // 26
317     HDMI_VIDEO_TIMING_2880X480I_60000,
318     HDMI_VIDEO_TIMING_2880X480P_60000,
319     HDMI_VIDEO_TIMING_2880X240I_60000,
320     HDMI_VIDEO_TIMING_2880X576I_50000,
321     HDMI_VIDEO_TIMING_2880X576P_50000,
322     HDMI_VIDEO_TIMING_1680X720P_24000,  // 32
323     HDMI_VIDEO_TIMING_1680X720P_25000,
324     HDMI_VIDEO_TIMING_1680X720P_30000,
325     HDMI_VIDEO_TIMING_1680X720P_48000,
326     HDMI_VIDEO_TIMING_1680X720P_50000,
327     HDMI_VIDEO_TIMING_1680X720P_60000,
328     HDMI_VIDEO_TIMING_1680X720P_100000,
329     HDMI_VIDEO_TIMING_1680X720P_120000,
330     HDMI_VIDEO_TIMING_2560X1080P_24000, // 39
331     HDMI_VIDEO_TIMING_2560X1080P_25000,
332     HDMI_VIDEO_TIMING_2560X1080P_30000,
333     HDMI_VIDEO_TIMING_2560X1080P_48000,
334     HDMI_VIDEO_TIMING_2560X1080P_50000,
335     HDMI_VIDEO_TIMING_2560X1080P_60000,
336     HDMI_VIDEO_TIMING_2560X1080P_100000,
337     HDMI_VIDEO_TIMING_2560X1080P_120000, // 45
338     HDMI_VIDEO_TIMING_1920X1080I_60000,
339     HDMI_VIDEO_TIMING_1920X1080P_60000,
340     HDMI_VIDEO_TIMING_1920X1080I_50000,
341     HDMI_VIDEO_TIMING_1920X1080P_50000,
342     HDMI_VIDEO_TIMING_1920X1080P_24000,
343     HDMI_VIDEO_TIMING_1920X1080P_25000,
344     HDMI_VIDEO_TIMING_1920X1080P_30000,
345     HDMI_VIDEO_TIMING_1920X1080P_48000,
346     HDMI_VIDEO_TIMING_1920X1080I_100000,
347     HDMI_VIDEO_TIMING_1920X1080I_120000,
348     HDMI_VIDEO_TIMING_1920X1080P_120000,
349     HDMI_VIDEO_TIMING_1920X1080P_100000, // 56
350     HDMI_VIDEO_TIMING_3840X2160P_24000,
351     HDMI_VIDEO_TIMING_3840X2160P_25000,
352     HDMI_VIDEO_TIMING_3840X2160P_30000,
353     HDMI_VIDEO_TIMING_3840X2160P_48000,
354     HDMI_VIDEO_TIMING_3840X2160P_50000,
355     HDMI_VIDEO_TIMING_3840X2160P_60000,
356     HDMI_VIDEO_TIMING_3840X2160P_100000,
357     HDMI_VIDEO_TIMING_3840X2160P_120000,
358     HDMI_VIDEO_TIMING_4096X2160P_24000,
359     HDMI_VIDEO_TIMING_4096X2160P_25000,
360     HDMI_VIDEO_TIMING_4096X2160P_30000,
361     HDMI_VIDEO_TIMING_4096X2160P_48000,
362     HDMI_VIDEO_TIMING_4096X2160P_50000,
363     HDMI_VIDEO_TIMING_4096X2160P_60000,
364     HDMI_VIDEO_TIMING_4096X2160P_100000,
365     HDMI_VIDEO_TIMING_4096X2160P_120000,
366     HDMI_VIDEO_TIMING_5120X2160P_24000,
367     HDMI_VIDEO_TIMING_5120X2160P_25000,
368     HDMI_VIDEO_TIMING_5120X2160P_30000,
369     HDMI_VIDEO_TIMING_5120X2160P_48000,
370     HDMI_VIDEO_TIMING_5120X2160P_50000,
371     HDMI_VIDEO_TIMING_5120X2160P_60000,
372     HDMI_VIDEO_TIMING_5120X2160P_100000,
373     HDMI_VIDEO_TIMING_5120X2160P_120000,
374     HDMI_VIDEO_TIMING_7680X4320P_24000,
375     HDMI_VIDEO_TIMING_7680X4320P_25000,
376     HDMI_VIDEO_TIMING_7680X4320P_30000,
377     HDMI_VIDEO_TIMING_7680X4320P_48000,
378     HDMI_VIDEO_TIMING_7680X4320P_50000,
379     HDMI_VIDEO_TIMING_7680X4320P_60000,
380     HDMI_VIDEO_TIMING_7680X4320P_100000,
381     HDMI_VIDEO_TIMING_7680X4320P_120000,
382     HDMI_VIDEO_TIMING_10240X4320P_24000,
383     HDMI_VIDEO_TIMING_10240X4320P_25000,
384     HDMI_VIDEO_TIMING_10240X4320P_30000,
385     HDMI_VIDEO_TIMING_10240X4320P_48000,
386     HDMI_VIDEO_TIMING_10240X4320P_50000,
387     HDMI_VIDEO_TIMING_10240X4320P_60000,
388     HDMI_VIDEO_TIMING_10240X4320P_100000,
389     HDMI_VIDEO_TIMING_10240X4320P_120000,
390     HDMI_VIDEO_TIMING_VESA_DEFINE,
391     HDMI_VIDEO_TIMING_VESA_800X600_60,
392     HDMI_VIDEO_TIMING_VESA_848X480_60,
393     HDMI_VIDEO_TIMING_VESA_1024X768_60,
394     HDMI_VIDEO_TIMING_VESA_1280X720_60,
395     HDMI_VIDEO_TIMING_VESA_1280X768_60,
396     HDMI_VIDEO_TIMING_VESA_1280X768_60_RB,
397     HDMI_VIDEO_TIMING_VESA_1280X800_60,
398     HDMI_VIDEO_TIMING_VESA_1280X800_60_RB,
399     HDMI_VIDEO_TIMING_VESA_1280X960_60,
400     HDMI_VIDEO_TIMING_VESA_1280X1024_60,
401     HDMI_VIDEO_TIMING_VESA_1360X768_60,
402     HDMI_VIDEO_TIMING_VESA_1366X768_60,
403     HDMI_VIDEO_TIMING_VESA_1400X1050_60,
404     HDMI_VIDEO_TIMING_VESA_1440X900_60,
405     HDMI_VIDEO_TIMING_VESA_1440X900_60_RB,
406     HDMI_VIDEO_TIMING_VESA_1440X1050_60,
407     HDMI_VIDEO_TIMING_VESA_1440X1050_60_RB,
408     HDMI_VIDEO_TIMING_VESA_1600X900_60_RB,
409     HDMI_VIDEO_TIMING_VESA_1600X1200_60,
410     HDMI_VIDEO_TIMING_VESA_1680X1050_60,
411     HDMI_VIDEO_TIMING_VESA_1680X1050_60_RB,
412     HDMI_VIDEO_TIMING_VESA_1792X1344_60,
413     HDMI_VIDEO_TIMING_VESA_1856X1392_60,
414     HDMI_VIDEO_TIMING_VESA_1920X1080_60,
415     HDMI_VIDEO_TIMING_VESA_1920X1200_60,
416     HDMI_VIDEO_TIMING_VESA_1920X1200_60_RB,
417     HDMI_VIDEO_TIMING_VESA_1920X1440_60,
418     HDMI_VIDEO_TIMING_VESA_2048X1152_60,
419     HDMI_VIDEO_TIMING_VESA_2560X1440_60_RB,
420     HDMI_VIDEO_TIMING_VESA_2560X1600_60,
421     HDMI_VIDEO_TIMING_VESA_2560X1600_60_RB,
422     HDMI_VIDEO_TIMING_USER_DEFINE,
423     HDMI_VIDEO_TIMING_USER_1920X2160_30,
424     HDMI_VIDEO_TIMING_USER_2560X1440_30,
425     HDMI_VIDEO_TIMING_USER_2560X1440_60,
426     HDMI_VIDEO_TIMING_USER_1280X720_60,
427     HDMI_VIDEO_TIMING_USER_1366X768_60,
428     HDMI_VIDEO_TIMING_USER_1600X900_60_RB,
429     HDMI_VIDEO_TIMING_USER_1920X1080_60,
430     HDMI_VIDEO_TIMING_USER_2048X1152_60,
431     HDMI_VIDEO_TIMING_BUTT
432 } hdmi_video_timing;
433 
434 typedef enum {
435     HDMI_VIDEO_FORMAT_1080P_60,
436     HDMI_VIDEO_FORMAT_1080P_50,
437     HDMI_VIDEO_FORMAT_1080P_30,
438     HDMI_VIDEO_FORMAT_1080P_25,
439     HDMI_VIDEO_FORMAT_1080P_24,
440     HDMI_VIDEO_FORMAT_1080I_60,
441     HDMI_VIDEO_FORMAT_1080I_50,
442     HDMI_VIDEO_FORMAT_720P_60,
443     HDMI_VIDEO_FORMAT_720P_50,
444     HDMI_VIDEO_FORMAT_576P_50,
445     HDMI_VIDEO_FORMAT_480P_60,
446     HDMI_VIDEO_FORMAT_PAL,
447     HDMI_VIDEO_FORMAT_NTSC,
448     HDMI_VIDEO_FORMAT_861D_640X480_60,
449     HDMI_VIDEO_FORMAT_VESA_800X600_60,
450     HDMI_VIDEO_FORMAT_VESA_1024X768_60,
451     HDMI_VIDEO_FORMAT_VESA_1280X800_60,
452     HDMI_VIDEO_FORMAT_VESA_1280X1024_60,
453     HDMI_VIDEO_FORMAT_VESA_1366X768_60,
454     HDMI_VIDEO_FORMAT_VESA_1440X900_60,
455 #ifdef CONFIG_HI_PLATFORM_H8
456     HDMI_VIDEO_FORMAT_VESA_1400X1050_60,
457 #endif
458     HDMI_VIDEO_FORMAT_VESA_1600X1200_60,
459     HDMI_VIDEO_FORMAT_VESA_1680X1050_60,
460     HDMI_VIDEO_FORMAT_VESA_1920X1200_60,
461     HDMI_VIDEO_FORMAT_2560X1440_30,
462     HDMI_VIDEO_FORMAT_2560X1440_60,
463     HDMI_VIDEO_FORMAT_2560X1600_60,
464     HDMI_VIDEO_FORMAT_1920X2160_30,
465     HDMI_VIDEO_FORMAT_3840X2160P_24,
466     HDMI_VIDEO_FORMAT_3840X2160P_25,
467     HDMI_VIDEO_FORMAT_3840X2160P_30,
468     HDMI_VIDEO_FORMAT_3840X2160P_50,
469     HDMI_VIDEO_FORMAT_3840X2160P_60,
470     HDMI_VIDEO_FORMAT_4096X2160P_24,
471     HDMI_VIDEO_FORMAT_4096X2160P_25,
472     HDMI_VIDEO_FORMAT_4096X2160P_30,
473     HDMI_VIDEO_FORMAT_4096X2160P_50,
474     HDMI_VIDEO_FORMAT_4096X2160P_60,
475     HDMI_VIDEO_FORMAT_3840X2160P_120,
476     HDMI_VIDEO_FORMAT_4096X2160P_120,
477     HDMI_VIDEO_FORMAT_7680X4320P_30,
478     HDMI_VIDEO_FORMAT_VESA_CUSTOMER_DEFINE,
479     HDMI_VIDEO_FORMAT_BUTT
480 } hdmi_disp_format;
481 
482 struct hdmi_avi_infoframe {
483     enum hdmi_infoframe_type    type;
484     hi_u8                       version;
485     hi_u8                       length;
486     hdmi_colorspace             colorspace;
487     hi_bool                     active_info_valid;
488     hi_bool                     horizontal_bar_valid;
489     hi_bool                     vertical_bar_valid;
490     enum hdmi_scan_mode         scan_mode;
491     enum hdmi_colorimetry       colorimetry;
492     hdmi_picture_aspect         picture_aspect;
493     hdmi_active_aspect          active_aspect;
494     hi_bool                     itc;
495     hdmi_extended_colormetry    extended_colorimetry;
496     hdmi_quantization_range     quantization_range;
497     enum hdmi_nups              nups;
498     hdmi_video_timing           video_timing;
499     hdmi_disp_format            disp_fmt;
500     hdmi_ycc_quantization_range ycc_quantization_range;
501     enum hdmi_content_type      content_type;
502     hi_u8                       pixel_repeat;
503     hi_u16                      top_bar;
504     hi_u16                      bottom_bar;
505     hi_u16                      left_bar;
506     hi_u16                      right_bar;
507 };
508 
509 typedef enum {
510     HDMI_EOTF_SDR_LUMIN,     /* traditional gamma - SDR luminance range */
511     HDMI_EOTF_HDR_LUMIN,     /* traditional gamma - HDR luminance range */
512     HDMI_EOTF_SMPTE_ST_2048, /* SMPTE ST 2084 */
513     HDMI_EOTF_HLG,           /* hybrid log-gamma(HLG) */
514     HDMI_EOTF_BUTT
515 } hdmi_eotf_type;
516 
517 enum hdmi_static_metadata_type {
518     HDMI_HDR_METADATA_ID_0, /* static metadata type 1 */
519     HDMI_HDR_METADATA_ID_BUTT
520 };
521 
522 struct hdmi_meta_descriptor_1st {
523     hi_u16 primaries0_x;        /* display_primaries_x[0], range[0,50000], in units of 0.00002 */
524     hi_u16 primaries0_y;        /* display_primaries_y[0], range[0,50000], in units of 0.00002 */
525     hi_u16 primaries1_x;        /* display_primaries_x[1], range[0,50000], in units of 0.00002 */
526     hi_u16 primaries1_y;        /* display_primaries_y[1], range[0,50000], in units of 0.00002 */
527     hi_u16 primaries2_x;        /* display_primaries_x[2], range[0,50000], in units of 0.00002 */
528     hi_u16 primaries2_y;        /* display_primaries_y[2], range[0,50000], in units of 0.00002 */
529     hi_u16 white_point_x;       /* white_point_x, range[0,50000], in units of 0.00002 */
530     hi_u16 white_point_y;       /* white_point_y, range[0,50000], in units of 0.00002 */
531     hi_u16 max_luminance;       /* max_display_mastering_luminance, in units of 1 cd/m^2 */
532     hi_u16 min_luminance;       /* min_display_mastering_luminance, in units of 0.0001 cd/m^2 */
533     hi_u16 max_light_level;     /* maximum content light level, in units of 1 cd/m2 */
534     hi_u16 average_light_level; /* maximum frame-average light level,in units of 1 cd/m^2 */
535 };
536 
537 union hdmi_meta_descriptor {
538     struct hdmi_meta_descriptor_1st type1; /* static metadata descriptor type1 */
539 };
540 
541 struct hdmi_drm_infoframe {
542     enum hdmi_infoframe_type type;
543     hi_u8 version;
544     hi_u8 length;
545     hdmi_eotf_type eotf_type;
546     enum hdmi_static_metadata_type metadata_type;
547     union hdmi_meta_descriptor meta_descriptor;
548 };
549 
550 enum hdmi_audio_sample_size {
551     HDMI_AUDIO_SAMPLE_SIZE_STREAM,
552     HDMI_AUDIO_SAMPLE_SIZE_16,
553     HDMI_AUDIO_SAMPLE_SIZE_20,
554     HDMI_AUDIO_SAMPLE_SIZE_24
555 };
556 
557 enum hdmi_audio_sample_frequency {
558     HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM,
559     HDMI_AUDIO_SAMPLE_FREQUENCY_32000,
560     HDMI_AUDIO_SAMPLE_FREQUENCY_44100,
561     HDMI_AUDIO_SAMPLE_FREQUENCY_48000,
562     HDMI_AUDIO_SAMPLE_FREQUENCY_88200,
563     HDMI_AUDIO_SAMPLE_FREQUENCY_96000,
564     HDMI_AUDIO_SAMPLE_FREQUENCY_176400,
565     HDMI_AUDIO_SAMPLE_FREQUENCY_192000
566 };
567 
568 enum hdmi_audio_coding_type_ext {
569     HDMI_AUDIO_CODING_TYPE_EXT_STREAM,
570     HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
571     HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
572     HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND
573 };
574 
575 enum hdmi_audio_lfe_playback_level {
576     HDMI_AUDIO_LFE_PLAYBACK_NO,
577     HDMI_AUDIO_LFE_PLAYBACK_0_DB,
578     HDMI_AUDIO_LFE_PLAYBACK_10_DB,
579     HDMI_AUDIO_LFE_PLAYBACK_RESERVED
580 };
581 
582 enum hdmi_audio_code {
583     HDMI_AUDIO_CODING_TYPE_STREAM,
584     HDMI_AUDIO_CODING_TYPE_PCM,
585     HDMI_AUDIO_CODING_TYPE_AC3,
586     HDMI_AUDIO_CODING_TYPE_MPEG1,
587     HDMI_AUDIO_CODING_TYPE_MP3,
588     HDMI_AUDIO_CODING_TYPE_MPEG2,
589     HDMI_AUDIO_CODING_TYPE_AAC_LC,
590     HDMI_AUDIO_CODING_TYPE_DTS,
591     HDMI_AUDIO_CODING_TYPE_ATRAC,
592     HDMI_AUDIO_CODING_TYPE_DSD,
593     HDMI_AUDIO_CODING_TYPE_EAC3,
594     HDMI_AUDIO_CODING_TYPE_DTS_HD,
595     HDMI_AUDIO_CODING_TYPE_MLP,
596     HDMI_AUDIO_CODING_TYPE_DST,
597     HDMI_AUDIO_CODING_TYPE_WMA_PRO,
598     HDMI_AUDIO_CODING_TYPE_RESERVED,
599     HDMI_AUDIO_CODING_TYPE_BUTT
600 };
601 
602 struct hdmi_audio_infoframe {
603     enum hdmi_infoframe_type           type;
604     hi_u8                              version;
605     hi_u8                              length;
606     hi_u8                              channels;
607     enum hdmi_audio_code               coding_type;
608     enum hdmi_audio_sample_size        sample_size;
609     enum hdmi_audio_sample_frequency   sample_frequency;
610     enum hdmi_audio_coding_type_ext    coding_type_ext;
611     hi_u8                              channel_allocation;
612     enum hdmi_audio_lfe_playback_level lfe_playback_level;
613     hi_u8                              level_shift_value;
614     hi_bool                            downmix_inhibit;
615 };
616 
617 enum hdmi_ieee_oui {
618     HDMI14_IEEE_OUI = 0x00000c03, // HDMI1.4
619     HDMI20_IEEE_OUI = 0x00c45dd8  // HDMI2.0
620 };
621 
622 enum hdmi_video_format {
623     HDMI_VIDEO_FORMAT_NONE,
624     HDMI_VIDEO_FORMAT_4K,
625     HDMI_VIDEO_FORMAT_3D
626 };
627 
628 enum hdmi_vic {
629     HDMI_VIC_4K_3840X2160_30 = 0x1,
630     HDMI_VIC_4K_3840X2160_25,
631     HDMI_VIC_4K_3840X2160_24,
632     HDMI_VIC_4K_4096X2160_24
633 };
634 
635 enum hdmi_3d_structure {
636     HDMI_3D_FRAME_PACKING,
637     HDMI_3D_FIELD_ALTERNATIVE,
638     HDMI_3D_LINE_ALTERNATIVE,
639     HDMI_3D_SIDE_BY_SIDE_FULL,
640     HDMI_3D_L_DEPTH,
641     HDMI_3D_L_DEPTH_GRAPHICS_GRAPHICS_DEPTH,
642     HDMI_3D_TOP_AND_BOTTOM,
643     HDMI_3D_SIDE_BY_SIDE_HALF = 0x08,
644     HDMI_3D_BUTT
645 };
646 
647 enum hdmi_3d_ext_data {
648     HDMI_3D_PICTURE_ODD_LEFT_ODD_RIGHT = 0x4,
649     HDMI_3D_PICTURE_ODD_LEFT_EVEN_RIGHT,
650     HDMI_3D_PICTURE_EVEN_LEFT_ODD_RIGHT,
651     HDMI_3D_PICTURE_EVEN_LEFT_EVEN_RIGHT
652 };
653 
654 typedef struct {
655     enum hdmi_ieee_oui     ieee;
656     enum hdmi_video_format format;
657     enum hdmi_vic          vic;
658     enum hdmi_3d_structure _3d_structure;
659     hi_u8                  _3d_meta_present;
660     enum hdmi_3d_ext_data  _3d_ext_data;
661     hi_u8                  _3d_metadata_type;
662     hi_u8                  _3d_metadata_length;
663     hi_u8                  _3d_metadata[20];
664 } hdmi_14_vsif_content;
665 
666 typedef struct {
667     enum hdmi_ieee_oui     ieee;
668     enum hdmi_video_format format;
669     enum hdmi_vic          vic;
670     enum hdmi_3d_structure _3d_structure;
671     hi_u8                  _3d_meta_present;
672     hi_u8                  len;
673     hi_u8                  data[HDMI_VENDOR_USER_DATA_MAX_LEN];
674 } hdmi_user_vsif_content;
675 
676 typedef struct {
677     enum hdmi_ieee_oui ieee;
678     hi_u8 version;
679     hi_u8 _3d_valid;
680     hi_u8 _3d_f_structure;
681     hi_u8 _3d_additional_info_present;
682     hi_u8 _3d_disparity_data_present;
683     hi_u8 _3d_meta_present;
684     hi_u8 _3d_f_ext_data;
685     hi_u8 _3d_dual_view;
686     hi_u8 _3d_view_dependency;
687     hi_u8 _3d_preferred_2d_view;
688     hi_u8 _3d_disparity_data_version;
689     hi_u8 _3d_disparity_data_length;
690     hi_u8 _3d_disparity_data[10];
691     hi_u8 _3d_ext_data;
692     hi_u8 _3d_metadata_type;
693     hi_u8 _3d_metadata_length;
694     hi_u8 _3d_metadata[10];
695 } hdmi_forum_vsif_content;
696 
697 struct hdmi_vendor_specific_infoframe {
698     enum hdmi_infoframe_type type;
699     hi_u8 version;
700     hi_u8 length;
701     union {
702         hdmi_user_vsif_content  cea861_vsif;
703         hdmi_14_vsif_content    h14_vsif_content;
704         hdmi_forum_vsif_content hf_vsif_content;
705     } vsif_content;
706 };
707 
708 typedef union {
709     struct {
710         hi_u8 affected_gamut_seq_num : 4; // [0..3]
711         hi_u8 gbd_profile            : 3; // [4..6]
712         hi_u8 next_field             : 1; // [7]
713     } bits;
714     hi_u8 u8;
715 } hdmi_gumat_hb1;
716 
717 typedef union {
718     struct {
719         hi_u8 current_gamut_seq_num : 4; // [0..3]
720         hi_u8 packet_seq            : 2; // [4..5]
721         hi_u8 reserved               : 1; // [6]
722         hi_u8 no_crnt_gbd           : 1; // [7]
723     } bits;
724     hi_u8 u8;
725 } hdmi_gumat_hb2;
726 
727 typedef union {
728     struct {
729         hi_u8 gbd_color_space     : 3; // [0..2]
730         hi_u8 gbd_color_precision : 2; // [3..4]
731         hi_u8 reserved0            : 1; // [5]
732         hi_u8 reserved1            : 1; // [6]
733         hi_u8 format_flag         : 1; // [7]
734     } bits;
735     hi_u8 u8;
736 } hdmi_gumat_range_gdb0;
737 
738 typedef struct {
739     hi_u8 hb0;
740     hdmi_gumat_hb1 hb1;
741     hdmi_gumat_hb2 hb2;
742     hdmi_gumat_range_gdb0 gdb0;
743     hi_u8 min_red_data_h;
744     hi_u8 mid_red_data_m;   // max_red_data_l||max_red_data_h
745     hi_u8 max_red_data_l;
746     hi_u8 min_green_data_h;
747     hi_u8 mid_green_data_m; // max_green_data_l||max_green_data_h
748     hi_u8 max_green_data_l;
749     hi_u8 min_blue_data_h;
750     hi_u8 mid_blue_data_m;  // max_blue_data_l||max_blue_data_h
751     hi_u8 max_blue_data_l;
752 } hdmi_gdb_pack;
753 
754 typedef enum   hdmi_3d_structure              hdmi_3d_mode;
755 typedef enum   hdmi_colorimetry               hdmi_colormetry;
756 typedef enum   hdmi_audio_code                hdmi_audio_format_code;
757 typedef enum   hdmi_vic                       hdmi_vsif_vic;
758 typedef enum   hdmi_infoframe_type            hdmi_infoframe_id;
759 typedef enum   hdmi_static_metadata_type      hdmi_static_meta_type_id;
760 typedef union  hdmi_meta_descriptor           hdmi_meta_descriptor;
761 typedef struct hdmi_avi_infoframe             hdmi_avi_infoframe;
762 typedef struct hdmi_audio_infoframe           hdmi_audio_infoframe;
763 typedef struct hdmi_vendor_specific_infoframe hdmi_vendor_infoframe;
764 typedef struct hdmi_meta_descriptor_1st       hdmi_meta_des_1st;
765 typedef struct hdmi_drm_infoframe             hdmi_drm_infoframe;
766 
767 typedef struct {
768     hdmi_avi_infoframe    avi_infoframe;
769     hdmi_audio_infoframe  audio_infoframe;
770     hdmi_vendor_infoframe vendor_infoframe;
771     hdmi_gdb_pack         gdb_pack;
772     hdmi_drm_infoframe    drm_infoframe;
773 } hdmi_infoframe_type;
774 
775 typedef union {
776     hdmi_avi_infoframe    avi_infoframe;
777     hdmi_audio_infoframe  audio_infoframe;
778     hdmi_vendor_infoframe vendor_infoframe;
779     hdmi_gdb_pack         gdb_pack;
780     hdmi_drm_infoframe    drm_infoframe;
781 } hdmi_infoframe;
782 
783 hi_s32 drv_hdmi_avi_infoframe_send(hdmi_infoframe_type *info_frame, hi_bool enable);
784 
785 hi_s32 drv_hdmi_vendor_infoframe_send(hdmi_infoframe_type *info_frame, hi_bool enable, hi_bool dolby_enable);
786 
787 hi_s32 drv_hdmi_audio_infoframe_send(hdmi_infoframe_type *info_frame, hi_bool enable);
788 
789 hi_void drv_hdmi_infoframe_send(hdmi_infoframe_type *info_frame,
790     hdmi_infoframe_id infoframe_id, hdmi_infoframe *infoframe);
791 
792 hi_void drv_hdmi_infoframe_enable_set(hdmi_infoframe_type *info_frame,
793     hdmi_infoframe_id infoframe_id, hi_bool enable);
794 
795 hdmi_video_timing drv_hdmi_video_timing_lookup(hdmi_video_code_vic vic, hdmi_picture_aspect aspect);
796 
797 hdmi_video_timing drv_hdmi_vsif_video_timing_lookup(hdmi_vsif_vic vic);
798 
799 hi_s32 drv_hdmi_drm_infoframe_send(hdmi_infoframe_type *info_frame, hi_bool enable);
800 
801 hi_s32 drv_hdmi_null_packet_send(hdmi_infoframe_type *info_frame, hi_bool enable);
802 
803 #endif /* __DRV_HDMI_INFOFRAME_H__ */
804 
805