asoc: lpass-cdc: add enable check before tx mixer put

Check whether tx channel had been enabled or disabled before
tx channel set.

Change-Id: I1f2e0132f0905a53df989b5d52370c4dfdf7d99b
此提交包含在:
Yuhui Zhao
2023-04-03 14:38:16 +08:00
提交者 Gerrit - the friendly Code Review server
父節點 a8496e9bf4
當前提交 5990a54d8e
共有 2 個檔案被更改,包括 30 行新增10 行删除

查看文件

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -612,11 +612,21 @@ static int lpass_cdc_tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
return -EINVAL;
if (enable) {
set_bit(dec_id, &tx_priv->active_ch_mask[dai_id]);
tx_priv->active_ch_cnt[dai_id]++;
if (test_bit(dec_id, &tx_priv->active_ch_mask[dai_id])) {
dev_err(component->dev, "%s: channel is already enabled, dec_id = %d, dai_id = %d\n",
__func__, dec_id, dai_id);
} else {
set_bit(dec_id, &tx_priv->active_ch_mask[dai_id]);
tx_priv->active_ch_cnt[dai_id]++;
}
} else {
tx_priv->active_ch_cnt[dai_id]--;
clear_bit(dec_id, &tx_priv->active_ch_mask[dai_id]);
if (!test_bit(dec_id, &tx_priv->active_ch_mask[dai_id])) {
dev_err(component->dev, "%s: channel is already disabled, dec_id = %d, dai_id = %d\n",
__func__, dec_id, dai_id);
} else {
tx_priv->active_ch_cnt[dai_id]--;
clear_bit(dec_id, &tx_priv->active_ch_mask[dai_id]);
}
}
snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);