Commit 5346f0e8 authored by Jonathan Marek's avatar Jonathan Marek Committed by Mark Brown

ASoC: codecs: lpass-va-macro: mute/unmute all active decimators

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: 908e6b1d ("ASoC: codecs: lpass-va-macro: Add support to VA Macro")
Signed-off-by: default avatarJonathan Marek <jonathan@marek.ca>
Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210304215646.17956-1-jonathan@marek.caSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7de14d58
...@@ -189,7 +189,6 @@ struct va_macro { ...@@ -189,7 +189,6 @@ struct va_macro {
struct device *dev; struct device *dev;
unsigned long active_ch_mask[VA_MACRO_MAX_DAIS]; unsigned long active_ch_mask[VA_MACRO_MAX_DAIS];
unsigned long active_ch_cnt[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; u16 dmic_clk_div;
int dec_mode[VA_MACRO_NUM_DECIMATORS]; int dec_mode[VA_MACRO_NUM_DECIMATORS];
...@@ -549,11 +548,9 @@ static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, ...@@ -549,11 +548,9 @@ static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
if (enable) { if (enable) {
set_bit(dec_id, &va->active_ch_mask[dai_id]); set_bit(dec_id, &va->active_ch_mask[dai_id]);
va->active_ch_cnt[dai_id]++; va->active_ch_cnt[dai_id]++;
va->active_decimator[dai_id] = dec_id;
} else { } else {
clear_bit(dec_id, &va->active_ch_mask[dai_id]); clear_bit(dec_id, &va->active_ch_mask[dai_id]);
va->active_ch_cnt[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); 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) ...@@ -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); struct va_macro *va = snd_soc_component_get_drvdata(component);
u16 tx_vol_ctl_reg, decimator; u16 tx_vol_ctl_reg, decimator;
decimator = va->active_decimator[dai->id]; 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 + tx_vol_ctl_reg = CDC_VA_TX0_TX_PATH_CTL +
VA_MACRO_TX_PATH_OFFSET * decimator; VA_MACRO_TX_PATH_OFFSET * decimator;
if (mute) if (mute)
snd_soc_component_update_bits(component, tx_vol_ctl_reg, 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_MASK,
CDC_VA_TX_PATH_PGA_MUTE_EN); CDC_VA_TX_PATH_PGA_MUTE_EN);
else else
snd_soc_component_update_bits(component, tx_vol_ctl_reg, 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_MASK,
CDC_VA_TX_PATH_PGA_MUTE_DISABLE); CDC_VA_TX_PATH_PGA_MUTE_DISABLE);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment