Re: [PATCH] ALSA: hda/conexant: Set mic pin VREF to 0x24 on headset mic plug

From: Takashi Iwai

Date: Tue Aug 25 2026 - 06:02:38 EST


On Tue, 25 Aug 2026 11:45:36 +0200,
songxiebing wrote:
>
> Hi Takashi,
>
> Yes, reading these registers is just to print out debugging information
> for problem analysis.

Then it's better to move the pin setup to the caller; it makes the
setup more consistent. While we're at it, rename the function to be
more intuitive one. So the change would be something like below.


Takashi

>
> >On Tue, 25 Aug 2026 11:13:03 +0200,
> >songxiebing wrote:
> >>
> >> Hi Takashi,
> >>
> >> 0x19 is configured as a mic pin, in cx_update_headset_mic_vref, it
> >> executes cx_process_headset_plugin only after confirming that a mic
> >> present is detected. A 4-pole headset is detected as either CTIA or
> >> OMTP and sets 0x24, but the 3-pole mic case is not handled, so a
> >> setting of 0x24 is added here.
> >
> >OK, then you'd need to explain more in the patch description.
> >It implies that the patch corrects the debug output, too.
> >
> >And, this also opens another door: why do we read those registers at
> >all? Now you always set the pin control 0x24 no matter what the
> >connection type is. So the whole headset type detection becomes
> >practically moot; it's used only for showing a debug print.
> >
> >
> >thanks,
> >
> >Takashi

-- 8< --
--- 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;
@@ -226,9 +226,8 @@ static void cx_process_headset_plugin(struct hda_codec *codec)
if (val & 0xc00) {
codec_dbg(codec, "headset plugin, type is %s\n",
val & 0x800 ? "CTIA" : "OMTP");
- snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24);
} else {
- codec_dbg(codec, "headphone plugin\n");
+ codec_dbg(codec, "headphone or mic plugin\n");
}
}

@@ -241,10 +240,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 {
+ snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24);
+ cx_process_headset_detect_plug_type(codec);
+ }
}

static int cx_suspend(struct hda_codec *codec)