From patchwork Wed Sep 25 04:38:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 831939 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 021BACE7D12 for ; Tue, 1 Oct 2024 12:37:32 +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 37B44E85; Tue, 1 Oct 2024 14:37:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 37B44E85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1727786251; bh=vcbtUAz7yhwWjWdeSyDPvePJuJQCbBjXfWfwU0OxtHI=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=sTd+Rq+LCq0R8uuexqEVKF8NkfWj+CRvzOZqjH1KLT3kpUVf093tDjqaKYRdvBy1y Z3+nn4zUMouBzKOZKN/pKwKJZqUnPCypv4NPqRT2BzXEofuZiRM56uvGNM/MdTAiUO K674rXVUYN77KNFWH3d418xWrEs9BAgQpKRbcGu0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1749F806D0; Tue, 1 Oct 2024 14:35:26 +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 C509BF806BC; Tue, 1 Oct 2024 14:35:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 918DDF8047C; Wed, 25 Sep 2024 06:38:31 +0200 (CEST) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (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 B3092F8010B for ; Wed, 25 Sep 2024 06:38:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B3092F8010B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=dhnJ9F3M Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a8a7b1c2f2bso1026136166b.0 for ; Tue, 24 Sep 2024 21:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727239106; x=1727843906; darn=alsa-project.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=D/oxZoO71PQ5m5Ow+SV5/SV/jvpv3lxQQXCYtby61Bc=; b=dhnJ9F3MQogCigSWSXqeLPWqfUgMbEHxjrVe10JiUq/R6NkDrwY+73rkxJCnG5nnov wIOD7SCW2RqkDGjcnxVImR1zxGvXrB2RQPUjDsGh6yr+mG8Ab+hxluyJISBcKvfWq/+G 9pmsuP3fL56sSbiLC5IhpxcNntF1ofwNeXug8anuyCIBLm+yY+4P3FNhraD0JL28vyn2 edgdvXTBZrB1P/rBSEY/tsH3a9lg+U1McOzMoz6w4A2zK8yBuIISxFRA83fe+yT93moa qMN83O89Zbz3+jizee4eqoFj/T0OyE+fv87XyYHA79eZvCB4LhCSpQuPjR1Jl6jy0tF4 AmRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727239106; x=1727843906; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D/oxZoO71PQ5m5Ow+SV5/SV/jvpv3lxQQXCYtby61Bc=; b=IixcpHSSJ+SuCKZ57rF03VHAkDC5BPqkr4zUqCEt41wemFL1eE/gaYWL/57QIjl7nt W9X+h10SuJnSQZgcUht5/vbrssGsiKw83maNQge4Gu2j8dYIG9Mio8wJXi9A5jIrhyA/ YZTb4SBKIcK7s++xu82pwO0rarUfwvgbgvQ1RxaJVDqN3sSmBChpLRGQJflpJF7huTRA x04TwfAAvmd9mKX1YvfcC42mBdDIM7cjuEEgHZ6/1jM2Z7XbSk8vyfDP+qCoDQ0aO4IZ BJhZ0FSFva6Hacn0D55Vnyf/lWvb47ECFxMEO+kXyzQS914xWMK+p9knTjht+b5rHNLL LWWg== X-Forwarded-Encrypted: i=1; AJvYcCUX53RgL8jtfki35vnZmmtmf12wKUXFGJjOhTMYZyfLHEddmghEAfuPxsQ4DniZFjBw49pY+AecKf6+@alsa-project.org X-Gm-Message-State: AOJu0Yx3eXdGLLo3HChz1ofR9ymIaSYG2ynftIuVc9dUgeiG/NplLees n+ObPyBBn8oTBkMYPzx86SwmZFKr1OIwQ6cZFKboID1LLvYnox5mrL5ja/9tYmI= X-Google-Smtp-Source: AGHT+IHwdF5ljDQfVen2bB2i+DqTGyQ8nFc+SavdlwPgLOgvH9bEIVuNClRBPu4Uwc0aZm3GruhGCg== X-Received: by 2002:a17:906:730a:b0:a8d:e49:c530 with SMTP id a640c23a62f3a-a93a05eda5fmr124902866b.42.1727239106340; Tue, 24 Sep 2024 21:38:26 -0700 (PDT) Received: from localhost.localdomain ([2.125.184.148]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9392f346casm164857466b.24.2024.09.24.21.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 21:38:25 -0700 (PDT) From: Alexey Klimov To: srinivas.kandagatla@linaro.org, a39.skl@gmail.com, linux-sound@vger.kernel.org Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski@linaro.org, vkoul@kernel.org, klimov.linux@gmail.com Subject: [PATCH REVIEW 1/2] ASoC: codecs: lpass-rx-macro: fix RXn(rx, n) macro for DSM_CTL and SEC7 regs Date: Wed, 25 Sep 2024 05:38:22 +0100 Message-ID: <20240925043823.520218-1-alexey.klimov@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-MailFrom: alexey.klimov@linaro.org 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: OW24PPV6ZBMT2OQP3IPKCJHP6QDL2VPU X-Message-ID-Hash: OW24PPV6ZBMT2OQP3IPKCJHP6QDL2VPU X-Mailman-Approved-At: Tue, 01 Oct 2024 12:35:05 +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: Turns out some registers of pre-2.5 version of rxmacro codecs are not located at the expected offsets but 0xc further away in memory. So far the detected registers are CDC_RX_RX2_RX_PATH_SEC7 and CDC_RX_RX2_RX_PATH_DSM_CTL. CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) macro incorrectly generates the address 0x540 for RX2 but it should be 0x54C and it also overwrites CDC_RX_RX2_RX_PATH_SEC7 which is located at 0x540. The same goes for CDC_RX_RXn_RX_PATH_SEC7(rx, n). Fix this by introducing additional rxn_reg_stride2 offset. For 2.5 version and above this offset will be equal to 0. With such change the corresponding RXn() macros will generate the same values for 2.5 codec version for all RX paths and the same old values for pre-2.5 version for RX0 and RX1. However for the latter case with RX2 path it will also add 2 * rxn_reg_stride2 on top. Signed-off-by: Alexey Klimov --- sound/soc/codecs/lpass-rx-macro.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index 71e0d3bffd3f..9288ddb705fe 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -202,12 +202,14 @@ #define CDC_RX_RXn_RX_PATH_SEC3(rx, n) (0x042c + rx->rxn_reg_stride * n) #define CDC_RX_RX0_RX_PATH_SEC4 (0x0430) #define CDC_RX_RX0_RX_PATH_SEC7 (0x0434) -#define CDC_RX_RXn_RX_PATH_SEC7(rx, n) (0x0434 + rx->rxn_reg_stride * n) +#define CDC_RX_RXn_RX_PATH_SEC7(rx, n) \ + (0x0434 + rx->rxn_reg_stride * n + n * (n - 1) * rx->rxn_reg_stride2) #define CDC_RX_DSM_OUT_DELAY_SEL_MASK GENMASK(2, 0) #define CDC_RX_DSM_OUT_DELAY_TWO_SAMPLE 0x2 #define CDC_RX_RX0_RX_PATH_MIX_SEC0 (0x0438) #define CDC_RX_RX0_RX_PATH_MIX_SEC1 (0x043C) -#define CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) (0x0440 + rx->rxn_reg_stride * n) +#define CDC_RX_RXn_RX_PATH_DSM_CTL(rx, n) \ + (0x0440 + rx->rxn_reg_stride * n + n * (n - 1) * rx->rxn_reg_stride2) #define CDC_RX_RXn_DSM_CLK_EN_MASK BIT(0) #define CDC_RX_RX0_RX_PATH_DSM_CTL (0x0440) #define CDC_RX_RX0_RX_PATH_DSM_DATA1 (0x0444) @@ -645,6 +647,7 @@ struct rx_macro { int rx_mclk_cnt; enum lpass_codec_version codec_version; int rxn_reg_stride; + int rxn_reg_stride2; bool is_ear_mode_on; bool hph_pwr_mode; bool hph_hd2_mode; @@ -3821,6 +3824,7 @@ static int rx_macro_probe(struct platform_device *pdev) case LPASS_CODEC_VERSION_2_0: case LPASS_CODEC_VERSION_2_1: rx->rxn_reg_stride = 0x80; + rx->rxn_reg_stride2 = 0x6; def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_pre_2_5_defaults); reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL); if (!reg_defaults) @@ -3834,6 +3838,7 @@ static int rx_macro_probe(struct platform_device *pdev) case LPASS_CODEC_VERSION_2_7: case LPASS_CODEC_VERSION_2_8: rx->rxn_reg_stride = 0xc0; + rx->rxn_reg_stride2 = 0x0; def_count = ARRAY_SIZE(rx_defaults) + ARRAY_SIZE(rx_2_5_defaults); reg_defaults = kmalloc_array(def_count, sizeof(struct reg_default), GFP_KERNEL); if (!reg_defaults) From patchwork Wed Sep 25 04:38:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 832450 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 85F6CCE7D12 for ; Tue, 1 Oct 2024 12:37:49 +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 C65C3827; Tue, 1 Oct 2024 14:37:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C65C3827 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1727786267; bh=ciTImMBS0p6wks5mQK0mcllczL97Z3Zssq9pfQWx3xs=; 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=Qfc1xG1BD2epqDbNOGYfjM5RaLHakWOV0fRA+Bo0OSSL6+HDg+QWBKlRUGWng6zSw MQleTcaKrXAvgpaC1YbDmo65EK2SJSnv590rZx79OzTtrf2Ho/zbwody7kZkqrC1fa k/H5XUWYLxGoUgPvaZwfgzXpCh9IbT91fiDymhqY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5AB25F805BE; Tue, 1 Oct 2024 14:35:30 +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 CF449F806E2; Tue, 1 Oct 2024 14:35:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4D18CF8010B; Wed, 25 Sep 2024 06:38:32 +0200 (CEST) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (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 ADDF1F80266 for ; Wed, 25 Sep 2024 06:38:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ADDF1F80266 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=v+hwom/N Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a8d2b4a5bf1so875432966b.2 for ; Tue, 24 Sep 2024 21:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727239108; x=1727843908; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eqcG1Y/DqvLJS0U3eydB1IqD9oVuSGX+UlV/1xSIyT0=; b=v+hwom/NVMXKs80+34ggVxdAaShr4wB32IPBy6u4YbEiLi0yRQAFOWbtRX/gETAgC+ GW33nLAt1QmQbVyohPG6AEwqOHmISPfraKzgtyFHyG2gBTu90GwjWwLwYi9P3vUQHNAe QVAxAPW4C2eCee0qmvIaIfUWF4qOy5Kw0onCzWBtGtUb7hQd6GSyihq5J4UNdSUMS0zl /86Vxh98BQkYJBjqCQSKSPvY+/9/5HZTfwczCb+Zk2zu/TaUL6eurD/AlSw5r8aX98go dy//MoVWj+ZCuiA2x3LcnYwT4sOAfshC+HMO6iwEIFtafwE0FfJOimPCljoKha+IhJNY ppzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727239108; x=1727843908; h=content-transfer-encoding:mime-version: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=eqcG1Y/DqvLJS0U3eydB1IqD9oVuSGX+UlV/1xSIyT0=; b=q2T2A8aZTkIUz8bJYalZAhYui9mi6wHHTdVI33p47rLK6PCKQzgqbHadTnfo23iwQO YOQNn0vGXHjVhKcHwryTmjY3phIgxOPO7c0l3PMsYiK6ozPX08/iuie257LIZ//cjJZ4 qK0FNtU40yi+hCUfN2u2TJlcFIerOBqvtzfzfG+LyEVeW08xNs/77Lg3DpBuGRpl6kEF IBIV9k3x/NCOUQ4i/9TLaAzRmwvtFBKv5qA/d5GBBGrlYwJnxV+2AV4xAS8w9OGDJx3u U3o+YmSzeXH/5icjwoK36i1+aOKgbiijj1gcOLzDwoAFgVhTW3RrUrvWGX8KGLow0ilW RJ5Q== X-Forwarded-Encrypted: i=1; AJvYcCUbnLqSNTjW21QrFcLLzCq0kdvqAfnw2SNrSJP1QlrqLycb7qzLw9A+67UyeHT0jc4osh2K35eF8dHe@alsa-project.org X-Gm-Message-State: AOJu0YzEvf/GeqbmJbtll+k7/wV8NkGxF/ot2OLDE6Wm3086XjbG8igY 8chhTVa6Lpt9CiCDd/EAqhd/cJd3yitD+cMA3O9h75vLohjl3VBV8ldclIcufrg= X-Google-Smtp-Source: AGHT+IGxDWA9Bpt+Vo+5NwY4exmWH9AugLbSR05W212S951aBgbB3SXoz6SBoMQb7pJmFGUWWMTH7w== X-Received: by 2002:a17:907:f14d:b0:a8b:6ee7:ba26 with SMTP id a640c23a62f3a-a93a0322a63mr119177866b.1.1727239108517; Tue, 24 Sep 2024 21:38:28 -0700 (PDT) Received: from localhost.localdomain ([2.125.184.148]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9392f346casm164857466b.24.2024.09.24.21.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 21:38:27 -0700 (PDT) From: Alexey Klimov To: srinivas.kandagatla@linaro.org, a39.skl@gmail.com, linux-sound@vger.kernel.org Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, krzysztof.kozlowski@linaro.org, vkoul@kernel.org, klimov.linux@gmail.com Subject: [PATCH REVIEW 2/2] ASoC: codecs: lpass-rx-macro: add missing CDC_RX_BCL_VBAT_RF_PROC2 to default regs values Date: Wed, 25 Sep 2024 05:38:23 +0100 Message-ID: <20240925043823.520218-2-alexey.klimov@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240925043823.520218-1-alexey.klimov@linaro.org> References: <20240925043823.520218-1-alexey.klimov@linaro.org> MIME-Version: 1.0 X-MailFrom: alexey.klimov@linaro.org 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: XYSJEWGQFFS7JH6O2MQLP3HE4QYCTB3D X-Message-ID-Hash: XYSJEWGQFFS7JH6O2MQLP3HE4QYCTB3D X-Mailman-Approved-At: Tue, 01 Oct 2024 12:35:06 +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: CDC_RX_BCL_VBAT_RF_PROC1 is listed twice and its default value is 0x2a which is overwriten by its next occurence in rx_defaults[]. The second one should be missing CDC_RX_BCL_VBAT_RF_PROC2 instead and its default value is expected 0x0. Signed-off-by: Alexey Klimov --- sound/soc/codecs/lpass-rx-macro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index 9288ddb705fe..2f6699c0a643 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -961,7 +961,7 @@ static const struct reg_default rx_defaults[] = { { CDC_RX_BCL_VBAT_PK_EST2, 0x01 }, { CDC_RX_BCL_VBAT_PK_EST3, 0x40 }, { CDC_RX_BCL_VBAT_RF_PROC1, 0x2A }, - { CDC_RX_BCL_VBAT_RF_PROC1, 0x00 }, + { CDC_RX_BCL_VBAT_RF_PROC2, 0x00 }, { CDC_RX_BCL_VBAT_TAC1, 0x00 }, { CDC_RX_BCL_VBAT_TAC2, 0x18 }, { CDC_RX_BCL_VBAT_TAC3, 0x18 },