Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3219113rdb; Tue, 26 Dec 2023 23:18:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXrgN6zSZR/cxyK4WpOc9s8N34/jXzt5AIySRQSFpBAn+i1yEh5PG1dUIsWasTRgRHji8c X-Received: by 2002:aa7:9831:0:b0:6d9:9a36:50dc with SMTP id q17-20020aa79831000000b006d99a3650dcmr2075448pfl.2.1703661515849; Tue, 26 Dec 2023 23:18:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703661515; cv=none; d=google.com; s=arc-20160816; b=aU7com7wRH13SiFn61u/0rJ6pkWN4j9jemFp8voOn/oCsIA4bn3EdM4FPxXhY6x3iu DdH605TpHq4nJwGpnKvL//uLsNOarv0q69AaAkVUGaIJ6QPD7cK9To3Bp8qBGpbmIhvP rwHs4uyPEVMrW/dKb26xA9tiFU7PnkPrdtHGnXFAgPI3kBIYp3BdmPvOOK+pjaFJbOvY Vcp0ykF2RTA5Jb+0/eE2uUKPgh23X7XGNsr0DPAW1K/+abyOYsfIIZvpK/RyhA7Zo7zq I/ABiGYfQCMe+PYsBUWDMu17hmRQUtQ29rSjXpJXzWGhPhKFbubuNdJ7jb3sdKV+Thhi AlCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=jYrvENNFU/8kBJdzd8KhBlT+5EdbihdbB6dSL72IJU0=; fh=YHDWZyeNx+1qLcLwiupLhFJjc+OL9V81fofGon++hts=; b=y8CswzVFToHbM50e0ZxCTTDkdTZ7AH1whwDTafGcog/GxluOJvVTpLGHytbhjtoLux l4l+UlEepDALm49ah2zrZzysUAiWeMnmdelrLOpqfsO0GZ7zqUzGu3ejXW/rHkCMRktr Zlhadp/yNCaUET4vHRRSyFjChxqVdcwIFN4hcBYj7hVnl4yqjfTE/UDqvpewX5Ownmsj UJiTyIiHtgQcwr22HF42+pKLk2BIZccsw6PFl4fsZYHIV79p4lmUlgRwspljS6ePt94X MLQhwV3g1oLwAggxr3H9k6wOCJHmMnJrjLlWGOP9DxeahePAq6+Go66JhDue2/WIIdxi NdcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=senarytech.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l11-20020a635b4b000000b005c65d99188esi5721552pgm.34.2023.12.26.23.18.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 23:18:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11881-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=senarytech.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 804F328358E for ; Wed, 27 Dec 2023 07:18:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7819853BF; Wed, 27 Dec 2023 07:18:27 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-m12746.qiye.163.com (mail-m12746.qiye.163.com [115.236.127.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7823E5392; Wed, 27 Dec 2023 07:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=senarytech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=senarytech.com Received: from book-ThinkStation-P328.. (unknown [61.183.143.78]) by mail-m12756.qiye.163.com (Hmail) with ESMTPA id 01270DC0610; Wed, 27 Dec 2023 15:10:23 +0800 (CST) From: bo liu To: perex@perex.cz, tiwai@suse.com Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, bo liu Subject: [PATCH 3/3] Fix headset auto detect fail in cx8070 and SN6140 Date: Wed, 27 Dec 2023 15:10:08 +0800 Message-Id: <20231227071008.13665-3-bo.liu@senarytech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231227071008.13665-1-bo.liu@senarytech.com> References: <20231227071008.13665-1-bo.liu@senarytech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlDTB1DVk1LHxlKGUMYGU9CTlUTARMWGhIXJBQOD1 lXWRgSC1lBWU1KVUpDSFVKT0hVTENZV1kWGg8SFR0UWUFZT0tIVUpNT0lMTlVKS0tVSkJLS1kG X-HM-Tid: 0a8caa1c33b6b223kuuu01270dc0610 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OTY6Ayo*Njw5KwkIODoqHE4S EykKCwNVSlVKTEtITU1KS0lPQkxCVTMWGhIXVRkUVRcSDjsIHhUaCQIPHhgTVRgUFkVZV1kSC1lB WU1KVUpDSFVKT0hVTENZV1kIAVlBSUNOSTcG CX8070 and SN6140 will get wrong headset type when use OMTP headset, then the headset mic will not work. Signed-off-by: bo liu --- 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