1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * rt298.h -- RT298 ALSA SoC audio driver 4 * 5 * Copyright 2011 Realtek Microelectronics 6 * Author: Johnny Hsu <johnnyhsu@realtek.com> 7 */ 8 9 #ifndef __RT298_H__ 10 #define __RT298_H__ 11 12 #define VERB_CMD(V, N, D) ((N << 20) | (V << 8 13 14 #define RT298_AUDIO_FUNCTION_GROUP 15 #define RT298_DAC_OUT1 16 #define RT298_DAC_OUT2 17 #define RT298_DIG_CVT 18 #define RT298_ADC_IN1 19 #define RT298_ADC_IN2 20 #define RT298_MIXER_IN 21 #define RT298_MIXER_OUT1 22 #define RT298_MIXER_OUT2 23 #define RT298_DMIC1 24 #define RT298_DMIC2 25 #define RT298_SPK_OUT 26 #define RT298_MIC1 27 #define RT298_LINE1 28 #define RT298_BEEP 29 #define RT298_SPDIF 30 #define RT298_VENDOR_REGISTERS 31 #define RT298_HP_OUT 32 #define RT298_MIXER_IN1 33 #define RT298_MIXER_IN2 34 #define RT298_INLINE_CMD 35 36 #define RT298_SET_PIN_SFT 37 #define RT298_SET_PIN_ENABLE 38 #define RT298_SET_PIN_DISABLE 39 #define RT298_SET_EAPD_HIGH 40 #define RT298_SET_EAPD_LOW 41 42 #define RT298_MUTE_SFT 43 44 /* Verb commands */ 45 #define RT298_GET_PARAM(NID, PARAM) VERB_CMD(A 46 #define RT298_SET_POWER(NID) VERB_CMD(AC_VERB_ 47 #define RT298_SET_AUDIO_POWER RT298_SET_POWER( 48 #define RT298_SET_HPO_POWER RT298_SET_POWER(RT 49 #define RT298_SET_SPK_POWER RT298_SET_POWER(RT 50 #define RT298_SET_DMIC1_POWER RT298_SET_POWER( 51 #define RT298_SPK_MUX\ 52 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT29 53 #define RT298_HPO_MUX\ 54 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT29 55 #define RT298_ADC0_MUX\ 56 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT29 57 #define RT298_ADC1_MUX\ 58 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT29 59 #define RT298_SET_MIC1\ 60 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTRO 61 #define RT298_SET_PIN_HPO\ 62 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTRO 63 #define RT298_SET_PIN_SPK\ 64 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTRO 65 #define RT298_SET_PIN_DMIC1\ 66 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTRO 67 #define RT298_SET_PIN_SPDIF\ 68 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTRO 69 #define RT298_SET_PIN_DIG_CVT\ 70 VERB_CMD(AC_VERB_SET_DIGI_CONVERT_1, R 71 #define RT298_SPK_EAPD\ 72 VERB_CMD(AC_VERB_SET_EAPD_BTLENABLE, R 73 #define RT298_SET_AMP_GAIN_HPO\ 74 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 75 #define RT298_SET_AMP_GAIN_ADC_IN1\ 76 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 77 #define RT298_SET_AMP_GAIN_ADC_IN2\ 78 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 79 #define RT298_GET_HP_SENSE\ 80 VERB_CMD(AC_VERB_GET_PIN_SENSE, RT298_ 81 #define RT298_GET_MIC1_SENSE\ 82 VERB_CMD(AC_VERB_GET_PIN_SENSE, RT298_ 83 #define RT298_SET_DMIC2_DEFAULT\ 84 VERB_CMD(AC_VERB_SET_CONFIG_DEFAULT_BY 85 #define RT298_SET_SPDIF_DEFAULT\ 86 VERB_CMD(AC_VERB_SET_CONFIG_DEFAULT_BY 87 #define RT298_DACL_GAIN\ 88 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 89 #define RT298_DACR_GAIN\ 90 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 91 #define RT298_ADCL_GAIN\ 92 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 93 #define RT298_ADCR_GAIN\ 94 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 95 #define RT298_MIC_GAIN\ 96 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 97 #define RT298_SPOL_GAIN\ 98 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 99 #define RT298_SPOR_GAIN\ 100 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 101 #define RT298_HPOL_GAIN\ 102 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 103 #define RT298_HPOR_GAIN\ 104 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 105 #define RT298_F_DAC_SWITCH\ 106 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 107 #define RT298_F_RECMIX_SWITCH\ 108 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 109 #define RT298_REC_MIC_SWITCH\ 110 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 111 #define RT298_REC_I2S_SWITCH\ 112 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 113 #define RT298_REC_LINE_SWITCH\ 114 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 115 #define RT298_REC_BEEP_SWITCH\ 116 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT 117 #define RT298_DAC_FORMAT\ 118 VERB_CMD(AC_VERB_SET_STREAM_FORMAT, RT 119 #define RT298_ADC_FORMAT\ 120 VERB_CMD(AC_VERB_SET_STREAM_FORMAT, RT 121 #define RT298_COEF_INDEX\ 122 VERB_CMD(AC_VERB_SET_COEF_INDEX, RT298 123 #define RT298_PROC_COEF\ 124 VERB_CMD(AC_VERB_SET_PROC_COEF, RT298_ 125 #define RT298_UNSOLICITED_INLINE_CMD\ 126 VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABL 127 #define RT298_UNSOLICITED_HP_OUT\ 128 VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABL 129 #define RT298_UNSOLICITED_MIC1\ 130 VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABL 131 132 /* Index registers */ 133 #define RT298_A_BIAS_CTRL1 0x01 134 #define RT298_A_BIAS_CTRL2 0x02 135 #define RT298_POWER_CTRL1 0x03 136 #define RT298_A_BIAS_CTRL3 0x04 137 #define RT298_D_FILTER_CTRL 0x05 138 #define RT298_POWER_CTRL2 0x08 139 #define RT298_I2S_CTRL1 0x09 140 #define RT298_I2S_CTRL2 0x0a 141 #define RT298_CLK_DIV 0x0b 142 #define RT298_DC_GAIN 0x0d 143 #define RT298_POWER_CTRL3 0x0f 144 #define RT298_MIC1_DET_CTRL 0x19 145 #define RT298_MISC_CTRL1 0x20 146 #define RT298_IRQ_CTRL 0x33 147 #define RT298_WIND_FILTER_CTRL 0x46 148 #define RT298_PLL_CTRL1 0x49 149 #define RT298_VAD_CTRL 0x4e 150 #define RT298_CBJ_CTRL1 0x4f 151 #define RT298_CBJ_CTRL2 0x50 152 #define RT298_PLL_CTRL 0x63 153 #define RT298_DEPOP_CTRL1 0x66 154 #define RT298_DEPOP_CTRL2 0x67 155 #define RT298_DEPOP_CTRL3 0x68 156 #define RT298_DEPOP_CTRL4 0x69 157 #define RT298_IRQ_FLAG_CTRL 0x7c 158 159 /* SPDIF (0x06) */ 160 #define RT298_SPDIF_SEL_SFT 0 161 #define RT298_SPDIF_SEL_PCM0 0 162 #define RT298_SPDIF_SEL_PCM1 1 163 #define RT298_SPDIF_SEL_SPOUT 2 164 #define RT298_SPDIF_SEL_PP 3 165 166 /* RECMIX (0x0b) */ 167 #define RT298_M_REC_BEEP_SFT 0 168 #define RT298_M_REC_LINE1_SFT 1 169 #define RT298_M_REC_MIC1_SFT 2 170 #define RT298_M_REC_I2S_SFT 3 171 172 /* Front (0x0c) */ 173 #define RT298_M_FRONT_DAC_SFT 0 174 #define RT298_M_FRONT_REC_SFT 1 175 176 /* SPK-OUT (0x14) */ 177 #define RT298_M_SPK_MUX_SFT 14 178 #define RT298_SPK_SEL_MASK 0x1 179 #define RT298_SPK_SEL_SFT 0 180 #define RT298_SPK_SEL_F 0 181 #define RT298_SPK_SEL_S 1 182 183 /* HP-OUT (0x21) */ 184 #define RT298_M_HP_MUX_SFT 14 185 #define RT298_HP_SEL_MASK 0x1 186 #define RT298_HP_SEL_SFT 0 187 #define RT298_HP_SEL_F 0 188 #define RT298_HP_SEL_S 1 189 190 /* ADC (0x22) (0x23) */ 191 #define RT298_ADC_SEL_MASK 0x7 192 #define RT298_ADC_SEL_SFT 0 193 #define RT298_ADC_SEL_SURR 0 194 #define RT298_ADC_SEL_FRONT 1 195 #define RT298_ADC_SEL_DMIC 2 196 #define RT298_ADC_SEL_BEEP 4 197 #define RT298_ADC_SEL_LINE1 5 198 #define RT298_ADC_SEL_I2S 6 199 #define RT298_ADC_SEL_MIC1 7 200 201 #define RT298_SCLK_S_MCLK 0 202 #define RT298_SCLK_S_PLL 1 203 204 enum { 205 RT298_AIF1, 206 RT298_AIF2, 207 RT298_AIFS, 208 }; 209 210 #endif /* __RT298_H__ */ 211 212
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.