linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators
@ 2021-03-04 21:56 Jonathan Marek
  2021-03-05  9:22 ` Srinivas Kandagatla
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Marek @ 2021-03-04 21:56 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Pierre-Louis Bossart,
	moderated list:QCOM AUDIO (ASoC) DRIVERS, open list

An interface can have multiple decimators enabled, so loop over all active
decimators. Otherwise only one channel will be unmuted, and other channels
will be zero. This fixes recording from dual DMIC as a single two channel
stream.

Also remove the now unused "active_decimator" field.

Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
 sound/soc/codecs/lpass-va-macro.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
index 91e6890d6efcb..3d6976a3d9e42 100644
--- a/sound/soc/codecs/lpass-va-macro.c
+++ b/sound/soc/codecs/lpass-va-macro.c
@@ -189,7 +189,6 @@ struct va_macro {
 	struct device *dev;
 	unsigned long active_ch_mask[VA_MACRO_MAX_DAIS];
 	unsigned long active_ch_cnt[VA_MACRO_MAX_DAIS];
-	unsigned long active_decimator[VA_MACRO_MAX_DAIS];
 	u16 dmic_clk_div;
 
 	int dec_mode[VA_MACRO_NUM_DECIMATORS];
@@ -549,11 +548,9 @@ static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
 	if (enable) {
 		set_bit(dec_id, &va->active_ch_mask[dai_id]);
 		va->active_ch_cnt[dai_id]++;
-		va->active_decimator[dai_id] = dec_id;
 	} else {
 		clear_bit(dec_id, &va->active_ch_mask[dai_id]);
 		va->active_ch_cnt[dai_id]--;
-		va->active_decimator[dai_id] = -1;
 	}
 
 	snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);
@@ -880,18 +877,19 @@ static int va_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
 	struct va_macro *va = snd_soc_component_get_drvdata(component);
 	u16 tx_vol_ctl_reg, decimator;
 
-	decimator = va->active_decimator[dai->id];
-
-	tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL +
-				VA_MACRO_TX_PATH_OFFSET * decimator;
-	if (mute)
-		snd_soc_component_update_bits(component, tx_vol_ctl_reg,
-					      CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
-					      CDC_VA_TX_PATH_PGA_MUTE_EN);
-	else
-		snd_soc_component_update_bits(component, tx_vol_ctl_reg,
-					      CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
-					      CDC_VA_TX_PATH_PGA_MUTE_DISABLE);
+	for_each_set_bit(decimator, &va->active_ch_mask[dai->id],
+			 VA_MACRO_DEC_MAX) {
+		tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL +
+					VA_MACRO_TX_PATH_OFFSET * decimator;
+		if (mute)
+			snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+					CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
+					CDC_VA_TX_PATH_PGA_MUTE_EN);
+		else
+			snd_soc_component_update_bits(component, tx_vol_ctl_reg,
+					CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
+					CDC_VA_TX_PATH_PGA_MUTE_DISABLE);
+	}
 
 	return 0;
 }
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators
  2021-03-04 21:56 [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators Jonathan Marek
@ 2021-03-05  9:22 ` Srinivas Kandagatla
  2021-03-08 16:06 ` Mark Brown
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Srinivas Kandagatla @ 2021-03-05  9:22 UTC (permalink / raw)
  To: Jonathan Marek, linux-arm-msm
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Pierre-Louis Bossart,
	moderated list:QCOM AUDIO (ASoC) DRIVERS, open list

Thanks Jonathan for testing and fixing this use case!


On 04/03/2021 21:56, Jonathan Marek wrote:
> An interface can have multiple decimators enabled, so loop over all active
> decimators. Otherwise only one channel will be unmuted, and other channels
> will be zero. This fixes recording from dual DMIC as a single two channel
> stream.

> 
> Also remove the now unused "active_decimator" field.
> 
> Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro")
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---

LGTM,

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


--srini
>   sound/soc/codecs/lpass-va-macro.c | 28 +++++++++++++---------------
>   1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
> index 91e6890d6efcb..3d6976a3d9e42 100644
> --- a/sound/soc/codecs/lpass-va-macro.c
> +++ b/sound/soc/codecs/lpass-va-macro.c
> @@ -189,7 +189,6 @@ struct va_macro {
>   	struct device *dev;
>   	unsigned long active_ch_mask[VA_MACRO_MAX_DAIS];
>   	unsigned long active_ch_cnt[VA_MACRO_MAX_DAIS];
> -	unsigned long active_decimator[VA_MACRO_MAX_DAIS];
>   	u16 dmic_clk_div;
>   
>   	int dec_mode[VA_MACRO_NUM_DECIMATORS];
> @@ -549,11 +548,9 @@ static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
>   	if (enable) {
>   		set_bit(dec_id, &va->active_ch_mask[dai_id]);
>   		va->active_ch_cnt[dai_id]++;
> -		va->active_decimator[dai_id] = dec_id;
>   	} else {
>   		clear_bit(dec_id, &va->active_ch_mask[dai_id]);
>   		va->active_ch_cnt[dai_id]--;
> -		va->active_decimator[dai_id] = -1;
>   	}
>   
>   	snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);
> @@ -880,18 +877,19 @@ static int va_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
>   	struct va_macro *va = snd_soc_component_get_drvdata(component);
>   	u16 tx_vol_ctl_reg, decimator;
>   
> -	decimator = va->active_decimator[dai->id];
> -
> -	tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL +
> -				VA_MACRO_TX_PATH_OFFSET * decimator;
> -	if (mute)
> -		snd_soc_component_update_bits(component, tx_vol_ctl_reg,
> -					      CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
> -					      CDC_VA_TX_PATH_PGA_MUTE_EN);
> -	else
> -		snd_soc_component_update_bits(component, tx_vol_ctl_reg,
> -					      CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
> -					      CDC_VA_TX_PATH_PGA_MUTE_DISABLE);
> +	for_each_set_bit(decimator, &va->active_ch_mask[dai->id],
> +			 VA_MACRO_DEC_MAX) {
> +		tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL +
> +					VA_MACRO_TX_PATH_OFFSET * decimator;
> +		if (mute)
> +			snd_soc_component_update_bits(component, tx_vol_ctl_reg,
> +					CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
> +					CDC_VA_TX_PATH_PGA_MUTE_EN);
> +		else
> +			snd_soc_component_update_bits(component, tx_vol_ctl_reg,
> +					CDC_VA_TX_PATH_PGA_MUTE_EN_MASK,
> +					CDC_VA_TX_PATH_PGA_MUTE_DISABLE);
> +	}
>   
>   	return 0;
>   }
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators
  2021-03-04 21:56 [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators Jonathan Marek
  2021-03-05  9:22 ` Srinivas Kandagatla
@ 2021-03-08 16:06 ` Mark Brown
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-03-08 16:06 UTC (permalink / raw)
  To: Jonathan Marek, linux-arm-msm
  Cc: Banajit Goswami, open list,
	moderated list:QCOM AUDIO ASoC DRIVERS, Pierre-Louis Bossart,
	Liam Girdwood, Takashi Iwai, Srinivas Kandagatla

On Thu, 4 Mar 2021 16:56:46 -0500, Jonathan Marek wrote:
> An interface can have multiple decimators enabled, so loop over all active
> decimators. Otherwise only one channel will be unmuted, and other channels
> will be zero. This fixes recording from dual DMIC as a single two channel
> stream.
> 
> Also remove the now unused "active_decimator" field.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators
      commit: adda199c1ea2bfb02e73829e6f1d374075958c1f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators
  2021-03-04 21:56 [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators Jonathan Marek
  2021-03-05  9:22 ` Srinivas Kandagatla
  2021-03-08 16:06 ` Mark Brown
@ 2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-05-26 19:03 UTC (permalink / raw)
  To: Jonathan Marek; +Cc: linux-arm-msm

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Thu,  4 Mar 2021 16:56:46 -0500 you wrote:
> An interface can have multiple decimators enabled, so loop over all active
> decimators. Otherwise only one channel will be unmuted, and other channels
> will be zero. This fixes recording from dual DMIC as a single two channel
> stream.
> 
> Also remove the now unused "active_decimator" field.
> 
> [...]

Here is the summary with links:
  - ASoC: codecs: lpass-va-macro: mute/unmute all active decimators
    https://git.kernel.org/qcom/c/5346f0e80b71

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-26 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04 21:56 [PATCH] ASoC: codecs: lpass-va-macro: mute/unmute all active decimators Jonathan Marek
2021-03-05  9:22 ` Srinivas Kandagatla
2021-03-08 16:06 ` Mark Brown
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).