Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	alsa-devel@alsa-project.org, Alexander Shiyan <shc_work@mail.ru>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Timur Tabi <timur@tabi.org>,
	"Li.Xiubo@freescale.com" <Li.Xiubo@freescale.com>,
	kernel@pengutronix.de, Nicolin Chen <Guangyu.Chen@freescale.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 15/18] ASoC: fsl-ssi: Allow first stream to set the bitclock
Date: Mon, 14 Apr 2014 15:35:45 +0200
Message-ID: <1397482548-28463-16-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1397482548-28463-1-git-send-email-mpa@pengutronix.de>

From: Sascha Hauer <s.hauer@pengutronix.de>

Allow to set the bitlcock exactly once when the ssi unit is
opened and do not touch the clock until both streams are closed
again. We should not unlock the bitclock in the stop trigger
since a trigger could be the result of an underrun and doesn't
mean the bitclock can be reconfigured again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/fsl_ssi.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index e5fa626..e97e30f 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -495,9 +495,6 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		snd_soc_dai_get_drvdata(rtd->cpu_dai);
 	int ret;
 
-	if (!dai->active && !fsl_ssi_is_ac97(ssi_private))
-		ssi_private->baudclk_locked = false;
-
 	if (fsl_ssi_is_i2s_master(ssi_private)) {
 		ret = clk_prepare_enable(ssi_private->baudclk);
 		if (ret)
@@ -525,6 +522,9 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
 
 	if (fsl_ssi_is_i2s_master(ssi_private))
 		clk_disable_unprepare(ssi_private->baudclk);
+
+	if (!dai->active)
+		ssi_private->baudclk_locked = 0;
 }
 
 /**
@@ -562,7 +562,11 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
 			continue;
 
 		tmprate = freq * factor * (i + 2);
-		clkrate = clk_round_rate(ssi_private->baudclk, tmprate);
+
+		if (ssi_private->baudclk_locked)
+			clkrate = clk_get_rate(ssi_private->baudclk);
+		else
+			clkrate = clk_round_rate(ssi_private->baudclk, tmprate);
 
 		do_div(clkrate, factor);
 		afreq = (u32)clkrate / (i + 1);
@@ -912,11 +916,6 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 			fsl_ssi_tx_config(ssi_private, false);
 		else
 			fsl_ssi_rx_config(ssi_private, false);
-
-		if (!fsl_ssi_is_ac97(ssi_private) && (read_ssi(&ssi->scr) &
-					(CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE)) == 0)
-			ssi_private->baudclk_locked = false;
-
 		break;
 
 	default:
@@ -1241,8 +1240,6 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                 /* Older 8610 DTs didn't have the fifo-depth property */
 		ssi_private->fifo_depth = 8;
 
-	ssi_private->baudclk_locked = false;
-
 	dev_set_drvdata(&pdev->dev, ssi_private);
 
 	if (ssi_private->soc->imx) {
-- 
1.9.1

  parent reply index

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 13:35 [PATCH v3 00/18] ASoC: fsl-ssi: Driver cleanup Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 01/18] ASoC: fsl-ssi: Fix register values when disabling Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 02/18] ASoC: fsl-ssi: Move debugging to seperate file Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 03/18] ASoC: fsl-ssi: Use dev_name for DAI driver struct Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 04/18] ASoC: fsl-ssi: Move imx-specific probe to seperate function Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 05/18] ASoC: fsl-ssi: Remove useless DMA code Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 06/18] ASoC: fsl-ssi: Cleanup probe function Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 07/18] ASoC: fsl-ssi: Remove unnecessary variables from ssi_private Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 08/18] ASoC: fsl-ssi: introduce SoC specific data Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 09/18] ASoC: fsl-ssi: Only enable baudclk when used Markus Pargmann
2014-04-14 15:28   ` Nicolin Chen
2014-04-16  7:27     ` Markus Pargmann
2014-04-16  8:08       ` Nicolin Chen
2014-04-16  8:43         ` Markus Pargmann
2014-04-16  8:40           ` Nicolin Chen
2014-04-16 17:42         ` Mark Brown
2014-04-17 13:46       ` Timur Tabi
2014-04-14 13:35 ` [PATCH v3 10/18] ASoC: fsl-ssi: make fsl,mode property optional Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 11/18] ASoC: fsl-ssi: Transmit enable synchronization Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 12/18] ASoC: fsl-ssi: Move fsl_ssi_set_dai_sysclk above fsl_ssi_hw_params Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 13/18] ASoC: fsl-ssi: set bitclock in master mode from hw_params Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 14/18] ASoC: fsl-ssi: remove unnecessary spinlock Markus Pargmann
2014-04-14 13:35 ` Markus Pargmann [this message]
2014-04-14 13:35 ` [PATCH v3 16/18] ASoC: fsl-ssi: Set framerate divider correctly for i2s master mode Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 17/18] ASoC: fsl-ssi: reorder and document fsl_ssi_private Markus Pargmann
2014-04-14 13:35 ` [PATCH v3 18/18] ASoC: fsl-ssi: Use regmap Markus Pargmann
2014-04-24 11:44 ` [PATCH v3 00/18] ASoC: fsl-ssi: Driver cleanup Mark Brown
2014-04-28  8:54   ` Markus Pargmann
2014-04-29 16:22     ` Mark Brown
2014-04-30  2:01       ` Li.Xiubo

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=1397482548-28463-16-git-send-email-mpa@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=Guangyu.Chen@freescale.com \
    --cc=Li.Xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shc_work@mail.ru \
    --cc=timur@tabi.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

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git