1b43edc50SJani Nikula /* SPDX-License-Identifier: MIT */ 2b43edc50SJani Nikula /* 3b43edc50SJani Nikula * Copyright © 2022 Intel Corporation 4b43edc50SJani Nikula */ 5b43edc50SJani Nikula 6b43edc50SJani Nikula #ifndef __INTEL_AUDIO_REGS_H__ 7b43edc50SJani Nikula #define __INTEL_AUDIO_REGS_H__ 8b43edc50SJani Nikula 9*e563531aSJani Nikula #include "intel_display_reg_defs.h" 10b43edc50SJani Nikula 11b43edc50SJani Nikula #define G4X_AUD_CNTL_ST _MMIO(0x620B4) 12985a74d8SVille Syrjälä #define G4X_ELD_VALID REG_BIT(14) 13011aa42eSVille Syrjälä #define G4X_ELD_BUFFER_SIZE_MASK REG_GENMASK(13, 9) 14985a74d8SVille Syrjälä #define G4X_ELD_ADDRESS_MASK REG_GENMASK(8, 5) 15011aa42eSVille Syrjälä #define G4X_ELD_ACK REG_BIT(4) 16b43edc50SJani Nikula #define G4X_HDMIW_HDMIEDID _MMIO(0x6210C) 17b43edc50SJani Nikula 18b43edc50SJani Nikula #define _IBX_HDMIW_HDMIEDID_A 0xE2050 19b43edc50SJani Nikula #define _IBX_HDMIW_HDMIEDID_B 0xE2150 20b43edc50SJani Nikula #define IBX_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _IBX_HDMIW_HDMIEDID_A, \ 21b43edc50SJani Nikula _IBX_HDMIW_HDMIEDID_B) 22b43edc50SJani Nikula #define _IBX_AUD_CNTL_ST_A 0xE20B4 23b43edc50SJani Nikula #define _IBX_AUD_CNTL_ST_B 0xE21B4 24b43edc50SJani Nikula #define IBX_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CNTL_ST_A, \ 25b43edc50SJani Nikula _IBX_AUD_CNTL_ST_B) 26011aa42eSVille Syrjälä #define IBX_ELD_BUFFER_SIZE_MASK REG_GENMASK(14, 10) 27011aa42eSVille Syrjälä #define IBX_ELD_ADDRESS_MASK REG_GENMASK(9, 5) 28011aa42eSVille Syrjälä #define IBX_ELD_ACK REG_BIT(4) 29b43edc50SJani Nikula #define IBX_AUD_CNTL_ST2 _MMIO(0xE20C0) 30011aa42eSVille Syrjälä #define IBX_CP_READY(port) REG_BIT(((port) - 1) * 4 + 1) 31011aa42eSVille Syrjälä #define IBX_ELD_VALID(port) REG_BIT(((port) - 1) * 4 + 0) 32b43edc50SJani Nikula 33b43edc50SJani Nikula #define _CPT_HDMIW_HDMIEDID_A 0xE5050 34b43edc50SJani Nikula #define _CPT_HDMIW_HDMIEDID_B 0xE5150 35b43edc50SJani Nikula #define CPT_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _CPT_HDMIW_HDMIEDID_A, _CPT_HDMIW_HDMIEDID_B) 36b43edc50SJani Nikula #define _CPT_AUD_CNTL_ST_A 0xE50B4 37b43edc50SJani Nikula #define _CPT_AUD_CNTL_ST_B 0xE51B4 38b43edc50SJani Nikula #define CPT_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CNTL_ST_A, _CPT_AUD_CNTL_ST_B) 39b43edc50SJani Nikula #define CPT_AUD_CNTRL_ST2 _MMIO(0xE50C0) 40b43edc50SJani Nikula 41b43edc50SJani Nikula #define _VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050) 42b43edc50SJani Nikula #define _VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150) 43b43edc50SJani Nikula #define VLV_HDMIW_HDMIEDID(pipe) _MMIO_PIPE(pipe, _VLV_HDMIW_HDMIEDID_A, _VLV_HDMIW_HDMIEDID_B) 44b43edc50SJani Nikula #define _VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4) 45b43edc50SJani Nikula #define _VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4) 46b43edc50SJani Nikula #define VLV_AUD_CNTL_ST(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CNTL_ST_A, _VLV_AUD_CNTL_ST_B) 47b43edc50SJani Nikula #define VLV_AUD_CNTL_ST2 _MMIO(VLV_DISPLAY_BASE + 0x620C0) 48b43edc50SJani Nikula 49b43edc50SJani Nikula #define _IBX_AUD_CONFIG_A 0xe2000 50b43edc50SJani Nikula #define _IBX_AUD_CONFIG_B 0xe2100 51b43edc50SJani Nikula #define IBX_AUD_CFG(pipe) _MMIO_PIPE(pipe, _IBX_AUD_CONFIG_A, _IBX_AUD_CONFIG_B) 52b43edc50SJani Nikula #define _CPT_AUD_CONFIG_A 0xe5000 53b43edc50SJani Nikula #define _CPT_AUD_CONFIG_B 0xe5100 54b43edc50SJani Nikula #define CPT_AUD_CFG(pipe) _MMIO_PIPE(pipe, _CPT_AUD_CONFIG_A, _CPT_AUD_CONFIG_B) 55b43edc50SJani Nikula #define _VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000) 56b43edc50SJani Nikula #define _VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100) 57b43edc50SJani Nikula #define VLV_AUD_CFG(pipe) _MMIO_PIPE(pipe, _VLV_AUD_CONFIG_A, _VLV_AUD_CONFIG_B) 58011aa42eSVille Syrjälä #define AUD_CONFIG_N_VALUE_INDEX REG_BIT(29) 59011aa42eSVille Syrjälä #define AUD_CONFIG_N_PROG_ENABLE REG_BIT(28) 60011aa42eSVille Syrjälä #define AUD_CONFIG_UPPER_N_MASK REG_GENMASK(27, 20) 61011aa42eSVille Syrjälä #define AUD_CONFIG_LOWER_N_MASK REG_GENMASK(15, 4) 62011aa42eSVille Syrjälä #define AUD_CONFIG_N_MASK (AUD_CONFIG_UPPER_N_MASK | \ 63011aa42eSVille Syrjälä AUD_CONFIG_LOWER_N_MASK) 64011aa42eSVille Syrjälä #define AUD_CONFIG_N(n) (REG_FIELD_PREP(AUD_CONFIG_UPPER_N_MASK, (n) >> 12) | \ 65011aa42eSVille Syrjälä REG_FIELD_PREP(AUD_CONFIG_LOWER_N_MASK, (n) & 0xfff)) 66011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK REG_GENMASK(19, 16) 67011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25175 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 0) 68011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_25200 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 1) 69011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_27000 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 2) 70011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_27027 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 3) 71011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_54000 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 4) 72011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_54054 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 5) 73011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_74176 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 6) 74011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_74250 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 7) 75011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_148352 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 8) 76011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_148500 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 9) 77011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_296703 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 10) 78011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_297000 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 11) 79011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_593407 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 12) 80011aa42eSVille Syrjälä #define AUD_CONFIG_PIXEL_CLOCK_HDMI_594000 REG_FIELD_PREP(AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK, 13) 81011aa42eSVille Syrjälä #define AUD_CONFIG_DISABLE_NCTS REG_BIT(3) 82b43edc50SJani Nikula 83b43edc50SJani Nikula #define _HSW_AUD_CONFIG_A 0x65000 84b43edc50SJani Nikula #define _HSW_AUD_CONFIG_B 0x65100 85b43edc50SJani Nikula #define HSW_AUD_CFG(trans) _MMIO_TRANS(trans, _HSW_AUD_CONFIG_A, _HSW_AUD_CONFIG_B) 86b43edc50SJani Nikula 87b43edc50SJani Nikula #define _HSW_AUD_MISC_CTRL_A 0x65010 88b43edc50SJani Nikula #define _HSW_AUD_MISC_CTRL_B 0x65110 89b43edc50SJani Nikula #define HSW_AUD_MISC_CTRL(trans) _MMIO_TRANS(trans, _HSW_AUD_MISC_CTRL_A, _HSW_AUD_MISC_CTRL_B) 90b43edc50SJani Nikula 91b43edc50SJani Nikula #define _HSW_AUD_M_CTS_ENABLE_A 0x65028 92b43edc50SJani Nikula #define _HSW_AUD_M_CTS_ENABLE_B 0x65128 93b43edc50SJani Nikula #define HSW_AUD_M_CTS_ENABLE(trans) _MMIO_TRANS(trans, _HSW_AUD_M_CTS_ENABLE_A, _HSW_AUD_M_CTS_ENABLE_B) 94011aa42eSVille Syrjälä #define AUD_M_CTS_M_VALUE_INDEX REG_BIT(21) 95011aa42eSVille Syrjälä #define AUD_M_CTS_M_PROG_ENABLE REG_BIT(20) 96011aa42eSVille Syrjälä #define AUD_CONFIG_M_MASK REG_GENMASK(19, 0) 97b43edc50SJani Nikula 98b43edc50SJani Nikula #define _HSW_AUD_DIP_ELD_CTRL_ST_A 0x650b4 99b43edc50SJani Nikula #define _HSW_AUD_DIP_ELD_CTRL_ST_B 0x651b4 100b43edc50SJani Nikula #define HSW_AUD_DIP_ELD_CTRL(trans) _MMIO_TRANS(trans, _HSW_AUD_DIP_ELD_CTRL_ST_A, _HSW_AUD_DIP_ELD_CTRL_ST_B) 101b43edc50SJani Nikula 102b43edc50SJani Nikula /* Audio Digital Converter */ 103b43edc50SJani Nikula #define _HSW_AUD_DIG_CNVT_1 0x65080 104b43edc50SJani Nikula #define _HSW_AUD_DIG_CNVT_2 0x65180 105b43edc50SJani Nikula #define AUD_DIG_CNVT(trans) _MMIO_TRANS(trans, _HSW_AUD_DIG_CNVT_1, _HSW_AUD_DIG_CNVT_2) 106b43edc50SJani Nikula #define DIP_PORT_SEL_MASK 0x3 107b43edc50SJani Nikula 108b43edc50SJani Nikula #define _HSW_AUD_EDID_DATA_A 0x65050 109b43edc50SJani Nikula #define _HSW_AUD_EDID_DATA_B 0x65150 110b43edc50SJani Nikula #define HSW_AUD_EDID_DATA(trans) _MMIO_TRANS(trans, _HSW_AUD_EDID_DATA_A, _HSW_AUD_EDID_DATA_B) 111b43edc50SJani Nikula 112b43edc50SJani Nikula #define HSW_AUD_PIPE_CONV_CFG _MMIO(0x6507c) 113b43edc50SJani Nikula #define HSW_AUD_PIN_ELD_CP_VLD _MMIO(0x650c0) 114b43edc50SJani Nikula #define AUDIO_INACTIVE(trans) ((1 << 3) << ((trans) * 4)) 115b43edc50SJani Nikula #define AUDIO_OUTPUT_ENABLE(trans) ((1 << 2) << ((trans) * 4)) 116b43edc50SJani Nikula #define AUDIO_CP_READY(trans) ((1 << 1) << ((trans) * 4)) 117b43edc50SJani Nikula #define AUDIO_ELD_VALID(trans) ((1 << 0) << ((trans) * 4)) 118b43edc50SJani Nikula 119b43edc50SJani Nikula #define _AUD_TCA_DP_2DOT0_CTRL 0x650bc 120b43edc50SJani Nikula #define _AUD_TCB_DP_2DOT0_CTRL 0x651bc 121b43edc50SJani Nikula #define AUD_DP_2DOT0_CTRL(trans) _MMIO_TRANS(trans, _AUD_TCA_DP_2DOT0_CTRL, _AUD_TCB_DP_2DOT0_CTRL) 122b43edc50SJani Nikula #define AUD_ENABLE_SDP_SPLIT REG_BIT(31) 123b43edc50SJani Nikula 124b43edc50SJani Nikula #define HSW_AUD_CHICKENBIT _MMIO(0x65f10) 125011aa42eSVille Syrjälä #define SKL_AUD_CODEC_WAKE_SIGNAL REG_BIT(15) 126b43edc50SJani Nikula 127b43edc50SJani Nikula #define AUD_FREQ_CNTRL _MMIO(0x65900) 128b43edc50SJani Nikula #define AUD_PIN_BUF_CTL _MMIO(0x48414) 129b43edc50SJani Nikula #define AUD_PIN_BUF_ENABLE REG_BIT(31) 130b43edc50SJani Nikula 131b43edc50SJani Nikula #define AUD_TS_CDCLK_M _MMIO(0x65ea0) 132b43edc50SJani Nikula #define AUD_TS_CDCLK_M_EN REG_BIT(31) 133b43edc50SJani Nikula #define AUD_TS_CDCLK_N _MMIO(0x65ea4) 134b43edc50SJani Nikula 135b43edc50SJani Nikula /* Display Audio Config Reg */ 136b43edc50SJani Nikula #define AUD_CONFIG_BE _MMIO(0x65ef0) 137b43edc50SJani Nikula #define HBLANK_EARLY_ENABLE_ICL(pipe) (0x1 << (20 - (pipe))) 138b43edc50SJani Nikula #define HBLANK_EARLY_ENABLE_TGL(pipe) (0x1 << (24 + (pipe))) 139b43edc50SJani Nikula #define HBLANK_START_COUNT_MASK(pipe) (0x7 << (3 + ((pipe) * 6))) 140b43edc50SJani Nikula #define HBLANK_START_COUNT(pipe, val) (((val) & 0x7) << (3 + ((pipe)) * 6)) 141b43edc50SJani Nikula #define NUMBER_SAMPLES_PER_LINE_MASK(pipe) (0x3 << ((pipe) * 6)) 142b43edc50SJani Nikula #define NUMBER_SAMPLES_PER_LINE(pipe, val) (((val) & 0x3) << ((pipe) * 6)) 143b43edc50SJani Nikula 144b43edc50SJani Nikula #define HBLANK_START_COUNT_8 0 145b43edc50SJani Nikula #define HBLANK_START_COUNT_16 1 146b43edc50SJani Nikula #define HBLANK_START_COUNT_32 2 147b43edc50SJani Nikula #define HBLANK_START_COUNT_64 3 148b43edc50SJani Nikula #define HBLANK_START_COUNT_96 4 149b43edc50SJani Nikula #define HBLANK_START_COUNT_128 5 150b43edc50SJani Nikula 151b43edc50SJani Nikula #endif /* __INTEL_AUDIO_REGS_H__ */ 152