Richard Fitzgerald | 6610550 | 2015-11-03 15:08:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * cs47l24.h -- ALSA SoC Audio driver for Cirrus Logic CS47L24 |
| 3 | * |
| 4 | * Copyright 2015 Cirrus Logic Inc. |
| 5 | * |
| 6 | * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/module.h> |
| 14 | #include <linux/moduleparam.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/delay.h> |
| 17 | #include <linux/pm.h> |
| 18 | #include <linux/pm_runtime.h> |
| 19 | #include <linux/regmap.h> |
| 20 | #include <linux/slab.h> |
| 21 | #include <sound/core.h> |
| 22 | #include <sound/pcm.h> |
| 23 | #include <sound/pcm_params.h> |
| 24 | #include <sound/soc.h> |
| 25 | #include <sound/jack.h> |
| 26 | #include <sound/initval.h> |
| 27 | #include <sound/tlv.h> |
| 28 | |
| 29 | #include <linux/mfd/arizona/core.h> |
| 30 | #include <linux/mfd/arizona/registers.h> |
| 31 | |
| 32 | #include "arizona.h" |
| 33 | #include "wm_adsp.h" |
| 34 | #include "cs47l24.h" |
| 35 | |
| 36 | struct cs47l24_priv { |
| 37 | struct arizona_priv core; |
| 38 | struct arizona_fll fll[2]; |
| 39 | }; |
| 40 | |
| 41 | static const struct wm_adsp_region cs47l24_dsp2_regions[] = { |
| 42 | { .type = WMFW_ADSP2_PM, .base = 0x200000 }, |
| 43 | { .type = WMFW_ADSP2_ZM, .base = 0x280000 }, |
| 44 | { .type = WMFW_ADSP2_XM, .base = 0x290000 }, |
| 45 | { .type = WMFW_ADSP2_YM, .base = 0x2a8000 }, |
| 46 | }; |
| 47 | |
| 48 | static const struct wm_adsp_region cs47l24_dsp3_regions[] = { |
| 49 | { .type = WMFW_ADSP2_PM, .base = 0x300000 }, |
| 50 | { .type = WMFW_ADSP2_ZM, .base = 0x380000 }, |
| 51 | { .type = WMFW_ADSP2_XM, .base = 0x390000 }, |
| 52 | { .type = WMFW_ADSP2_YM, .base = 0x3a8000 }, |
| 53 | }; |
| 54 | |
| 55 | static const struct wm_adsp_region *cs47l24_dsp_regions[] = { |
| 56 | cs47l24_dsp2_regions, |
| 57 | cs47l24_dsp3_regions, |
| 58 | }; |
| 59 | |
| 60 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
| 61 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
| 62 | static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); |
| 63 | static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); |
| 64 | |
| 65 | #define CS47L24_NG_SRC(name, base) \ |
| 66 | SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \ |
| 67 | SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \ |
| 68 | SOC_SINGLE(name " NG SPKOUT Switch", base, 6, 1, 0) |
| 69 | |
| 70 | static const struct snd_kcontrol_new cs47l24_snd_controls[] = { |
| 71 | SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]), |
| 72 | SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]), |
| 73 | |
| 74 | SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum), |
| 75 | |
| 76 | SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL, |
| 77 | ARIZONA_IN1L_HPF_SHIFT, 1, 0), |
| 78 | SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL, |
| 79 | ARIZONA_IN1R_HPF_SHIFT, 1, 0), |
| 80 | SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL, |
| 81 | ARIZONA_IN2L_HPF_SHIFT, 1, 0), |
| 82 | SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL, |
| 83 | ARIZONA_IN2R_HPF_SHIFT, 1, 0), |
| 84 | |
| 85 | SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L, |
| 86 | ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), |
| 87 | SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R, |
| 88 | ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), |
| 89 | SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L, |
| 90 | ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), |
| 91 | SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R, |
| 92 | ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), |
| 93 | |
| 94 | SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp), |
| 95 | SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp), |
| 96 | |
| 97 | ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE), |
| 98 | ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), |
| 99 | |
| 100 | ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2), |
| 101 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, |
| 102 | 24, 0, eq_tlv), |
| 103 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, |
| 104 | 24, 0, eq_tlv), |
| 105 | SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT, |
| 106 | 24, 0, eq_tlv), |
| 107 | SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT, |
| 108 | 24, 0, eq_tlv), |
| 109 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, |
| 110 | 24, 0, eq_tlv), |
| 111 | |
| 112 | ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2), |
| 113 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, |
| 114 | 24, 0, eq_tlv), |
| 115 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, |
| 116 | 24, 0, eq_tlv), |
| 117 | SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT, |
| 118 | 24, 0, eq_tlv), |
| 119 | SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT, |
| 120 | 24, 0, eq_tlv), |
| 121 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, |
| 122 | 24, 0, eq_tlv), |
| 123 | |
| 124 | ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE), |
| 125 | ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE), |
| 126 | ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE), |
| 127 | ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE), |
| 128 | |
| 129 | SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5, |
| 130 | ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA), |
| 131 | SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5, |
| 132 | ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA), |
| 133 | |
| 134 | ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE), |
| 135 | ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE), |
| 136 | ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE), |
| 137 | ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE), |
| 138 | |
| 139 | ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2), |
| 140 | ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2), |
| 141 | ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2), |
| 142 | ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2), |
| 143 | |
| 144 | SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode), |
| 145 | SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode), |
| 146 | SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode), |
| 147 | SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode), |
| 148 | |
| 149 | SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]), |
| 150 | SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]), |
| 151 | SOC_ENUM("ISRC3 FSL", arizona_isrc_fsl[2]), |
| 152 | SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]), |
| 153 | SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]), |
| 154 | SOC_ENUM("ISRC3 FSH", arizona_isrc_fsh[2]), |
| 155 | SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1), |
| 156 | |
| 157 | ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE), |
| 158 | ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE), |
| 159 | ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE), |
| 160 | ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE), |
| 161 | |
| 162 | SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR, |
| 163 | ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv), |
| 164 | |
| 165 | ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE), |
| 166 | ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE), |
| 167 | ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE), |
| 168 | |
| 169 | SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL, |
| 170 | ARIZONA_HP1_SC_ENA_SHIFT, 1, 0), |
| 171 | |
| 172 | SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, |
| 173 | ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), |
| 174 | SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, |
| 175 | ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), |
| 176 | |
| 177 | SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, |
| 178 | ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, |
| 179 | 0xbf, 0, digital_tlv), |
| 180 | SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, |
| 181 | ARIZONA_OUT4L_VOL_SHIFT, |
| 182 | 0xbf, 0, digital_tlv), |
| 183 | |
| 184 | SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), |
| 185 | SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), |
| 186 | |
| 187 | SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL, |
| 188 | ARIZONA_NGATE_ENA_SHIFT, 1, 0), |
| 189 | SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL, |
| 190 | ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv), |
| 191 | SOC_ENUM("Noise Gate Hold", arizona_ng_hold), |
| 192 | |
| 193 | CS47L24_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L), |
| 194 | CS47L24_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R), |
| 195 | CS47L24_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L), |
| 196 | |
| 197 | ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), |
| 198 | ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), |
| 199 | ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), |
| 200 | ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE), |
| 201 | ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE), |
| 202 | ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE), |
| 203 | ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE), |
| 204 | ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE), |
| 205 | |
| 206 | ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE), |
| 207 | ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE), |
| 208 | ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE), |
| 209 | ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE), |
| 210 | ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE), |
| 211 | ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE), |
| 212 | |
| 213 | ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE), |
| 214 | ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), |
| 215 | }; |
| 216 | |
| 217 | ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); |
| 218 | ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); |
| 219 | |
| 220 | ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE); |
| 221 | ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE); |
| 222 | ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE); |
| 223 | ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE); |
| 224 | |
| 225 | ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE); |
| 226 | ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE); |
| 227 | ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE); |
| 228 | ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE); |
| 229 | |
| 230 | ARIZONA_MIXER_ENUMS(DSP2L, ARIZONA_DSP2LMIX_INPUT_1_SOURCE); |
| 231 | ARIZONA_MIXER_ENUMS(DSP2R, ARIZONA_DSP2RMIX_INPUT_1_SOURCE); |
| 232 | ARIZONA_DSP_AUX_ENUMS(DSP2, ARIZONA_DSP2AUX1MIX_INPUT_1_SOURCE); |
| 233 | |
| 234 | ARIZONA_MIXER_ENUMS(DSP3L, ARIZONA_DSP3LMIX_INPUT_1_SOURCE); |
| 235 | ARIZONA_MIXER_ENUMS(DSP3R, ARIZONA_DSP3RMIX_INPUT_1_SOURCE); |
| 236 | ARIZONA_DSP_AUX_ENUMS(DSP3, ARIZONA_DSP3AUX1MIX_INPUT_1_SOURCE); |
| 237 | |
| 238 | ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE); |
| 239 | ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE); |
| 240 | |
| 241 | ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE); |
| 242 | ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE); |
| 243 | ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE); |
| 244 | |
| 245 | ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE); |
| 246 | ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE); |
| 247 | ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE); |
| 248 | ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE); |
| 249 | ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE); |
| 250 | ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE); |
| 251 | ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE); |
| 252 | ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE); |
| 253 | |
| 254 | ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE); |
| 255 | ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE); |
| 256 | ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE); |
| 257 | ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE); |
| 258 | ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE); |
| 259 | ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE); |
| 260 | |
| 261 | ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); |
| 262 | ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); |
| 263 | |
| 264 | ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); |
| 265 | ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); |
| 266 | ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); |
| 267 | ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); |
| 268 | |
| 269 | ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE); |
| 270 | ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE); |
| 271 | ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE); |
| 272 | ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE); |
| 273 | |
| 274 | ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE); |
| 275 | ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE); |
| 276 | ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE); |
| 277 | ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE); |
| 278 | |
| 279 | ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE); |
| 280 | ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE); |
| 281 | ARIZONA_MUX_ENUMS(ISRC2INT3, ARIZONA_ISRC2INT3MIX_INPUT_1_SOURCE); |
| 282 | ARIZONA_MUX_ENUMS(ISRC2INT4, ARIZONA_ISRC2INT4MIX_INPUT_1_SOURCE); |
| 283 | |
| 284 | ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE); |
| 285 | ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE); |
| 286 | ARIZONA_MUX_ENUMS(ISRC2DEC3, ARIZONA_ISRC2DEC3MIX_INPUT_1_SOURCE); |
| 287 | ARIZONA_MUX_ENUMS(ISRC2DEC4, ARIZONA_ISRC2DEC4MIX_INPUT_1_SOURCE); |
| 288 | |
| 289 | ARIZONA_MUX_ENUMS(ISRC3INT1, ARIZONA_ISRC3INT1MIX_INPUT_1_SOURCE); |
| 290 | ARIZONA_MUX_ENUMS(ISRC3INT2, ARIZONA_ISRC3INT2MIX_INPUT_1_SOURCE); |
| 291 | ARIZONA_MUX_ENUMS(ISRC3INT3, ARIZONA_ISRC3INT3MIX_INPUT_1_SOURCE); |
| 292 | ARIZONA_MUX_ENUMS(ISRC3INT4, ARIZONA_ISRC3INT4MIX_INPUT_1_SOURCE); |
| 293 | |
| 294 | ARIZONA_MUX_ENUMS(ISRC3DEC1, ARIZONA_ISRC3DEC1MIX_INPUT_1_SOURCE); |
| 295 | ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE); |
| 296 | ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE); |
| 297 | ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE); |
| 298 | |
| 299 | static const char * const cs47l24_aec_loopback_texts[] = { |
| 300 | "HPOUT1L", "HPOUT1R", "SPKOUT", |
| 301 | }; |
| 302 | |
| 303 | static const unsigned int cs47l24_aec_loopback_values[] = { |
| 304 | 0, 1, 6, |
| 305 | }; |
| 306 | |
| 307 | static const struct soc_enum cs47l24_aec_loopback = |
| 308 | SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1, |
| 309 | ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf, |
| 310 | ARRAY_SIZE(cs47l24_aec_loopback_texts), |
| 311 | cs47l24_aec_loopback_texts, |
| 312 | cs47l24_aec_loopback_values); |
| 313 | |
| 314 | static const struct snd_kcontrol_new cs47l24_aec_loopback_mux = |
| 315 | SOC_DAPM_ENUM("AEC Loopback", cs47l24_aec_loopback); |
| 316 | |
| 317 | static const struct snd_soc_dapm_widget cs47l24_dapm_widgets[] = { |
| 318 | SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, |
| 319 | ARIZONA_SYSCLK_ENA_SHIFT, 0, NULL, 0), |
| 320 | SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, |
| 321 | ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), |
| 322 | SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK, |
| 323 | ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0), |
| 324 | SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK, |
| 325 | ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0), |
| 326 | |
| 327 | SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0), |
| 328 | SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS), |
| 329 | SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0), |
| 330 | |
| 331 | SND_SOC_DAPM_SIGGEN("TONE"), |
| 332 | SND_SOC_DAPM_SIGGEN("NOISE"), |
| 333 | SND_SOC_DAPM_SIGGEN("HAPTICS"), |
| 334 | |
| 335 | SND_SOC_DAPM_INPUT("IN1L"), |
| 336 | SND_SOC_DAPM_INPUT("IN1R"), |
| 337 | SND_SOC_DAPM_INPUT("IN2L"), |
| 338 | SND_SOC_DAPM_INPUT("IN2R"), |
| 339 | |
| 340 | SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"), |
| 341 | SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"), |
| 342 | |
| 343 | SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT, |
| 344 | 0, NULL, 0, arizona_in_ev, |
| 345 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
| 346 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
| 347 | SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT, |
| 348 | 0, NULL, 0, arizona_in_ev, |
| 349 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
| 350 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
| 351 | SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT, |
| 352 | 0, NULL, 0, arizona_in_ev, |
| 353 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
| 354 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
| 355 | SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT, |
| 356 | 0, NULL, 0, arizona_in_ev, |
| 357 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
| 358 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
| 359 | |
| 360 | SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1, |
| 361 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), |
| 362 | SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2, |
| 363 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), |
| 364 | |
| 365 | SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR, |
| 366 | ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0), |
| 367 | |
| 368 | SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1, |
| 369 | ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0), |
| 370 | SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1, |
| 371 | ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0), |
| 372 | |
| 373 | SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0), |
| 374 | SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0), |
| 375 | |
| 376 | SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0, |
| 377 | NULL, 0), |
| 378 | SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0, |
| 379 | NULL, 0), |
| 380 | SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0, |
| 381 | NULL, 0), |
| 382 | SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0, |
| 383 | NULL, 0), |
| 384 | |
| 385 | SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0, |
| 386 | NULL, 0), |
| 387 | SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0, |
| 388 | NULL, 0), |
| 389 | SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0, |
| 390 | NULL, 0), |
| 391 | SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0, |
| 392 | NULL, 0), |
| 393 | |
| 394 | SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT, |
| 395 | 0, NULL, 0), |
| 396 | SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT, |
| 397 | 0, NULL, 0), |
| 398 | |
| 399 | SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0, |
| 400 | NULL, 0), |
| 401 | SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0, |
| 402 | NULL, 0), |
| 403 | SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0, |
| 404 | NULL, 0), |
| 405 | SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0, |
| 406 | NULL, 0), |
| 407 | |
| 408 | WM_ADSP2("DSP2", 1), |
| 409 | WM_ADSP2("DSP3", 2), |
| 410 | |
| 411 | SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3, |
| 412 | ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0), |
| 413 | SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3, |
| 414 | ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0), |
| 415 | SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3, |
| 416 | ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0), |
| 417 | SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3, |
| 418 | ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0), |
| 419 | |
| 420 | SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3, |
| 421 | ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0), |
| 422 | SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3, |
| 423 | ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0), |
| 424 | SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3, |
| 425 | ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0), |
| 426 | SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3, |
| 427 | ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0), |
| 428 | |
| 429 | SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3, |
| 430 | ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0), |
| 431 | SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3, |
| 432 | ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0), |
| 433 | SND_SOC_DAPM_PGA("ISRC2INT3", ARIZONA_ISRC_2_CTRL_3, |
| 434 | ARIZONA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0), |
| 435 | SND_SOC_DAPM_PGA("ISRC2INT4", ARIZONA_ISRC_2_CTRL_3, |
| 436 | ARIZONA_ISRC2_INT3_ENA_SHIFT, 0, NULL, 0), |
| 437 | |
| 438 | SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3, |
| 439 | ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0), |
| 440 | SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3, |
| 441 | ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0), |
| 442 | SND_SOC_DAPM_PGA("ISRC2DEC3", ARIZONA_ISRC_2_CTRL_3, |
| 443 | ARIZONA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0), |
| 444 | SND_SOC_DAPM_PGA("ISRC2DEC4", ARIZONA_ISRC_2_CTRL_3, |
| 445 | ARIZONA_ISRC2_DEC3_ENA_SHIFT, 0, NULL, 0), |
| 446 | |
| 447 | SND_SOC_DAPM_PGA("ISRC3INT1", ARIZONA_ISRC_3_CTRL_3, |
| 448 | ARIZONA_ISRC3_INT0_ENA_SHIFT, 0, NULL, 0), |
| 449 | SND_SOC_DAPM_PGA("ISRC3INT2", ARIZONA_ISRC_3_CTRL_3, |
| 450 | ARIZONA_ISRC3_INT1_ENA_SHIFT, 0, NULL, 0), |
| 451 | SND_SOC_DAPM_PGA("ISRC3INT3", ARIZONA_ISRC_3_CTRL_3, |
| 452 | ARIZONA_ISRC3_INT2_ENA_SHIFT, 0, NULL, 0), |
| 453 | SND_SOC_DAPM_PGA("ISRC3INT4", ARIZONA_ISRC_3_CTRL_3, |
| 454 | ARIZONA_ISRC3_INT3_ENA_SHIFT, 0, NULL, 0), |
| 455 | |
| 456 | SND_SOC_DAPM_PGA("ISRC3DEC1", ARIZONA_ISRC_3_CTRL_3, |
| 457 | ARIZONA_ISRC3_DEC0_ENA_SHIFT, 0, NULL, 0), |
| 458 | SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3, |
| 459 | ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0), |
| 460 | SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3, |
| 461 | ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0), |
| 462 | SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3, |
| 463 | ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0), |
| 464 | |
| 465 | SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, |
| 466 | ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, |
| 467 | &cs47l24_aec_loopback_mux), |
| 468 | |
| 469 | SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, |
| 470 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), |
| 471 | SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0, |
| 472 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0), |
| 473 | SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0, |
| 474 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0), |
| 475 | SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0, |
| 476 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0), |
| 477 | SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0, |
| 478 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0), |
| 479 | SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0, |
| 480 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0), |
| 481 | SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0, |
| 482 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0), |
| 483 | SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0, |
| 484 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0), |
| 485 | |
| 486 | SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0, |
| 487 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0), |
| 488 | SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0, |
| 489 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0), |
| 490 | SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0, |
| 491 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0), |
| 492 | SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0, |
| 493 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0), |
| 494 | SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0, |
| 495 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0), |
| 496 | SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0, |
| 497 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0), |
| 498 | SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0, |
| 499 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0), |
| 500 | SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0, |
| 501 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0), |
| 502 | |
| 503 | SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0, |
| 504 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0), |
| 505 | SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0, |
| 506 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0), |
| 507 | SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 0, |
| 508 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0), |
| 509 | SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 0, |
| 510 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0), |
| 511 | SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 0, |
| 512 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0), |
| 513 | SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 0, |
| 514 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0), |
| 515 | |
| 516 | SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0, |
| 517 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0), |
| 518 | SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0, |
| 519 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0), |
| 520 | SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 0, |
| 521 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0), |
| 522 | SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 0, |
| 523 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0), |
| 524 | SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 0, |
| 525 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0), |
| 526 | SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 0, |
| 527 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0), |
| 528 | |
| 529 | SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0, |
| 530 | ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0), |
| 531 | SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0, |
| 532 | ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0), |
| 533 | |
| 534 | SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0, |
| 535 | ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0), |
| 536 | SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0, |
| 537 | ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0), |
| 538 | |
| 539 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, |
| 540 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
| 541 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
| 542 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
| 543 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, |
| 544 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
| 545 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
| 546 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
| 547 | |
| 548 | ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"), |
| 549 | ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"), |
| 550 | |
| 551 | ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"), |
| 552 | ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"), |
| 553 | ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"), |
| 554 | ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"), |
| 555 | |
| 556 | ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"), |
| 557 | ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"), |
| 558 | ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"), |
| 559 | ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"), |
| 560 | |
| 561 | ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"), |
| 562 | ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"), |
| 563 | |
| 564 | ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"), |
| 565 | ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"), |
| 566 | ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"), |
| 567 | |
| 568 | ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"), |
| 569 | ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"), |
| 570 | ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"), |
| 571 | ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"), |
| 572 | ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"), |
| 573 | ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"), |
| 574 | ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"), |
| 575 | ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"), |
| 576 | |
| 577 | ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"), |
| 578 | ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"), |
| 579 | ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"), |
| 580 | ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"), |
| 581 | ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"), |
| 582 | ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"), |
| 583 | |
| 584 | ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), |
| 585 | ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), |
| 586 | |
| 587 | ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"), |
| 588 | ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"), |
| 589 | ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"), |
| 590 | ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"), |
| 591 | |
| 592 | ARIZONA_DSP_WIDGETS(DSP2, "DSP2"), |
| 593 | ARIZONA_DSP_WIDGETS(DSP3, "DSP3"), |
| 594 | |
| 595 | ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"), |
| 596 | ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"), |
| 597 | ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"), |
| 598 | ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"), |
| 599 | |
| 600 | ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"), |
| 601 | ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"), |
| 602 | ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"), |
| 603 | ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"), |
| 604 | |
| 605 | ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"), |
| 606 | ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"), |
| 607 | ARIZONA_MUX_WIDGETS(ISRC2DEC3, "ISRC2DEC3"), |
| 608 | ARIZONA_MUX_WIDGETS(ISRC2DEC4, "ISRC2DEC4"), |
| 609 | |
| 610 | ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"), |
| 611 | ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"), |
| 612 | ARIZONA_MUX_WIDGETS(ISRC2INT3, "ISRC2INT3"), |
| 613 | ARIZONA_MUX_WIDGETS(ISRC2INT4, "ISRC2INT4"), |
| 614 | |
| 615 | ARIZONA_MUX_WIDGETS(ISRC3DEC1, "ISRC3DEC1"), |
| 616 | ARIZONA_MUX_WIDGETS(ISRC3DEC2, "ISRC3DEC2"), |
| 617 | ARIZONA_MUX_WIDGETS(ISRC3DEC3, "ISRC3DEC3"), |
| 618 | ARIZONA_MUX_WIDGETS(ISRC3DEC4, "ISRC3DEC4"), |
| 619 | |
| 620 | ARIZONA_MUX_WIDGETS(ISRC3INT1, "ISRC3INT1"), |
| 621 | ARIZONA_MUX_WIDGETS(ISRC3INT2, "ISRC3INT2"), |
| 622 | ARIZONA_MUX_WIDGETS(ISRC3INT3, "ISRC3INT3"), |
| 623 | ARIZONA_MUX_WIDGETS(ISRC3INT4, "ISRC3INT4"), |
| 624 | |
| 625 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), |
| 626 | SND_SOC_DAPM_OUTPUT("HPOUT1R"), |
| 627 | SND_SOC_DAPM_OUTPUT("SPKOUTN"), |
| 628 | SND_SOC_DAPM_OUTPUT("SPKOUTP"), |
| 629 | |
| 630 | SND_SOC_DAPM_OUTPUT("MICSUPP"), |
| 631 | }; |
| 632 | |
| 633 | #define ARIZONA_MIXER_INPUT_ROUTES(name) \ |
| 634 | { name, "Noise Generator", "Noise Generator" }, \ |
| 635 | { name, "Tone Generator 1", "Tone Generator 1" }, \ |
| 636 | { name, "Tone Generator 2", "Tone Generator 2" }, \ |
| 637 | { name, "Haptics", "HAPTICS" }, \ |
| 638 | { name, "AEC", "AEC Loopback" }, \ |
| 639 | { name, "IN1L", "IN1L PGA" }, \ |
| 640 | { name, "IN1R", "IN1R PGA" }, \ |
| 641 | { name, "IN2L", "IN2L PGA" }, \ |
| 642 | { name, "IN2R", "IN2R PGA" }, \ |
| 643 | { name, "AIF1RX1", "AIF1RX1" }, \ |
| 644 | { name, "AIF1RX2", "AIF1RX2" }, \ |
| 645 | { name, "AIF1RX3", "AIF1RX3" }, \ |
| 646 | { name, "AIF1RX4", "AIF1RX4" }, \ |
| 647 | { name, "AIF1RX5", "AIF1RX5" }, \ |
| 648 | { name, "AIF1RX6", "AIF1RX6" }, \ |
| 649 | { name, "AIF1RX7", "AIF1RX7" }, \ |
| 650 | { name, "AIF1RX8", "AIF1RX8" }, \ |
| 651 | { name, "AIF2RX1", "AIF2RX1" }, \ |
| 652 | { name, "AIF2RX2", "AIF2RX2" }, \ |
| 653 | { name, "AIF2RX3", "AIF2RX3" }, \ |
| 654 | { name, "AIF2RX4", "AIF2RX4" }, \ |
| 655 | { name, "AIF2RX5", "AIF2RX5" }, \ |
| 656 | { name, "AIF2RX6", "AIF2RX6" }, \ |
| 657 | { name, "AIF3RX1", "AIF3RX1" }, \ |
| 658 | { name, "AIF3RX2", "AIF3RX2" }, \ |
| 659 | { name, "EQ1", "EQ1" }, \ |
| 660 | { name, "EQ2", "EQ2" }, \ |
| 661 | { name, "DRC1L", "DRC1L" }, \ |
| 662 | { name, "DRC1R", "DRC1R" }, \ |
| 663 | { name, "DRC2L", "DRC2L" }, \ |
| 664 | { name, "DRC2R", "DRC2R" }, \ |
| 665 | { name, "LHPF1", "LHPF1" }, \ |
| 666 | { name, "LHPF2", "LHPF2" }, \ |
| 667 | { name, "LHPF3", "LHPF3" }, \ |
| 668 | { name, "LHPF4", "LHPF4" }, \ |
| 669 | { name, "ASRC1L", "ASRC1L" }, \ |
| 670 | { name, "ASRC1R", "ASRC1R" }, \ |
| 671 | { name, "ASRC2L", "ASRC2L" }, \ |
| 672 | { name, "ASRC2R", "ASRC2R" }, \ |
| 673 | { name, "ISRC1DEC1", "ISRC1DEC1" }, \ |
| 674 | { name, "ISRC1DEC2", "ISRC1DEC2" }, \ |
| 675 | { name, "ISRC1DEC3", "ISRC1DEC3" }, \ |
| 676 | { name, "ISRC1DEC4", "ISRC1DEC4" }, \ |
| 677 | { name, "ISRC1INT1", "ISRC1INT1" }, \ |
| 678 | { name, "ISRC1INT2", "ISRC1INT2" }, \ |
| 679 | { name, "ISRC1INT3", "ISRC1INT3" }, \ |
| 680 | { name, "ISRC1INT4", "ISRC1INT4" }, \ |
| 681 | { name, "ISRC2DEC1", "ISRC2DEC1" }, \ |
| 682 | { name, "ISRC2DEC2", "ISRC2DEC2" }, \ |
| 683 | { name, "ISRC2DEC3", "ISRC2DEC3" }, \ |
| 684 | { name, "ISRC2DEC4", "ISRC2DEC4" }, \ |
| 685 | { name, "ISRC2INT1", "ISRC2INT1" }, \ |
| 686 | { name, "ISRC2INT2", "ISRC2INT2" }, \ |
| 687 | { name, "ISRC2INT3", "ISRC2INT3" }, \ |
| 688 | { name, "ISRC2INT4", "ISRC2INT4" }, \ |
| 689 | { name, "ISRC3DEC1", "ISRC3DEC1" }, \ |
| 690 | { name, "ISRC3DEC2", "ISRC3DEC2" }, \ |
| 691 | { name, "ISRC3DEC3", "ISRC3DEC3" }, \ |
| 692 | { name, "ISRC3DEC4", "ISRC3DEC4" }, \ |
| 693 | { name, "ISRC3INT1", "ISRC3INT1" }, \ |
| 694 | { name, "ISRC3INT2", "ISRC3INT2" }, \ |
| 695 | { name, "ISRC3INT3", "ISRC3INT3" }, \ |
| 696 | { name, "ISRC3INT4", "ISRC3INT4" }, \ |
| 697 | { name, "DSP2.1", "DSP2" }, \ |
| 698 | { name, "DSP2.2", "DSP2" }, \ |
| 699 | { name, "DSP2.3", "DSP2" }, \ |
| 700 | { name, "DSP2.4", "DSP2" }, \ |
| 701 | { name, "DSP2.5", "DSP2" }, \ |
| 702 | { name, "DSP2.6", "DSP2" }, \ |
| 703 | { name, "DSP3.1", "DSP3" }, \ |
| 704 | { name, "DSP3.2", "DSP3" }, \ |
| 705 | { name, "DSP3.3", "DSP3" }, \ |
| 706 | { name, "DSP3.4", "DSP3" }, \ |
| 707 | { name, "DSP3.5", "DSP3" }, \ |
| 708 | { name, "DSP3.6", "DSP3" } |
| 709 | |
| 710 | static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { |
| 711 | { "OUT1L", NULL, "CPVDD" }, |
| 712 | { "OUT1R", NULL, "CPVDD" }, |
| 713 | |
| 714 | { "OUT4L", NULL, "SPKVDD" }, |
| 715 | |
| 716 | { "OUT1L", NULL, "SYSCLK" }, |
| 717 | { "OUT1R", NULL, "SYSCLK" }, |
| 718 | { "OUT4L", NULL, "SYSCLK" }, |
| 719 | |
| 720 | { "IN1L", NULL, "SYSCLK" }, |
| 721 | { "IN1R", NULL, "SYSCLK" }, |
| 722 | { "IN2L", NULL, "SYSCLK" }, |
| 723 | { "IN2R", NULL, "SYSCLK" }, |
| 724 | |
| 725 | { "MICBIAS1", NULL, "MICVDD" }, |
| 726 | { "MICBIAS2", NULL, "MICVDD" }, |
| 727 | |
| 728 | { "Noise Generator", NULL, "SYSCLK" }, |
| 729 | { "Tone Generator 1", NULL, "SYSCLK" }, |
| 730 | { "Tone Generator 2", NULL, "SYSCLK" }, |
| 731 | |
| 732 | { "Noise Generator", NULL, "NOISE" }, |
| 733 | { "Tone Generator 1", NULL, "TONE" }, |
| 734 | { "Tone Generator 2", NULL, "TONE" }, |
| 735 | |
| 736 | { "AIF1 Capture", NULL, "AIF1TX1" }, |
| 737 | { "AIF1 Capture", NULL, "AIF1TX2" }, |
| 738 | { "AIF1 Capture", NULL, "AIF1TX3" }, |
| 739 | { "AIF1 Capture", NULL, "AIF1TX4" }, |
| 740 | { "AIF1 Capture", NULL, "AIF1TX5" }, |
| 741 | { "AIF1 Capture", NULL, "AIF1TX6" }, |
| 742 | { "AIF1 Capture", NULL, "AIF1TX7" }, |
| 743 | { "AIF1 Capture", NULL, "AIF1TX8" }, |
| 744 | |
| 745 | { "AIF1RX1", NULL, "AIF1 Playback" }, |
| 746 | { "AIF1RX2", NULL, "AIF1 Playback" }, |
| 747 | { "AIF1RX3", NULL, "AIF1 Playback" }, |
| 748 | { "AIF1RX4", NULL, "AIF1 Playback" }, |
| 749 | { "AIF1RX5", NULL, "AIF1 Playback" }, |
| 750 | { "AIF1RX6", NULL, "AIF1 Playback" }, |
| 751 | { "AIF1RX7", NULL, "AIF1 Playback" }, |
| 752 | { "AIF1RX8", NULL, "AIF1 Playback" }, |
| 753 | |
| 754 | { "AIF2 Capture", NULL, "AIF2TX1" }, |
| 755 | { "AIF2 Capture", NULL, "AIF2TX2" }, |
| 756 | { "AIF2 Capture", NULL, "AIF2TX3" }, |
| 757 | { "AIF2 Capture", NULL, "AIF2TX4" }, |
| 758 | { "AIF2 Capture", NULL, "AIF2TX5" }, |
| 759 | { "AIF2 Capture", NULL, "AIF2TX6" }, |
| 760 | |
| 761 | { "AIF2RX1", NULL, "AIF2 Playback" }, |
| 762 | { "AIF2RX2", NULL, "AIF2 Playback" }, |
| 763 | { "AIF2RX3", NULL, "AIF2 Playback" }, |
| 764 | { "AIF2RX4", NULL, "AIF2 Playback" }, |
| 765 | { "AIF2RX5", NULL, "AIF2 Playback" }, |
| 766 | { "AIF2RX6", NULL, "AIF2 Playback" }, |
| 767 | |
| 768 | { "AIF3 Capture", NULL, "AIF3TX1" }, |
| 769 | { "AIF3 Capture", NULL, "AIF3TX2" }, |
| 770 | |
| 771 | { "AIF3RX1", NULL, "AIF3 Playback" }, |
| 772 | { "AIF3RX2", NULL, "AIF3 Playback" }, |
| 773 | |
| 774 | { "AIF1 Playback", NULL, "SYSCLK" }, |
| 775 | { "AIF2 Playback", NULL, "SYSCLK" }, |
| 776 | { "AIF3 Playback", NULL, "SYSCLK" }, |
| 777 | |
| 778 | { "AIF1 Capture", NULL, "SYSCLK" }, |
| 779 | { "AIF2 Capture", NULL, "SYSCLK" }, |
| 780 | { "AIF3 Capture", NULL, "SYSCLK" }, |
| 781 | |
| 782 | { "IN1L PGA", NULL, "IN1L" }, |
| 783 | { "IN1R PGA", NULL, "IN1R" }, |
| 784 | |
| 785 | { "IN2L PGA", NULL, "IN2L" }, |
| 786 | { "IN2R PGA", NULL, "IN2R" }, |
| 787 | |
| 788 | ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), |
| 789 | ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), |
| 790 | |
| 791 | ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"), |
| 792 | |
| 793 | ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"), |
| 794 | ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"), |
| 795 | |
| 796 | ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"), |
| 797 | ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"), |
| 798 | ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"), |
| 799 | ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"), |
| 800 | ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"), |
| 801 | ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"), |
| 802 | ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"), |
| 803 | ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"), |
| 804 | |
| 805 | ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"), |
| 806 | ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"), |
| 807 | ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"), |
| 808 | ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"), |
| 809 | ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"), |
| 810 | ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"), |
| 811 | |
| 812 | ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"), |
| 813 | ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"), |
| 814 | |
| 815 | ARIZONA_MIXER_ROUTES("EQ1", "EQ1"), |
| 816 | ARIZONA_MIXER_ROUTES("EQ2", "EQ2"), |
| 817 | |
| 818 | ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"), |
| 819 | ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"), |
| 820 | ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"), |
| 821 | ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"), |
| 822 | |
| 823 | ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"), |
| 824 | ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"), |
| 825 | ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), |
| 826 | ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), |
| 827 | |
| 828 | ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"), |
| 829 | ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"), |
| 830 | ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"), |
| 831 | ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"), |
| 832 | |
| 833 | ARIZONA_DSP_ROUTES("DSP2"), |
| 834 | ARIZONA_DSP_ROUTES("DSP3"), |
| 835 | |
| 836 | ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"), |
| 837 | ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"), |
| 838 | ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"), |
| 839 | ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"), |
| 840 | |
| 841 | ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"), |
| 842 | ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"), |
| 843 | ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"), |
| 844 | ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"), |
| 845 | |
| 846 | ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"), |
| 847 | ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"), |
| 848 | ARIZONA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"), |
| 849 | ARIZONA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"), |
| 850 | |
| 851 | ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"), |
| 852 | ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"), |
| 853 | ARIZONA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"), |
| 854 | ARIZONA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"), |
| 855 | |
| 856 | ARIZONA_MUX_ROUTES("ISRC3INT1", "ISRC3INT1"), |
| 857 | ARIZONA_MUX_ROUTES("ISRC3INT2", "ISRC3INT2"), |
| 858 | ARIZONA_MUX_ROUTES("ISRC3INT3", "ISRC3INT3"), |
| 859 | ARIZONA_MUX_ROUTES("ISRC3INT4", "ISRC3INT4"), |
| 860 | |
| 861 | ARIZONA_MUX_ROUTES("ISRC3DEC1", "ISRC3DEC1"), |
| 862 | ARIZONA_MUX_ROUTES("ISRC3DEC2", "ISRC3DEC2"), |
| 863 | ARIZONA_MUX_ROUTES("ISRC3DEC3", "ISRC3DEC3"), |
| 864 | ARIZONA_MUX_ROUTES("ISRC3DEC4", "ISRC3DEC4"), |
| 865 | |
| 866 | { "AEC Loopback", "HPOUT1L", "OUT1L" }, |
| 867 | { "AEC Loopback", "HPOUT1R", "OUT1R" }, |
| 868 | { "HPOUT1L", NULL, "OUT1L" }, |
| 869 | { "HPOUT1R", NULL, "OUT1R" }, |
| 870 | |
| 871 | { "AEC Loopback", "SPKOUT", "OUT4L" }, |
| 872 | { "SPKOUTN", NULL, "OUT4L" }, |
| 873 | { "SPKOUTP", NULL, "OUT4L" }, |
| 874 | |
| 875 | { "MICSUPP", NULL, "SYSCLK" }, |
| 876 | |
| 877 | { "DRC1 Signal Activity", NULL, "DRC1L" }, |
| 878 | { "DRC1 Signal Activity", NULL, "DRC1R" }, |
| 879 | { "DRC2 Signal Activity", NULL, "DRC2L" }, |
| 880 | { "DRC2 Signal Activity", NULL, "DRC2R" }, |
| 881 | }; |
| 882 | |
| 883 | static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source, |
| 884 | unsigned int Fref, unsigned int Fout) |
| 885 | { |
| 886 | struct cs47l24_priv *cs47l24 = snd_soc_codec_get_drvdata(codec); |
| 887 | |
| 888 | switch (fll_id) { |
| 889 | case CS47L24_FLL1: |
| 890 | return arizona_set_fll(&cs47l24->fll[0], source, Fref, Fout); |
| 891 | case CS47L24_FLL2: |
| 892 | return arizona_set_fll(&cs47l24->fll[1], source, Fref, Fout); |
| 893 | case CS47L24_FLL1_REFCLK: |
| 894 | return arizona_set_fll_refclk(&cs47l24->fll[0], source, Fref, |
| 895 | Fout); |
| 896 | case CS47L24_FLL2_REFCLK: |
| 897 | return arizona_set_fll_refclk(&cs47l24->fll[1], source, Fref, |
| 898 | Fout); |
| 899 | default: |
| 900 | return -EINVAL; |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | #define CS47L24_RATES SNDRV_PCM_RATE_8000_192000 |
| 905 | |
| 906 | #define CS47L24_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
| 907 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
| 908 | |
| 909 | static struct snd_soc_dai_driver cs47l24_dai[] = { |
| 910 | { |
| 911 | .name = "cs47l24-aif1", |
| 912 | .id = 1, |
| 913 | .base = ARIZONA_AIF1_BCLK_CTRL, |
| 914 | .playback = { |
| 915 | .stream_name = "AIF1 Playback", |
| 916 | .channels_min = 1, |
| 917 | .channels_max = 8, |
| 918 | .rates = CS47L24_RATES, |
| 919 | .formats = CS47L24_FORMATS, |
| 920 | }, |
| 921 | .capture = { |
| 922 | .stream_name = "AIF1 Capture", |
| 923 | .channels_min = 1, |
| 924 | .channels_max = 8, |
| 925 | .rates = CS47L24_RATES, |
| 926 | .formats = CS47L24_FORMATS, |
| 927 | }, |
| 928 | .ops = &arizona_dai_ops, |
| 929 | .symmetric_rates = 1, |
| 930 | .symmetric_samplebits = 1, |
| 931 | }, |
| 932 | { |
| 933 | .name = "cs47l24-aif2", |
| 934 | .id = 2, |
| 935 | .base = ARIZONA_AIF2_BCLK_CTRL, |
| 936 | .playback = { |
| 937 | .stream_name = "AIF2 Playback", |
| 938 | .channels_min = 1, |
| 939 | .channels_max = 6, |
| 940 | .rates = CS47L24_RATES, |
| 941 | .formats = CS47L24_FORMATS, |
| 942 | }, |
| 943 | .capture = { |
| 944 | .stream_name = "AIF2 Capture", |
| 945 | .channels_min = 1, |
| 946 | .channels_max = 6, |
| 947 | .rates = CS47L24_RATES, |
| 948 | .formats = CS47L24_FORMATS, |
| 949 | }, |
| 950 | .ops = &arizona_dai_ops, |
| 951 | .symmetric_rates = 1, |
| 952 | .symmetric_samplebits = 1, |
| 953 | }, |
| 954 | { |
| 955 | .name = "cs47l24-aif3", |
| 956 | .id = 3, |
| 957 | .base = ARIZONA_AIF3_BCLK_CTRL, |
| 958 | .playback = { |
| 959 | .stream_name = "AIF3 Playback", |
| 960 | .channels_min = 1, |
| 961 | .channels_max = 2, |
| 962 | .rates = CS47L24_RATES, |
| 963 | .formats = CS47L24_FORMATS, |
| 964 | }, |
| 965 | .capture = { |
| 966 | .stream_name = "AIF3 Capture", |
| 967 | .channels_min = 1, |
| 968 | .channels_max = 2, |
| 969 | .rates = CS47L24_RATES, |
| 970 | .formats = CS47L24_FORMATS, |
| 971 | }, |
| 972 | .ops = &arizona_dai_ops, |
| 973 | .symmetric_rates = 1, |
| 974 | .symmetric_samplebits = 1, |
| 975 | }, |
| 976 | }; |
| 977 | |
| 978 | static int cs47l24_codec_probe(struct snd_soc_codec *codec) |
| 979 | { |
| 980 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
| 981 | struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 982 | int ret; |
| 983 | |
| 984 | priv->core.arizona->dapm = dapm; |
| 985 | |
| 986 | arizona_init_spk(codec); |
| 987 | arizona_init_gpio(codec); |
| 988 | arizona_init_mono(codec); |
| 989 | |
| 990 | ret = wm_adsp2_codec_probe(&priv->core.adsp[1], codec); |
| 991 | if (ret) |
| 992 | goto err_adsp2_codec_probe; |
| 993 | |
| 994 | ret = wm_adsp2_codec_probe(&priv->core.adsp[2], codec); |
| 995 | if (ret) |
| 996 | goto err_adsp2_codec_probe; |
| 997 | |
| 998 | ret = snd_soc_add_codec_controls(codec, |
| 999 | &arizona_adsp2_rate_controls[1], 2); |
| 1000 | if (ret) |
| 1001 | goto err_adsp2_codec_probe; |
| 1002 | |
| 1003 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 1004 | |
| 1005 | return 0; |
| 1006 | |
| 1007 | err_adsp2_codec_probe: |
| 1008 | wm_adsp2_codec_remove(&priv->core.adsp[1], codec); |
| 1009 | wm_adsp2_codec_remove(&priv->core.adsp[2], codec); |
| 1010 | |
| 1011 | return ret; |
| 1012 | } |
| 1013 | |
| 1014 | static int cs47l24_codec_remove(struct snd_soc_codec *codec) |
| 1015 | { |
| 1016 | struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 1017 | |
| 1018 | |
| 1019 | wm_adsp2_codec_remove(&priv->core.adsp[1], codec); |
| 1020 | wm_adsp2_codec_remove(&priv->core.adsp[2], codec); |
| 1021 | |
| 1022 | priv->core.arizona->dapm = NULL; |
| 1023 | |
| 1024 | return 0; |
| 1025 | } |
| 1026 | |
| 1027 | #define CS47L24_DIG_VU 0x0200 |
| 1028 | |
| 1029 | static unsigned int cs47l24_digital_vu[] = { |
| 1030 | ARIZONA_DAC_DIGITAL_VOLUME_1L, |
| 1031 | ARIZONA_DAC_DIGITAL_VOLUME_1R, |
| 1032 | ARIZONA_DAC_DIGITAL_VOLUME_4L, |
| 1033 | }; |
| 1034 | |
| 1035 | static struct regmap *cs47l24_get_regmap(struct device *dev) |
| 1036 | { |
| 1037 | struct cs47l24_priv *priv = dev_get_drvdata(dev); |
| 1038 | |
| 1039 | return priv->core.arizona->regmap; |
| 1040 | } |
| 1041 | |
| 1042 | static struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { |
| 1043 | .probe = cs47l24_codec_probe, |
| 1044 | .remove = cs47l24_codec_remove, |
| 1045 | .get_regmap = cs47l24_get_regmap, |
| 1046 | |
| 1047 | .idle_bias_off = true, |
| 1048 | |
| 1049 | .set_sysclk = arizona_set_sysclk, |
| 1050 | .set_pll = cs47l24_set_fll, |
| 1051 | |
| 1052 | .controls = cs47l24_snd_controls, |
| 1053 | .num_controls = ARRAY_SIZE(cs47l24_snd_controls), |
| 1054 | .dapm_widgets = cs47l24_dapm_widgets, |
| 1055 | .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets), |
| 1056 | .dapm_routes = cs47l24_dapm_routes, |
| 1057 | .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes), |
| 1058 | }; |
| 1059 | |
| 1060 | static int cs47l24_probe(struct platform_device *pdev) |
| 1061 | { |
| 1062 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
| 1063 | struct cs47l24_priv *cs47l24; |
| 1064 | int i, ret; |
| 1065 | |
| 1066 | BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI); |
| 1067 | |
| 1068 | cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv), |
| 1069 | GFP_KERNEL); |
| 1070 | if (!cs47l24) |
| 1071 | return -ENOMEM; |
| 1072 | |
| 1073 | platform_set_drvdata(pdev, cs47l24); |
| 1074 | |
| 1075 | cs47l24->core.arizona = arizona; |
| 1076 | cs47l24->core.num_inputs = 4; |
| 1077 | |
| 1078 | for (i = 1; i <= 2; i++) { |
| 1079 | cs47l24->core.adsp[i].part = "cs47l24"; |
| 1080 | cs47l24->core.adsp[i].num = i + 1; |
| 1081 | cs47l24->core.adsp[i].type = WMFW_ADSP2; |
| 1082 | cs47l24->core.adsp[i].dev = arizona->dev; |
| 1083 | cs47l24->core.adsp[i].regmap = arizona->regmap; |
| 1084 | |
| 1085 | cs47l24->core.adsp[i].base = ARIZONA_DSP1_CONTROL_1 + |
| 1086 | (0x100 * i); |
| 1087 | cs47l24->core.adsp[i].mem = cs47l24_dsp_regions[i - 1]; |
| 1088 | cs47l24->core.adsp[i].num_mems = |
| 1089 | ARRAY_SIZE(cs47l24_dsp2_regions); |
| 1090 | |
| 1091 | ret = wm_adsp2_init(&cs47l24->core.adsp[i]); |
| 1092 | if (ret != 0) |
| 1093 | return ret; |
| 1094 | } |
| 1095 | |
| 1096 | for (i = 0; i < ARRAY_SIZE(cs47l24->fll); i++) |
| 1097 | cs47l24->fll[i].vco_mult = 3; |
| 1098 | |
| 1099 | arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1, |
| 1100 | ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK, |
| 1101 | &cs47l24->fll[0]); |
| 1102 | arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1, |
| 1103 | ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK, |
| 1104 | &cs47l24->fll[1]); |
| 1105 | |
| 1106 | /* SR2 fixed at 8kHz, SR3 fixed at 16kHz */ |
| 1107 | regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2, |
| 1108 | ARIZONA_SAMPLE_RATE_2_MASK, 0x11); |
| 1109 | regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3, |
| 1110 | ARIZONA_SAMPLE_RATE_3_MASK, 0x12); |
| 1111 | |
| 1112 | for (i = 0; i < ARRAY_SIZE(cs47l24_dai); i++) |
| 1113 | arizona_init_dai(&cs47l24->core, i); |
| 1114 | |
| 1115 | /* Latch volume update bits */ |
| 1116 | for (i = 0; i < ARRAY_SIZE(cs47l24_digital_vu); i++) |
| 1117 | regmap_update_bits(arizona->regmap, cs47l24_digital_vu[i], |
| 1118 | CS47L24_DIG_VU, CS47L24_DIG_VU); |
| 1119 | |
| 1120 | pm_runtime_enable(&pdev->dev); |
| 1121 | pm_runtime_idle(&pdev->dev); |
| 1122 | |
| 1123 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24, |
| 1124 | cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); |
| 1125 | } |
| 1126 | |
| 1127 | static int cs47l24_remove(struct platform_device *pdev) |
| 1128 | { |
| 1129 | snd_soc_unregister_codec(&pdev->dev); |
| 1130 | pm_runtime_disable(&pdev->dev); |
| 1131 | |
| 1132 | return 0; |
| 1133 | } |
| 1134 | |
| 1135 | static struct platform_driver cs47l24_codec_driver = { |
| 1136 | .driver = { |
| 1137 | .name = "cs47l24-codec", |
| 1138 | }, |
| 1139 | .probe = cs47l24_probe, |
| 1140 | .remove = cs47l24_remove, |
| 1141 | }; |
| 1142 | |
| 1143 | module_platform_driver(cs47l24_codec_driver); |
| 1144 | |
| 1145 | MODULE_DESCRIPTION("ASoC CS47L24 driver"); |
| 1146 | MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.wolfsonmicro.com>"); |
| 1147 | MODULE_LICENSE("GPL v2"); |
| 1148 | MODULE_ALIAS("platform:cs47l24-codec"); |