1 /* 2 * include/linux/amlogic/media/vout/hdmi_tx/hdmi_info_global.h 3 * 4 * Copyright (C) 2017 Amlogic, Inc. All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 */ 17 18 #ifndef _HDMI_INFO_GLOBAL_H 19 #define _HDMI_INFO_GLOBAL_H 20 21 #include "hdmi_common.h" 22 23 enum hdmi_rx_video_state { 24 STATE_VIDEO__POWERDOWN = 0, 25 STATE_VIDEO__MUTED = 1, 26 STATE_VIDEO__UNMUTE = 2, 27 STATE_VIDEO__ON = 3, 28 }; 29 30 struct pixel_num { 31 short H; /* Number of horizontal pixels */ 32 short V; /* Number of vertical pixels */ 33 }; 34 35 enum hdmi_pixel_repeat { 36 NO_REPEAT = 0, 37 HDMI_2_TIMES_REPEAT, 38 HDMI_3_TIMES_REPEAT, 39 HDMI_4_TIMES_REPEAT, 40 HDMI_5_TIMES_REPEAT, 41 HDMI_6_TIMES_REPEAT, 42 HDMI_7_TIMES_REPEAT, 43 HDMI_8_TIMES_REPEAT, 44 HDMI_9_TIMES_REPEAT, 45 HDMI_10_TIMES_REPEAT, 46 MAX_TIMES_REPEAT, 47 }; 48 49 enum hdmi_scan { 50 SS_NO_DATA = 0, 51 /* where some active pixelsand lines at the edges are not displayed. */ 52 SS_SCAN_OVER, 53 /* where all active pixels&lines are displayed, 54 * with or withouta border. 55 */ 56 SS_SCAN_UNDER, 57 SS_RSV 58 }; 59 60 enum hdmi_barinfo { 61 B_UNVALID = 0, B_BAR_VERT, /* Vert. Bar Infovalid */ 62 B_BAR_HORIZ, /* Horiz. Bar Infovalid */ 63 B_BAR_VERT_HORIZ, 64 /* Vert.and Horiz. Bar Info valid */ 65 }; 66 67 enum hdmi_colourimetry { 68 CC_NO_DATA = 0, CC_ITU601, CC_ITU709, CC_XVYCC601, CC_XVYCC709, 69 }; 70 71 enum hdmi_slacing { 72 SC_NO_UINFORM = 0, 73 /* Picture has been scaled horizontally */ 74 SC_SCALE_HORIZ, 75 SC_SCALE_VERT, /* Picture has been scaled verticallv */ 76 SC_SCALE_HORIZ_VERT, 77 /* Picture has been scaled horizontally & SC_SCALE_H_V */ 78 }; 79 80 struct hdmi_videoinfo { 81 enum hdmi_vic VIC; 82 enum hdmi_color_space color; 83 enum hdmi_color_depth color_depth; 84 enum hdmi_barinfo bar_info; 85 enum hdmi_pixel_repeat repeat_time; 86 enum hdmi_aspect_ratio aspect_ratio; 87 enum hdmi_colourimetry cc; 88 enum hdmi_scan ss; 89 enum hdmi_slacing sc; 90 }; 91 /* -------------------HDMI VIDEO END---------------------------- */ 92 93 /* -------------------HDMI AUDIO-------------------------------- */ 94 #define TYPE_AUDIO_INFOFRAMES 0x84 95 #define AUDIO_INFOFRAMES_VERSION 0x01 96 #define AUDIO_INFOFRAMES_LENGTH 0x0A 97 98 #define HDMI_E_NONE 0x0 99 /* HPD Event & Status */ 100 #define E_HPD_PULG_IN 0x1 101 #define E_HPD_PLUG_OUT 0x2 102 #define S_HPD_PLUG_IN 0x1 103 #define S_HPD_PLUG_OUT 0x0 104 105 #define E_HDCP_CHK_BKSV 0x1 106 107 /* -------------------HDMI AUDIO END---------------------- */ 108 109 /* -------------------HDCP-------------------------------- */ 110 /* HDCP keys from Efuse are encrypted by default, in this test HDCP keys 111 * are written by CPU with encryption manually added 112 */ 113 #define ENCRYPT_KEY 0xbe 114 115 enum hdcp_authstate { 116 HDCP_NO_AUTH = 0, 117 HDCP_NO_DEVICE_WITH_SLAVE_ADDR, 118 HDCP_BCAP_ERROR, 119 HDCP_BKSV_ERROR, 120 HDCP_R0S_ARE_MISSMATCH, 121 HDCP_RIS_ARE_MISSMATCH, 122 HDCP_REAUTHENTATION_REQ, 123 HDCP_REQ_AUTHENTICATION, 124 HDCP_NO_ACK_FROM_DEV, 125 HDCP_NO_RSEN, 126 HDCP_AUTHENTICATED, 127 HDCP_REPEATER_AUTH_REQ, 128 HDCP_REQ_SHA_CALC, 129 HDCP_REQ_SHA_HW_CALC, 130 HDCP_FAILED_ViERROR, 131 HDCP_MAX 132 }; 133 134 /* -----------------------HDCP END---------------------------------------- */ 135 136 /* -----------------------HDMI TX---------------------------------- */ 137 enum hdmitx_disptype { 138 CABLE_UNPLUG = 0, 139 CABLE_PLUGIN_CHECK_EDID_I2C_ERROR, 140 CABLE_PLUGIN_CHECK_EDID_HEAD_ERROR, 141 CABLE_PLUGIN_CHECK_EDID_CHECKSUM_ERROR, 142 CABLE_PLUGIN_DVI_OUT, 143 CABLE_PLUGIN_HDMI_OUT, 144 CABLE_MAX 145 }; 146 147 struct hdmitx_supstatus { 148 unsigned int hpd_state:1; 149 unsigned int support_480i:1; 150 unsigned int support_576i:1; 151 unsigned int support_480p:1; 152 unsigned int support_576p:1; 153 unsigned int support_720p_60hz:1; 154 unsigned int support_720p_50hz:1; 155 unsigned int support_1080i_60hz:1; 156 unsigned int support_1080i_50hz:1; 157 unsigned int support_1080p_60hz:1; 158 unsigned int support_1080p_50hz:1; 159 unsigned int support_1080p_24hz:1; 160 unsigned int support_1080p_25hz:1; 161 unsigned int support_1080p_30hz:1; 162 }; 163 164 struct hdmitx_suplpcminfo { 165 unsigned int support_flag:1; 166 unsigned int max_channel_num:3; 167 unsigned int _192k:1; 168 unsigned int _176k:1; 169 unsigned int _96k:1; 170 unsigned int _88k:1; 171 unsigned int _48k:1; 172 unsigned int _44k:1; 173 unsigned int _32k:1; 174 unsigned int _24bit:1; 175 unsigned int _20bit:1; 176 unsigned int _16bit:1; 177 }; 178 179 struct hdmitx_supcompressedinfo { 180 unsigned int support_flag:1; 181 unsigned int max_channel_num:3; 182 unsigned int _192k:1; 183 unsigned int _176k:1; 184 unsigned int _96k:1; 185 unsigned int _88k:1; 186 unsigned int _48k:1; 187 unsigned int _44k:1; 188 unsigned int _32k:1; 189 unsigned int _max_bit:10; 190 }; 191 192 struct hdmitx_supspeakerformat { 193 unsigned int rlc_rrc:1; 194 unsigned int flc_frc:1; 195 unsigned int rc:1; 196 unsigned int rl_rr:1; 197 unsigned int fc:1; 198 unsigned int lfe:1; 199 unsigned int fl_fr:1; 200 }; 201 202 struct hdmitx_vidpara { 203 unsigned int VIC; 204 enum hdmi_color_space color_prefer; 205 enum hdmi_color_space color; 206 enum hdmi_color_depth color_depth; 207 enum hdmi_barinfo bar_info; 208 enum hdmi_pixel_repeat repeat_time; 209 enum hdmi_aspect_ratio aspect_ratio; 210 enum hdmi_colourimetry cc; 211 enum hdmi_scan ss; 212 enum hdmi_slacing sc; 213 }; 214 215 struct hdmitx_audpara { 216 enum hdmi_audio_type type; 217 enum hdmi_audio_chnnum channel_num; 218 enum hdmi_audio_fs sample_rate; 219 enum hdmi_audio_sampsize sample_size; 220 }; 221 222 struct hdmitx_supaudinfo { 223 struct hdmitx_suplpcminfo _60958_PCM; 224 struct hdmitx_supcompressedinfo _AC3; 225 struct hdmitx_supcompressedinfo _MPEG1; 226 struct hdmitx_supcompressedinfo _MP3; 227 struct hdmitx_supcompressedinfo _MPEG2; 228 struct hdmitx_supcompressedinfo _AAC; 229 struct hdmitx_supcompressedinfo _DTS; 230 struct hdmitx_supcompressedinfo _ATRAC; 231 struct hdmitx_supcompressedinfo _One_Bit_Audio; 232 struct hdmitx_supcompressedinfo _Dolby; 233 struct hdmitx_supcompressedinfo _DTS_HD; 234 struct hdmitx_supcompressedinfo _MAT; 235 struct hdmitx_supcompressedinfo _DST; 236 struct hdmitx_supcompressedinfo _WMA; 237 struct hdmitx_supspeakerformat speaker_allocation; 238 }; 239 240 /* ACR packet CTS parameters have 3 types: */ 241 /* 1. HW auto calculated */ 242 /* 2. Fixed values defined by Spec */ 243 /* 3. Calculated by clock meter */ 244 enum hdmitx_audcts { 245 AUD_CTS_AUTO = 0, AUD_CTS_FIXED, AUD_CTS_CALC, 246 }; 247 248 struct dispmode_vic { 249 const char *disp_mode; 250 enum hdmi_vic VIC; 251 }; 252 253 struct hdmitx_audinfo { 254 /* !< Signal decoding type -- TvAudioType */ 255 enum hdmi_audio_type type; 256 enum hdmi_audio_format format; 257 /* !< active audio channels bit mask. */ 258 enum hdmi_audio_chnnum channels; 259 enum hdmi_audio_fs fs; /* !< Signal sample rate in Hz */ 260 enum hdmi_audio_sampsize ss; 261 }; 262 263 /* -----------------Source Physical Address--------------- */ 264 struct vsdb_phyaddr { 265 unsigned char a:4; 266 unsigned char b:4; 267 unsigned char c:4; 268 unsigned char d:4; 269 unsigned char valid; 270 }; 271 272 #define Y420CMDB_MAX 32 273 struct hdmitx_info { 274 struct hdmi_rx_audioinfo audio_info; 275 struct hdmitx_supaudinfo tv_audio_info; 276 /* Hdmi_tx_video_info_t video_info; */ 277 enum hdcp_authstate auth_state; 278 enum hdmitx_disptype output_state; 279 /* -----------------Source Physical Address--------------- */ 280 struct vsdb_phyaddr vsdb_phy_addr; 281 /* ------------------------------------------------------- */ 282 unsigned video_out_changing_flag:1; 283 unsigned support_underscan_flag:1; 284 unsigned support_ycbcr444_flag:1; 285 unsigned support_ycbcr422_flag:1; 286 unsigned tx_video_input_stable_flag:1; 287 unsigned auto_hdcp_ri_flag:1; 288 unsigned hw_sha_calculator_flag:1; 289 unsigned need_sup_cec:1; 290 291 /* ------------------------------------------------------- */ 292 unsigned audio_out_changing_flag:1; 293 unsigned audio_flag:1; 294 unsigned support_basic_audio_flag:1; 295 unsigned audio_fifo_overflow:1; 296 unsigned audio_fifo_underflow:1; 297 unsigned audio_cts_status_err_flag:1; 298 unsigned support_ai_flag:1; 299 unsigned hdmi_sup_480i:1; 300 301 /* ------------------------------------------------------- */ 302 unsigned hdmi_sup_576i:1; 303 unsigned hdmi_sup_480p:1; 304 unsigned hdmi_sup_576p:1; 305 unsigned hdmi_sup_720p_60hz:1; 306 unsigned hdmi_sup_720p_50hz:1; 307 unsigned hdmi_sup_1080i_60hz:1; 308 unsigned hdmi_sup_1080i_50hz:1; 309 unsigned hdmi_sup_1080p_60hz:1; 310 311 /* ------------------------------------------------------- */ 312 unsigned hdmi_sup_1080p_50hz:1; 313 unsigned hdmi_sup_1080p_24hz:1; 314 unsigned hdmi_sup_1080p_25hz:1; 315 unsigned hdmi_sup_1080p_30hz:1; 316 317 /* ------------------------------------------------------- */ 318 /* for total = 32*8 = 256 VICs */ 319 /* for Y420CMDB bitmap */ 320 unsigned char bitmap_valid; 321 unsigned char bitmap_length; 322 unsigned char y420_all_vic; 323 unsigned char y420cmdb_bitmap[Y420CMDB_MAX]; 324 /* ------------------------------------------------------- */ 325 }; 326 327 #endif /* _HDMI_RX_GLOBAL_H */ 328