aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8994.c51
-rw-r--r--sound/soc/codecs/wm9081.c5
2 files changed, 47 insertions, 9 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index ebaee5ca7434..4afbe3b2e443 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -110,6 +110,9 @@ struct wm8994_priv {
110 110
111 unsigned int aif1clk_enable:1; 111 unsigned int aif1clk_enable:1;
112 unsigned int aif2clk_enable:1; 112 unsigned int aif2clk_enable:1;
113
114 unsigned int aif1clk_disable:1;
115 unsigned int aif2clk_disable:1;
113}; 116};
114 117
115static int wm8994_readable(unsigned int reg) 118static int wm8994_readable(unsigned int reg)
@@ -1015,14 +1018,18 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w,
1015 1018
1016 switch (event) { 1019 switch (event) {
1017 case SND_SOC_DAPM_PRE_PMU: 1020 case SND_SOC_DAPM_PRE_PMU:
1018 if (wm8994->aif1clk_enable) 1021 if (wm8994->aif1clk_enable) {
1019 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1022 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1020 WM8994_AIF1CLK_ENA_MASK, 1023 WM8994_AIF1CLK_ENA_MASK,
1021 WM8994_AIF1CLK_ENA); 1024 WM8994_AIF1CLK_ENA);
1022 if (wm8994->aif2clk_enable) 1025 wm8994->aif1clk_enable = 0;
1026 }
1027 if (wm8994->aif2clk_enable) {
1023 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1028 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1024 WM8994_AIF2CLK_ENA_MASK, 1029 WM8994_AIF2CLK_ENA_MASK,
1025 WM8994_AIF2CLK_ENA); 1030 WM8994_AIF2CLK_ENA);
1031 wm8994->aif2clk_enable = 0;
1032 }
1026 break; 1033 break;
1027 } 1034 }
1028 1035
@@ -1037,15 +1044,15 @@ static int late_disable_ev(struct snd_soc_dapm_widget *w,
1037 1044
1038 switch (event) { 1045 switch (event) {
1039 case SND_SOC_DAPM_POST_PMD: 1046 case SND_SOC_DAPM_POST_PMD:
1040 if (wm8994->aif1clk_enable) { 1047 if (wm8994->aif1clk_disable) {
1041 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1048 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1042 WM8994_AIF1CLK_ENA_MASK, 0); 1049 WM8994_AIF1CLK_ENA_MASK, 0);
1043 wm8994->aif1clk_enable = 0; 1050 wm8994->aif1clk_disable = 0;
1044 } 1051 }
1045 if (wm8994->aif2clk_enable) { 1052 if (wm8994->aif2clk_disable) {
1046 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1053 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1047 WM8994_AIF2CLK_ENA_MASK, 0); 1054 WM8994_AIF2CLK_ENA_MASK, 0);
1048 wm8994->aif2clk_enable = 0; 1055 wm8994->aif2clk_disable = 0;
1049 } 1056 }
1050 break; 1057 break;
1051 } 1058 }
@@ -1063,6 +1070,9 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1063 case SND_SOC_DAPM_PRE_PMU: 1070 case SND_SOC_DAPM_PRE_PMU:
1064 wm8994->aif1clk_enable = 1; 1071 wm8994->aif1clk_enable = 1;
1065 break; 1072 break;
1073 case SND_SOC_DAPM_POST_PMD:
1074 wm8994->aif1clk_disable = 1;
1075 break;
1066 } 1076 }
1067 1077
1068 return 0; 1078 return 0;
@@ -1078,11 +1088,21 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1078 case SND_SOC_DAPM_PRE_PMU: 1088 case SND_SOC_DAPM_PRE_PMU:
1079 wm8994->aif2clk_enable = 1; 1089 wm8994->aif2clk_enable = 1;
1080 break; 1090 break;
1091 case SND_SOC_DAPM_POST_PMD:
1092 wm8994->aif2clk_disable = 1;
1093 break;
1081 } 1094 }
1082 1095
1083 return 0; 1096 return 0;
1084} 1097}
1085 1098
1099static int adc_mux_ev(struct snd_soc_dapm_widget *w,
1100 struct snd_kcontrol *kcontrol, int event)
1101{
1102 late_enable_ev(w, kcontrol, event);
1103 return 0;
1104}
1105
1086static int dac_ev(struct snd_soc_dapm_widget *w, 1106static int dac_ev(struct snd_soc_dapm_widget *w,
1087 struct snd_kcontrol *kcontrol, int event) 1107 struct snd_kcontrol *kcontrol, int event)
1088{ 1108{
@@ -1403,6 +1423,18 @@ SND_SOC_DAPM_DAC("DAC1L", NULL, WM8994_POWER_MANAGEMENT_5, 1, 0),
1403SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), 1423SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0),
1404}; 1424};
1405 1425
1426static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = {
1427SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux,
1428 adc_mux_ev, SND_SOC_DAPM_PRE_PMU),
1429SND_SOC_DAPM_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux,
1430 adc_mux_ev, SND_SOC_DAPM_PRE_PMU),
1431};
1432
1433static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = {
1434SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux),
1435SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux),
1436};
1437
1406static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { 1438static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = {
1407SND_SOC_DAPM_INPUT("DMIC1DAT"), 1439SND_SOC_DAPM_INPUT("DMIC1DAT"),
1408SND_SOC_DAPM_INPUT("DMIC2DAT"), 1440SND_SOC_DAPM_INPUT("DMIC2DAT"),
@@ -1497,9 +1529,6 @@ SND_SOC_DAPM_ADC("DMIC1R", NULL, WM8994_POWER_MANAGEMENT_4, 2, 0),
1497SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0), 1529SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0),
1498SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), 1530SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0),
1499 1531
1500SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux),
1501SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux),
1502
1503SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), 1532SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux),
1504SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), 1533SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux),
1505 1534
@@ -3280,11 +3309,15 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3280 if (wm8994->revision < 4) { 3309 if (wm8994->revision < 4) {
3281 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_revd_widgets, 3310 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_revd_widgets,
3282 ARRAY_SIZE(wm8994_lateclk_revd_widgets)); 3311 ARRAY_SIZE(wm8994_lateclk_revd_widgets));
3312 snd_soc_dapm_new_controls(dapm, wm8994_adc_revd_widgets,
3313 ARRAY_SIZE(wm8994_adc_revd_widgets));
3283 snd_soc_dapm_new_controls(dapm, wm8994_dac_revd_widgets, 3314 snd_soc_dapm_new_controls(dapm, wm8994_dac_revd_widgets,
3284 ARRAY_SIZE(wm8994_dac_revd_widgets)); 3315 ARRAY_SIZE(wm8994_dac_revd_widgets));
3285 } else { 3316 } else {
3286 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets, 3317 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets,
3287 ARRAY_SIZE(wm8994_lateclk_widgets)); 3318 ARRAY_SIZE(wm8994_lateclk_widgets));
3319 snd_soc_dapm_new_controls(dapm, wm8994_adc_widgets,
3320 ARRAY_SIZE(wm8994_adc_widgets));
3288 snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets, 3321 snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets,
3289 ARRAY_SIZE(wm8994_dac_widgets)); 3322 ARRAY_SIZE(wm8994_dac_widgets));
3290 } 3323 }
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index 43825b2102a5..cce704c275c6 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -15,6 +15,7 @@
15#include <linux/moduleparam.h> 15#include <linux/moduleparam.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/device.h>
18#include <linux/pm.h> 19#include <linux/pm.h>
19#include <linux/i2c.h> 20#include <linux/i2c.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -1341,6 +1342,10 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1341 wm9081->control_type = SND_SOC_I2C; 1342 wm9081->control_type = SND_SOC_I2C;
1342 wm9081->control_data = i2c; 1343 wm9081->control_data = i2c;
1343 1344
1345 if (dev_get_platdata(&i2c->dev))
1346 memcpy(&wm9081->retune, dev_get_platdata(&i2c->dev),
1347 sizeof(wm9081->retune));
1348
1344 ret = snd_soc_register_codec(&i2c->dev, 1349 ret = snd_soc_register_codec(&i2c->dev,
1345 &soc_codec_dev_wm9081, &wm9081_dai, 1); 1350 &soc_codec_dev_wm9081, &wm9081_dai, 1);
1346 if (ret < 0) 1351 if (ret < 0)