summaryrefslogtreecommitdiff
path: root/asoc/msm-pcm-routing-v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'asoc/msm-pcm-routing-v2.c')
-rw-r--r--asoc/msm-pcm-routing-v2.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c
index 03603a2c..7aafe2b9 100644
--- a/asoc/msm-pcm-routing-v2.c
+++ b/asoc/msm-pcm-routing-v2.c
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
-/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -3033,6 +3033,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol,
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
int mux = ucontrol->value.enumerated.item[0];
int lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX;
+ int lsm_port_idx = 0;
u8 fe_idx = 0;
if (mux >= e->items) {
@@ -3042,6 +3043,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol,
pr_debug("%s: LSM enable %ld\n", __func__,
ucontrol->value.integer.value[0]);
+ lsm_port_idx = ucontrol->value.integer.value[0];
switch (ucontrol->value.integer.value[0]) {
case 1:
lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX;
@@ -3098,6 +3100,10 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol,
set_lsm_port(lsm_port);
msm_routing_get_lsm_fe_idx(kcontrol, &fe_idx);
lsm_port_index[fe_idx] = ucontrol->value.integer.value[0];
+ /* Set the default AFE LSM Port to 0xffff */
+ if(lsm_port_idx <= 0 || lsm_port_idx >= ARRAY_SIZE(lsm_port_text))
+ lsm_port = 0xffff;
+ afe_set_lsm_afe_port_id(fe_idx, lsm_port);
return 0;
}
@@ -22767,9 +22773,9 @@ static int msm_routing_put_app_type_cfg_control(struct snd_kcontrol *kcontrol,
memset(app_type_cfg, 0, MAX_APP_TYPES*
sizeof(struct msm_pcm_routing_app_type_data));
- if (num_app_types > MAX_APP_TYPES) {
- pr_err("%s: number of app types exceed the max supported\n",
- __func__);
+ if (num_app_types > MAX_APP_TYPES || num_app_types < 0) {
+ pr_err("%s: number of app types %d is invalid\n",
+ __func__, num_app_types);
return -EINVAL;
}
for (j = 0; j < num_app_types; j++) {
@@ -22973,9 +22979,10 @@ static int msm_routing_put_lsm_app_type_cfg_control(
int i = 0, j;
mutex_lock(&routing_lock);
- if (ucontrol->value.integer.value[0] > MAX_APP_TYPES) {
- pr_err("%s: number of app types exceed the max supported\n",
- __func__);
+ if (ucontrol->value.integer.value[0] < 0 ||
+ ucontrol->value.integer.value[0] > MAX_APP_TYPES) {
+ pr_err("%s: number of app types %ld is invalid\n",
+ __func__, ucontrol->value.integer.value[0]);
mutex_unlock(&routing_lock);
return -EINVAL;
}