mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sameer Pujar <spujar@nvidia.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>, <perex@perex.cz>,
	<tiwai@suse.com>
Cc: <kuninori.morimoto.gx@renesas.com>, <robert.hancock@calian.com>,
	<stephan@gerhold.net>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>, Sameer Pujar <spujar@nvidia.com>
Subject: [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
Date: Thu, 10 Mar 2022 16:46:39 +0530	[thread overview]
Message-ID: <1646910999-2501-1-git-send-email-spujar@nvidia.com> (raw)

Playback or capture errors are seen when clock is reset during an active
stage of DAI. Presently this scenario happens when DAI has both playback
and capture sessions running and one of these finishes first which will
be followed by clock rate reset. The remaining active session will be
affected in such case.

Address this problem by allowing clock rate reset to happen only when
the DAI is no more active.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 sound/soc/generic/simple-card-utils.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index a4babfb..6a5faaf 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -272,15 +272,19 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream)
 	int i;
 
 	for_each_prop_dai_cpu(props, i, dai) {
-		if (props->mclk_fs && !dai->clk_fixed)
-			snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, i),
+		struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, i);
+
+		if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(cpu_dai))
+			snd_soc_dai_set_sysclk(cpu_dai,
 					       0, 0, SND_SOC_CLOCK_IN);
 
 		asoc_simple_clk_disable(dai);
 	}
 	for_each_prop_dai_codec(props, i, dai) {
-		if (props->mclk_fs && !dai->clk_fixed)
-			snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, i),
+		struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, i);
+
+		if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(codec_dai))
+			snd_soc_dai_set_sysclk(codec_dai,
 					       0, 0, SND_SOC_CLOCK_IN);
 
 		asoc_simple_clk_disable(dai);
-- 
2.7.4


             reply	other threads:[~2022-03-10 11:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 11:16 Sameer Pujar [this message]
2022-03-10 23:32 ` Kuninori Morimoto
2022-03-11 20:22 ` 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=1646910999-2501-1-git-send-email-spujar@nvidia.com \
    --to=spujar@nvidia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robert.hancock@calian.com \
    --cc=stephan@gerhold.net \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®