1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * rt715.h -- RT715 ALSA SoC audio driver head 4 * 5 * Copyright(c) 2019 Realtek Semiconductor Cor 6 */ 7 8 #ifndef __RT715_H__ 9 #define __RT715_H__ 10 11 #include <linux/regulator/consumer.h> 12 13 struct rt715_priv { 14 struct regmap *regmap; 15 struct regmap *sdw_regmap; 16 struct snd_soc_codec *codec; 17 struct sdw_slave *slave; 18 int dbg_nid; 19 int dbg_vid; 20 int dbg_payload; 21 struct sdw_bus_params params; 22 bool hw_init; 23 bool first_hw_init; 24 unsigned int kctl_2ch_vol_ori[2]; 25 unsigned int kctl_8ch_switch_ori[8]; 26 unsigned int kctl_8ch_vol_ori[8]; 27 }; 28 29 /* NID */ 30 #define RT715_AUDIO_FUNCTION_GROUP 31 #define RT715_MIC_ADC 32 #define RT715_LINE_ADC 33 #define RT715_MIX_ADC 34 #define RT715_DMIC1 35 #define RT715_DMIC2 36 #define RT715_MIC1 37 #define RT715_MIC2 38 #define RT715_LINE1 39 #define RT715_LINE2 40 #define RT715_DMIC3 41 #define RT715_DMIC4 42 #define RT715_VENDOR_REGISTERS 43 #define RT715_MUX_IN1 44 #define RT715_MUX_IN2 45 #define RT715_MUX_IN3 46 #define RT715_MUX_IN4 47 #define RT715_MIX_ADC2 48 #define RT715_INLINE_CMD 49 50 /* Index (NID:20h) */ 51 #define RT715_VD_CLEAR_CTRL 52 #define RT715_SDW_INPUT_SEL 53 #define RT715_EXT_DMIC_CLK_CTRL2 54 55 /* Verb */ 56 #define RT715_VERB_SET_CONNECT_SEL 57 #define RT715_VERB_GET_CONNECT_SEL 58 #define RT715_VERB_SET_EAPD_BTLENABLE 59 #define RT715_VERB_SET_POWER_STATE 60 #define RT715_VERB_SET_CHANNEL_STREAMID 61 #define RT715_VERB_SET_PIN_WIDGET_CONTROL 62 #define RT715_VERB_SET_CONFIG_DEFAULT1 63 #define RT715_VERB_SET_CONFIG_DEFAULT2 64 #define RT715_VERB_SET_CONFIG_DEFAULT3 65 #define RT715_VERB_SET_CONFIG_DEFAULT4 66 #define RT715_VERB_SET_UNSOLICITED_ENABLE 67 #define RT715_SET_AMP_GAIN_MUTE_H 68 #define RT715_SET_AMP_GAIN_MUTE_L 69 #define RT715_READ_HDA_3 70 #define RT715_READ_HDA_2 71 #define RT715_READ_HDA_1 72 #define RT715_READ_HDA_0 73 #define RT715_PRIV_INDEX_W_H 74 #define RT715_PRIV_INDEX_W_L 75 #define RT715_PRIV_INDEX_W_H_2 76 #define RT715_PRIV_INDEX_W_L_2 77 #define RT715_PRIV_DATA_W_H 78 #define RT715_PRIV_DATA_W_L 79 #define RT715_PRIV_INDEX_R_H 80 #define RT715_PRIV_INDEX_R_L 81 #define RT715_PRIV_DATA_R_H 82 #define RT715_PRIV_DATA_R_L 83 #define RT715_MIC_ADC_FORMAT_H 84 #define RT715_MIC_ADC_FORMAT_L 85 #define RT715_MIC_LINE_FORMAT_H 86 #define RT715_MIC_LINE_FORMAT_L 87 #define RT715_MIX_ADC_FORMAT_H 88 #define RT715_MIX_ADC_FORMAT_L 89 #define RT715_MIX_ADC2_FORMAT_H 90 #define RT715_MIX_ADC2_FORMAT_L 91 #define RT715_FUNC_RESET 92 93 #define RT715_SET_AUDIO_POWER_STATE\ 94 (RT715_VERB_SET_POWER_STATE | RT715_AU 95 #define RT715_SET_PIN_DMIC1\ 96 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 97 #define RT715_SET_PIN_DMIC2\ 98 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 99 #define RT715_SET_PIN_DMIC3\ 100 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 101 #define RT715_SET_PIN_DMIC4\ 102 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 103 #define RT715_SET_PIN_MIC1\ 104 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 105 #define RT715_SET_PIN_MIC2\ 106 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 107 #define RT715_SET_PIN_LINE1\ 108 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 109 #define RT715_SET_PIN_LINE2\ 110 (RT715_VERB_SET_PIN_WIDGET_CONTROL | R 111 #define RT715_SET_MIC1_UNSOLICITED_ENABLE\ 112 (RT715_VERB_SET_UNSOLICITED_ENABLE | R 113 #define RT715_SET_MIC2_UNSOLICITED_ENABLE\ 114 (RT715_VERB_SET_UNSOLICITED_ENABLE | R 115 #define RT715_SET_STREAMID_MIC_ADC\ 116 (RT715_VERB_SET_CHANNEL_STREAMID | RT7 117 #define RT715_SET_STREAMID_LINE_ADC\ 118 (RT715_VERB_SET_CHANNEL_STREAMID | RT7 119 #define RT715_SET_STREAMID_MIX_ADC\ 120 (RT715_VERB_SET_CHANNEL_STREAMID | RT7 121 #define RT715_SET_STREAMID_MIX_ADC2\ 122 (RT715_VERB_SET_CHANNEL_STREAMID | RT7 123 #define RT715_SET_GAIN_MIC_ADC_L\ 124 (RT715_SET_AMP_GAIN_MUTE_L | RT715_MIC 125 #define RT715_SET_GAIN_MIC_ADC_H\ 126 (RT715_SET_AMP_GAIN_MUTE_H | RT715_MIC 127 #define RT715_SET_GAIN_LINE_ADC_L\ 128 (RT715_SET_AMP_GAIN_MUTE_L | RT715_LIN 129 #define RT715_SET_GAIN_LINE_ADC_H\ 130 (RT715_SET_AMP_GAIN_MUTE_H | RT715_LIN 131 #define RT715_SET_GAIN_MIX_ADC_L\ 132 (RT715_SET_AMP_GAIN_MUTE_L | RT715_MIX 133 #define RT715_SET_GAIN_MIX_ADC_H\ 134 (RT715_SET_AMP_GAIN_MUTE_H | RT715_MIX 135 #define RT715_SET_GAIN_MIX_ADC2_L\ 136 (RT715_SET_AMP_GAIN_MUTE_L | RT715_MIX 137 #define RT715_SET_GAIN_MIX_ADC2_H\ 138 (RT715_SET_AMP_GAIN_MUTE_H | RT715_MIX 139 #define RT715_SET_GAIN_DMIC1_L\ 140 (RT715_SET_AMP_GAIN_MUTE_L | RT715_DMI 141 #define RT715_SET_GAIN_DMIC1_H\ 142 (RT715_SET_AMP_GAIN_MUTE_H | RT715_DMI 143 #define RT715_SET_GAIN_DMIC2_L\ 144 (RT715_SET_AMP_GAIN_MUTE_L | RT715_DMI 145 #define RT715_SET_GAIN_DMIC2_H\ 146 (RT715_SET_AMP_GAIN_MUTE_H | RT715_DMI 147 #define RT715_SET_GAIN_DMIC3_L\ 148 (RT715_SET_AMP_GAIN_MUTE_L | RT715_DMI 149 #define RT715_SET_GAIN_DMIC3_H\ 150 (RT715_SET_AMP_GAIN_MUTE_H | RT715_DMI 151 #define RT715_SET_GAIN_DMIC4_L\ 152 (RT715_SET_AMP_GAIN_MUTE_L | RT715_DMI 153 #define RT715_SET_GAIN_DMIC4_H\ 154 (RT715_SET_AMP_GAIN_MUTE_H | RT715_DMI 155 #define RT715_SET_GAIN_MIC1_L\ 156 (RT715_SET_AMP_GAIN_MUTE_L | RT715_MIC 157 #define RT715_SET_GAIN_MIC1_H\ 158 (RT715_SET_AMP_GAIN_MUTE_H | RT715_MIC 159 #define RT715_SET_GAIN_MIC2_L\ 160 (RT715_SET_AMP_GAIN_MUTE_L | RT715_MIC 161 #define RT715_SET_GAIN_MIC2_H\ 162 (RT715_SET_AMP_GAIN_MUTE_H | RT715_MIC 163 #define RT715_SET_GAIN_LINE1_L\ 164 (RT715_SET_AMP_GAIN_MUTE_L | RT715_LIN 165 #define RT715_SET_GAIN_LINE1_H\ 166 (RT715_SET_AMP_GAIN_MUTE_H | RT715_LIN 167 #define RT715_SET_GAIN_LINE2_L\ 168 (RT715_SET_AMP_GAIN_MUTE_L | RT715_LIN 169 #define RT715_SET_GAIN_LINE2_H\ 170 (RT715_SET_AMP_GAIN_MUTE_H | RT715_LIN 171 #define RT715_SET_DMIC1_CONFIG_DEFAULT1\ 172 (RT715_VERB_SET_CONFIG_DEFAULT1 | RT71 173 #define RT715_SET_DMIC2_CONFIG_DEFAULT1\ 174 (RT715_VERB_SET_CONFIG_DEFAULT1 | RT71 175 #define RT715_SET_DMIC1_CONFIG_DEFAULT2\ 176 (RT715_VERB_SET_CONFIG_DEFAULT2 | RT71 177 #define RT715_SET_DMIC2_CONFIG_DEFAULT2\ 178 (RT715_VERB_SET_CONFIG_DEFAULT2 | RT71 179 #define RT715_SET_DMIC1_CONFIG_DEFAULT3\ 180 (RT715_VERB_SET_CONFIG_DEFAULT3 | RT71 181 #define RT715_SET_DMIC2_CONFIG_DEFAULT3\ 182 (RT715_VERB_SET_CONFIG_DEFAULT3 | RT71 183 #define RT715_SET_DMIC1_CONFIG_DEFAULT4\ 184 (RT715_VERB_SET_CONFIG_DEFAULT4 | RT71 185 #define RT715_SET_DMIC2_CONFIG_DEFAULT4\ 186 (RT715_VERB_SET_CONFIG_DEFAULT4 | RT71 187 #define RT715_SET_DMIC3_CONFIG_DEFAULT1\ 188 (RT715_VERB_SET_CONFIG_DEFAULT1 | RT71 189 #define RT715_SET_DMIC4_CONFIG_DEFAULT1\ 190 (RT715_VERB_SET_CONFIG_DEFAULT1 | RT71 191 #define RT715_SET_DMIC3_CONFIG_DEFAULT2\ 192 (RT715_VERB_SET_CONFIG_DEFAULT2 | RT71 193 #define RT715_SET_DMIC4_CONFIG_DEFAULT2\ 194 (RT715_VERB_SET_CONFIG_DEFAULT2 | RT71 195 #define RT715_SET_DMIC3_CONFIG_DEFAULT3\ 196 (RT715_VERB_SET_CONFIG_DEFAULT3 | RT71 197 #define RT715_SET_DMIC4_CONFIG_DEFAULT3\ 198 (RT715_VERB_SET_CONFIG_DEFAULT3 | RT71 199 #define RT715_SET_DMIC3_CONFIG_DEFAULT4\ 200 (RT715_VERB_SET_CONFIG_DEFAULT4 | RT71 201 #define RT715_SET_DMIC4_CONFIG_DEFAULT4\ 202 (RT715_VERB_SET_CONFIG_DEFAULT4 | RT71 203 204 /* vendor register clear ctrl-1 (0x01)(NID: 205 #define RT715_CLEAR_HIDDEN_REG (0x1 << 15) 206 207 208 #define RT715_MUTE_SFT 209 #define RT715_DIR_IN_SFT 210 #define RT715_DIR_OUT_SFT 211 212 enum { 213 RT715_AIF1, 214 RT715_AIF2, 215 }; 216 217 #define RT715_POWER_UP_DELAY_MS 400 218 219 int rt715_io_init(struct device *dev, struct s 220 int rt715_init(struct device *dev, struct regm 221 struct regmap *regmap, struct sdw_slav 222 223 int hda_to_sdw(unsigned int nid, unsigned int 224 unsigned int *sdw_addr_h, unsig 225 unsigned int *sdw_addr_l, unsig 226 int rt715_clock_config(struct device *dev); 227 #endif /* __RT715_H__ */ 228
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.