The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: songxiebing <songxiebing@kylinos.cn>
Cc: tiwai@suse.com, perex@perex.cz, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda/conexant: Set mic pin VREF to 0x24 on headset mic plug
Date: Tue, 25 Aug 2026 11:55:13 +0200	[thread overview]
Message-ID: <87v78ysewu.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260825094536.1718716-1-songxiebing@kylinos.cn>

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)

  reply	other threads:[~2026-08-25  9:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  2:38 [PATCH] ALSA: hda/conexant: Set mic pin VREF to 0x24 on headset mic plug songxiebing
2026-08-25  8:22 ` Takashi Iwai
2026-08-25  9:13 ` songxiebing
2026-08-25  9:28   ` Takashi Iwai
2026-08-25  9:45 ` songxiebing
2026-08-25  9:55   ` Takashi Iwai [this message]
2026-08-26  1:12 ` songxiebing
2026-08-26  1:45 ` [PATCH v2] ALSA: hda/conexant: Refactor headset plug detection songxiebing
2026-08-26  8:48   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v78ysewu.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=songxiebing@kylinos.cn \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox