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