summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-11-08 10:46:39 +0100
committerTakashi Iwai <tiwai@suse.de>2019-11-09 18:02:53 +0100
commitf541220cd590e4a7436913d6f7d41ff4aba67982 (patch)
tree00ea099dcb4633bfbe1a4718304ad4b9f60ac6e3 /sound/soc/codecs
parentb01aa131fae9da3c1898baff17176307c0e23e12 (diff)
downloadlinux-f541220cd590e4a7436913d6f7d41ff4aba67982.tar.bz2
ASoC: rt5677-spi: Convert to the common vmalloc memalloc
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code. (*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the default mmap handler Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Curtis Malainey <cujomalainey@chromium.org> Link: https://lore.kernel.org/r/20191108094641.20086-7-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/rt5677-spi.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c
index 3aa3ea7c2768..0c90f99b693f 100644
--- a/sound/soc/codecs/rt5677-spi.c
+++ b/sound/soc/codecs/rt5677-spi.c
@@ -128,8 +128,7 @@ static int rt5677_spi_hw_params(
int ret;
mutex_lock(&rt5677_dsp->dma_lock);
- ret = snd_pcm_lib_alloc_vmalloc_buffer(substream,
- params_buffer_bytes(hw_params));
+ ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
rt5677_dsp->substream = substream;
mutex_unlock(&rt5677_dsp->dma_lock);
@@ -147,7 +146,7 @@ static int rt5677_spi_hw_free(
rt5677_dsp->substream = NULL;
mutex_unlock(&rt5677_dsp->dma_lock);
- return snd_pcm_lib_free_vmalloc_buffer(substream);
+ return snd_pcm_lib_free_pages(substream);
}
static int rt5677_spi_prepare(
@@ -361,12 +360,12 @@ done:
mutex_unlock(&rt5677_dsp->dma_lock);
}
-static struct page *rt5677_spi_pcm_page(
- struct snd_soc_component *component,
- struct snd_pcm_substream *substream,
- unsigned long offset)
+static int rt5677_spi_pcm_new(struct snd_soc_component *component,
+ struct snd_soc_pcm_runtime *rtd)
{
- return snd_pcm_lib_get_vmalloc_page(substream, offset);
+ snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_VMALLOC,
+ NULL, 0, 0);
+ return 0;
}
static int rt5677_spi_pcm_probe(struct snd_soc_component *component)
@@ -394,7 +393,7 @@ static const struct snd_soc_component_driver rt5677_spi_dai_component = {
.hw_free = rt5677_spi_hw_free,
.prepare = rt5677_spi_prepare,
.pointer = rt5677_spi_pcm_pointer,
- .page = rt5677_spi_pcm_page,
+ .pcm_construct = rt5677_spi_pcm_new,
};
/* Select a suitable transfer command for the next transfer to ensure