0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __RT286_H__
0010 #define __RT286_H__
0011
0012 #define VERB_CMD(V, N, D) ((N << 20) | (V << 8) | D)
0013
0014 #define RT286_AUDIO_FUNCTION_GROUP 0x01
0015 #define RT286_DAC_OUT1 0x02
0016 #define RT286_DAC_OUT2 0x03
0017 #define RT286_ADC_IN1 0x09
0018 #define RT286_ADC_IN2 0x08
0019 #define RT286_MIXER_IN 0x0b
0020 #define RT286_MIXER_OUT1 0x0c
0021 #define RT286_MIXER_OUT2 0x0d
0022 #define RT286_DMIC1 0x12
0023 #define RT286_DMIC2 0x13
0024 #define RT286_SPK_OUT 0x14
0025 #define RT286_MIC1 0x18
0026 #define RT286_LINE1 0x1a
0027 #define RT286_BEEP 0x1d
0028 #define RT286_SPDIF 0x1e
0029 #define RT286_VENDOR_REGISTERS 0x20
0030 #define RT286_HP_OUT 0x21
0031 #define RT286_MIXER_IN1 0x22
0032 #define RT286_MIXER_IN2 0x23
0033
0034 #define RT286_SET_PIN_SFT 6
0035 #define RT286_SET_PIN_ENABLE 0x40
0036 #define RT286_SET_PIN_DISABLE 0
0037 #define RT286_SET_EAPD_HIGH 0x2
0038 #define RT286_SET_EAPD_LOW 0
0039
0040 #define RT286_MUTE_SFT 7
0041
0042
0043 #define RT286_GET_PARAM(NID, PARAM) VERB_CMD(AC_VERB_PARAMETERS, NID, PARAM)
0044 #define RT286_SET_POWER(NID) VERB_CMD(AC_VERB_SET_POWER_STATE, NID, 0)
0045 #define RT286_SET_AUDIO_POWER RT286_SET_POWER(RT286_AUDIO_FUNCTION_GROUP)
0046 #define RT286_SET_HPO_POWER RT286_SET_POWER(RT286_HP_OUT)
0047 #define RT286_SET_SPK_POWER RT286_SET_POWER(RT286_SPK_OUT)
0048 #define RT286_SET_DMIC1_POWER RT286_SET_POWER(RT286_DMIC1)
0049 #define RT286_SPK_MUX\
0050 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT286_SPK_OUT, 0)
0051 #define RT286_HPO_MUX\
0052 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT286_HP_OUT, 0)
0053 #define RT286_ADC0_MUX\
0054 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT286_MIXER_IN1, 0)
0055 #define RT286_ADC1_MUX\
0056 VERB_CMD(AC_VERB_SET_CONNECT_SEL, RT286_MIXER_IN2, 0)
0057 #define RT286_SET_MIC1\
0058 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT286_MIC1, 0)
0059 #define RT286_SET_PIN_HPO\
0060 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT286_HP_OUT, 0)
0061 #define RT286_SET_PIN_SPK\
0062 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT286_SPK_OUT, 0)
0063 #define RT286_SET_PIN_DMIC1\
0064 VERB_CMD(AC_VERB_SET_PIN_WIDGET_CONTROL, RT286_DMIC1, 0)
0065 #define RT286_SPK_EAPD\
0066 VERB_CMD(AC_VERB_SET_EAPD_BTLENABLE, RT286_SPK_OUT, 0)
0067 #define RT286_SET_AMP_GAIN_HPO\
0068 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_HP_OUT, 0)
0069 #define RT286_SET_AMP_GAIN_ADC_IN1\
0070 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_ADC_IN1, 0)
0071 #define RT286_SET_AMP_GAIN_ADC_IN2\
0072 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_ADC_IN2, 0)
0073 #define RT286_GET_HP_SENSE\
0074 VERB_CMD(AC_VERB_GET_PIN_SENSE, RT286_HP_OUT, 0)
0075 #define RT286_GET_MIC1_SENSE\
0076 VERB_CMD(AC_VERB_GET_PIN_SENSE, RT286_MIC1, 0)
0077 #define RT286_SET_DMIC2_DEFAULT\
0078 VERB_CMD(AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, RT286_DMIC2, 0)
0079 #define RT286_DACL_GAIN\
0080 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_DAC_OUT1, 0xa000)
0081 #define RT286_DACR_GAIN\
0082 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_DAC_OUT1, 0x9000)
0083 #define RT286_ADCL_GAIN\
0084 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_ADC_IN1, 0x6000)
0085 #define RT286_ADCR_GAIN\
0086 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_ADC_IN1, 0x5000)
0087 #define RT286_MIC_GAIN\
0088 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIC1, 0x7000)
0089 #define RT286_SPOL_GAIN\
0090 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_SPK_OUT, 0xa000)
0091 #define RT286_SPOR_GAIN\
0092 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_SPK_OUT, 0x9000)
0093 #define RT286_HPOL_GAIN\
0094 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_HP_OUT, 0xa000)
0095 #define RT286_HPOR_GAIN\
0096 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_HP_OUT, 0x9000)
0097 #define RT286_F_DAC_SWITCH\
0098 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIXER_OUT1, 0x7000)
0099 #define RT286_F_RECMIX_SWITCH\
0100 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIXER_OUT1, 0x7100)
0101 #define RT286_REC_MIC_SWITCH\
0102 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIXER_IN, 0x7000)
0103 #define RT286_REC_I2S_SWITCH\
0104 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIXER_IN, 0x7100)
0105 #define RT286_REC_LINE_SWITCH\
0106 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIXER_IN, 0x7200)
0107 #define RT286_REC_BEEP_SWITCH\
0108 VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, RT286_MIXER_IN, 0x7300)
0109 #define RT286_DAC_FORMAT\
0110 VERB_CMD(AC_VERB_SET_STREAM_FORMAT, RT286_DAC_OUT1, 0)
0111 #define RT286_ADC_FORMAT\
0112 VERB_CMD(AC_VERB_SET_STREAM_FORMAT, RT286_ADC_IN1, 0)
0113 #define RT286_COEF_INDEX\
0114 VERB_CMD(AC_VERB_SET_COEF_INDEX, RT286_VENDOR_REGISTERS, 0)
0115 #define RT286_PROC_COEF\
0116 VERB_CMD(AC_VERB_SET_PROC_COEF, RT286_VENDOR_REGISTERS, 0)
0117 #define RT286_SET_GPIO_MASK\
0118 VERB_CMD(AC_VERB_SET_GPIO_MASK, RT286_AUDIO_FUNCTION_GROUP, 0)
0119 #define RT286_SET_GPIO_DIRECTION\
0120 VERB_CMD(AC_VERB_SET_GPIO_DIRECTION, RT286_AUDIO_FUNCTION_GROUP, 0)
0121 #define RT286_SET_GPIO_DATA\
0122 VERB_CMD(AC_VERB_SET_GPIO_DATA, RT286_AUDIO_FUNCTION_GROUP, 0)
0123
0124
0125 #define RT286_A_BIAS_CTRL1 0x01
0126 #define RT286_A_BIAS_CTRL2 0x02
0127 #define RT286_POWER_CTRL1 0x03
0128 #define RT286_A_BIAS_CTRL3 0x04
0129 #define RT286_POWER_CTRL2 0x08
0130 #define RT286_I2S_CTRL1 0x09
0131 #define RT286_I2S_CTRL2 0x0a
0132 #define RT286_CLK_DIV 0x0b
0133 #define RT286_DC_GAIN 0x0d
0134 #define RT286_POWER_CTRL3 0x0f
0135 #define RT286_MIC1_DET_CTRL 0x19
0136 #define RT286_MISC_CTRL1 0x20
0137 #define RT286_GPIO_CTRL 0x29
0138 #define RT286_IRQ_CTRL 0x33
0139 #define RT286_PLL_CTRL1 0x49
0140 #define RT286_CBJ_CTRL1 0x4f
0141 #define RT286_CBJ_CTRL2 0x50
0142 #define RT286_PLL_CTRL 0x63
0143 #define RT286_DEPOP_CTRL1 0x66
0144 #define RT286_DEPOP_CTRL2 0x67
0145 #define RT286_DEPOP_CTRL3 0x68
0146 #define RT286_DEPOP_CTRL4 0x69
0147
0148
0149 #define RT286_SPDIF_SEL_SFT 0
0150 #define RT286_SPDIF_SEL_PCM0 0
0151 #define RT286_SPDIF_SEL_PCM1 1
0152 #define RT286_SPDIF_SEL_SPOUT 2
0153 #define RT286_SPDIF_SEL_PP 3
0154
0155
0156 #define RT286_M_REC_BEEP_SFT 0
0157 #define RT286_M_REC_LINE1_SFT 1
0158 #define RT286_M_REC_MIC1_SFT 2
0159 #define RT286_M_REC_I2S_SFT 3
0160
0161
0162 #define RT286_M_FRONT_DAC_SFT 0
0163 #define RT286_M_FRONT_REC_SFT 1
0164
0165
0166 #define RT286_M_SPK_MUX_SFT 14
0167 #define RT286_SPK_SEL_MASK 0x1
0168 #define RT286_SPK_SEL_SFT 0
0169 #define RT286_SPK_SEL_F 0
0170 #define RT286_SPK_SEL_S 1
0171
0172
0173 #define RT286_M_HP_MUX_SFT 14
0174 #define RT286_HP_SEL_MASK 0x1
0175 #define RT286_HP_SEL_SFT 0
0176 #define RT286_HP_SEL_F 0
0177 #define RT286_HP_SEL_S 1
0178
0179
0180 #define RT286_ADC_SEL_MASK 0x7
0181 #define RT286_ADC_SEL_SFT 0
0182 #define RT286_ADC_SEL_SURR 0
0183 #define RT286_ADC_SEL_FRONT 1
0184 #define RT286_ADC_SEL_DMIC 2
0185 #define RT286_ADC_SEL_BEEP 4
0186 #define RT286_ADC_SEL_LINE1 5
0187 #define RT286_ADC_SEL_I2S 6
0188 #define RT286_ADC_SEL_MIC1 7
0189
0190 #define RT286_SCLK_S_MCLK 0
0191 #define RT286_SCLK_S_PLL 1
0192
0193 enum {
0194 RT286_AIF1,
0195 RT286_AIF2,
0196 RT286_AIFS,
0197 };
0198
0199 #endif
0200