[alsa-devel] [PATCH for-5.6 00/23] ASoC: PCM API updates (part I)
Hi,
this is a patch set to adapt the recent PCM API updates to ASoC drivers. This is the first half of the whole changes, just for updating the buffer allocation code with the new API. There should be no functional changes.
The ASoC core changes are already found in 5.5-rc1, so please merge these onto 5.5-rc1 or later branch. Or I can merge through my tree, too, just let me know.
thanks,
Takashi
===
Takashi Iwai (23): ASoC: amd: Use managed buffer allocation ASoC: au1x: Use managed buffer allocation ASoC: dwc: Use managed buffer allocation ASoC: mediatek: Use managed buffer allocation ASoC: meson: Use managed buffer allocation ASoC: dma-sh7760: Use managed buffer allocation ASoC: fsi: Use managed buffer allocation ASoC: rcar: Use managed buffer allocation ASoC: siu_pcm: Use managed buffer allocation ASoC: generic-dmaengine-pcm: Use managed buffer allocation ASoC: SOF: Use managed buffer allocation ASoC: stm32: Use managed buffer allocation ASoC: txx9: Use managed buffer allocation ASoC: uniphier: Use managed buffer allocation ASoC: xilinx: Use managed buffer allocation ASoC: xtensa: Use managed buffer allocation ASoC: cros_ec_codec: Use managed buffer allocation ASoC: rt5514-spi: Use managed buffer allocation ASoC: rt5677-spi: Use managed buffer allocation ASoC: intel: atom: Use managed buffer allocation ASoC: intel: baytrail: Use managed buffer allocation ASoC: intel: haswell: Use managed buffer allocation ASoC: intel: skylake: Use managed buffer allocation
sound/soc/amd/acp-pcm-dma.c | 58 ++++++++-------------- sound/soc/amd/raven/acp3x-pcm-dma.c | 30 +++-------- sound/soc/au1x/dbdma2.c | 14 +----- sound/soc/au1x/dma.c | 21 +++----- sound/soc/codecs/cros_ec_codec.c | 8 +-- sound/soc/codecs/rt5514-spi.c | 10 ++-- sound/soc/codecs/rt5677-spi.c | 10 ++-- sound/soc/dwc/dwc-pcm.c | 24 +-------- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 25 +--------- sound/soc/intel/baytrail/sst-baytrail-pcm.c | 19 +------ sound/soc/intel/haswell/sst-haswell-pcm.c | 17 +------ sound/soc/intel/skylake/skl-pcm.c | 26 +++------- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 14 +----- sound/soc/mediatek/common/mtk-afe-fe-dai.h | 2 - .../soc/mediatek/common/mtk-afe-platform-driver.c | 12 +---- .../soc/mediatek/common/mtk-afe-platform-driver.h | 2 - sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 2 - sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 1 - sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 1 - sound/soc/meson/axg-fifo.c | 13 ++--- sound/soc/sh/dma-sh7760.c | 14 +----- sound/soc/sh/fsi.c | 18 +------ sound/soc/sh/rcar/core.c | 23 +++------ sound/soc/sh/siu_pcm.c | 39 +-------------- sound/soc/soc-generic-dmaengine-pcm.c | 12 +---- sound/soc/sof/pcm.c | 34 ++++--------- sound/soc/stm/stm32_adfsdm.c | 29 +---------- sound/soc/txx9/txx9aclc.c | 14 +----- sound/soc/uniphier/aio-dma.c | 30 +---------- sound/soc/xilinx/xlnx_formatter_pcm.c | 13 +---- sound/soc/xtensa/xtfpga-i2s.c | 9 ++-- 31 files changed, 93 insertions(+), 451 deletions(-)
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/amd/acp-pcm-dma.c | 58 +++++++++++++------------------------ sound/soc/amd/raven/acp3x-pcm-dma.c | 30 ++++--------------- 2 files changed, 26 insertions(+), 62 deletions(-)
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 4b9a27e25206..98400aaf0305 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -836,7 +836,6 @@ static int acp_dma_hw_params(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - int status; uint64_t size; u32 val = 0; struct snd_pcm_runtime *runtime; @@ -967,35 +966,19 @@ static int acp_dma_hw_params(struct snd_soc_component *component, }
size = params_buffer_bytes(params); - status = snd_pcm_lib_malloc_pages(substream, size); - if (status < 0) - return status; - - memset(substream->runtime->dma_area, 0, params_buffer_bytes(params));
- if (substream->dma_buffer.area) { - acp_set_sram_bank_state(rtd->acp_mmio, 0, true); - /* Save for runtime private data */ - rtd->dma_addr = substream->dma_buffer.addr; - rtd->order = get_order(size); + acp_set_sram_bank_state(rtd->acp_mmio, 0, true); + /* Save for runtime private data */ + rtd->dma_addr = substream->dma_buffer.addr; + rtd->order = get_order(size);
- /* Fill the page table entries in ACP SRAM */ - rtd->size = size; - rtd->num_of_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; - rtd->direction = substream->stream; + /* Fill the page table entries in ACP SRAM */ + rtd->size = size; + rtd->num_of_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; + rtd->direction = substream->stream;
- config_acp_dma(rtd->acp_mmio, rtd, adata->asic_type); - status = 0; - } else { - status = -ENOMEM; - } - return status; -} - -static int acp_dma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + config_acp_dma(rtd->acp_mmio, rtd, adata->asic_type); + return 0; }
static u64 acp_get_byte_count(struct audio_substream_data *rtd) @@ -1142,18 +1125,18 @@ static int acp_dma_new(struct snd_soc_component *component,
switch (adata->asic_type) { case CHIP_STONEY: - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, - SNDRV_DMA_TYPE_DEV, - parent, - ST_MIN_BUFFER, - ST_MAX_BUFFER); + snd_pcm_set_managed_buffer_all(rtd->pcm, + SNDRV_DMA_TYPE_DEV, + parent, + ST_MIN_BUFFER, + ST_MAX_BUFFER); break; default: - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, - SNDRV_DMA_TYPE_DEV, - parent, - MIN_BUFFER, - MAX_BUFFER); + snd_pcm_set_managed_buffer_all(rtd->pcm, + SNDRV_DMA_TYPE_DEV, + parent, + MIN_BUFFER, + MAX_BUFFER); break; } return 0; @@ -1221,7 +1204,6 @@ static const struct snd_soc_component_driver acp_asoc_platform = { .close = acp_dma_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = acp_dma_hw_params, - .hw_free = acp_dma_hw_free, .trigger = acp_dma_trigger, .pointer = acp_dma_pointer, .mmap = acp_dma_mmap, diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index 60709e3ba99d..98b76c38dae0 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -334,7 +334,6 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - int status; u64 size; struct snd_pcm_runtime *runtime = substream->runtime; struct i2s_stream_instance *rtd = runtime->private_data; @@ -343,20 +342,10 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component, return -EINVAL;
size = params_buffer_bytes(params); - status = snd_pcm_lib_malloc_pages(substream, size); - if (status < 0) - return status; - - memset(substream->runtime->dma_area, 0, params_buffer_bytes(params)); - if (substream->dma_buffer.area) { - rtd->dma_addr = substream->dma_buffer.addr; - rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); - config_acp3x_dma(rtd, substream->stream); - status = 0; - } else { - status = -ENOMEM; - } - return status; + rtd->dma_addr = substream->dma_buffer.addr; + rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); + config_acp3x_dma(rtd, substream->stream); + return 0; }
static snd_pcm_uframes_t acp3x_dma_pointer(struct snd_soc_component *component, @@ -381,17 +370,11 @@ static int acp3x_dma_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { struct device *parent = component->dev->parent; - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, - parent, MIN_BUFFER, MAX_BUFFER); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + parent, MIN_BUFFER, MAX_BUFFER); return 0; }
-static int acp3x_dma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int acp3x_dma_mmap(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct vm_area_struct *vma) @@ -601,7 +584,6 @@ static const struct snd_soc_component_driver acp3x_i2s_component = { .close = acp3x_dma_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = acp3x_dma_hw_params, - .hw_free = acp3x_dma_hw_free, .pointer = acp3x_dma_pointer, .mmap = acp3x_dma_mmap, .pcm_construct = acp3x_dma_new,
The patch
ASoC: amd: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 7f4aee8fa79c2d753aa1b2e9ffcad24689317f75 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:52 +0100 Subject: [PATCH] ASoC: amd: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-2-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/amd/acp-pcm-dma.c | 58 ++++++++++------------------- sound/soc/amd/raven/acp3x-pcm-dma.c | 30 +++------------ 2 files changed, 26 insertions(+), 62 deletions(-)
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 4b9a27e25206..98400aaf0305 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -836,7 +836,6 @@ static int acp_dma_hw_params(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - int status; uint64_t size; u32 val = 0; struct snd_pcm_runtime *runtime; @@ -967,35 +966,19 @@ static int acp_dma_hw_params(struct snd_soc_component *component, }
size = params_buffer_bytes(params); - status = snd_pcm_lib_malloc_pages(substream, size); - if (status < 0) - return status; - - memset(substream->runtime->dma_area, 0, params_buffer_bytes(params));
- if (substream->dma_buffer.area) { - acp_set_sram_bank_state(rtd->acp_mmio, 0, true); - /* Save for runtime private data */ - rtd->dma_addr = substream->dma_buffer.addr; - rtd->order = get_order(size); + acp_set_sram_bank_state(rtd->acp_mmio, 0, true); + /* Save for runtime private data */ + rtd->dma_addr = substream->dma_buffer.addr; + rtd->order = get_order(size);
- /* Fill the page table entries in ACP SRAM */ - rtd->size = size; - rtd->num_of_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; - rtd->direction = substream->stream; + /* Fill the page table entries in ACP SRAM */ + rtd->size = size; + rtd->num_of_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; + rtd->direction = substream->stream;
- config_acp_dma(rtd->acp_mmio, rtd, adata->asic_type); - status = 0; - } else { - status = -ENOMEM; - } - return status; -} - -static int acp_dma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + config_acp_dma(rtd->acp_mmio, rtd, adata->asic_type); + return 0; }
static u64 acp_get_byte_count(struct audio_substream_data *rtd) @@ -1142,18 +1125,18 @@ static int acp_dma_new(struct snd_soc_component *component,
switch (adata->asic_type) { case CHIP_STONEY: - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, - SNDRV_DMA_TYPE_DEV, - parent, - ST_MIN_BUFFER, - ST_MAX_BUFFER); + snd_pcm_set_managed_buffer_all(rtd->pcm, + SNDRV_DMA_TYPE_DEV, + parent, + ST_MIN_BUFFER, + ST_MAX_BUFFER); break; default: - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, - SNDRV_DMA_TYPE_DEV, - parent, - MIN_BUFFER, - MAX_BUFFER); + snd_pcm_set_managed_buffer_all(rtd->pcm, + SNDRV_DMA_TYPE_DEV, + parent, + MIN_BUFFER, + MAX_BUFFER); break; } return 0; @@ -1221,7 +1204,6 @@ static const struct snd_soc_component_driver acp_asoc_platform = { .close = acp_dma_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = acp_dma_hw_params, - .hw_free = acp_dma_hw_free, .trigger = acp_dma_trigger, .pointer = acp_dma_pointer, .mmap = acp_dma_mmap, diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index 60709e3ba99d..98b76c38dae0 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -334,7 +334,6 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - int status; u64 size; struct snd_pcm_runtime *runtime = substream->runtime; struct i2s_stream_instance *rtd = runtime->private_data; @@ -343,20 +342,10 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component, return -EINVAL;
size = params_buffer_bytes(params); - status = snd_pcm_lib_malloc_pages(substream, size); - if (status < 0) - return status; - - memset(substream->runtime->dma_area, 0, params_buffer_bytes(params)); - if (substream->dma_buffer.area) { - rtd->dma_addr = substream->dma_buffer.addr; - rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); - config_acp3x_dma(rtd, substream->stream); - status = 0; - } else { - status = -ENOMEM; - } - return status; + rtd->dma_addr = substream->dma_buffer.addr; + rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); + config_acp3x_dma(rtd, substream->stream); + return 0; }
static snd_pcm_uframes_t acp3x_dma_pointer(struct snd_soc_component *component, @@ -381,17 +370,11 @@ static int acp3x_dma_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { struct device *parent = component->dev->parent; - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, - parent, MIN_BUFFER, MAX_BUFFER); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + parent, MIN_BUFFER, MAX_BUFFER); return 0; }
-static int acp3x_dma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int acp3x_dma_mmap(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct vm_area_struct *vma) @@ -601,7 +584,6 @@ static const struct snd_soc_component_driver acp3x_i2s_component = { .close = acp3x_dma_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = acp3x_dma_hw_params, - .hw_free = acp3x_dma_hw_free, .pointer = acp3x_dma_pointer, .mmap = acp3x_dma_mmap, .pcm_construct = acp3x_dma_new,
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/au1x/dbdma2.c | 14 +------------- sound/soc/au1x/dma.c | 21 ++++++--------------- 2 files changed, 7 insertions(+), 28 deletions(-)
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 4553108ec92a..b2c0a0d8a407 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -197,10 +197,6 @@ static int au1xpsc_pcm_hw_params(struct snd_soc_component *component, struct au1xpsc_audio_dmadata *pcd; int stype, ret;
- ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - goto out; - stype = substream->stream; pcd = to_dmadata(substream, component);
@@ -232,13 +228,6 @@ static int au1xpsc_pcm_hw_params(struct snd_soc_component *component, return ret; }
-static int au1xpsc_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int au1xpsc_pcm_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -315,7 +304,7 @@ static int au1xpsc_pcm_new(struct snd_soc_component *component, struct snd_card *card = rtd->card->snd_card; struct snd_pcm *pcm = rtd->pcm;
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, AU1XPSC_BUFFER_MIN_BYTES, (4096 * 1024) - 1);
return 0; @@ -328,7 +317,6 @@ static struct snd_soc_component_driver au1xpsc_soc_component = { .close = au1xpsc_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = au1xpsc_pcm_hw_params, - .hw_free = au1xpsc_pcm_hw_free, .prepare = au1xpsc_pcm_prepare, .trigger = au1xpsc_pcm_trigger, .pointer = au1xpsc_pcm_pointer, diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index 054dfda89d3e..037f4a98fb76 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c @@ -231,19 +231,10 @@ static int alchemy_pcm_hw_params(struct snd_soc_component *component, struct snd_pcm_hw_params *hw_params) { struct audio_stream *stream = ss_to_as(substream, component); - int err; - - err = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (err < 0) - return err; - err = au1000_setup_dma_link(stream, - params_period_bytes(hw_params), - params_periods(hw_params)); - if (err) - snd_pcm_lib_free_pages(substream);
- return err; + return au1000_setup_dma_link(stream, + params_period_bytes(hw_params), + params_periods(hw_params)); }
static int alchemy_pcm_hw_free(struct snd_soc_component *component, @@ -251,7 +242,7 @@ static int alchemy_pcm_hw_free(struct snd_soc_component *component, { struct audio_stream *stream = ss_to_as(substream, component); au1000_release_dma_link(stream); - return snd_pcm_lib_free_pages(substream); + return 0; }
static int alchemy_pcm_trigger(struct snd_soc_component *component, @@ -292,8 +283,8 @@ static int alchemy_pcm_new(struct snd_soc_component *component, { struct snd_pcm *pcm = rtd->pcm;
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, - NULL, 65536, (4096 * 1024) - 1); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, + NULL, 65536, (4096 * 1024) - 1);
return 0; }
The patch
ASoC: au1x: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 fe9912ac58e4fa205faabcccc980eb834cc5f1aa Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:53 +0100 Subject: [PATCH] ASoC: au1x: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-3-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/au1x/dbdma2.c | 14 +------------- sound/soc/au1x/dma.c | 21 ++++++--------------- 2 files changed, 7 insertions(+), 28 deletions(-)
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 4c74698d31b3..8f855644c6b4 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -197,10 +197,6 @@ static int au1xpsc_pcm_hw_params(struct snd_soc_component *component, struct au1xpsc_audio_dmadata *pcd; int stype, ret;
- ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - goto out; - stype = substream->stream; pcd = to_dmadata(substream, component);
@@ -232,13 +228,6 @@ static int au1xpsc_pcm_hw_params(struct snd_soc_component *component, return ret; }
-static int au1xpsc_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int au1xpsc_pcm_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -315,7 +304,7 @@ static int au1xpsc_pcm_new(struct snd_soc_component *component, struct snd_card *card = rtd->card->snd_card; struct snd_pcm *pcm = rtd->pcm;
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, AU1XPSC_BUFFER_MIN_BYTES, (4096 * 1024) - 1);
return 0; @@ -327,7 +316,6 @@ static struct snd_soc_component_driver au1xpsc_soc_component = { .open = au1xpsc_pcm_open, .close = au1xpsc_pcm_close, .hw_params = au1xpsc_pcm_hw_params, - .hw_free = au1xpsc_pcm_hw_free, .prepare = au1xpsc_pcm_prepare, .trigger = au1xpsc_pcm_trigger, .pointer = au1xpsc_pcm_pointer, diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index 520eb7b24a92..c9a038a5e2d3 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c @@ -231,19 +231,10 @@ static int alchemy_pcm_hw_params(struct snd_soc_component *component, struct snd_pcm_hw_params *hw_params) { struct audio_stream *stream = ss_to_as(substream, component); - int err; - - err = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (err < 0) - return err; - err = au1000_setup_dma_link(stream, - params_period_bytes(hw_params), - params_periods(hw_params)); - if (err) - snd_pcm_lib_free_pages(substream);
- return err; + return au1000_setup_dma_link(stream, + params_period_bytes(hw_params), + params_periods(hw_params)); }
static int alchemy_pcm_hw_free(struct snd_soc_component *component, @@ -251,7 +242,7 @@ static int alchemy_pcm_hw_free(struct snd_soc_component *component, { struct audio_stream *stream = ss_to_as(substream, component); au1000_release_dma_link(stream); - return snd_pcm_lib_free_pages(substream); + return 0; }
static int alchemy_pcm_trigger(struct snd_soc_component *component, @@ -292,8 +283,8 @@ static int alchemy_pcm_new(struct snd_soc_component *component, { struct snd_pcm *pcm = rtd->pcm;
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, - NULL, 65536, (4096 * 1024) - 1); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, + NULL, 65536, (4096 * 1024) - 1);
return 0; }
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, as well as the superfluous snd_pcm_lib_preallocate_free_for_all() call. As of the result, hw_free and pcm_destruct ops became empty and got removed.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/dwc/dwc-pcm.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c index 4771eb5fbe2a..6d69e5a5b0e2 100644 --- a/sound/soc/dwc/dwc-pcm.c +++ b/sound/soc/dwc/dwc-pcm.c @@ -162,7 +162,6 @@ static int dw_pcm_hw_params(struct snd_soc_component *component, { struct snd_pcm_runtime *runtime = substream->runtime; struct dw_i2s_dev *dev = runtime->private_data; - int ret;
switch (params_channels(hw_params)) { case 2: @@ -187,18 +186,7 @@ static int dw_pcm_hw_params(struct snd_soc_component *component, return -EINVAL; }
- ret = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (ret < 0) - return ret; - else - return 0; -} - -static int dw_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + return 0; }
static int dw_pcm_trigger(struct snd_soc_component *component, @@ -256,28 +244,20 @@ static int dw_pcm_new(struct snd_soc_component *component, { size_t size = dw_pcm_hardware.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_CONTINUOUS, NULL, size, size); return 0; }
-static void dw_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static const struct snd_soc_component_driver dw_pcm_component = { .open = dw_pcm_open, .close = dw_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = dw_pcm_hw_params, - .hw_free = dw_pcm_hw_free, .trigger = dw_pcm_trigger, .pointer = dw_pcm_pointer, .pcm_construct = dw_pcm_new, - .pcm_destruct = dw_pcm_free, };
int dw_pcm_register(struct platform_device *pdev)
The patch
ASoC: dwc: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 fcf306efab32975e4f8bdf5e9d3e7c34fe4ce48c Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:54 +0100 Subject: [PATCH] ASoC: dwc: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, as well as the superfluous snd_pcm_lib_preallocate_free_for_all() call. As of the result, hw_free and pcm_destruct ops became empty and got removed.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-4-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/dwc/dwc-pcm.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c index bf36c1d29642..4b25aca3804f 100644 --- a/sound/soc/dwc/dwc-pcm.c +++ b/sound/soc/dwc/dwc-pcm.c @@ -162,7 +162,6 @@ static int dw_pcm_hw_params(struct snd_soc_component *component, { struct snd_pcm_runtime *runtime = substream->runtime; struct dw_i2s_dev *dev = runtime->private_data; - int ret;
switch (params_channels(hw_params)) { case 2: @@ -187,18 +186,7 @@ static int dw_pcm_hw_params(struct snd_soc_component *component, return -EINVAL; }
- ret = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (ret < 0) - return ret; - else - return 0; -} - -static int dw_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + return 0; }
static int dw_pcm_trigger(struct snd_soc_component *component, @@ -256,27 +244,19 @@ static int dw_pcm_new(struct snd_soc_component *component, { size_t size = dw_pcm_hardware.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_CONTINUOUS, NULL, size, size); return 0; }
-static void dw_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static const struct snd_soc_component_driver dw_pcm_component = { .open = dw_pcm_open, .close = dw_pcm_close, .hw_params = dw_pcm_hw_params, - .hw_free = dw_pcm_hw_free, .trigger = dw_pcm_trigger, .pointer = dw_pcm_pointer, .pcm_construct = dw_pcm_new, - .pcm_destruct = dw_pcm_free, };
int dw_pcm_register(struct platform_device *pdev)
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, as well as the superfluous snd_pcm_lib_preallocate_free_for_all() call. As of the result, hw_free and pcm_destruct ops became empty and got removed.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 14 +------------- sound/soc/mediatek/common/mtk-afe-fe-dai.h | 2 -- sound/soc/mediatek/common/mtk-afe-platform-driver.c | 12 ++---------- sound/soc/mediatek/common/mtk-afe-platform-driver.h | 2 -- sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 2 -- sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 1 - sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 1 - 7 files changed, 3 insertions(+), 31 deletions(-)
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index 10ea4fdbeb1e..f3af396da392 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -122,11 +122,7 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream, struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; int msb_at_bit33 = 0; - int ret, fs = 0; - - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - return ret; + int fs = 0;
msb_at_bit33 = upper_32_bits(substream->runtime->dma_addr) ? 1 : 0; memif->phys_buf_addr = lower_32_bits(substream->runtime->dma_addr); @@ -169,13 +165,6 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream, } EXPORT_SYMBOL_GPL(mtk_afe_fe_hw_params);
-int mtk_afe_fe_hw_free(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - return snd_pcm_lib_free_pages(substream); -} -EXPORT_SYMBOL_GPL(mtk_afe_fe_hw_free); - int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { @@ -275,7 +264,6 @@ const struct snd_soc_dai_ops mtk_afe_fe_ops = { .startup = mtk_afe_fe_startup, .shutdown = mtk_afe_fe_shutdown, .hw_params = mtk_afe_fe_hw_params, - .hw_free = mtk_afe_fe_hw_free, .prepare = mtk_afe_fe_prepare, .trigger = mtk_afe_fe_trigger, }; diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.h b/sound/soc/mediatek/common/mtk-afe-fe-dai.h index 55074fb9861a..5263690e225d 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.h +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.h @@ -20,8 +20,6 @@ void mtk_afe_fe_shutdown(struct snd_pcm_substream *substream, int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai); -int mtk_afe_fe_hw_free(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai); int mtk_afe_fe_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai); int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd, diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index b6624d8d084b..719d43bb0b8f 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c @@ -120,25 +120,17 @@ int mtk_afe_pcm_new(struct snd_soc_component *component, struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
size = afe->mtk_afe_hardware->buffer_bytes_max; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - afe->dev, size, size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + afe->dev, size, size); return 0; } EXPORT_SYMBOL_GPL(mtk_afe_pcm_new);
-void mtk_afe_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} -EXPORT_SYMBOL_GPL(mtk_afe_pcm_free); - const struct snd_soc_component_driver mtk_afe_pcm_platform = { .name = AFE_PCM_NAME, .ioctl = snd_soc_pcm_lib_ioctl, .pointer = mtk_afe_pcm_pointer, .pcm_construct = mtk_afe_pcm_new, - .pcm_destruct = mtk_afe_pcm_free, }; EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform);
diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.h b/sound/soc/mediatek/common/mtk-afe-platform-driver.h index e550d11568c3..fcc923b88f12 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.h +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.h @@ -21,8 +21,6 @@ snd_pcm_uframes_t mtk_afe_pcm_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream); int mtk_afe_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd); -void mtk_afe_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm);
int mtk_afe_combine_sub_dai(struct mtk_base_afe *afe); int mtk_afe_add_sub_dai_control(struct snd_soc_component *component); diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index 76502ba261c8..7318d452b764 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c @@ -515,7 +515,6 @@ static const struct snd_soc_dai_ops mt2701_single_memif_dai_ops = { .startup = mt2701_simple_fe_startup, .shutdown = mtk_afe_fe_shutdown, .hw_params = mt2701_simple_fe_hw_params, - .hw_free = mtk_afe_fe_hw_free, .prepare = mtk_afe_fe_prepare, .trigger = mtk_afe_fe_trigger, }; @@ -524,7 +523,6 @@ static const struct snd_soc_dai_ops mt2701_dlm_memif_dai_ops = { .startup = mt2701_dlm_fe_startup, .shutdown = mt2701_dlm_fe_shutdown, .hw_params = mt2701_dlm_fe_hw_params, - .hw_free = mtk_afe_fe_hw_free, .prepare = mtk_afe_fe_prepare, .trigger = mt2701_dlm_fe_trigger, }; diff --git a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c index 033c07fb599c..0743c699d8c1 100644 --- a/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c +++ b/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c @@ -715,7 +715,6 @@ static const struct snd_soc_component_driver mt6797_afe_component = { .ioctl = snd_soc_pcm_lib_ioctl, .pointer = mtk_afe_pcm_pointer, .pcm_construct = mtk_afe_pcm_new, - .pcm_destruct = mtk_afe_pcm_free, };
static int mt6797_dai_memif_register(struct mtk_base_afe *afe) diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c index 76af09d8f1af..6b5f407de3d0 100644 --- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c +++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c @@ -1053,7 +1053,6 @@ static const struct snd_soc_component_driver mt8183_afe_component = { .ioctl = snd_soc_pcm_lib_ioctl, .pointer = mtk_afe_pcm_pointer, .pcm_construct = mtk_afe_pcm_new, - .pcm_destruct = mtk_afe_pcm_free, };
static int mt8183_dai_memif_register(struct mtk_base_afe *afe)
On Tue, Dec 10, 2019 at 03:25:55PM +0100, Takashi Iwai wrote:
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, as well as the superfluous snd_pcm_lib_preallocate_free_for_all() call. As of the result, hw_free and pcm_destruct ops became empty and got removed.
This doesn't apply against current code, please check and resend.
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Jerome Brunet jbrunet@baylibre.com Cc: Kevin Hilman khilman@baylibre.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/meson/axg-fifo.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index d6f3eefb8f09..772eda857019 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c @@ -115,11 +115,6 @@ int axg_fifo_pcm_hw_params(struct snd_soc_component *component, struct axg_fifo *fifo = axg_fifo_data(ss); dma_addr_t end_ptr; unsigned int burst_num; - int ret; - - ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(params)); - if (ret < 0) - return ret;
/* Setup dma memory pointers */ end_ptr = runtime->dma_addr + runtime->dma_bytes - AXG_FIFO_BURST; @@ -167,7 +162,7 @@ int axg_fifo_pcm_hw_free(struct snd_soc_component *component, regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT), 0);
- return snd_pcm_lib_free_pages(ss); + return 0; } EXPORT_SYMBOL_GPL(axg_fifo_pcm_hw_free);
@@ -287,9 +282,9 @@ int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type) struct snd_card *card = rtd->card->snd_card; size_t size = axg_fifo_hw.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages(rtd->pcm->streams[type].substream, - SNDRV_DMA_TYPE_DEV, card->dev, - size, size); + snd_pcm_set_managed_buffer(rtd->pcm->streams[type].substream, + SNDRV_DMA_TYPE_DEV, card->dev, + size, size); return 0; } EXPORT_SYMBOL_GPL(axg_fifo_pcm_new);
On Tue 10 Dec 2019 at 15:25, Takashi Iwai tiwai@suse.de wrote:
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Jerome Brunet jbrunet@baylibre.com
Thanks Takashi ! Acked-by: Jerome Brunet jbrunet@baylibre.com
Cc: Kevin Hilman khilman@baylibre.com Signed-off-by: Takashi Iwai tiwai@suse.de
sound/soc/meson/axg-fifo.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index d6f3eefb8f09..772eda857019 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c @@ -115,11 +115,6 @@ int axg_fifo_pcm_hw_params(struct snd_soc_component *component, struct axg_fifo *fifo = axg_fifo_data(ss); dma_addr_t end_ptr; unsigned int burst_num;
int ret;
ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(params));
if (ret < 0)
return ret;
/* Setup dma memory pointers */ end_ptr = runtime->dma_addr + runtime->dma_bytes - AXG_FIFO_BURST;
@@ -167,7 +162,7 @@ int axg_fifo_pcm_hw_free(struct snd_soc_component *component, regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT), 0);
- return snd_pcm_lib_free_pages(ss);
- return 0;
} EXPORT_SYMBOL_GPL(axg_fifo_pcm_hw_free);
@@ -287,9 +282,9 @@ int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type) struct snd_card *card = rtd->card->snd_card; size_t size = axg_fifo_hw.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages(rtd->pcm->streams[type].substream,
SNDRV_DMA_TYPE_DEV, card->dev,
size, size);
- snd_pcm_set_managed_buffer(rtd->pcm->streams[type].substream,
SNDRV_DMA_TYPE_DEV, card->dev,
return 0;size, size);
} EXPORT_SYMBOL_GPL(axg_fifo_pcm_new);
The patch
ASoC: meson: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 bace3caa82e1f0b5b667e35b532534b9cbdc4338 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:56 +0100 Subject: [PATCH] ASoC: meson: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Jerome Brunet jbrunet@baylibre.com Cc: Kevin Hilman khilman@baylibre.com Signed-off-by: Takashi Iwai tiwai@suse.de Acked-by: Jerome Brunet jbrunet@baylibre.com Link: https://lore.kernel.org/r/20191210142614.19405-6-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/meson/axg-fifo.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index d6f3eefb8f09..772eda857019 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c @@ -115,11 +115,6 @@ int axg_fifo_pcm_hw_params(struct snd_soc_component *component, struct axg_fifo *fifo = axg_fifo_data(ss); dma_addr_t end_ptr; unsigned int burst_num; - int ret; - - ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(params)); - if (ret < 0) - return ret;
/* Setup dma memory pointers */ end_ptr = runtime->dma_addr + runtime->dma_bytes - AXG_FIFO_BURST; @@ -167,7 +162,7 @@ int axg_fifo_pcm_hw_free(struct snd_soc_component *component, regmap_update_bits(fifo->map, FIFO_CTRL0, CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT), 0);
- return snd_pcm_lib_free_pages(ss); + return 0; } EXPORT_SYMBOL_GPL(axg_fifo_pcm_hw_free);
@@ -287,9 +282,9 @@ int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type) struct snd_card *card = rtd->card->snd_card; size_t size = axg_fifo_hw.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages(rtd->pcm->streams[type].substream, - SNDRV_DMA_TYPE_DEV, card->dev, - size, size); + snd_pcm_set_managed_buffer(rtd->pcm->streams[type].substream, + SNDRV_DMA_TYPE_DEV, card->dev, + size, size); return 0; } EXPORT_SYMBOL_GPL(axg_fifo_pcm_new);
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/sh/dma-sh7760.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index 2b0eca02a8b9..4d0f2f738ffa 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c @@ -179,11 +179,6 @@ static int camelot_hw_params(struct snd_soc_component *component, int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; int ret;
- ret = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (ret < 0) - return ret; - if (recv) { cam->rx_period_size = params_period_bytes(hw_params); cam->rx_period = 0; @@ -194,12 +189,6 @@ static int camelot_hw_params(struct snd_soc_component *component, return 0; }
-static int camelot_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int camelot_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -307,7 +296,7 @@ static int camelot_pcm_new(struct snd_soc_component *component, /* dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel * in MMAP mode (i.e. aplay -M) */ - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, NULL, DMABRG_PREALLOC_BUFFER, DMABRG_PREALLOC_BUFFER_MAX); @@ -320,7 +309,6 @@ static const struct snd_soc_component_driver sh7760_soc_component = { .close = camelot_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = camelot_hw_params, - .hw_free = camelot_hw_free, .prepare = camelot_prepare, .trigger = camelot_trigger, .pointer = camelot_pos,
The patch
ASoC: dma-sh7760: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 d23a16584b4f4cc7226c75793d1797e5505a193b Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:57 +0100 Subject: [PATCH] ASoC: dma-sh7760: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-7-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/dma-sh7760.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index 2b0eca02a8b9..4d0f2f738ffa 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c @@ -179,11 +179,6 @@ static int camelot_hw_params(struct snd_soc_component *component, int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; int ret;
- ret = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - if (ret < 0) - return ret; - if (recv) { cam->rx_period_size = params_period_bytes(hw_params); cam->rx_period = 0; @@ -194,12 +189,6 @@ static int camelot_hw_params(struct snd_soc_component *component, return 0; }
-static int camelot_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int camelot_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -307,7 +296,7 @@ static int camelot_pcm_new(struct snd_soc_component *component, /* dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel * in MMAP mode (i.e. aplay -M) */ - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, NULL, DMABRG_PREALLOC_BUFFER, DMABRG_PREALLOC_BUFFER_MAX); @@ -320,7 +309,6 @@ static const struct snd_soc_component_driver sh7760_soc_component = { .close = camelot_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = camelot_hw_params, - .hw_free = camelot_hw_free, .prepare = camelot_prepare, .trigger = camelot_trigger, .pointer = camelot_pos,
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/sh/fsi.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index e384fdc8d60e..1cebddd76d12 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1732,20 +1732,6 @@ static int fsi_pcm_open(struct snd_soc_component *component, return ret; }
-static int fsi_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); -} - -static int fsi_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static snd_pcm_uframes_t fsi_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -1765,7 +1751,7 @@ static snd_pcm_uframes_t fsi_pointer(struct snd_soc_component *component, static int fsi_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all( + snd_pcm_set_managed_buffer_all( rtd->pcm, SNDRV_DMA_TYPE_DEV, rtd->card->snd_card->dev, @@ -1816,8 +1802,6 @@ static const struct snd_soc_component_driver fsi_soc_component = { .name = "fsi", .open = fsi_pcm_open, .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = fsi_hw_params, - .hw_free = fsi_hw_free, .pointer = fsi_pointer, .pcm_construct = fsi_pcm_new, };
The patch
ASoC: fsi: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 55df47f2300e7cdb2bb3ca1209ec0b938459fc8f Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:58 +0100 Subject: [PATCH] ASoC: fsi: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-8-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/fsi.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index e384fdc8d60e..1cebddd76d12 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1732,20 +1732,6 @@ static int fsi_pcm_open(struct snd_soc_component *component, return ret; }
-static int fsi_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); -} - -static int fsi_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static snd_pcm_uframes_t fsi_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -1765,7 +1751,7 @@ static snd_pcm_uframes_t fsi_pointer(struct snd_soc_component *component, static int fsi_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all( + snd_pcm_set_managed_buffer_all( rtd->pcm, SNDRV_DMA_TYPE_DEV, rtd->card->snd_card->dev, @@ -1816,8 +1802,6 @@ static const struct snd_soc_component_driver fsi_soc_component = { .name = "fsi", .open = fsi_pcm_open, .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = fsi_hw_params, - .hw_free = fsi_hw_free, .pointer = fsi_pointer, .pcm_construct = fsi_pcm_new, };
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/sh/rcar/core.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 399dc6e9bde5..bb840be5e591 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1223,10 +1223,10 @@ static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd, for (substream = rtd->pcm->streams[stream].substream; substream; substream = substream->next) { - snd_pcm_lib_preallocate_pages(substream, - SNDRV_DMA_TYPE_DEV, - dev, - PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); + snd_pcm_set_managed_buffer(substream, + SNDRV_DMA_TYPE_DEV, + dev, + PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); }
return 0; @@ -1405,7 +1405,6 @@ static int rsnd_hw_params(struct snd_soc_component *component, struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); struct snd_soc_pcm_runtime *fe = substream->private_data; - int ret;
/* * rsnd assumes that it might be used under DPCM if user want to use @@ -1438,12 +1437,7 @@ static int rsnd_hw_params(struct snd_soc_component *component, dev_dbg(dev, "convert rate = %d\n", io->converted_rate); }
- ret = rsnd_dai_call(hw_params, io, substream, hw_params); - if (ret) - return ret; - - return snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); + return rsnd_dai_call(hw_params, io, substream, hw_params); }
static int rsnd_hw_free(struct snd_soc_component *component, @@ -1452,13 +1446,8 @@ static int rsnd_hw_free(struct snd_soc_component *component, struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); - int ret; - - ret = rsnd_dai_call(hw_free, io, substream); - if (ret) - return ret;
- return snd_pcm_lib_free_pages(substream); + return rsnd_dai_call(hw_free, io, substream); }
static snd_pcm_uframes_t rsnd_pointer(struct snd_soc_component *component,
The patch
ASoC: rcar: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 e494dbcd9be743f41cf842f94ffbc7c56b6b072a Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:25:59 +0100 Subject: [PATCH] ASoC: rcar: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-9-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/rcar/core.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 6aac25095218..3dfc02092f76 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1218,10 +1218,10 @@ static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd, for (substream = rtd->pcm->streams[stream].substream; substream; substream = substream->next) { - snd_pcm_lib_preallocate_pages(substream, - SNDRV_DMA_TYPE_DEV, - dev, - PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); + snd_pcm_set_managed_buffer(substream, + SNDRV_DMA_TYPE_DEV, + dev, + PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); }
return 0; @@ -1400,7 +1400,6 @@ static int rsnd_hw_params(struct snd_soc_component *component, struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); struct snd_soc_pcm_runtime *fe = substream->private_data; - int ret;
/* * rsnd assumes that it might be used under DPCM if user want to use @@ -1433,12 +1432,7 @@ static int rsnd_hw_params(struct snd_soc_component *component, dev_dbg(dev, "convert rate = %d\n", io->converted_rate); }
- ret = rsnd_dai_call(hw_params, io, substream, hw_params); - if (ret) - return ret; - - return snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); + return rsnd_dai_call(hw_params, io, substream, hw_params); }
static int rsnd_hw_free(struct snd_soc_component *component, @@ -1447,13 +1441,8 @@ static int rsnd_hw_free(struct snd_soc_component *component, struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); - int ret; - - ret = rsnd_dai_call(hw_free, io, substream); - if (ret) - return ret;
- return snd_pcm_lib_free_pages(substream); + return rsnd_dai_call(hw_free, io, substream); }
static snd_pcm_uframes_t rsnd_pointer(struct snd_soc_component *component,
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous (the rest were only debug prints) and got dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/sh/siu_pcm.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index a5e21e554da2..65637ad93630 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c @@ -281,41 +281,6 @@ static int siu_pcm_stmread_stop(struct siu_port *port_info) return 0; }
-static int siu_pcm_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *ss, - struct snd_pcm_hw_params *hw_params) -{ - struct siu_info *info = siu_i2s_data; - struct device *dev = ss->pcm->card->dev; - int ret; - - dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id); - - ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params)); - if (ret < 0) - dev_err(dev, "snd_pcm_lib_malloc_pages() failed\n"); - - return ret; -} - -static int siu_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *ss) -{ - struct siu_info *info = siu_i2s_data; - struct siu_port *port_info = siu_port_info(ss); - struct device *dev = ss->pcm->card->dev; - struct siu_stream *siu_stream; - - if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) - siu_stream = &port_info->playback; - else - siu_stream = &port_info->capture; - - dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id); - - return snd_pcm_lib_free_pages(ss); -} - static bool filter(struct dma_chan *chan, void *slave) { struct sh_dmae_slave *param = slave; @@ -548,7 +513,7 @@ static int siu_pcm_new(struct snd_soc_component *component, if (ret < 0) return ret;
- snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX);
@@ -584,8 +549,6 @@ struct const snd_soc_component_driver siu_component = { .open = siu_pcm_open, .close = siu_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = siu_pcm_hw_params, - .hw_free = siu_pcm_hw_free, .prepare = siu_pcm_prepare, .trigger = siu_pcm_trigger, .pointer = siu_pcm_pointer_dma,
The patch
ASoC: siu_pcm: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 2c7c9630db45129838ed09f0ada718b0ac222377 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:00 +0100 Subject: [PATCH] ASoC: siu_pcm: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous (the rest were only debug prints) and got dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-10-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/siu_pcm.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index a5e21e554da2..65637ad93630 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c @@ -281,41 +281,6 @@ static int siu_pcm_stmread_stop(struct siu_port *port_info) return 0; }
-static int siu_pcm_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *ss, - struct snd_pcm_hw_params *hw_params) -{ - struct siu_info *info = siu_i2s_data; - struct device *dev = ss->pcm->card->dev; - int ret; - - dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id); - - ret = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw_params)); - if (ret < 0) - dev_err(dev, "snd_pcm_lib_malloc_pages() failed\n"); - - return ret; -} - -static int siu_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *ss) -{ - struct siu_info *info = siu_i2s_data; - struct siu_port *port_info = siu_port_info(ss); - struct device *dev = ss->pcm->card->dev; - struct siu_stream *siu_stream; - - if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) - siu_stream = &port_info->playback; - else - siu_stream = &port_info->capture; - - dev_dbg(dev, "%s: port=%d\n", __func__, info->port_id); - - return snd_pcm_lib_free_pages(ss); -} - static bool filter(struct dma_chan *chan, void *slave) { struct sh_dmae_slave *param = slave; @@ -548,7 +513,7 @@ static int siu_pcm_new(struct snd_soc_component *component, if (ret < 0) return ret;
- snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, SIU_BUFFER_BYTES_MAX, SIU_BUFFER_BYTES_MAX);
@@ -584,8 +549,6 @@ struct const snd_soc_component_driver siu_component = { .open = siu_pcm_open, .close = siu_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = siu_pcm_hw_params, - .hw_free = siu_pcm_hw_free, .prepare = siu_pcm_prepare, .trigger = siu_pcm_trigger, .pointer = siu_pcm_pointer_dma,
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Lars-Peter Clausen lars@metafoo.de Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/soc-generic-dmaengine-pcm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index a428ff393ea2..dd400afe3c8f 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -104,7 +104,7 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, return ret; }
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); + return 0; }
static int @@ -168,12 +168,6 @@ static int dmaengine_pcm_close(struct snd_soc_component *component, return snd_dmaengine_pcm_close(substream); }
-static int dmaengine_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int dmaengine_pcm_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) { @@ -261,7 +255,7 @@ static int dmaengine_pcm_new(struct snd_soc_component *component, return -EINVAL; }
- snd_pcm_lib_preallocate_pages(substream, + snd_pcm_set_managed_buffer(substream, SNDRV_DMA_TYPE_DEV_IRAM, dmaengine_dma_dev(pcm, substream), prealloc_buffer_size, @@ -331,7 +325,6 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = { .close = dmaengine_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = dmaengine_pcm_hw_params, - .hw_free = dmaengine_pcm_hw_free, .trigger = dmaengine_pcm_trigger, .pointer = dmaengine_pcm_pointer, .pcm_construct = dmaengine_pcm_new, @@ -344,7 +337,6 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = { .close = dmaengine_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = dmaengine_pcm_hw_params, - .hw_free = dmaengine_pcm_hw_free, .trigger = dmaengine_pcm_trigger, .pointer = dmaengine_pcm_pointer, .copy_user = dmaengine_copy_user,
The patch
ASoC: generic-dmaengine-pcm: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 d708c2b36b5d23a7266ca9bfe648533a0f61bdfd Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:01 +0100 Subject: [PATCH] ASoC: generic-dmaengine-pcm: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Lars-Peter Clausen lars@metafoo.de Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-11-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-generic-dmaengine-pcm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 4616cab2117c..df57ec47ad60 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -104,7 +104,7 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, return ret; }
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); + return 0; }
static int @@ -168,12 +168,6 @@ static int dmaengine_pcm_close(struct snd_soc_component *component, return snd_dmaengine_pcm_close(substream); }
-static int dmaengine_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int dmaengine_pcm_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) { @@ -261,7 +255,7 @@ static int dmaengine_pcm_new(struct snd_soc_component *component, return -EINVAL; }
- snd_pcm_lib_preallocate_pages(substream, + snd_pcm_set_managed_buffer(substream, SNDRV_DMA_TYPE_DEV_IRAM, dmaengine_dma_dev(pcm, substream), prealloc_buffer_size, @@ -330,7 +324,6 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = { .open = dmaengine_pcm_open, .close = dmaengine_pcm_close, .hw_params = dmaengine_pcm_hw_params, - .hw_free = dmaengine_pcm_hw_free, .trigger = dmaengine_pcm_trigger, .pointer = dmaengine_pcm_pointer, .pcm_construct = dmaengine_pcm_new, @@ -342,7 +335,6 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = { .open = dmaengine_pcm_open, .close = dmaengine_pcm_close, .hw_params = dmaengine_pcm_hw_params, - .hw_free = dmaengine_pcm_hw_free, .trigger = dmaengine_pcm_trigger, .pointer = dmaengine_pcm_pointer, .copy_user = dmaengine_copy_user,
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/sof/pcm.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 549238a98b2a..80081ea42566 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -119,20 +119,8 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
memset(&pcm, 0, sizeof(pcm));
- /* allocate audio buffer pages */ - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) { - dev_err(sdev->dev, "error: could not allocate %d bytes for PCM %d\n", - params_buffer_bytes(params), spcm->pcm.pcm_id); - return ret; - } - if (ret) { - /* - * ret == 1 means the buffer is changed - * create compressed page table for audio firmware - * ret == 0 means the buffer is not changed - * so no need to regenerate the page table - */ + /* create compressed page table for audio firmware */ + if (runtime->buffer_changed) { ret = create_page_table(component, substream, runtime->dma_area, runtime->dma_bytes); if (ret < 0) @@ -260,8 +248,6 @@ static int sof_pcm_hw_free(struct snd_soc_component *component, err = ret; }
- snd_pcm_lib_free_pages(substream); - cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work);
ret = snd_sof_pcm_platform_hw_free(sdev, substream); @@ -594,10 +580,10 @@ static int sof_pcm_new(struct snd_soc_component *component, dev_dbg(sdev->dev, "spcm: allocate %s playback DMA buffer size 0x%x max 0x%x\n", caps->name, caps->buffer_size_min, caps->buffer_size_max);
- snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, - SNDRV_DMA_TYPE_DEV_SG, sdev->dev, - le32_to_cpu(caps->buffer_size_min), - le32_to_cpu(caps->buffer_size_max)); + snd_pcm_set_managed_buffer(pcm->streams[stream].substream, + SNDRV_DMA_TYPE_DEV_SG, sdev->dev, + le32_to_cpu(caps->buffer_size_min), + le32_to_cpu(caps->buffer_size_max)); capture: stream = SNDRV_PCM_STREAM_CAPTURE;
@@ -611,10 +597,10 @@ static int sof_pcm_new(struct snd_soc_component *component, dev_dbg(sdev->dev, "spcm: allocate %s capture DMA buffer size 0x%x max 0x%x\n", caps->name, caps->buffer_size_min, caps->buffer_size_max);
- snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, - SNDRV_DMA_TYPE_DEV_SG, sdev->dev, - le32_to_cpu(caps->buffer_size_min), - le32_to_cpu(caps->buffer_size_max)); + snd_pcm_set_managed_buffer(pcm->streams[stream].substream, + SNDRV_DMA_TYPE_DEV_SG, sdev->dev, + le32_to_cpu(caps->buffer_size_min), + le32_to_cpu(caps->buffer_size_max));
return 0; }
On Tue, Dec 10, 2019 at 03:26:02PM +0100, Takashi Iwai wrote:
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
This doesn't apply against current code, please check and resend.
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, as well as the superfluous snd_pcm_lib_preallocate_free_for_all() call. As of the result, hw_free and pcm_destruct ops became empty and got removed.
Cc: Olivier Moysan olivier.moysan@st.com Cc: Arnaud Pouliquen arnaud.pouliquen@st.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/stm/stm32_adfsdm.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-)
diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 81c407da15c5..807fee1eac66 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -252,7 +252,6 @@ static int stm32_adfsdm_pcm_close(struct snd_soc_component *component, struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(rtd->cpu_dai);
- snd_pcm_lib_free_pages(substream); priv->substream = NULL;
return 0; @@ -276,25 +275,13 @@ static int stm32_adfsdm_pcm_hw_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(rtd->cpu_dai); - int ret;
- ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - return ret; priv->pcm_buff = substream->runtime->dma_area;
return iio_channel_cb_set_buffer_watermark(priv->iio_cb, params_period_size(params)); }
-static int stm32_adfsdm_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - - return 0; -} - static int stm32_adfsdm_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { @@ -303,30 +290,18 @@ static int stm32_adfsdm_pcm_new(struct snd_soc_component *component, snd_soc_dai_get_drvdata(rtd->cpu_dai); unsigned int size = DFSDM_MAX_PERIODS * DFSDM_MAX_PERIOD_SIZE;
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - priv->dev, size, size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + priv->dev, size, size); return 0; }
-static void stm32_adfsdm_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - struct snd_pcm_substream *substream; - - substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; - if (substream) - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static struct snd_soc_component_driver stm32_adfsdm_soc_platform = { .open = stm32_adfsdm_pcm_open, .close = stm32_adfsdm_pcm_close, .hw_params = stm32_adfsdm_pcm_hw_params, - .hw_free = stm32_adfsdm_pcm_hw_free, .trigger = stm32_adfsdm_trigger, .pointer = stm32_adfsdm_pcm_pointer, .pcm_construct = stm32_adfsdm_pcm_new, - .pcm_destruct = stm32_adfsdm_pcm_free, };
static const struct of_device_id stm32_adfsdm_of_match[] = {
The patch
ASoC: stm32: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 6f7aff352e690bd167d97f8354543855cf6c34b8 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:03 +0100 Subject: [PATCH] ASoC: stm32: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped, as well as the superfluous snd_pcm_lib_preallocate_free_for_all() call. As of the result, hw_free and pcm_destruct ops became empty and got removed.
Cc: Olivier Moysan olivier.moysan@st.com Cc: Arnaud Pouliquen arnaud.pouliquen@st.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-13-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/stm/stm32_adfsdm.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-)
diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 81c407da15c5..807fee1eac66 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -252,7 +252,6 @@ static int stm32_adfsdm_pcm_close(struct snd_soc_component *component, struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(rtd->cpu_dai);
- snd_pcm_lib_free_pages(substream); priv->substream = NULL;
return 0; @@ -276,25 +275,13 @@ static int stm32_adfsdm_pcm_hw_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(rtd->cpu_dai); - int ret;
- ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - return ret; priv->pcm_buff = substream->runtime->dma_area;
return iio_channel_cb_set_buffer_watermark(priv->iio_cb, params_period_size(params)); }
-static int stm32_adfsdm_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - - return 0; -} - static int stm32_adfsdm_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { @@ -303,30 +290,18 @@ static int stm32_adfsdm_pcm_new(struct snd_soc_component *component, snd_soc_dai_get_drvdata(rtd->cpu_dai); unsigned int size = DFSDM_MAX_PERIODS * DFSDM_MAX_PERIOD_SIZE;
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - priv->dev, size, size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + priv->dev, size, size); return 0; }
-static void stm32_adfsdm_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - struct snd_pcm_substream *substream; - - substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; - if (substream) - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static struct snd_soc_component_driver stm32_adfsdm_soc_platform = { .open = stm32_adfsdm_pcm_open, .close = stm32_adfsdm_pcm_close, .hw_params = stm32_adfsdm_pcm_hw_params, - .hw_free = stm32_adfsdm_pcm_hw_free, .trigger = stm32_adfsdm_trigger, .pointer = stm32_adfsdm_pcm_pointer, .pcm_construct = stm32_adfsdm_pcm_new, - .pcm_destruct = stm32_adfsdm_pcm_free, };
static const struct of_device_id stm32_adfsdm_of_match[] = {
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/txx9/txx9aclc.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 33c78d33e5a1..983481674c81 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c @@ -54,11 +54,6 @@ static int txx9aclc_pcm_hw_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct txx9aclc_dmadata *dmadata = runtime->private_data; - int ret; - - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - return ret;
dev_dbg(component->dev, "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " @@ -76,12 +71,6 @@ static int txx9aclc_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int txx9aclc_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int txx9aclc_pcm_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -306,7 +295,7 @@ static int txx9aclc_pcm_new(struct snd_soc_component *component, goto exit; }
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, 64 * 1024, 4 * 1024 * 1024); return 0;
@@ -408,7 +397,6 @@ static const struct snd_soc_component_driver txx9aclc_soc_component = { .close = txx9aclc_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = txx9aclc_pcm_hw_params, - .hw_free = txx9aclc_pcm_hw_free, .prepare = txx9aclc_pcm_prepare, .trigger = txx9aclc_pcm_trigger, .pointer = txx9aclc_pcm_pointer,
The patch
ASoC: txx9: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 ffe119308cf6f174eb65e2a7c023c85178f5109c Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:04 +0100 Subject: [PATCH] ASoC: txx9: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-14-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/txx9/txx9aclc.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 043d9ec1c2b5..dba13543911c 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c @@ -54,11 +54,6 @@ static int txx9aclc_pcm_hw_params(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct txx9aclc_dmadata *dmadata = runtime->private_data; - int ret; - - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) - return ret;
dev_dbg(component->dev, "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " @@ -76,12 +71,6 @@ static int txx9aclc_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int txx9aclc_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int txx9aclc_pcm_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -306,7 +295,7 @@ static int txx9aclc_pcm_new(struct snd_soc_component *component, goto exit; }
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, 64 * 1024, 4 * 1024 * 1024); return 0;
@@ -407,7 +396,6 @@ static const struct snd_soc_component_driver txx9aclc_soc_component = { .open = txx9aclc_pcm_open, .close = txx9aclc_pcm_close, .hw_params = txx9aclc_pcm_hw_params, - .hw_free = txx9aclc_pcm_hw_free, .prepare = txx9aclc_pcm_prepare, .trigger = txx9aclc_pcm_trigger, .pointer = txx9aclc_pcm_pointer,
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped, as well as the pcm_destruct callback just containing the superfluous snd_pcm_lib_preallocate_free_for_all() call.
Cc: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/uniphier/aio-dma.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/sound/soc/uniphier/aio-dma.c b/sound/soc/uniphier/aio-dma.c index 700d936ed94e..388f4785d93a 100644 --- a/sound/soc/uniphier/aio-dma.c +++ b/sound/soc/uniphier/aio-dma.c @@ -104,25 +104,6 @@ static int uniphier_aiodma_open(struct snd_soc_component *component, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256); }
-static int uniphier_aiodma_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); - substream->runtime->dma_bytes = params_buffer_bytes(params); - - return 0; -} - -static int uniphier_aiodma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_set_runtime_buffer(substream, NULL); - substream->runtime->dma_bytes = 0; - - return 0; -} - static int uniphier_aiodma_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -232,30 +213,21 @@ static int uniphier_aiodma_new(struct snd_soc_component *component, if (ret) return ret;
- snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, dev, uniphier_aiodma_hw.buffer_bytes_max, uniphier_aiodma_hw.buffer_bytes_max); return 0; }
-static void uniphier_aiodma_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static const struct snd_soc_component_driver uniphier_soc_platform = { .open = uniphier_aiodma_open, .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = uniphier_aiodma_hw_params, - .hw_free = uniphier_aiodma_hw_free, .prepare = uniphier_aiodma_prepare, .trigger = uniphier_aiodma_trigger, .pointer = uniphier_aiodma_pointer, .mmap = uniphier_aiodma_mmap, .pcm_construct = uniphier_aiodma_new, - .pcm_destruct = uniphier_aiodma_free, .compr_ops = &uniphier_aio_compr_ops, };
The patch
ASoC: uniphier: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 d55894bc27636ebaf66c7c6eca8da5548911f8c9 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:05 +0100 Subject: [PATCH] ASoC: uniphier: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped, as well as the pcm_destruct callback just containing the superfluous snd_pcm_lib_preallocate_free_for_all() call.
Cc: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-15-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/uniphier/aio-dma.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/sound/soc/uniphier/aio-dma.c b/sound/soc/uniphier/aio-dma.c index 700d936ed94e..388f4785d93a 100644 --- a/sound/soc/uniphier/aio-dma.c +++ b/sound/soc/uniphier/aio-dma.c @@ -104,25 +104,6 @@ static int uniphier_aiodma_open(struct snd_soc_component *component, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256); }
-static int uniphier_aiodma_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); - substream->runtime->dma_bytes = params_buffer_bytes(params); - - return 0; -} - -static int uniphier_aiodma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_set_runtime_buffer(substream, NULL); - substream->runtime->dma_bytes = 0; - - return 0; -} - static int uniphier_aiodma_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -232,30 +213,21 @@ static int uniphier_aiodma_new(struct snd_soc_component *component, if (ret) return ret;
- snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, dev, uniphier_aiodma_hw.buffer_bytes_max, uniphier_aiodma_hw.buffer_bytes_max); return 0; }
-static void uniphier_aiodma_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static const struct snd_soc_component_driver uniphier_soc_platform = { .open = uniphier_aiodma_open, .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = uniphier_aiodma_hw_params, - .hw_free = uniphier_aiodma_hw_free, .prepare = uniphier_aiodma_prepare, .trigger = uniphier_aiodma_trigger, .pointer = uniphier_aiodma_pointer, .mmap = uniphier_aiodma_mmap, .pcm_construct = uniphier_aiodma_new, - .pcm_destruct = uniphier_aiodma_free, .compr_ops = &uniphier_aio_compr_ops, };
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Michal Simek michal.simek@xilinx.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/xilinx/xlnx_formatter_pcm.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index 296c4caf96a0..f6e30090bdb0 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -426,7 +426,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, { u32 low, high, active_ch, val, bytes_per_ch, bits_per_sample; u32 aes_reg1_val, aes_reg2_val; - int status; u64 size; struct snd_pcm_runtime *runtime = substream->runtime; struct xlnx_pcm_stream_param *stream_data = runtime->private_data; @@ -450,9 +449,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, }
size = params_buffer_bytes(params); - status = snd_pcm_lib_malloc_pages(substream, size); - if (status < 0) - return status;
stream_data->buffer_size = size;
@@ -495,12 +491,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int xlnx_formatter_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) @@ -532,7 +522,7 @@ static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component, static int xlnx_formatter_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, component->dev, xlnx_pcm_hardware.buffer_bytes_max, xlnx_pcm_hardware.buffer_bytes_max); @@ -545,7 +535,6 @@ static const struct snd_soc_component_driver xlnx_asoc_component = { .close = xlnx_formatter_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = xlnx_formatter_pcm_hw_params, - .hw_free = xlnx_formatter_pcm_hw_free, .trigger = xlnx_formatter_pcm_trigger, .pointer = xlnx_formatter_pcm_pointer, .pcm_construct = xlnx_formatter_pcm_new,
The patch
ASoC: xilinx: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 52f0ac153d12beb5af9d8a1ad3013762e919ffa6 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:06 +0100 Subject: [PATCH] ASoC: xilinx: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Michal Simek michal.simek@xilinx.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-16-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/xilinx/xlnx_formatter_pcm.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index 14767f507cea..1d59fb668c77 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -426,7 +426,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, { u32 low, high, active_ch, val, bytes_per_ch, bits_per_sample; u32 aes_reg1_val, aes_reg2_val; - int status; u64 size; struct snd_pcm_runtime *runtime = substream->runtime; struct xlnx_pcm_stream_param *stream_data = runtime->private_data; @@ -450,9 +449,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, }
size = params_buffer_bytes(params); - status = snd_pcm_lib_malloc_pages(substream, size); - if (status < 0) - return status;
stream_data->buffer_size = size;
@@ -495,12 +491,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int xlnx_formatter_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) @@ -532,7 +522,7 @@ static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component, static int xlnx_formatter_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, component->dev, xlnx_pcm_hardware.buffer_bytes_max, xlnx_pcm_hardware.buffer_bytes_max); @@ -544,7 +534,6 @@ static const struct snd_soc_component_driver xlnx_asoc_component = { .open = xlnx_formatter_pcm_open, .close = xlnx_formatter_pcm_close, .hw_params = xlnx_formatter_pcm_hw_params, - .hw_free = xlnx_formatter_pcm_hw_free, .trigger = xlnx_formatter_pcm_trigger, .pointer = xlnx_formatter_pcm_pointer, .pcm_construct = xlnx_formatter_pcm_new,
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Max Filippov jcmvbkbc@gmail.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/xtensa/xtfpga-i2s.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c index e08f4fee932a..25ede9d7dfa4 100644 --- a/sound/soc/xtensa/xtfpga-i2s.c +++ b/sound/soc/xtensa/xtfpga-i2s.c @@ -390,7 +390,6 @@ static int xtfpga_pcm_hw_params(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { - int ret; struct snd_pcm_runtime *runtime = substream->runtime; struct xtfpga_i2s *i2s = runtime->private_data; unsigned channels = params_channels(hw_params); @@ -422,9 +421,7 @@ static int xtfpga_pcm_hw_params(struct snd_soc_component *component, return -EINVAL; }
- ret = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - return ret; + return 0; }
static int xtfpga_pcm_trigger(struct snd_soc_component *component, @@ -472,8 +469,8 @@ static int xtfpga_pcm_new(struct snd_soc_component *component, struct snd_card *card = rtd->card->snd_card; size_t size = xtfpga_pcm_hardware.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, - card->dev, size, size); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + card->dev, size, size); return 0; }
The patch
ASoC: xtensa: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 bfddcaffd8858973385ec11c6051bb04fa685e6c Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:07 +0100 Subject: [PATCH] ASoC: xtensa: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Max Filippov jcmvbkbc@gmail.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-17-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/xtensa/xtfpga-i2s.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c index 5dae9c8583b7..bcf442faff7c 100644 --- a/sound/soc/xtensa/xtfpga-i2s.c +++ b/sound/soc/xtensa/xtfpga-i2s.c @@ -390,7 +390,6 @@ static int xtfpga_pcm_hw_params(struct snd_soc_component *component, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { - int ret; struct snd_pcm_runtime *runtime = substream->runtime; struct xtfpga_i2s *i2s = runtime->private_data; unsigned channels = params_channels(hw_params); @@ -422,9 +421,7 @@ static int xtfpga_pcm_hw_params(struct snd_soc_component *component, return -EINVAL; }
- ret = snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); - return ret; + return 0; }
static int xtfpga_pcm_trigger(struct snd_soc_component *component, @@ -472,8 +469,8 @@ static int xtfpga_pcm_new(struct snd_soc_component *component, struct snd_card *card = rtd->card->snd_card; size_t size = xtfpga_pcm_hardware.buffer_bytes_max;
- snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, - card->dev, size, size); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + card->dev, size, size); return 0; }
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Cheng-Yi Chiang cychiang@chromium.org Cc: Benson Leung bleung@chromium.org Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/cros_ec_codec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index 7b17f39a6a10..c81bbef2367a 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -918,7 +918,7 @@ static int wov_pcm_hw_params(struct snd_soc_component *component, priv->wov_burst_read = true; mutex_unlock(&priv->wov_dma_lock);
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); + return 0; }
static int wov_pcm_hw_free(struct snd_soc_component *component, @@ -934,7 +934,7 @@ static int wov_pcm_hw_free(struct snd_soc_component *component,
cancel_delayed_work_sync(&priv->wov_copy_work);
- return snd_pcm_lib_free_pages(substream); + return 0; }
static snd_pcm_uframes_t wov_pcm_pointer(struct snd_soc_component *component, @@ -950,8 +950,8 @@ static snd_pcm_uframes_t wov_pcm_pointer(struct snd_soc_component *component, static int wov_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, - NULL, 0, 0); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, + NULL, 0, 0); return 0; }
The patch
ASoC: cros_ec_codec: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 66b3621b8b6f3e184b5dd34358de41bcd5a73bb5 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:08 +0100 Subject: [PATCH] ASoC: cros_ec_codec: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Cheng-Yi Chiang cychiang@chromium.org Cc: Benson Leung bleung@chromium.org Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-18-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/cros_ec_codec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index 7b17f39a6a10..c81bbef2367a 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -918,7 +918,7 @@ static int wov_pcm_hw_params(struct snd_soc_component *component, priv->wov_burst_read = true; mutex_unlock(&priv->wov_dma_lock);
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); + return 0; }
static int wov_pcm_hw_free(struct snd_soc_component *component, @@ -934,7 +934,7 @@ static int wov_pcm_hw_free(struct snd_soc_component *component,
cancel_delayed_work_sync(&priv->wov_copy_work);
- return snd_pcm_lib_free_pages(substream); + return 0; }
static snd_pcm_uframes_t wov_pcm_pointer(struct snd_soc_component *component, @@ -950,8 +950,8 @@ static snd_pcm_uframes_t wov_pcm_pointer(struct snd_soc_component *component, static int wov_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, - NULL, 0, 0); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, + NULL, 0, 0); return 0; }
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Oder Chiou oder_chiou@realtek.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/rt5514-spi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index f1b7b947ecbd..1a25a3787935 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@ -215,11 +215,9 @@ static int rt5514_spi_hw_params(struct snd_soc_component *component, { struct rt5514_dsp *rt5514_dsp = snd_soc_component_get_drvdata(component); - int ret; u8 buf[8];
mutex_lock(&rt5514_dsp->dma_lock); - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); rt5514_dsp->substream = substream; rt5514_dsp->dma_offset = 0;
@@ -230,7 +228,7 @@ static int rt5514_spi_hw_params(struct snd_soc_component *component,
mutex_unlock(&rt5514_dsp->dma_lock);
- return ret; + return 0; }
static int rt5514_spi_hw_free(struct snd_soc_component *component, @@ -245,7 +243,7 @@ static int rt5514_spi_hw_free(struct snd_soc_component *component,
cancel_delayed_work_sync(&rt5514_dsp->copy_work);
- return snd_pcm_lib_free_pages(substream); + return 0; }
static snd_pcm_uframes_t rt5514_spi_pcm_pointer( @@ -294,8 +292,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_component *component) static int rt5514_spi_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, - NULL, 0, 0); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, + NULL, 0, 0); return 0; }
The patch
ASoC: rt5514-spi: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 cae8055e065644fd1d92d2f0c23a39b6768d168a Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:09 +0100 Subject: [PATCH] ASoC: rt5514-spi: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Oder Chiou oder_chiou@realtek.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-19-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt5514-spi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index f1b7b947ecbd..1a25a3787935 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@ -215,11 +215,9 @@ static int rt5514_spi_hw_params(struct snd_soc_component *component, { struct rt5514_dsp *rt5514_dsp = snd_soc_component_get_drvdata(component); - int ret; u8 buf[8];
mutex_lock(&rt5514_dsp->dma_lock); - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); rt5514_dsp->substream = substream; rt5514_dsp->dma_offset = 0;
@@ -230,7 +228,7 @@ static int rt5514_spi_hw_params(struct snd_soc_component *component,
mutex_unlock(&rt5514_dsp->dma_lock);
- return ret; + return 0; }
static int rt5514_spi_hw_free(struct snd_soc_component *component, @@ -245,7 +243,7 @@ static int rt5514_spi_hw_free(struct snd_soc_component *component,
cancel_delayed_work_sync(&rt5514_dsp->copy_work);
- return snd_pcm_lib_free_pages(substream); + return 0; }
static snd_pcm_uframes_t rt5514_spi_pcm_pointer( @@ -294,8 +292,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_component *component) static int rt5514_spi_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, - NULL, 0, 0); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, + NULL, 0, 0); return 0; }
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Oder Chiou oder_chiou@realtek.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/rt5677-spi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c index 7810b1d7de32..3f40d2751833 100644 --- a/sound/soc/codecs/rt5677-spi.c +++ b/sound/soc/codecs/rt5677-spi.c @@ -132,14 +132,12 @@ static int rt5677_spi_hw_params( { struct rt5677_dsp *rt5677_dsp = snd_soc_component_get_drvdata(component); - int ret;
mutex_lock(&rt5677_dsp->dma_lock); - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); rt5677_dsp->substream = substream; mutex_unlock(&rt5677_dsp->dma_lock);
- return ret; + return 0; }
static int rt5677_spi_hw_free( @@ -153,7 +151,7 @@ static int rt5677_spi_hw_free( rt5677_dsp->substream = NULL; mutex_unlock(&rt5677_dsp->dma_lock);
- return snd_pcm_lib_free_pages(substream); + return 0; }
static int rt5677_spi_prepare( @@ -376,8 +374,8 @@ static void rt5677_spi_copy_work(struct work_struct *work) static int rt5677_spi_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, - NULL, 0, 0); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, + NULL, 0, 0); return 0; }
The patch
ASoC: rt5677-spi: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 9a560089e964c47f9be11cfb174c47aab0db64a3 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:10 +0100 Subject: [PATCH] ASoC: rt5677-spi: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped.
Cc: Oder Chiou oder_chiou@realtek.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-20-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/rt5677-spi.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c index 7810b1d7de32..3f40d2751833 100644 --- a/sound/soc/codecs/rt5677-spi.c +++ b/sound/soc/codecs/rt5677-spi.c @@ -132,14 +132,12 @@ static int rt5677_spi_hw_params( { struct rt5677_dsp *rt5677_dsp = snd_soc_component_get_drvdata(component); - int ret;
mutex_lock(&rt5677_dsp->dma_lock); - ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); rt5677_dsp->substream = substream; mutex_unlock(&rt5677_dsp->dma_lock);
- return ret; + return 0; }
static int rt5677_spi_hw_free( @@ -153,7 +151,7 @@ static int rt5677_spi_hw_free( rt5677_dsp->substream = NULL; mutex_unlock(&rt5677_dsp->dma_lock);
- return snd_pcm_lib_free_pages(substream); + return 0; }
static int rt5677_spi_prepare( @@ -376,8 +374,8 @@ static void rt5677_spi_copy_work(struct work_struct *work) static int rt5677_spi_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd) { - snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, - NULL, 0, 0); + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC, + NULL, 0, 0); return 0; }
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 47e3d1943d7e..08aa46ba5b07 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -387,27 +387,6 @@ static int sst_media_prepare(struct snd_pcm_substream *substream, return ret_val; }
-static int sst_media_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) -{ - int ret; - - ret = - snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(params)); - if (ret) - return ret; - memset(substream->runtime->dma_area, 0, params_buffer_bytes(params)); - return 0; -} - -static int sst_media_hw_free(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - return snd_pcm_lib_free_pages(substream); -} - static int sst_enable_ssp(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -473,8 +452,6 @@ static const struct snd_soc_dai_ops sst_media_dai_ops = { .startup = sst_media_open, .shutdown = sst_media_close, .prepare = sst_media_prepare, - .hw_params = sst_media_hw_params, - .hw_free = sst_media_hw_free, .mute_stream = sst_media_digital_mute, };
@@ -677,7 +654,7 @@ static int sst_soc_pcm_new(struct snd_soc_component *component,
if (dai->driver->playback.channels_min || dai->driver->capture.channels_min) { - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_DMA), SST_MIN_BUFFER, SST_MAX_BUFFER);
The patch
ASoC: intel: atom: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 02298145559f824b31a4bada8071e59c55b7df88 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:11 +0100 Subject: [PATCH] ASoC: intel: atom: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-21-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 25 +------------------- 1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 607c8f50c3f3..340bd2be39a7 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -387,27 +387,6 @@ static int sst_media_prepare(struct snd_pcm_substream *substream, return ret_val; }
-static int sst_media_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) -{ - int ret; - - ret = - snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(params)); - if (ret) - return ret; - memset(substream->runtime->dma_area, 0, params_buffer_bytes(params)); - return 0; -} - -static int sst_media_hw_free(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - return snd_pcm_lib_free_pages(substream); -} - static int sst_enable_ssp(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -473,8 +452,6 @@ static const struct snd_soc_dai_ops sst_media_dai_ops = { .startup = sst_media_open, .shutdown = sst_media_close, .prepare = sst_media_prepare, - .hw_params = sst_media_hw_params, - .hw_free = sst_media_hw_free, .mute_stream = sst_media_digital_mute, };
@@ -677,7 +654,7 @@ static int sst_soc_pcm_new(struct snd_soc_component *component,
if (dai->driver->playback.channels_min || dai->driver->capture.channels_min) { - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_DMA), SST_MIN_BUFFER, SST_MAX_BUFFER);
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/intel/baytrail/sst-baytrail-pcm.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/sound/soc/intel/baytrail/sst-baytrail-pcm.c b/sound/soc/intel/baytrail/sst-baytrail-pcm.c index 1d780fcc448c..a4435306325a 100644 --- a/sound/soc/intel/baytrail/sst-baytrail-pcm.c +++ b/sound/soc/intel/baytrail/sst-baytrail-pcm.c @@ -102,8 +102,6 @@ static int sst_byt_pcm_hw_params(struct snd_soc_component *component, return ret; }
- snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - ret = sst_byt_stream_buffer(byt, pcm_data->stream, substream->dma_buffer.addr, params_buffer_bytes(params)); @@ -121,17 +119,6 @@ static int sst_byt_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int sst_byt_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - - dev_dbg(rtd->dev, "PCM: hw_free\n"); - snd_pcm_lib_free_pages(substream); - - return 0; -} - static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -315,9 +302,8 @@ static int sst_byt_pcm_new(struct snd_soc_component *component, if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { size = sst_byt_pcm_hardware.buffer_bytes_max; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - pdata->dma_dev, - size, size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + pdata->dma_dev, size, size); }
return 0; @@ -375,7 +361,6 @@ static const struct snd_soc_component_driver byt_dai_component = { .close = sst_byt_pcm_close, .ioctl = snd_soc_pcm_lib_ioctl, .hw_params = sst_byt_pcm_hw_params, - .hw_free = sst_byt_pcm_hw_free, .trigger = sst_byt_pcm_trigger, .pointer = sst_byt_pcm_pointer, .mmap = sst_byt_pcm_mmap,
The patch
ASoC: intel: baytrail: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 d9c7824aa29d064b205957033463563ac3205fcb Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:12 +0100 Subject: [PATCH] ASoC: intel: baytrail: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-22-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/baytrail/sst-baytrail-pcm.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/sound/soc/intel/baytrail/sst-baytrail-pcm.c b/sound/soc/intel/baytrail/sst-baytrail-pcm.c index 775c3b0b209e..53383055c8dc 100644 --- a/sound/soc/intel/baytrail/sst-baytrail-pcm.c +++ b/sound/soc/intel/baytrail/sst-baytrail-pcm.c @@ -102,8 +102,6 @@ static int sst_byt_pcm_hw_params(struct snd_soc_component *component, return ret; }
- snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - ret = sst_byt_stream_buffer(byt, pcm_data->stream, substream->dma_buffer.addr, params_buffer_bytes(params)); @@ -121,17 +119,6 @@ static int sst_byt_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int sst_byt_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - - dev_dbg(rtd->dev, "PCM: hw_free\n"); - snd_pcm_lib_free_pages(substream); - - return 0; -} - static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -315,9 +302,8 @@ static int sst_byt_pcm_new(struct snd_soc_component *component, if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { size = sst_byt_pcm_hardware.buffer_bytes_max; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - pdata->dma_dev, - size, size); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + pdata->dma_dev, size, size); }
return 0; @@ -374,7 +360,6 @@ static const struct snd_soc_component_driver byt_dai_component = { .open = sst_byt_pcm_open, .close = sst_byt_pcm_close, .hw_params = sst_byt_pcm_hw_params, - .hw_free = sst_byt_pcm_hw_free, .trigger = sst_byt_pcm_trigger, .pointer = sst_byt_pcm_pointer, .mmap = sst_byt_pcm_mmap,
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/intel/haswell/sst-haswell-pcm.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c index a3a5bba2fbd9..59c63ccc7bb3 100644 --- a/sound/soc/intel/haswell/sst-haswell-pcm.c +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c @@ -592,13 +592,6 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, return ret; }
- ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) { - dev_err(rtd->dev, "error: could not allocate %d bytes for PCM %d\n", - params_buffer_bytes(params), ret); - return ret; - } - dmab = snd_pcm_get_dma_buf(substream);
ret = create_adsp_page_table(substream, pdata, rtd, runtime->dma_area, @@ -656,13 +649,6 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int hsw_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int hsw_pcm_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) { @@ -930,7 +916,7 @@ static int hsw_pcm_new(struct snd_soc_component *component,
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG, dev, hsw_pcm_hardware.buffer_bytes_max, @@ -1114,7 +1100,6 @@ static const struct snd_soc_component_driver hsw_dai_component = { .open = hsw_pcm_open, .close = hsw_pcm_close, .hw_params = hsw_pcm_hw_params, - .hw_free = hsw_pcm_hw_free, .trigger = hsw_pcm_trigger, .pointer = hsw_pcm_pointer, .ioctl = snd_soc_pcm_lib_ioctl,
The patch
ASoC: intel: haswell: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 3f93b1ed4ac1e285eafc6da8b354d3577977059a Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:13 +0100 Subject: [PATCH] ASoC: intel: haswell: Use managed buffer allocation
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-23-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/haswell/sst-haswell-pcm.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c index 31fb38067f8f..033d7c05d7fb 100644 --- a/sound/soc/intel/haswell/sst-haswell-pcm.c +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c @@ -592,13 +592,6 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, return ret; }
- ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); - if (ret < 0) { - dev_err(rtd->dev, "error: could not allocate %d bytes for PCM %d\n", - params_buffer_bytes(params), ret); - return ret; - } - dmab = snd_pcm_get_dma_buf(substream);
ret = create_adsp_page_table(substream, pdata, rtd, runtime->dma_area, @@ -656,13 +649,6 @@ static int hsw_pcm_hw_params(struct snd_soc_component *component, return 0; }
-static int hsw_pcm_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int hsw_pcm_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) { @@ -930,7 +916,7 @@ static int hsw_pcm_new(struct snd_soc_component *component,
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG, dev, hsw_pcm_hardware.buffer_bytes_max, @@ -1114,7 +1100,6 @@ static const struct snd_soc_component_driver hsw_dai_component = { .open = hsw_pcm_open, .close = hsw_pcm_close, .hw_params = hsw_pcm_hw_params, - .hw_free = hsw_pcm_hw_free, .trigger = hsw_pcm_trigger, .pointer = hsw_pcm_pointer, .pcm_construct = hsw_pcm_new,
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped. The pcm_construct ops contains only the superfluous call of snd_pcm_lib_preallocate_free_for_all(), so dropped, too.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/intel/skylake/skl-pcm.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index 8b9abb79a69e..ce14fa735d73 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -77,13 +77,7 @@ static int skl_substream_alloc_pages(struct hdac_bus *bus, hdac_stream(stream)->period_bytes = 0; hdac_stream(stream)->format_val = 0;
- return snd_pcm_lib_malloc_pages(substream, size); -} - -static int skl_substream_free_pages(struct hdac_bus *bus, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + return 0; }
static void skl_set_pcm_constrains(struct hdac_bus *bus, @@ -385,7 +379,6 @@ static void skl_pcm_close(struct snd_pcm_substream *substream, static int skl_pcm_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct hdac_bus *bus = dev_get_drvdata(dai->dev); struct hdac_ext_stream *stream = get_hdac_ext_stream(substream); struct skl_dev *skl = get_skl_ctx(dai->dev); struct skl_module_cfg *mconfig; @@ -405,7 +398,7 @@ static int skl_pcm_hw_free(struct snd_pcm_substream *substream, snd_hdac_stream_cleanup(hdac_stream(stream)); hdac_stream(stream)->prepared = 0;
- return skl_substream_free_pages(bus, substream); + return 0; }
static int skl_be_hw_params(struct snd_pcm_substream *substream, @@ -1289,12 +1282,6 @@ static int skl_platform_soc_get_time_info( return 0; }
-static void skl_platform_soc_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - #define MAX_PREALLOC_SIZE (32 * 1024 * 1024)
static int skl_platform_soc_new(struct snd_soc_component *component, @@ -1312,10 +1299,10 @@ static int skl_platform_soc_new(struct snd_soc_component *component, size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024; if (size > MAX_PREALLOC_SIZE) size = MAX_PREALLOC_SIZE; - snd_pcm_lib_preallocate_pages_for_all(pcm, - SNDRV_DMA_TYPE_DEV_SG, - &skl->pci->dev, - size, MAX_PREALLOC_SIZE); + snd_pcm_set_managed_buffer_all(pcm, + SNDRV_DMA_TYPE_DEV_SG, + &skl->pci->dev, + size, MAX_PREALLOC_SIZE); }
return 0; @@ -1483,7 +1470,6 @@ static const struct snd_soc_component_driver skl_component = { .get_time_info = skl_platform_soc_get_time_info, .mmap = skl_platform_soc_mmap, .pcm_construct = skl_platform_soc_new, - .pcm_destruct = skl_platform_soc_free, .module_get_upon_open = 1, /* increment refcount when a pcm is opened */ };
The patch
ASoC: intel: skylake: Use managed buffer allocation
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 51240953f28e0528a975db686d4e9e5938d55829 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Tue, 10 Dec 2019 15:26:14 +0100 Subject: [PATCH] ASoC: intel: skylake: Use managed buffer allocation
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped. The pcm_construct ops contains only the superfluous call of snd_pcm_lib_preallocate_free_for_all(), so dropped, too.
Cc: Cezary Rojewski cezary.rojewski@intel.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: Liam Girdwood liam.r.girdwood@linux.intel.com Cc: Jie Yang yang.jie@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://lore.kernel.org/r/20191210142614.19405-24-tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl-pcm.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index bec5cee19566..355165fd6b6a 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -77,13 +77,7 @@ static int skl_substream_alloc_pages(struct hdac_bus *bus, hdac_stream(stream)->period_bytes = 0; hdac_stream(stream)->format_val = 0;
- return snd_pcm_lib_malloc_pages(substream, size); -} - -static int skl_substream_free_pages(struct hdac_bus *bus, - struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + return 0; }
static void skl_set_pcm_constrains(struct hdac_bus *bus, @@ -385,7 +379,6 @@ static void skl_pcm_close(struct snd_pcm_substream *substream, static int skl_pcm_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct hdac_bus *bus = dev_get_drvdata(dai->dev); struct hdac_ext_stream *stream = get_hdac_ext_stream(substream); struct skl_dev *skl = get_skl_ctx(dai->dev); struct skl_module_cfg *mconfig; @@ -405,7 +398,7 @@ static int skl_pcm_hw_free(struct snd_pcm_substream *substream, snd_hdac_stream_cleanup(hdac_stream(stream)); hdac_stream(stream)->prepared = 0;
- return skl_substream_free_pages(bus, substream); + return 0; }
static int skl_be_hw_params(struct snd_pcm_substream *substream, @@ -1289,12 +1282,6 @@ static int skl_platform_soc_get_time_info( return 0; }
-static void skl_platform_soc_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - #define MAX_PREALLOC_SIZE (32 * 1024 * 1024)
static int skl_platform_soc_new(struct snd_soc_component *component, @@ -1312,10 +1299,10 @@ static int skl_platform_soc_new(struct snd_soc_component *component, size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024; if (size > MAX_PREALLOC_SIZE) size = MAX_PREALLOC_SIZE; - snd_pcm_lib_preallocate_pages_for_all(pcm, - SNDRV_DMA_TYPE_DEV_SG, - &skl->pci->dev, - size, MAX_PREALLOC_SIZE); + snd_pcm_set_managed_buffer_all(pcm, + SNDRV_DMA_TYPE_DEV_SG, + &skl->pci->dev, + size, MAX_PREALLOC_SIZE); }
return 0; @@ -1482,7 +1469,6 @@ static const struct snd_soc_component_driver skl_component = { .get_time_info = skl_platform_soc_get_time_info, .mmap = skl_platform_soc_mmap, .pcm_construct = skl_platform_soc_new, - .pcm_destruct = skl_platform_soc_free, .module_get_upon_open = 1, /* increment refcount when a pcm is opened */ };
participants (3)
-
Jerome Brunet
-
Mark Brown
-
Takashi Iwai