Commit 2bcba424 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: xilinx: xlnx_formatter_pcm: remove snd_pcm_ops

snd_pcm_ops is no longer needed.
Let's use component driver callback.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bluzaf0y.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 17d48a31
...@@ -313,16 +313,14 @@ static irqreturn_t xlnx_s2mm_irq_handler(int irq, void *arg) ...@@ -313,16 +313,14 @@ static irqreturn_t xlnx_s2mm_irq_handler(int irq, void *arg)
return IRQ_NONE; return IRQ_NONE;
} }
static int xlnx_formatter_pcm_open(struct snd_pcm_substream *substream) static int xlnx_formatter_pcm_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
int err; int err;
u32 val, data_format_mode; u32 val, data_format_mode;
u32 ch_count_mask, ch_count_shift, data_xfer_mode, data_xfer_shift; u32 ch_count_mask, ch_count_shift, data_xfer_mode, data_xfer_shift;
struct xlnx_pcm_stream_param *stream_data; struct xlnx_pcm_stream_param *stream_data;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *prtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
DRV_NAME);
struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev); struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
...@@ -387,14 +385,12 @@ static int xlnx_formatter_pcm_open(struct snd_pcm_substream *substream) ...@@ -387,14 +385,12 @@ static int xlnx_formatter_pcm_open(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int xlnx_formatter_pcm_close(struct snd_pcm_substream *substream) static int xlnx_formatter_pcm_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
int ret; int ret;
struct xlnx_pcm_stream_param *stream_data = struct xlnx_pcm_stream_param *stream_data =
substream->runtime->private_data; substream->runtime->private_data;
struct snd_soc_pcm_runtime *prtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
DRV_NAME);
ret = xlnx_formatter_pcm_reset(stream_data->mmio); ret = xlnx_formatter_pcm_reset(stream_data->mmio);
if (ret) { if (ret) {
...@@ -409,7 +405,8 @@ static int xlnx_formatter_pcm_close(struct snd_pcm_substream *substream) ...@@ -409,7 +405,8 @@ static int xlnx_formatter_pcm_close(struct snd_pcm_substream *substream)
} }
static snd_pcm_uframes_t static snd_pcm_uframes_t
xlnx_formatter_pcm_pointer(struct snd_pcm_substream *substream) xlnx_formatter_pcm_pointer(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
u32 pos; u32 pos;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
...@@ -423,16 +420,14 @@ xlnx_formatter_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -423,16 +420,14 @@ xlnx_formatter_pcm_pointer(struct snd_pcm_substream *substream)
return bytes_to_frames(runtime, pos); return bytes_to_frames(runtime, pos);
} }
static int xlnx_formatter_pcm_hw_params(struct snd_pcm_substream *substream, static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
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; int status;
u64 size; u64 size;
struct snd_soc_pcm_runtime *prtd = substream->private_data;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd,
DRV_NAME);
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;
...@@ -500,12 +495,14 @@ static int xlnx_formatter_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -500,12 +495,14 @@ static int xlnx_formatter_pcm_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
static int xlnx_formatter_pcm_hw_free(struct snd_pcm_substream *substream) static int xlnx_formatter_pcm_hw_free(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{ {
return snd_pcm_lib_free_pages(substream); return snd_pcm_lib_free_pages(substream);
} }
static int xlnx_formatter_pcm_trigger(struct snd_pcm_substream *substream, static int xlnx_formatter_pcm_trigger(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
int cmd) int cmd)
{ {
u32 val; u32 val;
...@@ -532,10 +529,9 @@ static int xlnx_formatter_pcm_trigger(struct snd_pcm_substream *substream, ...@@ -532,10 +529,9 @@ static int xlnx_formatter_pcm_trigger(struct snd_pcm_substream *substream,
return 0; return 0;
} }
static int xlnx_formatter_pcm_new(struct snd_soc_pcm_runtime *rtd) static int xlnx_formatter_pcm_new(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd,
DRV_NAME);
snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, snd_pcm_lib_preallocate_pages_for_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,
...@@ -543,20 +539,16 @@ static int xlnx_formatter_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -543,20 +539,16 @@ static int xlnx_formatter_pcm_new(struct snd_soc_pcm_runtime *rtd)
return 0; return 0;
} }
static const struct snd_pcm_ops xlnx_formatter_pcm_ops = {
.open = xlnx_formatter_pcm_open,
.close = xlnx_formatter_pcm_close,
.ioctl = snd_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,
};
static const struct snd_soc_component_driver xlnx_asoc_component = { static const struct snd_soc_component_driver xlnx_asoc_component = {
.name = DRV_NAME, .name = DRV_NAME,
.ops = &xlnx_formatter_pcm_ops, .open = xlnx_formatter_pcm_open,
.pcm_new = xlnx_formatter_pcm_new, .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,
}; };
static int xlnx_formatter_pcm_probe(struct platform_device *pdev) static int xlnx_formatter_pcm_probe(struct platform_device *pdev)
......
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