aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorLiam Girdwood <lg@opensource.wolfsonmicro.com>2007-02-02 11:21:16 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:03:46 -0500
commit596ce32b74dccf53ef59cc9ba2e95a2a34ba921c (patch)
tree6ecffb595a5839c1011eb8eb5a6e737f6d7a50e1 /sound/soc
parenteaff2ae702f937020bfde96eea552caae3815784 (diff)
[ALSA] soc - ASoC 0.13 pxa2xx AC97 driver
This patch updates the pxa2xx AC97 driver to the new API in ASoC 0.13. Changes:- o Removed DAI capabilities matching code in favour of manual matching in the machine drivers. o Added DAI operations for codec and CPU interfaces. o Added pxa2xx-ac97.h header Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c64
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.h22
2 files changed, 51 insertions, 35 deletions
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 28b1985edc05..1bbbeff84ef0 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -31,27 +31,12 @@
31#include <asm/arch/audio.h> 31#include <asm/arch/audio.h>
32 32
33#include "pxa2xx-pcm.h" 33#include "pxa2xx-pcm.h"
34#include "pxa2xx-ac97.h"
34 35
35static DEFINE_MUTEX(car_mutex); 36static DEFINE_MUTEX(car_mutex);
36static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); 37static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
37static volatile long gsr_bits; 38static volatile long gsr_bits;
38 39
39#define AC97_DIR \
40 (SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE)
41
42#define AC97_RATES \
43 (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
44 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
45
46/* may need to expand this */
47static struct snd_soc_dai_mode pxa2xx_ac97_modes[] = {
48 {
49 .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
50 .pcmrate = AC97_RATES,
51 .pcmdir = AC97_DIR,
52 },
53};
54
55/* 40/*
56 * Beware PXA27x bugs: 41 * Beware PXA27x bugs:
57 * 42 *
@@ -334,11 +319,12 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
334 struct snd_pcm_hw_params *params) 319 struct snd_pcm_hw_params *params)
335{ 320{
336 struct snd_soc_pcm_runtime *rtd = substream->private_data; 321 struct snd_soc_pcm_runtime *rtd = substream->private_data;
322 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
337 323
338 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 324 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
339 rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_out; 325 cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_out;
340 else 326 else
341 rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in; 327 cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in;
342 328
343 return 0; 329 return 0;
344} 330}
@@ -347,11 +333,12 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream,
347 struct snd_pcm_hw_params *params) 333 struct snd_pcm_hw_params *params)
348{ 334{
349 struct snd_soc_pcm_runtime *rtd = substream->private_data; 335 struct snd_soc_pcm_runtime *rtd = substream->private_data;
336 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
350 337
351 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 338 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
352 rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_out; 339 cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
353 else 340 else
354 rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in; 341 cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in;
355 342
356 return 0; 343 return 0;
357} 344}
@@ -360,15 +347,20 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream,
360 struct snd_pcm_hw_params *params) 347 struct snd_pcm_hw_params *params)
361{ 348{
362 struct snd_soc_pcm_runtime *rtd = substream->private_data; 349 struct snd_soc_pcm_runtime *rtd = substream->private_data;
350 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
363 351
364 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 352 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
365 return -ENODEV; 353 return -ENODEV;
366 else 354 else
367 rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in; 355 cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in;
368 356
369 return 0; 357 return 0;
370} 358}
371 359
360#define PXA2XX_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
361 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
362 SNDRV_PCM_RATE_48000)
363
372/* 364/*
373 * There is only 1 physical AC97 interface for pxa2xx, but it 365 * There is only 1 physical AC97 interface for pxa2xx, but it
374 * has extra fifo's that can be used for aux DACs and ADCs. 366 * has extra fifo's that can be used for aux DACs and ADCs.
@@ -385,16 +377,17 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
385 .playback = { 377 .playback = {
386 .stream_name = "AC97 Playback", 378 .stream_name = "AC97 Playback",
387 .channels_min = 2, 379 .channels_min = 2,
388 .channels_max = 2,}, 380 .channels_max = 2,
381 .rates = PXA2XX_AC97_RATES,
382 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
389 .capture = { 383 .capture = {
390 .stream_name = "AC97 Capture", 384 .stream_name = "AC97 Capture",
391 .channels_min = 2, 385 .channels_min = 2,
392 .channels_max = 2,}, 386 .channels_max = 2,
387 .rates = PXA2XX_AC97_RATES,
388 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
393 .ops = { 389 .ops = {
394 .hw_params = pxa2xx_ac97_hw_params,}, 390 .hw_params = pxa2xx_ac97_hw_params,},
395 .caps = {
396 .num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
397 .mode = pxa2xx_ac97_modes,},
398}, 391},
399{ 392{
400 .name = "pxa2xx-ac97-aux", 393 .name = "pxa2xx-ac97-aux",
@@ -403,16 +396,17 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
403 .playback = { 396 .playback = {
404 .stream_name = "AC97 Aux Playback", 397 .stream_name = "AC97 Aux Playback",
405 .channels_min = 1, 398 .channels_min = 1,
406 .channels_max = 1,}, 399 .channels_max = 1,
400 .rates = PXA2XX_AC97_RATES,
401 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
407 .capture = { 402 .capture = {
408 .stream_name = "AC97 Aux Capture", 403 .stream_name = "AC97 Aux Capture",
409 .channels_min = 1, 404 .channels_min = 1,
410 .channels_max = 1,}, 405 .channels_max = 1,
406 .rates = PXA2XX_AC97_RATES,
407 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
411 .ops = { 408 .ops = {
412 .hw_params = pxa2xx_ac97_hw_aux_params,}, 409 .hw_params = pxa2xx_ac97_hw_aux_params,},
413 .caps = {
414 .num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
415 .mode = pxa2xx_ac97_modes,},
416}, 410},
417{ 411{
418 .name = "pxa2xx-ac97-mic", 412 .name = "pxa2xx-ac97-mic",
@@ -421,12 +415,12 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
421 .capture = { 415 .capture = {
422 .stream_name = "AC97 Mic Capture", 416 .stream_name = "AC97 Mic Capture",
423 .channels_min = 1, 417 .channels_min = 1,
424 .channels_max = 1,}, 418 .channels_max = 1,
419 .rates = PXA2XX_AC97_RATES,
420 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
425 .ops = { 421 .ops = {
426 .hw_params = pxa2xx_ac97_hw_mic_params,}, 422 .hw_params = pxa2xx_ac97_hw_mic_params,},
427 .caps = { 423},
428 .num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
429 .mode = pxa2xx_ac97_modes,},},
430}; 424};
431 425
432EXPORT_SYMBOL_GPL(pxa_ac97_dai); 426EXPORT_SYMBOL_GPL(pxa_ac97_dai);
diff --git a/sound/soc/pxa/pxa2xx-ac97.h b/sound/soc/pxa/pxa2xx-ac97.h
new file mode 100644
index 000000000000..4c4b882316ac
--- /dev/null
+++ b/sound/soc/pxa/pxa2xx-ac97.h
@@ -0,0 +1,22 @@
1/*
2 * linux/sound/arm/pxa2xx-ac97.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _PXA2XX_AC97_H
10#define _PXA2XX_AC97_H
11
12/* pxa2xx DAI ID's */
13#define PXA2XX_DAI_AC97_HIFI 0
14#define PXA2XX_DAI_AC97_AUX 1
15#define PXA2XX_DAI_AC97_MIC 2
16
17extern struct snd_soc_cpu_dai pxa_ac97_dai[3];
18
19/* platform data */
20extern struct snd_ac97_bus_ops pxa2xx_ac97_ops;
21
22#endif