Mark Brown | 93e8791 | 2012-06-19 16:38:15 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * wm5102.c -- WM5102 ALSA SoC Audio driver |
| 3 | * |
| 4 | * Copyright 2012 Wolfson Microelectronics plc |
| 5 | * |
| 6 | * Author: Mark Brown <broonie@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 | #include <sound/wm5102.h> |
| 29 | |
| 30 | #include <linux/mfd/arizona/core.h> |
| 31 | #include <linux/mfd/arizona/registers.h> |
| 32 | |
| 33 | #include "arizona.h" |
| 34 | #include "wm5102.h" |
| 35 | |
| 36 | struct wm5102_priv { |
| 37 | struct arizona_priv core; |
| 38 | struct arizona_fll fll[2]; |
| 39 | }; |
| 40 | |
| 41 | static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); |
| 42 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
| 43 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
| 44 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
| 45 | |
| 46 | static const struct snd_kcontrol_new wm5102_snd_controls[] = { |
| 47 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, |
| 48 | ARIZONA_IN1_OSR_SHIFT, 1, 0), |
| 49 | SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL, |
| 50 | ARIZONA_IN2_OSR_SHIFT, 1, 0), |
| 51 | SOC_SINGLE("IN3 High Performance Switch", ARIZONA_IN3L_CONTROL, |
| 52 | ARIZONA_IN3_OSR_SHIFT, 1, 0), |
| 53 | |
| 54 | SOC_DOUBLE_R_RANGE_TLV("IN1 Volume", ARIZONA_IN1L_CONTROL, |
| 55 | ARIZONA_IN1R_CONTROL, |
| 56 | ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
| 57 | SOC_DOUBLE_R_RANGE_TLV("IN2 Volume", ARIZONA_IN2L_CONTROL, |
| 58 | ARIZONA_IN2R_CONTROL, |
| 59 | ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
| 60 | SOC_DOUBLE_R_RANGE_TLV("IN3 Volume", ARIZONA_IN3L_CONTROL, |
| 61 | ARIZONA_IN3R_CONTROL, |
| 62 | ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
| 63 | |
| 64 | SOC_DOUBLE_R("IN1 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L, |
| 65 | ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_MUTE_SHIFT, 1, 1), |
| 66 | SOC_DOUBLE_R("IN2 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L, |
| 67 | ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_MUTE_SHIFT, 1, 1), |
| 68 | SOC_DOUBLE_R("IN3 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L, |
| 69 | ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_MUTE_SHIFT, 1, 1), |
| 70 | |
| 71 | SOC_DOUBLE_R_TLV("IN1 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L, |
| 72 | ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_PGA_VOL_SHIFT, |
| 73 | 0xbf, 0, digital_tlv), |
| 74 | SOC_DOUBLE_R_TLV("IN2 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L, |
| 75 | ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_PGA_VOL_SHIFT, |
| 76 | 0xbf, 0, digital_tlv), |
| 77 | SOC_DOUBLE_R_TLV("IN3 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L, |
| 78 | ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_PGA_VOL_SHIFT, |
| 79 | 0xbf, 0, digital_tlv), |
| 80 | |
| 81 | ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE), |
| 82 | ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), |
| 83 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), |
| 84 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), |
| 85 | |
| 86 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, |
| 87 | 24, 0, eq_tlv), |
| 88 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, |
| 89 | 24, 0, eq_tlv), |
| 90 | SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT, |
| 91 | 24, 0, eq_tlv), |
| 92 | SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT, |
| 93 | 24, 0, eq_tlv), |
| 94 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, |
| 95 | 24, 0, eq_tlv), |
| 96 | |
| 97 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, |
| 98 | 24, 0, eq_tlv), |
| 99 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, |
| 100 | 24, 0, eq_tlv), |
| 101 | SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT, |
| 102 | 24, 0, eq_tlv), |
| 103 | SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT, |
| 104 | 24, 0, eq_tlv), |
| 105 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, |
| 106 | 24, 0, eq_tlv), |
| 107 | |
| 108 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, |
| 109 | 24, 0, eq_tlv), |
| 110 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, |
| 111 | 24, 0, eq_tlv), |
| 112 | SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT, |
| 113 | 24, 0, eq_tlv), |
| 114 | SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT, |
| 115 | 24, 0, eq_tlv), |
| 116 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, |
| 117 | 24, 0, eq_tlv), |
| 118 | |
| 119 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, |
| 120 | 24, 0, eq_tlv), |
| 121 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, |
| 122 | 24, 0, eq_tlv), |
| 123 | SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT, |
| 124 | 24, 0, eq_tlv), |
| 125 | SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT, |
| 126 | 24, 0, eq_tlv), |
| 127 | SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT, |
| 128 | 24, 0, eq_tlv), |
| 129 | |
| 130 | ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE), |
| 131 | ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE), |
| 132 | ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE), |
| 133 | ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE), |
| 134 | |
| 135 | SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5, |
| 136 | ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA), |
| 137 | SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5, |
| 138 | ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA), |
| 139 | |
| 140 | ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE), |
| 141 | ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE), |
| 142 | ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE), |
| 143 | ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE), |
| 144 | |
| 145 | SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode), |
| 146 | SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode), |
| 147 | SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode), |
| 148 | SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode), |
| 149 | |
| 150 | ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE), |
| 151 | ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE), |
| 152 | |
| 153 | SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR, |
| 154 | ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv), |
| 155 | |
| 156 | ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE), |
| 157 | ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE), |
| 158 | ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE), |
| 159 | ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE), |
| 160 | ARIZONA_MIXER_CONTROLS("EPOUT", ARIZONA_OUT3LMIX_INPUT_1_SOURCE), |
| 161 | ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE), |
| 162 | ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE), |
| 163 | ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE), |
| 164 | ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE), |
| 165 | |
| 166 | SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L, |
| 167 | ARIZONA_OUT1_OSR_SHIFT, 1, 0), |
| 168 | SOC_SINGLE("OUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L, |
| 169 | ARIZONA_OUT2_OSR_SHIFT, 1, 0), |
| 170 | SOC_SINGLE("EPOUT High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L, |
| 171 | ARIZONA_OUT3_OSR_SHIFT, 1, 0), |
| 172 | SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L, |
| 173 | ARIZONA_OUT4_OSR_SHIFT, 1, 0), |
| 174 | SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L, |
| 175 | ARIZONA_OUT5_OSR_SHIFT, 1, 0), |
| 176 | |
| 177 | SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, |
| 178 | ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), |
| 179 | SOC_DOUBLE_R("OUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L, |
| 180 | ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1), |
| 181 | SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L, |
| 182 | ARIZONA_OUT3L_MUTE_SHIFT, 1, 1), |
| 183 | SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, |
| 184 | ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), |
| 185 | SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L, |
| 186 | ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1), |
| 187 | |
| 188 | SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, |
| 189 | ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, |
| 190 | 0xbf, 0, digital_tlv), |
| 191 | SOC_DOUBLE_R_TLV("OUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L, |
| 192 | ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT, |
| 193 | 0xbf, 0, digital_tlv), |
| 194 | SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L, |
| 195 | ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv), |
| 196 | SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, |
| 197 | ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT, |
| 198 | 0xbf, 0, digital_tlv), |
| 199 | SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L, |
| 200 | ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT, |
| 201 | 0xbf, 0, digital_tlv), |
| 202 | |
| 203 | SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L, |
| 204 | ARIZONA_OUTPUT_PATH_CONFIG_1R, |
| 205 | ARIZONA_OUT1L_PGA_VOL_SHIFT, |
| 206 | 0x34, 0x40, 0, ana_tlv), |
| 207 | SOC_DOUBLE_R_RANGE_TLV("OUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L, |
| 208 | ARIZONA_OUTPUT_PATH_CONFIG_2R, |
| 209 | ARIZONA_OUT2L_PGA_VOL_SHIFT, |
| 210 | 0x34, 0x40, 0, ana_tlv), |
| 211 | SOC_SINGLE_RANGE_TLV("EPOUT Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L, |
| 212 | ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv), |
| 213 | |
| 214 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, |
| 215 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), |
| 216 | |
| 217 | ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), |
| 218 | ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), |
| 219 | ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), |
| 220 | ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE), |
| 221 | ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE), |
| 222 | ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE), |
| 223 | ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE), |
| 224 | ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE), |
| 225 | |
| 226 | ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE), |
| 227 | ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE), |
| 228 | |
| 229 | ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE), |
| 230 | ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), |
| 231 | }; |
| 232 | |
| 233 | ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); |
| 234 | ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); |
| 235 | ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); |
| 236 | ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE); |
| 237 | |
| 238 | ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE); |
| 239 | ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE); |
| 240 | ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE); |
| 241 | ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE); |
| 242 | |
| 243 | ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE); |
| 244 | ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE); |
| 245 | ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE); |
| 246 | ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE); |
| 247 | |
| 248 | ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE); |
| 249 | ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE); |
| 250 | |
| 251 | ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE); |
| 252 | ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE); |
| 253 | |
| 254 | ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE); |
| 255 | ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE); |
| 256 | ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE); |
| 257 | ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE); |
| 258 | ARIZONA_MIXER_ENUMS(OUT3, ARIZONA_OUT3LMIX_INPUT_1_SOURCE); |
| 259 | ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE); |
| 260 | ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE); |
| 261 | ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE); |
| 262 | ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE); |
| 263 | |
| 264 | ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE); |
| 265 | ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE); |
| 266 | ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE); |
| 267 | ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE); |
| 268 | ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE); |
| 269 | ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE); |
| 270 | ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE); |
| 271 | ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE); |
| 272 | |
| 273 | ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE); |
| 274 | ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE); |
| 275 | |
| 276 | ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); |
| 277 | ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); |
| 278 | |
| 279 | static const struct snd_soc_dapm_widget wm5102_dapm_widgets[] = { |
| 280 | SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT, |
| 281 | 0, NULL, 0), |
| 282 | SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, |
| 283 | ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), |
| 284 | |
| 285 | SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0), |
| 286 | SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0), |
| 287 | SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20), |
| 288 | SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0), |
| 289 | SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0), |
| 290 | SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0), |
| 291 | |
| 292 | SND_SOC_DAPM_SIGGEN("TONE"), |
| 293 | SND_SOC_DAPM_SIGGEN("NOISE"), |
| 294 | |
| 295 | SND_SOC_DAPM_INPUT("IN1L"), |
| 296 | SND_SOC_DAPM_INPUT("IN1R"), |
| 297 | SND_SOC_DAPM_INPUT("IN2L"), |
| 298 | SND_SOC_DAPM_INPUT("IN2R"), |
| 299 | SND_SOC_DAPM_INPUT("IN3L"), |
| 300 | SND_SOC_DAPM_INPUT("IN3R"), |
| 301 | |
| 302 | SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT, |
| 303 | 0, NULL, 0, arizona_in_ev, |
| 304 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 305 | SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT, |
| 306 | 0, NULL, 0, arizona_in_ev, |
| 307 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 308 | SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT, |
| 309 | 0, NULL, 0, arizona_in_ev, |
| 310 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 311 | SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT, |
| 312 | 0, NULL, 0, arizona_in_ev, |
| 313 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 314 | SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT, |
| 315 | 0, NULL, 0, arizona_in_ev, |
| 316 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 317 | SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT, |
| 318 | 0, NULL, 0, arizona_in_ev, |
| 319 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 320 | |
| 321 | SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1, |
| 322 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), |
| 323 | SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2, |
| 324 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), |
| 325 | SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3, |
| 326 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), |
| 327 | |
| 328 | SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR, |
| 329 | ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0), |
| 330 | |
| 331 | SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1, |
| 332 | ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0), |
| 333 | SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1, |
| 334 | ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0), |
| 335 | |
| 336 | SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1, |
| 337 | ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0), |
| 338 | |
| 339 | SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0), |
| 340 | SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0), |
| 341 | SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0), |
| 342 | SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0), |
| 343 | |
| 344 | SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0, |
| 345 | NULL, 0), |
| 346 | SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0, |
| 347 | NULL, 0), |
| 348 | SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0, |
| 349 | NULL, 0), |
| 350 | SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0, |
| 351 | NULL, 0), |
| 352 | |
| 353 | SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0, |
| 354 | NULL, 0), |
| 355 | SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0, |
| 356 | NULL, 0), |
| 357 | SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0, |
| 358 | NULL, 0), |
| 359 | SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0, |
| 360 | NULL, 0), |
| 361 | |
| 362 | SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT, |
| 363 | 0, NULL, 0), |
| 364 | SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT, |
| 365 | 0, NULL, 0), |
| 366 | |
| 367 | SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, |
| 368 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), |
| 369 | SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0, |
| 370 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0), |
| 371 | SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0, |
| 372 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0), |
| 373 | SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0, |
| 374 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0), |
| 375 | SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0, |
| 376 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0), |
| 377 | SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0, |
| 378 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0), |
| 379 | SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0, |
| 380 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0), |
| 381 | SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0, |
| 382 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0), |
| 383 | |
| 384 | SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0, |
| 385 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0), |
| 386 | SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0, |
| 387 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0), |
| 388 | SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0, |
| 389 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0), |
| 390 | SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0, |
| 391 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0), |
| 392 | SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0, |
| 393 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0), |
| 394 | SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0, |
| 395 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0), |
| 396 | SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0, |
| 397 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0), |
| 398 | SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0, |
| 399 | ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0), |
| 400 | |
| 401 | SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0, |
| 402 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0), |
| 403 | SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0, |
| 404 | ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0), |
| 405 | |
| 406 | SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0, |
| 407 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0), |
| 408 | SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0, |
| 409 | ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0), |
| 410 | |
| 411 | SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0, |
| 412 | ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0), |
| 413 | SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0, |
| 414 | ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0), |
| 415 | |
| 416 | SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0, |
| 417 | ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0), |
| 418 | SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0, |
| 419 | ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0), |
| 420 | |
| 421 | SND_SOC_DAPM_PGA_E("OUT1L", ARIZONA_OUTPUT_ENABLES_1, |
| 422 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 423 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 424 | SND_SOC_DAPM_PGA_E("OUT1R", ARIZONA_OUTPUT_ENABLES_1, |
| 425 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 426 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 427 | SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1, |
| 428 | ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 429 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 430 | SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1, |
| 431 | ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 432 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 433 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, |
| 434 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 435 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 436 | SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, |
| 437 | ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 438 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 439 | SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, |
| 440 | ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 441 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 442 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, |
| 443 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 444 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 445 | SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1, |
| 446 | ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
| 447 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 448 | |
| 449 | ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"), |
| 450 | ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"), |
| 451 | ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"), |
| 452 | ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"), |
| 453 | |
| 454 | ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"), |
| 455 | ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"), |
| 456 | ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"), |
| 457 | ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"), |
| 458 | |
| 459 | ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"), |
| 460 | ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"), |
| 461 | ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"), |
| 462 | ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"), |
| 463 | |
| 464 | ARIZONA_MIXER_WIDGETS(Mic, "Mic"), |
| 465 | ARIZONA_MIXER_WIDGETS(Noise, "Noise"), |
| 466 | |
| 467 | ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"), |
| 468 | ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"), |
| 469 | |
| 470 | ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"), |
| 471 | ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"), |
| 472 | ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"), |
| 473 | ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"), |
| 474 | ARIZONA_MIXER_WIDGETS(OUT3, "EPOUT"), |
| 475 | ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"), |
| 476 | ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"), |
| 477 | ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"), |
| 478 | ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"), |
| 479 | |
| 480 | ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"), |
| 481 | ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"), |
| 482 | ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"), |
| 483 | ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"), |
| 484 | ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"), |
| 485 | ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"), |
| 486 | ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"), |
| 487 | ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"), |
| 488 | |
| 489 | ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"), |
| 490 | ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"), |
| 491 | |
| 492 | ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), |
| 493 | ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), |
| 494 | |
| 495 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), |
| 496 | SND_SOC_DAPM_OUTPUT("HPOUT1R"), |
| 497 | SND_SOC_DAPM_OUTPUT("HPOUT2L"), |
| 498 | SND_SOC_DAPM_OUTPUT("HPOUT2R"), |
| 499 | SND_SOC_DAPM_OUTPUT("EPOUTN"), |
| 500 | SND_SOC_DAPM_OUTPUT("EPOUTP"), |
| 501 | SND_SOC_DAPM_OUTPUT("SPKOUTLN"), |
| 502 | SND_SOC_DAPM_OUTPUT("SPKOUTLP"), |
| 503 | SND_SOC_DAPM_OUTPUT("SPKOUTRN"), |
| 504 | SND_SOC_DAPM_OUTPUT("SPKOUTRP"), |
| 505 | SND_SOC_DAPM_OUTPUT("SPKDAT1L"), |
| 506 | SND_SOC_DAPM_OUTPUT("SPKDAT1R"), |
| 507 | }; |
| 508 | |
| 509 | #define ARIZONA_MIXER_INPUT_ROUTES(name) \ |
| 510 | { name, "Noise Generator", "Noise Generator" }, \ |
| 511 | { name, "Tone Generator 1", "Tone Generator 1" }, \ |
| 512 | { name, "Tone Generator 2", "Tone Generator 2" }, \ |
| 513 | { name, "IN1L", "IN1L PGA" }, \ |
| 514 | { name, "IN1R", "IN1R PGA" }, \ |
| 515 | { name, "IN2L", "IN2L PGA" }, \ |
| 516 | { name, "IN2R", "IN2R PGA" }, \ |
| 517 | { name, "IN3L", "IN3L PGA" }, \ |
| 518 | { name, "IN3R", "IN3R PGA" }, \ |
| 519 | { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \ |
| 520 | { name, "AIF1RX1", "AIF1RX1" }, \ |
| 521 | { name, "AIF1RX2", "AIF1RX2" }, \ |
| 522 | { name, "AIF1RX3", "AIF1RX3" }, \ |
| 523 | { name, "AIF1RX4", "AIF1RX4" }, \ |
| 524 | { name, "AIF1RX5", "AIF1RX5" }, \ |
| 525 | { name, "AIF1RX6", "AIF1RX6" }, \ |
| 526 | { name, "AIF1RX7", "AIF1RX7" }, \ |
| 527 | { name, "AIF1RX8", "AIF1RX8" }, \ |
| 528 | { name, "AIF2RX1", "AIF2RX1" }, \ |
| 529 | { name, "AIF2RX2", "AIF2RX2" }, \ |
| 530 | { name, "AIF3RX1", "AIF3RX1" }, \ |
| 531 | { name, "AIF3RX2", "AIF3RX2" }, \ |
| 532 | { name, "EQ1", "EQ1" }, \ |
| 533 | { name, "EQ2", "EQ2" }, \ |
| 534 | { name, "EQ3", "EQ3" }, \ |
| 535 | { name, "EQ4", "EQ4" }, \ |
| 536 | { name, "DRC1L", "DRC1L" }, \ |
| 537 | { name, "DRC1R", "DRC1R" }, \ |
| 538 | { name, "DRC2L", "DRC2L" }, \ |
| 539 | { name, "DRC2R", "DRC2R" }, \ |
| 540 | { name, "LHPF1", "LHPF1" }, \ |
| 541 | { name, "LHPF2", "LHPF2" }, \ |
| 542 | { name, "LHPF3", "LHPF3" }, \ |
| 543 | { name, "LHPF4", "LHPF4" } |
| 544 | |
| 545 | static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { |
| 546 | { "AIF2 Capture", NULL, "DBVDD2" }, |
| 547 | { "AIF2 Playback", NULL, "DBVDD2" }, |
| 548 | |
| 549 | { "AIF3 Capture", NULL, "DBVDD3" }, |
| 550 | { "AIF3 Playback", NULL, "DBVDD3" }, |
| 551 | |
| 552 | { "OUT1L", NULL, "CPVDD" }, |
| 553 | { "OUT1R", NULL, "CPVDD" }, |
| 554 | { "OUT2L", NULL, "CPVDD" }, |
| 555 | { "OUT2R", NULL, "CPVDD" }, |
| 556 | { "OUT3L", NULL, "CPVDD" }, |
| 557 | |
| 558 | { "OUT4L", NULL, "SPKVDDL" }, |
| 559 | { "OUT4R", NULL, "SPKVDDR" }, |
| 560 | |
| 561 | { "OUT1L", NULL, "SYSCLK" }, |
| 562 | { "OUT1R", NULL, "SYSCLK" }, |
| 563 | { "OUT2L", NULL, "SYSCLK" }, |
| 564 | { "OUT2R", NULL, "SYSCLK" }, |
| 565 | { "OUT3L", NULL, "SYSCLK" }, |
| 566 | { "OUT4L", NULL, "SYSCLK" }, |
| 567 | { "OUT4R", NULL, "SYSCLK" }, |
| 568 | { "OUT5L", NULL, "SYSCLK" }, |
| 569 | { "OUT5R", NULL, "SYSCLK" }, |
| 570 | |
| 571 | { "MICBIAS1", NULL, "MICVDD" }, |
| 572 | { "MICBIAS2", NULL, "MICVDD" }, |
| 573 | { "MICBIAS3", NULL, "MICVDD" }, |
| 574 | |
| 575 | { "Noise Generator", NULL, "NOISE" }, |
| 576 | { "Tone Generator 1", NULL, "TONE" }, |
| 577 | { "Tone Generator 2", NULL, "TONE" }, |
| 578 | |
| 579 | { "Mic Mute Mixer", NULL, "Noise Mixer" }, |
| 580 | { "Mic Mute Mixer", NULL, "Mic Mixer" }, |
| 581 | |
| 582 | { "AIF1 Capture", NULL, "AIF1TX1" }, |
| 583 | { "AIF1 Capture", NULL, "AIF1TX2" }, |
| 584 | { "AIF1 Capture", NULL, "AIF1TX3" }, |
| 585 | { "AIF1 Capture", NULL, "AIF1TX4" }, |
| 586 | { "AIF1 Capture", NULL, "AIF1TX5" }, |
| 587 | { "AIF1 Capture", NULL, "AIF1TX6" }, |
| 588 | { "AIF1 Capture", NULL, "AIF1TX7" }, |
| 589 | { "AIF1 Capture", NULL, "AIF1TX8" }, |
| 590 | |
| 591 | { "AIF1RX1", NULL, "AIF1 Playback" }, |
| 592 | { "AIF1RX2", NULL, "AIF1 Playback" }, |
| 593 | { "AIF1RX3", NULL, "AIF1 Playback" }, |
| 594 | { "AIF1RX4", NULL, "AIF1 Playback" }, |
| 595 | { "AIF1RX5", NULL, "AIF1 Playback" }, |
| 596 | { "AIF1RX6", NULL, "AIF1 Playback" }, |
| 597 | { "AIF1RX7", NULL, "AIF1 Playback" }, |
| 598 | { "AIF1RX8", NULL, "AIF1 Playback" }, |
| 599 | |
| 600 | { "AIF2 Capture", NULL, "AIF2TX1" }, |
| 601 | { "AIF2 Capture", NULL, "AIF2TX2" }, |
| 602 | |
| 603 | { "AIF2RX1", NULL, "AIF2 Playback" }, |
| 604 | { "AIF2RX2", NULL, "AIF2 Playback" }, |
| 605 | |
| 606 | { "AIF3 Capture", NULL, "AIF3TX1" }, |
| 607 | { "AIF3 Capture", NULL, "AIF3TX2" }, |
| 608 | |
| 609 | { "AIF3RX1", NULL, "AIF3 Playback" }, |
| 610 | { "AIF3RX2", NULL, "AIF3 Playback" }, |
| 611 | |
| 612 | { "AIF1 Playback", NULL, "SYSCLK" }, |
| 613 | { "AIF2 Playback", NULL, "SYSCLK" }, |
| 614 | { "AIF3 Playback", NULL, "SYSCLK" }, |
| 615 | |
| 616 | { "AIF1 Capture", NULL, "SYSCLK" }, |
| 617 | { "AIF2 Capture", NULL, "SYSCLK" }, |
| 618 | { "AIF3 Capture", NULL, "SYSCLK" }, |
| 619 | |
| 620 | ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), |
| 621 | ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), |
| 622 | ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"), |
| 623 | ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"), |
| 624 | ARIZONA_MIXER_ROUTES("OUT3L", "EPOUT"), |
| 625 | |
| 626 | ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"), |
| 627 | ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"), |
| 628 | ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"), |
| 629 | ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"), |
| 630 | |
| 631 | ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"), |
| 632 | ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"), |
| 633 | |
| 634 | ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"), |
| 635 | ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"), |
| 636 | ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"), |
| 637 | ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"), |
| 638 | ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"), |
| 639 | ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"), |
| 640 | ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"), |
| 641 | ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"), |
| 642 | |
| 643 | ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"), |
| 644 | ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"), |
| 645 | |
| 646 | ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"), |
| 647 | ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"), |
| 648 | |
| 649 | ARIZONA_MIXER_ROUTES("EQ1", "EQ1"), |
| 650 | ARIZONA_MIXER_ROUTES("EQ2", "EQ2"), |
| 651 | ARIZONA_MIXER_ROUTES("EQ3", "EQ3"), |
| 652 | ARIZONA_MIXER_ROUTES("EQ4", "EQ4"), |
| 653 | |
| 654 | ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"), |
| 655 | ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"), |
| 656 | ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"), |
| 657 | ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"), |
| 658 | |
| 659 | ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"), |
| 660 | ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"), |
| 661 | ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), |
| 662 | ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), |
| 663 | |
| 664 | { "HPOUT1L", NULL, "OUT1L" }, |
| 665 | { "HPOUT1R", NULL, "OUT1R" }, |
| 666 | |
| 667 | { "HPOUT2L", NULL, "OUT2L" }, |
| 668 | { "HPOUT2R", NULL, "OUT2R" }, |
| 669 | |
| 670 | { "EPOUTN", NULL, "OUT3L" }, |
| 671 | { "EPOUTP", NULL, "OUT3L" }, |
| 672 | |
| 673 | { "SPKOUTLN", NULL, "OUT4L" }, |
| 674 | { "SPKOUTLP", NULL, "OUT4L" }, |
| 675 | |
| 676 | { "SPKOUTRN", NULL, "OUT4R" }, |
| 677 | { "SPKOUTRP", NULL, "OUT4R" }, |
| 678 | |
| 679 | { "SPKDAT1L", NULL, "OUT5L" }, |
| 680 | { "SPKDAT1R", NULL, "OUT5R" }, |
| 681 | }; |
| 682 | |
| 683 | static int wm5102_set_fll(struct snd_soc_codec *codec, int fll_id, int source, |
| 684 | unsigned int Fref, unsigned int Fout) |
| 685 | { |
| 686 | struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec); |
| 687 | |
| 688 | switch (fll_id) { |
| 689 | case WM5102_FLL1: |
| 690 | return arizona_set_fll(&wm5102->fll[0], source, Fref, Fout); |
| 691 | case WM5102_FLL2: |
| 692 | return arizona_set_fll(&wm5102->fll[1], source, Fref, Fout); |
| 693 | default: |
| 694 | return -EINVAL; |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | #define WM5102_RATES SNDRV_PCM_RATE_8000_192000 |
| 699 | |
| 700 | #define WM5102_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
| 701 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
| 702 | |
| 703 | static struct snd_soc_dai_driver wm5102_dai[] = { |
| 704 | { |
| 705 | .name = "wm5102-aif1", |
| 706 | .id = 1, |
| 707 | .base = ARIZONA_AIF1_BCLK_CTRL, |
| 708 | .playback = { |
| 709 | .stream_name = "AIF1 Playback", |
| 710 | .channels_min = 1, |
| 711 | .channels_max = 8, |
| 712 | .rates = WM5102_RATES, |
| 713 | .formats = WM5102_FORMATS, |
| 714 | }, |
| 715 | .capture = { |
| 716 | .stream_name = "AIF1 Capture", |
| 717 | .channels_min = 1, |
| 718 | .channels_max = 8, |
| 719 | .rates = WM5102_RATES, |
| 720 | .formats = WM5102_FORMATS, |
| 721 | }, |
| 722 | .ops = &arizona_dai_ops, |
| 723 | .symmetric_rates = 1, |
| 724 | }, |
| 725 | { |
| 726 | .name = "wm5102-aif2", |
| 727 | .id = 2, |
| 728 | .base = ARIZONA_AIF2_BCLK_CTRL, |
| 729 | .playback = { |
| 730 | .stream_name = "AIF2 Playback", |
| 731 | .channels_min = 1, |
| 732 | .channels_max = 2, |
| 733 | .rates = WM5102_RATES, |
| 734 | .formats = WM5102_FORMATS, |
| 735 | }, |
| 736 | .capture = { |
| 737 | .stream_name = "AIF2 Capture", |
| 738 | .channels_min = 1, |
| 739 | .channels_max = 2, |
| 740 | .rates = WM5102_RATES, |
| 741 | .formats = WM5102_FORMATS, |
| 742 | }, |
| 743 | .ops = &arizona_dai_ops, |
| 744 | .symmetric_rates = 1, |
| 745 | }, |
| 746 | { |
| 747 | .name = "wm5102-aif3", |
| 748 | .id = 3, |
| 749 | .base = ARIZONA_AIF3_BCLK_CTRL, |
| 750 | .playback = { |
| 751 | .stream_name = "AIF3 Playback", |
| 752 | .channels_min = 1, |
| 753 | .channels_max = 2, |
| 754 | .rates = WM5102_RATES, |
| 755 | .formats = WM5102_FORMATS, |
| 756 | }, |
| 757 | .capture = { |
| 758 | .stream_name = "AIF3 Capture", |
| 759 | .channels_min = 1, |
| 760 | .channels_max = 2, |
| 761 | .rates = WM5102_RATES, |
| 762 | .formats = WM5102_FORMATS, |
| 763 | }, |
| 764 | .ops = &arizona_dai_ops, |
| 765 | .symmetric_rates = 1, |
| 766 | }, |
| 767 | }; |
| 768 | |
| 769 | static int wm5102_codec_probe(struct snd_soc_codec *codec) |
| 770 | { |
| 771 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); |
| 772 | |
| 773 | codec->control_data = priv->core.arizona->regmap; |
| 774 | return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); |
| 775 | } |
| 776 | |
| 777 | #define WM5102_DIG_VU 0x0200 |
| 778 | |
| 779 | static unsigned int wm5102_digital_vu[] = { |
| 780 | ARIZONA_ADC_DIGITAL_VOLUME_1L, |
| 781 | ARIZONA_ADC_DIGITAL_VOLUME_1R, |
| 782 | ARIZONA_ADC_DIGITAL_VOLUME_2L, |
| 783 | ARIZONA_ADC_DIGITAL_VOLUME_2R, |
| 784 | ARIZONA_ADC_DIGITAL_VOLUME_3L, |
| 785 | ARIZONA_ADC_DIGITAL_VOLUME_3R, |
| 786 | |
| 787 | ARIZONA_DAC_DIGITAL_VOLUME_1L, |
| 788 | ARIZONA_DAC_DIGITAL_VOLUME_1R, |
| 789 | ARIZONA_DAC_DIGITAL_VOLUME_2L, |
| 790 | ARIZONA_DAC_DIGITAL_VOLUME_2R, |
| 791 | ARIZONA_DAC_DIGITAL_VOLUME_3L, |
| 792 | ARIZONA_DAC_DIGITAL_VOLUME_3R, |
| 793 | ARIZONA_DAC_DIGITAL_VOLUME_4L, |
| 794 | ARIZONA_DAC_DIGITAL_VOLUME_4R, |
| 795 | ARIZONA_DAC_DIGITAL_VOLUME_5L, |
| 796 | ARIZONA_DAC_DIGITAL_VOLUME_5R, |
| 797 | }; |
| 798 | |
| 799 | static struct snd_soc_codec_driver soc_codec_dev_wm5102 = { |
| 800 | .probe = wm5102_codec_probe, |
| 801 | |
| 802 | .idle_bias_off = true, |
| 803 | |
| 804 | .set_sysclk = arizona_set_sysclk, |
| 805 | .set_pll = wm5102_set_fll, |
| 806 | |
| 807 | .controls = wm5102_snd_controls, |
| 808 | .num_controls = ARRAY_SIZE(wm5102_snd_controls), |
| 809 | .dapm_widgets = wm5102_dapm_widgets, |
| 810 | .num_dapm_widgets = ARRAY_SIZE(wm5102_dapm_widgets), |
| 811 | .dapm_routes = wm5102_dapm_routes, |
| 812 | .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes), |
| 813 | }; |
| 814 | |
| 815 | static int __devinit wm5102_probe(struct platform_device *pdev) |
| 816 | { |
| 817 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
| 818 | struct wm5102_priv *wm5102; |
| 819 | int i; |
| 820 | |
| 821 | wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), |
| 822 | GFP_KERNEL); |
| 823 | if (wm5102 == NULL) |
| 824 | return -ENOMEM; |
| 825 | platform_set_drvdata(pdev, wm5102); |
| 826 | |
| 827 | wm5102->core.arizona = arizona; |
| 828 | |
| 829 | arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1, |
| 830 | ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK, |
| 831 | &wm5102->fll[0]); |
| 832 | arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1, |
| 833 | ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK, |
| 834 | &wm5102->fll[1]); |
| 835 | |
| 836 | /* Latch volume update bits */ |
| 837 | for (i = 0; i < ARRAY_SIZE(wm5102_digital_vu); i++) |
| 838 | regmap_update_bits(arizona->regmap, wm5102_digital_vu[i], |
| 839 | WM5102_DIG_VU, WM5102_DIG_VU); |
| 840 | |
| 841 | pm_runtime_enable(&pdev->dev); |
| 842 | pm_runtime_idle(&pdev->dev); |
| 843 | |
| 844 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102, |
| 845 | wm5102_dai, ARRAY_SIZE(wm5102_dai)); |
| 846 | } |
| 847 | |
| 848 | static int __devexit wm5102_remove(struct platform_device *pdev) |
| 849 | { |
| 850 | snd_soc_unregister_codec(&pdev->dev); |
| 851 | pm_runtime_disable(&pdev->dev); |
| 852 | |
| 853 | return 0; |
| 854 | } |
| 855 | |
| 856 | static struct platform_driver wm5102_codec_driver = { |
| 857 | .driver = { |
| 858 | .name = "wm5102-codec", |
| 859 | .owner = THIS_MODULE, |
| 860 | }, |
| 861 | .probe = wm5102_probe, |
| 862 | .remove = __devexit_p(wm5102_remove), |
| 863 | }; |
| 864 | |
| 865 | module_platform_driver(wm5102_codec_driver); |
| 866 | |
| 867 | MODULE_DESCRIPTION("ASoC WM5102 driver"); |
| 868 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 869 | MODULE_LICENSE("GPL"); |
| 870 | MODULE_ALIAS("platform:wm5102-codec"); |