Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel Mack and committed by
Mark Brown
95acb005 8f54061d

+76 -207
-5
sound/arm/Kconfig
··· 17 17 select SND_PCM 18 18 select SND_AC97_CODEC 19 19 20 - config SND_PXA2XX_PCM 21 - tristate 22 - select SND_PCM 23 - 24 20 config SND_PXA2XX_AC97 25 21 tristate "AC97 driver for the Intel PXA2xx chip" 26 22 depends on ARCH_PXA 27 - select SND_PXA2XX_PCM 28 23 select SND_AC97_CODEC 29 24 select SND_PXA2XX_LIB 30 25 select SND_PXA2XX_LIB_AC97
-3
sound/arm/Makefile
··· 6 6 obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o 7 7 snd-aaci-objs := aaci.o 8 8 9 - obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o 10 - snd-pxa2xx-pcm-objs := pxa2xx-pcm.o 11 - 12 9 obj-$(CONFIG_SND_PXA2XX_LIB) += snd-pxa2xx-lib.o 13 10 snd-pxa2xx-lib-y := pxa2xx-pcm-lib.o 14 11 snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o
+76 -38
sound/arm/pxa2xx-ac97.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/dmaengine.h> 18 - #include <linux/dma/pxa-dma.h> 18 + #include <linux/dma-mapping.h> 19 19 20 20 #include <sound/core.h> 21 21 #include <sound/pcm.h> ··· 26 26 27 27 #include <mach/regs-ac97.h> 28 28 #include <mach/audio.h> 29 - 30 - #include "pxa2xx-pcm.h" 31 29 32 30 static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97) 33 31 { ··· 61 63 .reset = pxa2xx_ac97_legacy_reset, 62 64 }; 63 65 64 - static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = { 65 - .addr = __PREG(PCDR), 66 - .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 67 - .chan_name = "pcm_pcm_stereo_out", 68 - .maxburst = 32, 69 - }; 70 - 71 - static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = { 72 - .addr = __PREG(PCDR), 73 - .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, 74 - .chan_name = "pcm_pcm_stereo_in", 75 - .maxburst = 32, 76 - }; 77 - 78 66 static struct snd_pcm *pxa2xx_ac97_pcm; 79 67 static struct snd_ac97 *pxa2xx_ac97_ac97; 80 68 81 - static int pxa2xx_ac97_pcm_startup(struct snd_pcm_substream *substream) 69 + static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) 82 70 { 83 71 struct snd_pcm_runtime *runtime = substream->runtime; 84 72 pxa2xx_audio_ops_t *platform_ops; 85 - int r; 73 + int ret, i; 74 + 75 + ret = __pxa2xx_pcm_open(substream); 76 + if (ret) 77 + return ret; 86 78 87 79 runtime->hw.channels_min = 2; 88 80 runtime->hw.channels_max = 2; 89 81 90 - r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 91 - AC97_RATES_FRONT_DAC : AC97_RATES_ADC; 92 - runtime->hw.rates = pxa2xx_ac97_ac97->rates[r]; 82 + i = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 83 + AC97_RATES_FRONT_DAC : AC97_RATES_ADC; 84 + runtime->hw.rates = pxa2xx_ac97_ac97->rates[i]; 93 85 snd_pcm_limit_hw_rates(runtime); 94 86 95 - platform_ops = substream->pcm->card->dev->platform_data; 96 - if (platform_ops && platform_ops->startup) 97 - return platform_ops->startup(substream, platform_ops->priv); 98 - else 99 - return 0; 87 + platform_ops = substream->pcm->card->dev->platform_data; 88 + if (platform_ops && platform_ops->startup) { 89 + ret = platform_ops->startup(substream, platform_ops->priv); 90 + if (ret < 0) 91 + __pxa2xx_pcm_close(substream); 92 + } 93 + 94 + return ret; 100 95 } 101 96 102 - static void pxa2xx_ac97_pcm_shutdown(struct snd_pcm_substream *substream) 97 + static int pxa2xx_ac97_pcm_close(struct snd_pcm_substream *substream) 103 98 { 104 99 pxa2xx_audio_ops_t *platform_ops; 105 100 106 - platform_ops = substream->pcm->card->dev->platform_data; 101 + platform_ops = substream->pcm->card->dev->platform_data; 107 102 if (platform_ops && platform_ops->shutdown) 108 103 platform_ops->shutdown(substream, platform_ops->priv); 104 + 105 + return 0; 109 106 } 110 107 111 108 static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) ··· 108 115 struct snd_pcm_runtime *runtime = substream->runtime; 109 116 int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 110 117 AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; 118 + int ret; 119 + 120 + ret = __pxa2xx_pcm_prepare(substream); 121 + if (ret < 0) 122 + return ret; 123 + 111 124 return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate); 112 125 } 113 - 114 - static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = { 115 - .playback_params = &pxa2xx_ac97_pcm_out, 116 - .capture_params = &pxa2xx_ac97_pcm_in, 117 - .startup = pxa2xx_ac97_pcm_startup, 118 - .shutdown = pxa2xx_ac97_pcm_shutdown, 119 - .prepare = pxa2xx_ac97_pcm_prepare, 120 - }; 121 126 122 127 #ifdef CONFIG_PM_SLEEP 123 128 ··· 174 183 static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); 175 184 #endif 176 185 186 + static const struct snd_pcm_ops pxa2xx_pcm_ops = { 187 + .open = pxa2xx_ac97_pcm_open, 188 + .close = pxa2xx_ac97_pcm_close, 189 + .ioctl = snd_pcm_lib_ioctl, 190 + .hw_params = __pxa2xx_pcm_hw_params, 191 + .hw_free = __pxa2xx_pcm_hw_free, 192 + .prepare = pxa2xx_ac97_pcm_prepare, 193 + .trigger = pxa2xx_pcm_trigger, 194 + .pointer = pxa2xx_pcm_pointer, 195 + .mmap = pxa2xx_pcm_mmap, 196 + }; 197 + 198 + 199 + static int pxa2xx_ac97_pcm_new(struct snd_card *card) 200 + { 201 + struct snd_pcm *pcm; 202 + int stream, ret; 203 + 204 + ret = snd_pcm_new(card, "PXA2xx-PCM", 0, 1, 1, &pcm); 205 + if (ret) 206 + goto out; 207 + 208 + pcm->private_free = pxa2xx_pcm_free_dma_buffers; 209 + 210 + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); 211 + if (ret) 212 + goto out; 213 + 214 + stream = SNDRV_PCM_STREAM_PLAYBACK; 215 + snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); 216 + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); 217 + if (ret) 218 + goto out; 219 + 220 + stream = SNDRV_PCM_STREAM_CAPTURE; 221 + snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); 222 + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); 223 + if (ret) 224 + goto out; 225 + 226 + pxa2xx_ac97_pcm = pcm; 227 + ret = 0; 228 + 229 + out: 230 + return ret; 231 + } 232 + 177 233 static int pxa2xx_ac97_probe(struct platform_device *dev) 178 234 { 179 235 struct snd_card *card; ··· 242 204 243 205 strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver)); 244 206 245 - ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); 207 + ret = pxa2xx_ac97_pcm_new(card); 246 208 if (ret) 247 209 goto err; 248 210
-2
sound/arm/pxa2xx-pcm-lib.c
··· 16 16 #include <sound/pxa2xx-lib.h> 17 17 #include <sound/dmaengine_pcm.h> 18 18 19 - #include "pxa2xx-pcm.h" 20 - 21 19 static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { 22 20 .info = SNDRV_PCM_INFO_MMAP | 23 21 SNDRV_PCM_INFO_MMAP_VALID |
-129
sound/arm/pxa2xx-pcm.c
··· 1 - /* 2 - * linux/sound/arm/pxa2xx-pcm.c -- ALSA PCM interface for the Intel PXA2xx chip 3 - * 4 - * Author: Nicolas Pitre 5 - * Created: Nov 30, 2004 6 - * Copyright: (C) 2004 MontaVista Software, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - 13 - #include <linux/module.h> 14 - #include <linux/dma-mapping.h> 15 - #include <linux/dmaengine.h> 16 - 17 - #include <mach/dma.h> 18 - 19 - #include <sound/core.h> 20 - #include <sound/pxa2xx-lib.h> 21 - #include <sound/dmaengine_pcm.h> 22 - 23 - #include "pxa2xx-pcm.h" 24 - 25 - static int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) 26 - { 27 - struct pxa2xx_pcm_client *client = substream->private_data; 28 - 29 - __pxa2xx_pcm_prepare(substream); 30 - 31 - return client->prepare(substream); 32 - } 33 - 34 - static int pxa2xx_pcm_open(struct snd_pcm_substream *substream) 35 - { 36 - struct pxa2xx_pcm_client *client = substream->private_data; 37 - struct snd_pcm_runtime *runtime = substream->runtime; 38 - struct pxa2xx_runtime_data *rtd; 39 - int ret; 40 - 41 - ret = __pxa2xx_pcm_open(substream); 42 - if (ret) 43 - goto out; 44 - 45 - rtd = runtime->private_data; 46 - 47 - rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 48 - client->playback_params : client->capture_params; 49 - 50 - ret = client->startup(substream); 51 - if (!ret) 52 - goto err2; 53 - 54 - return 0; 55 - 56 - err2: 57 - __pxa2xx_pcm_close(substream); 58 - out: 59 - return ret; 60 - } 61 - 62 - static int pxa2xx_pcm_close(struct snd_pcm_substream *substream) 63 - { 64 - struct pxa2xx_pcm_client *client = substream->private_data; 65 - 66 - client->shutdown(substream); 67 - 68 - return __pxa2xx_pcm_close(substream); 69 - } 70 - 71 - static const struct snd_pcm_ops pxa2xx_pcm_ops = { 72 - .open = pxa2xx_pcm_open, 73 - .close = pxa2xx_pcm_close, 74 - .ioctl = snd_pcm_lib_ioctl, 75 - .hw_params = __pxa2xx_pcm_hw_params, 76 - .hw_free = __pxa2xx_pcm_hw_free, 77 - .prepare = pxa2xx_pcm_prepare, 78 - .trigger = pxa2xx_pcm_trigger, 79 - .pointer = pxa2xx_pcm_pointer, 80 - .mmap = pxa2xx_pcm_mmap, 81 - }; 82 - 83 - int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client, 84 - struct snd_pcm **rpcm) 85 - { 86 - struct snd_pcm *pcm; 87 - int play = client->playback_params ? 1 : 0; 88 - int capt = client->capture_params ? 1 : 0; 89 - int ret; 90 - 91 - ret = snd_pcm_new(card, "PXA2xx-PCM", 0, play, capt, &pcm); 92 - if (ret) 93 - goto out; 94 - 95 - pcm->private_data = client; 96 - pcm->private_free = pxa2xx_pcm_free_dma_buffers; 97 - 98 - ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); 99 - if (ret) 100 - goto out; 101 - 102 - if (play) { 103 - int stream = SNDRV_PCM_STREAM_PLAYBACK; 104 - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); 105 - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); 106 - if (ret) 107 - goto out; 108 - } 109 - if (capt) { 110 - int stream = SNDRV_PCM_STREAM_CAPTURE; 111 - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); 112 - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); 113 - if (ret) 114 - goto out; 115 - } 116 - 117 - if (rpcm) 118 - *rpcm = pcm; 119 - ret = 0; 120 - 121 - out: 122 - return ret; 123 - } 124 - 125 - EXPORT_SYMBOL(pxa2xx_pcm_new); 126 - 127 - MODULE_AUTHOR("Nicolas Pitre"); 128 - MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); 129 - MODULE_LICENSE("GPL");
-27
sound/arm/pxa2xx-pcm.h
··· 1 - /* 2 - * linux/sound/arm/pxa2xx-pcm.h -- ALSA PCM interface for the Intel PXA2xx chip 3 - * 4 - * Author: Nicolas Pitre 5 - * Created: Nov 30, 2004 6 - * Copyright: MontaVista Software, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - */ 12 - 13 - struct pxa2xx_runtime_data { 14 - int dma_ch; 15 - struct snd_dmaengine_dai_dma_data *params; 16 - }; 17 - 18 - struct pxa2xx_pcm_client { 19 - struct snd_dmaengine_dai_dma_data *playback_params; 20 - struct snd_dmaengine_dai_dma_data *capture_params; 21 - int (*startup)(struct snd_pcm_substream *); 22 - void (*shutdown)(struct snd_pcm_substream *); 23 - int (*prepare)(struct snd_pcm_substream *); 24 - }; 25 - 26 - extern int pxa2xx_pcm_new(struct snd_card *, struct pxa2xx_pcm_client *, struct snd_pcm **); 27 -
-1
sound/soc/pxa/pxa-ssp.c
··· 34 34 #include <sound/pxa2xx-lib.h> 35 35 #include <sound/dmaengine_pcm.h> 36 36 37 - #include "../../arm/pxa2xx-pcm.h" 38 37 #include "pxa-ssp.h" 39 38 40 39 /*
-2
sound/soc/pxa/pxa2xx-pcm.c
··· 20 20 #include <sound/pxa2xx-lib.h> 21 21 #include <sound/dmaengine_pcm.h> 22 22 23 - #include "../../arm/pxa2xx-pcm.h" 24 - 25 23 static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, 26 24 struct snd_pcm_hw_params *params) 27 25 {