From patchwork Tue Jan 16 09:38:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763064 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 6D832C47077 for ; Tue, 16 Jan 2024 09:40:29 +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 0E84D826; Tue, 16 Jan 2024 10:40:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0E84D826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398027; bh=nvWSTvevOskToEZpfEU2EEaPDtMjqucztV5vWpemT2E=; 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=lmdm+sVuxIYoCcSt2duzUdSqyBzuu2Kisqoms4L/a4CPw/rdaF+Op6dkXUTfRjOpI GNJgGo7T9apZwywixB1M1JcZAhDiKOpgafAbkxOLWrK8UmDJBNQK00ZD8dJqsTWMKK wr61TqHp25b1YRg16BF8vI7B0xdFv0T2/D4us8AY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 49224F80571; Tue, 16 Jan 2024 10:39:53 +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 4C3E5F8057E; Tue, 16 Jan 2024 10:39:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E8101F80520; Tue, 16 Jan 2024 10:39:47 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 436F9F80074 for ; Tue, 16 Jan 2024 10:39:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 436F9F80074 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=RKmoRJkw Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 3F7E5B80D7B; Tue, 16 Jan 2024 09:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F772C43390; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=nvWSTvevOskToEZpfEU2EEaPDtMjqucztV5vWpemT2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKmoRJkwvYt5VDdESK9KIx/LDj4F0E7M/8n1WuR0soKQjN424GIFu75fnOUmyxpvL zDStNl/RrkH00uMgg5wKY62Qycvcq9zeb7YceufvII03mCUVQJX1Zle4gPbYaJaMxZ xf6RVMgkxEBnYUsTIXVeyvj6RX2L/9bp1n3TUwVE/0fz6T/lTKpTyaFLR835+MnfJW 9IbXMLS+JW4uMHe+h+t/VKyq3RxgyupwdfJtSK3orD0H46iJurVPSqIhNP8Np/IOTX KkrwvpT9FVjeMRrMrUDT+0wA3sZ0vXdjal0qWQrj+QRgOGN3DZpfsuN+OkgfVCoQoo W6g9qL1HrlqAw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053R-0a; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/7] ASoC: qcom: sc8280xp: limit speaker volumes Date: Tue, 16 Jan 2024 10:38:57 +0100 Message-ID: <20240116093903.19403-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: 3YKT6OGC323MFLKBGMQJJ7R6D6XM5Y46 X-Message-ID-Hash: 3YKT6OGC323MFLKBGMQJJ7R6D6XM5Y46 X-MailFrom: johan+linaro@kernel.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 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: The current UCM configuration sets the speaker PA volume to 15 dB when enabling the speakers but this does not prevent the user from increasing the volume further. Limit the PA volume to 15 dB in the machine driver to reduce the risk of speaker damage until we have active speaker protection in place. Note that this will probably need to be generalised using machine-specific limits, but a common limit should do for now. Cc: stable@vger.kernel.org # 6.5 Signed-off-by: Johan Hovold Reviewed-by: Srinivas Kandagatla --- sound/soc/qcom/sc8280xp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index ed4bb551bfbb..aa43903421f5 100644 --- a/sound/soc/qcom/sc8280xp.c +++ b/sound/soc/qcom/sc8280xp.c @@ -32,12 +32,14 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) case WSA_CODEC_DMA_RX_0: case WSA_CODEC_DMA_RX_1: /* - * set limit of 0dB on Digital Volume for Speakers, - * this can prevent damage of speakers to some extent without - * active speaker protection + * Set limit of 0 dB on Digital Volume and 15 dB on PA Volume + * to reduce the risk of speaker damage until we have active + * speaker protection in place. */ snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84); snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84); + snd_soc_limit_volume(card, "SpkrLeft PA Volume", 12); + snd_soc_limit_volume(card, "SpkrRight PA Volume", 12); break; default: break; From patchwork Tue Jan 16 09:38:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763678 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 5AAE4C47077 for ; Tue, 16 Jan 2024 09:41:47 +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 96E6384A; Tue, 16 Jan 2024 10:41:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96E6384A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398105; bh=N8c8yQ8JoVaZ43ekrgFMJaI6nSmiX70JukNaBce+F1M=; 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=KeNTJ6tU1pR8cGqK358PsV0RpmGEEwFNKXX4YAS1XypEjnUc7j2HF3NjVLwQr1eIh BHzoROv90+SU4YXqgK/i+xe4EcwtEfVlB6kT0o/Dy0Wk619gNGTx0XES5Kib3R+ljr WHeGCxTe8F+owoIwD1MoJHUehKkqRBqMsPvByG1k= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E1FAEF80637; Tue, 16 Jan 2024 10:40:08 +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 F3B9AF8065E; Tue, 16 Jan 2024 10:40:07 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2501AF805E2; Tue, 16 Jan 2024 10:39:57 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 6FCB5F802E8 for ; Tue, 16 Jan 2024 10:39:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6FCB5F802E8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=hzZKRWMr Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E271C60C57; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CFEFC43394; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=N8c8yQ8JoVaZ43ekrgFMJaI6nSmiX70JukNaBce+F1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzZKRWMrHhV/16BojQ69j2BghzEVFFRdYyUQsp9ne6dQpadmkTlTbx6LxBT483wRm xDA1RCjOqZqOeb8D7WPBMXeUmEr/3z6qzsMYhBvuz2TZ2lsgL1xwFomapPg2QcNnan OTGBQem22S3QJ5C0gZUdmpIyeIdd8fsUi05I3wt0MqJc1xJpEQTCkg8UI11YOx60LI O4esH6VYlFUFOX1I57ZFeeC9ma3NFmTyINVkDozvRZY2rSqV595p/9q7iS8mkE4UMb KAnyQ0VYAmhNSRGjcVucA72rkvPu4TFzgB3HhyoB/c/InpqjOQhDMRFIgNrqKlmQ0G uoMcWnfQEsClg== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053T-0r; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/7] ASoC: codecs: lpass-wsa-macro: fix compander volume hack Date: Tue, 16 Jan 2024 10:38:58 +0100 Message-ID: <20240116093903.19403-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: D4N4Q3QGTV7SYKJAXKYVBM2TVOQSNJNK X-Message-ID-Hash: D4N4Q3QGTV7SYKJAXKYVBM2TVOQSNJNK X-MailFrom: johan+linaro@kernel.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 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: The LPASS WSA macro codec driver is updating the digital gain settings behind the back of user space on DAPM events if companding has been enabled. As compander control is exported to user space, this can result in the digital gain setting being incremented (or decremented) every time the sound server is started and the codec suspended depending on what the UCM configuration looks like. Soon enough playback will become distorted (or too quiet). This is specifically a problem on the Lenovo ThinkPad X13s as this bypasses the limit for the digital gain setting that has been set by the machine driver. Fix this by simply dropping the compander gain hack. If someone cares about modelling the impact of the compander setting this can possibly be done by exporting it as a volume control later. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route") Cc: stable@vger.kernel.org # 5.11 Cc: Srinivas Kandagatla Signed-off-by: Johan Hovold --- sound/soc/codecs/lpass-wsa-macro.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 7e21cec3c2fb..7de221464d47 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1583,8 +1583,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); u16 gain_reg; u16 reg; - int val; - int offset_val = 0; struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); if (w->shift == WSA_MACRO_COMP1) { @@ -1623,11 +1621,7 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, CDC_WSA_RX1_RX_PATH_MIX_SEC0, CDC_WSA_RX_PGA_HALF_DB_MASK, CDC_WSA_RX_PGA_HALF_DB_ENABLE); - offset_val = -2; } - val = snd_soc_component_read(component, gain_reg); - val += offset_val; - snd_soc_component_write(component, gain_reg, val); wsa_macro_config_ear_spkr_gain(component, wsa, event, gain_reg); break; @@ -1654,10 +1648,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, CDC_WSA_RX1_RX_PATH_MIX_SEC0, CDC_WSA_RX_PGA_HALF_DB_MASK, CDC_WSA_RX_PGA_HALF_DB_DISABLE); - offset_val = 2; - val = snd_soc_component_read(component, gain_reg); - val += offset_val; - snd_soc_component_write(component, gain_reg, val); } wsa_macro_config_ear_spkr_gain(component, wsa, event, gain_reg); From patchwork Tue Jan 16 09:38:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763062 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 0BE51C4706C for ; Tue, 16 Jan 2024 09:41: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 25AA6202; Tue, 16 Jan 2024 10:41:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 25AA6202 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398093; bh=mnsvv8nLXcpID7aeu/iuGLMoF7xZR5DEBr8yX7bAx7k=; 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=LqdBimi+sCfDvvDEGH7te0vVeEkBFT8eB71ROJuIBpZP2/0s5XJnXH1ndX5LdeqfL aGNAJmJpoulCxZpJCkTqN5R2CQvaMfiSftw3KSokpdfYk+3C1rbbkg8VV5aRNHVekI Oq18GvOtxLm8n0GhhgdblBOP9oAF7jLanzI+yVaQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5B2C1F80635; Tue, 16 Jan 2024 10:40:05 +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 0961FF8062D; Tue, 16 Jan 2024 10:40:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 421C2F805E0; Tue, 16 Jan 2024 10:39:56 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 6DCA9F802BE for ; Tue, 16 Jan 2024 10:39:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6DCA9F802BE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=srMWK9ab Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B6C1761164; Tue, 16 Jan 2024 09:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E34AC43330; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=mnsvv8nLXcpID7aeu/iuGLMoF7xZR5DEBr8yX7bAx7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srMWK9ab1BIYiHFwgI2B2+w1VwIwAs5MRYycieUR/UqX2/NlVT1DqOvkuvQZFwuI2 1NZ2CkD1LX+bjLz1x75526r3oggFIXzPzVbwpcvY8bkZ0enYTmIiSJkDxokVwWjG96 U8HrIVW/M0I9DB0vq0SxvTqBaZlewFzpm4DPwn9aF4cZIbXdETXpbmRThEmHC30v9M ShVnMrj0oKVqRsfmLodGn59RPmz1aySjA3HTv9m5vGaUYvA9juNQGy+SiIkvVfMiUn kfR3DcAi1pqcnjGTyglSKBEL70kFgKP0vqpqlwVChEWtub2LLiFsNMzCWuTg8UmEEI yt2hpY6514q5Q== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053V-18; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/7] ASoC: codecs: lpass-wsa-macro: drop dead mixer-path gain hack Date: Tue, 16 Jan 2024 10:38:59 +0100 Message-ID: <20240116093903.19403-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: KNS2TT67ESLFRZOI5U4DRJWZQZTQQQRR X-Message-ID-Hash: KNS2TT67ESLFRZOI5U4DRJWZQZTQQQRR X-MailFrom: johan+linaro@kernel.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 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: The vendor driver modifies the gain settings behind the back of user space but some of these hacks never made it upstream except for some essentially dead code that reads out the (cached) gain setting and writes it back again on DAPM events. Drop the incomplete and pointless hack when enabling mixer paths. Signed-off-by: Johan Hovold --- sound/soc/codecs/lpass-wsa-macro.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 7de221464d47..36a8f1980c6e 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1220,27 +1220,20 @@ static int wsa_macro_enable_mix_path(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - u16 path_reg, gain_reg; - int val; + u16 path_reg; switch (w->shift) { case WSA_MACRO_RX_MIX0: path_reg = CDC_WSA_RX0_RX_PATH_MIX_CTL; - gain_reg = CDC_WSA_RX0_RX_VOL_MIX_CTL; break; case WSA_MACRO_RX_MIX1: path_reg = CDC_WSA_RX1_RX_PATH_MIX_CTL; - gain_reg = CDC_WSA_RX1_RX_VOL_MIX_CTL; break; default: return 0; } switch (event) { - case SND_SOC_DAPM_POST_PMU: - val = snd_soc_component_read(component, gain_reg); - snd_soc_component_write(component, gain_reg, val); - break; case SND_SOC_DAPM_POST_PMD: snd_soc_component_update_bits(component, path_reg, CDC_WSA_RX_PATH_MIX_CLK_EN_MASK, From patchwork Tue Jan 16 09:39:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763680 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 C6237C4706C for ; Tue, 16 Jan 2024 09:40:39 +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 0D75484D; Tue, 16 Jan 2024 10:40:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0D75484D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398038; bh=Bedn57ruaI8vaei65DA95W6x7hJEXXYsGj9Dv4JJWYU=; 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=M4u1hlwiRrTRtu8VNhC09hzYqxvzxdqlJFHh9jyHZwRuA8uPjQgJQkS1xAJCjTLAO u8z9+AdlFYochuNdwds3VCKw21BTcNMFioMM34GjGANcgQmiderbkYuo7K56D0hCcg Ty3nrGrccMGeDwe5tYP1QR40bcuxBgTKstRJvHAs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 149E2F805C9; Tue, 16 Jan 2024 10:39:56 +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 35543F805C3; Tue, 16 Jan 2024 10:39:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE716F804F1; Tue, 16 Jan 2024 10:39:49 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 A7F2DF800F5 for ; Tue, 16 Jan 2024 10:39:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A7F2DF800F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ajxrKBJf Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 3E4F3B80D7A; Tue, 16 Jan 2024 09:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89D27C433F1; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=Bedn57ruaI8vaei65DA95W6x7hJEXXYsGj9Dv4JJWYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ajxrKBJf6arEbXQ5f+gdeuNkpLXGzIqLvQQdw3sG/5LMMyliy+LcghBsTF1EmTMtB 5Z7z/GsF1PxKqo92QXGMQ05T80pQuspKYoSFy3mtMbnt2o/3fEkEvSTvwZ60yXEib7 nxbFZd6eZ4h+bK3isUAyFF5Q4FyHOibE7cmAoYm5DxtHSgKqAkieC0L4RK6qbG3AaP ldSM62IlYcOAGnhYSzL3dzYgjgW72qEXrjl2E1+z0Ke5XDzPavveJUnMR6zzUskjId i1nJQL3AwaodK1RWP5qBFz0PLi5X4p/h7AuY0jZFBp+uQnpo0YyLOKZDKU3ILT1tdH nOh4DZwqHYJGA== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053X-1Q; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/7] ASoC: codecs: lpass-rx-macro: drop dead mixer-path gain hack Date: Tue, 16 Jan 2024 10:39:00 +0100 Message-ID: <20240116093903.19403-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: IO7CIY6GHLACDBZXV4XIPL6AK4PQIBP4 X-Message-ID-Hash: IO7CIY6GHLACDBZXV4XIPL6AK4PQIBP4 X-MailFrom: johan+linaro@kernel.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 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: The vendor driver modifies the gain settings behind the back of user space but some of these hacks never made it upstream except for some essentially dead code that reads out the (cached) gain setting and writes it back again on DAPM events. Drop the incomplete and pointless hack when enabling mixer paths. Signed-off-by: Johan Hovold --- sound/soc/codecs/lpass-rx-macro.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index f35187d69cac..b1ec41eed851 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -1956,10 +1956,9 @@ static int rx_macro_enable_main_path(struct snd_soc_dapm_widget *w, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - u16 gain_reg, reg; + u16 reg; reg = CDC_RX_RXn_RX_PATH_CTL(w->shift); - gain_reg = CDC_RX_RXn_RX_VOL_CTL(w->shift); switch (event) { case SND_SOC_DAPM_PRE_PMU: @@ -1969,10 +1968,6 @@ static int rx_macro_enable_main_path(struct snd_soc_dapm_widget *w, CDC_RX_PATH_CLK_EN_MASK, CDC_RX_PATH_CLK_ENABLE); break; - case SND_SOC_DAPM_POST_PMU: - snd_soc_component_write(component, gain_reg, - snd_soc_component_read(component, gain_reg)); - break; case SND_SOC_DAPM_POST_PMD: rx_macro_enable_interp_clk(component, event, w->shift); break; @@ -3031,16 +3026,13 @@ static const struct snd_soc_dapm_widget rx_macro_dapm_widgets[] = { SND_SOC_DAPM_MUX_E("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_HPHL, 0, &rx_int0_1_interp_mux, rx_macro_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT1_1 INTERP", SND_SOC_NOPM, INTERP_HPHR, 0, &rx_int1_1_interp_mux, rx_macro_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT2_1 INTERP", SND_SOC_NOPM, INTERP_AUX, 0, &rx_int2_1_interp_mux, rx_macro_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX("RX INT0_2 INTERP", SND_SOC_NOPM, 0, 0, &rx_int0_2_interp_mux), From patchwork Tue Jan 16 09:39:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763679 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 08443C4706C for ; Tue, 16 Jan 2024 09:41:18 +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 740D6202; Tue, 16 Jan 2024 10:41:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 740D6202 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398076; bh=zy0of3fiWEQpkb5cR6+C9zbsHyiHSObthcRpranYgEM=; 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=m7d1UyovdxqJ6OtUhrrXXSEK3mhpJkN1i/xuE52voeP20GciUc+ndkqxAkgrROAeF pvePvQvknON+n+X0LzYw1uK1xBA8GSMMoVQ0J8J8PhYXeZGx244QTw5go1YTCy5z8b tS31mI3sLwt1Zjwg5fktkSdnxb8HCJk4dtiL0jkY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D014EF80613; Tue, 16 Jan 2024 10:40:02 +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 1CDECF80613; Tue, 16 Jan 2024 10:40:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 71A0AF805B0; Tue, 16 Jan 2024 10:39:55 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4606DF80236 for ; Tue, 16 Jan 2024 10:39:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4606DF80236 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=tzBYrmhH Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 333AAB80D7C; Tue, 16 Jan 2024 09:39:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BDDDC433A6; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=zy0of3fiWEQpkb5cR6+C9zbsHyiHSObthcRpranYgEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzBYrmhHNQ9FbwAfpOgdV2girOOMUrZHZkXo4+L4HL6C/7+tYfaT01D3wJbYNEBPe l6DfjzK6JTqmSxdlM3tGOJ0EjpbidJNk+QkCGHA+RthaUscsh3zawJlybGJ2gXNEm/ +kOA2yPMwxGGgJpeBdwGbtatljI/DdNUV+flNDwh54z/XKB3XsbLtOY+9uwtQ0UOAS 4AZ72mLrerhBDVgkkKXWEoZDyz049GYnHwdD1QGDkYJ0ggK0uNTwcS1Jdqeobuotnm VkiPjyMAWnJVaZU/1liOgR6gebXldhxpxzn3ufVhUzIYoMaSRq0ZvCfAsTrscJhgHi Kt0HViBoXxoDw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053Z-1g; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 5/7] ASoC: codecs: wcd9335: drop dead gain hacks Date: Tue, 16 Jan 2024 10:39:01 +0100 Message-ID: <20240116093903.19403-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: QXLTM2LGCWO767B2Q5HOSTKPKSWDFJPC X-Message-ID-Hash: QXLTM2LGCWO767B2Q5HOSTKPKSWDFJPC X-MailFrom: johan+linaro@kernel.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 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: The vendor driver appears to be modifying the gain settings behind the back of user space but these hacks never made it upstream except for some essentially dead code that reads out the (cached) gain setting and writes it back again on DAPM events. Drop these incomplete and pointless hacks. Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd9335.c | 115 ++++++------------------------------- 1 file changed, 18 insertions(+), 97 deletions(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 43c648efd0d9..cee17b309160 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -3028,61 +3028,6 @@ static int wcd9335_codec_enable_slim(struct snd_soc_dapm_widget *w, return 0; } -static int wcd9335_codec_enable_mix_path(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kc, int event) -{ - struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); - u16 gain_reg; - int offset_val = 0; - int val = 0; - - switch (w->reg) { - case WCD9335_CDC_RX0_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX0_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX1_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX1_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX2_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX2_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX3_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX3_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX4_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX4_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX5_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX5_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX6_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX6_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX7_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX7_RX_VOL_MIX_CTL; - break; - case WCD9335_CDC_RX8_RX_PATH_MIX_CTL: - gain_reg = WCD9335_CDC_RX8_RX_VOL_MIX_CTL; - break; - default: - dev_err(comp->dev, "%s: No gain register avail for %s\n", - __func__, w->name); - return 0; - } - - switch (event) { - case SND_SOC_DAPM_POST_PMU: - val = snd_soc_component_read(comp, gain_reg); - val += offset_val; - snd_soc_component_write(comp, gain_reg, val); - break; - case SND_SOC_DAPM_POST_PMD: - break; - } - - return 0; -} - static u16 wcd9335_interp_get_primary_reg(u16 reg, u16 *ind) { u16 prim_int_reg = WCD9335_CDC_RX0_RX_PATH_CTL; @@ -3291,38 +3236,26 @@ static int wcd9335_codec_enable_interpolator(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kc, int event) { struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); - u16 gain_reg; u16 reg; - int val; - int offset_val = 0; if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT0 INTERP"))) { reg = WCD9335_CDC_RX0_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX0_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT1 INTERP"))) { reg = WCD9335_CDC_RX1_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX1_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT2 INTERP"))) { reg = WCD9335_CDC_RX2_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX2_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT3 INTERP"))) { reg = WCD9335_CDC_RX3_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX3_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT4 INTERP"))) { reg = WCD9335_CDC_RX4_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX4_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT5 INTERP"))) { reg = WCD9335_CDC_RX5_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX5_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT6 INTERP"))) { reg = WCD9335_CDC_RX6_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX6_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT7 INTERP"))) { reg = WCD9335_CDC_RX7_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX7_RX_VOL_CTL; } else if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT8 INTERP"))) { reg = WCD9335_CDC_RX8_RX_PATH_CTL; - gain_reg = WCD9335_CDC_RX8_RX_VOL_CTL; } else { dev_err(comp->dev, "%s: Interpolator reg not found\n", __func__); @@ -3336,9 +3269,6 @@ static int wcd9335_codec_enable_interpolator(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMU: wcd9335_config_compander(comp, w->shift, event); - val = snd_soc_component_read(comp, gain_reg); - val += offset_val; - snd_soc_component_write(comp, gain_reg, val); break; case SND_SOC_DAPM_POST_PMD: wcd9335_config_compander(comp, w->shift, event); @@ -4367,33 +4297,24 @@ static const struct snd_soc_dapm_widget wcd9335_dapm_widgets[] = { SND_SOC_DAPM_MIXER("SLIM RX5", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER("SLIM RX6", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_MIXER("SLIM RX7", SND_SOC_NOPM, 0, 0, NULL, 0), - SND_SOC_DAPM_MUX_E("RX INT0_2 MUX", WCD9335_CDC_RX0_RX_PATH_MIX_CTL, - 5, 0, &rx_int0_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT1_2 MUX", WCD9335_CDC_RX1_RX_PATH_MIX_CTL, - 5, 0, &rx_int1_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT2_2 MUX", WCD9335_CDC_RX2_RX_PATH_MIX_CTL, - 5, 0, &rx_int2_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT3_2 MUX", WCD9335_CDC_RX3_RX_PATH_MIX_CTL, - 5, 0, &rx_int3_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT4_2 MUX", WCD9335_CDC_RX4_RX_PATH_MIX_CTL, - 5, 0, &rx_int4_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT5_2 MUX", WCD9335_CDC_RX5_RX_PATH_MIX_CTL, - 5, 0, &rx_int5_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT6_2 MUX", WCD9335_CDC_RX6_RX_PATH_MIX_CTL, - 5, 0, &rx_int6_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT7_2 MUX", WCD9335_CDC_RX7_RX_PATH_MIX_CTL, - 5, 0, &rx_int7_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), - SND_SOC_DAPM_MUX_E("RX INT8_2 MUX", WCD9335_CDC_RX8_RX_PATH_MIX_CTL, - 5, 0, &rx_int8_2_mux, wcd9335_codec_enable_mix_path, - SND_SOC_DAPM_POST_PMU), + SND_SOC_DAPM_MUX("RX INT0_2 MUX", WCD9335_CDC_RX0_RX_PATH_MIX_CTL, + 5, 0, &rx_int0_2_mux), + SND_SOC_DAPM_MUX("RX INT1_2 MUX", WCD9335_CDC_RX1_RX_PATH_MIX_CTL, + 5, 0, &rx_int1_2_mux), + SND_SOC_DAPM_MUX("RX INT2_2 MUX", WCD9335_CDC_RX2_RX_PATH_MIX_CTL, + 5, 0, &rx_int2_2_mux), + SND_SOC_DAPM_MUX("RX INT3_2 MUX", WCD9335_CDC_RX3_RX_PATH_MIX_CTL, + 5, 0, &rx_int3_2_mux), + SND_SOC_DAPM_MUX("RX INT4_2 MUX", WCD9335_CDC_RX4_RX_PATH_MIX_CTL, + 5, 0, &rx_int4_2_mux), + SND_SOC_DAPM_MUX("RX INT5_2 MUX", WCD9335_CDC_RX5_RX_PATH_MIX_CTL, + 5, 0, &rx_int5_2_mux), + SND_SOC_DAPM_MUX("RX INT6_2 MUX", WCD9335_CDC_RX6_RX_PATH_MIX_CTL, + 5, 0, &rx_int6_2_mux), + SND_SOC_DAPM_MUX("RX INT7_2 MUX", WCD9335_CDC_RX7_RX_PATH_MIX_CTL, + 5, 0, &rx_int7_2_mux), + SND_SOC_DAPM_MUX("RX INT8_2 MUX", WCD9335_CDC_RX8_RX_PATH_MIX_CTL, + 5, 0, &rx_int8_2_mux), SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp0_mux), SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP1", SND_SOC_NOPM, 0, 0, From patchwork Tue Jan 16 09:39:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763677 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 F0599C4706C for ; Tue, 16 Jan 2024 09:42:22 +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 10E75950; Tue, 16 Jan 2024 10:42:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 10E75950 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398141; bh=giZJPjzHIAgbfcWBFZIpouzW5e8CYSbpzSOMlA3D6XM=; 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=oDVsYPDCY9Tj/BEvbSwfmcNhk61Yjl2zpLH1gSp0ll4gLkVFo62JKkywi3cUJQe19 479xpLVJPFHLQ5RJ9xMe3CfWUZt7RaqFM8TZX7CLh4nSVJVVdzPntQwjqj3UPbDXyb VRVl6f2fDH8BQ2HQSVVS5FhEjMaAluc/pGeVial8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 13DACF806C7; Tue, 16 Jan 2024 10:40:12 +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 57FF9F806BC; Tue, 16 Jan 2024 10:40:12 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 74ABCF805ED; Tue, 16 Jan 2024 10:39:58 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 98602F8028D for ; Tue, 16 Jan 2024 10:39:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 98602F8028D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=jlvOdhA0 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9987B6114A; Tue, 16 Jan 2024 09:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9666AC433B1; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=giZJPjzHIAgbfcWBFZIpouzW5e8CYSbpzSOMlA3D6XM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlvOdhA0zQtwZG5lzcUOSlPuXQDc/qCeZA8RaccbofgGVxpFhv6Q5rwq1FUwI/Jy8 oXAZj8+b2auxyE/HJrTlvLXK+r5Kie1TVZUQKq6sMTz90IZgs42pLF70ki/9ZrdDPB /Gqc6aY0tBhyCJV3OOoKZkgEmw11C38GjUaprBbJw7cSuHK8KDixDHhqdiMSK4RyfJ ZGEWfbnXGVgGjBBtFYjcSIxHU8vYdsBxqs6BuMs/DZdNOcL2ANf6+z9eMRUNznUZj5 8bMq//F8nOLHX7PWBy/9CpglUpYXxWrZ07+nbyWKXjEeit6pzR98pEFaXc1so7e6NV Y7+Qgcj+Ce06Q== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053b-1y; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 6/7] ASoC: codecs: wcd934x: drop dead gain hacks Date: Tue, 16 Jan 2024 10:39:02 +0100 Message-ID: <20240116093903.19403-7-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: 4WUPIFD5EL7IRKWDON5BOAL67JBVMO3T X-Message-ID-Hash: 4WUPIFD5EL7IRKWDON5BOAL67JBVMO3T X-MailFrom: johan+linaro@kernel.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 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: The vendor driver appears to be modifying the gain settings behind the back of user space but these hacks never made it upstream except for some essentially dead code that reads out the gain and writes it back again on DAPM events. Drop these incomplete and pointless hacks. Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd934x.c | 102 ++++++++----------------------------- 1 file changed, 22 insertions(+), 80 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 1b6e376f3833..34e97d39a146 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -4357,12 +4357,8 @@ static int wcd934x_codec_enable_mix_path(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kc, int event) { struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); - int offset_val = 0; - u16 gain_reg, mix_reg; - int val = 0; + u16 mix_reg; - gain_reg = WCD934X_CDC_RX0_RX_VOL_MIX_CTL + - (w->shift * WCD934X_RX_PATH_CTL_OFFSET); mix_reg = WCD934X_CDC_RX0_RX_PATH_MIX_CTL + (w->shift * WCD934X_RX_PATH_CTL_OFFSET); @@ -4373,12 +4369,6 @@ static int wcd934x_codec_enable_mix_path(struct snd_soc_dapm_widget *w, WCD934X_CDC_RX_MIX_CLK_EN_MASK, WCD934X_CDC_RX_MIX_CLK_ENABLE); break; - - case SND_SOC_DAPM_POST_PMU: - val = snd_soc_component_read(comp, gain_reg); - val += offset_val; - snd_soc_component_write(comp, gain_reg, val); - break; } return 0; @@ -4418,26 +4408,6 @@ static int wcd934x_codec_set_iir_gain(struct snd_soc_dapm_widget *w, return 0; } -static int wcd934x_codec_enable_main_path(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, - int event) -{ - struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); - u16 gain_reg; - - gain_reg = WCD934X_CDC_RX0_RX_VOL_CTL + (w->shift * - WCD934X_RX_PATH_CTL_OFFSET); - - switch (event) { - case SND_SOC_DAPM_POST_PMU: - snd_soc_component_write(comp, gain_reg, - snd_soc_component_read(comp, gain_reg)); - break; - } - - return 0; -} - static int wcd934x_codec_ear_dac_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kc, int event) { @@ -5238,32 +5208,25 @@ static const struct snd_soc_dapm_widget wcd934x_dapm_widgets[] = { SND_SOC_DAPM_MUX_E("RX INT0_2 MUX", SND_SOC_NOPM, INTERP_EAR, 0, &rx_int0_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT1_2 MUX", SND_SOC_NOPM, INTERP_HPHL, 0, &rx_int1_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT2_2 MUX", SND_SOC_NOPM, INTERP_HPHR, 0, &rx_int2_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT3_2 MUX", SND_SOC_NOPM, INTERP_LO1, 0, &rx_int3_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT4_2 MUX", SND_SOC_NOPM, INTERP_LO2, 0, &rx_int4_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT7_2 MUX", SND_SOC_NOPM, INTERP_SPKR1, 0, &rx_int7_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX_E("RX INT8_2 MUX", SND_SOC_NOPM, INTERP_SPKR2, 0, &rx_int8_2_mux, wcd934x_codec_enable_mix_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX("RX INT0_1 MIX1 INP0", SND_SOC_NOPM, 0, 0, &rx_int0_1_mix_inp0_mux), @@ -5389,41 +5352,20 @@ static const struct snd_soc_dapm_widget wcd934x_dapm_widgets[] = { SND_SOC_DAPM_MUX("RX INT2 DEM MUX", SND_SOC_NOPM, 0, 0, &rx_int2_dem_inp_mux), - SND_SOC_DAPM_MUX_E("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_EAR, 0, - &rx_int0_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_MUX_E("RX INT1_1 INTERP", SND_SOC_NOPM, INTERP_HPHL, 0, - &rx_int1_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_MUX_E("RX INT2_1 INTERP", SND_SOC_NOPM, INTERP_HPHR, 0, - &rx_int2_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_MUX_E("RX INT3_1 INTERP", SND_SOC_NOPM, INTERP_LO1, 0, - &rx_int3_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_MUX_E("RX INT4_1 INTERP", SND_SOC_NOPM, INTERP_LO2, 0, - &rx_int4_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_MUX_E("RX INT7_1 INTERP", SND_SOC_NOPM, INTERP_SPKR1, 0, - &rx_int7_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_MUX_E("RX INT8_1 INTERP", SND_SOC_NOPM, INTERP_SPKR2, 0, - &rx_int8_1_interp_mux, - wcd934x_codec_enable_main_path, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_MUX("RX INT0_1 INTERP", SND_SOC_NOPM, INTERP_EAR, 0, + &rx_int0_1_interp_mux), + SND_SOC_DAPM_MUX("RX INT1_1 INTERP", SND_SOC_NOPM, INTERP_HPHL, 0, + &rx_int1_1_interp_mux), + SND_SOC_DAPM_MUX("RX INT2_1 INTERP", SND_SOC_NOPM, INTERP_HPHR, 0, + &rx_int2_1_interp_mux), + SND_SOC_DAPM_MUX("RX INT3_1 INTERP", SND_SOC_NOPM, INTERP_LO1, 0, + &rx_int3_1_interp_mux), + SND_SOC_DAPM_MUX("RX INT4_1 INTERP", SND_SOC_NOPM, INTERP_LO2, 0, + &rx_int4_1_interp_mux), + SND_SOC_DAPM_MUX("RX INT7_1 INTERP", SND_SOC_NOPM, INTERP_SPKR1, 0, + &rx_int7_1_interp_mux), + SND_SOC_DAPM_MUX("RX INT8_1 INTERP", SND_SOC_NOPM, INTERP_SPKR2, 0, + &rx_int8_1_interp_mux), SND_SOC_DAPM_MUX("RX INT0_2 INTERP", SND_SOC_NOPM, 0, 0, &rx_int0_2_interp_mux), From patchwork Tue Jan 16 09:39:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 763063 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 40FF2C4706C for ; Tue, 16 Jan 2024 09:40:59 +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 69AFC84A; Tue, 16 Jan 2024 10:40:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 69AFC84A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1705398057; bh=oXGwkRr+pTlA9URBIwOHy4z7wRIJRjTwPvC7AmtNWLg=; 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=gczLg6o8vfypc4B84mJzBOefRUkLqyK6zYrzKHiIZpFJaWM5LLcgUC+FKiREuiW3Y xBSI+LiETZgRSHad7V35otkOPCCzkdPye47T/mlXDm2GlTNLlmsjjYhZ8865VOPjN1 2zJNMJiK82lwzfqpCDcEcty+7V73VyLrGTgMRWu0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 71A78F805EA; Tue, 16 Jan 2024 10:39:58 +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 7BA28F805F1; Tue, 16 Jan 2024 10:39:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BD5F1F804E7; Tue, 16 Jan 2024 10:39:51 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3AB27F8014B for ; Tue, 16 Jan 2024 10:39:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3AB27F8014B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=UEFze6N4 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id A322DB80D53; Tue, 16 Jan 2024 09:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F57C43399; Tue, 16 Jan 2024 09:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705397981; bh=oXGwkRr+pTlA9URBIwOHy4z7wRIJRjTwPvC7AmtNWLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UEFze6N4PSjBVOpIiLLK/f83TnQUY8KnW+bXk41i5ZwRMx+uL92kX5IrTEkGBUvAZ CCPGl+2c8pglScIUg6cfgA5+RVown6mGlOndo3JKfwERmpNyzCcqVuQANikyw/a6BB ym6vhp3tGMM0RUJGqmnYHp57oi88a7wf1zV1EeZN8VvpxvOPvUxeJcq0ajXBoXV9mF Vl+dKHikM3b9KW8Im9pckTXN3V0a3ctomNYM0ARsPmZHIAYY2bwn/eJrZHRNEI22pA AlLgkGD7gGuJZ+/lAyKt7GuVs+xwmUIoT6zrAyfXy8K+IcIXJgDJ6hR51lNpEcPfiI JbteXyN7ybXww== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rPfv6-00053d-2G; Tue, 16 Jan 2024 10:39:44 +0100 From: Johan Hovold To: Mark Brown Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 7/7] ASoC: codecs: msm8916-wcd-digital: drop dead gain hacks Date: Tue, 16 Jan 2024 10:39:03 +0100 Message-ID: <20240116093903.19403-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240116093903.19403-1-johan+linaro@kernel.org> References: <20240116093903.19403-1-johan+linaro@kernel.org> MIME-Version: 1.0 Message-ID-Hash: DSEZOVON3YPLEXSEGDNLF7QOGWXJP5CU X-Message-ID-Hash: DSEZOVON3YPLEXSEGDNLF7QOGWXJP5CU X-MailFrom: johan+linaro@kernel.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 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: The vendor driver appears to be modifying the gain settings behind the back of user space but these hacks never made it upstream except for some essentially dead code that reads out the (cached) gain setting and writes it back again on DAPM events. Drop these incomplete and pointless hacks. Note that seemingly related 10 ms delay after enabling the interpolator is removed in the process. Signed-off-by: Johan Hovold --- sound/soc/codecs/msm8916-wcd-digital.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c index 978c4d056e81..f73731aa4b58 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c @@ -228,17 +228,6 @@ struct msm8916_wcd_digital_priv { struct clk *ahbclk, *mclk; }; -static const unsigned long rx_gain_reg[] = { - LPASS_CDC_RX1_VOL_CTL_B2_CTL, - LPASS_CDC_RX2_VOL_CTL_B2_CTL, - LPASS_CDC_RX3_VOL_CTL_B2_CTL, -}; - -static const unsigned long tx_gain_reg[] = { - LPASS_CDC_TX1_VOL_CTL_GAIN, - LPASS_CDC_TX2_VOL_CTL_GAIN, -}; - static const char *const rx_mix1_text[] = { "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3" }; @@ -580,12 +569,6 @@ static int msm8916_wcd_digital_enable_interpolator( struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); switch (event) { - case SND_SOC_DAPM_POST_PMU: - /* apply the digital gain after the interpolator is enabled */ - usleep_range(10000, 10100); - snd_soc_component_write(component, rx_gain_reg[w->shift], - snd_soc_component_read(component, rx_gain_reg[w->shift])); - break; case SND_SOC_DAPM_POST_PMD: snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL, 1 << w->shift, 1 << w->shift); @@ -630,9 +613,6 @@ static int msm8916_wcd_digital_enable_dec(struct snd_soc_dapm_widget *w, snd_soc_component_update_bits(component, tx_mux_ctl_reg, TX_MUX_CTL_HPF_BP_SEL_MASK, TX_MUX_CTL_HPF_BP_SEL_NO_BYPASS); - /* apply the digital gain after the decimator is enabled */ - snd_soc_component_write(component, tx_gain_reg[w->shift], - snd_soc_component_read(component, tx_gain_reg[w->shift])); snd_soc_component_update_bits(component, tx_vol_ctl_reg, TX_VOL_CTL_CFG_MUTE_EN_MASK, 0); break; @@ -739,13 +719,13 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = { /* Interpolator */ SND_SOC_DAPM_MIXER_E("RX1 INT", LPASS_CDC_CLK_RX_B1_CTL, 0, 0, NULL, 0, msm8916_wcd_digital_enable_interpolator, - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MIXER_E("RX2 INT", LPASS_CDC_CLK_RX_B1_CTL, 1, 0, NULL, 0, msm8916_wcd_digital_enable_interpolator, - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MIXER_E("RX3 INT", LPASS_CDC_CLK_RX_B1_CTL, 2, 0, NULL, 0, msm8916_wcd_digital_enable_interpolator, - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX("RX1 MIX1 INP1", SND_SOC_NOPM, 0, 0, &rx_mix1_inp1_mux), SND_SOC_DAPM_MUX("RX1 MIX1 INP2", SND_SOC_NOPM, 0, 0,