Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Avionic Design GmbH |
| 3 | * |
Thierry Reding | 37d7457 | 2014-10-08 11:14:34 +0200 | [diff] [blame] | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the |
| 12 | * next paragraph) shall be included in all copies or substantial portions |
| 13 | * of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 22 | */ |
| 23 | |
| 24 | #ifndef __LINUX_HDMI_H_ |
| 25 | #define __LINUX_HDMI_H_ |
| 26 | |
| 27 | #include <linux/types.h> |
Martin Bugge | 2c676f3 | 2014-12-19 09:14:21 -0300 | [diff] [blame] | 28 | #include <linux/device.h> |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 29 | |
Ville Syrjälä | f1a2a54 | 2019-01-10 23:14:36 +0200 | [diff] [blame] | 30 | enum hdmi_packet_type { |
| 31 | HDMI_PACKET_TYPE_NULL = 0x00, |
| 32 | HDMI_PACKET_TYPE_AUDIO_CLOCK_REGEN = 0x01, |
| 33 | HDMI_PACKET_TYPE_AUDIO_SAMPLE = 0x02, |
| 34 | HDMI_PACKET_TYPE_GENERAL_CONTROL = 0x03, |
| 35 | HDMI_PACKET_TYPE_ACP = 0x04, |
| 36 | HDMI_PACKET_TYPE_ISRC1 = 0x05, |
| 37 | HDMI_PACKET_TYPE_ISRC2 = 0x06, |
| 38 | HDMI_PACKET_TYPE_ONE_BIT_AUDIO_SAMPLE = 0x07, |
| 39 | HDMI_PACKET_TYPE_DST_AUDIO = 0x08, |
| 40 | HDMI_PACKET_TYPE_HBR_AUDIO_STREAM = 0x09, |
| 41 | HDMI_PACKET_TYPE_GAMUT_METADATA = 0x0a, |
| 42 | /* + enum hdmi_infoframe_type */ |
| 43 | }; |
| 44 | |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 45 | enum hdmi_infoframe_type { |
| 46 | HDMI_INFOFRAME_TYPE_VENDOR = 0x81, |
| 47 | HDMI_INFOFRAME_TYPE_AVI = 0x82, |
| 48 | HDMI_INFOFRAME_TYPE_SPD = 0x83, |
| 49 | HDMI_INFOFRAME_TYPE_AUDIO = 0x84, |
Uma Shankar | 2cdbfd6 | 2019-05-16 19:40:09 +0530 | [diff] [blame] | 50 | HDMI_INFOFRAME_TYPE_DRM = 0x87, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
Lespiau, Damien | 6cb3b7f | 2013-08-19 16:59:05 +0100 | [diff] [blame] | 53 | #define HDMI_IEEE_OUI 0x000c03 |
Thierry Reding | 50dd1bd | 2017-03-13 16:54:00 +0530 | [diff] [blame] | 54 | #define HDMI_FORUM_IEEE_OUI 0xc45dd8 |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 55 | #define HDMI_INFOFRAME_HEADER_SIZE 4 |
| 56 | #define HDMI_AVI_INFOFRAME_SIZE 13 |
| 57 | #define HDMI_SPD_INFOFRAME_SIZE 25 |
| 58 | #define HDMI_AUDIO_INFOFRAME_SIZE 10 |
Uma Shankar | 2cdbfd6 | 2019-05-16 19:40:09 +0530 | [diff] [blame] | 59 | #define HDMI_DRM_INFOFRAME_SIZE 26 |
Bernard Zhao | d43be25 | 2020-04-27 01:05:23 -0700 | [diff] [blame] | 60 | #define HDMI_VENDOR_INFOFRAME_SIZE 4 |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 61 | |
Damien Lespiau | 61177b0 | 2013-08-06 20:32:15 +0100 | [diff] [blame] | 62 | #define HDMI_INFOFRAME_SIZE(type) \ |
| 63 | (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE) |
| 64 | |
Damien Lespiau | 72b0989 | 2013-08-06 20:32:14 +0100 | [diff] [blame] | 65 | struct hdmi_any_infoframe { |
| 66 | enum hdmi_infoframe_type type; |
| 67 | unsigned char version; |
| 68 | unsigned char length; |
| 69 | }; |
| 70 | |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 71 | enum hdmi_colorspace { |
| 72 | HDMI_COLORSPACE_RGB, |
| 73 | HDMI_COLORSPACE_YUV422, |
| 74 | HDMI_COLORSPACE_YUV444, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 75 | HDMI_COLORSPACE_YUV420, |
| 76 | HDMI_COLORSPACE_RESERVED4, |
| 77 | HDMI_COLORSPACE_RESERVED5, |
| 78 | HDMI_COLORSPACE_RESERVED6, |
| 79 | HDMI_COLORSPACE_IDO_DEFINED, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | enum hdmi_scan_mode { |
| 83 | HDMI_SCAN_MODE_NONE, |
| 84 | HDMI_SCAN_MODE_OVERSCAN, |
| 85 | HDMI_SCAN_MODE_UNDERSCAN, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 86 | HDMI_SCAN_MODE_RESERVED, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | enum hdmi_colorimetry { |
| 90 | HDMI_COLORIMETRY_NONE, |
| 91 | HDMI_COLORIMETRY_ITU_601, |
| 92 | HDMI_COLORIMETRY_ITU_709, |
| 93 | HDMI_COLORIMETRY_EXTENDED, |
| 94 | }; |
| 95 | |
| 96 | enum hdmi_picture_aspect { |
| 97 | HDMI_PICTURE_ASPECT_NONE, |
| 98 | HDMI_PICTURE_ASPECT_4_3, |
| 99 | HDMI_PICTURE_ASPECT_16_9, |
Shashank Sharma | a6e78b3 | 2016-10-17 17:34:39 +0530 | [diff] [blame] | 100 | HDMI_PICTURE_ASPECT_64_27, |
| 101 | HDMI_PICTURE_ASPECT_256_135, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 102 | HDMI_PICTURE_ASPECT_RESERVED, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | enum hdmi_active_aspect { |
| 106 | HDMI_ACTIVE_ASPECT_16_9_TOP = 2, |
| 107 | HDMI_ACTIVE_ASPECT_14_9_TOP = 3, |
| 108 | HDMI_ACTIVE_ASPECT_16_9_CENTER = 4, |
| 109 | HDMI_ACTIVE_ASPECT_PICTURE = 8, |
| 110 | HDMI_ACTIVE_ASPECT_4_3 = 9, |
| 111 | HDMI_ACTIVE_ASPECT_16_9 = 10, |
| 112 | HDMI_ACTIVE_ASPECT_14_9 = 11, |
| 113 | HDMI_ACTIVE_ASPECT_4_3_SP_14_9 = 13, |
| 114 | HDMI_ACTIVE_ASPECT_16_9_SP_14_9 = 14, |
| 115 | HDMI_ACTIVE_ASPECT_16_9_SP_4_3 = 15, |
| 116 | }; |
| 117 | |
| 118 | enum hdmi_extended_colorimetry { |
| 119 | HDMI_EXTENDED_COLORIMETRY_XV_YCC_601, |
| 120 | HDMI_EXTENDED_COLORIMETRY_XV_YCC_709, |
| 121 | HDMI_EXTENDED_COLORIMETRY_S_YCC_601, |
Hans Verkuil | 463659a0 | 2018-09-13 07:47:29 -0400 | [diff] [blame] | 122 | HDMI_EXTENDED_COLORIMETRY_OPYCC_601, |
| 123 | HDMI_EXTENDED_COLORIMETRY_OPRGB, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 124 | |
| 125 | /* The following EC values are only defined in CEA-861-F. */ |
| 126 | HDMI_EXTENDED_COLORIMETRY_BT2020_CONST_LUM, |
| 127 | HDMI_EXTENDED_COLORIMETRY_BT2020, |
| 128 | HDMI_EXTENDED_COLORIMETRY_RESERVED, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 129 | }; |
| 130 | |
| 131 | enum hdmi_quantization_range { |
| 132 | HDMI_QUANTIZATION_RANGE_DEFAULT, |
| 133 | HDMI_QUANTIZATION_RANGE_LIMITED, |
| 134 | HDMI_QUANTIZATION_RANGE_FULL, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 135 | HDMI_QUANTIZATION_RANGE_RESERVED, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | /* non-uniform picture scaling */ |
| 139 | enum hdmi_nups { |
| 140 | HDMI_NUPS_UNKNOWN, |
| 141 | HDMI_NUPS_HORIZONTAL, |
| 142 | HDMI_NUPS_VERTICAL, |
| 143 | HDMI_NUPS_BOTH, |
| 144 | }; |
| 145 | |
| 146 | enum hdmi_ycc_quantization_range { |
| 147 | HDMI_YCC_QUANTIZATION_RANGE_LIMITED, |
| 148 | HDMI_YCC_QUANTIZATION_RANGE_FULL, |
| 149 | }; |
| 150 | |
| 151 | enum hdmi_content_type { |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 152 | HDMI_CONTENT_TYPE_GRAPHICS, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 153 | HDMI_CONTENT_TYPE_PHOTO, |
| 154 | HDMI_CONTENT_TYPE_CINEMA, |
| 155 | HDMI_CONTENT_TYPE_GAME, |
| 156 | }; |
| 157 | |
Uma Shankar | fbb5d03 | 2019-05-16 19:40:06 +0530 | [diff] [blame] | 158 | enum hdmi_metadata_type { |
| 159 | HDMI_STATIC_METADATA_TYPE1 = 1, |
| 160 | }; |
| 161 | |
| 162 | enum hdmi_eotf { |
| 163 | HDMI_EOTF_TRADITIONAL_GAMMA_SDR, |
| 164 | HDMI_EOTF_TRADITIONAL_GAMMA_HDR, |
| 165 | HDMI_EOTF_SMPTE_ST2084, |
Ville Syrjälä | b5e3eed | 2019-05-16 19:40:12 +0530 | [diff] [blame] | 166 | HDMI_EOTF_BT_2100_HLG, |
Uma Shankar | fbb5d03 | 2019-05-16 19:40:06 +0530 | [diff] [blame] | 167 | }; |
| 168 | |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 169 | struct hdmi_avi_infoframe { |
| 170 | enum hdmi_infoframe_type type; |
| 171 | unsigned char version; |
| 172 | unsigned char length; |
| 173 | enum hdmi_colorspace colorspace; |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 174 | enum hdmi_scan_mode scan_mode; |
| 175 | enum hdmi_colorimetry colorimetry; |
| 176 | enum hdmi_picture_aspect picture_aspect; |
| 177 | enum hdmi_active_aspect active_aspect; |
| 178 | bool itc; |
| 179 | enum hdmi_extended_colorimetry extended_colorimetry; |
| 180 | enum hdmi_quantization_range quantization_range; |
| 181 | enum hdmi_nups nups; |
| 182 | unsigned char video_code; |
| 183 | enum hdmi_ycc_quantization_range ycc_quantization_range; |
| 184 | enum hdmi_content_type content_type; |
| 185 | unsigned char pixel_repeat; |
| 186 | unsigned short top_bar; |
| 187 | unsigned short bottom_bar; |
| 188 | unsigned short left_bar; |
| 189 | unsigned short right_bar; |
| 190 | }; |
| 191 | |
Uma Shankar | 2cdbfd6 | 2019-05-16 19:40:09 +0530 | [diff] [blame] | 192 | /* DRM Infoframe as per CTA 861.G spec */ |
| 193 | struct hdmi_drm_infoframe { |
| 194 | enum hdmi_infoframe_type type; |
| 195 | unsigned char version; |
| 196 | unsigned char length; |
| 197 | enum hdmi_eotf eotf; |
| 198 | enum hdmi_metadata_type metadata_type; |
| 199 | struct { |
| 200 | u16 x, y; |
| 201 | } display_primaries[3]; |
| 202 | struct { |
| 203 | u16 x, y; |
| 204 | } white_point; |
| 205 | u16 max_display_mastering_luminance; |
| 206 | u16 min_display_mastering_luminance; |
| 207 | u16 max_cll; |
| 208 | u16 max_fall; |
| 209 | }; |
| 210 | |
Laurent Pinchart | 5ee0caf | 2020-02-26 13:24:21 +0200 | [diff] [blame] | 211 | void hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame); |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 212 | ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, |
| 213 | size_t size); |
Ville Syrjälä | c5e69ab3 | 2018-09-21 17:33:32 +0300 | [diff] [blame] | 214 | ssize_t hdmi_avi_infoframe_pack_only(const struct hdmi_avi_infoframe *frame, |
| 215 | void *buffer, size_t size); |
| 216 | int hdmi_avi_infoframe_check(struct hdmi_avi_infoframe *frame); |
Uma Shankar | 2cdbfd6 | 2019-05-16 19:40:09 +0530 | [diff] [blame] | 217 | int hdmi_drm_infoframe_init(struct hdmi_drm_infoframe *frame); |
| 218 | ssize_t hdmi_drm_infoframe_pack(struct hdmi_drm_infoframe *frame, void *buffer, |
| 219 | size_t size); |
| 220 | ssize_t hdmi_drm_infoframe_pack_only(const struct hdmi_drm_infoframe *frame, |
| 221 | void *buffer, size_t size); |
| 222 | int hdmi_drm_infoframe_check(struct hdmi_drm_infoframe *frame); |
Gwan-gyeong Mun | f45ce93 | 2020-05-14 09:07:19 +0300 | [diff] [blame] | 223 | int hdmi_drm_infoframe_unpack_only(struct hdmi_drm_infoframe *frame, |
| 224 | const void *buffer, size_t size); |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 225 | |
| 226 | enum hdmi_spd_sdi { |
| 227 | HDMI_SPD_SDI_UNKNOWN, |
| 228 | HDMI_SPD_SDI_DSTB, |
| 229 | HDMI_SPD_SDI_DVDP, |
| 230 | HDMI_SPD_SDI_DVHS, |
| 231 | HDMI_SPD_SDI_HDDVR, |
| 232 | HDMI_SPD_SDI_DVC, |
| 233 | HDMI_SPD_SDI_DSC, |
| 234 | HDMI_SPD_SDI_VCD, |
| 235 | HDMI_SPD_SDI_GAME, |
| 236 | HDMI_SPD_SDI_PC, |
| 237 | HDMI_SPD_SDI_BD, |
| 238 | HDMI_SPD_SDI_SACD, |
| 239 | HDMI_SPD_SDI_HDDVD, |
| 240 | HDMI_SPD_SDI_PMP, |
| 241 | }; |
| 242 | |
| 243 | struct hdmi_spd_infoframe { |
| 244 | enum hdmi_infoframe_type type; |
| 245 | unsigned char version; |
| 246 | unsigned char length; |
| 247 | char vendor[8]; |
| 248 | char product[16]; |
| 249 | enum hdmi_spd_sdi sdi; |
| 250 | }; |
| 251 | |
| 252 | int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe *frame, |
| 253 | const char *vendor, const char *product); |
| 254 | ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer, |
| 255 | size_t size); |
Ville Syrjälä | c5e69ab3 | 2018-09-21 17:33:32 +0300 | [diff] [blame] | 256 | ssize_t hdmi_spd_infoframe_pack_only(const struct hdmi_spd_infoframe *frame, |
| 257 | void *buffer, size_t size); |
| 258 | int hdmi_spd_infoframe_check(struct hdmi_spd_infoframe *frame); |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 259 | |
| 260 | enum hdmi_audio_coding_type { |
| 261 | HDMI_AUDIO_CODING_TYPE_STREAM, |
| 262 | HDMI_AUDIO_CODING_TYPE_PCM, |
| 263 | HDMI_AUDIO_CODING_TYPE_AC3, |
| 264 | HDMI_AUDIO_CODING_TYPE_MPEG1, |
| 265 | HDMI_AUDIO_CODING_TYPE_MP3, |
| 266 | HDMI_AUDIO_CODING_TYPE_MPEG2, |
| 267 | HDMI_AUDIO_CODING_TYPE_AAC_LC, |
| 268 | HDMI_AUDIO_CODING_TYPE_DTS, |
| 269 | HDMI_AUDIO_CODING_TYPE_ATRAC, |
| 270 | HDMI_AUDIO_CODING_TYPE_DSD, |
| 271 | HDMI_AUDIO_CODING_TYPE_EAC3, |
| 272 | HDMI_AUDIO_CODING_TYPE_DTS_HD, |
| 273 | HDMI_AUDIO_CODING_TYPE_MLP, |
| 274 | HDMI_AUDIO_CODING_TYPE_DST, |
| 275 | HDMI_AUDIO_CODING_TYPE_WMA_PRO, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 276 | HDMI_AUDIO_CODING_TYPE_CXT, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 277 | }; |
| 278 | |
| 279 | enum hdmi_audio_sample_size { |
| 280 | HDMI_AUDIO_SAMPLE_SIZE_STREAM, |
| 281 | HDMI_AUDIO_SAMPLE_SIZE_16, |
| 282 | HDMI_AUDIO_SAMPLE_SIZE_20, |
| 283 | HDMI_AUDIO_SAMPLE_SIZE_24, |
| 284 | }; |
| 285 | |
| 286 | enum hdmi_audio_sample_frequency { |
| 287 | HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM, |
| 288 | HDMI_AUDIO_SAMPLE_FREQUENCY_32000, |
| 289 | HDMI_AUDIO_SAMPLE_FREQUENCY_44100, |
| 290 | HDMI_AUDIO_SAMPLE_FREQUENCY_48000, |
| 291 | HDMI_AUDIO_SAMPLE_FREQUENCY_88200, |
| 292 | HDMI_AUDIO_SAMPLE_FREQUENCY_96000, |
| 293 | HDMI_AUDIO_SAMPLE_FREQUENCY_176400, |
| 294 | HDMI_AUDIO_SAMPLE_FREQUENCY_192000, |
| 295 | }; |
| 296 | |
| 297 | enum hdmi_audio_coding_type_ext { |
Hans Verkuil | dc18905 | 2014-12-19 09:14:22 -0300 | [diff] [blame] | 298 | /* Refer to Audio Coding Type (CT) field in Data Byte 1 */ |
| 299 | HDMI_AUDIO_CODING_TYPE_EXT_CT, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 300 | |
| 301 | /* |
| 302 | * The next three CXT values are defined in CEA-861-E only. |
| 303 | * They do not exist in older versions, and in CEA-861-F they are |
| 304 | * defined as 'Not in use'. |
| 305 | */ |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 306 | HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC, |
| 307 | HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2, |
| 308 | HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND, |
Hans Verkuil | 05c80d7 | 2014-12-19 09:14:20 -0300 | [diff] [blame] | 309 | |
| 310 | /* The following CXT values are only defined in CEA-861-F. */ |
| 311 | HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC, |
| 312 | HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_V2, |
| 313 | HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC, |
| 314 | HDMI_AUDIO_CODING_TYPE_EXT_DRA, |
| 315 | HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_SURROUND, |
| 316 | HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC_SURROUND = 10, |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 317 | }; |
| 318 | |
| 319 | struct hdmi_audio_infoframe { |
| 320 | enum hdmi_infoframe_type type; |
| 321 | unsigned char version; |
| 322 | unsigned char length; |
| 323 | unsigned char channels; |
| 324 | enum hdmi_audio_coding_type coding_type; |
| 325 | enum hdmi_audio_sample_size sample_size; |
| 326 | enum hdmi_audio_sample_frequency sample_frequency; |
| 327 | enum hdmi_audio_coding_type_ext coding_type_ext; |
| 328 | unsigned char channel_allocation; |
| 329 | unsigned char level_shift_value; |
| 330 | bool downmix_inhibit; |
| 331 | |
| 332 | }; |
| 333 | |
| 334 | int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame); |
| 335 | ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, |
| 336 | void *buffer, size_t size); |
Ville Syrjälä | c5e69ab3 | 2018-09-21 17:33:32 +0300 | [diff] [blame] | 337 | ssize_t hdmi_audio_infoframe_pack_only(const struct hdmi_audio_infoframe *frame, |
| 338 | void *buffer, size_t size); |
| 339 | int hdmi_audio_infoframe_check(struct hdmi_audio_infoframe *frame); |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 340 | |
Lespiau, Damien | 7d27bec | 2013-08-19 16:58:58 +0100 | [diff] [blame] | 341 | enum hdmi_3d_structure { |
| 342 | HDMI_3D_STRUCTURE_INVALID = -1, |
| 343 | HDMI_3D_STRUCTURE_FRAME_PACKING = 0, |
| 344 | HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE, |
| 345 | HDMI_3D_STRUCTURE_LINE_ALTERNATIVE, |
| 346 | HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL, |
| 347 | HDMI_3D_STRUCTURE_L_DEPTH, |
| 348 | HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH, |
| 349 | HDMI_3D_STRUCTURE_TOP_AND_BOTTOM, |
| 350 | HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF = 8, |
| 351 | }; |
| 352 | |
Lespiau, Damien | ae84b90 | 2013-08-19 16:59:02 +0100 | [diff] [blame] | 353 | |
| 354 | struct hdmi_vendor_infoframe { |
Lespiau, Damien | 7d27bec | 2013-08-19 16:58:58 +0100 | [diff] [blame] | 355 | enum hdmi_infoframe_type type; |
| 356 | unsigned char version; |
| 357 | unsigned char length; |
Lespiau, Damien | af3e95b | 2013-08-19 16:59:01 +0100 | [diff] [blame] | 358 | unsigned int oui; |
Lespiau, Damien | 7d27bec | 2013-08-19 16:58:58 +0100 | [diff] [blame] | 359 | u8 vic; |
| 360 | enum hdmi_3d_structure s3d_struct; |
| 361 | unsigned int s3d_ext_data; |
| 362 | }; |
| 363 | |
Uma Shankar | fbb5d03 | 2019-05-16 19:40:06 +0530 | [diff] [blame] | 364 | /* HDR Metadata as per 861.G spec */ |
| 365 | struct hdr_static_metadata { |
| 366 | __u8 eotf; |
| 367 | __u8 metadata_type; |
| 368 | __u16 max_cll; |
| 369 | __u16 max_fall; |
| 370 | __u16 min_cll; |
| 371 | }; |
| 372 | |
Uma Shankar | a09db88 | 2019-06-04 16:47:02 +0530 | [diff] [blame] | 373 | /** |
| 374 | * struct hdr_sink_metadata - HDR sink metadata |
| 375 | * |
| 376 | * Metadata Information read from Sink's EDID |
| 377 | */ |
Uma Shankar | fbb5d03 | 2019-05-16 19:40:06 +0530 | [diff] [blame] | 378 | struct hdr_sink_metadata { |
Uma Shankar | a09db88 | 2019-06-04 16:47:02 +0530 | [diff] [blame] | 379 | /** |
| 380 | * @metadata_type: Static_Metadata_Descriptor_ID. |
| 381 | */ |
Uma Shankar | fbb5d03 | 2019-05-16 19:40:06 +0530 | [diff] [blame] | 382 | __u32 metadata_type; |
Uma Shankar | a09db88 | 2019-06-04 16:47:02 +0530 | [diff] [blame] | 383 | /** |
| 384 | * @hdmi_type1: HDR Metadata Infoframe. |
| 385 | */ |
Uma Shankar | fbb5d03 | 2019-05-16 19:40:06 +0530 | [diff] [blame] | 386 | union { |
| 387 | struct hdr_static_metadata hdmi_type1; |
| 388 | }; |
| 389 | }; |
| 390 | |
Lespiau, Damien | ae84b90 | 2013-08-19 16:59:02 +0100 | [diff] [blame] | 391 | int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame); |
| 392 | ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, |
| 393 | void *buffer, size_t size); |
Ville Syrjälä | c5e69ab3 | 2018-09-21 17:33:32 +0300 | [diff] [blame] | 394 | ssize_t hdmi_vendor_infoframe_pack_only(const struct hdmi_vendor_infoframe *frame, |
| 395 | void *buffer, size_t size); |
| 396 | int hdmi_vendor_infoframe_check(struct hdmi_vendor_infoframe *frame); |
Lespiau, Damien | 7d27bec | 2013-08-19 16:58:58 +0100 | [diff] [blame] | 397 | |
Lespiau, Damien | ae84b90 | 2013-08-19 16:59:02 +0100 | [diff] [blame] | 398 | union hdmi_vendor_any_infoframe { |
Lespiau, Damien | af3e95b | 2013-08-19 16:59:01 +0100 | [diff] [blame] | 399 | struct { |
| 400 | enum hdmi_infoframe_type type; |
| 401 | unsigned char version; |
| 402 | unsigned char length; |
| 403 | unsigned int oui; |
| 404 | } any; |
Lespiau, Damien | ae84b90 | 2013-08-19 16:59:02 +0100 | [diff] [blame] | 405 | struct hdmi_vendor_infoframe hdmi; |
Lespiau, Damien | af3e95b | 2013-08-19 16:59:01 +0100 | [diff] [blame] | 406 | }; |
| 407 | |
Daniel Vetter | 2d123f4 | 2014-01-22 18:26:16 +0100 | [diff] [blame] | 408 | /** |
| 409 | * union hdmi_infoframe - overall union of all abstract infoframe representations |
| 410 | * @any: generic infoframe |
| 411 | * @avi: avi infoframe |
| 412 | * @spd: spd infoframe |
| 413 | * @vendor: union of all vendor infoframes |
| 414 | * @audio: audio infoframe |
Uma Shankar | a09db88 | 2019-06-04 16:47:02 +0530 | [diff] [blame] | 415 | * @drm: Dynamic Range and Mastering infoframe |
Daniel Vetter | 2d123f4 | 2014-01-22 18:26:16 +0100 | [diff] [blame] | 416 | * |
| 417 | * This is used by the generic pack function. This works since all infoframes |
| 418 | * have the same header which also indicates which type of infoframe should be |
| 419 | * packed. |
| 420 | */ |
Damien Lespiau | 72b0989 | 2013-08-06 20:32:14 +0100 | [diff] [blame] | 421 | union hdmi_infoframe { |
| 422 | struct hdmi_any_infoframe any; |
| 423 | struct hdmi_avi_infoframe avi; |
| 424 | struct hdmi_spd_infoframe spd; |
Lespiau, Damien | ae84b90 | 2013-08-19 16:59:02 +0100 | [diff] [blame] | 425 | union hdmi_vendor_any_infoframe vendor; |
Damien Lespiau | 72b0989 | 2013-08-06 20:32:14 +0100 | [diff] [blame] | 426 | struct hdmi_audio_infoframe audio; |
Uma Shankar | 2cdbfd6 | 2019-05-16 19:40:09 +0530 | [diff] [blame] | 427 | struct hdmi_drm_infoframe drm; |
Damien Lespiau | 72b0989 | 2013-08-06 20:32:14 +0100 | [diff] [blame] | 428 | }; |
| 429 | |
Ville Syrjälä | c5e69ab3 | 2018-09-21 17:33:32 +0300 | [diff] [blame] | 430 | ssize_t hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, |
| 431 | size_t size); |
| 432 | ssize_t hdmi_infoframe_pack_only(const union hdmi_infoframe *frame, |
| 433 | void *buffer, size_t size); |
| 434 | int hdmi_infoframe_check(union hdmi_infoframe *frame); |
Ville Syrjälä | f26e1de | 2018-09-20 21:51:28 +0300 | [diff] [blame] | 435 | int hdmi_infoframe_unpack(union hdmi_infoframe *frame, |
Ville Syrjälä | 480b8b3 | 2018-09-20 21:51:29 +0300 | [diff] [blame] | 436 | const void *buffer, size_t size); |
Martin Bugge | 2c676f3 | 2014-12-19 09:14:21 -0300 | [diff] [blame] | 437 | void hdmi_infoframe_log(const char *level, struct device *dev, |
Ville Syrjälä | 468d6a4 | 2018-09-20 21:51:30 +0300 | [diff] [blame] | 438 | const union hdmi_infoframe *frame); |
Damien Lespiau | 72b0989 | 2013-08-06 20:32:14 +0100 | [diff] [blame] | 439 | |
Thierry Reding | f142d3b | 2012-11-21 15:29:29 +0100 | [diff] [blame] | 440 | #endif /* _DRM_HDMI_H */ |