linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 09/15] ASoC: fsl-ssi: Add support for imx-pcm-fiq
Date: Sun, 14 Apr 2013 13:42:53 +0200	[thread overview]
Message-ID: <1365939779-4507-10-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1365939779-4507-1-git-send-email-mpa@pengutronix.de>

Add support for non-dma pcm for imx platforms with imx-pcm-fiq support.
Instead of imx-pcm-audio, in this case imx-pcm-fiq-audio device is added
and the SIER flags are set differently.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---

Notes:
    Changes in v3:
     - Rename bool "dma" to "use_dma"

 sound/soc/fsl/fsl_ssi.c | 66 ++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 52 insertions(+), 14 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 0f0bed6..6a9be9c 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -121,12 +121,14 @@ struct fsl_ssi_private {
 
 	bool new_binding;
 	bool ssi_on_imx;
+	bool use_dma;
 	struct clk *clk;
 	struct platform_device *imx_pcm_pdev;
 	struct snd_dmaengine_dai_dma_data dma_params_tx;
 	struct snd_dmaengine_dai_dma_data dma_params_rx;
 	struct imx_dma_data filter_data_tx;
 	struct imx_dma_data filter_data_rx;
+	struct imx_pcm_fiq_params fiq_params;
 
 	struct {
 		unsigned int rfrc;
@@ -356,7 +358,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		 */
 
 		/* Enable the interrupts and DMA requests */
-		write_ssi(SIER_FLAGS, &ssi->sier);
+		if (ssi_private->use_dma)
+			write_ssi(SIER_FLAGS, &ssi->sier);
+		else
+			write_ssi(CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN |
+					CCSR_SSI_SIER_RIE |
+					CCSR_SSI_SIER_RFF0_EN, &ssi->sier);
 
 		/*
 		 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -550,7 +557,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
 {
 	struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
 
-	if (ssi_private->ssi_on_imx) {
+	if (ssi_private->ssi_on_imx && ssi_private->use_dma) {
 		dai->playback_dma_data = &ssi_private->dma_params_tx;
 		dai->capture_dma_data = &ssi_private->dma_params_rx;
 	}
@@ -695,6 +702,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 	       sizeof(fsl_ssi_dai_template));
 	ssi_private->cpu_dai_drv.name = ssi_private->name;
 
+	ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
+
 	/* Get the addresses and IRQ */
 	ret = of_address_to_resource(np, 0, &res);
 	if (ret) {
@@ -716,12 +725,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 		goto error_iomap;
 	}
 
-	/* The 'name' should not have any slashes in it. */
-	ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
-			  ssi_private);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "could not claim irq %u\n", ssi_private->irq);
-		goto error_irqmap;
+	if (ssi_private->use_dma) {
+		/* The 'name' should not have any slashes in it. */
+		ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0,
+				ssi_private->name, ssi_private);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "could not claim irq %u\n",
+					ssi_private->irq);
+			goto error_irqmap;
+		}
 	}
 
 	/* Are the RX and the TX clocks locked? */
@@ -770,7 +782,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 		 */
 		ret = of_property_read_u32_array(pdev->dev.of_node,
 					"fsl,ssi-dma-events", dma_events, 2);
-		if (ret) {
+		if (ret && !ssi_private->use_dma) {
 			dev_err(&pdev->dev, "could not get dma events\n");
 			goto error_clk;
 		}
@@ -809,12 +821,38 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 	}
 
 	if (ssi_private->ssi_on_imx) {
-		ssi_private->imx_pcm_pdev =
-			platform_device_register_simple("imx-pcm-audio",
+		if (!ssi_private->use_dma) {
+			ssi_private->imx_pcm_pdev = platform_device_alloc(
+							"imx-fiq-pcm-audio",
+							pdev->id);
+			if (!ssi_private->imx_pcm_pdev) {
+				ret = -ENOMEM;
+				goto error_dev;
+			}
+
+			ssi_private->fiq_params.irq = ssi_private->irq;
+			ssi_private->fiq_params.base = ssi_private->ssi;
+			ssi_private->fiq_params.dma_params_rx =
+				&ssi_private->dma_params_rx;
+			ssi_private->fiq_params.dma_params_tx =
+				&ssi_private->dma_params_tx;
+
+			platform_set_drvdata(ssi_private->imx_pcm_pdev,
+					&ssi_private->fiq_params);
+			ret = platform_device_add(ssi_private->imx_pcm_pdev);
+			if (ret) {
+				dev_err(&pdev->dev, "Failed to add imx-fiq-pcm-audio device\n");
+				platform_device_put(ssi_private->imx_pcm_pdev);
+				goto error_dev;
+			}
+		} else {
+			ssi_private->imx_pcm_pdev =
+				platform_device_register_simple("imx-pcm-audio",
 							-1, NULL, 0);
-		if (IS_ERR(ssi_private->imx_pcm_pdev)) {
-			ret = PTR_ERR(ssi_private->imx_pcm_pdev);
-			goto error_dev;
+			if (IS_ERR(ssi_private->imx_pcm_pdev)) {
+				ret = PTR_ERR(ssi_private->imx_pcm_pdev);
+				goto error_dev;
+			}
 		}
 	}
 
-- 
1.8.1.5

  parent reply	other threads:[~2013-04-14 11:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 11:42 [PATCH v3 00/15] ASoC: fsl-ssi: ac97-slave support Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 01/15] ASoC: imx-ssi: Fix includes Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 02/15] ASoC: dmaengine-pcm: Replace of specific helper function Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 03/15] ASoC: dmaengine-pcm: Fix function name Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 04/15] ASoC: dmaengine-pcm: Fix pcm_request_chan " Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 05/15] ASoC: phycore-ac97: Add DT support Markus Pargmann
2013-04-16 11:59   ` Mark Brown
2013-04-16 15:23     ` Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 06/15] ASoC: imx-pcm-dma: " Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 07/15] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 08/15] ASoC: fsl-ssi: Add SACNT definitions Markus Pargmann
2013-04-16 12:03   ` Mark Brown
2013-04-14 11:42 ` Markus Pargmann [this message]
2013-04-14 11:42 ` [PATCH v3 10/15] ASoC: fsl-ssi: Use generic DMA bindings if possible Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 11/15] ARM: imx: Export ac97 reset functions Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 12/15] ASoC: fsl-ssi: imx ac97 support Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 13/15] ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97 Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 14/15] ASoC: fsl: Move fsl-ssi binding doc to sound/ Markus Pargmann
2013-04-14 11:42 ` [PATCH v3 15/15] ASoC: fsl: Update fsl-ssi binding doc Markus Pargmann
2013-04-14 12:13 ` [PATCH v3 00/15] ASoC: fsl-ssi: ac97-slave support Lars-Peter Clausen
2013-04-16  0:25   ` Timur Tabi
2013-04-16  8:06     ` Lars-Peter Clausen
2013-04-17 14:12 ` Mark Brown

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=1365939779-4507-10-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).