diff options
Diffstat (limited to 'sound/soc/davinci/davinci-evm.c')
-rw-r--r-- | sound/soc/davinci/davinci-evm.c | 109 |
1 files changed, 36 insertions, 73 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 97f74d6a33e6..2b07b17a6b2d 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
@@ -28,12 +28,9 @@ | |||
28 | #include <mach/mux.h> | 28 | #include <mach/mux.h> |
29 | 29 | ||
30 | #include "../codecs/tlv320aic3x.h" | 30 | #include "../codecs/tlv320aic3x.h" |
31 | #include "../codecs/cq93vc.h" | ||
32 | #include "../codecs/spdif_transciever.h" | ||
33 | #include "davinci-pcm.h" | 31 | #include "davinci-pcm.h" |
34 | #include "davinci-i2s.h" | 32 | #include "davinci-i2s.h" |
35 | #include "davinci-mcasp.h" | 33 | #include "davinci-mcasp.h" |
36 | #include "davinci-vcif.h" | ||
37 | 34 | ||
38 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ | 35 | #define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \ |
39 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) | 36 | SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF) |
@@ -41,8 +38,8 @@ static int evm_hw_params(struct snd_pcm_substream *substream, | |||
41 | struct snd_pcm_hw_params *params) | 38 | struct snd_pcm_hw_params *params) |
42 | { | 39 | { |
43 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 40 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
44 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 41 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
45 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 42 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
46 | int ret = 0; | 43 | int ret = 0; |
47 | unsigned sysclk; | 44 | unsigned sysclk; |
48 | 45 | ||
@@ -87,7 +84,7 @@ static int evm_spdif_hw_params(struct snd_pcm_substream *substream, | |||
87 | struct snd_pcm_hw_params *params) | 84 | struct snd_pcm_hw_params *params) |
88 | { | 85 | { |
89 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 86 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
90 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 87 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
91 | 88 | ||
92 | /* set cpu DAI configuration */ | 89 | /* set cpu DAI configuration */ |
93 | return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); | 90 | return snd_soc_dai_set_fmt(cpu_dai, AUDIO_FORMAT); |
@@ -132,8 +129,10 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
132 | }; | 129 | }; |
133 | 130 | ||
134 | /* Logic for a aic3x as connected on a davinci-evm */ | 131 | /* Logic for a aic3x as connected on a davinci-evm */ |
135 | static int evm_aic3x_init(struct snd_soc_codec *codec) | 132 | static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) |
136 | { | 133 | { |
134 | struct snd_soc_codec *codec = rtd->codec; | ||
135 | |||
137 | /* Add davinci-evm specific widgets */ | 136 | /* Add davinci-evm specific widgets */ |
138 | snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, | 137 | snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, |
139 | ARRAY_SIZE(aic3x_dapm_widgets)); | 138 | ARRAY_SIZE(aic3x_dapm_widgets)); |
@@ -161,8 +160,10 @@ static int evm_aic3x_init(struct snd_soc_codec *codec) | |||
161 | static struct snd_soc_dai_link evm_dai = { | 160 | static struct snd_soc_dai_link evm_dai = { |
162 | .name = "TLV320AIC3X", | 161 | .name = "TLV320AIC3X", |
163 | .stream_name = "AIC3X", | 162 | .stream_name = "AIC3X", |
164 | .cpu_dai = &davinci_i2s_dai, | 163 | .cpu_dai_name = "davinci-mcasp.0", |
165 | .codec_dai = &aic3x_dai, | 164 | .codec_dai_name = "tlv320aic3x-hifi", |
165 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
166 | .platform_name = "davinci-pcm-audio", | ||
166 | .init = evm_aic3x_init, | 167 | .init = evm_aic3x_init, |
167 | .ops = &evm_ops, | 168 | .ops = &evm_ops, |
168 | }; | 169 | }; |
@@ -171,40 +172,49 @@ static struct snd_soc_dai_link dm365_evm_dai = { | |||
171 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC | 172 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC |
172 | .name = "TLV320AIC3X", | 173 | .name = "TLV320AIC3X", |
173 | .stream_name = "AIC3X", | 174 | .stream_name = "AIC3X", |
174 | .cpu_dai = &davinci_i2s_dai, | 175 | .cpu_dai_name = "davinci-i2s", |
175 | .codec_dai = &aic3x_dai, | 176 | .codec_dai_name = "tlv320aic3x-hifi", |
176 | .init = evm_aic3x_init, | 177 | .init = evm_aic3x_init, |
178 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
177 | .ops = &evm_ops, | 179 | .ops = &evm_ops, |
178 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) | 180 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) |
179 | .name = "Voice Codec - CQ93VC", | 181 | .name = "Voice Codec - CQ93VC", |
180 | .stream_name = "CQ93", | 182 | .stream_name = "CQ93", |
181 | .cpu_dai = &davinci_vcif_dai, | 183 | .cpu_dai_name = "davinci-vcif", |
182 | .codec_dai = &cq93vc_dai, | 184 | .codec_dai_name = "cq93vc-hifi", |
185 | .codec_name = "cq93vc-codec", | ||
183 | #endif | 186 | #endif |
187 | .platform_name = "davinci-pcm-audio", | ||
184 | }; | 188 | }; |
185 | 189 | ||
186 | static struct snd_soc_dai_link dm6467_evm_dai[] = { | 190 | static struct snd_soc_dai_link dm6467_evm_dai[] = { |
187 | { | 191 | { |
188 | .name = "TLV320AIC3X", | 192 | .name = "TLV320AIC3X", |
189 | .stream_name = "AIC3X", | 193 | .stream_name = "AIC3X", |
190 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], | 194 | .cpu_dai_name= "davinci-mcasp.0", |
191 | .codec_dai = &aic3x_dai, | 195 | .codec_dai_name = "tlv320aic3x-hifi", |
196 | .platform_name ="davinci-pcm-audio", | ||
197 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
192 | .init = evm_aic3x_init, | 198 | .init = evm_aic3x_init, |
193 | .ops = &evm_ops, | 199 | .ops = &evm_ops, |
194 | }, | 200 | }, |
195 | { | 201 | { |
196 | .name = "McASP", | 202 | .name = "McASP", |
197 | .stream_name = "spdif", | 203 | .stream_name = "spdif", |
198 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_DIT_DAI], | 204 | .cpu_dai_name= "davinci-mcasp.1", |
199 | .codec_dai = &dit_stub_dai, | 205 | .codec_dai_name = "dit-hifi", |
206 | .codec_name = "spdif_dit", | ||
207 | .platform_name = "davinci-pcm-audio", | ||
200 | .ops = &evm_spdif_ops, | 208 | .ops = &evm_spdif_ops, |
201 | }, | 209 | }, |
202 | }; | 210 | }; |
203 | static struct snd_soc_dai_link da8xx_evm_dai = { | 211 | static struct snd_soc_dai_link da8xx_evm_dai = { |
204 | .name = "TLV320AIC3X", | 212 | .name = "TLV320AIC3X", |
205 | .stream_name = "AIC3X", | 213 | .stream_name = "AIC3X", |
206 | .cpu_dai = &davinci_mcasp_dai[DAVINCI_MCASP_I2S_DAI], | 214 | .cpu_dai_name= "davinci-mcasp.0", |
207 | .codec_dai = &aic3x_dai, | 215 | .codec_dai_name = "tlv320aic3x-hifi", |
216 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
217 | .platform_name = "davinci-pcm-audio", | ||
208 | .init = evm_aic3x_init, | 218 | .init = evm_aic3x_init, |
209 | .ops = &evm_ops, | 219 | .ops = &evm_ops, |
210 | }; | 220 | }; |
@@ -212,7 +222,6 @@ static struct snd_soc_dai_link da8xx_evm_dai = { | |||
212 | /* davinci dm6446, dm355 evm audio machine driver */ | 222 | /* davinci dm6446, dm355 evm audio machine driver */ |
213 | static struct snd_soc_card snd_soc_card_evm = { | 223 | static struct snd_soc_card snd_soc_card_evm = { |
214 | .name = "DaVinci EVM", | 224 | .name = "DaVinci EVM", |
215 | .platform = &davinci_soc_platform, | ||
216 | .dai_link = &evm_dai, | 225 | .dai_link = &evm_dai, |
217 | .num_links = 1, | 226 | .num_links = 1, |
218 | }; | 227 | }; |
@@ -220,16 +229,13 @@ static struct snd_soc_card snd_soc_card_evm = { | |||
220 | /* davinci dm365 evm audio machine driver */ | 229 | /* davinci dm365 evm audio machine driver */ |
221 | static struct snd_soc_card dm365_snd_soc_card_evm = { | 230 | static struct snd_soc_card dm365_snd_soc_card_evm = { |
222 | .name = "DaVinci DM365 EVM", | 231 | .name = "DaVinci DM365 EVM", |
223 | .platform = &davinci_soc_platform, | ||
224 | .dai_link = &dm365_evm_dai, | 232 | .dai_link = &dm365_evm_dai, |
225 | .num_links = 1, | 233 | .num_links = 1, |
226 | }; | 234 | }; |
227 | 235 | ||
228 | |||
229 | /* davinci dm6467 evm audio machine driver */ | 236 | /* davinci dm6467 evm audio machine driver */ |
230 | static struct snd_soc_card dm6467_snd_soc_card_evm = { | 237 | static struct snd_soc_card dm6467_snd_soc_card_evm = { |
231 | .name = "DaVinci DM6467 EVM", | 238 | .name = "DaVinci DM6467 EVM", |
232 | .platform = &davinci_soc_platform, | ||
233 | .dai_link = dm6467_evm_dai, | 239 | .dai_link = dm6467_evm_dai, |
234 | .num_links = ARRAY_SIZE(dm6467_evm_dai), | 240 | .num_links = ARRAY_SIZE(dm6467_evm_dai), |
235 | }; | 241 | }; |
@@ -237,82 +243,40 @@ static struct snd_soc_card dm6467_snd_soc_card_evm = { | |||
237 | static struct snd_soc_card da830_snd_soc_card = { | 243 | static struct snd_soc_card da830_snd_soc_card = { |
238 | .name = "DA830/OMAP-L137 EVM", | 244 | .name = "DA830/OMAP-L137 EVM", |
239 | .dai_link = &da8xx_evm_dai, | 245 | .dai_link = &da8xx_evm_dai, |
240 | .platform = &davinci_soc_platform, | ||
241 | .num_links = 1, | 246 | .num_links = 1, |
242 | }; | 247 | }; |
243 | 248 | ||
244 | static struct snd_soc_card da850_snd_soc_card = { | 249 | static struct snd_soc_card da850_snd_soc_card = { |
245 | .name = "DA850/OMAP-L138 EVM", | 250 | .name = "DA850/OMAP-L138 EVM", |
246 | .dai_link = &da8xx_evm_dai, | 251 | .dai_link = &da8xx_evm_dai, |
247 | .platform = &davinci_soc_platform, | ||
248 | .num_links = 1, | 252 | .num_links = 1, |
249 | }; | 253 | }; |
250 | 254 | ||
251 | static struct aic3x_setup_data aic3x_setup; | ||
252 | |||
253 | /* evm audio subsystem */ | ||
254 | static struct snd_soc_device evm_snd_devdata = { | ||
255 | .card = &snd_soc_card_evm, | ||
256 | .codec_dev = &soc_codec_dev_aic3x, | ||
257 | .codec_data = &aic3x_setup, | ||
258 | }; | ||
259 | |||
260 | /* evm audio subsystem */ | ||
261 | static struct snd_soc_device dm365_evm_snd_devdata = { | ||
262 | .card = &dm365_snd_soc_card_evm, | ||
263 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC | ||
264 | .codec_dev = &soc_codec_dev_aic3x, | ||
265 | .codec_data = &aic3x_setup, | ||
266 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) | ||
267 | .codec_dev = &soc_codec_dev_cq93vc, | ||
268 | #endif | ||
269 | }; | ||
270 | |||
271 | /* evm audio subsystem */ | ||
272 | static struct snd_soc_device dm6467_evm_snd_devdata = { | ||
273 | .card = &dm6467_snd_soc_card_evm, | ||
274 | .codec_dev = &soc_codec_dev_aic3x, | ||
275 | .codec_data = &aic3x_setup, | ||
276 | }; | ||
277 | |||
278 | /* evm audio subsystem */ | ||
279 | static struct snd_soc_device da830_evm_snd_devdata = { | ||
280 | .card = &da830_snd_soc_card, | ||
281 | .codec_dev = &soc_codec_dev_aic3x, | ||
282 | .codec_data = &aic3x_setup, | ||
283 | }; | ||
284 | |||
285 | static struct snd_soc_device da850_evm_snd_devdata = { | ||
286 | .card = &da850_snd_soc_card, | ||
287 | .codec_dev = &soc_codec_dev_aic3x, | ||
288 | .codec_data = &aic3x_setup, | ||
289 | }; | ||
290 | |||
291 | static struct platform_device *evm_snd_device; | 255 | static struct platform_device *evm_snd_device; |
292 | 256 | ||
293 | static int __init evm_init(void) | 257 | static int __init evm_init(void) |
294 | { | 258 | { |
295 | struct snd_soc_device *evm_snd_dev_data; | 259 | struct snd_soc_card *evm_snd_dev_data; |
296 | int index; | 260 | int index; |
297 | int ret; | 261 | int ret; |
298 | 262 | ||
299 | if (machine_is_davinci_evm()) { | 263 | if (machine_is_davinci_evm()) { |
300 | evm_snd_dev_data = &evm_snd_devdata; | 264 | evm_snd_dev_data = &snd_soc_card_evm; |
301 | index = 0; | 265 | index = 0; |
302 | } else if (machine_is_davinci_dm355_evm()) { | 266 | } else if (machine_is_davinci_dm355_evm()) { |
303 | evm_snd_dev_data = &evm_snd_devdata; | 267 | evm_snd_dev_data = &snd_soc_card_evm; |
304 | index = 1; | 268 | index = 1; |
305 | } else if (machine_is_davinci_dm365_evm()) { | 269 | } else if (machine_is_davinci_dm365_evm()) { |
306 | evm_snd_dev_data = &dm365_evm_snd_devdata; | 270 | evm_snd_dev_data = &dm365_snd_soc_card_evm; |
307 | index = 0; | 271 | index = 0; |
308 | } else if (machine_is_davinci_dm6467_evm()) { | 272 | } else if (machine_is_davinci_dm6467_evm()) { |
309 | evm_snd_dev_data = &dm6467_evm_snd_devdata; | 273 | evm_snd_dev_data = &dm6467_snd_soc_card_evm; |
310 | index = 0; | 274 | index = 0; |
311 | } else if (machine_is_davinci_da830_evm()) { | 275 | } else if (machine_is_davinci_da830_evm()) { |
312 | evm_snd_dev_data = &da830_evm_snd_devdata; | 276 | evm_snd_dev_data = &da830_snd_soc_card; |
313 | index = 1; | 277 | index = 1; |
314 | } else if (machine_is_davinci_da850_evm()) { | 278 | } else if (machine_is_davinci_da850_evm()) { |
315 | evm_snd_dev_data = &da850_evm_snd_devdata; | 279 | evm_snd_dev_data = &da850_snd_soc_card; |
316 | index = 0; | 280 | index = 0; |
317 | } else | 281 | } else |
318 | return -EINVAL; | 282 | return -EINVAL; |
@@ -322,7 +286,6 @@ static int __init evm_init(void) | |||
322 | return -ENOMEM; | 286 | return -ENOMEM; |
323 | 287 | ||
324 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); | 288 | platform_set_drvdata(evm_snd_device, evm_snd_dev_data); |
325 | evm_snd_dev_data->dev = &evm_snd_device->dev; | ||
326 | ret = platform_device_add(evm_snd_device); | 289 | ret = platform_device_add(evm_snd_device); |
327 | if (ret) | 290 | if (ret) |
328 | platform_device_put(evm_snd_device); | 291 | platform_device_put(evm_snd_device); |