asoc: codecs: Update logic for active ch cnt calculation
Use number of bits set in active_ch_mask to calculate active channel count. This fixes improper update of channel count if same kcontrol is issued more than once. Change-Id: I84dc33ad5b6dbfc3babf5bbfeab1e2e71af5983b Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
54961362cb
commit
e25a1fdc64
@@ -203,7 +203,6 @@ enum {
|
||||
* @rx_0_count: RX0 interpolation users
|
||||
* @rx_1_count: RX1 interpolation users
|
||||
* @active_ch_mask: channel mask for all AIF DAIs
|
||||
* @active_ch_cnt: channel count of all AIF DAIs
|
||||
* @rx_port_value: mixer ctl value of WSA RX MUXes
|
||||
* @wsa_io_base: Base address of WSA macro addr space
|
||||
*/
|
||||
@@ -227,7 +226,6 @@ struct wsa_macro_priv {
|
||||
int rx_0_count;
|
||||
int rx_1_count;
|
||||
unsigned long active_ch_mask[WSA_MACRO_MAX_DAIS];
|
||||
unsigned long active_ch_cnt[WSA_MACRO_MAX_DAIS];
|
||||
int rx_port_value[WSA_MACRO_RX_MAX];
|
||||
char __iomem *wsa_io_base;
|
||||
struct platform_device *pdev_child_devices
|
||||
@@ -801,7 +799,7 @@ static int wsa_macro_get_channel_map(struct snd_soc_dai *dai,
|
||||
switch (dai->id) {
|
||||
case WSA_MACRO_AIF_VI:
|
||||
*tx_slot = wsa_priv->active_ch_mask[dai->id];
|
||||
*tx_num = wsa_priv->active_ch_cnt[dai->id];
|
||||
*tx_num = hweight_long(wsa_priv->active_ch_mask[dai->id]);
|
||||
break;
|
||||
case WSA_MACRO_AIF1_PB:
|
||||
case WSA_MACRO_AIF_MIX1_PB:
|
||||
@@ -2242,17 +2240,13 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol,
|
||||
|
||||
switch (rx_port_value) {
|
||||
case 0:
|
||||
if (wsa_priv->active_ch_cnt[aif_rst]) {
|
||||
clear_bit(bit_input,
|
||||
&wsa_priv->active_ch_mask[aif_rst]);
|
||||
wsa_priv->active_ch_cnt[aif_rst]--;
|
||||
}
|
||||
clear_bit(bit_input,
|
||||
&wsa_priv->active_ch_mask[aif_rst]);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
set_bit(bit_input,
|
||||
&wsa_priv->active_ch_mask[rx_port_value]);
|
||||
wsa_priv->active_ch_cnt[rx_port_value]++;
|
||||
break;
|
||||
default:
|
||||
dev_err(wsa_dev,
|
||||
@@ -2462,14 +2456,12 @@ static int wsa_macro_vi_feed_mixer_put(struct snd_kcontrol *kcontrol,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
|
||||
set_bit(WSA_MACRO_TX0,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI]);
|
||||
wsa_priv->active_ch_cnt[WSA_MACRO_AIF_VI]++;
|
||||
}
|
||||
if (spk_tx_id == WSA_MACRO_TX1 &&
|
||||
!test_bit(WSA_MACRO_TX1,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
|
||||
set_bit(WSA_MACRO_TX1,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI]);
|
||||
wsa_priv->active_ch_cnt[WSA_MACRO_AIF_VI]++;
|
||||
}
|
||||
} else {
|
||||
if (spk_tx_id == WSA_MACRO_TX0 &&
|
||||
@@ -2477,14 +2469,12 @@ static int wsa_macro_vi_feed_mixer_put(struct snd_kcontrol *kcontrol,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
|
||||
clear_bit(WSA_MACRO_TX0,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI]);
|
||||
wsa_priv->active_ch_cnt[WSA_MACRO_AIF_VI]--;
|
||||
}
|
||||
if (spk_tx_id == WSA_MACRO_TX1 &&
|
||||
test_bit(WSA_MACRO_TX1,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI])) {
|
||||
clear_bit(WSA_MACRO_TX1,
|
||||
&wsa_priv->active_ch_mask[WSA_MACRO_AIF_VI]);
|
||||
wsa_priv->active_ch_cnt[WSA_MACRO_AIF_VI]--;
|
||||
}
|
||||
}
|
||||
snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, NULL);
|
||||
|
Reference in New Issue
Block a user