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
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
a8496e9bf4
commit
5990a54d8e
@@ -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,12 +612,22 @@ static int lpass_cdc_tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
|
||||
return -EINVAL;
|
||||
|
||||
if (enable) {
|
||||
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 {
|
||||
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);
|
||||
|
||||
return 0;
|
||||
|
@@ -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>
|
||||
@@ -1186,11 +1186,21 @@ static int lpass_cdc_va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol,
|
||||
return -EINVAL;
|
||||
|
||||
if (enable) {
|
||||
if (test_bit(dec_id, &va_priv->active_ch_mask[dai_id])) {
|
||||
dev_err_ratelimited(component->dev, "%s: channel is already enabled, dec_id = %d, dai_id = %d\n",
|
||||
__func__, dec_id, dai_id);
|
||||
} else {
|
||||
set_bit(dec_id, &va_priv->active_ch_mask[dai_id]);
|
||||
va_priv->active_ch_cnt[dai_id]++;
|
||||
}
|
||||
} else {
|
||||
if (!test_bit(dec_id, &va_priv->active_ch_mask[dai_id])) {
|
||||
dev_err_ratelimited(component->dev, "%s: channel is already disabled, dec_id = %d, dai_id = %d\n",
|
||||
__func__, dec_id, dai_id);
|
||||
} else {
|
||||
va_priv->active_ch_mask[dai_id]--;
|
||||
clear_bit(dec_id, &va_priv->active_ch_mask[dai_id]);
|
||||
va_priv->active_ch_cnt[dai_id]--;
|
||||
}
|
||||
}
|
||||
|
||||
snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update);
|
||||
|
Reference in New Issue
Block a user