mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bo liu <bo.liu@senarytech.com>
To: perex@perex.cz, tiwai@suse.com
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	bo liu <bo.liu@senarytech.com>
Subject: [PATCH 3/3] Fix headset auto detect fail in cx8070 and SN6140
Date: Wed, 27 Dec 2023 15:10:08 +0800	[thread overview]
Message-ID: <20231227071008.13665-3-bo.liu@senarytech.com> (raw)
In-Reply-To: <20231227071008.13665-1-bo.liu@senarytech.com>

CX8070 and SN6140 will get wrong headset type when use OMTP headset,
then the headset mic will not work.

Signed-off-by: bo liu <bo.liu@senarytech.com>
---
 sound/pci/hda/patch_conexant.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 9ebc0709a202..86e7241b4961 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -184,7 +184,7 @@ static int cx_auto_init(struct hda_codec *codec)
 		snd_hda_codec_write(codec, 0x1c, 0, 0x4f0, 0x0eb);
 		/* fix reboot headset recognize fail issue */
 		mic_persent = snd_hda_codec_read(codec, 0x19, 0, 0xf09, 0x0);
-		if (mic_persent&0x80000000) 
+		if (mic_persent&0x80000000)
 			snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x24);
 		else
 			snd_hda_codec_write(codec, 0x19, 0, 0x707, 0x20);
@@ -212,7 +212,7 @@ static void cx_auto_free(struct hda_codec *codec)
 static int headset_present_flag;
 static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res)
 {
-	unsigned int val, phone_present, mic_persent,phone_tag, mic_tag;
+	unsigned int val, phone_present, mic_persent, phone_tag, mic_tag;
 	unsigned int count=0;
 
 	switch (codec->core.vendor_id) {
@@ -236,13 +236,11 @@ static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res)
 				if ((phone_present&0x80000000) && (mic_persent&0x80000000)) {
 					/* wait headset detect done */
 					do {
+						msleep(20);
 						val = snd_hda_codec_read(codec, 0x1c,
 									0, 0xca0, 0x0);
-						if (val&0x080)
-							break;
-						msleep(20);
 						count += 1;
-					} while (count > 3);
+					} while ((count > 3) || (val&0x080));
 					val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0);
 					if (val&0x800) {
 						codec_dbg(codec, "headset plugin, type is CTIA\n");
-- 
2.34.1


  parent reply	other threads:[~2023-12-27  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20231227071008.13665-1-bo.liu@senarytech.com>
2023-12-27  7:10 ` [PATCH 2/3] " bo liu
2023-12-27  7:10 ` bo liu [this message]
2023-12-29 15:15 ` [PATCH 1/3] " 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=20231227071008.13665-3-bo.liu@senarytech.com \
    --to=bo.liu@senarytech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --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

all inboxes | Powered by JetHome®