From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Jonathan Marek <jonathan@marek.ca>, linux-arm-msm@vger.kernel.org
Cc: Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
"open list:QCOM AUDIO (ASoC) DRIVERS"
<linux-sound@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 9/9] ASoC: codecs: lpass-rx-macro: fix mute_stream affecting all paths
Date: Wed, 19 Nov 2025 15:33:21 +0000 [thread overview]
Message-ID: <2075e642-9976-49a8-a148-3a6fa113e66c@oss.qualcomm.com> (raw)
In-Reply-To: <20251117051523.16462-9-jonathan@marek.ca>
On 11/17/25 5:15 AM, Jonathan Marek wrote:
> The current mute_steam() implementation affects all paths instead of
> only those in use by the DAI.
>
> For example, playing to 2 DAIs simultaneously with mixing, stopping
> one will mute the other.
>
> Rework to use the same logic as hw_params() to mute only the relevant paths.
> (also, use "rx->main_clk_users[j] > 0" instead of dsm_reg, which is
> equivalent. I also don't think the clock enable should be in this function,
> but that's a change for another patch)
I agree, we can move the clk to a widget.
>
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
patch looks sane to me,
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
> sound/soc/codecs/lpass-rx-macro.c | 74 +++++++++++++++----------------
> 1 file changed, 35 insertions(+), 39 deletions(-)
>
> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
> index a8fc842cc94ef..d7e51f02a9115 100644
> --- a/sound/soc/codecs/lpass-rx-macro.c
> +++ b/sound/soc/codecs/lpass-rx-macro.c
> @@ -1905,52 +1905,48 @@ static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
> {
> struct snd_soc_component *component = dai->component;
> struct rx_macro *rx = snd_soc_component_get_drvdata(component);
> - uint16_t j, reg, mix_reg, dsm_reg;
> - u16 int_mux_cfg0, int_mux_cfg1;
> + u32 port, j, reg, mix_reg, int_mux_cfg0, int_mux_cfg1;
> + u32 mask, val;
> u8 int_mux_cfg0_val, int_mux_cfg1_val;
>
> - switch (dai->id) {
> - case RX_MACRO_AIF1_PB:
> - case RX_MACRO_AIF2_PB:
> - case RX_MACRO_AIF3_PB:
> - case RX_MACRO_AIF4_PB:
> - for (j = 0; j < INTERP_MAX; j++) {
> - reg = CDC_RX_RXn_RX_PATH_CTL(rx, j);
> - mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j);
> - dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, j);
> -
> - if (mute) {
> - snd_soc_component_update_bits(component, reg,
> - CDC_RX_PATH_PGA_MUTE_MASK,
> - CDC_RX_PATH_PGA_MUTE_ENABLE);
> - snd_soc_component_update_bits(component, mix_reg,
> - CDC_RX_PATH_PGA_MUTE_MASK,
> - CDC_RX_PATH_PGA_MUTE_ENABLE);
> - } else {
> - snd_soc_component_update_bits(component, reg,
> - CDC_RX_PATH_PGA_MUTE_MASK, 0x0);
> - snd_soc_component_update_bits(component, mix_reg,
> - CDC_RX_PATH_PGA_MUTE_MASK, 0x0);
> + if (stream != SNDRV_PCM_STREAM_PLAYBACK)
> + return 0;
> +
> + for (j = 0; j < INTERP_MAX; j++) {
> + reg = CDC_RX_RXn_RX_PATH_CTL(rx, j);
> + mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j);
> +
> + mask = CDC_RX_PATH_PGA_MUTE_MASK;
> + val = 0;
> + if (mute)
> + val |= CDC_RX_PATH_PGA_MUTE_ENABLE;
> + if (rx->main_clk_users[j] > 0) {
> + mask |= CDC_RX_PATH_CLK_EN_MASK;
> + val |= CDC_RX_PATH_CLK_ENABLE;
> + }
> +
> + int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8;
> + int_mux_cfg1 = int_mux_cfg0 + 4;
> + int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0);
> + int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1);
> +
> + for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) {
> + if (((int_mux_cfg0_val & 0x0f) == port + INTn_1_INP_SEL_RX0) ||
> + ((int_mux_cfg0_val >> 4) == port + INTn_1_INP_SEL_RX0) ||
> + ((int_mux_cfg1_val >> 4) == port + INTn_1_INP_SEL_RX0)) {
> + snd_soc_component_update_bits(component, reg, mask, val);
> }
>
> - int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8;
> - int_mux_cfg1 = int_mux_cfg0 + 4;
> - int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0);
> - int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1);
> -
> - if (snd_soc_component_read(component, dsm_reg) & 0x01) {
> - if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0))
> - snd_soc_component_update_bits(component, reg, 0x20, 0x20);
> - if (int_mux_cfg1_val & 0x0F) {
> - snd_soc_component_update_bits(component, reg, 0x20, 0x20);
> - snd_soc_component_update_bits(component, mix_reg, 0x20,
> - 0x20);
> + if ((int_mux_cfg1_val & 0x0f) == port + INTn_2_INP_SEL_RX0) {
> + snd_soc_component_update_bits(component, mix_reg, mask, val);
> + /* main clock needs to be enabled for mix to be useful: */
> + if (rx->main_clk_users[j] > 0) {
> + snd_soc_component_update_bits(component, reg,
> + CDC_RX_PATH_CLK_EN_MASK,
> + CDC_RX_PATH_CLK_ENABLE);
> }
> }
> }
> - break;
> - default:
> - break;
> }
> return 0;
> }
next prev parent reply other threads:[~2025-11-19 15:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 5:15 [PATCH 1/9] ASoC: codecs: lpass-wsa-macro: remove unnecessary bounds check Jonathan Marek
2025-11-17 5:15 ` [PATCH 2/9] ASoC: codecs: lpass-wsa-macro: remove useless gain read/write sequence Jonathan Marek
2025-11-19 15:36 ` Srinivas Kandagatla
2025-11-19 15:36 ` Srinivas Kandagatla
2025-11-17 5:15 ` [PATCH 3/9] ASoC: codecs: lpass-wsa-macro: remove mix path event Jonathan Marek
2025-11-19 15:34 ` Srinivas Kandagatla
2025-11-17 5:15 ` [PATCH 4/9] ASoC: codecs: lpass-wsa-macro: fix path clock dependencies Jonathan Marek
2025-11-19 15:34 ` Srinivas Kandagatla
2025-11-17 5:15 ` [PATCH 5/9] ASoC: codecs: lpass-wsa-macro: add volume controls for mix path Jonathan Marek
2025-11-19 15:34 ` Srinivas Kandagatla
2025-11-17 5:15 ` [PATCH 6/9] ASoC: codecs: lpass-wsa-macro: remove main path event Jonathan Marek
2025-11-19 15:34 ` Srinivas Kandagatla
2025-11-17 5:15 ` [PATCH 7/9] ASoC: codecs: lpass-wsa-macro: add RX4 and RX5 Jonathan Marek
2025-11-19 15:33 ` Srinivas Kandagatla
2025-11-19 17:13 ` Jonathan Marek
2025-11-17 5:15 ` [PATCH 8/9] ASoC: codecs: lpass-wsa-macro: remove unused WSA_MACRO_RX_MIX enum Jonathan Marek
2025-11-19 15:33 ` Srinivas Kandagatla
2025-11-17 5:15 ` [PATCH 9/9] ASoC: codecs: lpass-rx-macro: fix mute_stream affecting all paths Jonathan Marek
2025-11-19 15:33 ` Srinivas Kandagatla [this message]
2025-11-19 15:35 ` [PATCH 1/9] ASoC: codecs: lpass-wsa-macro: remove unnecessary bounds check Srinivas Kandagatla
2025-11-20 9:40 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2075e642-9976-49a8-a148-3a6fa113e66c@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=jonathan@marek.ca \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox