All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
@ 2022-03-10 11:16 ` Sameer Pujar
  0 siblings, 0 replies; 6+ messages in thread
From: Sameer Pujar @ 2022-03-10 11:16 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: kuninori.morimoto.gx, robert.hancock, stephan, alsa-devel,
	linux-kernel, Sameer Pujar

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
@ 2022-03-10 11:16 ` Sameer Pujar
  0 siblings, 0 replies; 6+ messages in thread
From: Sameer Pujar @ 2022-03-10 11:16 UTC (permalink / raw)
  To: broonie, lgirdwood, perex, tiwai
  Cc: alsa-devel, kuninori.morimoto.gx, stephan, Sameer Pujar,
	linux-kernel, robert.hancock

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
  2022-03-10 11:16 ` Sameer Pujar
@ 2022-03-10 23:32   ` Kuninori Morimoto
  -1 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2022-03-10 23:32 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: broonie, lgirdwood, perex, tiwai, robert.hancock, stephan,
	alsa-devel, linux-kernel


Hi

> 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>
> ---

Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
@ 2022-03-10 23:32   ` Kuninori Morimoto
  0 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2022-03-10 23:32 UTC (permalink / raw)
  To: Sameer Pujar
  Cc: alsa-devel, stephan, linux-kernel, tiwai, lgirdwood,
	robert.hancock, broonie


Hi

> 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>
> ---

Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
  2022-03-10 11:16 ` Sameer Pujar
@ 2022-03-11 20:22   ` Mark Brown
  -1 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2022-03-11 20:22 UTC (permalink / raw)
  To: lgirdwood, tiwai, perex, Sameer Pujar
  Cc: stephan, robert.hancock, alsa-devel, linux-kernel, kuninori.morimoto.gx

On Thu, 10 Mar 2022 16:46:39 +0530, Sameer Pujar wrote:
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: simple-card-utils: Don't reset clock of active DAI
      commit: 5bbe2918acccfa60de1c1a2139de9cc5441d5796

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI
@ 2022-03-11 20:22   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2022-03-11 20:22 UTC (permalink / raw)
  To: lgirdwood, tiwai, perex, Sameer Pujar
  Cc: robert.hancock, alsa-devel, linux-kernel, stephan, kuninori.morimoto.gx

On Thu, 10 Mar 2022 16:46:39 +0530, Sameer Pujar wrote:
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: simple-card-utils: Don't reset clock of active DAI
      commit: 5bbe2918acccfa60de1c1a2139de9cc5441d5796

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-11 20:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10 11:16 [PATCH] ASoC: simple-card-utils: Don't reset clock of active DAI Sameer Pujar
2022-03-10 11:16 ` Sameer Pujar
2022-03-10 23:32 ` Kuninori Morimoto
2022-03-10 23:32   ` Kuninori Morimoto
2022-03-11 20:22 ` Mark Brown
2022-03-11 20:22   ` Mark Brown

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.