Skip to content

Commit

Permalink
[ALSA] soc - ASoC 0.13 pxa2xx AC97 driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Liam Girdwood authored and Jaroslav Kysela committed Feb 9, 2007
1 parent eaff2ae commit 596ce32
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 35 deletions.
64 changes: 29 additions & 35 deletions sound/soc/pxa/pxa2xx-ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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.
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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);
Expand Down
22 changes: 22 additions & 0 deletions sound/soc/pxa/pxa2xx-ac97.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 596ce32

Please sign in to comment.