1287599cfSJerome Anand /* 2287599cfSJerome Anand * intel_hdmi_lpe_audio.h - Intel HDMI LPE audio driver 3287599cfSJerome Anand * 4287599cfSJerome Anand * Copyright (C) 2016 Intel Corp 5287599cfSJerome Anand * Authors: Sailaja Bandarupalli <sailaja.bandarupalli@intel.com> 6287599cfSJerome Anand * Ramesh Babu K V <ramesh.babu@intel.com> 7287599cfSJerome Anand * Vaibhav Agarwal <vaibhav.agarwal@intel.com> 8287599cfSJerome Anand * Jerome Anand <jerome.anand@intel.com> 9287599cfSJerome Anand * Aravind Siddappaji <aravindx.siddappaji@intel.com> 10287599cfSJerome Anand * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11287599cfSJerome Anand * 12287599cfSJerome Anand * This program is free software; you can redistribute it and/or modify 13287599cfSJerome Anand * it under the terms of the GNU General Public License as published by 14287599cfSJerome Anand * the Free Software Foundation; version 2 of the License. 15287599cfSJerome Anand * 16287599cfSJerome Anand * This program is distributed in the hope that it will be useful, but 17287599cfSJerome Anand * WITHOUT ANY WARRANTY; without even the implied warranty of 18287599cfSJerome Anand * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19287599cfSJerome Anand * General Public License for more details. 20287599cfSJerome Anand * 21287599cfSJerome Anand * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 22287599cfSJerome Anand */ 23287599cfSJerome Anand #ifndef __INTEL_HDMI_LPE_AUDIO_H 24287599cfSJerome Anand #define __INTEL_HDMI_LPE_AUDIO_H 25287599cfSJerome Anand 26287599cfSJerome Anand #include <linux/types.h> 27287599cfSJerome Anand #include <sound/initval.h> 28287599cfSJerome Anand #include <linux/version.h> 29287599cfSJerome Anand #include <linux/pm_runtime.h> 30da864809STakashi Iwai #include <linux/platform_device.h> 31287599cfSJerome Anand #include <sound/asoundef.h> 32287599cfSJerome Anand #include <sound/control.h> 33287599cfSJerome Anand #include <sound/pcm.h> 34287599cfSJerome Anand 35964ca808SPierre-Louis Bossart #define AUD_CONFIG_VALID_BIT (1<<9) 36964ca808SPierre-Louis Bossart #define AUD_CONFIG_DP_MODE (1<<15) 37964ca808SPierre-Louis Bossart #define AUD_CONFIG_BLOCK_BIT (1<<7) 38964ca808SPierre-Louis Bossart 39287599cfSJerome Anand #define HMDI_LPE_AUDIO_DRIVER_NAME "intel-hdmi-lpe-audio" 40287599cfSJerome Anand #define HAD_MAX_DEVICES 1 41287599cfSJerome Anand #define HAD_MIN_CHANNEL 2 42287599cfSJerome Anand #define HAD_MAX_CHANNEL 8 43287599cfSJerome Anand #define HAD_NUM_OF_RING_BUFS 4 44287599cfSJerome Anand 45287599cfSJerome Anand /* Assume 192KHz, 8channel, 25msec period */ 46287599cfSJerome Anand #define HAD_MAX_BUFFER (600*1024) 47287599cfSJerome Anand #define HAD_MIN_BUFFER (32*1024) 48287599cfSJerome Anand #define HAD_MAX_PERIODS 4 49287599cfSJerome Anand #define HAD_MIN_PERIODS 4 50287599cfSJerome Anand #define HAD_MAX_PERIOD_BYTES (HAD_MAX_BUFFER/HAD_MIN_PERIODS) 51287599cfSJerome Anand #define HAD_MIN_PERIOD_BYTES 256 52287599cfSJerome Anand #define HAD_FIFO_SIZE 0 /* fifo not being used */ 53287599cfSJerome Anand #define MAX_SPEAKERS 8 54287599cfSJerome Anand 55287599cfSJerome Anand #define AUD_SAMPLE_RATE_32 32000 56287599cfSJerome Anand #define AUD_SAMPLE_RATE_44_1 44100 57287599cfSJerome Anand #define AUD_SAMPLE_RATE_48 48000 58287599cfSJerome Anand #define AUD_SAMPLE_RATE_88_2 88200 59287599cfSJerome Anand #define AUD_SAMPLE_RATE_96 96000 60287599cfSJerome Anand #define AUD_SAMPLE_RATE_176_4 176400 61287599cfSJerome Anand #define AUD_SAMPLE_RATE_192 192000 62287599cfSJerome Anand 63287599cfSJerome Anand #define HAD_MIN_RATE AUD_SAMPLE_RATE_32 64287599cfSJerome Anand #define HAD_MAX_RATE AUD_SAMPLE_RATE_192 65287599cfSJerome Anand 66287599cfSJerome Anand #define DIS_SAMPLE_RATE_25_2 25200 67287599cfSJerome Anand #define DIS_SAMPLE_RATE_27 27000 68287599cfSJerome Anand #define DIS_SAMPLE_RATE_54 54000 69287599cfSJerome Anand #define DIS_SAMPLE_RATE_74_25 74250 70287599cfSJerome Anand #define DIS_SAMPLE_RATE_148_5 148500 71287599cfSJerome Anand #define HAD_REG_WIDTH 0x08 72287599cfSJerome Anand #define HAD_MAX_HW_BUFS 0x04 73287599cfSJerome Anand #define HAD_MAX_DIP_WORDS 16 74287599cfSJerome Anand #define INTEL_HAD "IntelHdmiLpeAudio" 75287599cfSJerome Anand 76964ca808SPierre-Louis Bossart /* DP Link Rates */ 77964ca808SPierre-Louis Bossart #define DP_2_7_GHZ 270000 78964ca808SPierre-Louis Bossart #define DP_1_62_GHZ 162000 79964ca808SPierre-Louis Bossart 80964ca808SPierre-Louis Bossart /* Maud Values */ 81964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_32_DP_2_7_MAUD_VAL 1988 82964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_44_1_DP_2_7_MAUD_VAL 2740 83964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_48_DP_2_7_MAUD_VAL 2982 84964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_88_2_DP_2_7_MAUD_VAL 5480 85964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_96_DP_2_7_MAUD_VAL 5965 86964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_176_4_DP_2_7_MAUD_VAL 10961 87964ca808SPierre-Louis Bossart #define HAD_MAX_RATE_DP_2_7_MAUD_VAL 11930 88964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_32_DP_1_62_MAUD_VAL 3314 89964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_44_1_DP_1_62_MAUD_VAL 4567 90964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_48_DP_1_62_MAUD_VAL 4971 91964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_88_2_DP_1_62_MAUD_VAL 9134 92964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_96_DP_1_62_MAUD_VAL 9942 93964ca808SPierre-Louis Bossart #define AUD_SAMPLE_RATE_176_4_DP_1_62_MAUD_VAL 18268 94964ca808SPierre-Louis Bossart #define HAD_MAX_RATE_DP_1_62_MAUD_VAL 19884 95964ca808SPierre-Louis Bossart 96964ca808SPierre-Louis Bossart /* Naud Value */ 97964ca808SPierre-Louis Bossart #define DP_NAUD_VAL 32768 98964ca808SPierre-Louis Bossart 99287599cfSJerome Anand /* _AUD_CONFIG register MASK */ 100287599cfSJerome Anand #define AUD_CONFIG_MASK_UNDERRUN 0xC0000000 101287599cfSJerome Anand #define AUD_CONFIG_MASK_SRDBG 0x00000002 102287599cfSJerome Anand #define AUD_CONFIG_MASK_FUNCRST 0x00000001 103287599cfSJerome Anand 104287599cfSJerome Anand #define MAX_CNT 0xFF 105287599cfSJerome Anand #define HAD_SUSPEND_DELAY 1000 106287599cfSJerome Anand 107287599cfSJerome Anand #define OTM_HDMI_ELD_SIZE 128 108287599cfSJerome Anand 109287599cfSJerome Anand union otm_hdmi_eld_t { 110287599cfSJerome Anand unsigned char eld_data[OTM_HDMI_ELD_SIZE]; 111287599cfSJerome Anand struct { 112287599cfSJerome Anand /* Byte[0] = ELD Version Number */ 113287599cfSJerome Anand union { 114287599cfSJerome Anand unsigned char byte0; 115287599cfSJerome Anand struct { 116287599cfSJerome Anand unsigned char reserved:3; /* Reserf */ 117287599cfSJerome Anand unsigned char eld_ver:5; /* ELD Version Number */ 118287599cfSJerome Anand /* 00000b - reserved 119287599cfSJerome Anand * 00001b - first rev, obsoleted 120287599cfSJerome Anand * 00010b - version 2, supporting CEA version 121287599cfSJerome Anand * 861D or below 122287599cfSJerome Anand * 00011b:11111b - reserved 123287599cfSJerome Anand * for future 124287599cfSJerome Anand */ 125287599cfSJerome Anand }; 126287599cfSJerome Anand }; 127287599cfSJerome Anand 128287599cfSJerome Anand /* Byte[1] = Vendor Version Field */ 129287599cfSJerome Anand union { 130287599cfSJerome Anand unsigned char vendor_version; 131287599cfSJerome Anand struct { 132287599cfSJerome Anand unsigned char reserved1:3; 133287599cfSJerome Anand unsigned char veld_ver:5; /* Version number of the ELD 134287599cfSJerome Anand * extension. This value is 135287599cfSJerome Anand * provisioned and unique to 136287599cfSJerome Anand * each vendor. 137287599cfSJerome Anand */ 138287599cfSJerome Anand }; 139287599cfSJerome Anand }; 140287599cfSJerome Anand 141287599cfSJerome Anand /* Byte[2] = Baseline Length field */ 142287599cfSJerome Anand unsigned char baseline_eld_length; /* Length of the Baseline structure 143287599cfSJerome Anand * divided by Four. 144287599cfSJerome Anand */ 145287599cfSJerome Anand 146287599cfSJerome Anand /* Byte [3] = Reserved for future use */ 147287599cfSJerome Anand unsigned char byte3; 148287599cfSJerome Anand 149287599cfSJerome Anand /* Starting of the BaseLine EELD structure 150287599cfSJerome Anand * Byte[4] = Monitor Name Length 151287599cfSJerome Anand */ 152287599cfSJerome Anand union { 153287599cfSJerome Anand unsigned char byte4; 154287599cfSJerome Anand struct { 155287599cfSJerome Anand unsigned char mnl:5; 156287599cfSJerome Anand unsigned char cea_edid_rev_id:3; 157287599cfSJerome Anand }; 158287599cfSJerome Anand }; 159287599cfSJerome Anand 160287599cfSJerome Anand /* Byte[5] = Capabilities */ 161287599cfSJerome Anand union { 162287599cfSJerome Anand unsigned char capabilities; 163287599cfSJerome Anand struct { 164287599cfSJerome Anand unsigned char hdcp:1; /* HDCP support */ 165287599cfSJerome Anand unsigned char ai_support:1; /* AI support */ 166287599cfSJerome Anand unsigned char connection_type:2; /* Connection type 167287599cfSJerome Anand * 00 - HDMI 168287599cfSJerome Anand * 01 - DP 169287599cfSJerome Anand * 10 -11 Reserved 170287599cfSJerome Anand * for future 171287599cfSJerome Anand * connection types 172287599cfSJerome Anand */ 173287599cfSJerome Anand unsigned char sadc:4; /* Indicates number of 3 bytes 174287599cfSJerome Anand * Short Audio Descriptors. 175287599cfSJerome Anand */ 176287599cfSJerome Anand }; 177287599cfSJerome Anand }; 178287599cfSJerome Anand 179287599cfSJerome Anand /* Byte[6] = Audio Synch Delay */ 180287599cfSJerome Anand unsigned char audio_synch_delay; /* Amount of time reported by the 181287599cfSJerome Anand * sink that the video trails audio 182287599cfSJerome Anand * in milliseconds. 183287599cfSJerome Anand */ 184287599cfSJerome Anand 185287599cfSJerome Anand /* Byte[7] = Speaker Allocation Block */ 186287599cfSJerome Anand union { 187287599cfSJerome Anand unsigned char speaker_allocation_block; 188287599cfSJerome Anand struct { 189287599cfSJerome Anand unsigned char flr:1; /*Front Left and Right channels*/ 190287599cfSJerome Anand unsigned char lfe:1; /*Low Frequency Effect channel*/ 191287599cfSJerome Anand unsigned char fc:1; /*Center transmission channel*/ 192287599cfSJerome Anand unsigned char rlr:1; /*Rear Left and Right channels*/ 193287599cfSJerome Anand unsigned char rc:1; /*Rear Center channel*/ 194287599cfSJerome Anand unsigned char flrc:1; /*Front left and Right of Center 195287599cfSJerome Anand *transmission channels 196287599cfSJerome Anand */ 197287599cfSJerome Anand unsigned char rlrc:1; /*Rear left and Right of Center 198287599cfSJerome Anand *transmission channels 199287599cfSJerome Anand */ 200287599cfSJerome Anand unsigned char reserved3:1; /* Reserved */ 201287599cfSJerome Anand }; 202287599cfSJerome Anand }; 203287599cfSJerome Anand 204287599cfSJerome Anand /* Byte[8 - 15] - 8 Byte port identification value */ 205287599cfSJerome Anand unsigned char port_id_value[8]; 206287599cfSJerome Anand 207287599cfSJerome Anand /* Byte[16 - 17] - 2 Byte Manufacturer ID */ 208287599cfSJerome Anand unsigned char manufacturer_id[2]; 209287599cfSJerome Anand 210287599cfSJerome Anand /* Byte[18 - 19] - 2 Byte Product ID */ 211287599cfSJerome Anand unsigned char product_id[2]; 212287599cfSJerome Anand 213287599cfSJerome Anand /* Byte [20-83] - 64 Bytes of BaseLine Data */ 214287599cfSJerome Anand unsigned char mn_sand_sads[64]; /* This will include 215287599cfSJerome Anand * - ASCII string of Monitor name 216287599cfSJerome Anand * - List of 3 byte SADs 217287599cfSJerome Anand * - Zero padding 218287599cfSJerome Anand */ 219287599cfSJerome Anand 220287599cfSJerome Anand /* Vendor ELD Block should continue here! 221287599cfSJerome Anand * No Vendor ELD block defined as of now. 222287599cfSJerome Anand */ 223287599cfSJerome Anand } __packed; 224287599cfSJerome Anand }; 225287599cfSJerome Anand 226287599cfSJerome Anand /** 227287599cfSJerome Anand * enum had_status - Audio stream states 228287599cfSJerome Anand * 229287599cfSJerome Anand * @STREAM_INIT: Stream initialized 230287599cfSJerome Anand * @STREAM_RUNNING: Stream running 231287599cfSJerome Anand * @STREAM_PAUSED: Stream paused 232287599cfSJerome Anand * @STREAM_DROPPED: Stream dropped 233287599cfSJerome Anand */ 234287599cfSJerome Anand enum had_stream_status { 235287599cfSJerome Anand STREAM_INIT = 0, 236287599cfSJerome Anand STREAM_RUNNING = 1, 237287599cfSJerome Anand STREAM_PAUSED = 2, 238287599cfSJerome Anand STREAM_DROPPED = 3 239287599cfSJerome Anand }; 240287599cfSJerome Anand 241287599cfSJerome Anand /** 242287599cfSJerome Anand * enum had_status_stream - HAD stream states 243287599cfSJerome Anand */ 244287599cfSJerome Anand enum had_status_stream { 245287599cfSJerome Anand HAD_INIT = 0, 246287599cfSJerome Anand HAD_RUNNING_STREAM, 247287599cfSJerome Anand }; 248287599cfSJerome Anand 249287599cfSJerome Anand enum had_drv_status { 250287599cfSJerome Anand HAD_DRV_CONNECTED, 251287599cfSJerome Anand HAD_DRV_RUNNING, 252287599cfSJerome Anand HAD_DRV_DISCONNECTED, 253287599cfSJerome Anand HAD_DRV_SUSPENDED, 254287599cfSJerome Anand HAD_DRV_ERR, 255287599cfSJerome Anand }; 256287599cfSJerome Anand 257287599cfSJerome Anand /* enum intel_had_aud_buf_type - HDMI controller ring buffer types */ 258287599cfSJerome Anand enum intel_had_aud_buf_type { 259287599cfSJerome Anand HAD_BUF_TYPE_A = 0, 260287599cfSJerome Anand HAD_BUF_TYPE_B = 1, 261287599cfSJerome Anand HAD_BUF_TYPE_C = 2, 262287599cfSJerome Anand HAD_BUF_TYPE_D = 3, 263287599cfSJerome Anand }; 264287599cfSJerome Anand 265287599cfSJerome Anand enum num_aud_ch { 266287599cfSJerome Anand CH_STEREO = 0, 267287599cfSJerome Anand CH_THREE_FOUR = 1, 268287599cfSJerome Anand CH_FIVE_SIX = 2, 269287599cfSJerome Anand CH_SEVEN_EIGHT = 3 270287599cfSJerome Anand }; 271287599cfSJerome Anand 272287599cfSJerome Anand /* HDMI Controller register offsets - audio domain common */ 273287599cfSJerome Anand /* Base address for below regs = 0x65000 */ 274287599cfSJerome Anand enum hdmi_ctrl_reg_offset_common { 275287599cfSJerome Anand AUDIO_HDMI_CONFIG_A = 0x000, 276287599cfSJerome Anand AUDIO_HDMI_CONFIG_B = 0x800, 277287599cfSJerome Anand AUDIO_HDMI_CONFIG_C = 0x900, 278287599cfSJerome Anand }; 279287599cfSJerome Anand /* HDMI controller register offsets */ 280*4151ee84STakashi Iwai enum hdmi_ctrl_reg_offset { 281287599cfSJerome Anand AUD_CONFIG = 0x0, 282287599cfSJerome Anand AUD_CH_STATUS_0 = 0x08, 283287599cfSJerome Anand AUD_CH_STATUS_1 = 0x0C, 284287599cfSJerome Anand AUD_HDMI_CTS = 0x10, 285287599cfSJerome Anand AUD_N_ENABLE = 0x14, 286287599cfSJerome Anand AUD_SAMPLE_RATE = 0x18, 287287599cfSJerome Anand AUD_BUF_CONFIG = 0x20, 288287599cfSJerome Anand AUD_BUF_CH_SWAP = 0x24, 289287599cfSJerome Anand AUD_BUF_A_ADDR = 0x40, 290287599cfSJerome Anand AUD_BUF_A_LENGTH = 0x44, 291287599cfSJerome Anand AUD_BUF_B_ADDR = 0x48, 292287599cfSJerome Anand AUD_BUF_B_LENGTH = 0x4c, 293287599cfSJerome Anand AUD_BUF_C_ADDR = 0x50, 294287599cfSJerome Anand AUD_BUF_C_LENGTH = 0x54, 295287599cfSJerome Anand AUD_BUF_D_ADDR = 0x58, 296287599cfSJerome Anand AUD_BUF_D_LENGTH = 0x5c, 297287599cfSJerome Anand AUD_CNTL_ST = 0x60, 298*4151ee84STakashi Iwai AUD_HDMI_STATUS = 0x64, /* v2 */ 299*4151ee84STakashi Iwai AUD_HDMIW_INFOFR = 0x68, /* v2 */ 300287599cfSJerome Anand }; 301287599cfSJerome Anand 302287599cfSJerome Anand /* 303287599cfSJerome Anand * CEA speaker placement: 304287599cfSJerome Anand * 305287599cfSJerome Anand * FL FLC FC FRC FR 306287599cfSJerome Anand * 307287599cfSJerome Anand * LFE 308287599cfSJerome Anand * 309287599cfSJerome Anand * RL RLC RC RRC RR 310287599cfSJerome Anand * 311287599cfSJerome Anand * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M 312287599cfSJerome Anand * corresponds to CEA RL/RR; The SMPTE channel _assignment_ C/LFE is 313287599cfSJerome Anand * swapped to CEA LFE/FC. 314287599cfSJerome Anand */ 315287599cfSJerome Anand enum cea_speaker_placement { 316287599cfSJerome Anand FL = (1 << 0), /* Front Left */ 317287599cfSJerome Anand FC = (1 << 1), /* Front Center */ 318287599cfSJerome Anand FR = (1 << 2), /* Front Right */ 319287599cfSJerome Anand FLC = (1 << 3), /* Front Left Center */ 320287599cfSJerome Anand FRC = (1 << 4), /* Front Right Center */ 321287599cfSJerome Anand RL = (1 << 5), /* Rear Left */ 322287599cfSJerome Anand RC = (1 << 6), /* Rear Center */ 323287599cfSJerome Anand RR = (1 << 7), /* Rear Right */ 324287599cfSJerome Anand RLC = (1 << 8), /* Rear Left Center */ 325287599cfSJerome Anand RRC = (1 << 9), /* Rear Right Center */ 326287599cfSJerome Anand LFE = (1 << 10), /* Low Frequency Effect */ 327287599cfSJerome Anand }; 328287599cfSJerome Anand 329287599cfSJerome Anand struct cea_channel_speaker_allocation { 330287599cfSJerome Anand int ca_index; 331287599cfSJerome Anand int speakers[8]; 332287599cfSJerome Anand 333287599cfSJerome Anand /* derived values, just for convenience */ 334287599cfSJerome Anand int channels; 335287599cfSJerome Anand int spk_mask; 336287599cfSJerome Anand }; 337287599cfSJerome Anand 338287599cfSJerome Anand struct channel_map_table { 339287599cfSJerome Anand unsigned char map; /* ALSA API channel map position */ 340287599cfSJerome Anand unsigned char cea_slot; /* CEA slot value */ 341287599cfSJerome Anand int spk_mask; /* speaker position bit mask */ 342287599cfSJerome Anand }; 343287599cfSJerome Anand 344287599cfSJerome Anand /** 345287599cfSJerome Anand * union aud_cfg - Audio configuration 346287599cfSJerome Anand * 347287599cfSJerome Anand * @cfg_regx: individual register bits 348287599cfSJerome Anand * @cfg_regval: full register value 349287599cfSJerome Anand * 350287599cfSJerome Anand */ 351287599cfSJerome Anand union aud_cfg { 352287599cfSJerome Anand struct { 353287599cfSJerome Anand u32 aud_en:1; 354287599cfSJerome Anand u32 layout:1; 355287599cfSJerome Anand u32 fmt:2; 356287599cfSJerome Anand u32 num_ch:3; 357287599cfSJerome Anand u32 set:1; 358287599cfSJerome Anand u32 flat:1; 359287599cfSJerome Anand u32 val_bit:1; 360287599cfSJerome Anand u32 user_bit:1; 361287599cfSJerome Anand u32 underrun:1; 362287599cfSJerome Anand u32 packet_mode:1; 363287599cfSJerome Anand u32 left_align:1; 364287599cfSJerome Anand u32 bogus_sample:1; 365287599cfSJerome Anand u32 dp_modei:1; 366287599cfSJerome Anand u32 rsvd:16; 367*4151ee84STakashi Iwai } cfg_regx; 368287599cfSJerome Anand u32 cfg_regval; 369287599cfSJerome Anand }; 370287599cfSJerome Anand 371287599cfSJerome Anand /** 372287599cfSJerome Anand * union aud_ch_status_0 - Audio Channel Status 0 Attributes 373287599cfSJerome Anand * 374287599cfSJerome Anand * @status_0_regx:individual register bits 375287599cfSJerome Anand * @status_0_regval:full register value 376287599cfSJerome Anand * 377287599cfSJerome Anand */ 378287599cfSJerome Anand union aud_ch_status_0 { 379287599cfSJerome Anand struct { 380287599cfSJerome Anand u32 ch_status:1; 381287599cfSJerome Anand u32 lpcm_id:1; 382287599cfSJerome Anand u32 cp_info:1; 383287599cfSJerome Anand u32 format:3; 384287599cfSJerome Anand u32 mode:2; 385287599cfSJerome Anand u32 ctg_code:8; 386287599cfSJerome Anand u32 src_num:4; 387287599cfSJerome Anand u32 ch_num:4; 388287599cfSJerome Anand u32 samp_freq:4; 389287599cfSJerome Anand u32 clk_acc:2; 390287599cfSJerome Anand u32 rsvd:2; 391287599cfSJerome Anand } status_0_regx; 392287599cfSJerome Anand u32 status_0_regval; 393287599cfSJerome Anand }; 394287599cfSJerome Anand 395287599cfSJerome Anand /** 396287599cfSJerome Anand * union aud_ch_status_1 - Audio Channel Status 1 Attributes 397287599cfSJerome Anand * 398287599cfSJerome Anand * @status_1_regx: individual register bits 399287599cfSJerome Anand * @status_1_regval: full register value 400287599cfSJerome Anand * 401287599cfSJerome Anand */ 402287599cfSJerome Anand union aud_ch_status_1 { 403287599cfSJerome Anand struct { 404287599cfSJerome Anand u32 max_wrd_len:1; 405287599cfSJerome Anand u32 wrd_len:3; 406287599cfSJerome Anand u32 rsvd:28; 407287599cfSJerome Anand } status_1_regx; 408287599cfSJerome Anand u32 status_1_regval; 409287599cfSJerome Anand }; 410287599cfSJerome Anand 411287599cfSJerome Anand /** 412287599cfSJerome Anand * union aud_hdmi_cts - CTS register 413287599cfSJerome Anand * 414287599cfSJerome Anand * @cts_regx: individual register bits 415287599cfSJerome Anand * @cts_regval: full register value 416287599cfSJerome Anand * 417287599cfSJerome Anand */ 418287599cfSJerome Anand union aud_hdmi_cts { 419287599cfSJerome Anand struct { 420287599cfSJerome Anand u32 cts_val:24; 421287599cfSJerome Anand u32 en_cts_prog:1; 422287599cfSJerome Anand u32 rsvd:7; 423*4151ee84STakashi Iwai } cts_regx; 424287599cfSJerome Anand u32 cts_regval; 425287599cfSJerome Anand }; 426287599cfSJerome Anand 427287599cfSJerome Anand /** 428287599cfSJerome Anand * union aud_hdmi_n_enable - N register 429287599cfSJerome Anand * 430287599cfSJerome Anand * @n_regx: individual register bits 431287599cfSJerome Anand * @n_regval: full register value 432287599cfSJerome Anand * 433287599cfSJerome Anand */ 434287599cfSJerome Anand union aud_hdmi_n_enable { 435287599cfSJerome Anand struct { 436287599cfSJerome Anand u32 n_val:24; 437287599cfSJerome Anand u32 en_n_prog:1; 438287599cfSJerome Anand u32 rsvd:7; 439*4151ee84STakashi Iwai } n_regx; 440287599cfSJerome Anand u32 n_regval; 441287599cfSJerome Anand }; 442287599cfSJerome Anand 443287599cfSJerome Anand /** 444287599cfSJerome Anand * union aud_buf_config - Audio Buffer configurations 445287599cfSJerome Anand * 446287599cfSJerome Anand * @buf_cfg_regx: individual register bits 447287599cfSJerome Anand * @buf_cfgval: full register value 448287599cfSJerome Anand * 449287599cfSJerome Anand */ 450287599cfSJerome Anand union aud_buf_config { 451287599cfSJerome Anand struct { 452287599cfSJerome Anand u32 audio_fifo_watermark:8; 453287599cfSJerome Anand u32 dma_fifo_watermark:3; 454287599cfSJerome Anand u32 rsvd0:5; 455287599cfSJerome Anand u32 aud_delay:8; 456287599cfSJerome Anand u32 rsvd1:8; 457*4151ee84STakashi Iwai } buf_cfg_regx; 458287599cfSJerome Anand u32 buf_cfgval; 459287599cfSJerome Anand }; 460287599cfSJerome Anand 461287599cfSJerome Anand /** 462287599cfSJerome Anand * union aud_buf_ch_swap - Audio Sample Swapping offset 463287599cfSJerome Anand * 464287599cfSJerome Anand * @buf_ch_swap_regx: individual register bits 465287599cfSJerome Anand * @buf_ch_swap_val: full register value 466287599cfSJerome Anand * 467287599cfSJerome Anand */ 468287599cfSJerome Anand union aud_buf_ch_swap { 469287599cfSJerome Anand struct { 470287599cfSJerome Anand u32 first_0:3; 471287599cfSJerome Anand u32 second_0:3; 472287599cfSJerome Anand u32 first_1:3; 473287599cfSJerome Anand u32 second_1:3; 474287599cfSJerome Anand u32 first_2:3; 475287599cfSJerome Anand u32 second_2:3; 476287599cfSJerome Anand u32 first_3:3; 477287599cfSJerome Anand u32 second_3:3; 478287599cfSJerome Anand u32 rsvd:8; 479287599cfSJerome Anand } buf_ch_swap_regx; 480287599cfSJerome Anand u32 buf_ch_swap_val; 481287599cfSJerome Anand }; 482287599cfSJerome Anand 483287599cfSJerome Anand /** 484287599cfSJerome Anand * union aud_buf_addr - Address for Audio Buffer 485287599cfSJerome Anand * 486287599cfSJerome Anand * @buf_addr_regx: individual register bits 487287599cfSJerome Anand * @buf_addr_val: full register value 488287599cfSJerome Anand * 489287599cfSJerome Anand */ 490287599cfSJerome Anand union aud_buf_addr { 491287599cfSJerome Anand struct { 492287599cfSJerome Anand u32 valid:1; 493287599cfSJerome Anand u32 intr_en:1; 494287599cfSJerome Anand u32 rsvd:4; 495287599cfSJerome Anand u32 addr:26; 496287599cfSJerome Anand } buf_addr_regx; 497287599cfSJerome Anand u32 buf_addr_val; 498287599cfSJerome Anand }; 499287599cfSJerome Anand 500287599cfSJerome Anand /** 501287599cfSJerome Anand * union aud_buf_len - Length of Audio Buffer 502287599cfSJerome Anand * 503287599cfSJerome Anand * @buf_len_regx: individual register bits 504287599cfSJerome Anand * @buf_len_val: full register value 505287599cfSJerome Anand * 506287599cfSJerome Anand */ 507287599cfSJerome Anand union aud_buf_len { 508287599cfSJerome Anand struct { 509287599cfSJerome Anand u32 buf_len:20; 510287599cfSJerome Anand u32 rsvd:12; 511287599cfSJerome Anand } buf_len_regx; 512287599cfSJerome Anand u32 buf_len_val; 513287599cfSJerome Anand }; 514287599cfSJerome Anand 515287599cfSJerome Anand /** 516287599cfSJerome Anand * union aud_ctrl_st - Audio Control State Register offset 517287599cfSJerome Anand * 518287599cfSJerome Anand * @ctrl_regx: individual register bits 519287599cfSJerome Anand * @ctrl_val: full register value 520287599cfSJerome Anand * 521287599cfSJerome Anand */ 522287599cfSJerome Anand union aud_ctrl_st { 523287599cfSJerome Anand struct { 524287599cfSJerome Anand u32 ram_addr:4; 525287599cfSJerome Anand u32 eld_ack:1; 526287599cfSJerome Anand u32 eld_addr:4; 527287599cfSJerome Anand u32 eld_buf_size:5; 528287599cfSJerome Anand u32 eld_valid:1; 529287599cfSJerome Anand u32 cp_ready:1; 530287599cfSJerome Anand u32 dip_freq:2; 531287599cfSJerome Anand u32 dip_idx:3; 532287599cfSJerome Anand u32 dip_en_sta:4; 533287599cfSJerome Anand u32 rsvd:7; 534287599cfSJerome Anand } ctrl_regx; 535287599cfSJerome Anand u32 ctrl_val; 536287599cfSJerome Anand }; 537287599cfSJerome Anand 538287599cfSJerome Anand /** 539287599cfSJerome Anand * union aud_info_frame1 - Audio HDMI Widget Data Island Packet offset 540287599cfSJerome Anand * 541287599cfSJerome Anand * @fr1_regx: individual register bits 542287599cfSJerome Anand * @fr1_val: full register value 543287599cfSJerome Anand * 544287599cfSJerome Anand */ 545287599cfSJerome Anand union aud_info_frame1 { 546287599cfSJerome Anand struct { 547287599cfSJerome Anand u32 pkt_type:8; 548287599cfSJerome Anand u32 ver_num:8; 549287599cfSJerome Anand u32 len:5; 550287599cfSJerome Anand u32 rsvd:11; 551287599cfSJerome Anand } fr1_regx; 552287599cfSJerome Anand u32 fr1_val; 553287599cfSJerome Anand }; 554287599cfSJerome Anand 555287599cfSJerome Anand /** 556287599cfSJerome Anand * union aud_info_frame2 - DIP frame 2 557287599cfSJerome Anand * 558287599cfSJerome Anand * @fr2_regx: individual register bits 559287599cfSJerome Anand * @fr2_val: full register value 560287599cfSJerome Anand * 561287599cfSJerome Anand */ 562287599cfSJerome Anand union aud_info_frame2 { 563287599cfSJerome Anand struct { 564287599cfSJerome Anand u32 chksum:8; 565287599cfSJerome Anand u32 chnl_cnt:3; 566287599cfSJerome Anand u32 rsvd0:1; 567287599cfSJerome Anand u32 coding_type:4; 568287599cfSJerome Anand u32 smpl_size:2; 569287599cfSJerome Anand u32 smpl_freq:3; 570287599cfSJerome Anand u32 rsvd1:3; 571287599cfSJerome Anand u32 format:8; 572287599cfSJerome Anand } fr2_regx; 573287599cfSJerome Anand u32 fr2_val; 574287599cfSJerome Anand }; 575287599cfSJerome Anand 576287599cfSJerome Anand /** 577287599cfSJerome Anand * union aud_info_frame3 - DIP frame 3 578287599cfSJerome Anand * 579287599cfSJerome Anand * @fr3_regx: individual register bits 580287599cfSJerome Anand * @fr3_val: full register value 581287599cfSJerome Anand * 582287599cfSJerome Anand */ 583287599cfSJerome Anand union aud_info_frame3 { 584287599cfSJerome Anand struct { 585287599cfSJerome Anand u32 chnl_alloc:8; 586287599cfSJerome Anand u32 rsvd0:3; 587287599cfSJerome Anand u32 lsv:4; 588287599cfSJerome Anand u32 dm_inh:1; 589287599cfSJerome Anand u32 rsvd1:16; 590287599cfSJerome Anand } fr3_regx; 591287599cfSJerome Anand u32 fr3_val; 592287599cfSJerome Anand }; 593287599cfSJerome Anand 594287599cfSJerome Anand enum hdmi_connector_status { 595287599cfSJerome Anand hdmi_connector_status_connected = 1, 596287599cfSJerome Anand hdmi_connector_status_disconnected = 2, 597287599cfSJerome Anand hdmi_connector_status_unknown = 3, 598287599cfSJerome Anand }; 599287599cfSJerome Anand 600287599cfSJerome Anand #define HDMI_AUDIO_UNDERRUN (1UL<<31) 601287599cfSJerome Anand #define HDMI_AUDIO_BUFFER_DONE (1UL<<29) 602287599cfSJerome Anand 603287599cfSJerome Anand 604287599cfSJerome Anand #define PORT_ENABLE (1 << 31) 605287599cfSJerome Anand #define SDVO_AUDIO_ENABLE (1 << 6) 606287599cfSJerome Anand 607287599cfSJerome Anand enum had_caps_list { 608287599cfSJerome Anand HAD_GET_ELD = 1, 609287599cfSJerome Anand HAD_GET_DISPLAY_RATE, 610964ca808SPierre-Louis Bossart HAD_GET_DP_OUTPUT, 611964ca808SPierre-Louis Bossart HAD_GET_LINK_RATE, 612287599cfSJerome Anand HAD_SET_ENABLE_AUDIO, 613287599cfSJerome Anand HAD_SET_DISABLE_AUDIO, 614287599cfSJerome Anand HAD_SET_ENABLE_AUDIO_INT, 615287599cfSJerome Anand HAD_SET_DISABLE_AUDIO_INT, 616287599cfSJerome Anand }; 617287599cfSJerome Anand 618287599cfSJerome Anand enum had_event_type { 619287599cfSJerome Anand HAD_EVENT_HOT_PLUG = 1, 620287599cfSJerome Anand HAD_EVENT_HOT_UNPLUG, 621287599cfSJerome Anand HAD_EVENT_MODE_CHANGING, 622287599cfSJerome Anand HAD_EVENT_AUDIO_BUFFER_DONE, 623287599cfSJerome Anand HAD_EVENT_AUDIO_BUFFER_UNDERRUN, 624287599cfSJerome Anand HAD_EVENT_QUERY_IS_AUDIO_BUSY, 625287599cfSJerome Anand HAD_EVENT_QUERY_IS_AUDIO_SUSPENDED, 626287599cfSJerome Anand }; 627287599cfSJerome Anand 628287599cfSJerome Anand #endif 629