Commit d23a1658 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown

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: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210142614.19405-7-tiwai@suse.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent bace3caa
...@@ -179,11 +179,6 @@ static int camelot_hw_params(struct snd_soc_component *component, ...@@ -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 recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1;
int ret; int ret;
ret = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
if (ret < 0)
return ret;
if (recv) { if (recv) {
cam->rx_period_size = params_period_bytes(hw_params); cam->rx_period_size = params_period_bytes(hw_params);
cam->rx_period = 0; cam->rx_period = 0;
...@@ -194,12 +189,6 @@ static int camelot_hw_params(struct snd_soc_component *component, ...@@ -194,12 +189,6 @@ static int camelot_hw_params(struct snd_soc_component *component,
return 0; 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, static int camelot_prepare(struct snd_soc_component *component,
struct snd_pcm_substream *substream) struct snd_pcm_substream *substream)
{ {
...@@ -307,7 +296,7 @@ static int camelot_pcm_new(struct snd_soc_component *component, ...@@ -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 /* dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
* in MMAP mode (i.e. aplay -M) * 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, SNDRV_DMA_TYPE_CONTINUOUS,
NULL, NULL,
DMABRG_PREALLOC_BUFFER, DMABRG_PREALLOC_BUFFER_MAX); DMABRG_PREALLOC_BUFFER, DMABRG_PREALLOC_BUFFER_MAX);
...@@ -320,7 +309,6 @@ static const struct snd_soc_component_driver sh7760_soc_component = { ...@@ -320,7 +309,6 @@ static const struct snd_soc_component_driver sh7760_soc_component = {
.close = camelot_pcm_close, .close = camelot_pcm_close,
.ioctl = snd_soc_pcm_lib_ioctl, .ioctl = snd_soc_pcm_lib_ioctl,
.hw_params = camelot_hw_params, .hw_params = camelot_hw_params,
.hw_free = camelot_hw_free,
.prepare = camelot_prepare, .prepare = camelot_prepare,
.trigger = camelot_trigger, .trigger = camelot_trigger,
.pointer = camelot_pos, .pointer = camelot_pos,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment