2 * Copyright (C) 2012 Avionic Design GmbH
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 #ifndef __LINUX_HDMI_H_
10 #define __LINUX_HDMI_H_
12 #include <linux/types.h>
14 enum hdmi_infoframe_type
{
15 HDMI_INFOFRAME_TYPE_VENDOR
= 0x81,
16 HDMI_INFOFRAME_TYPE_AVI
= 0x82,
17 HDMI_INFOFRAME_TYPE_SPD
= 0x83,
18 HDMI_INFOFRAME_TYPE_AUDIO
= 0x84,
21 #define HDMI_INFOFRAME_HEADER_SIZE 4
22 #define HDMI_AVI_INFOFRAME_SIZE 13
23 #define HDMI_SPD_INFOFRAME_SIZE 25
24 #define HDMI_AUDIO_INFOFRAME_SIZE 10
26 enum hdmi_colorspace
{
28 HDMI_COLORSPACE_YUV422
,
29 HDMI_COLORSPACE_YUV444
,
34 HDMI_SCAN_MODE_OVERSCAN
,
35 HDMI_SCAN_MODE_UNDERSCAN
,
38 enum hdmi_colorimetry
{
39 HDMI_COLORIMETRY_NONE
,
40 HDMI_COLORIMETRY_ITU_601
,
41 HDMI_COLORIMETRY_ITU_709
,
42 HDMI_COLORIMETRY_EXTENDED
,
45 enum hdmi_picture_aspect
{
46 HDMI_PICTURE_ASPECT_NONE
,
47 HDMI_PICTURE_ASPECT_4_3
,
48 HDMI_PICTURE_ASPECT_16_9
,
51 enum hdmi_active_aspect
{
52 HDMI_ACTIVE_ASPECT_16_9_TOP
= 2,
53 HDMI_ACTIVE_ASPECT_14_9_TOP
= 3,
54 HDMI_ACTIVE_ASPECT_16_9_CENTER
= 4,
55 HDMI_ACTIVE_ASPECT_PICTURE
= 8,
56 HDMI_ACTIVE_ASPECT_4_3
= 9,
57 HDMI_ACTIVE_ASPECT_16_9
= 10,
58 HDMI_ACTIVE_ASPECT_14_9
= 11,
59 HDMI_ACTIVE_ASPECT_4_3_SP_14_9
= 13,
60 HDMI_ACTIVE_ASPECT_16_9_SP_14_9
= 14,
61 HDMI_ACTIVE_ASPECT_16_9_SP_4_3
= 15,
64 enum hdmi_extended_colorimetry
{
65 HDMI_EXTENDED_COLORIMETRY_XV_YCC_601
,
66 HDMI_EXTENDED_COLORIMETRY_XV_YCC_709
,
67 HDMI_EXTENDED_COLORIMETRY_S_YCC_601
,
68 HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601
,
69 HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB
,
72 enum hdmi_quantization_range
{
73 HDMI_QUANTIZATION_RANGE_DEFAULT
,
74 HDMI_QUANTIZATION_RANGE_LIMITED
,
75 HDMI_QUANTIZATION_RANGE_FULL
,
78 /* non-uniform picture scaling */
86 enum hdmi_ycc_quantization_range
{
87 HDMI_YCC_QUANTIZATION_RANGE_LIMITED
,
88 HDMI_YCC_QUANTIZATION_RANGE_FULL
,
91 enum hdmi_content_type
{
92 HDMI_CONTENT_TYPE_NONE
,
93 HDMI_CONTENT_TYPE_PHOTO
,
94 HDMI_CONTENT_TYPE_CINEMA
,
95 HDMI_CONTENT_TYPE_GAME
,
98 struct hdmi_avi_infoframe
{
99 enum hdmi_infoframe_type type
;
100 unsigned char version
;
101 unsigned char length
;
102 enum hdmi_colorspace colorspace
;
103 bool active_info_valid
;
104 bool horizontal_bar_valid
;
105 bool vertical_bar_valid
;
106 enum hdmi_scan_mode scan_mode
;
107 enum hdmi_colorimetry colorimetry
;
108 enum hdmi_picture_aspect picture_aspect
;
109 enum hdmi_active_aspect active_aspect
;
111 enum hdmi_extended_colorimetry extended_colorimetry
;
112 enum hdmi_quantization_range quantization_range
;
114 unsigned char video_code
;
115 enum hdmi_ycc_quantization_range ycc_quantization_range
;
116 enum hdmi_content_type content_type
;
117 unsigned char pixel_repeat
;
118 unsigned short top_bar
;
119 unsigned short bottom_bar
;
120 unsigned short left_bar
;
121 unsigned short right_bar
;
124 int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe
*frame
);
125 ssize_t
hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe
*frame
, void *buffer
,
129 HDMI_SPD_SDI_UNKNOWN
,
145 struct hdmi_spd_infoframe
{
146 enum hdmi_infoframe_type type
;
147 unsigned char version
;
148 unsigned char length
;
151 enum hdmi_spd_sdi sdi
;
154 int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe
*frame
,
155 const char *vendor
, const char *product
);
156 ssize_t
hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe
*frame
, void *buffer
,
159 enum hdmi_audio_coding_type
{
160 HDMI_AUDIO_CODING_TYPE_STREAM
,
161 HDMI_AUDIO_CODING_TYPE_PCM
,
162 HDMI_AUDIO_CODING_TYPE_AC3
,
163 HDMI_AUDIO_CODING_TYPE_MPEG1
,
164 HDMI_AUDIO_CODING_TYPE_MP3
,
165 HDMI_AUDIO_CODING_TYPE_MPEG2
,
166 HDMI_AUDIO_CODING_TYPE_AAC_LC
,
167 HDMI_AUDIO_CODING_TYPE_DTS
,
168 HDMI_AUDIO_CODING_TYPE_ATRAC
,
169 HDMI_AUDIO_CODING_TYPE_DSD
,
170 HDMI_AUDIO_CODING_TYPE_EAC3
,
171 HDMI_AUDIO_CODING_TYPE_DTS_HD
,
172 HDMI_AUDIO_CODING_TYPE_MLP
,
173 HDMI_AUDIO_CODING_TYPE_DST
,
174 HDMI_AUDIO_CODING_TYPE_WMA_PRO
,
177 enum hdmi_audio_sample_size
{
178 HDMI_AUDIO_SAMPLE_SIZE_STREAM
,
179 HDMI_AUDIO_SAMPLE_SIZE_16
,
180 HDMI_AUDIO_SAMPLE_SIZE_20
,
181 HDMI_AUDIO_SAMPLE_SIZE_24
,
184 enum hdmi_audio_sample_frequency
{
185 HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM
,
186 HDMI_AUDIO_SAMPLE_FREQUENCY_32000
,
187 HDMI_AUDIO_SAMPLE_FREQUENCY_44100
,
188 HDMI_AUDIO_SAMPLE_FREQUENCY_48000
,
189 HDMI_AUDIO_SAMPLE_FREQUENCY_88200
,
190 HDMI_AUDIO_SAMPLE_FREQUENCY_96000
,
191 HDMI_AUDIO_SAMPLE_FREQUENCY_176400
,
192 HDMI_AUDIO_SAMPLE_FREQUENCY_192000
,
195 enum hdmi_audio_coding_type_ext
{
196 HDMI_AUDIO_CODING_TYPE_EXT_STREAM
,
197 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC
,
198 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2
,
199 HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND
,
202 struct hdmi_audio_infoframe
{
203 enum hdmi_infoframe_type type
;
204 unsigned char version
;
205 unsigned char length
;
206 unsigned char channels
;
207 enum hdmi_audio_coding_type coding_type
;
208 enum hdmi_audio_sample_size sample_size
;
209 enum hdmi_audio_sample_frequency sample_frequency
;
210 enum hdmi_audio_coding_type_ext coding_type_ext
;
211 unsigned char channel_allocation
;
212 unsigned char level_shift_value
;
213 bool downmix_inhibit
;
217 int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe
*frame
);
218 ssize_t
hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe
*frame
,
219 void *buffer
, size_t size
);
221 struct hdmi_vendor_infoframe
{
222 enum hdmi_infoframe_type type
;
223 unsigned char version
;
224 unsigned char length
;
228 ssize_t
hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe
*frame
,
229 void *buffer
, size_t size
);
231 #endif /* _DRM_HDMI_H */