Commit 596ce32b authored by Liam Girdwood's avatar Liam Girdwood Committed by Jaroslav Kysela

[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: default avatarLiam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent eaff2ae7
...@@ -31,27 +31,12 @@ ...@@ -31,27 +31,12 @@
#include <asm/arch/audio.h> #include <asm/arch/audio.h>
#include "pxa2xx-pcm.h" #include "pxa2xx-pcm.h"
#include "pxa2xx-ac97.h"
static DEFINE_MUTEX(car_mutex); static DEFINE_MUTEX(car_mutex);
static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
static volatile long gsr_bits; 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: * Beware PXA27x bugs:
* *
...@@ -334,11 +319,12 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, ...@@ -334,11 +319,12 @@ static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; 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) 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 else
rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in; cpu_dai->dma_data = &pxa2xx_ac97_pcm_stereo_in;
return 0; return 0;
} }
...@@ -347,11 +333,12 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream, ...@@ -347,11 +333,12 @@ static int pxa2xx_ac97_hw_aux_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; 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) 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 else
rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in; cpu_dai->dma_data = &pxa2xx_ac97_pcm_aux_mono_in;
return 0; return 0;
} }
...@@ -360,15 +347,20 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, ...@@ -360,15 +347,20 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; 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) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
return -ENODEV; return -ENODEV;
else else
rtd->cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in; cpu_dai->dma_data = &pxa2xx_ac97_pcm_mic_mono_in;
return 0; 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 * There is only 1 physical AC97 interface for pxa2xx, but it
* has extra fifo's that can be used for aux DACs and ADCs. * 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,16 +377,17 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
.playback = { .playback = {
.stream_name = "AC97 Playback", .stream_name = "AC97 Playback",
.channels_min = 2, .channels_min = 2,
.channels_max = 2,}, .channels_max = 2,
.rates = PXA2XX_AC97_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE,},
.capture = { .capture = {
.stream_name = "AC97 Capture", .stream_name = "AC97 Capture",
.channels_min = 2, .channels_min = 2,
.channels_max = 2,}, .channels_max = 2,
.rates = PXA2XX_AC97_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE,},
.ops = { .ops = {
.hw_params = pxa2xx_ac97_hw_params,}, .hw_params = pxa2xx_ac97_hw_params,},
.caps = {
.num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
.mode = pxa2xx_ac97_modes,},
}, },
{ {
.name = "pxa2xx-ac97-aux", .name = "pxa2xx-ac97-aux",
...@@ -403,16 +396,17 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = { ...@@ -403,16 +396,17 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
.playback = { .playback = {
.stream_name = "AC97 Aux Playback", .stream_name = "AC97 Aux Playback",
.channels_min = 1, .channels_min = 1,
.channels_max = 1,}, .channels_max = 1,
.rates = PXA2XX_AC97_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE,},
.capture = { .capture = {
.stream_name = "AC97 Aux Capture", .stream_name = "AC97 Aux Capture",
.channels_min = 1, .channels_min = 1,
.channels_max = 1,}, .channels_max = 1,
.rates = PXA2XX_AC97_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE,},
.ops = { .ops = {
.hw_params = pxa2xx_ac97_hw_aux_params,}, .hw_params = pxa2xx_ac97_hw_aux_params,},
.caps = {
.num_modes = ARRAY_SIZE(pxa2xx_ac97_modes),
.mode = pxa2xx_ac97_modes,},
}, },
{ {
.name = "pxa2xx-ac97-mic", .name = "pxa2xx-ac97-mic",
...@@ -421,12 +415,12 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = { ...@@ -421,12 +415,12 @@ struct snd_soc_cpu_dai pxa_ac97_dai[] = {
.capture = { .capture = {
.stream_name = "AC97 Mic Capture", .stream_name = "AC97 Mic Capture",
.channels_min = 1, .channels_min = 1,
.channels_max = 1,}, .channels_max = 1,
.rates = PXA2XX_AC97_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE,},
.ops = { .ops = {
.hw_params = pxa2xx_ac97_hw_mic_params,}, .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); EXPORT_SYMBOL_GPL(pxa_ac97_dai);
......
/*
* 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment