diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-10-02 14:34:34 +0900 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-10-08 13:49:39 +0100 |
commit | 4ac85de9977e7361ef10be23a33313f3cf56e073 (patch) | |
tree | 24c5eb07c6ed8a526b470ca8a4aeada6b89e5f7c /sound/soc/fsl/fsl_dma.c | |
parent | 2adc3fcc4a1f50e614cff67d8de5dcbb4a3b553d (diff) |
ASoC: fsl: fsl_dma: 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/87bluz90d1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl/fsl_dma.c')
-rw-r--r-- | sound/soc/fsl/fsl_dma.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index e22508301412..bc8691a45131 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c @@ -280,7 +280,8 @@ static irqreturn_t fsl_dma_isr(int irq, void *dev_id) * Regardless of where the memory is actually allocated, since the device can * technically DMA to any 36-bit address, we do need to set the DMA mask to 36. */ -static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd) +static int fsl_dma_new(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; struct snd_pcm *pcm = rtd->pcm; @@ -380,11 +381,10 @@ static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd) * buffer, which is what ALSA expects. We're just dividing it into * contiguous parts, and creating a link descriptor for each one. */ -static int fsl_dma_open(struct snd_pcm_substream *substream) +static int fsl_dma_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct device *dev = component->dev; struct dma_object *dma = container_of(component->driver, struct dma_object, dai); @@ -533,13 +533,12 @@ static int fsl_dma_open(struct snd_pcm_substream *substream) * and 8 bytes at a time). So we do not support packed 24-bit samples. * 24-bit data must be padded to 32 bits. */ -static int fsl_dma_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) +static int fsl_dma_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { struct snd_pcm_runtime *runtime = substream->runtime; struct fsl_dma_private *dma_private = runtime->private_data; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct device *dev = component->dev; /* Number of bits per sample */ @@ -698,12 +697,11 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream, * The base address of the buffer is stored in the source_addr field of the * first link descriptor. */ -static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream) +static snd_pcm_uframes_t fsl_dma_pointer(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct fsl_dma_private *dma_private = runtime->private_data; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct device *dev = component->dev; struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel; dma_addr_t position; @@ -763,7 +761,8 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream) * * This function can be called multiple times. */ -static int fsl_dma_hw_free(struct snd_pcm_substream *substream) +static int fsl_dma_hw_free(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct fsl_dma_private *dma_private = runtime->private_data; @@ -796,12 +795,11 @@ static int fsl_dma_hw_free(struct snd_pcm_substream *substream) /** * fsl_dma_close: close the stream. */ -static int fsl_dma_close(struct snd_pcm_substream *substream) +static int fsl_dma_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct fsl_dma_private *dma_private = runtime->private_data; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct device *dev = component->dev; struct dma_object *dma = container_of(component->driver, struct dma_object, dai); @@ -824,7 +822,8 @@ static int fsl_dma_close(struct snd_pcm_substream *substream) /* * Remove this PCM driver. */ -static void fsl_dma_free_dma_buffers(struct snd_pcm *pcm) +static void fsl_dma_free_dma_buffers(struct snd_soc_component *component, + struct snd_pcm *pcm) { struct snd_pcm_substream *substream; unsigned int i; @@ -872,15 +871,6 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np) return NULL; } -static const struct snd_pcm_ops fsl_dma_ops = { - .open = fsl_dma_open, - .close = fsl_dma_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = fsl_dma_hw_params, - .hw_free = fsl_dma_hw_free, - .pointer = fsl_dma_pointer, -}; - static int fsl_soc_dma_probe(struct platform_device *pdev) { struct dma_object *dma; @@ -913,8 +903,14 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) dma->dai.name = DRV_NAME; dma->dai.ops = &fsl_dma_ops; - dma->dai.pcm_new = fsl_dma_new; - dma->dai.pcm_free = fsl_dma_free_dma_buffers; + dma->dai.open = fsl_dma_open; + dma->dai.close = fsl_dma_close; + dma->dai.ioctl = snd_soc_pcm_lib_ioctl; + dma->dai.hw_params = fsl_dma_hw_params; + dma->dai.hw_free = fsl_dma_hw_free; + dma->dai.pointer = fsl_dma_pointer; + dma->dai.pcm_construct = fsl_dma_new; + dma->dai.pcm_destruct = fsl_dma_free_dma_buffers; /* Store the SSI-specific information that we need */ dma->ssi_stx_phys = res.start + REG_SSI_STX0; |