diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-10 17:26:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-10 17:26:00 -0500 |
commit | 33175d84ee3fa29991adb80513683e010769e807 (patch) | |
tree | 3731f61cf82451b6892cf1368701e57e35d92908 /sound/soc/codecs/wm8994.c | |
parent | c5908939b2738bafe1b309bc2465cb9f2e6184c5 (diff) | |
parent | 6dfbd87a20a737641ef228230c77f4262434fa24 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/bnx2x/bnx2x_cmn.c
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r-- | sound/soc/codecs/wm8994.c | 51 |
1 files changed, 42 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 | ||
115 | static int wm8994_readable(unsigned int reg) | 118 | static 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 | ||
1099 | static 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 | |||
1086 | static int dac_ev(struct snd_soc_dapm_widget *w, | 1106 | static 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), | |||
1403 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | 1423 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), |
1404 | }; | 1424 | }; |
1405 | 1425 | ||
1426 | static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { | ||
1427 | SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, | ||
1428 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | ||
1429 | SND_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 | |||
1433 | static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { | ||
1434 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | ||
1435 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | ||
1436 | }; | ||
1437 | |||
1406 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { | 1438 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { |
1407 | SND_SOC_DAPM_INPUT("DMIC1DAT"), | 1439 | SND_SOC_DAPM_INPUT("DMIC1DAT"), |
1408 | SND_SOC_DAPM_INPUT("DMIC2DAT"), | 1440 | SND_SOC_DAPM_INPUT("DMIC2DAT"), |
@@ -1497,9 +1529,6 @@ SND_SOC_DAPM_ADC("DMIC1R", NULL, WM8994_POWER_MANAGEMENT_4, 2, 0), | |||
1497 | SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0), | 1529 | SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0), |
1498 | SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), | 1530 | SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), |
1499 | 1531 | ||
1500 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | ||
1501 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | ||
1502 | |||
1503 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), | 1532 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), |
1504 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), | 1533 | SND_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 | } |