All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lubomir Rintel <lkundrak@v3.sk>
To: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH 04/11] ASoC: mmp-sspa: Get rid of dma_params and phys_base
Date: Mon, 11 May 2020 23:01:27 +0200	[thread overview]
Message-ID: <20200511210134.1224532-5-lkundrak@v3.sk> (raw)
In-Reply-To: <20200511210134.1224532-1-lkundrak@v3.sk>

This makes things simpler. There's no reason not to just embed the struct
snd_dmaengine_dai_dma_data in struct sspa_priv and do away with an
unnecessary kmalloc(). While at that, we can initialize the
snd_dmaengine_dai_dma_data structures earlier.

Let's also stop offsetting the source/destination of the DMA transfer by
phys_base. Firstly, it's never set and is always zero. Secondly, the
hardware actually ignores it, at least on a MMP2 and MMP3.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 sound/soc/pxa/mmp-sspa.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index 90a9bc81be80..421ffa9fa7b1 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -29,7 +29,8 @@
  */
 struct sspa_priv {
 	struct ssp_device *sspa;
-	struct snd_dmaengine_dai_dma_data *dma_params;
+	struct snd_dmaengine_dai_dma_data playback_dma_data;
+	struct snd_dmaengine_dai_dma_data capture_dma_data;
 	struct clk *audio_clk;
 	struct clk *sysclk;
 	int dai_fmt;
@@ -250,11 +251,8 @@ static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
 			       struct snd_pcm_hw_params *params,
 			       struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
 	struct sspa_priv *sspa_priv = snd_soc_dai_get_drvdata(dai);
 	struct ssp_device *sspa = sspa_priv->sspa;
-	struct snd_dmaengine_dai_dma_data *dma_params;
 	u32 sspa_ctrl;
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -293,11 +291,6 @@ static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
 		mmp_sspa_write_reg(sspa, SSPA_RXFIFO_UL, 0x0);
 	}
 
-	dma_params = &sspa_priv->dma_params[substream->stream];
-	dma_params->addr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
-				(sspa->phys_base + SSPA_TXD) :
-				(sspa->phys_base + SSPA_RXD);
-	snd_soc_dai_set_dma_data(cpu_dai, substream, dma_params);
 	return 0;
 }
 
@@ -351,6 +344,10 @@ static int mmp_sspa_probe(struct snd_soc_dai *dai)
 {
 	struct sspa_priv *priv = dev_get_drvdata(dai->dev);
 
+	snd_soc_dai_init_dma_data(dai,
+				&priv->playback_dma_data,
+				&priv->capture_dma_data);
+
 	snd_soc_dai_set_drvdata(dai, priv);
 	return 0;
 
@@ -407,12 +404,6 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
 	if (priv->sspa == NULL)
 		return -ENOMEM;
 
-	priv->dma_params = devm_kcalloc(&pdev->dev,
-			2, sizeof(struct snd_dmaengine_dai_dma_data),
-			GFP_KERNEL);
-	if (priv->dma_params == NULL)
-		return -ENOMEM;
-
 	priv->sspa->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->sspa->mmio_base))
 		return PTR_ERR(priv->sspa->mmio_base);
@@ -434,6 +425,10 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
 	priv->dai_fmt = (unsigned int) -1;
 	platform_set_drvdata(pdev, priv);
 
+	/* You know, these addresses are actually ignored. */
+	priv->playback_dma_data.addr = SSPA_TXD;
+	priv->capture_dma_data.addr = SSPA_RXD;
+
 	return devm_snd_soc_register_component(&pdev->dev, &mmp_sspa_component,
 					       &mmp_sspa_dai, 1);
 }
-- 
2.26.2


  parent reply	other threads:[~2020-05-11 21:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 21:01 [PATCH 00/11] Make sound work on DT-based MMP2 machines Lubomir Rintel
2020-05-11 21:01 ` [PATCH 01/11] ASoC: mmp-sspa: Flip SNDRV_PCM_FMTBIT_S24_3LE on Lubomir Rintel
2020-05-12 16:45   ` Mark Brown
2020-05-19 19:52   ` Mark Brown
2020-05-11 21:01 ` [PATCH 02/11] ASoC: mmp-sspa: Drop S20_3LE case Lubomir Rintel
2020-05-11 21:01 ` [PATCH 03/11] ASoC: mmp-sspa: A trivial typo fix Lubomir Rintel
2020-05-11 21:01 ` Lubomir Rintel [this message]
2020-05-11 21:01 ` [PATCH 05/11] ASoC: mmp-sspa: Add support for soc-generic-dmaengine-pcm Lubomir Rintel
2020-05-11 21:01 ` [PATCH 06/11] ASoC: mmp-sspa: Remove the embedded struct ssp_device Lubomir Rintel
2020-05-11 21:01 ` [PATCH 07/11] ASoC: mmp-sspa: Prepare/unprepare the clocks Lubomir Rintel
2020-05-12 12:45   ` Mark Brown
2020-05-12 15:36     ` Lubomir Rintel
2020-05-12 16:29       ` Mark Brown
2020-05-11 21:01 ` [PATCH 08/11] ASoC: mmp-sspa: Add support for the runtime power management Lubomir Rintel
2020-05-11 21:01 ` [PATCH 09/11] ASoC: mmp-sspa: Set appropriate bus format for given bit width Lubomir Rintel
2020-05-11 21:01 ` [PATCH 10/11] dt-bindings: sound: Add Marvell MMP SSPA binding Lubomir Rintel
2020-05-19 18:37   ` Rob Herring
2020-05-11 21:01 ` [PATCH 11/11] ASoC: mmp-sspa: Add Device Tree support Lubomir Rintel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200511210134.1224532-5-lkundrak@v3.sk \
    --to=lkundrak@v3.sk \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.