From fc3923644867e4bf2ccd3b9a1daca269c0bc8ff1 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 23 Mar 2020 14:17:59 +0900 Subject: ASoC: bcm: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer Signed-off-by: Kuninori Morimoto Tested-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/87zhc7ir94.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/bcm/bcm63xx-pcm-whistler.c | 16 ++++++++-------- sound/soc/bcm/cygnus-pcm.c | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/soc/bcm/bcm63xx-pcm-whistler.c b/sound/soc/bcm/bcm63xx-pcm-whistler.c index 55c760f1cf4d..e46c390683e7 100644 --- a/sound/soc/bcm/bcm63xx-pcm-whistler.c +++ b/sound/soc/bcm/bcm63xx-pcm-whistler.c @@ -55,7 +55,7 @@ static int bcm63xx_pcm_hw_params(struct snd_soc_component *component, if (!dma_desc) return -ENOMEM; - snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_desc); + snd_soc_dai_set_dma_data(asoc_rtd_to_cpu(rtd, 0), substream, dma_desc); return 0; } @@ -66,7 +66,7 @@ static int bcm63xx_pcm_hw_free(struct snd_soc_component *component, struct i2s_dma_desc *dma_desc; struct snd_soc_pcm_runtime *rtd = substream->private_data; - dma_desc = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + dma_desc = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); kfree(dma_desc); snd_pcm_set_runtime_buffer(substream, NULL); @@ -82,7 +82,7 @@ static int bcm63xx_pcm_trigger(struct snd_soc_component *component, struct regmap *regmap_i2s; rtd = substream->private_data; - i2s_priv = dev_get_drvdata(rtd->cpu_dai->dev); + i2s_priv = dev_get_drvdata(asoc_rtd_to_cpu(rtd, 0)->dev); regmap_i2s = i2s_priv->regmap_i2s; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { @@ -152,7 +152,7 @@ static int bcm63xx_pcm_prepare(struct snd_soc_component *component, struct snd_pcm_runtime *runtime = substream->runtime; uint32_t regaddr_desclen, regaddr_descaddr; - dma_desc = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + dma_desc = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); dma_desc->dma_len = snd_pcm_lib_period_bytes(substream); dma_desc->dma_addr = runtime->dma_addr; dma_desc->dma_area = runtime->dma_area; @@ -165,7 +165,7 @@ static int bcm63xx_pcm_prepare(struct snd_soc_component *component, regaddr_descaddr = I2S_RX_DESC_IFF_ADDR; } - i2s_priv = dev_get_drvdata(rtd->cpu_dai->dev); + i2s_priv = dev_get_drvdata(asoc_rtd_to_cpu(rtd, 0)->dev); regmap_i2s = i2s_priv->regmap_i2s; regmap_write(regmap_i2s, regaddr_desclen, dma_desc->dma_len); @@ -269,7 +269,7 @@ static irqreturn_t i2s_dma_isr(int irq, void *bcm_i2s_priv) runtime = substream->runtime; rtd = substream->private_data; prtd = runtime->private_data; - dma_desc = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + dma_desc = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); offlevel = (int_status & I2S_RX_DESC_OFF_LEVEL_MASK) >> I2S_RX_DESC_OFF_LEVEL_SHIFT; @@ -317,7 +317,7 @@ static irqreturn_t i2s_dma_isr(int irq, void *bcm_i2s_priv) runtime = substream->runtime; rtd = substream->private_data; prtd = runtime->private_data; - dma_desc = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); + dma_desc = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); offlevel = (int_status & I2S_TX_DESC_OFF_LEVEL_MASK) >> I2S_TX_DESC_OFF_LEVEL_SHIFT; @@ -388,7 +388,7 @@ static int bcm63xx_soc_pcm_new(struct snd_soc_component *component, struct bcm_i2s_priv *i2s_priv; int ret; - i2s_priv = dev_get_drvdata(rtd->cpu_dai->dev); + i2s_priv = dev_get_drvdata(asoc_rtd_to_cpu(rtd, 0)->dev); of_dma_configure(pcm->card->dev, pcm->card->dev->of_node, 1); diff --git a/sound/soc/bcm/cygnus-pcm.c b/sound/soc/bcm/cygnus-pcm.c index 3a80c613bc3f..f96d27c8b301 100644 --- a/sound/soc/bcm/cygnus-pcm.c +++ b/sound/soc/bcm/cygnus-pcm.c @@ -209,7 +209,7 @@ static struct cygnus_aio_port *cygnus_dai_get_dma_data( { struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; - return snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); + return snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(soc_runtime, 0), substream); } static void ringbuf_set_initial(void __iomem *audio_io, @@ -359,7 +359,7 @@ static void disable_intr(struct snd_pcm_substream *substream) aio = cygnus_dai_get_dma_data(substream); - dev_dbg(rtd->cpu_dai->dev, "%s on port %d\n", __func__, aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s on port %d\n", __func__, aio->portnum); /* The port number maps to the bit position to be set */ set_mask = BIT(aio->portnum); @@ -590,7 +590,7 @@ static int cygnus_pcm_open(struct snd_soc_component *component, if (!aio) return -ENODEV; - dev_dbg(rtd->cpu_dai->dev, "%s port %d\n", __func__, aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s port %d\n", __func__, aio->portnum); snd_soc_set_runtime_hwparams(substream, &cygnus_pcm_hw); @@ -623,7 +623,7 @@ static int cygnus_pcm_close(struct snd_soc_component *component, aio = cygnus_dai_get_dma_data(substream); - dev_dbg(rtd->cpu_dai->dev, "%s port %d\n", __func__, aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s port %d\n", __func__, aio->portnum); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) aio->play_stream = NULL; @@ -631,7 +631,7 @@ static int cygnus_pcm_close(struct snd_soc_component *component, aio->capture_stream = NULL; if (!aio->play_stream && !aio->capture_stream) - dev_dbg(rtd->cpu_dai->dev, "freed port %d\n", aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "freed port %d\n", aio->portnum); return 0; } @@ -645,7 +645,7 @@ static int cygnus_pcm_hw_params(struct snd_soc_component *component, struct cygnus_aio_port *aio; aio = cygnus_dai_get_dma_data(substream); - dev_dbg(rtd->cpu_dai->dev, "%s port %d\n", __func__, aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s port %d\n", __func__, aio->portnum); snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); runtime->dma_bytes = params_buffer_bytes(params); @@ -660,7 +660,7 @@ static int cygnus_pcm_hw_free(struct snd_soc_component *component, struct cygnus_aio_port *aio; aio = cygnus_dai_get_dma_data(substream); - dev_dbg(rtd->cpu_dai->dev, "%s port %d\n", __func__, aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s port %d\n", __func__, aio->portnum); snd_pcm_set_runtime_buffer(substream, NULL); return 0; @@ -678,12 +678,12 @@ static int cygnus_pcm_prepare(struct snd_soc_component *component, struct ringbuf_regs *p_rbuf = NULL; aio = cygnus_dai_get_dma_data(substream); - dev_dbg(rtd->cpu_dai->dev, "%s port %d\n", __func__, aio->portnum); + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s port %d\n", __func__, aio->portnum); bufsize = snd_pcm_lib_buffer_bytes(substream); periodsize = snd_pcm_lib_period_bytes(substream); - dev_dbg(rtd->cpu_dai->dev, "%s (buf_size %lu) (period_size %lu)\n", + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s (buf_size %lu) (period_size %lu)\n", __func__, bufsize, periodsize); configure_ringbuf_regs(substream); @@ -745,11 +745,11 @@ static int cygnus_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) buf->area = dma_alloc_coherent(pcm->card->dev, size, &buf->addr, GFP_KERNEL); - dev_dbg(rtd->cpu_dai->dev, "%s: size 0x%zx @ %pK\n", + dev_dbg(asoc_rtd_to_cpu(rtd, 0)->dev, "%s: size 0x%zx @ %pK\n", __func__, size, buf->area); if (!buf->area) { - dev_err(rtd->cpu_dai->dev, "%s: dma_alloc failed\n", __func__); + dev_err(asoc_rtd_to_cpu(rtd, 0)->dev, "%s: dma_alloc failed\n", __func__); return -ENOMEM; } buf->bytes = size; -- cgit v1.2.3