diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-18 13:20:05 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-18 13:20:58 -0400 |
commit | 0cbe4b36b075e80f3149a91ef640bc7930aa94c7 (patch) | |
tree | 68427259dfadb1bf74adde246eb9ed072d1d2891 /sound/soc/samsung | |
parent | 8c5b842b8352494d4a258311866b6dc7c2cb11eb (diff) |
ASoC: samsung: Hook up AIF2 to the CODEC on Littlemill
Connect the WM1250-EV1 baseband simulator on Littlemill systems up to
the CODEC AIF2 using the new CODEC<->CODEC link support, allowing a wider
range of use cases to be represented.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r-- | sound/soc/samsung/littlemill.c | 82 |
1 files changed, 70 insertions, 12 deletions
diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index e7416851bf7d..fd5ac47371a1 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c | |||
@@ -23,10 +23,10 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, | |||
23 | struct snd_soc_dapm_context *dapm, | 23 | struct snd_soc_dapm_context *dapm, |
24 | enum snd_soc_bias_level level) | 24 | enum snd_soc_bias_level level) |
25 | { | 25 | { |
26 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | 26 | struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; |
27 | int ret; | 27 | int ret; |
28 | 28 | ||
29 | if (dapm->dev != codec_dai->dev) | 29 | if (dapm->dev != aif1_dai->dev) |
30 | return 0; | 30 | return 0; |
31 | 31 | ||
32 | switch (level) { | 32 | switch (level) { |
@@ -36,7 +36,7 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, | |||
36 | * then do so now, otherwise these are noops. | 36 | * then do so now, otherwise these are noops. |
37 | */ | 37 | */ |
38 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { | 38 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { |
39 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, | 39 | ret = snd_soc_dai_set_pll(aif1_dai, WM8994_FLL1, |
40 | WM8994_FLL_SRC_MCLK2, 32768, | 40 | WM8994_FLL_SRC_MCLK2, 32768, |
41 | sample_rate * 512); | 41 | sample_rate * 512); |
42 | if (ret < 0) { | 42 | if (ret < 0) { |
@@ -44,7 +44,7 @@ static int littlemill_set_bias_level(struct snd_soc_card *card, | |||
44 | return ret; | 44 | return ret; |
45 | } | 45 | } |
46 | 46 | ||
47 | ret = snd_soc_dai_set_sysclk(codec_dai, | 47 | ret = snd_soc_dai_set_sysclk(aif1_dai, |
48 | WM8994_SYSCLK_FLL1, | 48 | WM8994_SYSCLK_FLL1, |
49 | sample_rate * 512, | 49 | sample_rate * 512, |
50 | SND_SOC_CLOCK_IN); | 50 | SND_SOC_CLOCK_IN); |
@@ -66,25 +66,58 @@ static int littlemill_set_bias_level_post(struct snd_soc_card *card, | |||
66 | struct snd_soc_dapm_context *dapm, | 66 | struct snd_soc_dapm_context *dapm, |
67 | enum snd_soc_bias_level level) | 67 | enum snd_soc_bias_level level) |
68 | { | 68 | { |
69 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | 69 | struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; |
70 | struct snd_soc_dai *aif2_dai = card->rtd[1].cpu_dai; | ||
70 | int ret; | 71 | int ret; |
71 | 72 | ||
72 | if (dapm->dev != codec_dai->dev) | 73 | if (dapm->dev != aif1_dai->dev) |
73 | return 0; | 74 | return 0; |
74 | 75 | ||
75 | switch (level) { | 76 | switch (level) { |
76 | case SND_SOC_BIAS_STANDBY: | 77 | case SND_SOC_BIAS_STANDBY: |
77 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2, | 78 | ret = snd_soc_dai_set_sysclk(aif2_dai, WM8994_SYSCLK_MCLK2, |
78 | 32768, SND_SOC_CLOCK_IN); | 79 | 32768, SND_SOC_CLOCK_IN); |
79 | if (ret < 0) { | 80 | if (ret < 0) { |
80 | pr_err("Failed to switch away from FLL: %d\n", ret); | 81 | pr_err("Failed to switch away from FLL2: %d\n", ret); |
81 | return ret; | 82 | return ret; |
82 | } | 83 | } |
83 | 84 | ||
84 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, | 85 | ret = snd_soc_dai_set_pll(aif2_dai, WM8994_FLL2, |
85 | 0, 0, 0); | 86 | 0, 0, 0); |
86 | if (ret < 0) { | 87 | if (ret < 0) { |
87 | pr_err("Failed to stop FLL: %d\n", ret); | 88 | pr_err("Failed to stop FLL2: %d\n", ret); |
89 | return ret; | ||
90 | } | ||
91 | |||
92 | ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2, | ||
93 | 32768, SND_SOC_CLOCK_IN); | ||
94 | if (ret < 0) { | ||
95 | pr_err("Failed to switch away from FLL1: %d\n", ret); | ||
96 | return ret; | ||
97 | } | ||
98 | |||
99 | ret = snd_soc_dai_set_pll(aif1_dai, WM8994_FLL1, | ||
100 | 0, 0, 0); | ||
101 | if (ret < 0) { | ||
102 | pr_err("Failed to stop FLL1: %d\n", ret); | ||
103 | return ret; | ||
104 | } | ||
105 | break; | ||
106 | |||
107 | case SND_SOC_BIAS_PREPARE: | ||
108 | ret = snd_soc_dai_set_pll(aif2_dai, WM8994_FLL2, | ||
109 | WM8994_FLL_SRC_BCLK, 64 * 8000, | ||
110 | 8000 * 256); | ||
111 | if (ret < 0) { | ||
112 | pr_err("Failed to start FLL: %d\n", ret); | ||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | ret = snd_soc_dai_set_sysclk(aif2_dai, WM8994_SYSCLK_FLL2, | ||
117 | 8000 * 256, | ||
118 | SND_SOC_CLOCK_IN); | ||
119 | if (ret < 0) { | ||
120 | pr_err("Failed to set SYSCLK: %d\n", ret); | ||
88 | return ret; | 121 | return ret; |
89 | } | 122 | } |
90 | break; | 123 | break; |
@@ -131,6 +164,14 @@ static struct snd_soc_ops littlemill_ops = { | |||
131 | .hw_params = littlemill_hw_params, | 164 | .hw_params = littlemill_hw_params, |
132 | }; | 165 | }; |
133 | 166 | ||
167 | static const struct snd_soc_pcm_stream baseband_params = { | ||
168 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | ||
169 | .rate_min = 8000, | ||
170 | .rate_max = 8000, | ||
171 | .channels_min = 2, | ||
172 | .channels_max = 2, | ||
173 | }; | ||
174 | |||
134 | static struct snd_soc_dai_link littlemill_dai[] = { | 175 | static struct snd_soc_dai_link littlemill_dai[] = { |
135 | { | 176 | { |
136 | .name = "CPU", | 177 | .name = "CPU", |
@@ -143,6 +184,17 @@ static struct snd_soc_dai_link littlemill_dai[] = { | |||
143 | | SND_SOC_DAIFMT_CBM_CFM, | 184 | | SND_SOC_DAIFMT_CBM_CFM, |
144 | .ops = &littlemill_ops, | 185 | .ops = &littlemill_ops, |
145 | }, | 186 | }, |
187 | { | ||
188 | .name = "Baseband", | ||
189 | .stream_name = "Baseband", | ||
190 | .cpu_dai_name = "wm8994-aif2", | ||
191 | .codec_dai_name = "wm1250-ev1", | ||
192 | .codec_name = "wm1250-ev1.1-0027", | ||
193 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ||
194 | | SND_SOC_DAIFMT_CBM_CFM, | ||
195 | .ignore_suspend = 1, | ||
196 | .params = &baseband_params, | ||
197 | }, | ||
146 | }; | 198 | }; |
147 | 199 | ||
148 | static struct snd_soc_dapm_widget widgets[] = { | 200 | static struct snd_soc_dapm_widget widgets[] = { |
@@ -169,10 +221,16 @@ static struct snd_soc_jack littlemill_headset; | |||
169 | static int littlemill_late_probe(struct snd_soc_card *card) | 221 | static int littlemill_late_probe(struct snd_soc_card *card) |
170 | { | 222 | { |
171 | struct snd_soc_codec *codec = card->rtd[0].codec; | 223 | struct snd_soc_codec *codec = card->rtd[0].codec; |
172 | struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; | 224 | struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; |
225 | struct snd_soc_dai *aif2_dai = card->rtd[1].cpu_dai; | ||
173 | int ret; | 226 | int ret; |
174 | 227 | ||
175 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2, | 228 | ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2, |
229 | 32768, SND_SOC_CLOCK_IN); | ||
230 | if (ret < 0) | ||
231 | return ret; | ||
232 | |||
233 | ret = snd_soc_dai_set_sysclk(aif2_dai, WM8994_SYSCLK_MCLK2, | ||
176 | 32768, SND_SOC_CLOCK_IN); | 234 | 32768, SND_SOC_CLOCK_IN); |
177 | if (ret < 0) | 235 | if (ret < 0) |
178 | return ret; | 236 | return ret; |