From patchwork Fri Jan 19 11:28:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Ning X-Patchwork-Id: 764474 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 B036DC4725D for ; Fri, 19 Jan 2024 11:30:44 +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 DC4E3825; Fri, 19 Jan 2024 12:30:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DC4E3825 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705663842; bh=uGnXBoy7ILdY1GFVkqqWGFPDKF87GLY6aiytakmDVKw=; 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=MK2ztD5o5fXb2JkttZB91X04BmLGbbHKxO4EK0XQZcKArYA3GdgGhvEKnL7jwjVRu xJuD4Clu0rwKUWvQngedNlPM2wauyzrWHkQfxMQqUeRY1xCuSOyePHXIlwMuPNMhpO 7UF1U8/Xvx1JmfH8e3B59SAUvtdANHTW2lCJ5QL0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AA25F805EE; Fri, 19 Jan 2024 12:29:42 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id BF883F805F4; Fri, 19 Jan 2024 12:29:41 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9CEA0F80520; Fri, 19 Jan 2024 12:29:37 +0100 (CET) Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 71ABFF80520 for ; Fri, 19 Jan 2024 12:29:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 71ABFF80520 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=jeWXlvMY Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so522226a12.1 for ; Fri, 19 Jan 2024 03:29:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705663753; x=1706268553; darn=alsa-project.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Lu4mBGRHek8xxeOugvmNKBRhHVvcnP8bUZIpFogLPGk=; b=jeWXlvMY6xUHaXn2iIbnFnYVFG+HGdZ67J8vrmocJij/Ixl/e4bAKIXm1BGRTLAz2D t+LXxoMHB6xj8AQuMYsp85/MfSxe8lGQ5q6qoOlmArE1ZOcoVme5Nh8JQd9Bar4o5+ok daio39rE75YCSL3ce/ULqrmppcAYWs5nu2DGFzRT8FZCeBCuthuuiltwJtPLRtgcM3fI Di1t1Up3foFAIaCSBJurJ6E3pVXeGp8UxMeLRfkDMiq81TxEjxtu3k2ILVp3DXirnIOR EbrzLSV5TrSTtaoLadorVGAd/d7UwC4XF4NSxphTKyEne6kRjDv4Sc9IhlAcSb0z23GO ZK5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705663753; x=1706268553; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Lu4mBGRHek8xxeOugvmNKBRhHVvcnP8bUZIpFogLPGk=; b=k9m5hENbZJ0Z7Tm0Kc00x8aQbXGS30BsNpg2FAAtrLrRcnIe4BP2aYtudUqhpsrPSS eP4b6Y9BfUziG86wpj6dCxsrzUUqHzOQvqc9UOuXL+gcrVOYwUr883KLkEVH7/FqqbSh KdvkcrJsqW1Lrb9FNaIBiFZiz2JXHtLF1fi//8lxYZJYMD0bZUJtusACrmqLV3nGEdLU 5WAMftfKICFsWoD/0aqwSbHS9Wyl9fSE5hYQuoBa99kj5nUbuf52RxDp8vsk+/P4wCMT /DTSw9+MkQuG5Ynul1NOp1E+6kY4yrYuhdPjYblWtWQoQPS6KjF15xQHBV/PbL2JUM5W 6f8g== X-Gm-Message-State: AOJu0YxxXPvnSykYQ5PTygEuWFMYqu+AC9zSKcZPyNJ/9AEOBHddXwzK UhyTI3eLwUGUFMJbPH2G7CCR7WRWBkKxjBeH20JW1F4LdnhWW7ICr0HsmHlKj+2R4OkD X-Google-Smtp-Source: AGHT+IFjVxE9BVr4RTThMwXjc6X6XEl92U421XxDuDEiAOoZsnVdt96zPNk8h5lEqxkj/sdqdgH9EA== X-Received: by 2002:a05:6a20:439e:b0:19b:6a1:a6a7 with SMTP id i30-20020a056a20439e00b0019b06a1a6a7mr2384453pzl.117.1705663752870; Fri, 19 Jan 2024 03:29:12 -0800 (PST) Received: from zy-virtual-machine.localdomain ([222.70.13.170]) by smtp.gmail.com with ESMTPSA id n9-20020a62e509000000b006d9b8e1971dsm4884541pff.191.2024.01.19.03.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:29:12 -0800 (PST) From: Zhu Ning 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, Zhu Ning Subject: [PATCH 1/5] ASoC: codecs: ES8326: improving crosstalk performance Date: Fri, 19 Jan 2024 19:28:54 +0800 Message-Id: <20240119112858.2982-2-zhuning0077@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240119112858.2982-1-zhuning0077@gmail.com> References: <20240119112858.2982-1-zhuning0077@gmail.com> Message-ID-Hash: RFSKCMLCAWJTW35PCELSGD7ZQLGE35I7 X-Message-ID-Hash: RFSKCMLCAWJTW35PCELSGD7ZQLGE35I7 X-MailFrom: zhuning0077@gmail.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 change the crosstalk parameter in es8326_resume function to improve crosstalk performance. Adding crosstalk kcontrol to enhance the flexibility of crosstalk debugging in machine. Adding ES8326_DAC_CROSSTALK macro to declare the crosstalk register. Signed-off-by: Zhu Ning --- sound/soc/codecs/es8326.c | 82 +++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/es8326.h | 1 + 2 files changed, 83 insertions(+) diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index fa890f6205e2..82d1c4f8324c 100755 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -45,6 +45,82 @@ struct es8326_priv { int jack_remove_retry; }; +static int es8326_crosstalk1_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component); + unsigned int crosstalk_h, crosstalk_l; + unsigned int crosstalk; + + regmap_read(es8326->regmap, ES8326_DAC_RAMPRATE, &crosstalk_h); + regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l); + crosstalk_h &= 0x20; + crosstalk_l &= 0xf0; + crosstalk = crosstalk_h >> 1 | crosstalk_l >> 4; + ucontrol->value.integer.value[0] = crosstalk; + + return 0; +} + +static int es8326_crosstalk1_set(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component); + unsigned int crosstalk_h, crosstalk_l; + unsigned int crosstalk; + + crosstalk = ucontrol->value.integer.value[0]; + regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l); + crosstalk_h = (crosstalk & 0x10) << 1; + crosstalk_l &= 0x0f; + crosstalk_l |= (crosstalk & 0x0f) << 4; + regmap_update_bits(es8326->regmap, ES8326_DAC_RAMPRATE, + 0x20, crosstalk_h); + regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, crosstalk_l); + + return 0; +} + +static int es8326_crosstalk2_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component); + unsigned int crosstalk_h, crosstalk_l; + unsigned int crosstalk; + + regmap_read(es8326->regmap, ES8326_DAC_RAMPRATE, &crosstalk_h); + regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l); + crosstalk_h &= 0x10; + crosstalk_l &= 0x0f; + crosstalk = crosstalk_h | crosstalk_l; + ucontrol->value.integer.value[0] = crosstalk; + + return 0; +} + +static int es8326_crosstalk2_set(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component); + unsigned int crosstalk_h, crosstalk_l; + unsigned int crosstalk; + + crosstalk = ucontrol->value.integer.value[0]; + regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l); + crosstalk_h = crosstalk & 0x10; + crosstalk_l &= 0xf0; + crosstalk_l |= crosstalk & 0x0f; + regmap_update_bits(es8326->regmap, ES8326_DAC_RAMPRATE, + 0x10, crosstalk_h); + regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, crosstalk_l); + + return 0; +} + static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0); static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9550, 50, 0); static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_analog_pga_tlv, 0, 300, 0); @@ -102,6 +178,10 @@ static const struct snd_kcontrol_new es8326_snd_controls[] = { SOC_SINGLE_TLV("ALC Capture Target Level", ES8326_ALC_LEVEL, 0, 0x0f, 0, drc_target_tlv), + SOC_SINGLE_EXT("CROSSTALK1", SND_SOC_NOPM, 0, 31, 0, + es8326_crosstalk1_get, es8326_crosstalk1_set), + SOC_SINGLE_EXT("CROSSTALK2", SND_SOC_NOPM, 0, 31, 0, + es8326_crosstalk2_get, es8326_crosstalk2_set), }; static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = { @@ -844,6 +924,8 @@ static int es8326_resume(struct snd_soc_component *component) regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x00); /* calibrate for B version */ es8326_calibrate(component); + regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, 0xaa); + regmap_write(es8326->regmap, ES8326_DAC_RAMPRATE, 0x00); /* turn off headphone out */ regmap_write(es8326->regmap, ES8326_HP_CAL, 0x00); /* set ADC and DAC in low power mode */ diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h index 90a08351d6ac..dfef808673f4 100644 --- a/sound/soc/codecs/es8326.h +++ b/sound/soc/codecs/es8326.h @@ -72,6 +72,7 @@ #define ES8326_DAC_VOL 0x50 #define ES8326_DRC_RECOVERY 0x53 #define ES8326_DRC_WINSIZE 0x54 +#define ES8326_DAC_CROSSTALK 0x55 #define ES8326_HPJACK_TIMER 0x56 #define ES8326_HPDET_TYPE 0x57 #define ES8326_INT_SOURCE 0x58 From patchwork Fri Jan 19 11:28:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Ning X-Patchwork-Id: 763967 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 71283C47DAF for ; Fri, 19 Jan 2024 11:30:30 +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 7E0947F1; Fri, 19 Jan 2024 12:30:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7E0947F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705663828; bh=/pkr9+xZ8Qa17bkZvZ5paQEsHAiTKL2OaIl0xlSNsQI=; 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=MpS5iIgUzWhxGlggsf9Yua9L11Bj+pdmMgs+5uq772vg0Qio4sfEZpFNje/IOZ6ec U/R678wdR6ymdrmduw89zgM+8Kw77tQE/syj2FYpjJbQ+BIONpFspqN3r5GPL0yGxK g1mE3X/WCKkB+wMxykS122GkJCp3GFSuaIgftKm8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 90040F805CA; Fri, 19 Jan 2024 12:29:36 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 65CD9F805CA; Fri, 19 Jan 2024 12:29:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6449AF801F5; Fri, 19 Jan 2024 12:29:32 +0100 (CET) Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D59F6F80236 for ; Fri, 19 Jan 2024 12:29:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D59F6F80236 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ervB1nT4 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5986cb7bb61so308845eaf.2 for ; Fri, 19 Jan 2024 03:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705663758; x=1706268558; darn=alsa-project.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=pIRKL85FnZ07zglYZHqKUrP254oS82SHQ7x66LFSCYc=; b=ervB1nT4KYvzJOVaZGHOxuWnpuZJAUBi0nFgdjcMEKzOZy4DDnWoz7MbUhtZolWMlP At52Wn6J3XKkCTCvniRwAa4NH6w/Vc2jbGbLNg1TgVMaWy4JoLF8h8jczgpdiBnFQJNH jJJHHvDE7lqW3YP6mbKCsM9xJDEUmcTGUvImUHsvv61kc6GuQM8tKiZ3yd0oTMpujVVd HO/B8vHV02gIa6LwsJ2Ac8M7XYulxo8S/SZDaWiT8yTh4Ju9BQiF0wA2ThCP2moPYmI6 Lqwb4vBDnGOXX3ltqMHRBz8PcaV8US5Ec7YtL+IjOsv/lmWIbRpKORn3N0QaTeWOvm/+ RjAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705663758; x=1706268558; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pIRKL85FnZ07zglYZHqKUrP254oS82SHQ7x66LFSCYc=; b=jTIE7mg77U9kPZIwO74W2XSNTvxzB2WTipKQNaWJ47qQ6pbfWoAdfj70Gx94cDB2sW okSs/KET9L9IZhIWsl54ynjGnmmcO5jkReW1ljopOF9RhtzPumuM5EiTSUPQbY9SXau9 Po5vSH4BaTZRdRXOl0t24VUkbKg+T24h/a187fHF9FIp9ZW4FJxGPQF5MpFxT4nJQlI+ J0yVKfNtGsK0aYQp+Z3zzYAvGsfEcKzbqr4TNM/Lbqyn1NMmjFjXaCwV6vj6l/y3F+5c SYokB/YRQVeeEFJUkbeuqygO78VOxo4x+IDTmsyrjBsSM3Zef8h97Ipdpjffy+a6Zl9a l0rA== X-Gm-Message-State: AOJu0YyMotMV1cwkxrY/GHRul+8gVDq3bDq4hM1+aldjIWoQ1cFRRkp9 bY7bFhDdN9Huj00D+ylozxsfvRv5kqRR87tQXXZkX5W8lPphwUq7qqHDFQO4cOzcF/5D X-Google-Smtp-Source: AGHT+IEu79lL3+mVAjAtQg9LfxckB4AIZhP1P5afw4GzGe5cO9c31EgdYRjBunEzgS9OHeGcpmKjuw== X-Received: by 2002:a05:6358:8822:b0:175:745e:dbef with SMTP id hv34-20020a056358882200b00175745edbefmr3014887rwb.61.1705663758000; Fri, 19 Jan 2024 03:29:18 -0800 (PST) Received: from zy-virtual-machine.localdomain ([222.70.13.170]) by smtp.gmail.com with ESMTPSA id n9-20020a62e509000000b006d9b8e1971dsm4884541pff.191.2024.01.19.03.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:29:17 -0800 (PST) From: Zhu Ning 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, Zhu Ning Subject: [PATCH 2/5] ASoC: codecs: ES8326: Improving the THD+N performance Date: Fri, 19 Jan 2024 19:28:55 +0800 Message-Id: <20240119112858.2982-3-zhuning0077@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240119112858.2982-1-zhuning0077@gmail.com> References: <20240119112858.2982-1-zhuning0077@gmail.com> Message-ID-Hash: 3PGSXQDR2JBU5FIPQ63UQBZ3ERYTUCTV X-Message-ID-Hash: 3PGSXQDR2JBU5FIPQ63UQBZ3ERYTUCTV X-MailFrom: zhuning0077@gmail.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 update the values of some registers in the initialization sequence in es8326_resume function to improve THD+N performance. THD+N performance decreases if the output level on headphone is close to full scale. So we change the register setting in es8326_jack_detect_handler function to improve THD+N performance if headphone pulgged. Also, the register setting should be restored when the headset is unplugged Signed-off-by: Zhu Ning --- sound/soc/codecs/es8326.c | 21 +++++++++++++-------- sound/soc/codecs/es8326.h | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index 82d1c4f8324c..10157a4bd500 100755 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -752,6 +752,8 @@ static void es8326_jack_detect_handler(struct work_struct *work) es8326->hp = 0; } 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); /* * Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event */ @@ -777,6 +779,8 @@ static void es8326_jack_detect_handler(struct work_struct *work) regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01); usleep_range(50000, 70000); regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00); + regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08); queue_delayed_work(system_wq, &es8326->jack_detect_work, msecs_to_jiffies(400)); es8326->hp = 1; @@ -846,14 +850,14 @@ static int es8326_calibrate(struct snd_soc_component *component) if ((es8326->version == ES8326_VERSION_B) && (es8326->calibrated == false)) { dev_dbg(component->dev, "ES8326_VERSION_B, calibrating\n"); regmap_write(es8326->regmap, ES8326_CLK_INV, 0xc0); - regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x01); + regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x03); regmap_write(es8326->regmap, ES8326_CLK_DLL, 0x30); regmap_write(es8326->regmap, ES8326_CLK_MUX, 0xed); regmap_write(es8326->regmap, ES8326_CLK_DAC_SEL, 0x08); regmap_write(es8326->regmap, ES8326_CLK_TRI, 0xc1); regmap_write(es8326->regmap, ES8326_DAC_MUTE, 0x03); regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7f); - regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x03); + regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23); regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x88); usleep_range(15000, 20000); regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c); @@ -894,13 +898,13 @@ static int es8326_resume(struct snd_soc_component *component) /* reset internal clock state */ regmap_write(es8326->regmap, ES8326_RESET, 0x1f); 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_ANA_MICBIAS, 0x4b); + regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb); /* set headphone default type and detect pin */ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83); regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05); - regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30); /* set internal oscillator as clock source of headpone cp */ regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x89); @@ -908,14 +912,15 @@ static int es8326_resume(struct snd_soc_component *component) /* clock manager reset release */ regmap_write(es8326->regmap, ES8326_RESET, 0x17); /* set headphone detection as half scan mode */ - regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30); + regmap_write(es8326->regmap, ES8326_HP_MISC, 0x3d); regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x00); /* enable headphone driver */ + regmap_write(es8326->regmap, ES8326_HP_VOL, 0xc4); regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa7); usleep_range(2000, 5000); - regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xa3); - regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xb3); + regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0x23); + regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0x33); regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1); regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00); @@ -946,7 +951,7 @@ static int es8326_resume(struct snd_soc_component *component) (ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT)); regmap_write(es8326->regmap, ES8326_SDINOUT23_IO, ES8326_IO_INPUT); - regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b); + regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00); regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_ON); regmap_update_bits(es8326->regmap, ES8326_PGAGAIN, ES8326_MIC_SEL_MASK, ES8326_MIC1_SEL); diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h index dfef808673f4..4234bbb900c4 100644 --- a/sound/soc/codecs/es8326.h +++ b/sound/soc/codecs/es8326.h @@ -101,7 +101,7 @@ #define ES8326_MUTE (3 << 0) /* ES8326_CLK_CTL */ -#define ES8326_CLK_ON (0x7f << 0) +#define ES8326_CLK_ON (0x7e << 0) #define ES8326_CLK_OFF (0 << 0) /* ES8326_CLK_INV */ From patchwork Fri Jan 19 11:28:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Ning X-Patchwork-Id: 763966 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 D172CC4725D for ; Fri, 19 Jan 2024 11:31:02 +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 E3B3083E; Fri, 19 Jan 2024 12:30:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E3B3083E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705663860; bh=674tDTiDlWIl3qZq+F+4nQuuogkUcyGVC3Ni7ePevso=; 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=ScwxWgEHzn/qdV6aVRPSXsPzPLmVu/MXTBQJPHSswm1YItq7OxK4Ytd85+1q1EX8N +QOsD8i8ggn2g7rhxNw7jgrK0bC6k9O+G941II6AsunAW9La3SkI0PuucHVPfXrWC/ zKKrK7lS5dxQgDlLsHIvpWH2oK2KYsPjCM2HVMbY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D357FF805F9; Fri, 19 Jan 2024 12:29:46 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 58562F805FF; Fri, 19 Jan 2024 12:29:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0C120F805F9; Fri, 19 Jan 2024 12:29:43 +0100 (CET) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 27EF1F8003A for ; Fri, 19 Jan 2024 12:29:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27EF1F8003A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=gHg4C4Ux Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6d9c2db82b0so564401b3a.1 for ; Fri, 19 Jan 2024 03:29:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705663769; x=1706268569; darn=alsa-project.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=PukuqSkFqArLMkVmFzdDVnacS7jVSYVupLAIDu+heWc=; b=gHg4C4Uxz1qKSwU9ZFJ0RqgE2al+a3A22C00JPGhiMlyyqMI/7HSnKp6SKzdZcpPlK 7V+oMQ1bPvxwNWxKRizsw8TTIJkwna6ZZ+8C5bTRS7XkZABce+fXHBnAgOT/QfqDnK+K 4RR6MzTEq5QdZzG6dS98yu6N0bxY+awhS5vEstDMvsZBD9I7rhrfCoSj7ZqweDC8vI9f 4ZrMydUYQiDvSTNFaHHD7U/HEe0+xNDPGbv8JLzWtzEwKmdVNYoehMKEnJ7fRdQxCTCc /+qMIfJ6QK3RwcYYb0o9h49kAnqAej3Gj0A8Snv9VqgBMow0MUdIh5HjZGeYKk3HygFj f4hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705663769; x=1706268569; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PukuqSkFqArLMkVmFzdDVnacS7jVSYVupLAIDu+heWc=; b=Gs9IgkecAeAIID5eTLvB0z1kBhIvi3CjDMSO+vxd4cRH+8cQ2Sh8swU7wSsiHK7Qng EWSPQ2iHMjdWX+70g0EfZa9yqzgWMmLQg+2z6ZTVJ8OCvFQdJJgqbF7nWZaQNYExpwwl ro5gxylNn6V7F72scb5gvy4MgjDxPKDtfBHy2NK3dHNQ6J8Dd/8E96nEK5aZzsCFhCQJ YnICnTnkrUeGfIZnb7NXlzqBfY3i1oLdnUZYHzzk8UR57fq4VVBZwocDdMngf+SkpBXX MCqr3sXHF7tBgtI3RDpDyNWGI7Zu1xfrlVBz75ApFGvu3StVWOgN6Gq8WV06fo0h8dfZ Bf0g== X-Gm-Message-State: AOJu0YyjMCs31z5GcKRNPp72wJhI0K5OYGgEdN49rZb6UjIF7zQH40+8 z3KBVCljWwVpq+DjSg4kNed8+Pqtmuk5vwrrZ6zJvFjPIEBKCzRo4PREloxoOw8Kj4+j X-Google-Smtp-Source: AGHT+IESai/mp6KlyJCbfRPNyYu3P8RosfPSAjc9Sjmsyxdnux1KMe0bxKj9LAwts6H2lNbUk2GSBg== X-Received: by 2002:a05:6a00:23c4:b0:6d9:3d15:d506 with SMTP id g4-20020a056a0023c400b006d93d15d506mr2081929pfc.53.1705663768743; Fri, 19 Jan 2024 03:29:28 -0800 (PST) Received: from zy-virtual-machine.localdomain ([222.70.13.170]) by smtp.gmail.com with ESMTPSA id n9-20020a62e509000000b006d9b8e1971dsm4884541pff.191.2024.01.19.03.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:29:28 -0800 (PST) From: Zhu Ning 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, Zhu Ning Subject: [PATCH 3/5] ASoC: codecs: ES8326: Adding new volume kcontrols Date: Fri, 19 Jan 2024 19:28:56 +0800 Message-Id: <20240119112858.2982-4-zhuning0077@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240119112858.2982-1-zhuning0077@gmail.com> References: <20240119112858.2982-1-zhuning0077@gmail.com> Message-ID-Hash: AUXFM5UZMUCJJTQA2TNCIIRXAVEJHEPE X-Message-ID-Hash: AUXFM5UZMUCJJTQA2TNCIIRXAVEJHEPE X-MailFrom: zhuning0077@gmail.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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: ES8326 features a headphone volume control register and four DAC volume control registers. We add new volume Kcontrols for these registers to enhance the configurability of the volume settings, providing users with greater flexibility. Signed-off-by: Zhu Ning --- sound/soc/codecs/es8326.c | 30 ++++++++++++++++++++++++++++++ sound/soc/codecs/es8326.h | 5 ++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index 10157a4bd500..c7f89c990178 100755 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -151,12 +151,34 @@ static const char *const winsize[] = { static const char *const dacpol_txt[] = { "Normal", "R Invert", "L Invert", "L + R Invert" }; +static const char *const hpvol[] = { + "0 dB", + "-6 dB", + "-24 dB", + "+3.5 dB", + "-3.5 dB", + "-18 dB", +}; +static const unsigned int hp_vol_values[] = { 0, 1, 2, 4, 5, 6 }; + +static const char *const hp_spkvol_switch[] = { + "HPVOL: HPL+HPL, SPKVOL: HPL+HPL", + "HPVOL: HPL+HPR, SPKVOL: HPL+HPR", + "HPVOL: HPL+HPL, SPKVOL: SPKL+SPKR", + "HPVOL: HPL+HPR, SPKVOL: SPKL+SPKR", +}; + static const struct soc_enum dacpol = SOC_ENUM_SINGLE(ES8326_DAC_DSM, 4, 4, dacpol_txt); static const struct soc_enum alc_winsize = SOC_ENUM_SINGLE(ES8326_ADC_RAMPRATE, 4, 16, winsize); static const struct soc_enum drc_winsize = SOC_ENUM_SINGLE(ES8326_DRC_WINSIZE, 4, 16, winsize); +static const struct soc_enum hp_vol = + SOC_VALUE_ENUM_DOUBLE(ES8326_HP_VOL, 4, 0, 7, + ARRAY_SIZE(hpvol), hpvol, hp_vol_values); +static const struct soc_enum hpvol_spkvol_switch = + SOC_ENUM_SINGLE(ES8326_HP_MISC, 6, 4, hp_spkvol_switch); static const struct snd_kcontrol_new es8326_snd_controls[] = { SOC_SINGLE_TLV("DAC Playback Volume", ES8326_DAC_VOL, 0, 0xbf, 0, dac_vol_tlv), @@ -182,6 +204,14 @@ static const struct snd_kcontrol_new es8326_snd_controls[] = { es8326_crosstalk1_get, es8326_crosstalk1_set), SOC_SINGLE_EXT("CROSSTALK2", SND_SOC_NOPM, 0, 31, 0, es8326_crosstalk2_get, es8326_crosstalk2_set), + + SOC_SINGLE_TLV("HPL Playback Volume", ES8326_DACL_VOL, 0, 0xbf, 0, dac_vol_tlv), + SOC_SINGLE_TLV("HPR Playback Volume", ES8326_DACR_VOL, 0, 0xbf, 0, dac_vol_tlv), + SOC_SINGLE_TLV("SPKL Playback Volume", ES8326_SPKL_VOL, 0, 0xbf, 0, dac_vol_tlv), + SOC_SINGLE_TLV("SPKR Playback Volume", ES8326_SPKR_VOL, 0, 0xbf, 0, dac_vol_tlv), + + SOC_ENUM("HP Volume", hp_vol), + SOC_ENUM("HPVol SPKVol switch", hpvol_spkvol_switch), }; static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = { diff --git a/sound/soc/codecs/es8326.h b/sound/soc/codecs/es8326.h index 4234bbb900c4..ee12caef8105 100644 --- a/sound/soc/codecs/es8326.h +++ b/sound/soc/codecs/es8326.h @@ -69,7 +69,7 @@ #define ES8326_DAC_DSM 0x4D #define ES8326_DAC_RAMPRATE 0x4E #define ES8326_DAC_VPPSCALE 0x4F -#define ES8326_DAC_VOL 0x50 +#define ES8326_DACL_VOL 0x50 #define ES8326_DRC_RECOVERY 0x53 #define ES8326_DRC_WINSIZE 0x54 #define ES8326_DAC_CROSSTALK 0x55 @@ -81,6 +81,9 @@ #define ES8326_SDINOUT23_IO 0x5B #define ES8326_JACK_PULSE 0x5C +#define ES8326_DACR_VOL 0xF4 +#define ES8326_SPKL_VOL 0xF5 +#define ES8326_SPKR_VOL 0xF6 #define ES8326_HP_MISC 0xF7 #define ES8326_CTIA_OMTP_STA 0xF8 #define ES8326_PULLUP_CTL 0xF9 From patchwork Fri Jan 19 11:28:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Ning X-Patchwork-Id: 764473 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 17255C47DAF for ; Fri, 19 Jan 2024 11:31:15 +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 13A65206; Fri, 19 Jan 2024 12:31:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 13A65206 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705663873; bh=xuDPMoIv7SAAudDgGcVNuwiYOfXIYmkB8eT6qXx5Vwk=; 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=WpVKStpalj+jKBAFndE1kP/YukdrQrzY7DowbUQ/gotz4Z0DHeN1PNDKDWSPNU8mE 1LFHcXggN0Ry8ZqNz+YwsHnivQ3cxlmBhx9OS4uCcTjIMaB+N+8mOKaslG5Fadf/iP id3EMFGGzhWxx+rqWW9A+fNs5gMa+Ca9eO5QB2Yc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9137F8062F; Fri, 19 Jan 2024 12:29:50 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 312EAF80635; Fri, 19 Jan 2024 12:29:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D9DBDF8060D; Fri, 19 Jan 2024 12:29:46 +0100 (CET) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 48DB2F805C6 for ; Fri, 19 Jan 2024 12:29:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 48DB2F805C6 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ZVB8m4d6 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6daf9d5f111so683871b3a.0 for ; Fri, 19 Jan 2024 03:29:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705663773; x=1706268573; darn=alsa-project.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=aPFQf5Rvq4xymPBAJnoqpxqqRCx74zAcNbTt6aCN7Mk=; b=ZVB8m4d6CgGKzX/Gh5dFlTZ3f4MdQHT5QpNqDAnNcHE019smeybtq0xEJrWzCj1YO5 UXVkSVtGtmIF9WziHqCR/g7XQEsLgSgL0h++UJCX0uFiYQXWbqbYCasST/xW9aSdJBq1 BF8InlMRQ4SNPRu2PUd4uVyiYtByiSqC0hVPC6El4OEzEFjtn8P7aIskLuMR3DNr7zbK 1xfVPAKXXwBx4vidEv5adBI1qKH6LfBcuKuXsV0+x0qhzlsZBljjqUzgwjGWDBrKUvl+ mIAsrFqj2We/lMqsx1zQ1BYowNNecBm++8/Nn89Ly5wX81A7Tt4v6ZHzvYmB14Y4dFQC Ej2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705663773; x=1706268573; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aPFQf5Rvq4xymPBAJnoqpxqqRCx74zAcNbTt6aCN7Mk=; b=dIFXHINPM8wYnKksxN8f0W5HpEsrnowVaV4ZgUlEqbgg2SEFFomXfuLTpEENPPNu05 H3XhdJB9Aotk7YFNWJ2xLhdkPW13wUPyzxd1Pco2ucgeP4fF1aKV5a5v/KmGe8kzk6hj T1RzHF41AOnzZrq25dLwmgxZ1bdDma1b311gXDYqvzTTvfPY4qUC3VvAAUPYcUNzdofy Naq2yDbQaQUCzDssBEo35WhejQb0HuecbXZari41sb0LuQGrlOuQkaAACnRVtUFcGdSJ vC4S1WtVyFpcgMjJr1rCiT32dnqeTwDvE0xdyxGVxrTVMcFejpFay/+ewvuBLk8yCHIZ No1A== X-Gm-Message-State: AOJu0Ywj/IYk347CdQlsn3mM24JAJ21iO/GhYpV1868u8qNcgEw/+/6O J0X6w8ZUoUYgcPBobwksxmcQcH4NHwP8QE5XyuAsj5Joxrt8cyM2DKruexsysQqEU4uQ X-Google-Smtp-Source: AGHT+IFXuwMOTnhFlwth1KXqXZT87fZYKesBiC5+2RRssF3Vko+e8L19p8ctmc91HveoDnSFrLITQA== X-Received: by 2002:a05:6a00:182a:b0:6d9:b112:ef85 with SMTP id y42-20020a056a00182a00b006d9b112ef85mr2811280pfa.48.1705663772822; Fri, 19 Jan 2024 03:29:32 -0800 (PST) Received: from zy-virtual-machine.localdomain ([222.70.13.170]) by smtp.gmail.com with ESMTPSA id n9-20020a62e509000000b006d9b8e1971dsm4884541pff.191.2024.01.19.03.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:29:32 -0800 (PST) From: Zhu Ning 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, Zhu Ning Subject: [PATCH 4/5] ASoC: codecs: ES8326: Minimize the pop noise on headphone Date: Fri, 19 Jan 2024 19:28:57 +0800 Message-Id: <20240119112858.2982-5-zhuning0077@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240119112858.2982-1-zhuning0077@gmail.com> References: <20240119112858.2982-1-zhuning0077@gmail.com> Message-ID-Hash: LGQZTLACL7JEUJB2DOM2TCSYN3PXBU4Z X-Message-ID-Hash: LGQZTLACL7JEUJB2DOM2TCSYN3PXBU4Z X-MailFrom: zhuning0077@gmail.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 modify the register settings to minimize headphone pop noise during ES8326 power-up and music start/stop. Signed-off-by: Zhu Ning --- sound/soc/codecs/es8326.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index c7f89c990178..fd3e73c4b7e9 100755 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -553,7 +553,8 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction) regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF); regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK, ES8326_MUTE); - regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xf0); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, + 0x30, 0x00); } else { if (!es8326->calibrated) { regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL); @@ -566,8 +567,13 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction) regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r); es8326->calibrated = true; } + regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01); + usleep_range(1000, 5000); + regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00); + usleep_range(1000, 5000); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30); regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1); - regmap_write(es8326->regmap, ES8326_HP_VOL, 0x91); regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON); regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK, ~(ES8326_MUTE)); @@ -587,23 +593,20 @@ static int es8326_set_bias_level(struct snd_soc_component *codec, if (ret) return ret; - regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00); + regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x02); + usleep_range(5000, 10000); regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk); regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, (ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT)); - regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E); regmap_write(es8326->regmap, ES8326_PGA_PDN, 0x40); regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00); regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20); - - regmap_update_bits(es8326->regmap, ES8326_RESET, - ES8326_CSM_ON, ES8326_CSM_ON); + regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x00); break; case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b); - regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x00); regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00); regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, ES8326_IO_INPUT); break; @@ -807,6 +810,7 @@ static void es8326_jack_detect_handler(struct work_struct *work) * Don't report jack status. */ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01); + es8326_enable_micbias(es8326->component); usleep_range(50000, 70000); regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00); regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f); @@ -850,13 +854,10 @@ static void es8326_jack_detect_handler(struct work_struct *work) static irqreturn_t es8326_irq(int irq, void *dev_id) { struct es8326_priv *es8326 = dev_id; - struct snd_soc_component *comp = es8326->component; if (!es8326->jack) goto out; - es8326_enable_micbias(comp); - if (es8326->jack->status & SND_JACK_HEADSET) queue_delayed_work(system_wq, &es8326->jack_detect_work, msecs_to_jiffies(10)); @@ -973,6 +974,14 @@ static int es8326_resume(struct snd_soc_component *component) regmap_write(es8326->regmap, ES8326_DAC_DSM, 0x08); regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15); + regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 | + ((es8326->version == ES8326_VERSION_B) ? + (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) : + (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04))); + usleep_range(5000, 10000); + 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_INTOUT_IO, @@ -989,11 +998,6 @@ static int es8326_resume(struct snd_soc_component *component) regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK, ES8326_MUTE); - regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 | - ((es8326->version == ES8326_VERSION_B) ? - (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) : - (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04))); - regmap_write(es8326->regmap, ES8326_HP_VOL, 0x11); es8326->jack_remove_retry = 0; es8326->hp = 0; From patchwork Fri Jan 19 11:28:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Ning X-Patchwork-Id: 763965 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 65796C4725D for ; Fri, 19 Jan 2024 11:31:35 +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 89B0A20E; Fri, 19 Jan 2024 12:31:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 89B0A20E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705663893; bh=PeSGgUlLO0QYQTNF6HEH4Awp8ydSuN7HXZkAQhBxbH4=; 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=ESGMs4K9dM+Hj7/RC03oJsQeDNGDGcl8ZQR3FghgEGqiZVmDmllVh3cydKAftiOd0 5+0rsbPr+7637fKPf2u0x+Ds94izcMnU+u/KbksE5yemvdOdDC85XsbWvOXGSJKgTa NHQao95bXgfeRuPha+zPeFv7ifxFjcxqu0DGI1cU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id DD796F8065C; Fri, 19 Jan 2024 12:29:54 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 48592F8065B; Fri, 19 Jan 2024 12:29:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7AED2F80637; Fri, 19 Jan 2024 12:29:49 +0100 (CET) Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 121DCF80520 for ; Fri, 19 Jan 2024 12:29:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 121DCF80520 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=g8XzdJHq Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3bd6581bc62so456877b6e.2 for ; Fri, 19 Jan 2024 03:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705663776; x=1706268576; darn=alsa-project.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=WzWU93PVglAiK6JeYvApr/hL3iYswtlmnngYtH+W0CM=; b=g8XzdJHqTFhWqSZ8i8lF4LeJw6RPGSC61uQc4tmAIjzAevh57Mpq0WqcirOaM8Wg/l atnYUXHaN54nsXNU5Xq12k/FrJxuHS78LS/6cIzjA8f+3RX9JO3OLYf6ZycIJc3lPRg9 IiFXzZKiD0eDINSE5RTNBhn5w8BJzrYTgVtMU5XlVa00a2+O+v7P43IxruHrZMLEKYEL PY04Qj37xiTYj9cBq5L8QGHjsU6MLVe+TJompVy7LZ3hF+1KBqo3xEemzjmqUFzWlAsH WTen+8+6OQMfejAMaV3eyExvmsDgxXqoQlCyQmpR5HOhIwxksf0rw8l1pOBssPy7gdNJ 6R8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705663776; x=1706268576; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WzWU93PVglAiK6JeYvApr/hL3iYswtlmnngYtH+W0CM=; b=XkDbhpW24GcVskvqGetmuyYjGajfpaoOhV1VAhY0fg3DzwLh2rv874QAsxR9TYEUPB wT4CELeXFTpnIE8z+NYjB/mSoo5A2witYcbebW1ufhhc5EKin7Ns/j5DW4QfO10AS1hI 02MMqCBOlOD3+nBz3dAQCYaRMMvhYtkoEn2kBBgZ7zcD2cp1/i1z8maGQ7AjkJ1tTowr o0N45qEN4OQyiXKdU3D+IYItaLcRvgNrOeTXJwXQ/kWlpOZISGcKUnsWzTl8SYQkbJqa uKxNkDfgr3KwKJUSEbPtBwzdDRKziVsZUl0XqXzRl2dHnXl5u5eNlRvQ79kh5wx9T1cq dNtQ== X-Gm-Message-State: AOJu0Yxt8G0FIL74GltSQPLDPRsYCg2LZ0r9vELqLs+6uL+WecHSSxwU s6TlcQ/4ReoKPTJQV9cFORiA0+ZIW6cBBVeOu3VH0P0tsV4sfMbm8lMLRKM69a9RyODG X-Google-Smtp-Source: AGHT+IGRvRiKLinz+GPG9h9DEF08HnviY4IR7tU6JNhQIlV8OAH1KDJdfxnmc8SZRrozmnGoaColVQ== X-Received: by 2002:a05:6808:2193:b0:3bd:5b4d:3e30 with SMTP id be19-20020a056808219300b003bd5b4d3e30mr2831823oib.81.1705663776564; Fri, 19 Jan 2024 03:29:36 -0800 (PST) Received: from zy-virtual-machine.localdomain ([222.70.13.170]) by smtp.gmail.com with ESMTPSA id n9-20020a62e509000000b006d9b8e1971dsm4884541pff.191.2024.01.19.03.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 03:29:36 -0800 (PST) From: Zhu Ning 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, Zhu Ning Subject: [PATCH 5/5] ASoC: codecs: ES8326: fix the capture noise issue Date: Fri, 19 Jan 2024 19:28:58 +0800 Message-Id: <20240119112858.2982-6-zhuning0077@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240119112858.2982-1-zhuning0077@gmail.com> References: <20240119112858.2982-1-zhuning0077@gmail.com> Message-ID-Hash: GSVVMUCQDEIWVZS7RKK5QZ6OJZ6ENFCG X-Message-ID-Hash: GSVVMUCQDEIWVZS7RKK5QZ6OJZ6ENFCG X-MailFrom: zhuning0077@gmail.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 get a noise issue during the startup of recording. We update the register setting and dapm widgets to fix this issue. we change callback type of es8326_mute function to mute_stream. ES8326_ADC_MUTE is moved to es8326_mute function so it can be turned on at last and turned off at first. Signed-off-by: Zhu Ning --- sound/soc/codecs/es8326.c | 63 ++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c index fd3e73c4b7e9..4026d939e051 100755 --- a/sound/soc/codecs/es8326.c +++ b/sound/soc/codecs/es8326.c @@ -227,12 +227,6 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = { SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0, SND_SOC_NOPM, 0, 0), - /* ADC Digital Mute */ - SND_SOC_DAPM_PGA("ADC L1", ES8326_ADC_MUTE, 0, 1, NULL, 0), - SND_SOC_DAPM_PGA("ADC R1", ES8326_ADC_MUTE, 1, 1, NULL, 0), - SND_SOC_DAPM_PGA("ADC L2", ES8326_ADC_MUTE, 2, 1, NULL, 0), - SND_SOC_DAPM_PGA("ADC R2", ES8326_ADC_MUTE, 3, 1, NULL, 0), - /* Analog Power Supply*/ SND_SOC_DAPM_DAC("Right DAC", NULL, ES8326_ANA_PDN, 0, 1), SND_SOC_DAPM_DAC("Left DAC", NULL, ES8326_ANA_PDN, 1, 1), @@ -252,15 +246,10 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = { }; static const struct snd_soc_dapm_route es8326_dapm_routes[] = { - {"ADC L1", NULL, "MIC1"}, - {"ADC R1", NULL, "MIC2"}, - {"ADC L2", NULL, "MIC3"}, - {"ADC R2", NULL, "MIC4"}, - - {"ADC L", NULL, "ADC L1"}, - {"ADC R", NULL, "ADC R1"}, - {"ADC L", NULL, "ADC L2"}, - {"ADC R", NULL, "ADC R2"}, + {"ADC L", NULL, "MIC1"}, + {"ADC R", NULL, "MIC2"}, + {"ADC L", NULL, "MIC3"}, + {"ADC R", NULL, "MIC4"}, {"I2S OUT", NULL, "ADC L"}, {"I2S OUT", NULL, "ADC R"}, @@ -550,11 +539,16 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction) unsigned int offset_l, offset_r; if (mute) { - regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF); - regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, - ES8326_MUTE_MASK, ES8326_MUTE); - regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, - 0x30, 0x00); + if (direction == SNDRV_PCM_STREAM_PLAYBACK) { + regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF); + regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, + ES8326_MUTE_MASK, ES8326_MUTE); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, + 0x30, 0x00); + } else { + regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE, + 0x0F, 0x0F); + } } else { if (!es8326->calibrated) { regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL); @@ -567,16 +561,22 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction) regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r); es8326->calibrated = true; } - regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01); - usleep_range(1000, 5000); - regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00); - usleep_range(1000, 5000); - regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20); - regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30); - regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1); - regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON); - regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, - ES8326_MUTE_MASK, ~(ES8326_MUTE)); + if (direction == SNDRV_PCM_STREAM_PLAYBACK) { + regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01); + usleep_range(1000, 5000); + regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00); + usleep_range(1000, 5000); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20); + regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30); + regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1); + regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON); + regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, + ES8326_MUTE_MASK, ~(ES8326_MUTE)); + } else { + msleep(300); + regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE, + 0x0F, 0x00); + } } return 0; } @@ -626,7 +626,7 @@ static const struct snd_soc_dai_ops es8326_ops = { .set_fmt = es8326_set_dai_fmt, .set_sysclk = es8326_set_dai_sysclk, .mute_stream = es8326_mute, - .no_capture_mute = 1, + .no_capture_mute = 0, }; static struct snd_soc_dai_driver es8326_dai = { @@ -998,6 +998,7 @@ static int es8326_resume(struct snd_soc_component *component) regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK, ES8326_MUTE); + regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f); es8326->jack_remove_retry = 0; es8326->hp = 0;