1 From d52d2bd85ad4d1cfc37a87a6b7bfcc37207c6025 Mon Sep 17 00:00:00 2001
2 From: Ali Tekin <140681099+alitekin-saha@users.noreply.github.com>
3 Date: Thu, 26 Sep 2024 10:51:13 +0300
4 Subject: [PATCH 1284/1350] googlevoicehat: Fix playback muting when recording
7 Fixed audio amplifier control logic in the voicehat trigger function
8 Resolves improper handling of the SDMODE pin, which caused issues when the microphone and speaker were used simultaneously. The playback stream check is now correctly based on `substream->stream == SNDRV_PCM_STREAM_PLAYBACK`, ensuring proper control of the audio amplifier.
10 Signed-off-by: Ali Tekin <ali.tekin@saharobotik.com>
12 sound/soc/bcm/googlevoicehat-codec.c | 7 +++----
13 1 file changed, 3 insertions(+), 4 deletions(-)
15 --- a/sound/soc/bcm/googlevoicehat-codec.c
16 +++ b/sound/soc/bcm/googlevoicehat-codec.c
17 @@ -95,8 +95,7 @@ static int voicehat_daiops_trigger(struc
18 struct snd_soc_dai *dai)
20 struct snd_soc_component *component = dai->component;
21 - struct voicehat_priv *voicehat =
22 - snd_soc_component_get_drvdata(component);
23 + struct voicehat_priv *voicehat = snd_soc_component_get_drvdata(component);
25 if (voicehat->sdmode_delay_jiffies == 0)
27 @@ -109,7 +108,7 @@ static int voicehat_daiops_trigger(struc
28 case SNDRV_PCM_TRIGGER_START:
29 case SNDRV_PCM_TRIGGER_RESUME:
30 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
31 - if (dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active) {
32 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
33 dev_info(dai->dev, "Enabling audio amp...\n");
35 system_power_efficient_wq,
36 @@ -120,7 +119,7 @@ static int voicehat_daiops_trigger(struc
37 case SNDRV_PCM_TRIGGER_STOP:
38 case SNDRV_PCM_TRIGGER_SUSPEND:
39 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
40 - if (dai->stream[SNDRV_PCM_STREAM_PLAYBACK].active) {
41 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
42 cancel_delayed_work(&voicehat->enable_sdmode_work);
43 dev_info(dai->dev, "Disabling audio amp...\n");
44 gpiod_set_value(voicehat->sdmode_gpio, 0);