From adbca4f654f6217c26981891b9b2589ee1180306 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Mon, 29 Oct 2018 14:30:13 +0800 Subject: [PATCH] asoc: routing: update app type config get function Update app type config get function and userspace can get the app type config with mixer control. Change-Id: I78eda2963161936ae1dbf90dad1bfb64cb079e8d Signed-off-by: Meng Wang --- asoc/msm-pcm-routing-v2.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c index 0d07dd4773af..41dd7cdac671 100644 --- a/asoc/msm-pcm-routing-v2.c +++ b/asoc/msm-pcm-routing-v2.c @@ -84,6 +84,7 @@ static bool is_custom_stereo_on; static bool is_ds2_on; static bool swap_ch; static int aanc_level; +static int num_app_cfg_types; #define WEIGHT_0_DB 0x4000 /* all the FEs which can support channel mixer */ @@ -17238,6 +17239,23 @@ static int msm_routing_get_lsm_app_type_cfg_control( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + int shift = ((struct soc_multi_mixer_control *) + kcontrol->private_value)->shift; + int i = 0, j = 0; + + ucontrol->value.integer.value[i] = num_app_cfg_types; + + for (j = 0; j < num_app_cfg_types; ++j) { + ucontrol->value.integer.value[++i] = + lsm_app_type_cfg[j].app_type; + ucontrol->value.integer.value[++i] = + lsm_app_type_cfg[j].sample_rate; + ucontrol->value.integer.value[++i] = + lsm_app_type_cfg[j].bit_width; + if (shift == 1) + ucontrol->value.integer.value[++i] = + lsm_app_type_cfg[j].num_out_channels; + } return 0; } @@ -17248,18 +17266,18 @@ static int msm_routing_put_lsm_app_type_cfg_control( int shift = ((struct soc_multi_mixer_control *) kcontrol->private_value)->shift; int i = 0, j; - int num_app_types = ucontrol->value.integer.value[i++]; + num_app_cfg_types = ucontrol->value.integer.value[i++]; memset(lsm_app_type_cfg, 0, MAX_APP_TYPES* sizeof(struct msm_pcm_routing_app_type_data)); - if (num_app_types > MAX_APP_TYPES) { + if (num_app_cfg_types > MAX_APP_TYPES) { pr_err("%s: number of app types exceed the max supported\n", __func__); return -EINVAL; } - for (j = 0; j < num_app_types; j++) { + for (j = 0; j < num_app_cfg_types; j++) { lsm_app_type_cfg[j].app_type = ucontrol->value.integer.value[i++]; lsm_app_type_cfg[j].sample_rate =