From patchwork Tue Apr 2 06:20:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 785155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF1C1C6FD1F for ; Tue, 2 Apr 2024 07:14:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 15EA62CF9; Tue, 2 Apr 2024 09:14:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 15EA62CF9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1712042076; bh=1HyWKMRkMFJa3CX6hxUj7ivuCbAv3c5mLvQz0QWHrDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=aCL0RvpfvRUpwduznlvQhBHyW0fXECrfnDumaewyUjEqe/rYgu6IkIfB5htTkSElO 8vhLO4BENnHn+HkfWd6VvMPR/5g1lqxp1e6QFiR+DPqF8bjTAP0pWmXENHQWPlBMPd W5R5z6M1+I8+c2B00Wnk99NaFEJb4cg+7CbNBZEA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D0089F806AB; Tue, 2 Apr 2024 08:58:15 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 50857F89CBB; Tue, 2 Apr 2024 08:58:15 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A260CF8020D; Tue, 2 Apr 2024 08:21:09 +0200 (CEST) Received: from mail78-60.sinamail.sina.com.cn (mail78-60.sinamail.sina.com.cn [219.142.78.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 563CEF8015B for ; Tue, 2 Apr 2024 08:20:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 563CEF8015B Received: from unknown (HELO zy-virtual-machine.localdomain)([116.232.53.71]) by sina.net (10.75.30.234) with ESMTP id 660BA3B800029E89; Tue, 2 Apr 2024 14:20:43 +0800 (CST) X-Sender: zhangyi@everest-semi.com X-Auth-ID: zhangyi@everest-semi.com Authentication-Results: sina.net; spf=none smtp.mailfrom=zhangyi@everest-semi.com; dkim=none header.i=none; dmarc=none action=none header.from=zhangyi@everest-semi.com X-SMAIL-MID: D1EDB42FE57B43668269A0D91F30EB72 X-SMAIL-UIID: D1EDB42FE57B43668269A0D91F30EB72-20240402-142043 From: Zhang Yi To: alsa-devel@alsa-project.org, broonie@kernel.org Cc: tiwai@suse.com, amadeuszx.slawinski@linux.intel.com, yangxiaohua@everest-semi.com, zhuning@everest-semi.com, zhangyi@everest-semi.com Subject: [PATCH 1/4] ASoC: codecs: ES8326: Solve error interruption issue Date: Tue, 2 Apr 2024 14:20:40 +0800 Message-Id: <20240402062043.20608-2-zhangyi@everest-semi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240402062043.20608-1-zhangyi@everest-semi.com> References: <20240402062043.20608-1-zhangyi@everest-semi.com> X-MailFrom: zhangyi@everest-semi.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 3KQN6YM5UCTGCRCTB3OBUN2QTDOMD4YO X-Message-ID-Hash: 3KQN6YM5UCTGCRCTB3OBUN2QTDOMD4YO X-Mailman-Approved-At: Tue, 02 Apr 2024 06:55:00 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: We got an error report about headphone type detection and button detection. We fixed the headphone type detection error by adjusting the debounce timer configuration. And we fixed the button detection error by disabling the button detection feature when the headphone are unplugged and enabling it when headphone are plugged in. Signed-off-by: Zhang Yi --- sound/soc/codecs/es8326.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index e8526844337d..d87592747b4e 100755 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -835,6 +835,7 @@ static void es8326_jack_detect_handler(struct work_struct *work) regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01); regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x0a); regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x03); + regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9); /* * Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event */ @@ -857,6 +858,8 @@ static void es8326_jack_detect_handler(struct work_struct *work) * set auto-check mode, then restart jack_detect_work after 400ms. * Don't report jack status. */ + regmap_write(es8326->regmap, ES8326_INT_SOURCE, + (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON)); regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01); es8326_enable_micbias(es8326->component); usleep_range(50000, 70000); @@ -979,7 +982,7 @@ static int es8326_resume(struct snd_soc_component *component) regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E); regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0); usleep_range(10000, 15000); - regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xe9); + regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xd9); regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb); /* set headphone default type and detect pin */ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83); @@ -1030,8 +1033,7 @@ static int es8326_resume(struct snd_soc_component *component) es8326_enable_micbias(es8326->component); usleep_range(50000, 70000); regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00); - regmap_write(es8326->regmap, ES8326_INT_SOURCE, - (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON)); + regmap_write(es8326->regmap, ES8326_INT_SOURCE, ES8326_INT_SRC_PIN9); regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk); regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,