Commit 52f0ac15 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown

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: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191210142614.19405-16-tiwai@suse.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ffe11930
...@@ -426,7 +426,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, ...@@ -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 low, high, active_ch, val, bytes_per_ch, bits_per_sample;
u32 aes_reg1_val, aes_reg2_val; u32 aes_reg1_val, aes_reg2_val;
int status;
u64 size; u64 size;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct xlnx_pcm_stream_param *stream_data = runtime->private_data; 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, ...@@ -450,9 +449,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
} }
size = params_buffer_bytes(params); size = params_buffer_bytes(params);
status = snd_pcm_lib_malloc_pages(substream, size);
if (status < 0)
return status;
stream_data->buffer_size = size; stream_data->buffer_size = size;
...@@ -495,12 +491,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, ...@@ -495,12 +491,6 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
return 0; 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, static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component,
struct snd_pcm_substream *substream, struct snd_pcm_substream *substream,
int cmd) int cmd)
...@@ -532,7 +522,7 @@ static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component, ...@@ -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, static int xlnx_formatter_pcm_new(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd) 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, SNDRV_DMA_TYPE_DEV, component->dev,
xlnx_pcm_hardware.buffer_bytes_max, xlnx_pcm_hardware.buffer_bytes_max,
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 = { ...@@ -544,7 +534,6 @@ static const struct snd_soc_component_driver xlnx_asoc_component = {
.open = xlnx_formatter_pcm_open, .open = xlnx_formatter_pcm_open,
.close = xlnx_formatter_pcm_close, .close = xlnx_formatter_pcm_close,
.hw_params = xlnx_formatter_pcm_hw_params, .hw_params = xlnx_formatter_pcm_hw_params,
.hw_free = xlnx_formatter_pcm_hw_free,
.trigger = xlnx_formatter_pcm_trigger, .trigger = xlnx_formatter_pcm_trigger,
.pointer = xlnx_formatter_pcm_pointer, .pointer = xlnx_formatter_pcm_pointer,
.pcm_construct = xlnx_formatter_pcm_new, .pcm_construct = xlnx_formatter_pcm_new,
......
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