Commit 4ac85de9 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: fsl: fsl_dma: 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/87bluz90d1.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2adc3fcc
...@@ -280,7 +280,8 @@ static irqreturn_t fsl_dma_isr(int irq, void *dev_id) ...@@ -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 * 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. * 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_card *card = rtd->card->snd_card;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
...@@ -380,11 +381,10 @@ static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd) ...@@ -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 * buffer, which is what ALSA expects. We're just dividing it into
* contiguous parts, and creating a link descriptor for each one. * 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_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 device *dev = component->dev;
struct dma_object *dma = struct dma_object *dma =
container_of(component->driver, struct dma_object, dai); container_of(component->driver, struct dma_object, dai);
...@@ -533,13 +533,12 @@ static int fsl_dma_open(struct snd_pcm_substream *substream) ...@@ -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. * and 8 bytes at a time). So we do not support packed 24-bit samples.
* 24-bit data must be padded to 32 bits. * 24-bit data must be padded to 32 bits.
*/ */
static int fsl_dma_hw_params(struct snd_pcm_substream *substream, 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_hw_params *hw_params)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct fsl_dma_private *dma_private = runtime->private_data; 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 device *dev = component->dev;
/* Number of bits per sample */ /* Number of bits per sample */
...@@ -698,12 +697,11 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream, ...@@ -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 * The base address of the buffer is stored in the source_addr field of the
* first link descriptor. * 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 snd_pcm_runtime *runtime = substream->runtime;
struct fsl_dma_private *dma_private = runtime->private_data; 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 device *dev = component->dev;
struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel; struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel;
dma_addr_t position; dma_addr_t position;
...@@ -763,7 +761,8 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream) ...@@ -763,7 +761,8 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream)
* *
* This function can be called multiple times. * 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 snd_pcm_runtime *runtime = substream->runtime;
struct fsl_dma_private *dma_private = runtime->private_data; struct fsl_dma_private *dma_private = runtime->private_data;
...@@ -796,12 +795,11 @@ static int fsl_dma_hw_free(struct snd_pcm_substream *substream) ...@@ -796,12 +795,11 @@ static int fsl_dma_hw_free(struct snd_pcm_substream *substream)
/** /**
* fsl_dma_close: close the stream. * 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 snd_pcm_runtime *runtime = substream->runtime;
struct fsl_dma_private *dma_private = runtime->private_data; 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 device *dev = component->dev;
struct dma_object *dma = struct dma_object *dma =
container_of(component->driver, struct dma_object, dai); container_of(component->driver, struct dma_object, dai);
...@@ -824,7 +822,8 @@ static int fsl_dma_close(struct snd_pcm_substream *substream) ...@@ -824,7 +822,8 @@ static int fsl_dma_close(struct snd_pcm_substream *substream)
/* /*
* Remove this PCM driver. * 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; struct snd_pcm_substream *substream;
unsigned int i; unsigned int i;
...@@ -872,15 +871,6 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np) ...@@ -872,15 +871,6 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np)
return NULL; 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) static int fsl_soc_dma_probe(struct platform_device *pdev)
{ {
struct dma_object *dma; struct dma_object *dma;
...@@ -913,8 +903,14 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) ...@@ -913,8 +903,14 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
dma->dai.name = DRV_NAME; dma->dai.name = DRV_NAME;
dma->dai.ops = &fsl_dma_ops; dma->dai.ops = &fsl_dma_ops;
dma->dai.pcm_new = fsl_dma_new; dma->dai.open = fsl_dma_open;
dma->dai.pcm_free = fsl_dma_free_dma_buffers; 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 */ /* Store the SSI-specific information that we need */
dma->ssi_stx_phys = res.start + REG_SSI_STX0; dma->ssi_stx_phys = res.start + REG_SSI_STX0;
......
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