[PATCH v3] ALSA: hda/conexant: Always enable the headset-mic pin on plugin

songxiebing posted 1 patch 1 month ago
sound/hda/codecs/conexant.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
[PATCH v3] ALSA: hda/conexant: Always enable the headset-mic pin on plugin
Posted by songxiebing 1 month ago
From: Bob Song <songxiebing@kylinos.cn>

Rename the function to cx_process_headset_detect_plug_type() to reflect
that it only reports the detected plug type, and move the pin control
write into cx_update_headset_mic_vref() so that node 0x19 is always set
to enable the headset mic with the 80% VREF whenever the mic is
present, regardless of the type detection result.

Signed-off-by: Bob Song <songxiebing@kylinos.cn>
---
changes in v2:
  - Optimize code logic and description
changes in v3:
  - Based on the latest code modifications
---
 sound/hda/codecs/conexant.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
index 8e950c796209..7357dc91ac49 100644
--- a/sound/hda/codecs/conexant.c
+++ b/sound/hda/codecs/conexant.c
@@ -207,7 +207,7 @@ static void cx_remove(struct hda_codec *codec)
 	snd_hda_gen_remove(codec);
 }
 
-static void cx_process_headset_plugin(struct hda_codec *codec)
+static void cx_process_headset_detect_plug_type(struct hda_codec *codec)
 {
 	unsigned int val;
 	unsigned int count = 0;
@@ -241,10 +241,12 @@ static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_
 	 * Check hp&mic tag to process headset plugin & plugout.
 	 */
 	mic_present = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0);
-	if (!(mic_present & AC_PINSENSE_PRESENCE)) /* mic plugout */
+	if (!(mic_present & AC_PINSENSE_PRESENCE)) { /* mic plugout */
 		snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20);
-	else
-		cx_process_headset_plugin(codec);
+	} else {
+		cx_process_headset_detect_plug_type(codec);
+		snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24);
+	}
 }
 
 static int cx_suspend(struct hda_codec *codec)
-- 
2.25.1
Re: [PATCH v3] ALSA: hda/conexant: Always enable the headset-mic pin on plugin
Posted by Takashi Iwai 1 month ago
On Wed, 26 Aug 2026 13:53:44 +0200,
songxiebing wrote:
> 
> From: Bob Song <songxiebing@kylinos.cn>
> 
> Rename the function to cx_process_headset_detect_plug_type() to reflect
> that it only reports the detected plug type, and move the pin control
> write into cx_update_headset_mic_vref() so that node 0x19 is always set
> to enable the headset mic with the 80% VREF whenever the mic is
> present, regardless of the type detection result.
> 
> Signed-off-by: Bob Song <songxiebing@kylinos.cn>

Applied now.  Thanks.


Takashi