aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-27 01:16:15 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-27 01:16:15 -0500
commite2755cf9a4b9403373f5d50292e4ac410ab9ce0e (patch)
tree3371bc76183562dca2b310eead59ccc08ba3041a /sound
parentfce0a0c72618e021e29ed4e051ce6b42b218c5e6 (diff)
parent57374bb491facf716c172126b7e9b99c9e3f8b45 (diff)
Merge tag 'asoc-v3.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v3.14 A somewhat large set of fixes here due to the identification of some systematic problems with hard to use APIs in the subsystem. Takashi did a lot of work to address the enumeration API which uncovered a number of off by one bugs caused by confusing APIs while Charles addressed issues in the locking around DAPM.
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ad1980.c4
-rw-r--r--sound/soc/codecs/isabelle.c52
-rw-r--r--sound/soc/codecs/sta32x.c74
-rw-r--r--sound/soc/codecs/wm8400.c34
-rw-r--r--sound/soc/codecs/wm8770.c4
-rw-r--r--sound/soc/codecs/wm8900.c44
-rw-r--r--sound/soc/codecs/wm8994.c135
-rw-r--r--sound/soc/soc-dapm.c139
8 files changed, 309 insertions, 177 deletions
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
index 7257a8885f42..34d965a4a040 100644
--- a/sound/soc/codecs/ad1980.c
+++ b/sound/soc/codecs/ad1980.c
@@ -57,8 +57,8 @@ static const u16 ad1980_reg[] = {
57static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", 57static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line",
58 "Stereo Mix", "Mono Mix", "Phone"}; 58 "Stereo Mix", "Mono Mix", "Phone"};
59 59
60static const struct soc_enum ad1980_cap_src = 60static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src,
61 SOC_ENUM_DOUBLE(AC97_REC_SEL, 8, 0, 7, ad1980_rec_sel); 61 AC97_REC_SEL, 8, 0, ad1980_rec_sel);
62 62
63static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { 63static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = {
64SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), 64SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1),
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c
index 5839048ec467..cb736ddc446d 100644
--- a/sound/soc/codecs/isabelle.c
+++ b/sound/soc/codecs/isabelle.c
@@ -140,13 +140,17 @@ static const char *isabelle_rx1_texts[] = {"VRX1", "ARX1"};
140static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"}; 140static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"};
141 141
142static const struct soc_enum isabelle_rx1_enum[] = { 142static const struct soc_enum isabelle_rx1_enum[] = {
143 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, 1, isabelle_rx1_texts), 143 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3,
144 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, 1, isabelle_rx1_texts), 144 ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts),
145 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5,
146 ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts),
145}; 147};
146 148
147static const struct soc_enum isabelle_rx2_enum[] = { 149static const struct soc_enum isabelle_rx2_enum[] = {
148 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, 1, isabelle_rx2_texts), 150 SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2,
149 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, 1, isabelle_rx2_texts), 151 ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts),
152 SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4,
153 ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts),
150}; 154};
151 155
152/* Headset DAC playback switches */ 156/* Headset DAC playback switches */
@@ -161,13 +165,17 @@ static const char *isabelle_atx_texts[] = {"AMIC1", "DMIC"};
161static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"}; 165static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"};
162 166
163static const struct soc_enum isabelle_atx_enum[] = { 167static const struct soc_enum isabelle_atx_enum[] = {
164 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, 1, isabelle_atx_texts), 168 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7,
165 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_atx_texts), 169 ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts),
170 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0,
171 ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts),
166}; 172};
167 173
168static const struct soc_enum isabelle_vtx_enum[] = { 174static const struct soc_enum isabelle_vtx_enum[] = {
169 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, 1, isabelle_vtx_texts), 175 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6,
170 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_vtx_texts), 176 ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts),
177 SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0,
178 ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts),
171}; 179};
172 180
173static const struct snd_kcontrol_new atx_mux_controls = 181static const struct snd_kcontrol_new atx_mux_controls =
@@ -183,17 +191,13 @@ static const char *isabelle_amic1_texts[] = {
183/* Left analog microphone selection */ 191/* Left analog microphone selection */
184static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"}; 192static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"};
185 193
186static const struct soc_enum isabelle_amic1_enum[] = { 194static SOC_ENUM_SINGLE_DECL(isabelle_amic1_enum,
187 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 5, 195 ISABELLE_AMIC_CFG_REG, 5,
188 ARRAY_SIZE(isabelle_amic1_texts), 196 isabelle_amic1_texts);
189 isabelle_amic1_texts),
190};
191 197
192static const struct soc_enum isabelle_amic2_enum[] = { 198static SOC_ENUM_SINGLE_DECL(isabelle_amic2_enum,
193 SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 4, 199 ISABELLE_AMIC_CFG_REG, 4,
194 ARRAY_SIZE(isabelle_amic2_texts), 200 isabelle_amic2_texts);
195 isabelle_amic2_texts),
196};
197 201
198static const struct snd_kcontrol_new amic1_control = 202static const struct snd_kcontrol_new amic1_control =
199 SOC_DAPM_ENUM("Route", isabelle_amic1_enum); 203 SOC_DAPM_ENUM("Route", isabelle_amic1_enum);
@@ -206,16 +210,20 @@ static const char *isabelle_st_audio_texts[] = {"ATX1", "ATX2"};
206static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"}; 210static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"};
207 211
208static const struct soc_enum isabelle_st_audio_enum[] = { 212static const struct soc_enum isabelle_st_audio_enum[] = {
209 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, 1, 213 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7,
214 ARRAY_SIZE(isabelle_st_audio_texts),
210 isabelle_st_audio_texts), 215 isabelle_st_audio_texts),
211 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, 1, 216 SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7,
217 ARRAY_SIZE(isabelle_st_audio_texts),
212 isabelle_st_audio_texts), 218 isabelle_st_audio_texts),
213}; 219};
214 220
215static const struct soc_enum isabelle_st_voice_enum[] = { 221static const struct soc_enum isabelle_st_voice_enum[] = {
216 SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, 1, 222 SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7,
223 ARRAY_SIZE(isabelle_st_voice_texts),
217 isabelle_st_voice_texts), 224 isabelle_st_voice_texts),
218 SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, 1, 225 SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7,
226 ARRAY_SIZE(isabelle_st_voice_texts),
219 isabelle_st_voice_texts), 227 isabelle_st_voice_texts),
220}; 228};
221 229
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index 06edb396e733..ea78c172538c 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = {
187 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), 187 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0),
188}; 188};
189 189
190static const struct soc_enum sta32x_drc_ac_enum = 190static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum,
191 SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, 191 STA32X_CONFD, STA32X_CONFD_DRC_SHIFT,
192 2, sta32x_drc_ac); 192 sta32x_drc_ac);
193static const struct soc_enum sta32x_auto_eq_enum = 193static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum,
194 SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, 194 STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT,
195 3, sta32x_auto_eq_mode); 195 sta32x_auto_eq_mode);
196static const struct soc_enum sta32x_auto_gc_enum = 196static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum,
197 SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, 197 STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT,
198 4, sta32x_auto_gc_mode); 198 sta32x_auto_gc_mode);
199static const struct soc_enum sta32x_auto_xo_enum = 199static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum,
200 SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, 200 STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT,
201 16, sta32x_auto_xo_mode); 201 sta32x_auto_xo_mode);
202static const struct soc_enum sta32x_preset_eq_enum = 202static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum,
203 SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, 203 STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT,
204 32, sta32x_preset_eq_mode); 204 sta32x_preset_eq_mode);
205static const struct soc_enum sta32x_limiter_ch1_enum = 205static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum,
206 SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, 206 STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT,
207 3, sta32x_limiter_select); 207 sta32x_limiter_select);
208static const struct soc_enum sta32x_limiter_ch2_enum = 208static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum,
209 SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, 209 STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT,
210 3, sta32x_limiter_select); 210 sta32x_limiter_select);
211static const struct soc_enum sta32x_limiter_ch3_enum = 211static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum,
212 SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, 212 STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT,
213 3, sta32x_limiter_select); 213 sta32x_limiter_select);
214static const struct soc_enum sta32x_limiter1_attack_rate_enum = 214static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum,
215 SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT, 215 STA32X_L1AR, STA32X_LxA_SHIFT,
216 16, sta32x_limiter_attack_rate); 216 sta32x_limiter_attack_rate);
217static const struct soc_enum sta32x_limiter2_attack_rate_enum = 217static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum,
218 SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT, 218 STA32X_L2AR, STA32X_LxA_SHIFT,
219 16, sta32x_limiter_attack_rate); 219 sta32x_limiter_attack_rate);
220static const struct soc_enum sta32x_limiter1_release_rate_enum = 220static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum,
221 SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT, 221 STA32X_L1AR, STA32X_LxR_SHIFT,
222 16, sta32x_limiter_release_rate); 222 sta32x_limiter_release_rate);
223static const struct soc_enum sta32x_limiter2_release_rate_enum = 223static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum,
224 SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT, 224 STA32X_L2AR, STA32X_LxR_SHIFT,
225 16, sta32x_limiter_release_rate); 225 sta32x_limiter_release_rate);
226 226
227/* byte array controls for setting biquad, mixer, scaling coefficients; 227/* byte array controls for setting biquad, mixer, scaling coefficients;
228 * for biquads all five coefficients need to be set in one go, 228 * for biquads all five coefficients need to be set in one go,
@@ -331,7 +331,7 @@ static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
331 331
332static int sta32x_cache_sync(struct snd_soc_codec *codec) 332static int sta32x_cache_sync(struct snd_soc_codec *codec)
333{ 333{
334 struct sta32x_priv *sta32x = codec->control_data; 334 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
335 unsigned int mute; 335 unsigned int mute;
336 int rc; 336 int rc;
337 337
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 48dc7d2fee36..6d684d934f4d 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -117,19 +117,23 @@ static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
117static const char *wm8400_digital_sidetone[] = 117static const char *wm8400_digital_sidetone[] =
118 {"None", "Left ADC", "Right ADC", "Reserved"}; 118 {"None", "Left ADC", "Right ADC", "Reserved"};
119 119
120static const struct soc_enum wm8400_left_digital_sidetone_enum = 120static SOC_ENUM_SINGLE_DECL(wm8400_left_digital_sidetone_enum,
121SOC_ENUM_SINGLE(WM8400_DIGITAL_SIDE_TONE, 121 WM8400_DIGITAL_SIDE_TONE,
122 WM8400_ADC_TO_DACL_SHIFT, 2, wm8400_digital_sidetone); 122 WM8400_ADC_TO_DACL_SHIFT,
123 wm8400_digital_sidetone);
123 124
124static const struct soc_enum wm8400_right_digital_sidetone_enum = 125static SOC_ENUM_SINGLE_DECL(wm8400_right_digital_sidetone_enum,
125SOC_ENUM_SINGLE(WM8400_DIGITAL_SIDE_TONE, 126 WM8400_DIGITAL_SIDE_TONE,
126 WM8400_ADC_TO_DACR_SHIFT, 2, wm8400_digital_sidetone); 127 WM8400_ADC_TO_DACR_SHIFT,
128 wm8400_digital_sidetone);
127 129
128static const char *wm8400_adcmode[] = 130static const char *wm8400_adcmode[] =
129 {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; 131 {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"};
130 132
131static const struct soc_enum wm8400_right_adcmode_enum = 133static SOC_ENUM_SINGLE_DECL(wm8400_right_adcmode_enum,
132SOC_ENUM_SINGLE(WM8400_ADC_CTRL, WM8400_ADC_HPF_CUT_SHIFT, 3, wm8400_adcmode); 134 WM8400_ADC_CTRL,
135 WM8400_ADC_HPF_CUT_SHIFT,
136 wm8400_adcmode);
133 137
134static const struct snd_kcontrol_new wm8400_snd_controls[] = { 138static const struct snd_kcontrol_new wm8400_snd_controls[] = {
135/* INMIXL */ 139/* INMIXL */
@@ -422,9 +426,10 @@ SOC_DAPM_SINGLE("RINPGA34 Switch", WM8400_INPUT_MIXER3, WM8400_L34MNB_SHIFT,
422static const char *wm8400_ainlmux[] = 426static const char *wm8400_ainlmux[] =
423 {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; 427 {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"};
424 428
425static const struct soc_enum wm8400_ainlmux_enum = 429static SOC_ENUM_SINGLE_DECL(wm8400_ainlmux_enum,
426SOC_ENUM_SINGLE( WM8400_INPUT_MIXER1, WM8400_AINLMODE_SHIFT, 430 WM8400_INPUT_MIXER1,
427 ARRAY_SIZE(wm8400_ainlmux), wm8400_ainlmux); 431 WM8400_AINLMODE_SHIFT,
432 wm8400_ainlmux);
428 433
429static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls = 434static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls =
430SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); 435SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum);
@@ -435,9 +440,10 @@ SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum);
435static const char *wm8400_ainrmux[] = 440static const char *wm8400_ainrmux[] =
436 {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; 441 {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"};
437 442
438static const struct soc_enum wm8400_ainrmux_enum = 443static SOC_ENUM_SINGLE_DECL(wm8400_ainrmux_enum,
439SOC_ENUM_SINGLE( WM8400_INPUT_MIXER1, WM8400_AINRMODE_SHIFT, 444 WM8400_INPUT_MIXER1,
440 ARRAY_SIZE(wm8400_ainrmux), wm8400_ainrmux); 445 WM8400_AINRMODE_SHIFT,
446 wm8400_ainrmux);
441 447
442static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls = 448static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls =
443SOC_DAPM_ENUM("Route", wm8400_ainrmux_enum); 449SOC_DAPM_ENUM("Route", wm8400_ainrmux_enum);
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
index 89a18d82f303..5bce21013485 100644
--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -196,8 +196,8 @@ static const char *ain_text[] = {
196 "AIN5", "AIN6", "AIN7", "AIN8" 196 "AIN5", "AIN6", "AIN7", "AIN8"
197}; 197};
198 198
199static const struct soc_enum ain_enum = 199static SOC_ENUM_DOUBLE_DECL(ain_enum,
200 SOC_ENUM_DOUBLE(WM8770_ADCMUX, 0, 4, 8, ain_text); 200 WM8770_ADCMUX, 0, 4, ain_text);
201 201
202static const struct snd_kcontrol_new ain_mux = 202static const struct snd_kcontrol_new ain_mux =
203 SOC_DAPM_ENUM("Capture Mux", ain_enum); 203 SOC_DAPM_ENUM("Capture Mux", ain_enum);
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index e98bc7038a08..43c2201cb901 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -304,53 +304,53 @@ static const DECLARE_TLV_DB_SCALE(adc_tlv, -7200, 75, 1);
304 304
305static const char *mic_bias_level_txt[] = { "0.9*AVDD", "0.65*AVDD" }; 305static const char *mic_bias_level_txt[] = { "0.9*AVDD", "0.65*AVDD" };
306 306
307static const struct soc_enum mic_bias_level = 307static SOC_ENUM_SINGLE_DECL(mic_bias_level,
308SOC_ENUM_SINGLE(WM8900_REG_INCTL, 8, 2, mic_bias_level_txt); 308 WM8900_REG_INCTL, 8, mic_bias_level_txt);
309 309
310static const char *dac_mute_rate_txt[] = { "Fast", "Slow" }; 310static const char *dac_mute_rate_txt[] = { "Fast", "Slow" };
311 311
312static const struct soc_enum dac_mute_rate = 312static SOC_ENUM_SINGLE_DECL(dac_mute_rate,
313SOC_ENUM_SINGLE(WM8900_REG_DACCTRL, 7, 2, dac_mute_rate_txt); 313 WM8900_REG_DACCTRL, 7, dac_mute_rate_txt);
314 314
315static const char *dac_deemphasis_txt[] = { 315static const char *dac_deemphasis_txt[] = {
316 "Disabled", "32kHz", "44.1kHz", "48kHz" 316 "Disabled", "32kHz", "44.1kHz", "48kHz"
317}; 317};
318 318
319static const struct soc_enum dac_deemphasis = 319static SOC_ENUM_SINGLE_DECL(dac_deemphasis,
320SOC_ENUM_SINGLE(WM8900_REG_DACCTRL, 4, 4, dac_deemphasis_txt); 320 WM8900_REG_DACCTRL, 4, dac_deemphasis_txt);
321 321
322static const char *adc_hpf_cut_txt[] = { 322static const char *adc_hpf_cut_txt[] = {
323 "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3" 323 "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"
324}; 324};
325 325
326static const struct soc_enum adc_hpf_cut = 326static SOC_ENUM_SINGLE_DECL(adc_hpf_cut,
327SOC_ENUM_SINGLE(WM8900_REG_ADCCTRL, 5, 4, adc_hpf_cut_txt); 327 WM8900_REG_ADCCTRL, 5, adc_hpf_cut_txt);
328 328
329static const char *lr_txt[] = { 329static const char *lr_txt[] = {
330 "Left", "Right" 330 "Left", "Right"
331}; 331};
332 332
333static const struct soc_enum aifl_src = 333static SOC_ENUM_SINGLE_DECL(aifl_src,
334SOC_ENUM_SINGLE(WM8900_REG_AUDIO1, 15, 2, lr_txt); 334 WM8900_REG_AUDIO1, 15, lr_txt);
335 335
336static const struct soc_enum aifr_src = 336static SOC_ENUM_SINGLE_DECL(aifr_src,
337SOC_ENUM_SINGLE(WM8900_REG_AUDIO1, 14, 2, lr_txt); 337 WM8900_REG_AUDIO1, 14, lr_txt);
338 338
339static const struct soc_enum dacl_src = 339static SOC_ENUM_SINGLE_DECL(dacl_src,
340SOC_ENUM_SINGLE(WM8900_REG_AUDIO2, 15, 2, lr_txt); 340 WM8900_REG_AUDIO2, 15, lr_txt);
341 341
342static const struct soc_enum dacr_src = 342static SOC_ENUM_SINGLE_DECL(dacr_src,
343SOC_ENUM_SINGLE(WM8900_REG_AUDIO2, 14, 2, lr_txt); 343 WM8900_REG_AUDIO2, 14, lr_txt);
344 344
345static const char *sidetone_txt[] = { 345static const char *sidetone_txt[] = {
346 "Disabled", "Left ADC", "Right ADC" 346 "Disabled", "Left ADC", "Right ADC"
347}; 347};
348 348
349static const struct soc_enum dacl_sidetone = 349static SOC_ENUM_SINGLE_DECL(dacl_sidetone,
350SOC_ENUM_SINGLE(WM8900_REG_SIDETONE, 2, 3, sidetone_txt); 350 WM8900_REG_SIDETONE, 2, sidetone_txt);
351 351
352static const struct soc_enum dacr_sidetone = 352static SOC_ENUM_SINGLE_DECL(dacr_sidetone,
353SOC_ENUM_SINGLE(WM8900_REG_SIDETONE, 0, 3, sidetone_txt); 353 WM8900_REG_SIDETONE, 0, sidetone_txt);
354 354
355static const struct snd_kcontrol_new wm8900_snd_controls[] = { 355static const struct snd_kcontrol_new wm8900_snd_controls[] = {
356SOC_ENUM("Mic Bias Level", mic_bias_level), 356SOC_ENUM("Mic Bias Level", mic_bias_level),
@@ -496,8 +496,8 @@ SOC_DAPM_SINGLE("RINPUT3 Switch", WM8900_REG_INCTL, 0, 1, 0),
496 496
497static const char *wm8900_lp_mux[] = { "Disabled", "Enabled" }; 497static const char *wm8900_lp_mux[] = { "Disabled", "Enabled" };
498 498
499static const struct soc_enum wm8900_lineout2_lp_mux = 499static SOC_ENUM_SINGLE_DECL(wm8900_lineout2_lp_mux,
500SOC_ENUM_SINGLE(WM8900_REG_LOUTMIXCTL1, 1, 2, wm8900_lp_mux); 500 WM8900_REG_LOUTMIXCTL1, 1, wm8900_lp_mux);
501 501
502static const struct snd_kcontrol_new wm8900_lineout2_lp = 502static const struct snd_kcontrol_new wm8900_lineout2_lp =
503SOC_DAPM_ENUM("Route", wm8900_lineout2_lp_mux); 503SOC_DAPM_ENUM("Route", wm8900_lineout2_lp_mux);
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index b9be9cbc4603..adb72063d44e 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -265,21 +265,21 @@ static const char *sidetone_hpf_text[] = {
265 "2.7kHz", "1.35kHz", "675Hz", "370Hz", "180Hz", "90Hz", "45Hz" 265 "2.7kHz", "1.35kHz", "675Hz", "370Hz", "180Hz", "90Hz", "45Hz"
266}; 266};
267 267
268static const struct soc_enum sidetone_hpf = 268static SOC_ENUM_SINGLE_DECL(sidetone_hpf,
269 SOC_ENUM_SINGLE(WM8994_SIDETONE, 7, 7, sidetone_hpf_text); 269 WM8994_SIDETONE, 7, sidetone_hpf_text);
270 270
271static const char *adc_hpf_text[] = { 271static const char *adc_hpf_text[] = {
272 "HiFi", "Voice 1", "Voice 2", "Voice 3" 272 "HiFi", "Voice 1", "Voice 2", "Voice 3"
273}; 273};
274 274
275static const struct soc_enum aif1adc1_hpf = 275static SOC_ENUM_SINGLE_DECL(aif1adc1_hpf,
276 SOC_ENUM_SINGLE(WM8994_AIF1_ADC1_FILTERS, 13, 4, adc_hpf_text); 276 WM8994_AIF1_ADC1_FILTERS, 13, adc_hpf_text);
277 277
278static const struct soc_enum aif1adc2_hpf = 278static SOC_ENUM_SINGLE_DECL(aif1adc2_hpf,
279 SOC_ENUM_SINGLE(WM8994_AIF1_ADC2_FILTERS, 13, 4, adc_hpf_text); 279 WM8994_AIF1_ADC2_FILTERS, 13, adc_hpf_text);
280 280
281static const struct soc_enum aif2adc_hpf = 281static SOC_ENUM_SINGLE_DECL(aif2adc_hpf,
282 SOC_ENUM_SINGLE(WM8994_AIF2_ADC_FILTERS, 13, 4, adc_hpf_text); 282 WM8994_AIF2_ADC_FILTERS, 13, adc_hpf_text);
283 283
284static const DECLARE_TLV_DB_SCALE(aif_tlv, 0, 600, 0); 284static const DECLARE_TLV_DB_SCALE(aif_tlv, 0, 600, 0);
285static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); 285static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
@@ -501,39 +501,39 @@ static const char *aif_chan_src_text[] = {
501 "Left", "Right" 501 "Left", "Right"
502}; 502};
503 503
504static const struct soc_enum aif1adcl_src = 504static SOC_ENUM_SINGLE_DECL(aif1adcl_src,
505 SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_1, 15, 2, aif_chan_src_text); 505 WM8994_AIF1_CONTROL_1, 15, aif_chan_src_text);
506 506
507static const struct soc_enum aif1adcr_src = 507static SOC_ENUM_SINGLE_DECL(aif1adcr_src,
508 SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_1, 14, 2, aif_chan_src_text); 508 WM8994_AIF1_CONTROL_1, 14, aif_chan_src_text);
509 509
510static const struct soc_enum aif2adcl_src = 510static SOC_ENUM_SINGLE_DECL(aif2adcl_src,
511 SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_1, 15, 2, aif_chan_src_text); 511 WM8994_AIF2_CONTROL_1, 15, aif_chan_src_text);
512 512
513static const struct soc_enum aif2adcr_src = 513static SOC_ENUM_SINGLE_DECL(aif2adcr_src,
514 SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_1, 14, 2, aif_chan_src_text); 514 WM8994_AIF2_CONTROL_1, 14, aif_chan_src_text);
515 515
516static const struct soc_enum aif1dacl_src = 516static SOC_ENUM_SINGLE_DECL(aif1dacl_src,
517 SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, 15, 2, aif_chan_src_text); 517 WM8994_AIF1_CONTROL_2, 15, aif_chan_src_text);
518 518
519static const struct soc_enum aif1dacr_src = 519static SOC_ENUM_SINGLE_DECL(aif1dacr_src,
520 SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, 14, 2, aif_chan_src_text); 520 WM8994_AIF1_CONTROL_2, 14, aif_chan_src_text);
521 521
522static const struct soc_enum aif2dacl_src = 522static SOC_ENUM_SINGLE_DECL(aif2dacl_src,
523 SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, 15, 2, aif_chan_src_text); 523 WM8994_AIF2_CONTROL_2, 15, aif_chan_src_text);
524 524
525static const struct soc_enum aif2dacr_src = 525static SOC_ENUM_SINGLE_DECL(aif2dacr_src,
526 SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, 14, 2, aif_chan_src_text); 526 WM8994_AIF2_CONTROL_2, 14, aif_chan_src_text);
527 527
528static const char *osr_text[] = { 528static const char *osr_text[] = {
529 "Low Power", "High Performance", 529 "Low Power", "High Performance",
530}; 530};
531 531
532static const struct soc_enum dac_osr = 532static SOC_ENUM_SINGLE_DECL(dac_osr,
533 SOC_ENUM_SINGLE(WM8994_OVERSAMPLING, 0, 2, osr_text); 533 WM8994_OVERSAMPLING, 0, osr_text);
534 534
535static const struct soc_enum adc_osr = 535static SOC_ENUM_SINGLE_DECL(adc_osr,
536 SOC_ENUM_SINGLE(WM8994_OVERSAMPLING, 1, 2, osr_text); 536 WM8994_OVERSAMPLING, 1, osr_text);
537 537
538static const struct snd_kcontrol_new wm8994_snd_controls[] = { 538static const struct snd_kcontrol_new wm8994_snd_controls[] = {
539SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, 539SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME,
@@ -690,17 +690,20 @@ static const char *wm8958_ng_text[] = {
690 "30ms", "125ms", "250ms", "500ms", 690 "30ms", "125ms", "250ms", "500ms",
691}; 691};
692 692
693static const struct soc_enum wm8958_aif1dac1_ng_hold = 693static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac1_ng_hold,
694 SOC_ENUM_SINGLE(WM8958_AIF1_DAC1_NOISE_GATE, 694 WM8958_AIF1_DAC1_NOISE_GATE,
695 WM8958_AIF1DAC1_NG_THR_SHIFT, 4, wm8958_ng_text); 695 WM8958_AIF1DAC1_NG_THR_SHIFT,
696 wm8958_ng_text);
696 697
697static const struct soc_enum wm8958_aif1dac2_ng_hold = 698static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac2_ng_hold,
698 SOC_ENUM_SINGLE(WM8958_AIF1_DAC2_NOISE_GATE, 699 WM8958_AIF1_DAC2_NOISE_GATE,
699 WM8958_AIF1DAC2_NG_THR_SHIFT, 4, wm8958_ng_text); 700 WM8958_AIF1DAC2_NG_THR_SHIFT,
701 wm8958_ng_text);
700 702
701static const struct soc_enum wm8958_aif2dac_ng_hold = 703static SOC_ENUM_SINGLE_DECL(wm8958_aif2dac_ng_hold,
702 SOC_ENUM_SINGLE(WM8958_AIF2_DAC_NOISE_GATE, 704 WM8958_AIF2_DAC_NOISE_GATE,
703 WM8958_AIF2DAC_NG_THR_SHIFT, 4, wm8958_ng_text); 705 WM8958_AIF2DAC_NG_THR_SHIFT,
706 wm8958_ng_text);
704 707
705static const struct snd_kcontrol_new wm8958_snd_controls[] = { 708static const struct snd_kcontrol_new wm8958_snd_controls[] = {
706SOC_SINGLE_TLV("AIF3 Boost Volume", WM8958_AIF3_CONTROL_2, 10, 3, 0, aif_tlv), 709SOC_SINGLE_TLV("AIF3 Boost Volume", WM8958_AIF3_CONTROL_2, 10, 3, 0, aif_tlv),
@@ -1341,8 +1344,8 @@ static const char *adc_mux_text[] = {
1341 "DMIC", 1344 "DMIC",
1342}; 1345};
1343 1346
1344static const struct soc_enum adc_enum = 1347static SOC_ENUM_SINGLE_DECL(adc_enum,
1345 SOC_ENUM_SINGLE(0, 0, 2, adc_mux_text); 1348 0, 0, adc_mux_text);
1346 1349
1347static const struct snd_kcontrol_new adcl_mux = 1350static const struct snd_kcontrol_new adcl_mux =
1348 SOC_DAPM_ENUM_VIRT("ADCL Mux", adc_enum); 1351 SOC_DAPM_ENUM_VIRT("ADCL Mux", adc_enum);
@@ -1478,14 +1481,14 @@ static const char *sidetone_text[] = {
1478 "ADC/DMIC1", "DMIC2", 1481 "ADC/DMIC1", "DMIC2",
1479}; 1482};
1480 1483
1481static const struct soc_enum sidetone1_enum = 1484static SOC_ENUM_SINGLE_DECL(sidetone1_enum,
1482 SOC_ENUM_SINGLE(WM8994_SIDETONE, 0, 2, sidetone_text); 1485 WM8994_SIDETONE, 0, sidetone_text);
1483 1486
1484static const struct snd_kcontrol_new sidetone1_mux = 1487static const struct snd_kcontrol_new sidetone1_mux =
1485 SOC_DAPM_ENUM("Left Sidetone Mux", sidetone1_enum); 1488 SOC_DAPM_ENUM("Left Sidetone Mux", sidetone1_enum);
1486 1489
1487static const struct soc_enum sidetone2_enum = 1490static SOC_ENUM_SINGLE_DECL(sidetone2_enum,
1488 SOC_ENUM_SINGLE(WM8994_SIDETONE, 1, 2, sidetone_text); 1491 WM8994_SIDETONE, 1, sidetone_text);
1489 1492
1490static const struct snd_kcontrol_new sidetone2_mux = 1493static const struct snd_kcontrol_new sidetone2_mux =
1491 SOC_DAPM_ENUM("Right Sidetone Mux", sidetone2_enum); 1494 SOC_DAPM_ENUM("Right Sidetone Mux", sidetone2_enum);
@@ -1498,22 +1501,24 @@ static const char *loopback_text[] = {
1498 "None", "ADCDAT", 1501 "None", "ADCDAT",
1499}; 1502};
1500 1503
1501static const struct soc_enum aif1_loopback_enum = 1504static SOC_ENUM_SINGLE_DECL(aif1_loopback_enum,
1502 SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, WM8994_AIF1_LOOPBACK_SHIFT, 2, 1505 WM8994_AIF1_CONTROL_2,
1503 loopback_text); 1506 WM8994_AIF1_LOOPBACK_SHIFT,
1507 loopback_text);
1504 1508
1505static const struct snd_kcontrol_new aif1_loopback = 1509static const struct snd_kcontrol_new aif1_loopback =
1506 SOC_DAPM_ENUM("AIF1 Loopback", aif1_loopback_enum); 1510 SOC_DAPM_ENUM("AIF1 Loopback", aif1_loopback_enum);
1507 1511
1508static const struct soc_enum aif2_loopback_enum = 1512static SOC_ENUM_SINGLE_DECL(aif2_loopback_enum,
1509 SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, WM8994_AIF2_LOOPBACK_SHIFT, 2, 1513 WM8994_AIF2_CONTROL_2,
1510 loopback_text); 1514 WM8994_AIF2_LOOPBACK_SHIFT,
1515 loopback_text);
1511 1516
1512static const struct snd_kcontrol_new aif2_loopback = 1517static const struct snd_kcontrol_new aif2_loopback =
1513 SOC_DAPM_ENUM("AIF2 Loopback", aif2_loopback_enum); 1518 SOC_DAPM_ENUM("AIF2 Loopback", aif2_loopback_enum);
1514 1519
1515static const struct soc_enum aif1dac_enum = 1520static SOC_ENUM_SINGLE_DECL(aif1dac_enum,
1516 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 0, 2, aif1dac_text); 1521 WM8994_POWER_MANAGEMENT_6, 0, aif1dac_text);
1517 1522
1518static const struct snd_kcontrol_new aif1dac_mux = 1523static const struct snd_kcontrol_new aif1dac_mux =
1519 SOC_DAPM_ENUM("AIF1DAC Mux", aif1dac_enum); 1524 SOC_DAPM_ENUM("AIF1DAC Mux", aif1dac_enum);
@@ -1522,8 +1527,8 @@ static const char *aif2dac_text[] = {
1522 "AIF2DACDAT", "AIF3DACDAT", 1527 "AIF2DACDAT", "AIF3DACDAT",
1523}; 1528};
1524 1529
1525static const struct soc_enum aif2dac_enum = 1530static SOC_ENUM_SINGLE_DECL(aif2dac_enum,
1526 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 1, 2, aif2dac_text); 1531 WM8994_POWER_MANAGEMENT_6, 1, aif2dac_text);
1527 1532
1528static const struct snd_kcontrol_new aif2dac_mux = 1533static const struct snd_kcontrol_new aif2dac_mux =
1529 SOC_DAPM_ENUM("AIF2DAC Mux", aif2dac_enum); 1534 SOC_DAPM_ENUM("AIF2DAC Mux", aif2dac_enum);
@@ -1532,8 +1537,8 @@ static const char *aif2adc_text[] = {
1532 "AIF2ADCDAT", "AIF3DACDAT", 1537 "AIF2ADCDAT", "AIF3DACDAT",
1533}; 1538};
1534 1539
1535static const struct soc_enum aif2adc_enum = 1540static SOC_ENUM_SINGLE_DECL(aif2adc_enum,
1536 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 2, 2, aif2adc_text); 1541 WM8994_POWER_MANAGEMENT_6, 2, aif2adc_text);
1537 1542
1538static const struct snd_kcontrol_new aif2adc_mux = 1543static const struct snd_kcontrol_new aif2adc_mux =
1539 SOC_DAPM_ENUM("AIF2ADC Mux", aif2adc_enum); 1544 SOC_DAPM_ENUM("AIF2ADC Mux", aif2adc_enum);
@@ -1542,14 +1547,14 @@ static const char *aif3adc_text[] = {
1542 "AIF1ADCDAT", "AIF2ADCDAT", "AIF2DACDAT", "Mono PCM", 1547 "AIF1ADCDAT", "AIF2ADCDAT", "AIF2DACDAT", "Mono PCM",
1543}; 1548};
1544 1549
1545static const struct soc_enum wm8994_aif3adc_enum = 1550static SOC_ENUM_SINGLE_DECL(wm8994_aif3adc_enum,
1546 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 3, 3, aif3adc_text); 1551 WM8994_POWER_MANAGEMENT_6, 3, aif3adc_text);
1547 1552
1548static const struct snd_kcontrol_new wm8994_aif3adc_mux = 1553static const struct snd_kcontrol_new wm8994_aif3adc_mux =
1549 SOC_DAPM_ENUM("AIF3ADC Mux", wm8994_aif3adc_enum); 1554 SOC_DAPM_ENUM("AIF3ADC Mux", wm8994_aif3adc_enum);
1550 1555
1551static const struct soc_enum wm8958_aif3adc_enum = 1556static SOC_ENUM_SINGLE_DECL(wm8958_aif3adc_enum,
1552 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 3, 4, aif3adc_text); 1557 WM8994_POWER_MANAGEMENT_6, 3, aif3adc_text);
1553 1558
1554static const struct snd_kcontrol_new wm8958_aif3adc_mux = 1559static const struct snd_kcontrol_new wm8958_aif3adc_mux =
1555 SOC_DAPM_ENUM("AIF3ADC Mux", wm8958_aif3adc_enum); 1560 SOC_DAPM_ENUM("AIF3ADC Mux", wm8958_aif3adc_enum);
@@ -1558,8 +1563,8 @@ static const char *mono_pcm_out_text[] = {
1558 "None", "AIF2ADCL", "AIF2ADCR", 1563 "None", "AIF2ADCL", "AIF2ADCR",
1559}; 1564};
1560 1565
1561static const struct soc_enum mono_pcm_out_enum = 1566static SOC_ENUM_SINGLE_DECL(mono_pcm_out_enum,
1562 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 9, 3, mono_pcm_out_text); 1567 WM8994_POWER_MANAGEMENT_6, 9, mono_pcm_out_text);
1563 1568
1564static const struct snd_kcontrol_new mono_pcm_out_mux = 1569static const struct snd_kcontrol_new mono_pcm_out_mux =
1565 SOC_DAPM_ENUM("Mono PCM Out Mux", mono_pcm_out_enum); 1570 SOC_DAPM_ENUM("Mono PCM Out Mux", mono_pcm_out_enum);
@@ -1569,14 +1574,14 @@ static const char *aif2dac_src_text[] = {
1569}; 1574};
1570 1575
1571/* Note that these two control shouldn't be simultaneously switched to AIF3 */ 1576/* Note that these two control shouldn't be simultaneously switched to AIF3 */
1572static const struct soc_enum aif2dacl_src_enum = 1577static SOC_ENUM_SINGLE_DECL(aif2dacl_src_enum,
1573 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 7, 2, aif2dac_src_text); 1578 WM8994_POWER_MANAGEMENT_6, 7, aif2dac_src_text);
1574 1579
1575static const struct snd_kcontrol_new aif2dacl_src_mux = 1580static const struct snd_kcontrol_new aif2dacl_src_mux =
1576 SOC_DAPM_ENUM("AIF2DACL Mux", aif2dacl_src_enum); 1581 SOC_DAPM_ENUM("AIF2DACL Mux", aif2dacl_src_enum);
1577 1582
1578static const struct soc_enum aif2dacr_src_enum = 1583static SOC_ENUM_SINGLE_DECL(aif2dacr_src_enum,
1579 SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 8, 2, aif2dac_src_text); 1584 WM8994_POWER_MANAGEMENT_6, 8, aif2dac_src_text);
1580 1585
1581static const struct snd_kcontrol_new aif2dacr_src_mux = 1586static const struct snd_kcontrol_new aif2dacr_src_mux =
1582 SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); 1587 SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dc8ff13187f7..b9dc6acbba8c 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1218,7 +1218,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1218 ret = regulator_allow_bypass(w->regulator, false); 1218 ret = regulator_allow_bypass(w->regulator, false);
1219 if (ret != 0) 1219 if (ret != 0)
1220 dev_warn(w->dapm->dev, 1220 dev_warn(w->dapm->dev,
1221 "ASoC: Failed to bypass %s: %d\n", 1221 "ASoC: Failed to unbypass %s: %d\n",
1222 w->name, ret); 1222 w->name, ret);
1223 } 1223 }
1224 1224
@@ -1228,7 +1228,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1228 ret = regulator_allow_bypass(w->regulator, true); 1228 ret = regulator_allow_bypass(w->regulator, true);
1229 if (ret != 0) 1229 if (ret != 0)
1230 dev_warn(w->dapm->dev, 1230 dev_warn(w->dapm->dev,
1231 "ASoC: Failed to unbypass %s: %d\n", 1231 "ASoC: Failed to bypass %s: %d\n",
1232 w->name, ret); 1232 w->name, ret);
1233 } 1233 }
1234 1234
@@ -3210,15 +3210,11 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
3210 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); 3210 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
3211 const char *pin = (const char *)kcontrol->private_value; 3211 const char *pin = (const char *)kcontrol->private_value;
3212 3212
3213 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
3214
3215 if (ucontrol->value.integer.value[0]) 3213 if (ucontrol->value.integer.value[0])
3216 snd_soc_dapm_enable_pin(&card->dapm, pin); 3214 snd_soc_dapm_enable_pin(&card->dapm, pin);
3217 else 3215 else
3218 snd_soc_dapm_disable_pin(&card->dapm, pin); 3216 snd_soc_dapm_disable_pin(&card->dapm, pin);
3219 3217
3220 mutex_unlock(&card->dapm_mutex);
3221
3222 snd_soc_dapm_sync(&card->dapm); 3218 snd_soc_dapm_sync(&card->dapm);
3223 return 0; 3219 return 0;
3224} 3220}
@@ -3248,7 +3244,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3248 ret = regulator_allow_bypass(w->regulator, true); 3244 ret = regulator_allow_bypass(w->regulator, true);
3249 if (ret != 0) 3245 if (ret != 0)
3250 dev_warn(w->dapm->dev, 3246 dev_warn(w->dapm->dev,
3251 "ASoC: Failed to unbypass %s: %d\n", 3247 "ASoC: Failed to bypass %s: %d\n",
3252 w->name, ret); 3248 w->name, ret);
3253 } 3249 }
3254 break; 3250 break;
@@ -3767,23 +3763,52 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
3767} 3763}
3768 3764
3769/** 3765/**
3766 * snd_soc_dapm_enable_pin_unlocked - enable pin.
3767 * @dapm: DAPM context
3768 * @pin: pin name
3769 *
3770 * Enables input/output pin and its parents or children widgets iff there is
3771 * a valid audio route and active audio stream.
3772 *
3773 * Requires external locking.
3774 *
3775 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3776 * do any widget power switching.
3777 */
3778int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
3779 const char *pin)
3780{
3781 return snd_soc_dapm_set_pin(dapm, pin, 1);
3782}
3783EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_unlocked);
3784
3785/**
3770 * snd_soc_dapm_enable_pin - enable pin. 3786 * snd_soc_dapm_enable_pin - enable pin.
3771 * @dapm: DAPM context 3787 * @dapm: DAPM context
3772 * @pin: pin name 3788 * @pin: pin name
3773 * 3789 *
3774 * Enables input/output pin and its parents or children widgets iff there is 3790 * Enables input/output pin and its parents or children widgets iff there is
3775 * a valid audio route and active audio stream. 3791 * a valid audio route and active audio stream.
3792 *
3776 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 3793 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3777 * do any widget power switching. 3794 * do any widget power switching.
3778 */ 3795 */
3779int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) 3796int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin)
3780{ 3797{
3781 return snd_soc_dapm_set_pin(dapm, pin, 1); 3798 int ret;
3799
3800 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
3801
3802 ret = snd_soc_dapm_set_pin(dapm, pin, 1);
3803
3804 mutex_unlock(&dapm->card->dapm_mutex);
3805
3806 return ret;
3782} 3807}
3783EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); 3808EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);
3784 3809
3785/** 3810/**
3786 * snd_soc_dapm_force_enable_pin - force a pin to be enabled 3811 * snd_soc_dapm_force_enable_pin_unlocked - force a pin to be enabled
3787 * @dapm: DAPM context 3812 * @dapm: DAPM context
3788 * @pin: pin name 3813 * @pin: pin name
3789 * 3814 *
@@ -3791,11 +3816,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);
3791 * intended for use with microphone bias supplies used in microphone 3816 * intended for use with microphone bias supplies used in microphone
3792 * jack detection. 3817 * jack detection.
3793 * 3818 *
3819 * Requires external locking.
3820 *
3794 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 3821 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3795 * do any widget power switching. 3822 * do any widget power switching.
3796 */ 3823 */
3797int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, 3824int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
3798 const char *pin) 3825 const char *pin)
3799{ 3826{
3800 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); 3827 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
3801 3828
@@ -3811,25 +3838,103 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
3811 3838
3812 return 0; 3839 return 0;
3813} 3840}
3841EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin_unlocked);
3842
3843/**
3844 * snd_soc_dapm_force_enable_pin - force a pin to be enabled
3845 * @dapm: DAPM context
3846 * @pin: pin name
3847 *
3848 * Enables input/output pin regardless of any other state. This is
3849 * intended for use with microphone bias supplies used in microphone
3850 * jack detection.
3851 *
3852 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3853 * do any widget power switching.
3854 */
3855int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
3856 const char *pin)
3857{
3858 int ret;
3859
3860 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
3861
3862 ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin);
3863
3864 mutex_unlock(&dapm->card->dapm_mutex);
3865
3866 return ret;
3867}
3814EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); 3868EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);
3815 3869
3816/** 3870/**
3871 * snd_soc_dapm_disable_pin_unlocked - disable pin.
3872 * @dapm: DAPM context
3873 * @pin: pin name
3874 *
3875 * Disables input/output pin and its parents or children widgets.
3876 *
3877 * Requires external locking.
3878 *
3879 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3880 * do any widget power switching.
3881 */
3882int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm,
3883 const char *pin)
3884{
3885 return snd_soc_dapm_set_pin(dapm, pin, 0);
3886}
3887EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin_unlocked);
3888
3889/**
3817 * snd_soc_dapm_disable_pin - disable pin. 3890 * snd_soc_dapm_disable_pin - disable pin.
3818 * @dapm: DAPM context 3891 * @dapm: DAPM context
3819 * @pin: pin name 3892 * @pin: pin name
3820 * 3893 *
3821 * Disables input/output pin and its parents or children widgets. 3894 * Disables input/output pin and its parents or children widgets.
3895 *
3822 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to 3896 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3823 * do any widget power switching. 3897 * do any widget power switching.
3824 */ 3898 */
3825int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, 3899int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
3826 const char *pin) 3900 const char *pin)
3827{ 3901{
3828 return snd_soc_dapm_set_pin(dapm, pin, 0); 3902 int ret;
3903
3904 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
3905
3906 ret = snd_soc_dapm_set_pin(dapm, pin, 0);
3907
3908 mutex_unlock(&dapm->card->dapm_mutex);
3909
3910 return ret;
3829} 3911}
3830EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); 3912EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin);
3831 3913
3832/** 3914/**
3915 * snd_soc_dapm_nc_pin_unlocked - permanently disable pin.
3916 * @dapm: DAPM context
3917 * @pin: pin name
3918 *
3919 * Marks the specified pin as being not connected, disabling it along
3920 * any parent or child widgets. At present this is identical to
3921 * snd_soc_dapm_disable_pin() but in future it will be extended to do
3922 * additional things such as disabling controls which only affect
3923 * paths through the pin.
3924 *
3925 * Requires external locking.
3926 *
3927 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
3928 * do any widget power switching.
3929 */
3930int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
3931 const char *pin)
3932{
3933 return snd_soc_dapm_set_pin(dapm, pin, 0);
3934}
3935EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin_unlocked);
3936
3937/**
3833 * snd_soc_dapm_nc_pin - permanently disable pin. 3938 * snd_soc_dapm_nc_pin - permanently disable pin.
3834 * @dapm: DAPM context 3939 * @dapm: DAPM context
3835 * @pin: pin name 3940 * @pin: pin name
@@ -3845,7 +3950,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin);
3845 */ 3950 */
3846int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) 3951int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin)
3847{ 3952{
3848 return snd_soc_dapm_set_pin(dapm, pin, 0); 3953 int ret;
3954
3955 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
3956
3957 ret = snd_soc_dapm_set_pin(dapm, pin, 0);
3958
3959 mutex_unlock(&dapm->card->dapm_mutex);
3960
3961 return ret;
3849} 3962}
3850EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); 3963EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin);
3851 3964