ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in hw_free()
PATCH 1/1 ASoC: soc-pcm: Use valid condition for snd_soc_dai_digital_mute() in hw_free()
The snd_soc_dai_digital_mute() here will be never executed because we only decrease codec->active in snd_soc_close(). Thus correct it.
--- sound/soc/soc-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-pcm.c +1 -1
@@ -689,7 +689,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) }/* apply codec digital mute */ -if (!codec->active) +if (codec->active ==1 )snd_soc_dai_digital_mute (codec_dai,1 , substream->stream);/* free any machine hw params */
Signature · 1 line
1.8.4
At Mon, 2 Dec 2013 17:34:34 +0800,
Quoted 3 lines · Nicolin Chen
The
snd_soc_dai_digital_mute()here will be never executed because we only decreasecodec->activeinsnd_soc_close(). Thus correct it.
A couple of minor problems by this approach:
- snd_soc_dai_digital_mute() will be called twice in the normal PCM close path.
- In full duplex mode where both playback/capture streams share the same codec, one of the directions won't be handled correctly because codec->active is incremented/decremented twice (once for each direction).
Takashi
Quoted 23 lines
Signed-off-by Nicolin Chen <[email protected]>--- sound/soc/soc-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/soc-pcm.c +1
-1@@ -689,7 +689,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) }/* apply codec digital mute */ -if (!codec->active) +if (codec->active ==1 )snd_soc_dai_digital_mute (codec_dai,1 , substream->stream);/* free any machine hw params */ Signature · 1 line
1.8.4
Quoted 8 lines · Takashi Iwai
At Mon, 2 Dec 2013 17:34:34 +0800,
Quoted 3 lines · Nicolin Chen
The
snd_soc_dai_digital_mute()here will be never executed because we only decreasecodec->activeinsnd_soc_close(). Thus correct it.A couple of minor problems by this approach:
Quoted 8 lines
-
snd_soc_dai_digital_mute()will be called twice in the normal PCM close path.- In full duplex mode where both playback/capture streams share the same codec, one of the directions won't be handled correctly because
codec->activeis incremented/decremented twice (once for each direction).
Thank you for the comments. I didn't look at the whole board. Please Drop this patch.
Thank you.
Nicolin Chen
Quoted 27 lines
Takashi
Quoted 23 lines
Signed-off-by Nicolin Chen <[email protected]>--- sound/soc/soc-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/soc-pcm.c +1
-1@@ -689,7 +689,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) }/* apply codec digital mute */ -if (!codec->active) +if (codec->active ==1 )snd_soc_dai_digital_mute (codec_dai,1 , substream->stream);/* free any machine hw params */ Signature · 1 line
1.8.4
Mark Brown
maintainerQuoted 9 lines · Takashi Iwai
Quoted 2 lines · Nicolin Chen
The
snd_soc_dai_digital_mute()here will be never executed because we only decreasecodec->activeinsnd_soc_close(). Thus correct it.A couple of minor problems by this approach:
-
snd_soc_dai_digital_mute()will be called twice in the normal PCM close path.
Right, it's called in close() so it's redundant to call it here most of the time. On the other hand it will at least get called slightly sooner which is good and in the case of reconfiguration we'll mute while doing that - doing the mute earlier is better.
Quoted 4 lines
- In full duplex mode where both playback/capture streams share the same codec, one of the directions won't be handled correctly because
codec->activeis incremented/decremented twice (once for each direction).
Indeed, the check needs to be on playback_active or capture_active rather than on the overall DAI.
Quoted 16 lines · Mark Brown
Quoted 9 lines · Takashi Iwai
Quoted 2 lines · Nicolin Chen
The
snd_soc_dai_digital_mute()here will be never executed because we only decreasecodec->activeinsnd_soc_close(). Thus correct it.A couple of minor problems by this approach:
-
snd_soc_dai_digital_mute()will be called twice in the normal PCM close path.Right, it's called in
close()so it's redundant to call it here most of the time. On the other hand it will at least get called slightly sooner which is good and in the case of reconfiguration we'll mute while doing that - doing the mute earlier is better.
Quoted 7 lines
Quoted 4 lines
- In full duplex mode where both playback/capture streams share the same codec, one of the directions won't be handled correctly because
codec->activeis incremented/decremented twice (once for each direction).Indeed, the check needs to be on
playback_activeorcapture_activerather than on the overall DAI.
Sir, thank you for the hint. I will reconsider about the modification.
And also thank Iwai-san for pointing out the flaws in my patch.
Best regards,
Nicolin Chen