ASoC: msm: qdsp6v2: Add get for App Type mixer control

Implement get function for App Type mixer control in
pcm and compress driver. Returns app type, ACDB ID,
and sample rate in use for FE ID.

Change-Id: I4972de893a638f2482c37796dd1718628526351d
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
This commit is contained in:
Ben Romberger 2016-03-02 17:26:11 -08:00 committed by Gerrit - the friendly Code Review server
parent 400520a6e2
commit 08ebb66927
4 changed files with 107 additions and 4 deletions

View file

@ -2749,7 +2749,35 @@ static int msm_compr_app_type_cfg_put(struct snd_kcontrol *kcontrol,
static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
return 0;
u64 fe_id = kcontrol->private_value;
int ret = 0;
int app_type;
int acdb_dev_id;
int sample_rate;
pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
if (fe_id >= MSM_FRONTEND_DAI_MAX) {
pr_err("%s Received out of bounds fe_id %llu\n",
__func__, fe_id);
ret = -EINVAL;
goto done;
}
ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type,
&acdb_dev_id, &sample_rate);
if (ret < 0) {
pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n",
__func__, ret);
goto done;
}
ucontrol->value.integer.value[0] = app_type;
ucontrol->value.integer.value[1] = acdb_dev_id;
ucontrol->value.integer.value[2] = sample_rate;
pr_debug("%s: fedai_id %llu, app_type %d, acdb_dev_id %d, sample_rate %d\n",
__func__, fe_id, app_type, acdb_dev_id, sample_rate);
done:
return ret;
}
static int msm_compr_channel_map_put(struct snd_kcontrol *kcontrol,

View file

@ -1174,7 +1174,35 @@ static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
return 0;
u64 fe_id = kcontrol->private_value;
int ret = 0;
int app_type;
int acdb_dev_id;
int sample_rate;
pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
if (fe_id >= MSM_FRONTEND_DAI_MAX) {
pr_err("%s Received out of bounds fe_id %llu\n",
__func__, fe_id);
ret = -EINVAL;
goto done;
}
ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type,
&acdb_dev_id, &sample_rate);
if (ret < 0) {
pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n",
__func__, ret);
goto done;
}
ucontrol->value.integer.value[0] = app_type;
ucontrol->value.integer.value[1] = acdb_dev_id;
ucontrol->value.integer.value[2] = sample_rate;
pr_debug("%s: fedai_id %llu, app_type %d, acdb_dev_id %d, sample_rate %d\n",
__func__, fe_id, app_type, acdb_dev_id, sample_rate);
done:
return ret;
}
static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd)

View file

@ -551,8 +551,8 @@ void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
pr_debug("%s: fedai_id %d, app_type %d, sample_rate %d\n",
__func__, fedai_id, app_type, sample_rate);
if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
/* bad ID assigned in machine driver */
pr_err("%s: bad MM ID %d\n", __func__, fedai_id);
pr_err("%s: Invalid machine driver ID %d\n",
__func__, fedai_id);
return;
}
fe_dai_app_type_cfg[fedai_id].app_type = app_type;
@ -560,6 +560,51 @@ void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
fe_dai_app_type_cfg[fedai_id].sample_rate = sample_rate;
}
/**
* msm_pcm_routing_get_stream_app_type_cfg
*
* Receives fedai_id and populates app_type, acdb_dev_id, &
* sample rate. Returns 0 on success. On failure returns
* -EINVAL and does not alter passed values.
*
* fedai_id - Passed value, front end ID for which app type config is wanted
* app_type - Returned value, app type used by app type config
* acdb_dev_id - Returned value, ACDB device ID used by app type config
* sample_rate - Returned value, sample rate used by app type config
*/
int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int *app_type,
int *acdb_dev_id, int *sample_rate)
{
int ret = 0;
if (app_type == NULL) {
pr_err("%s: NULL pointer sent for app_type\n", __func__);
ret = -EINVAL;
goto done;
} else if (acdb_dev_id == NULL) {
pr_err("%s: NULL pointer sent for acdb_dev_id\n", __func__);
ret = -EINVAL;
goto done;
} else if (sample_rate == NULL) {
pr_err("%s: NULL pointer sent for sample rate\n", __func__);
ret = -EINVAL;
goto done;
} else if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
pr_err("%s: Invalid FE ID %d\n",
__func__, fedai_id);
ret = -EINVAL;
goto done;
}
*app_type = fe_dai_app_type_cfg[fedai_id].app_type;
*acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id;
*sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate;
pr_debug("%s: fedai_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n",
__func__, fedai_id, *app_type, *acdb_dev_id, *sample_rate);
done:
return ret;
}
EXPORT_SYMBOL(msm_pcm_routing_get_stream_app_type_cfg);
static struct cal_block_data *msm_routing_find_topology_by_path(int path)
{

View file

@ -414,4 +414,6 @@ void msm_pcm_routing_release_lock(void);
void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type,
int acdb_dev_id, int sample_rate);
int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int *app_type,
int *acdb_dev_id, int *sample_rate);
#endif /*_MSM_PCM_H*/