-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0081-ASoC-codec-Handle-mute-of-different-directions.patch
88 lines (77 loc) · 3.03 KB
/
0081-ASoC-codec-Handle-mute-of-different-directions.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From f3b50fed98fc82aa703c9d3b29c29aa5a3b36ff6 Mon Sep 17 00:00:00 2001
From: Zhou Zheng <[email protected]>
Date: Mon, 17 Jun 2024 19:33:07 +0800
Subject: [PATCH 081/150] ASoC: codec: Handle mute of different directions
Without this patch,ADC mute will be called
instead of DAC mute when recording ends.
So,this patch correctly handles mute of ADC and DAC.
Playbacking ends --- DAC mute.
Recording ends --- ADC mute.
Signed-off-by: Zhou Zheng <[email protected]>
Signed-off-by: Wang Yinfeng <[email protected]>
Signed-off-by: Chen Baozi <[email protected]>
Change-Id: Id8cf3dad1f61ab04860af4d68df3ec732f50ba1c
Signed-off-by: Andrew Powers-Holmes <[email protected]>
---
sound/soc/codecs/es8336.c | 22 ++++++++++++----------
sound/soc/codecs/es8388.c | 11 ++++++++---
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/sound/soc/codecs/es8336.c b/sound/soc/codecs/es8336.c
index f38b64620c31..ef147857bd29 100644
--- a/sound/soc/codecs/es8336.c
+++ b/sound/soc/codecs/es8336.c
@@ -34,6 +34,7 @@
#define INVALID_GPIO -1
#define GPIO_LOW 0
#define GPIO_HIGH 1
+#define ES8336_MUTE (1 << 5)
static struct snd_soc_component *es8336_component;
@@ -675,17 +676,18 @@ static int es8336_mute(struct snd_soc_dai *dai, int mute, int direction)
struct es8336_priv *es8336 = snd_soc_component_get_drvdata(component);
es8336->muted = mute;
- if (mute) {
+ if (!es8336->hp_inserted)
+ es8336_enable_spk(es8336, true);
+ else
es8336_enable_spk(es8336, false);
- msleep(100);
- snd_soc_component_write(component, ES8336_DAC_SET1_REG30, 0x20);
- } else if (snd_soc_dai_stream_active(dai, SNDRV_PCM_STREAM_PLAYBACK)) {
- snd_soc_component_write(component, ES8336_DAC_SET1_REG30, 0x00);
- msleep(130);
- if (!es8336->hp_inserted)
- es8336_enable_spk(es8336, true);
- }
- return 0;
+ if (direction)
+ return snd_soc_component_update_bits(dai->component, ES8336_ADC_MUTE_REG26,
+ ES8336_MUTE,
+ mute ? ES8336_MUTE : 0);
+ else
+ return snd_soc_component_update_bits(dai->component, ES8336_DAC_SET1_REG30,
+ ES8336_MUTE,
+ mute ? ES8336_MUTE : 0);
}
static int es8336_set_bias_level(struct snd_soc_component *component,
diff --git a/sound/soc/codecs/es8388.c b/sound/soc/codecs/es8388.c
index 473385d143d9..7bb0fe5ae756 100644
--- a/sound/soc/codecs/es8388.c
+++ b/sound/soc/codecs/es8388.c
@@ -421,9 +421,14 @@ static const struct snd_soc_dapm_route es8388_dapm_routes[] = {
static int es8388_mute(struct snd_soc_dai *dai, int mute, int direction)
{
- return snd_soc_component_update_bits(dai->component, ES8388_DACCONTROL3,
- ES8388_DACCONTROL3_DACMUTE,
- mute ? ES8388_DACCONTROL3_DACMUTE : 0);
+ if (direction)
+ return snd_soc_component_update_bits(dai->component, ES8388_ADCCONTROL7,
+ ES8388_ADCCONTROL7_ADC_MUTE,
+ mute ? ES8388_ADCCONTROL7_ADC_MUTE : 0);
+ else
+ return snd_soc_component_update_bits(dai->component, ES8388_DACCONTROL3,
+ ES8388_DACCONTROL3_DACMUTE,
+ mute ? ES8388_DACCONTROL3_DACMUTE : 0);
}
static int es8388_startup(struct snd_pcm_substream *substream,
--
2.47.0