Skip to content

Commit 95acb00

Browse files
zonquebroonie
authored andcommitted
ASoC: fold pxa2xx-pcm into its only user, pxa2xx-ac97
Now that the PXA SSP bits are ported over to generic DMA, the pxa2xx-pcm code only has a single user left. This patch folds the remaining bits into its only user and removes the unnecessary glue layer along with its header file. The include dependency to linux/dma/pxa-dma.h is also gone now. Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8f54061 commit 95acb00

8 files changed

Lines changed: 76 additions & 207 deletions

File tree

‎sound/arm/Kconfig‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@ config SND_ARMAACI
1717
select SND_PCM
1818
select SND_AC97_CODEC
1919

20-
config SND_PXA2XX_PCM
21-
tristate
22-
select SND_PCM
23-
2420
config SND_PXA2XX_AC97
2521
tristate "AC97 driver for the Intel PXA2xx chip"
2622
depends on ARCH_PXA
27-
select SND_PXA2XX_PCM
2823
select SND_AC97_CODEC
2924
select SND_PXA2XX_LIB
3025
select SND_PXA2XX_LIB_AC97

‎sound/arm/Makefile‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o
77
snd-aaci-objs := aaci.o
88

9-
obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o
10-
snd-pxa2xx-pcm-objs := pxa2xx-pcm.o
11-
129
obj-$(CONFIG_SND_PXA2XX_LIB) += snd-pxa2xx-lib.o
1310
snd-pxa2xx-lib-y := pxa2xx-pcm-lib.o
1411
snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o

‎sound/arm/pxa2xx-ac97.c‎

Lines changed: 76 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <linux/module.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/dmaengine.h>
18-
#include <linux/dma/pxa-dma.h>
18+
#include <linux/dma-mapping.h>
1919

2020
#include <sound/core.h>
2121
#include <sound/pcm.h>
@@ -27,8 +27,6 @@
2727
#include <mach/regs-ac97.h>
2828
#include <mach/audio.h>
2929

30-
#include "pxa2xx-pcm.h"
31-
3230
static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97)
3331
{
3432
if (!pxa2xx_ac97_try_cold_reset())
@@ -63,69 +61,62 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
6361
.reset = pxa2xx_ac97_legacy_reset,
6462
};
6563

66-
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = {
67-
.addr = __PREG(PCDR),
68-
.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
69-
.chan_name = "pcm_pcm_stereo_out",
70-
.maxburst = 32,
71-
};
72-
73-
static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = {
74-
.addr = __PREG(PCDR),
75-
.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES,
76-
.chan_name = "pcm_pcm_stereo_in",
77-
.maxburst = 32,
78-
};
79-
8064
static struct snd_pcm *pxa2xx_ac97_pcm;
8165
static struct snd_ac97 *pxa2xx_ac97_ac97;
8266

83-
static int pxa2xx_ac97_pcm_startup(struct snd_pcm_substream *substream)
67+
static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream)
8468
{
8569
struct snd_pcm_runtime *runtime = substream->runtime;
8670
pxa2xx_audio_ops_t *platform_ops;
87-
int r;
71+
int ret, i;
72+
73+
ret = __pxa2xx_pcm_open(substream);
74+
if (ret)
75+
return ret;
8876

8977
runtime->hw.channels_min = 2;
9078
runtime->hw.channels_max = 2;
9179

92-
r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
93-
AC97_RATES_FRONT_DAC : AC97_RATES_ADC;
94-
runtime->hw.rates = pxa2xx_ac97_ac97->rates[r];
80+
i = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
81+
AC97_RATES_FRONT_DAC : AC97_RATES_ADC;
82+
runtime->hw.rates = pxa2xx_ac97_ac97->rates[i];
9583
snd_pcm_limit_hw_rates(runtime);
9684

97-
platform_ops = substream->pcm->card->dev->platform_data;
98-
if (platform_ops && platform_ops->startup)
99-
return platform_ops->startup(substream, platform_ops->priv);
100-
else
101-
return 0;
85+
platform_ops = substream->pcm->card->dev->platform_data;
86+
if (platform_ops && platform_ops->startup) {
87+
ret = platform_ops->startup(substream, platform_ops->priv);
88+
if (ret < 0)
89+
__pxa2xx_pcm_close(substream);
90+
}
91+
92+
return ret;
10293
}
10394

104-
static void pxa2xx_ac97_pcm_shutdown(struct snd_pcm_substream *substream)
95+
static int pxa2xx_ac97_pcm_close(struct snd_pcm_substream *substream)
10596
{
10697
pxa2xx_audio_ops_t *platform_ops;
10798

108-
platform_ops = substream->pcm->card->dev->platform_data;
99+
platform_ops = substream->pcm->card->dev->platform_data;
109100
if (platform_ops && platform_ops->shutdown)
110101
platform_ops->shutdown(substream, platform_ops->priv);
102+
103+
return 0;
111104
}
112105

113106
static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream)
114107
{
115108
struct snd_pcm_runtime *runtime = substream->runtime;
116109
int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
117110
AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
111+
int ret;
112+
113+
ret = __pxa2xx_pcm_prepare(substream);
114+
if (ret < 0)
115+
return ret;
116+
118117
return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate);
119118
}
120119

121-
static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = {
122-
.playback_params = &pxa2xx_ac97_pcm_out,
123-
.capture_params = &pxa2xx_ac97_pcm_in,
124-
.startup = pxa2xx_ac97_pcm_startup,
125-
.shutdown = pxa2xx_ac97_pcm_shutdown,
126-
.prepare = pxa2xx_ac97_pcm_prepare,
127-
};
128-
129120
#ifdef CONFIG_PM_SLEEP
130121

131122
static int pxa2xx_ac97_do_suspend(struct snd_card *card)
@@ -183,6 +174,53 @@ static int pxa2xx_ac97_resume(struct device *dev)
183174
static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume);
184175
#endif
185176

177+
static const struct snd_pcm_ops pxa2xx_pcm_ops = {
178+
.open = pxa2xx_ac97_pcm_open,
179+
.close = pxa2xx_ac97_pcm_close,
180+
.ioctl = snd_pcm_lib_ioctl,
181+
.hw_params = __pxa2xx_pcm_hw_params,
182+
.hw_free = __pxa2xx_pcm_hw_free,
183+
.prepare = pxa2xx_ac97_pcm_prepare,
184+
.trigger = pxa2xx_pcm_trigger,
185+
.pointer = pxa2xx_pcm_pointer,
186+
.mmap = pxa2xx_pcm_mmap,
187+
};
188+
189+
190+
static int pxa2xx_ac97_pcm_new(struct snd_card *card)
191+
{
192+
struct snd_pcm *pcm;
193+
int stream, ret;
194+
195+
ret = snd_pcm_new(card, "PXA2xx-PCM", 0, 1, 1, &pcm);
196+
if (ret)
197+
goto out;
198+
199+
pcm->private_free = pxa2xx_pcm_free_dma_buffers;
200+
201+
ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
202+
if (ret)
203+
goto out;
204+
205+
stream = SNDRV_PCM_STREAM_PLAYBACK;
206+
snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops);
207+
ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream);
208+
if (ret)
209+
goto out;
210+
211+
stream = SNDRV_PCM_STREAM_CAPTURE;
212+
snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops);
213+
ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream);
214+
if (ret)
215+
goto out;
216+
217+
pxa2xx_ac97_pcm = pcm;
218+
ret = 0;
219+
220+
out:
221+
return ret;
222+
}
223+
186224
static int pxa2xx_ac97_probe(struct platform_device *dev)
187225
{
188226
struct snd_card *card;
@@ -204,7 +242,7 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
204242

205243
strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
206244

207-
ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
245+
ret = pxa2xx_ac97_pcm_new(card);
208246
if (ret)
209247
goto err;
210248

‎sound/arm/pxa2xx-pcm-lib.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include <sound/pxa2xx-lib.h>
1717
#include <sound/dmaengine_pcm.h>
1818

19-
#include "pxa2xx-pcm.h"
20-
2119
static const struct snd_pcm_hardware pxa2xx_pcm_hardware = {
2220
.info = SNDRV_PCM_INFO_MMAP |
2321
SNDRV_PCM_INFO_MMAP_VALID |

‎sound/arm/pxa2xx-pcm.c‎

Lines changed: 0 additions & 129 deletions
This file was deleted.

‎sound/arm/pxa2xx-pcm.h‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎sound/soc/pxa/pxa-ssp.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <sound/pxa2xx-lib.h>
3535
#include <sound/dmaengine_pcm.h>
3636

37-
#include "../../arm/pxa2xx-pcm.h"
3837
#include "pxa-ssp.h"
3938

4039
/*

‎sound/soc/pxa/pxa2xx-pcm.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include <sound/pxa2xx-lib.h>
2121
#include <sound/dmaengine_pcm.h>
2222

23-
#include "../../arm/pxa2xx-pcm.h"
24-
2523
static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
2624
struct snd_pcm_hw_params *params)
2725
{

0 commit comments

Comments
 (0)