blob: bc6743e76e378796474cb3cb784e062d07b904b0 [file] [log] [blame]
Thierry Redingf142d3b2012-11-21 15:29:29 +01001/*
2 * Copyright (C) 2012 Avionic Design GmbH
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_HDMI_H_
10#define __LINUX_HDMI_H_
11
12#include <linux/types.h>
13
14enum 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,
19};
20
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
25
Damien Lespiau61177b02013-08-06 20:32:15 +010026#define HDMI_INFOFRAME_SIZE(type) \
27 (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
28
Damien Lespiau72b09892013-08-06 20:32:14 +010029struct hdmi_any_infoframe {
30 enum hdmi_infoframe_type type;
31 unsigned char version;
32 unsigned char length;
33};
34
Thierry Redingf142d3b2012-11-21 15:29:29 +010035enum hdmi_colorspace {
36 HDMI_COLORSPACE_RGB,
37 HDMI_COLORSPACE_YUV422,
38 HDMI_COLORSPACE_YUV444,
39};
40
41enum hdmi_scan_mode {
42 HDMI_SCAN_MODE_NONE,
43 HDMI_SCAN_MODE_OVERSCAN,
44 HDMI_SCAN_MODE_UNDERSCAN,
45};
46
47enum hdmi_colorimetry {
48 HDMI_COLORIMETRY_NONE,
49 HDMI_COLORIMETRY_ITU_601,
50 HDMI_COLORIMETRY_ITU_709,
51 HDMI_COLORIMETRY_EXTENDED,
52};
53
54enum hdmi_picture_aspect {
55 HDMI_PICTURE_ASPECT_NONE,
56 HDMI_PICTURE_ASPECT_4_3,
57 HDMI_PICTURE_ASPECT_16_9,
58};
59
60enum hdmi_active_aspect {
61 HDMI_ACTIVE_ASPECT_16_9_TOP = 2,
62 HDMI_ACTIVE_ASPECT_14_9_TOP = 3,
63 HDMI_ACTIVE_ASPECT_16_9_CENTER = 4,
64 HDMI_ACTIVE_ASPECT_PICTURE = 8,
65 HDMI_ACTIVE_ASPECT_4_3 = 9,
66 HDMI_ACTIVE_ASPECT_16_9 = 10,
67 HDMI_ACTIVE_ASPECT_14_9 = 11,
68 HDMI_ACTIVE_ASPECT_4_3_SP_14_9 = 13,
69 HDMI_ACTIVE_ASPECT_16_9_SP_14_9 = 14,
70 HDMI_ACTIVE_ASPECT_16_9_SP_4_3 = 15,
71};
72
73enum hdmi_extended_colorimetry {
74 HDMI_EXTENDED_COLORIMETRY_XV_YCC_601,
75 HDMI_EXTENDED_COLORIMETRY_XV_YCC_709,
76 HDMI_EXTENDED_COLORIMETRY_S_YCC_601,
77 HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601,
78 HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB,
79};
80
81enum hdmi_quantization_range {
82 HDMI_QUANTIZATION_RANGE_DEFAULT,
83 HDMI_QUANTIZATION_RANGE_LIMITED,
84 HDMI_QUANTIZATION_RANGE_FULL,
85};
86
87/* non-uniform picture scaling */
88enum hdmi_nups {
89 HDMI_NUPS_UNKNOWN,
90 HDMI_NUPS_HORIZONTAL,
91 HDMI_NUPS_VERTICAL,
92 HDMI_NUPS_BOTH,
93};
94
95enum hdmi_ycc_quantization_range {
96 HDMI_YCC_QUANTIZATION_RANGE_LIMITED,
97 HDMI_YCC_QUANTIZATION_RANGE_FULL,
98};
99
100enum hdmi_content_type {
101 HDMI_CONTENT_TYPE_NONE,
102 HDMI_CONTENT_TYPE_PHOTO,
103 HDMI_CONTENT_TYPE_CINEMA,
104 HDMI_CONTENT_TYPE_GAME,
105};
106
107struct hdmi_avi_infoframe {
108 enum hdmi_infoframe_type type;
109 unsigned char version;
110 unsigned char length;
111 enum hdmi_colorspace colorspace;
112 bool active_info_valid;
113 bool horizontal_bar_valid;
114 bool vertical_bar_valid;
115 enum hdmi_scan_mode scan_mode;
116 enum hdmi_colorimetry colorimetry;
117 enum hdmi_picture_aspect picture_aspect;
118 enum hdmi_active_aspect active_aspect;
119 bool itc;
120 enum hdmi_extended_colorimetry extended_colorimetry;
121 enum hdmi_quantization_range quantization_range;
122 enum hdmi_nups nups;
123 unsigned char video_code;
124 enum hdmi_ycc_quantization_range ycc_quantization_range;
125 enum hdmi_content_type content_type;
126 unsigned char pixel_repeat;
127 unsigned short top_bar;
128 unsigned short bottom_bar;
129 unsigned short left_bar;
130 unsigned short right_bar;
131};
132
133int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
134ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
135 size_t size);
136
137enum hdmi_spd_sdi {
138 HDMI_SPD_SDI_UNKNOWN,
139 HDMI_SPD_SDI_DSTB,
140 HDMI_SPD_SDI_DVDP,
141 HDMI_SPD_SDI_DVHS,
142 HDMI_SPD_SDI_HDDVR,
143 HDMI_SPD_SDI_DVC,
144 HDMI_SPD_SDI_DSC,
145 HDMI_SPD_SDI_VCD,
146 HDMI_SPD_SDI_GAME,
147 HDMI_SPD_SDI_PC,
148 HDMI_SPD_SDI_BD,
149 HDMI_SPD_SDI_SACD,
150 HDMI_SPD_SDI_HDDVD,
151 HDMI_SPD_SDI_PMP,
152};
153
154struct hdmi_spd_infoframe {
155 enum hdmi_infoframe_type type;
156 unsigned char version;
157 unsigned char length;
158 char vendor[8];
159 char product[16];
160 enum hdmi_spd_sdi sdi;
161};
162
163int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe *frame,
164 const char *vendor, const char *product);
165ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer,
166 size_t size);
167
168enum hdmi_audio_coding_type {
169 HDMI_AUDIO_CODING_TYPE_STREAM,
170 HDMI_AUDIO_CODING_TYPE_PCM,
171 HDMI_AUDIO_CODING_TYPE_AC3,
172 HDMI_AUDIO_CODING_TYPE_MPEG1,
173 HDMI_AUDIO_CODING_TYPE_MP3,
174 HDMI_AUDIO_CODING_TYPE_MPEG2,
175 HDMI_AUDIO_CODING_TYPE_AAC_LC,
176 HDMI_AUDIO_CODING_TYPE_DTS,
177 HDMI_AUDIO_CODING_TYPE_ATRAC,
178 HDMI_AUDIO_CODING_TYPE_DSD,
179 HDMI_AUDIO_CODING_TYPE_EAC3,
180 HDMI_AUDIO_CODING_TYPE_DTS_HD,
181 HDMI_AUDIO_CODING_TYPE_MLP,
182 HDMI_AUDIO_CODING_TYPE_DST,
183 HDMI_AUDIO_CODING_TYPE_WMA_PRO,
184};
185
186enum hdmi_audio_sample_size {
187 HDMI_AUDIO_SAMPLE_SIZE_STREAM,
188 HDMI_AUDIO_SAMPLE_SIZE_16,
189 HDMI_AUDIO_SAMPLE_SIZE_20,
190 HDMI_AUDIO_SAMPLE_SIZE_24,
191};
192
193enum hdmi_audio_sample_frequency {
194 HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM,
195 HDMI_AUDIO_SAMPLE_FREQUENCY_32000,
196 HDMI_AUDIO_SAMPLE_FREQUENCY_44100,
197 HDMI_AUDIO_SAMPLE_FREQUENCY_48000,
198 HDMI_AUDIO_SAMPLE_FREQUENCY_88200,
199 HDMI_AUDIO_SAMPLE_FREQUENCY_96000,
200 HDMI_AUDIO_SAMPLE_FREQUENCY_176400,
201 HDMI_AUDIO_SAMPLE_FREQUENCY_192000,
202};
203
204enum hdmi_audio_coding_type_ext {
205 HDMI_AUDIO_CODING_TYPE_EXT_STREAM,
206 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
207 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
208 HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND,
209};
210
211struct hdmi_audio_infoframe {
212 enum hdmi_infoframe_type type;
213 unsigned char version;
214 unsigned char length;
215 unsigned char channels;
216 enum hdmi_audio_coding_type coding_type;
217 enum hdmi_audio_sample_size sample_size;
218 enum hdmi_audio_sample_frequency sample_frequency;
219 enum hdmi_audio_coding_type_ext coding_type_ext;
220 unsigned char channel_allocation;
221 unsigned char level_shift_value;
222 bool downmix_inhibit;
223
224};
225
226int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame);
227ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
228 void *buffer, size_t size);
229
230struct hdmi_vendor_infoframe {
231 enum hdmi_infoframe_type type;
232 unsigned char version;
233 unsigned char length;
234 u8 data[27];
235};
236
237ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
238 void *buffer, size_t size);
239
Damien Lespiau72b09892013-08-06 20:32:14 +0100240union hdmi_infoframe {
241 struct hdmi_any_infoframe any;
242 struct hdmi_avi_infoframe avi;
243 struct hdmi_spd_infoframe spd;
244 struct hdmi_vendor_infoframe vendor;
245 struct hdmi_audio_infoframe audio;
246};
247
248ssize_t
249hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size);
250
Thierry Redingf142d3b2012-11-21 15:29:29 +0100251#endif /* _DRM_HDMI_H */