summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorLiam Girdwood <lg@opensource.wolfsonmicro.com>2007-02-02 17:21:16 +0100
committerJaroslav Kysela <perex@suse.cz>2007-02-09 09:03:46 +0100
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 28b1985edc0..1bbbeff84ef 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -31,27 +31,12 @@
#include <asm/arch/audio.h>
#include "pxa2xx-pcm.h"
+#include "pxa2xx-ac97.h"
static DEFINE_MUTEX(car_mutex);
static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
static volatile long gsr_bits;
-#define AC97_DIR \
- (SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE)
-
-#define AC97_RATES \
- (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
- SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
-
-/* may need to expand this */
-static struct snd_soc_dai_mode pxa2xx_ac97_modes[] = {
- {
- .pcmfmt = SNDRV_PCM_FMTBIT_S16_LE,
- .pcmrate = AC97_RATES,
- .pcmdir = AC97_DIR,
- },
-};
-
/*
* Beware PXA27x bugs:
*
@@ -334,11 +319,12 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_out;
+ cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_out;
else
- rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in;
+ cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in;
return 0;
}
@@ -347,11 +333,12 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
+ cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
else
- rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in;
+ cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in;
return 0;
}
@@ -360,15 +347,20 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
return -ENODEV;
else
- rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in;
+ cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in;
return 0;
}
+#define PXA2XX_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
+ SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
+ SNDRV_PCM_RATE_48000)
+
/*
* There is only 1 physical AC97 interface for pxa2xx, but it
* 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[] = {
.playback = {
.stream_name = "AC97 Playback",
.channels_min = 2,
- .channels_max = 2,},
+ .channels_max = 2,
+ .rates = PXA2XX_AC97_RATES,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
.capture = {
.stream_name = "AC97 Capture",
.channels_min = 2,
- .channels_max = 2,},
+ .channels_max = 2,
+ .rates = PXA2XX_AC97_RATES,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
.ops = {
.hw_params = pxa2xx_ac97_hw_params,},
- .caps = {
- .num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
- .mode = pxa2xx_ac97_modes,},
},
{
.name = "pxa2xx-ac97-aux",
@@ -403,16 +396,17 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
.playback = {
.stream_name = "AC97 Aux Playback",
.channels_min = 1,
- .channels_max = 1,},
+ .channels_max = 1,
+ .rates = PXA2XX_AC97_RATES,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
.capture = {
.stream_name = "AC97 Aux Capture",
.channels_min = 1,
- .channels_max = 1,},
+ .channels_max = 1,
+ .rates = PXA2XX_AC97_RATES,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
.ops = {
.hw_params = pxa2xx_ac97_hw_aux_params,},
- .caps = {
- .num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
- .mode = pxa2xx_ac97_modes,},
},
{
.name = "pxa2xx-ac97-mic",
@@ -421,12 +415,12 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
.capture = {
.stream_name = "AC97 Mic Capture",
.channels_min = 1,
- .channels_max = 1,},
+ .channels_max = 1,
+ .rates = PXA2XX_AC97_RATES,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
.ops = {
.hw_params = pxa2xx_ac97_hw_mic_params,},
- .caps = {
- .num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
- .mode = pxa2xx_ac97_modes,},},
+},
};
EXPORT_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 00000000000..4c4b882316a
--- /dev/null
+++ b/sound/soc/pxa/pxa2xx-ac97.h
@@ -0,0 +1,22 @@
+/*
+ * linux/sound/arm/pxa2xx-ac97.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _PXA2XX_AC97_H
+#define _PXA2XX_AC97_H
+
+/* pxa2xx DAI ID's */
+#define PXA2XX_DAI_AC97_HIFI 0
+#define PXA2XX_DAI_AC97_AUX 1
+#define PXA2XX_DAI_AC97_MIC 2
+
+extern struct snd_soc_cpu_dai pxa_ac97_dai[3];
+
+/* platform data */
+extern struct snd_ac97_bus_ops pxa2xx_ac97_ops;
+
+#endif