All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Only do snd_soc_dai_digital_mute() in hw_free()
@ 2013-12-04  3:18 Nicolin Chen
  2013-12-04  3:18 ` [PATCH v2 1/2] ASoC: soc-pcm: Use valid condition for " Nicolin Chen
  2013-12-04  3:18 ` [PATCH v2 2/2] ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close() Nicolin Chen
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolin Chen @ 2013-12-04  3:18 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: tiwai, alsa-devel

This series of patches mainly fixes an issue of snd_soc_dai_digital_mute()
operation after playback/capture is done. The current system has two of
them in a normal PCM instance while one of them has an invalid condition.
Thus we first fix the condition and then drop the redundant one.

Changelog:
v2:
 * Bisected into two patches.
 * Fixed indentation in PATCH-1.

Nicolin Chen (2):
  ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in
    hw_free()
  ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in
    soc_pcm_close()

 sound/soc/soc-pcm.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

-- 
1.8.4

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

* [PATCH v2 1/2] ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in hw_free()
  2013-12-04  3:18 [PATCH v2 0/2] Only do snd_soc_dai_digital_mute() in hw_free() Nicolin Chen
@ 2013-12-04  3:18 ` Nicolin Chen
  2013-12-04 11:47   ` Mark Brown
  2013-12-04  3:18 ` [PATCH v2 2/2] ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close() Nicolin Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2013-12-04  3:18 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: tiwai, alsa-devel

The snd_soc_dai_digital_mute() here will be never executed because we only
decrease codec->active in snd_soc_close(). Thus correct it.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
 sound/soc/soc-pcm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index eb340a8..3774471 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -689,7 +689,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
 	struct snd_soc_platform *platform = rtd->platform;
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
-	struct snd_soc_codec *codec = rtd->codec;
+	bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
 
 	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
 
@@ -707,7 +707,8 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
 	}
 
 	/* apply codec digital mute */
-	if (!codec->active)
+	if ((playback && codec_dai->playback_active == 1) ||
+	    (!playback && codec_dai->capture_active == 1))
 		snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
 
 	/* free any machine hw params */
-- 
1.8.4

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

* [PATCH v2 2/2] ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close()
  2013-12-04  3:18 [PATCH v2 0/2] Only do snd_soc_dai_digital_mute() in hw_free() Nicolin Chen
  2013-12-04  3:18 ` [PATCH v2 1/2] ASoC: soc-pcm: Use valid condition for " Nicolin Chen
@ 2013-12-04  3:18 ` Nicolin Chen
  2013-12-04 11:46   ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2013-12-04  3:18 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: tiwai, alsa-devel

This patch removed the redundant snd_soc_dai_digital_mute() in close() since
it's better to mute in hw_free() which's slightly earlier and symmetrical for
the case of reconfiguration: 'aplay 44k1.wav 48k.wav', for example, will be
open()->hw_params()->prepare(unmute)->playi1ng->hw_free(mute)->hw_params()->
parepare(unmute)->playing->hw_free(mute)->close()

Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
 sound/soc/soc-pcm.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 3774471..1c3cd5e 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -474,11 +474,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 	codec_dai->active--;
 	codec->active--;
 
-	/* Muting the DAC suppresses artifacts caused during digital
-	 * shutdown, for example from stopping clocks.
-	 */
-	snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
-
 	if (cpu_dai->driver->ops->shutdown)
 		cpu_dai->driver->ops->shutdown(substream, cpu_dai);
 
-- 
1.8.4

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

* Re: [PATCH v2 2/2] ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close()
  2013-12-04  3:18 ` [PATCH v2 2/2] ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close() Nicolin Chen
@ 2013-12-04 11:46   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-12-04 11:46 UTC (permalink / raw)
  To: Nicolin Chen; +Cc: tiwai, alsa-devel, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 448 bytes --]

On Wed, Dec 04, 2013 at 11:18:37AM +0800, Nicolin Chen wrote:
> This patch removed the redundant snd_soc_dai_digital_mute() in close() since
> it's better to mute in hw_free() which's slightly earlier and symmetrical for
> the case of reconfiguration: 'aplay 44k1.wav 48k.wav', for example, will be
> open()->hw_params()->prepare(unmute)->playi1ng->hw_free(mute)->hw_params()->
> parepare(unmute)->playing->hw_free(mute)->close()

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH v2 1/2] ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in hw_free()
  2013-12-04  3:18 ` [PATCH v2 1/2] ASoC: soc-pcm: Use valid condition for " Nicolin Chen
@ 2013-12-04 11:47   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-12-04 11:47 UTC (permalink / raw)
  To: Nicolin Chen; +Cc: tiwai, alsa-devel, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 219 bytes --]

On Wed, Dec 04, 2013 at 11:18:36AM +0800, Nicolin Chen wrote:
> The snd_soc_dai_digital_mute() here will be never executed because we only
> decrease codec->active in snd_soc_close(). Thus correct it.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2013-12-04 11:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-04  3:18 [PATCH v2 0/2] Only do snd_soc_dai_digital_mute() in hw_free() Nicolin Chen
2013-12-04  3:18 ` [PATCH v2 1/2] ASoC: soc-pcm: Use valid condition for " Nicolin Chen
2013-12-04 11:47   ` Mark Brown
2013-12-04  3:18 ` [PATCH v2 2/2] ASoC: soc-pcm: Drop the redundant snd_soc_dai_digital_mute() in soc_pcm_close() Nicolin Chen
2013-12-04 11:46   ` 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.