ASoC: pxa: mmp-pcm: remove snd_pcm_ops
snd_pcm_ops is no longer needed. Let's use component driver callback. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pnjf90ef.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
2324c8f4cd
Коммит
540e59c68b
|
@ -55,7 +55,8 @@ static struct snd_pcm_hardware mmp_pcm_hardware[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mmp_pcm_hw_params(struct snd_pcm_substream *substream,
|
static int mmp_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)
|
||||||
{
|
{
|
||||||
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
|
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
|
||||||
|
@ -77,6 +78,18 @@ static int mmp_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mmp_pcm_trigger(struct snd_soc_component *component,
|
||||||
|
struct snd_pcm_substream *substream, int cmd)
|
||||||
|
{
|
||||||
|
return snd_dmaengine_pcm_trigger(substream, cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static snd_pcm_uframes_t mmp_pcm_pointer(struct snd_soc_component *component,
|
||||||
|
struct snd_pcm_substream *substream)
|
||||||
|
{
|
||||||
|
return snd_dmaengine_pcm_pointer(substream);
|
||||||
|
}
|
||||||
|
|
||||||
static bool filter(struct dma_chan *chan, void *param)
|
static bool filter(struct dma_chan *chan, void *param)
|
||||||
{
|
{
|
||||||
struct mmp_dma_data *dma_data = param;
|
struct mmp_dma_data *dma_data = param;
|
||||||
|
@ -94,10 +107,10 @@ static bool filter(struct dma_chan *chan, void *param)
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmp_pcm_open(struct snd_pcm_substream *substream)
|
static int mmp_pcm_open(struct snd_soc_component *component,
|
||||||
|
struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
|
||||||
struct platform_device *pdev = to_platform_device(component->dev);
|
struct platform_device *pdev = to_platform_device(component->dev);
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
struct mmp_dma_data dma_data;
|
struct mmp_dma_data dma_data;
|
||||||
|
@ -117,7 +130,14 @@ static int mmp_pcm_open(struct snd_pcm_substream *substream)
|
||||||
&dma_data);
|
&dma_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmp_pcm_mmap(struct snd_pcm_substream *substream,
|
static int mmp_pcm_close(struct snd_soc_component *component,
|
||||||
|
struct snd_pcm_substream *substream)
|
||||||
|
{
|
||||||
|
return snd_dmaengine_pcm_close_release_chan(substream);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mmp_pcm_mmap(struct snd_soc_component *component,
|
||||||
|
struct snd_pcm_substream *substream,
|
||||||
struct vm_area_struct *vma)
|
struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||||
|
@ -129,17 +149,8 @@ static int mmp_pcm_mmap(struct snd_pcm_substream *substream,
|
||||||
vma->vm_end - vma->vm_start, vma->vm_page_prot);
|
vma->vm_end - vma->vm_start, vma->vm_page_prot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_pcm_ops mmp_pcm_ops = {
|
static void mmp_pcm_free_dma_buffers(struct snd_soc_component *component,
|
||||||
.open = mmp_pcm_open,
|
struct snd_pcm *pcm)
|
||||||
.close = snd_dmaengine_pcm_close_release_chan,
|
|
||||||
.ioctl = snd_pcm_lib_ioctl,
|
|
||||||
.hw_params = mmp_pcm_hw_params,
|
|
||||||
.trigger = snd_dmaengine_pcm_trigger,
|
|
||||||
.pointer = snd_dmaengine_pcm_pointer,
|
|
||||||
.mmap = mmp_pcm_mmap,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void mmp_pcm_free_dma_buffers(struct snd_pcm *pcm)
|
|
||||||
{
|
{
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
struct snd_dma_buffer *buf;
|
struct snd_dma_buffer *buf;
|
||||||
|
@ -188,7 +199,8 @@ static int mmp_pcm_preallocate_dma_buffer(struct snd_pcm_substream *substream,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mmp_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
static int mmp_pcm_new(struct snd_soc_component *component,
|
||||||
|
struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
struct snd_pcm *pcm = rtd->pcm;
|
struct snd_pcm *pcm = rtd->pcm;
|
||||||
|
@ -205,15 +217,21 @@ static int mmp_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
mmp_pcm_free_dma_buffers(pcm);
|
mmp_pcm_free_dma_buffers(component, pcm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_component_driver mmp_soc_component = {
|
static const struct snd_soc_component_driver mmp_soc_component = {
|
||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.ops = &mmp_pcm_ops,
|
.open = mmp_pcm_open,
|
||||||
.pcm_new = mmp_pcm_new,
|
.close = mmp_pcm_close,
|
||||||
.pcm_free = mmp_pcm_free_dma_buffers,
|
.ioctl = snd_soc_pcm_lib_ioctl,
|
||||||
|
.hw_params = mmp_pcm_hw_params,
|
||||||
|
.trigger = mmp_pcm_trigger,
|
||||||
|
.pointer = mmp_pcm_pointer,
|
||||||
|
.mmap = mmp_pcm_mmap,
|
||||||
|
.pcm_construct = mmp_pcm_new,
|
||||||
|
.pcm_destruct = mmp_pcm_free_dma_buffers,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mmp_pcm_probe(struct platform_device *pdev)
|
static int mmp_pcm_probe(struct platform_device *pdev)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче