aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8958-dsp2.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-11 13:13:12 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-18 06:52:50 -0400
commitc6b7b57012c8307b936025ad41fcbef6b1b6b52f (patch)
tree5c92f52155ef595fc0dded01101122de6bdafcc1 /sound/soc/codecs/wm8958-dsp2.c
parentf701a2e594e62b35d895ad5ec1db8d2d0714c158 (diff)
ASoC: Handle startup sequencing of WM8958 DSP2 with deferred clocking
The DSP2 startup requires that the clock be enable so if we've deferred clock startup we need to defer DSP2 startup Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/wm8958-dsp2.c')
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
index 4b4c93c20331..f07775ebec04 100644
--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -69,6 +69,13 @@ static void wm8958_mbc_apply(struct snd_soc_codec *codec, int mbc, int start)
69 if (reg & WM8958_DSP2_ENA) 69 if (reg & WM8958_DSP2_ENA)
70 return; 70 return;
71 71
72 /* If neither AIFnCLK is not yet enabled postpone */
73 if (!(snd_soc_read(codec, WM8994_AIF1_CLOCKING_1)
74 & WM8994_AIF1CLK_ENA_MASK) &&
75 !(snd_soc_read(codec, WM8994_AIF2_CLOCKING_1)
76 & WM8994_AIF2CLK_ENA_MASK))
77 return;
78
72 /* Switch the clock over to the appropriate AIF */ 79 /* Switch the clock over to the appropriate AIF */
73 snd_soc_update_bits(codec, WM8994_CLOCKING_1, 80 snd_soc_update_bits(codec, WM8994_CLOCKING_1,
74 WM8958_DSP2CLK_SRC | WM8958_DSP2CLK_ENA, 81 WM8958_DSP2CLK_SRC | WM8958_DSP2CLK_ENA,
@@ -120,32 +127,18 @@ int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
120 struct snd_kcontrol *kcontrol, int event) 127 struct snd_kcontrol *kcontrol, int event)
121{ 128{
122 struct snd_soc_codec *codec = w->codec; 129 struct snd_soc_codec *codec = w->codec;
123 int mbc; 130 int i;
124
125 switch (w->shift) {
126 case 13:
127 case 12:
128 mbc = 2;
129 break;
130 case 11:
131 case 10:
132 mbc = 1;
133 break;
134 case 9:
135 case 8:
136 mbc = 0;
137 break;
138 default:
139 BUG();
140 return -EINVAL;
141 }
142 131
143 switch (event) { 132 switch (event) {
144 case SND_SOC_DAPM_POST_PMU: 133 case SND_SOC_DAPM_POST_PMU:
145 wm8958_mbc_apply(codec, mbc, 1); 134 case SND_SOC_DAPM_PRE_PMU:
135 for (i = 0; i < 3; i++)
136 wm8958_mbc_apply(codec, i, 1);
146 break; 137 break;
147 case SND_SOC_DAPM_POST_PMD: 138 case SND_SOC_DAPM_POST_PMD:
148 wm8958_mbc_apply(codec, mbc, 0); 139 case SND_SOC_DAPM_PRE_PMD:
140 for (i = 0; i < 3; i++)
141 wm8958_mbc_apply(codec, i, 0);
149 break; 142 break;
150 } 143 }
151 144