[alsa-devel] [PATCH 0/7] ASoC: pxa: code refactoring
This is a series to clean up the code base in the ASoC/PXA area a bit. It folds some implementations, removes some files and brings pcm ops to the CPU DAIS, so they can be used on DT platforms without platform drivers.
They are a preparation for some more patches that will follow on top.
Daniel Mack (7): ASoC: fold pxa2xx-pcm into its only user, pxa2xx-ac97 ASoC: pxa: clean up function names in pxa2xx-lib ASoC: pxa: move some functions to pxa2xx-lib ASoC: pxa2xx-pcm-lib: fix indenting ASoC: pxa: provide PCM ops for ssp, i2s and ac97 components ASoC: pxa: remove bindings from pxa2xx-pcm ASoC: pxa: make SND_PXA2XX_SOC_I2S selectable
.../bindings/sound/mrvl,pxa2xx-pcm.txt | 15 -- include/sound/pxa2xx-lib.h | 13 +- sound/arm/Kconfig | 5 - sound/arm/Makefile | 3 - sound/arm/pxa2xx-ac97.c | 114 ++++++++++------ sound/arm/pxa2xx-pcm-lib.c | 69 ++++++++-- sound/arm/pxa2xx-pcm.c | 129 ------------------ sound/arm/pxa2xx-pcm.h | 27 ---- sound/soc/pxa/Kconfig | 2 +- sound/soc/pxa/pxa-ssp.c | 4 +- sound/soc/pxa/pxa2xx-ac97.c | 3 + sound/soc/pxa/pxa2xx-i2s.c | 3 + sound/soc/pxa/pxa2xx-pcm.c | 73 ---------- 13 files changed, 148 insertions(+), 312 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt delete mode 100644 sound/arm/pxa2xx-pcm.c delete mode 100644 sound/arm/pxa2xx-pcm.h
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 --- sound/arm/Kconfig | 5 -- sound/arm/Makefile | 3 - sound/arm/pxa2xx-ac97.c | 114 +++++++++++++++++++++----------- sound/arm/pxa2xx-pcm-lib.c | 2 - sound/arm/pxa2xx-pcm.c | 129 ------------------------------------- sound/arm/pxa2xx-pcm.h | 27 -------- sound/soc/pxa/pxa-ssp.c | 1 - sound/soc/pxa/pxa2xx-pcm.c | 2 - 8 files changed, 76 insertions(+), 207 deletions(-) delete mode 100644 sound/arm/pxa2xx-pcm.c delete mode 100644 sound/arm/pxa2xx-pcm.h
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 65171f6657a2..5fbd47a9177e 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig @@ -17,14 +17,9 @@ config SND_ARMAACI select SND_PCM select SND_AC97_CODEC
-config SND_PXA2XX_PCM - tristate - select SND_PCM - config SND_PXA2XX_AC97 tristate "AC97 driver for the Intel PXA2xx chip" depends on ARCH_PXA - select SND_PXA2XX_PCM select SND_AC97_CODEC select SND_PXA2XX_LIB select SND_PXA2XX_LIB_AC97 diff --git a/sound/arm/Makefile b/sound/arm/Makefile index e10d5b169565..34c769489877 100644 --- a/sound/arm/Makefile +++ b/sound/arm/Makefile @@ -6,9 +6,6 @@ obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o snd-aaci-objs := aaci.o
-obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o -snd-pxa2xx-pcm-objs := pxa2xx-pcm.o - obj-$(CONFIG_SND_PXA2XX_LIB) += snd-pxa2xx-lib.o snd-pxa2xx-lib-y := pxa2xx-pcm-lib.o snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 236a63cdaf9f..7d8d7b7199dc 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -15,7 +15,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/dmaengine.h> -#include <linux/dma/pxa-dma.h> +#include <linux/dma-mapping.h>
#include <sound/core.h> #include <sound/pcm.h> @@ -27,8 +27,6 @@ #include <mach/regs-ac97.h> #include <mach/audio.h>
-#include "pxa2xx-pcm.h" - static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97) { if (!pxa2xx_ac97_try_cold_reset()) @@ -63,51 +61,46 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { .reset = pxa2xx_ac97_legacy_reset, };
-static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = { - .addr = __PREG(PCDR), - .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, - .chan_name = "pcm_pcm_stereo_out", - .maxburst = 32, -}; - -static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = { - .addr = __PREG(PCDR), - .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, - .chan_name = "pcm_pcm_stereo_in", - .maxburst = 32, -}; - static struct snd_pcm *pxa2xx_ac97_pcm; static struct snd_ac97 *pxa2xx_ac97_ac97;
-static int pxa2xx_ac97_pcm_startup(struct snd_pcm_substream *substream) +static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; pxa2xx_audio_ops_t *platform_ops; - int r; + int ret, i; + + ret = __pxa2xx_pcm_open(substream); + if (ret) + return ret;
runtime->hw.channels_min = 2; runtime->hw.channels_max = 2;
- r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? - AC97_RATES_FRONT_DAC : AC97_RATES_ADC; - runtime->hw.rates = pxa2xx_ac97_ac97->rates[r]; + i = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? + AC97_RATES_FRONT_DAC : AC97_RATES_ADC; + runtime->hw.rates = pxa2xx_ac97_ac97->rates[i]; snd_pcm_limit_hw_rates(runtime);
- platform_ops = substream->pcm->card->dev->platform_data; - if (platform_ops && platform_ops->startup) - return platform_ops->startup(substream, platform_ops->priv); - else - return 0; + platform_ops = substream->pcm->card->dev->platform_data; + if (platform_ops && platform_ops->startup) { + ret = platform_ops->startup(substream, platform_ops->priv); + if (ret < 0) + __pxa2xx_pcm_close(substream); + } + + return ret; }
-static void pxa2xx_ac97_pcm_shutdown(struct snd_pcm_substream *substream) +static int pxa2xx_ac97_pcm_close(struct snd_pcm_substream *substream) { pxa2xx_audio_ops_t *platform_ops;
- platform_ops = substream->pcm->card->dev->platform_data; + platform_ops = substream->pcm->card->dev->platform_data; if (platform_ops && platform_ops->shutdown) platform_ops->shutdown(substream, platform_ops->priv); + + return 0; }
static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) @@ -115,17 +108,15 @@ static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; + int ret; + + ret = __pxa2xx_pcm_prepare(substream); + if (ret < 0) + return ret; + return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate); }
-static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = { - .playback_params = &pxa2xx_ac97_pcm_out, - .capture_params = &pxa2xx_ac97_pcm_in, - .startup = pxa2xx_ac97_pcm_startup, - .shutdown = pxa2xx_ac97_pcm_shutdown, - .prepare = pxa2xx_ac97_pcm_prepare, -}; - #ifdef CONFIG_PM_SLEEP
static int pxa2xx_ac97_do_suspend(struct snd_card *card) @@ -183,6 +174,53 @@ static int pxa2xx_ac97_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); #endif
+static const struct snd_pcm_ops pxa2xx_pcm_ops = { + .open = pxa2xx_ac97_pcm_open, + .close = pxa2xx_ac97_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = __pxa2xx_pcm_hw_params, + .hw_free = __pxa2xx_pcm_hw_free, + .prepare = pxa2xx_ac97_pcm_prepare, + .trigger = pxa2xx_pcm_trigger, + .pointer = pxa2xx_pcm_pointer, + .mmap = pxa2xx_pcm_mmap, +}; + + +static int pxa2xx_ac97_pcm_new(struct snd_card *card) +{ + struct snd_pcm *pcm; + int stream, ret; + + ret = snd_pcm_new(card, "PXA2xx-PCM", 0, 1, 1, &pcm); + if (ret) + goto out; + + pcm->private_free = pxa2xx_pcm_free_dma_buffers; + + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); + if (ret) + goto out; + + stream = SNDRV_PCM_STREAM_PLAYBACK; + snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); + if (ret) + goto out; + + stream = SNDRV_PCM_STREAM_CAPTURE; + snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); + if (ret) + goto out; + + pxa2xx_ac97_pcm = pcm; + ret = 0; + + out: + return ret; +} + static int pxa2xx_ac97_probe(struct platform_device *dev) { struct snd_card *card; @@ -204,7 +242,7 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
- ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); + ret = pxa2xx_ac97_pcm_new(card); if (ret) goto err;
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index dcbe7ecc1835..b927fa5ddbc0 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -16,8 +16,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-#include "pxa2xx-pcm.h" - static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c deleted file mode 100644 index 1c6f4b436de3..000000000000 --- a/sound/arm/pxa2xx-pcm.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * linux/sound/arm/pxa2xx-pcm.c -- ALSA PCM interface for the Intel PXA2xx chip - * - * Author: Nicolas Pitre - * Created: Nov 30, 2004 - * Copyright: (C) 2004 MontaVista Software, Inc. - * - * 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. - */ - -#include <linux/module.h> -#include <linux/dma-mapping.h> -#include <linux/dmaengine.h> - -#include <mach/dma.h> - -#include <sound/core.h> -#include <sound/pxa2xx-lib.h> -#include <sound/dmaengine_pcm.h> - -#include "pxa2xx-pcm.h" - -static int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) -{ - struct pxa2xx_pcm_client *client = substream->private_data; - - __pxa2xx_pcm_prepare(substream); - - return client->prepare(substream); -} - -static int pxa2xx_pcm_open(struct snd_pcm_substream *substream) -{ - struct pxa2xx_pcm_client *client = substream->private_data; - struct snd_pcm_runtime *runtime = substream->runtime; - struct pxa2xx_runtime_data *rtd; - int ret; - - ret = __pxa2xx_pcm_open(substream); - if (ret) - goto out; - - rtd = runtime->private_data; - - rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? - client->playback_params : client->capture_params; - - ret = client->startup(substream); - if (!ret) - goto err2; - - return 0; - - err2: - __pxa2xx_pcm_close(substream); - out: - return ret; -} - -static int pxa2xx_pcm_close(struct snd_pcm_substream *substream) -{ - struct pxa2xx_pcm_client *client = substream->private_data; - - client->shutdown(substream); - - return __pxa2xx_pcm_close(substream); -} - -static const struct snd_pcm_ops pxa2xx_pcm_ops = { - .open = pxa2xx_pcm_open, - .close = pxa2xx_pcm_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = __pxa2xx_pcm_hw_params, - .hw_free = __pxa2xx_pcm_hw_free, - .prepare = pxa2xx_pcm_prepare, - .trigger = pxa2xx_pcm_trigger, - .pointer = pxa2xx_pcm_pointer, - .mmap = pxa2xx_pcm_mmap, -}; - -int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client, - struct snd_pcm **rpcm) -{ - struct snd_pcm *pcm; - int play = client->playback_params ? 1 : 0; - int capt = client->capture_params ? 1 : 0; - int ret; - - ret = snd_pcm_new(card, "PXA2xx-PCM", 0, play, capt, &pcm); - if (ret) - goto out; - - pcm->private_data = client; - pcm->private_free = pxa2xx_pcm_free_dma_buffers; - - ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); - if (ret) - goto out; - - if (play) { - int stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); - if (ret) - goto out; - } - if (capt) { - int stream = SNDRV_PCM_STREAM_CAPTURE; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); - if (ret) - goto out; - } - - if (rpcm) - *rpcm = pcm; - ret = 0; - - out: - return ret; -} - -EXPORT_SYMBOL(pxa2xx_pcm_new); - -MODULE_AUTHOR("Nicolas Pitre"); -MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); -MODULE_LICENSE("GPL"); diff --git a/sound/arm/pxa2xx-pcm.h b/sound/arm/pxa2xx-pcm.h deleted file mode 100644 index 8fa2b7c9e6b8..000000000000 --- a/sound/arm/pxa2xx-pcm.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * linux/sound/arm/pxa2xx-pcm.h -- ALSA PCM interface for the Intel PXA2xx chip - * - * Author: Nicolas Pitre - * Created: Nov 30, 2004 - * Copyright: MontaVista Software, Inc. - * - * 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. - */ - -struct pxa2xx_runtime_data { - int dma_ch; - struct snd_dmaengine_dai_dma_data *params; -}; - -struct pxa2xx_pcm_client { - struct snd_dmaengine_dai_dma_data *playback_params; - struct snd_dmaengine_dai_dma_data *capture_params; - int (*startup)(struct snd_pcm_substream *); - void (*shutdown)(struct snd_pcm_substream *); - int (*prepare)(struct snd_pcm_substream *); -}; - -extern int pxa2xx_pcm_new(struct snd_card *, struct pxa2xx_pcm_client *, struct snd_pcm **); - diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 0b441338bdd4..c1f4af869289 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -34,7 +34,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-#include "../../arm/pxa2xx-pcm.h" #include "pxa-ssp.h"
/* diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 8b6a70e94c01..445e691126e5 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -20,8 +20,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-#include "../../arm/pxa2xx-pcm.h" - static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {
The patch
ASoC: fold pxa2xx-pcm into its only user, pxa2xx-ac97
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 95acb005fef2aeaeb63c20de98aca0ed5bd0efa2 Mon Sep 17 00:00:00 2001
From: Daniel Mack daniel@zonque.org Date: Wed, 27 Jun 2018 21:33:53 +0200 Subject: [PATCH] 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 --- sound/arm/Kconfig | 5 -- sound/arm/Makefile | 3 - sound/arm/pxa2xx-ac97.c | 114 +++++++++++++++++++++----------- sound/arm/pxa2xx-pcm-lib.c | 2 - sound/arm/pxa2xx-pcm.c | 129 ------------------------------------- sound/arm/pxa2xx-pcm.h | 27 -------- sound/soc/pxa/pxa-ssp.c | 1 - sound/soc/pxa/pxa2xx-pcm.c | 2 - 8 files changed, 76 insertions(+), 207 deletions(-) delete mode 100644 sound/arm/pxa2xx-pcm.c delete mode 100644 sound/arm/pxa2xx-pcm.h
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 65171f6657a2..5fbd47a9177e 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig @@ -17,14 +17,9 @@ config SND_ARMAACI select SND_PCM select SND_AC97_CODEC
-config SND_PXA2XX_PCM - tristate - select SND_PCM - config SND_PXA2XX_AC97 tristate "AC97 driver for the Intel PXA2xx chip" depends on ARCH_PXA - select SND_PXA2XX_PCM select SND_AC97_CODEC select SND_PXA2XX_LIB select SND_PXA2XX_LIB_AC97 diff --git a/sound/arm/Makefile b/sound/arm/Makefile index e10d5b169565..34c769489877 100644 --- a/sound/arm/Makefile +++ b/sound/arm/Makefile @@ -6,9 +6,6 @@ obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o snd-aaci-objs := aaci.o
-obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o -snd-pxa2xx-pcm-objs := pxa2xx-pcm.o - obj-$(CONFIG_SND_PXA2XX_LIB) += snd-pxa2xx-lib.o snd-pxa2xx-lib-y := pxa2xx-pcm-lib.o snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97) += pxa2xx-ac97-lib.o diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 236a63cdaf9f..7d8d7b7199dc 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -15,7 +15,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/dmaengine.h> -#include <linux/dma/pxa-dma.h> +#include <linux/dma-mapping.h>
#include <sound/core.h> #include <sound/pcm.h> @@ -27,8 +27,6 @@ #include <mach/regs-ac97.h> #include <mach/audio.h>
-#include "pxa2xx-pcm.h" - static void pxa2xx_ac97_legacy_reset(struct snd_ac97 *ac97) { if (!pxa2xx_ac97_try_cold_reset()) @@ -63,51 +61,46 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { .reset = pxa2xx_ac97_legacy_reset, };
-static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_out = { - .addr = __PREG(PCDR), - .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, - .chan_name = "pcm_pcm_stereo_out", - .maxburst = 32, -}; - -static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_in = { - .addr = __PREG(PCDR), - .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, - .chan_name = "pcm_pcm_stereo_in", - .maxburst = 32, -}; - static struct snd_pcm *pxa2xx_ac97_pcm; static struct snd_ac97 *pxa2xx_ac97_ac97;
-static int pxa2xx_ac97_pcm_startup(struct snd_pcm_substream *substream) +static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; pxa2xx_audio_ops_t *platform_ops; - int r; + int ret, i; + + ret = __pxa2xx_pcm_open(substream); + if (ret) + return ret;
runtime->hw.channels_min = 2; runtime->hw.channels_max = 2;
- r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? - AC97_RATES_FRONT_DAC : AC97_RATES_ADC; - runtime->hw.rates = pxa2xx_ac97_ac97->rates[r]; + i = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? + AC97_RATES_FRONT_DAC : AC97_RATES_ADC; + runtime->hw.rates = pxa2xx_ac97_ac97->rates[i]; snd_pcm_limit_hw_rates(runtime);
- platform_ops = substream->pcm->card->dev->platform_data; - if (platform_ops && platform_ops->startup) - return platform_ops->startup(substream, platform_ops->priv); - else - return 0; + platform_ops = substream->pcm->card->dev->platform_data; + if (platform_ops && platform_ops->startup) { + ret = platform_ops->startup(substream, platform_ops->priv); + if (ret < 0) + __pxa2xx_pcm_close(substream); + } + + return ret; }
-static void pxa2xx_ac97_pcm_shutdown(struct snd_pcm_substream *substream) +static int pxa2xx_ac97_pcm_close(struct snd_pcm_substream *substream) { pxa2xx_audio_ops_t *platform_ops;
- platform_ops = substream->pcm->card->dev->platform_data; + platform_ops = substream->pcm->card->dev->platform_data; if (platform_ops && platform_ops->shutdown) platform_ops->shutdown(substream, platform_ops->priv); + + return 0; }
static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) @@ -115,17 +108,15 @@ static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; + int ret; + + ret = __pxa2xx_pcm_prepare(substream); + if (ret < 0) + return ret; + return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate); }
-static struct pxa2xx_pcm_client pxa2xx_ac97_pcm_client = { - .playback_params = &pxa2xx_ac97_pcm_out, - .capture_params = &pxa2xx_ac97_pcm_in, - .startup = pxa2xx_ac97_pcm_startup, - .shutdown = pxa2xx_ac97_pcm_shutdown, - .prepare = pxa2xx_ac97_pcm_prepare, -}; - #ifdef CONFIG_PM_SLEEP
static int pxa2xx_ac97_do_suspend(struct snd_card *card) @@ -183,6 +174,53 @@ static int pxa2xx_ac97_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); #endif
+static const struct snd_pcm_ops pxa2xx_pcm_ops = { + .open = pxa2xx_ac97_pcm_open, + .close = pxa2xx_ac97_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = __pxa2xx_pcm_hw_params, + .hw_free = __pxa2xx_pcm_hw_free, + .prepare = pxa2xx_ac97_pcm_prepare, + .trigger = pxa2xx_pcm_trigger, + .pointer = pxa2xx_pcm_pointer, + .mmap = pxa2xx_pcm_mmap, +}; + + +static int pxa2xx_ac97_pcm_new(struct snd_card *card) +{ + struct snd_pcm *pcm; + int stream, ret; + + ret = snd_pcm_new(card, "PXA2xx-PCM", 0, 1, 1, &pcm); + if (ret) + goto out; + + pcm->private_free = pxa2xx_pcm_free_dma_buffers; + + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); + if (ret) + goto out; + + stream = SNDRV_PCM_STREAM_PLAYBACK; + snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); + if (ret) + goto out; + + stream = SNDRV_PCM_STREAM_CAPTURE; + snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); + if (ret) + goto out; + + pxa2xx_ac97_pcm = pcm; + ret = 0; + + out: + return ret; +} + static int pxa2xx_ac97_probe(struct platform_device *dev) { struct snd_card *card; @@ -204,7 +242,7 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
- ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); + ret = pxa2xx_ac97_pcm_new(card); if (ret) goto err;
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index dcbe7ecc1835..b927fa5ddbc0 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -16,8 +16,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-#include "pxa2xx-pcm.h" - static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c deleted file mode 100644 index 1c6f4b436de3..000000000000 --- a/sound/arm/pxa2xx-pcm.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * linux/sound/arm/pxa2xx-pcm.c -- ALSA PCM interface for the Intel PXA2xx chip - * - * Author: Nicolas Pitre - * Created: Nov 30, 2004 - * Copyright: (C) 2004 MontaVista Software, Inc. - * - * 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. - */ - -#include <linux/module.h> -#include <linux/dma-mapping.h> -#include <linux/dmaengine.h> - -#include <mach/dma.h> - -#include <sound/core.h> -#include <sound/pxa2xx-lib.h> -#include <sound/dmaengine_pcm.h> - -#include "pxa2xx-pcm.h" - -static int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) -{ - struct pxa2xx_pcm_client *client = substream->private_data; - - __pxa2xx_pcm_prepare(substream); - - return client->prepare(substream); -} - -static int pxa2xx_pcm_open(struct snd_pcm_substream *substream) -{ - struct pxa2xx_pcm_client *client = substream->private_data; - struct snd_pcm_runtime *runtime = substream->runtime; - struct pxa2xx_runtime_data *rtd; - int ret; - - ret = __pxa2xx_pcm_open(substream); - if (ret) - goto out; - - rtd = runtime->private_data; - - rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? - client->playback_params : client->capture_params; - - ret = client->startup(substream); - if (!ret) - goto err2; - - return 0; - - err2: - __pxa2xx_pcm_close(substream); - out: - return ret; -} - -static int pxa2xx_pcm_close(struct snd_pcm_substream *substream) -{ - struct pxa2xx_pcm_client *client = substream->private_data; - - client->shutdown(substream); - - return __pxa2xx_pcm_close(substream); -} - -static const struct snd_pcm_ops pxa2xx_pcm_ops = { - .open = pxa2xx_pcm_open, - .close = pxa2xx_pcm_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = __pxa2xx_pcm_hw_params, - .hw_free = __pxa2xx_pcm_hw_free, - .prepare = pxa2xx_pcm_prepare, - .trigger = pxa2xx_pcm_trigger, - .pointer = pxa2xx_pcm_pointer, - .mmap = pxa2xx_pcm_mmap, -}; - -int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client, - struct snd_pcm **rpcm) -{ - struct snd_pcm *pcm; - int play = client->playback_params ? 1 : 0; - int capt = client->capture_params ? 1 : 0; - int ret; - - ret = snd_pcm_new(card, "PXA2xx-PCM", 0, play, capt, &pcm); - if (ret) - goto out; - - pcm->private_data = client; - pcm->private_free = pxa2xx_pcm_free_dma_buffers; - - ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); - if (ret) - goto out; - - if (play) { - int stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); - if (ret) - goto out; - } - if (capt) { - int stream = SNDRV_PCM_STREAM_CAPTURE; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); - if (ret) - goto out; - } - - if (rpcm) - *rpcm = pcm; - ret = 0; - - out: - return ret; -} - -EXPORT_SYMBOL(pxa2xx_pcm_new); - -MODULE_AUTHOR("Nicolas Pitre"); -MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); -MODULE_LICENSE("GPL"); diff --git a/sound/arm/pxa2xx-pcm.h b/sound/arm/pxa2xx-pcm.h deleted file mode 100644 index 8fa2b7c9e6b8..000000000000 --- a/sound/arm/pxa2xx-pcm.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * linux/sound/arm/pxa2xx-pcm.h -- ALSA PCM interface for the Intel PXA2xx chip - * - * Author: Nicolas Pitre - * Created: Nov 30, 2004 - * Copyright: MontaVista Software, Inc. - * - * 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. - */ - -struct pxa2xx_runtime_data { - int dma_ch; - struct snd_dmaengine_dai_dma_data *params; -}; - -struct pxa2xx_pcm_client { - struct snd_dmaengine_dai_dma_data *playback_params; - struct snd_dmaengine_dai_dma_data *capture_params; - int (*startup)(struct snd_pcm_substream *); - void (*shutdown)(struct snd_pcm_substream *); - int (*prepare)(struct snd_pcm_substream *); -}; - -extern int pxa2xx_pcm_new(struct snd_card *, struct pxa2xx_pcm_client *, struct snd_pcm **); - diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 0b441338bdd4..c1f4af869289 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -34,7 +34,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-#include "../../arm/pxa2xx-pcm.h" #include "pxa-ssp.h"
/* diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 8b6a70e94c01..445e691126e5 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -20,8 +20,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-#include "../../arm/pxa2xx-pcm.h" - static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {
Clean up the namespace a bit and drop the __ prefix of all functions exported by pxa2xx-lib. This improves the readability of the code.
Signed-off-by: Daniel Mack daniel@zonque.org --- include/sound/pxa2xx-lib.h | 10 +++++----- sound/arm/pxa2xx-ac97.c | 10 +++++----- sound/arm/pxa2xx-pcm-lib.c | 22 +++++++++++----------- sound/soc/pxa/pxa2xx-pcm.c | 21 +++++++-------------- 4 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index 63f75450d3db..b43de38de8b2 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -10,14 +10,14 @@ struct snd_pcm_substream; struct snd_pcm_hw_params; struct snd_pcm;
-extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, +extern int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); -extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream); extern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd); extern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream); -extern int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream); -extern int __pxa2xx_pcm_open(struct snd_pcm_substream *substream); -extern int __pxa2xx_pcm_close(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_open(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_close(struct snd_pcm_substream *substream); extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma); extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream); diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 7d8d7b7199dc..0d624337857b 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -70,7 +70,7 @@ static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) pxa2xx_audio_ops_t *platform_ops; int ret, i;
- ret = __pxa2xx_pcm_open(substream); + ret = pxa2xx_pcm_open(substream); if (ret) return ret;
@@ -86,7 +86,7 @@ static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) if (platform_ops && platform_ops->startup) { ret = platform_ops->startup(substream, platform_ops->priv); if (ret < 0) - __pxa2xx_pcm_close(substream); + pxa2xx_pcm_close(substream); }
return ret; @@ -110,7 +110,7 @@ static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; int ret;
- ret = __pxa2xx_pcm_prepare(substream); + ret = pxa2xx_pcm_prepare(substream); if (ret < 0) return ret;
@@ -178,8 +178,8 @@ static const struct snd_pcm_ops pxa2xx_pcm_ops = { .open = pxa2xx_ac97_pcm_open, .close = pxa2xx_ac97_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = __pxa2xx_pcm_hw_params, - .hw_free = __pxa2xx_pcm_hw_free, + .hw_params = pxa2xx_pcm_hw_params, + .hw_free = pxa2xx_pcm_hw_free, .prepare = pxa2xx_ac97_pcm_prepare, .trigger = pxa2xx_pcm_trigger, .pointer = pxa2xx_pcm_pointer, diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index b927fa5ddbc0..dc56dbebf441 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -33,8 +33,8 @@ static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { .fifo_size = 32, };
-int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) +int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) { struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -62,14 +62,14 @@ int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
return 0; } -EXPORT_SYMBOL(__pxa2xx_pcm_hw_params); +EXPORT_SYMBOL(pxa2xx_pcm_hw_params);
-int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) +int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) { snd_pcm_set_runtime_buffer(substream, NULL); return 0; } -EXPORT_SYMBOL(__pxa2xx_pcm_hw_free); +EXPORT_SYMBOL(pxa2xx_pcm_hw_free);
int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { @@ -84,13 +84,13 @@ pxa2xx_pcm_pointer(struct snd_pcm_substream *substream) } EXPORT_SYMBOL(pxa2xx_pcm_pointer);
-int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) +int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) { return 0; } -EXPORT_SYMBOL(__pxa2xx_pcm_prepare); +EXPORT_SYMBOL(pxa2xx_pcm_prepare);
-int __pxa2xx_pcm_open(struct snd_pcm_substream *substream) +int pxa2xx_pcm_open(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; @@ -127,13 +127,13 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream) substream, dma_request_slave_channel(rtd->cpu_dai->dev, dma_params->chan_name)); } -EXPORT_SYMBOL(__pxa2xx_pcm_open); +EXPORT_SYMBOL(pxa2xx_pcm_open);
-int __pxa2xx_pcm_close(struct snd_pcm_substream *substream) +int pxa2xx_pcm_close(struct snd_pcm_substream *substream) { return snd_dmaengine_pcm_close_release_chan(substream); } -EXPORT_SYMBOL(__pxa2xx_pcm_close); +EXPORT_SYMBOL(pxa2xx_pcm_close);
int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 445e691126e5..da252d1f732e 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -20,8 +20,8 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) +static int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_dmaengine_dai_dma_data *dma; @@ -33,23 +33,16 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, if (!dma) return 0;
- return __pxa2xx_pcm_hw_params(substream, params); -} - -static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) -{ - __pxa2xx_pcm_hw_free(substream); - - return 0; + return pxa2xx_pcm_hw_params(substream, params); }
static const struct snd_pcm_ops pxa2xx_pcm_ops = { - .open = __pxa2xx_pcm_open, - .close = __pxa2xx_pcm_close, + .open = pxa2xx_pcm_open, + .close = pxa2xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = pxa2xx_pcm_hw_params, + .hw_params = __pxa2xx_pcm_hw_params, .hw_free = pxa2xx_pcm_hw_free, - .prepare = __pxa2xx_pcm_prepare, + .prepare = pxa2xx_pcm_prepare, .trigger = pxa2xx_pcm_trigger, .pointer = pxa2xx_pcm_pointer, .mmap = pxa2xx_pcm_mmap,
The patch
ASoC: pxa: clean up function names in pxa2xx-lib
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From a7160670b5e2d6b59e0f7a5b7e5bcef3b532c24c Mon Sep 17 00:00:00 2001
From: Daniel Mack daniel@zonque.org Date: Wed, 27 Jun 2018 21:33:54 +0200 Subject: [PATCH] ASoC: pxa: clean up function names in pxa2xx-lib
Clean up the namespace a bit and drop the __ prefix of all functions exported by pxa2xx-lib. This improves the readability of the code.
Signed-off-by: Daniel Mack daniel@zonque.org Signed-off-by: Mark Brown broonie@kernel.org --- include/sound/pxa2xx-lib.h | 10 +++++----- sound/arm/pxa2xx-ac97.c | 10 +++++----- sound/arm/pxa2xx-pcm-lib.c | 22 +++++++++++----------- sound/soc/pxa/pxa2xx-pcm.c | 21 +++++++-------------- 4 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index 63f75450d3db..b43de38de8b2 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -10,14 +10,14 @@ struct snd_pcm_substream; struct snd_pcm_hw_params; struct snd_pcm;
-extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, +extern int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); -extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream); extern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd); extern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream); -extern int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream); -extern int __pxa2xx_pcm_open(struct snd_pcm_substream *substream); -extern int __pxa2xx_pcm_close(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_open(struct snd_pcm_substream *substream); +extern int pxa2xx_pcm_close(struct snd_pcm_substream *substream); extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma); extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream); diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 7d8d7b7199dc..0d624337857b 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -70,7 +70,7 @@ static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) pxa2xx_audio_ops_t *platform_ops; int ret, i;
- ret = __pxa2xx_pcm_open(substream); + ret = pxa2xx_pcm_open(substream); if (ret) return ret;
@@ -86,7 +86,7 @@ static int pxa2xx_ac97_pcm_open(struct snd_pcm_substream *substream) if (platform_ops && platform_ops->startup) { ret = platform_ops->startup(substream, platform_ops->priv); if (ret < 0) - __pxa2xx_pcm_close(substream); + pxa2xx_pcm_close(substream); }
return ret; @@ -110,7 +110,7 @@ static int pxa2xx_ac97_pcm_prepare(struct snd_pcm_substream *substream) AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; int ret;
- ret = __pxa2xx_pcm_prepare(substream); + ret = pxa2xx_pcm_prepare(substream); if (ret < 0) return ret;
@@ -178,8 +178,8 @@ static const struct snd_pcm_ops pxa2xx_pcm_ops = { .open = pxa2xx_ac97_pcm_open, .close = pxa2xx_ac97_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = __pxa2xx_pcm_hw_params, - .hw_free = __pxa2xx_pcm_hw_free, + .hw_params = pxa2xx_pcm_hw_params, + .hw_free = pxa2xx_pcm_hw_free, .prepare = pxa2xx_ac97_pcm_prepare, .trigger = pxa2xx_pcm_trigger, .pointer = pxa2xx_pcm_pointer, diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index b927fa5ddbc0..dc56dbebf441 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -33,8 +33,8 @@ static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { .fifo_size = 32, };
-int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) +int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) { struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -62,14 +62,14 @@ int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
return 0; } -EXPORT_SYMBOL(__pxa2xx_pcm_hw_params); +EXPORT_SYMBOL(pxa2xx_pcm_hw_params);
-int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) +int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) { snd_pcm_set_runtime_buffer(substream, NULL); return 0; } -EXPORT_SYMBOL(__pxa2xx_pcm_hw_free); +EXPORT_SYMBOL(pxa2xx_pcm_hw_free);
int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { @@ -84,13 +84,13 @@ pxa2xx_pcm_pointer(struct snd_pcm_substream *substream) } EXPORT_SYMBOL(pxa2xx_pcm_pointer);
-int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) +int pxa2xx_pcm_prepare(struct snd_pcm_substream *substream) { return 0; } -EXPORT_SYMBOL(__pxa2xx_pcm_prepare); +EXPORT_SYMBOL(pxa2xx_pcm_prepare);
-int __pxa2xx_pcm_open(struct snd_pcm_substream *substream) +int pxa2xx_pcm_open(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; @@ -127,13 +127,13 @@ int __pxa2xx_pcm_open(struct snd_pcm_substream *substream) substream, dma_request_slave_channel(rtd->cpu_dai->dev, dma_params->chan_name)); } -EXPORT_SYMBOL(__pxa2xx_pcm_open); +EXPORT_SYMBOL(pxa2xx_pcm_open);
-int __pxa2xx_pcm_close(struct snd_pcm_substream *substream) +int pxa2xx_pcm_close(struct snd_pcm_substream *substream) { return snd_dmaengine_pcm_close_release_chan(substream); } -EXPORT_SYMBOL(__pxa2xx_pcm_close); +EXPORT_SYMBOL(pxa2xx_pcm_close);
int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 445e691126e5..da252d1f732e 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -20,8 +20,8 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) +static int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_dmaengine_dai_dma_data *dma; @@ -33,23 +33,16 @@ static int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, if (!dma) return 0;
- return __pxa2xx_pcm_hw_params(substream, params); -} - -static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) -{ - __pxa2xx_pcm_hw_free(substream); - - return 0; + return pxa2xx_pcm_hw_params(substream, params); }
static const struct snd_pcm_ops pxa2xx_pcm_ops = { - .open = __pxa2xx_pcm_open, - .close = __pxa2xx_pcm_close, + .open = pxa2xx_pcm_open, + .close = pxa2xx_pcm_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = pxa2xx_pcm_hw_params, + .hw_params = __pxa2xx_pcm_hw_params, .hw_free = pxa2xx_pcm_hw_free, - .prepare = __pxa2xx_pcm_prepare, + .prepare = pxa2xx_pcm_prepare, .trigger = pxa2xx_pcm_trigger, .pointer = pxa2xx_pcm_pointer, .mmap = pxa2xx_pcm_mmap,
To get rid of some intermediate platform layers, move pxa2xx_soc_pcm_new() and pxa2xx_pcm_ops in pxa2xx-lib.
Signed-off-by: Daniel Mack daniel@zonque.org --- include/sound/pxa2xx-lib.h | 3 +++ sound/arm/pxa2xx-ac97.c | 6 ++--- sound/arm/pxa2xx-pcm-lib.c | 41 ++++++++++++++++++++++++++++ sound/soc/pxa/pxa2xx-pcm.c | 55 -------------------------------------- 4 files changed, 47 insertions(+), 58 deletions(-)
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index b43de38de8b2..6758fc12fa84 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -8,6 +8,7 @@ /* PCM */ struct snd_pcm_substream; struct snd_pcm_hw_params; +struct snd_soc_pcm_runtime; struct snd_pcm;
extern int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, @@ -22,6 +23,8 @@ extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma); extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream); extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm); +extern int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd); +extern const struct snd_pcm_ops pxa2xx_pcm_ops;
/* AC97 */
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 0d624337857b..1f72672262d0 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -174,7 +174,7 @@ static int pxa2xx_ac97_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); #endif
-static const struct snd_pcm_ops pxa2xx_pcm_ops = { +static const struct snd_pcm_ops pxa2xx_ac97_pcm_ops = { .open = pxa2xx_ac97_pcm_open, .close = pxa2xx_ac97_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -203,13 +203,13 @@ static int pxa2xx_ac97_pcm_new(struct snd_card *card) goto out;
stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + snd_pcm_set_ops(pcm, stream, &pxa2xx_ac97_pcm_ops); ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); if (ret) goto out;
stream = SNDRV_PCM_STREAM_CAPTURE; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + snd_pcm_set_ops(pcm, stream, &pxa2xx_ac97_pcm_ops); ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); if (ret) goto out; diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index dc56dbebf441..add23d9b4ef6 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -179,6 +179,47 @@ void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm) } EXPORT_SYMBOL(pxa2xx_pcm_free_dma_buffers);
+int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_card *card = rtd->card->snd_card; + struct snd_pcm *pcm = rtd->pcm; + int ret; + + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, + SNDRV_PCM_STREAM_PLAYBACK); + if (ret) + goto out; + } + + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, + SNDRV_PCM_STREAM_CAPTURE); + if (ret) + goto out; + } + out: + return ret; +} +EXPORT_SYMBOL(pxa2xx_soc_pcm_new); + +const struct snd_pcm_ops pxa2xx_pcm_ops = { + .open = pxa2xx_pcm_open, + .close = pxa2xx_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = pxa2xx_pcm_hw_params, + .hw_free = pxa2xx_pcm_hw_free, + .prepare = pxa2xx_pcm_prepare, + .trigger = pxa2xx_pcm_trigger, + .pointer = pxa2xx_pcm_pointer, + .mmap = pxa2xx_pcm_mmap, +}; +EXPORT_SYMBOL(pxa2xx_pcm_ops); + MODULE_AUTHOR("Nicolas Pitre"); MODULE_DESCRIPTION("Intel PXA2xx sound library"); MODULE_LICENSE("GPL"); diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index da252d1f732e..a1df4ec76cbd 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -20,61 +20,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-static int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_dmaengine_dai_dma_data *dma; - - dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - - /* return if this is a bufferless transfer e.g. - * codec <--> BT codec or GSM modem -- lg FIXME */ - if (!dma) - return 0; - - return pxa2xx_pcm_hw_params(substream, params); -} - -static const struct snd_pcm_ops pxa2xx_pcm_ops = { - .open = pxa2xx_pcm_open, - .close = pxa2xx_pcm_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = __pxa2xx_pcm_hw_params, - .hw_free = pxa2xx_pcm_hw_free, - .prepare = pxa2xx_pcm_prepare, - .trigger = pxa2xx_pcm_trigger, - .pointer = pxa2xx_pcm_pointer, - .mmap = pxa2xx_pcm_mmap, -}; - -static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_card *card = rtd->card->snd_card; - struct snd_pcm *pcm = rtd->pcm; - int ret; - - ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - - if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, - SNDRV_PCM_STREAM_PLAYBACK); - if (ret) - goto out; - } - - if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, - SNDRV_PCM_STREAM_CAPTURE); - if (ret) - goto out; - } - out: - return ret; -} - static const struct snd_soc_component_driver pxa2xx_soc_platform = { .ops = &pxa2xx_pcm_ops, .pcm_new = pxa2xx_soc_pcm_new,
The patch
ASoC: pxa: move some functions to pxa2xx-lib
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 7afd1b0b2ef9a8120951188a955010ef92bdf885 Mon Sep 17 00:00:00 2001
From: Daniel Mack daniel@zonque.org Date: Wed, 27 Jun 2018 21:33:55 +0200 Subject: [PATCH] ASoC: pxa: move some functions to pxa2xx-lib
To get rid of some intermediate platform layers, move pxa2xx_soc_pcm_new() and pxa2xx_pcm_ops in pxa2xx-lib.
Signed-off-by: Daniel Mack daniel@zonque.org Signed-off-by: Mark Brown broonie@kernel.org --- include/sound/pxa2xx-lib.h | 3 +++ sound/arm/pxa2xx-ac97.c | 6 ++--- sound/arm/pxa2xx-pcm-lib.c | 41 ++++++++++++++++++++++++++++ sound/soc/pxa/pxa2xx-pcm.c | 55 -------------------------------------- 4 files changed, 47 insertions(+), 58 deletions(-)
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h index b43de38de8b2..6758fc12fa84 100644 --- a/include/sound/pxa2xx-lib.h +++ b/include/sound/pxa2xx-lib.h @@ -8,6 +8,7 @@ /* PCM */ struct snd_pcm_substream; struct snd_pcm_hw_params; +struct snd_soc_pcm_runtime; struct snd_pcm;
extern int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, @@ -22,6 +23,8 @@ extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma); extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream); extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm); +extern int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd); +extern const struct snd_pcm_ops pxa2xx_pcm_ops;
/* AC97 */
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 0d624337857b..1f72672262d0 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -174,7 +174,7 @@ static int pxa2xx_ac97_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); #endif
-static const struct snd_pcm_ops pxa2xx_pcm_ops = { +static const struct snd_pcm_ops pxa2xx_ac97_pcm_ops = { .open = pxa2xx_ac97_pcm_open, .close = pxa2xx_ac97_pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -203,13 +203,13 @@ static int pxa2xx_ac97_pcm_new(struct snd_card *card) goto out;
stream = SNDRV_PCM_STREAM_PLAYBACK; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + snd_pcm_set_ops(pcm, stream, &pxa2xx_ac97_pcm_ops); ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); if (ret) goto out;
stream = SNDRV_PCM_STREAM_CAPTURE; - snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); + snd_pcm_set_ops(pcm, stream, &pxa2xx_ac97_pcm_ops); ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); if (ret) goto out; diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index dc56dbebf441..add23d9b4ef6 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -179,6 +179,47 @@ void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm) } EXPORT_SYMBOL(pxa2xx_pcm_free_dma_buffers);
+int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_card *card = rtd->card->snd_card; + struct snd_pcm *pcm = rtd->pcm; + int ret; + + ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, + SNDRV_PCM_STREAM_PLAYBACK); + if (ret) + goto out; + } + + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { + ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, + SNDRV_PCM_STREAM_CAPTURE); + if (ret) + goto out; + } + out: + return ret; +} +EXPORT_SYMBOL(pxa2xx_soc_pcm_new); + +const struct snd_pcm_ops pxa2xx_pcm_ops = { + .open = pxa2xx_pcm_open, + .close = pxa2xx_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = pxa2xx_pcm_hw_params, + .hw_free = pxa2xx_pcm_hw_free, + .prepare = pxa2xx_pcm_prepare, + .trigger = pxa2xx_pcm_trigger, + .pointer = pxa2xx_pcm_pointer, + .mmap = pxa2xx_pcm_mmap, +}; +EXPORT_SYMBOL(pxa2xx_pcm_ops); + MODULE_AUTHOR("Nicolas Pitre"); MODULE_DESCRIPTION("Intel PXA2xx sound library"); MODULE_LICENSE("GPL"); diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index da252d1f732e..a1df4ec76cbd 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -20,61 +20,6 @@ #include <sound/pxa2xx-lib.h> #include <sound/dmaengine_pcm.h>
-static int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_dmaengine_dai_dma_data *dma; - - dma = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); - - /* return if this is a bufferless transfer e.g. - * codec <--> BT codec or GSM modem -- lg FIXME */ - if (!dma) - return 0; - - return pxa2xx_pcm_hw_params(substream, params); -} - -static const struct snd_pcm_ops pxa2xx_pcm_ops = { - .open = pxa2xx_pcm_open, - .close = pxa2xx_pcm_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = __pxa2xx_pcm_hw_params, - .hw_free = pxa2xx_pcm_hw_free, - .prepare = pxa2xx_pcm_prepare, - .trigger = pxa2xx_pcm_trigger, - .pointer = pxa2xx_pcm_pointer, - .mmap = pxa2xx_pcm_mmap, -}; - -static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_card *card = rtd->card->snd_card; - struct snd_pcm *pcm = rtd->pcm; - int ret; - - ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - - if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, - SNDRV_PCM_STREAM_PLAYBACK); - if (ret) - goto out; - } - - if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { - ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, - SNDRV_PCM_STREAM_CAPTURE); - if (ret) - goto out; - } - out: - return ret; -} - static const struct snd_soc_component_driver pxa2xx_soc_platform = { .ops = &pxa2xx_pcm_ops, .pcm_new = pxa2xx_soc_pcm_new,
While at it, also fix some indenting.
Signed-off-by: Daniel Mack daniel@zonque.org --- sound/arm/pxa2xx-pcm-lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index add23d9b4ef6..7931789d4a9f 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -23,8 +23,8 @@ static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, .formats = SNDRV_PCM_FMTBIT_S16_LE | - SNDRV_PCM_FMTBIT_S24_LE | - SNDRV_PCM_FMTBIT_S32_LE, + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, .period_bytes_min = 32, .period_bytes_max = 8192 - 32, .periods_min = 1,
The patch
ASoC: pxa2xx-pcm-lib: fix indenting
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 456ec80876564edb74a0fff78499beb7ca286302 Mon Sep 17 00:00:00 2001
From: Daniel Mack daniel@zonque.org Date: Wed, 27 Jun 2018 21:33:56 +0200 Subject: [PATCH] ASoC: pxa2xx-pcm-lib: fix indenting
While at it, also fix some indenting.
Signed-off-by: Daniel Mack daniel@zonque.org Signed-off-by: Mark Brown broonie@kernel.org --- sound/arm/pxa2xx-pcm-lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index add23d9b4ef6..7931789d4a9f 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c @@ -23,8 +23,8 @@ static const struct snd_pcm_hardware pxa2xx_pcm_hardware = { SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, .formats = SNDRV_PCM_FMTBIT_S16_LE | - SNDRV_PCM_FMTBIT_S24_LE | - SNDRV_PCM_FMTBIT_S32_LE, + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, .period_bytes_min = 32, .period_bytes_max = 8192 - 32, .periods_min = 1,
Now that the functions are now available through pxa2xx-lib, hook them up to pxa-sspi, pxa-ac97 and pxa-i2s. This allows DT platforms to use the DAIs without a platform driver.
Signed-off-by: Daniel Mack daniel@zonque.org --- sound/soc/pxa/pxa-ssp.c | 3 +++ sound/soc/pxa/pxa2xx-ac97.c | 3 +++ sound/soc/pxa/pxa2xx-i2s.c | 3 +++ 3 files changed, 9 insertions(+)
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index c1f4af869289..01d54697ede4 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -841,6 +841,9 @@ static struct snd_soc_dai_driver pxa_ssp_dai = {
static const struct snd_soc_component_driver pxa_ssp_component = { .name = "pxa-ssp", + .ops = &pxa2xx_pcm_ops, + .pcm_new = pxa2xx_soc_pcm_new, + .pcm_free = pxa2xx_pcm_free_dma_buffers, };
#ifdef CONFIG_OF diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 1b41c0f2a8fb..95e34d196eab 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -214,6 +214,9 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
static const struct snd_soc_component_driver pxa_ac97_component = { .name = "pxa-ac97", + .ops = &pxa2xx_pcm_ops, + .pcm_new = pxa2xx_soc_pcm_new, + .pcm_free = pxa2xx_pcm_free_dma_buffers, };
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index e7184de0de04..42820121e5b9 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c @@ -364,6 +364,9 @@ static struct snd_soc_dai_driver pxa_i2s_dai = {
static const struct snd_soc_component_driver pxa_i2s_component = { .name = "pxa-i2s", + .ops = &pxa2xx_pcm_ops, + .pcm_new = pxa2xx_soc_pcm_new, + .pcm_free = pxa2xx_pcm_free_dma_buffers, };
static int pxa2xx_i2s_drv_probe(struct platform_device *pdev)
This platform is no longer needed on DT boards, so let's remove them to avoid confusion. DT bindings should use the CPU DAIs (I2S/SSP/AC97) directly.
Signed-off-by: Daniel Mack daniel@zonque.org --- .../devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt | 15 --------------- sound/soc/pxa/pxa2xx-pcm.c | 9 --------- 2 files changed, 24 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt
diff --git a/Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt b/Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt deleted file mode 100644 index 551fbb8348c2..000000000000 --- a/Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt +++ /dev/null @@ -1,15 +0,0 @@ -DT bindings for ARM PXA2xx PCM platform driver - -This is just a dummy driver that registers the PXA ASoC platform driver. -It does not have any resources assigned. - -Required properties: - - - compatible 'mrvl,pxa-pcm-audio' - -Example: - - pxa_pcm_audio: snd_soc_pxa_audio { - compatible = "mrvl,pxa-pcm-audio"; - }; - diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index a1df4ec76cbd..72eaaef1b426 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -32,18 +32,9 @@ static int pxa2xx_soc_platform_probe(struct platform_device *pdev) NULL, 0); }
-#ifdef CONFIG_OF -static const struct of_device_id snd_soc_pxa_audio_match[] = { - { .compatible = "mrvl,pxa-pcm-audio" }, - { } -}; -MODULE_DEVICE_TABLE(of, snd_soc_pxa_audio_match); -#endif - static struct platform_driver pxa_pcm_driver = { .driver = { .name = "pxa-pcm-audio", - .of_match_table = of_match_ptr(snd_soc_pxa_audio_match), },
.probe = pxa2xx_soc_platform_probe,
The patch
ASoC: pxa: remove bindings from pxa2xx-pcm
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From c7b4f15ddb4f28451679019374027f5223c616ce Mon Sep 17 00:00:00 2001
From: Daniel Mack daniel@zonque.org Date: Wed, 27 Jun 2018 21:33:58 +0200 Subject: [PATCH] ASoC: pxa: remove bindings from pxa2xx-pcm
This platform is no longer needed on DT boards, so let's remove them to avoid confusion. DT bindings should use the CPU DAIs (I2S/SSP/AC97) directly.
Signed-off-by: Daniel Mack daniel@zonque.org Signed-off-by: Mark Brown broonie@kernel.org --- .../devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt | 15 --------------- sound/soc/pxa/pxa2xx-pcm.c | 9 --------- 2 files changed, 24 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt
diff --git a/Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt b/Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt deleted file mode 100644 index 551fbb8348c2..000000000000 --- a/Documentation/devicetree/bindings/sound/mrvl,pxa2xx-pcm.txt +++ /dev/null @@ -1,15 +0,0 @@ -DT bindings for ARM PXA2xx PCM platform driver - -This is just a dummy driver that registers the PXA ASoC platform driver. -It does not have any resources assigned. - -Required properties: - - - compatible 'mrvl,pxa-pcm-audio' - -Example: - - pxa_pcm_audio: snd_soc_pxa_audio { - compatible = "mrvl,pxa-pcm-audio"; - }; - diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index a1df4ec76cbd..72eaaef1b426 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -32,18 +32,9 @@ static int pxa2xx_soc_platform_probe(struct platform_device *pdev) NULL, 0); }
-#ifdef CONFIG_OF -static const struct of_device_id snd_soc_pxa_audio_match[] = { - { .compatible = "mrvl,pxa-pcm-audio" }, - { } -}; -MODULE_DEVICE_TABLE(of, snd_soc_pxa_audio_match); -#endif - static struct platform_driver pxa_pcm_driver = { .driver = { .name = "pxa-pcm-audio", - .of_match_table = of_match_ptr(snd_soc_pxa_audio_match), },
.probe = pxa2xx_soc_platform_probe,
Signed-off-by: Daniel Mack daniel@zonque.org --- sound/soc/pxa/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 960744e46edc..95dcf97a6271 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig @@ -31,7 +31,7 @@ config SND_PXA2XX_SOC_I2S tristate
config SND_PXA_SOC_SSP - tristate + tristate "Soc Audio via PXA2xx/PXA3xx SSP ports" select PXA_SSP
config SND_MMP_SOC_SSPA
The patch
ASoC: pxa: make SND_PXA2XX_SOC_I2S selectable
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 0a94cf3457408058f894cc4d95e58d8e18eb7f75 Mon Sep 17 00:00:00 2001
From: Daniel Mack daniel@zonque.org Date: Wed, 27 Jun 2018 21:33:59 +0200 Subject: [PATCH] ASoC: pxa: make SND_PXA2XX_SOC_I2S selectable
Signed-off-by: Daniel Mack daniel@zonque.org Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/pxa/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index 960744e46edc..95dcf97a6271 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig @@ -31,7 +31,7 @@ config SND_PXA2XX_SOC_I2S tristate
config SND_PXA_SOC_SSP - tristate + tristate "Soc Audio via PXA2xx/PXA3xx SSP ports" select PXA_SSP
config SND_MMP_SOC_SSPA
participants (2)
-
Daniel Mack
-
Mark Brown