aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8994.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-01 18:29:04 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-01 18:29:04 -0500
commitc496ccd5dbd8bd25a8817bc2a901adec153a41e1 (patch)
treea8881fbe1b6ee31ba6e937367775a98aacf401dc /sound/soc/codecs/wm8994.c
parente1412e636eeb84023b79e525909b366a9b28a185 (diff)
parent04d286819ba499839d04cbf847f2ea28d5cf4296 (diff)
Merge branch 'for-2.6.38' into for-2.6.39
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r--sound/soc/codecs/wm8994.c51
1 files changed, 42 insertions, 9 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 0dc14115f109..b17ac1971b0d 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -109,6 +109,9 @@ struct wm8994_priv {
109 109
110 unsigned int aif1clk_enable:1; 110 unsigned int aif1clk_enable:1;
111 unsigned int aif2clk_enable:1; 111 unsigned int aif2clk_enable:1;
112
113 unsigned int aif1clk_disable:1;
114 unsigned int aif2clk_disable:1;
112}; 115};
113 116
114static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) 117static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg)
@@ -1014,14 +1017,18 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w,
1014 1017
1015 switch (event) { 1018 switch (event) {
1016 case SND_SOC_DAPM_PRE_PMU: 1019 case SND_SOC_DAPM_PRE_PMU:
1017 if (wm8994->aif1clk_enable) 1020 if (wm8994->aif1clk_enable) {
1018 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1021 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1019 WM8994_AIF1CLK_ENA_MASK, 1022 WM8994_AIF1CLK_ENA_MASK,
1020 WM8994_AIF1CLK_ENA); 1023 WM8994_AIF1CLK_ENA);
1021 if (wm8994->aif2clk_enable) 1024 wm8994->aif1clk_enable = 0;
1025 }
1026 if (wm8994->aif2clk_enable) {
1022 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1027 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1023 WM8994_AIF2CLK_ENA_MASK, 1028 WM8994_AIF2CLK_ENA_MASK,
1024 WM8994_AIF2CLK_ENA); 1029 WM8994_AIF2CLK_ENA);
1030 wm8994->aif2clk_enable = 0;
1031 }
1025 break; 1032 break;
1026 } 1033 }
1027 1034
@@ -1036,15 +1043,15 @@ static int late_disable_ev(struct snd_soc_dapm_widget *w,
1036 1043
1037 switch (event) { 1044 switch (event) {
1038 case SND_SOC_DAPM_POST_PMD: 1045 case SND_SOC_DAPM_POST_PMD:
1039 if (wm8994->aif1clk_enable) { 1046 if (wm8994->aif1clk_disable) {
1040 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1047 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1041 WM8994_AIF1CLK_ENA_MASK, 0); 1048 WM8994_AIF1CLK_ENA_MASK, 0);
1042 wm8994->aif1clk_enable = 0; 1049 wm8994->aif1clk_disable = 0;
1043 } 1050 }
1044 if (wm8994->aif2clk_enable) { 1051 if (wm8994->aif2clk_disable) {
1045 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1052 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1046 WM8994_AIF2CLK_ENA_MASK, 0); 1053 WM8994_AIF2CLK_ENA_MASK, 0);
1047 wm8994->aif2clk_enable = 0; 1054 wm8994->aif2clk_disable = 0;
1048 } 1055 }
1049 break; 1056 break;
1050 } 1057 }
@@ -1062,6 +1069,9 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1062 case SND_SOC_DAPM_PRE_PMU: 1069 case SND_SOC_DAPM_PRE_PMU:
1063 wm8994->aif1clk_enable = 1; 1070 wm8994->aif1clk_enable = 1;
1064 break; 1071 break;
1072 case SND_SOC_DAPM_POST_PMD:
1073 wm8994->aif1clk_disable = 1;
1074 break;
1065 } 1075 }
1066 1076
1067 return 0; 1077 return 0;
@@ -1077,11 +1087,21 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1077 case SND_SOC_DAPM_PRE_PMU: 1087 case SND_SOC_DAPM_PRE_PMU:
1078 wm8994->aif2clk_enable = 1; 1088 wm8994->aif2clk_enable = 1;
1079 break; 1089 break;
1090 case SND_SOC_DAPM_POST_PMD:
1091 wm8994->aif2clk_disable = 1;
1092 break;
1080 } 1093 }
1081 1094
1082 return 0; 1095 return 0;
1083} 1096}
1084 1097
1098static int adc_mux_ev(struct snd_soc_dapm_widget *w,
1099 struct snd_kcontrol *kcontrol, int event)
1100{
1101 late_enable_ev(w, kcontrol, event);
1102 return 0;
1103}
1104
1085static int dac_ev(struct snd_soc_dapm_widget *w, 1105static int dac_ev(struct snd_soc_dapm_widget *w,
1086 struct snd_kcontrol *kcontrol, int event) 1106 struct snd_kcontrol *kcontrol, int event)
1087{ 1107{
@@ -1402,6 +1422,18 @@ SND_SOC_DAPM_DAC("DAC1L", NULL, WM8994_POWER_MANAGEMENT_5, 1, 0),
1402SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), 1422SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0),
1403}; 1423};
1404 1424
1425static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = {
1426SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux,
1427 adc_mux_ev, SND_SOC_DAPM_PRE_PMU),
1428SND_SOC_DAPM_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux,
1429 adc_mux_ev, SND_SOC_DAPM_PRE_PMU),
1430};
1431
1432static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = {
1433SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux),
1434SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux),
1435};
1436
1405static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { 1437static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = {
1406SND_SOC_DAPM_INPUT("DMIC1DAT"), 1438SND_SOC_DAPM_INPUT("DMIC1DAT"),
1407SND_SOC_DAPM_INPUT("DMIC2DAT"), 1439SND_SOC_DAPM_INPUT("DMIC2DAT"),
@@ -1496,9 +1528,6 @@ SND_SOC_DAPM_ADC("DMIC1R", NULL, WM8994_POWER_MANAGEMENT_4, 2, 0),
1496SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0), 1528SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0),
1497SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), 1529SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0),
1498 1530
1499SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux),
1500SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux),
1501
1502SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), 1531SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux),
1503SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), 1532SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux),
1504 1533
@@ -3269,11 +3298,15 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3269 if (wm8994->revision < 4) { 3298 if (wm8994->revision < 4) {
3270 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_revd_widgets, 3299 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_revd_widgets,
3271 ARRAY_SIZE(wm8994_lateclk_revd_widgets)); 3300 ARRAY_SIZE(wm8994_lateclk_revd_widgets));
3301 snd_soc_dapm_new_controls(dapm, wm8994_adc_revd_widgets,
3302 ARRAY_SIZE(wm8994_adc_revd_widgets));
3272 snd_soc_dapm_new_controls(dapm, wm8994_dac_revd_widgets, 3303 snd_soc_dapm_new_controls(dapm, wm8994_dac_revd_widgets,
3273 ARRAY_SIZE(wm8994_dac_revd_widgets)); 3304 ARRAY_SIZE(wm8994_dac_revd_widgets));
3274 } else { 3305 } else {
3275 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets, 3306 snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets,
3276 ARRAY_SIZE(wm8994_lateclk_widgets)); 3307 ARRAY_SIZE(wm8994_lateclk_widgets));
3308 snd_soc_dapm_new_controls(dapm, wm8994_adc_widgets,
3309 ARRAY_SIZE(wm8994_adc_widgets));
3277 snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets, 3310 snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets,
3278 ARRAY_SIZE(wm8994_dac_widgets)); 3311 ARRAY_SIZE(wm8994_dac_widgets));
3279 } 3312 }