Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp173307lqo; Tue, 7 May 2024 16:37:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW065RjoSKpWJlN9ZRphGuzMItsVRmscis1/FzJZKlXJb+htKUmWhy4RTUNgKdvE6E8m7IkCsVPzUPkNmNhmYEoOGeyXdE54IlT82gTtg== X-Google-Smtp-Source: AGHT+IFliR3BflJyf75wBpuzuycetYmQoBdSLxUaUT5n2xnDPfHmnOY0/Uwu9GQr9bzOQ5NKumR1 X-Received: by 2002:a17:90a:940c:b0:2b5:91d1:3ae9 with SMTP id 98e67ed59e1d1-2b6165a4a52mr959458a91.19.1715125071150; Tue, 07 May 2024 16:37:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715125071; cv=pass; d=google.com; s=arc-20160816; b=NxUqGzKspAxfJlUUZ7g9K+8o6fohNT/OwacfzVjvfxNpR0/oFudrcb244PRH0NFrau 1Mu7X1g8vvzIVMRaF+ZwyLwLnHaa+wqS8vI58/APcozRxKFrCMc//9Fsn7rfeQba0il8 LdUTgSg6cNS7YUH3AersiN/v5uk5MRZYJdY0J23sBMxhttRS+avKPB/XB+3EcSse7TyM JCWFMHFzBu9lD+dNJ8FiLe9FNiSaEG1289bxm6RarIODGM4KqFmVsViYxxdQPaMWdmXA rFxvcupGL9NSuX/Jq+NMGIO2sBZFgmuVmG+WTnGKD62xjuhK5Awzi6RbEvrH+YPvt71p O1hg== ARC-Message-Signature: i=2; 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:dkim-signature; bh=FhO6eirxcZA2b43HPCUc9k9Cw88LwFrPAEYU6oNbFZk=; fh=CL9T5IU3cyk3BqPmaWbfpo3+d1IboHBgSMTrmJzto98=; b=yyXr/KV9oOkuEW4sZr/T/Y6btu0cVpg2iXcSn7ArJ3J6uM9Sunv7yBgYBPsJ6JVfFt HYlNf2twnhugRGievhutSvoE0e9Oc6aXKqKZYNFeYVS65D3jS7cryAJlv9fhRDOAFUzI YLexNl7KM8/TT+GbWOS4yJNdVu84+MxzAIEAd2FjcejweJcvteKNUYHZO2EqK5eoCdL+ GN8j/LscslBBMKlzM67KMBvnJ3tFNU4uoqD4uzTvm355B0lFb351SYoO8M+Fr4v8GHk5 D+XAZvWOfTTdmud4ihl3h4j5ZTU55YYQYvaVihwXAcbl91tc8aPIgvhUeZeSW7lWLraw 7UeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tIgxBHFs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628ea72e8si123537a91.100.2024.05.07.16.37.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:37:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tIgxBHFs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E9E8BB261B6 for ; Tue, 7 May 2024 23:24:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8A48131E4B; Tue, 7 May 2024 23:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tIgxBHFs" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DD80F131BD0; Tue, 7 May 2024 23:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123305; cv=none; b=Yf5PFmB9nglKj4MDs/DrtpfAcSZ4MNB6AIkFO4XLvpvhL1RMpZjDGmujGkyEt6p/ddFUWseUl3p9xhnzOKep0q81kfkMAr7Ybho0RjcbHNahqi97LIciQqOnJO4eaQwpXMsyj1ImH2564J8SNTDF1useUSZcnHppO97RIk3nq4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123305; c=relaxed/simple; bh=8flEoGuR5cknPXB6dawqgRqhe1hzDJzH/am2PZMz4Cg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qpsEjosx6tusgwc9ASfHq10rsMRo2Y+UN5sP1V1fkNmlLNxNc0ZzeiETL/ydJwxGEsErFd3Zhe98xbmhuBCSCcNv6mvBQRv68diS7RxMeNwer73Nl9d8+v0iOehbmejS6aGNUc1ZsKDGVnFNkeo7TTGL424aC9xR8YGE36JjeHM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tIgxBHFs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57CF7C2BBFC; Tue, 7 May 2024 23:08:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123304; bh=8flEoGuR5cknPXB6dawqgRqhe1hzDJzH/am2PZMz4Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tIgxBHFsL27ydIYjy00uUpdNBraMgQB9Ecf9VKscxeYPsw1Eg7WuYRm4Y8LEvutTO CJWOkGX8LGvMvqD5lhLufhL92UYLiN0L6jb/OQLuddfhCWZBB4Zrww0g9C6D8Y6gXn ZrWiMHFlUmTa7FNJzVxhk6z/gRXdoc/xeZ42d6YfxNoPfeBum+aSIJDnBEm9MVdQ0R WIwTmZMzP1WpsvZMBlarcZqsoSMg3GsLIbpybqVx3JD4pcGfXlxwZ4xmgPjVvAg+Wj MfvTnKgeiogaaPo2VEuCc+gvHp/179YN4b3IGF3vuni7t17Cuxfz50Z4rEE/J2Z1al 9YGjoQWU7TQcw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jack Yu , Mark Brown , Sasha Levin , oder_chiou@realtek.com, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 12/52] ASoC: rt722-sdca: add headset microphone vrefo setting Date: Tue, 7 May 2024 19:06:38 -0400 Message-ID: <20240507230800.392128-12-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507230800.392128-1-sashal@kernel.org> References: <20240507230800.392128-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.9 Content-Transfer-Encoding: 8bit From: Jack Yu [ Upstream commit 140e0762ca055d1aa84b17847cde5d9e47f56f76 ] Add vrefo settings to fix jd and headset mic recording issue. Signed-off-by: Jack Yu Link: https://msgid.link/r/727219ed45d3485ba8f4646700aaa8a8@realtek.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt722-sdca.c | 25 +++++++++++++++++++------ sound/soc/codecs/rt722-sdca.h | 3 +++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/rt722-sdca.c b/sound/soc/codecs/rt722-sdca.c index 4338cdb3a7917..9ff607984ea19 100644 --- a/sound/soc/codecs/rt722-sdca.c +++ b/sound/soc/codecs/rt722-sdca.c @@ -1438,9 +1438,12 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722) int loop_check, chk_cnt = 100, ret; unsigned int calib_status = 0; - /* Read eFuse */ - rt722_sdca_index_write(rt722, RT722_VENDOR_SPK_EFUSE, RT722_DC_CALIB_CTRL, - 0x4808); + /* Config analog bias */ + rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_ANALOG_BIAS_CTL3, + 0xa081); + /* GE related settings */ + rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_GE_RELATED_CTL2, + 0xa009); /* Button A, B, C, D bypass mode */ rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_UMP_HID_CTL4, 0xcf00); @@ -1474,9 +1477,6 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722) if ((calib_status & 0x0040) == 0x0) break; } - /* Release HP-JD, EN_CBJ_TIE_GL/R open, en_osw gating auto done bit */ - rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_DIGITAL_MISC_CTRL4, - 0x0010); /* Set ADC09 power entity floating control */ rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_ADC0A_08_PDE_FLOAT_CTL, 0x2a12); @@ -1489,8 +1489,21 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722) /* Set DAC03 and HP power entity floating control */ rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_DAC03_HP_PDE_FLOAT_CTL, 0x4040); + rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_ENT_FLOAT_CTRL_1, + 0x4141); + rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_FLOAT_CTRL_1, + 0x0101); /* Fine tune PDE40 latency */ regmap_write(rt722->regmap, 0x2f58, 0x07); + regmap_write(rt722->regmap, 0x2f03, 0x06); + /* MIC VRefo */ + rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG, + RT722_COMBO_JACK_AUTO_CTL1, 0x0200, 0x0200); + rt722_sdca_index_update_bits(rt722, RT722_VENDOR_REG, + RT722_VREFO_GAT, 0x4000, 0x4000); + /* Release HP-JD, EN_CBJ_TIE_GL/R open, en_osw gating auto done bit */ + rt722_sdca_index_write(rt722, RT722_VENDOR_REG, RT722_DIGITAL_MISC_CTRL4, + 0x0010); } int rt722_sdca_io_init(struct device *dev, struct sdw_slave *slave) diff --git a/sound/soc/codecs/rt722-sdca.h b/sound/soc/codecs/rt722-sdca.h index 44af8901352eb..2464361a7958c 100644 --- a/sound/soc/codecs/rt722-sdca.h +++ b/sound/soc/codecs/rt722-sdca.h @@ -69,6 +69,7 @@ struct rt722_sdca_dmic_kctrl_priv { #define RT722_COMBO_JACK_AUTO_CTL2 0x46 #define RT722_COMBO_JACK_AUTO_CTL3 0x47 #define RT722_DIGITAL_MISC_CTRL4 0x4a +#define RT722_VREFO_GAT 0x63 #define RT722_FSM_CTL 0x67 #define RT722_SDCA_INTR_REC 0x82 #define RT722_SW_CONFIG1 0x8a @@ -127,6 +128,8 @@ struct rt722_sdca_dmic_kctrl_priv { #define RT722_UMP_HID_CTL6 0x66 #define RT722_UMP_HID_CTL7 0x67 #define RT722_UMP_HID_CTL8 0x68 +#define RT722_FLOAT_CTRL_1 0x70 +#define RT722_ENT_FLOAT_CTRL_1 0x76 /* Parameter & Verb control 01 (0x1a)(NID:20h) */ #define RT722_HIDDEN_REG_SW_RESET (0x1 << 14) -- 2.43.0