aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung/ac97.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/samsung/ac97.c')
-rw-r--r--sound/soc/samsung/ac97.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 350ba23a9893..4a88e36c82ec 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -221,24 +221,6 @@ static struct snd_ac97_bus_ops s3c_ac97_ops = {
221 .reset = s3c_ac97_cold_reset, 221 .reset = s3c_ac97_cold_reset,
222}; 222};
223 223
224static int s3c_ac97_hw_params(struct snd_pcm_substream *substream,
225 struct snd_pcm_hw_params *params,
226 struct snd_soc_dai *dai)
227{
228 struct snd_soc_pcm_runtime *rtd = substream->private_data;
229 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
230 struct s3c_dma_params *dma_data;
231
232 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
233 dma_data = &s3c_ac97_pcm_out;
234 else
235 dma_data = &s3c_ac97_pcm_in;
236
237 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
238
239 return 0;
240}
241
242static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd, 224static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
243 struct snd_soc_dai *dai) 225 struct snd_soc_dai *dai)
244{ 226{
@@ -279,21 +261,6 @@ static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd,
279 return 0; 261 return 0;
280} 262}
281 263
282static int s3c_ac97_hw_mic_params(struct snd_pcm_substream *substream,
283 struct snd_pcm_hw_params *params,
284 struct snd_soc_dai *dai)
285{
286 struct snd_soc_pcm_runtime *rtd = substream->private_data;
287 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
288
289 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
290 return -ENODEV;
291 else
292 snd_soc_dai_set_dma_data(cpu_dai, substream, &s3c_ac97_mic_in);
293
294 return 0;
295}
296
297static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream, 264static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream,
298 int cmd, struct snd_soc_dai *dai) 265 int cmd, struct snd_soc_dai *dai)
299{ 266{
@@ -329,15 +296,27 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream,
329} 296}
330 297
331static const struct snd_soc_dai_ops s3c_ac97_dai_ops = { 298static const struct snd_soc_dai_ops s3c_ac97_dai_ops = {
332 .hw_params = s3c_ac97_hw_params,
333 .trigger = s3c_ac97_trigger, 299 .trigger = s3c_ac97_trigger,
334}; 300};
335 301
336static const struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = { 302static const struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = {
337 .hw_params = s3c_ac97_hw_mic_params,
338 .trigger = s3c_ac97_mic_trigger, 303 .trigger = s3c_ac97_mic_trigger,
339}; 304};
340 305
306static int s3c_ac97_dai_probe(struct snd_soc_dai *dai)
307{
308 samsung_asoc_init_dma_data(dai, &s3c_ac97_pcm_out, &s3c_ac97_pcm_in);
309
310 return 0;
311}
312
313static int s3c_ac97_mic_dai_probe(struct snd_soc_dai *dai)
314{
315 samsung_asoc_init_dma_data(dai, NULL, &s3c_ac97_mic_in);
316
317 return 0;
318}
319
341static struct snd_soc_dai_driver s3c_ac97_dai[] = { 320static struct snd_soc_dai_driver s3c_ac97_dai[] = {
342 [S3C_AC97_DAI_PCM] = { 321 [S3C_AC97_DAI_PCM] = {
343 .name = "samsung-ac97", 322 .name = "samsung-ac97",
@@ -354,6 +333,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
354 .channels_max = 2, 333 .channels_max = 2,
355 .rates = SNDRV_PCM_RATE_8000_48000, 334 .rates = SNDRV_PCM_RATE_8000_48000,
356 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 335 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
336 .probe = s3c_ac97_dai_probe,
357 .ops = &s3c_ac97_dai_ops, 337 .ops = &s3c_ac97_dai_ops,
358 }, 338 },
359 [S3C_AC97_DAI_MIC] = { 339 [S3C_AC97_DAI_MIC] = {
@@ -365,6 +345,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
365 .channels_max = 1, 345 .channels_max = 1,
366 .rates = SNDRV_PCM_RATE_8000_48000, 346 .rates = SNDRV_PCM_RATE_8000_48000,
367 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 347 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
348 .probe = s3c_ac97_mic_dai_probe,
368 .ops = &s3c_ac97_mic_dai_ops, 349 .ops = &s3c_ac97_mic_dai_ops,
369 }, 350 },
370}; 351};