ASoC: codecs: lpass-wsa-macro: Do not hard-code dai in VI mixer

The wsa_macro_vi_feed_mixer_put() callback for setting VI feedback mixer
value could be used for different DAIs (planned in the future CPS DAI),
so make the code a bit more generic by using DAI ID from widget->shift,
instead of hard-coding it.  The get() callback already follows such
convention.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240723144607.123240-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2024-07-23 16:46:07 +02:00 committed by Mark Brown
parent 3ff810b9be
commit b3f35bae68
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -2297,36 +2297,37 @@ static int wsa_macro_vi_feed_mixer_put(struct snd_kcontrol *kcontrol,
struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
u32 enable = ucontrol->value.integer.value[0];
u32 spk_tx_id = mixer->shift;
u32 dai_id = widget->shift;
if (enable) {
if (spk_tx_id == WSA_MACRO_TX0 &&
!test_bit(WSA_MACRO_TX0,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI])) {
&wsa->active_ch_mask[dai_id])) {
set_bit(WSA_MACRO_TX0,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI]);
wsa->active_ch_cnt[WSA_MACRO_AIF_VI]++;
&wsa->active_ch_mask[dai_id]);
wsa->active_ch_cnt[dai_id]++;
}
if (spk_tx_id == WSA_MACRO_TX1 &&
!test_bit(WSA_MACRO_TX1,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI])) {
&wsa->active_ch_mask[dai_id])) {
set_bit(WSA_MACRO_TX1,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI]);
wsa->active_ch_cnt[WSA_MACRO_AIF_VI]++;
&wsa->active_ch_mask[dai_id]);
wsa->active_ch_cnt[dai_id]++;
}
} else {
if (spk_tx_id == WSA_MACRO_TX0 &&
test_bit(WSA_MACRO_TX0,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI])) {
&wsa->active_ch_mask[dai_id])) {
clear_bit(WSA_MACRO_TX0,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI]);
wsa->active_ch_cnt[WSA_MACRO_AIF_VI]--;
&wsa->active_ch_mask[dai_id]);
wsa->active_ch_cnt[dai_id]--;
}
if (spk_tx_id == WSA_MACRO_TX1 &&
test_bit(WSA_MACRO_TX1,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI])) {
&wsa->active_ch_mask[dai_id])) {
clear_bit(WSA_MACRO_TX1,
&wsa->active_ch_mask[WSA_MACRO_AIF_VI]);
wsa->active_ch_cnt[WSA_MACRO_AIF_VI]--;
&wsa->active_ch_mask[dai_id]);
wsa->active_ch_cnt[dai_id]--;
}
}
snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, NULL);