|
@@ -901,6 +901,67 @@ done:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static int msm_transcode_capture_app_type_cfg_put(
|
|
|
+ struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ u64 fe_id = kcontrol->private_value;
|
|
|
+ int session_type = SESSION_TYPE_TX;
|
|
|
+ int be_id = ucontrol->value.integer.value[APP_TYPE_CONFIG_IDX_BE_ID];
|
|
|
+ struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000};
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ cfg_data.app_type = ucontrol->value.integer.value[
|
|
|
+ APP_TYPE_CONFIG_IDX_APP_TYPE];
|
|
|
+ cfg_data.acdb_dev_id = ucontrol->value.integer.value[
|
|
|
+ APP_TYPE_CONFIG_IDX_ACDB_ID];
|
|
|
+ if (ucontrol->value.integer.value[APP_TYPE_CONFIG_IDX_SAMPLE_RATE] != 0)
|
|
|
+ cfg_data.sample_rate = ucontrol->value.integer.value[
|
|
|
+ APP_TYPE_CONFIG_IDX_SAMPLE_RATE];
|
|
|
+ pr_debug("%s: fe_id %llu session_type %d be_id %d app_type %d acdb_dev_id %d sample_rate- %d\n",
|
|
|
+ __func__, fe_id, session_type, be_id,
|
|
|
+ cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate);
|
|
|
+ ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
|
|
|
+ be_id, &cfg_data);
|
|
|
+ if (ret < 0)
|
|
|
+ pr_err("%s: register stream app type cfg failed, returned %d\n",
|
|
|
+ __func__, ret);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static int msm_transcode_capture_app_type_cfg_get(
|
|
|
+ struct snd_kcontrol *kcontrol,
|
|
|
+ struct snd_ctl_elem_value *ucontrol)
|
|
|
+{
|
|
|
+ u64 fe_id = kcontrol->private_value;
|
|
|
+ int session_type = SESSION_TYPE_TX;
|
|
|
+ int be_id = 0;
|
|
|
+ struct msm_pcm_stream_app_type_cfg cfg_data = {0};
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type,
|
|
|
+ &be_id, &cfg_data);
|
|
|
+ if (ret < 0) {
|
|
|
+ pr_err("%s: get stream app type cfg failed, returned %d\n",
|
|
|
+ __func__, ret);
|
|
|
+ goto done;
|
|
|
+ }
|
|
|
+
|
|
|
+ ucontrol->value.integer.value[APP_TYPE_CONFIG_IDX_APP_TYPE] =
|
|
|
+ cfg_data.app_type;
|
|
|
+ ucontrol->value.integer.value[APP_TYPE_CONFIG_IDX_ACDB_ID] =
|
|
|
+ cfg_data.acdb_dev_id;
|
|
|
+ ucontrol->value.integer.value[APP_TYPE_CONFIG_IDX_SAMPLE_RATE] =
|
|
|
+ cfg_data.sample_rate;
|
|
|
+ ucontrol->value.integer.value[APP_TYPE_CONFIG_IDX_BE_ID] = be_id;
|
|
|
+ pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n",
|
|
|
+ __func__, fe_id, session_type, be_id,
|
|
|
+ cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate);
|
|
|
+done:
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
static int msm_transcode_set_volume(struct snd_compr_stream *cstream,
|
|
|
uint32_t master_gain)
|
|
|
{
|
|
@@ -1411,14 +1472,12 @@ static int msm_transcode_add_app_type_cfg_control(
|
|
|
struct snd_soc_pcm_runtime *rtd)
|
|
|
{
|
|
|
struct snd_soc_component *component = NULL;
|
|
|
- char mixer_str[32];
|
|
|
+ char mixer_str[128];
|
|
|
struct snd_kcontrol_new fe_app_type_cfg_control[1] = {
|
|
|
{
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
|
|
|
.info = msm_transcode_app_type_cfg_info,
|
|
|
- .put = msm_transcode_playback_app_type_cfg_put,
|
|
|
- .get = msm_transcode_playback_app_type_cfg_get,
|
|
|
.private_value = 0,
|
|
|
}
|
|
|
};
|
|
@@ -1447,6 +1506,23 @@ static int msm_transcode_add_app_type_cfg_control(
|
|
|
fe_app_type_cfg_control[0].get =
|
|
|
msm_transcode_playback_app_type_cfg_get;
|
|
|
|
|
|
+ pr_debug("Registering new mixer ctl %s", mixer_str);
|
|
|
+ snd_soc_add_component_controls(component,
|
|
|
+ fe_app_type_cfg_control,
|
|
|
+ ARRAY_SIZE(fe_app_type_cfg_control));
|
|
|
+ } else if (rtd->compr->direction == SND_COMPRESS_CAPTURE) {
|
|
|
+ snprintf(mixer_str, sizeof(mixer_str),
|
|
|
+ "Audio Stream Capture %d App Type Cfg",
|
|
|
+ rtd->pcm->device);
|
|
|
+
|
|
|
+ fe_app_type_cfg_control[0].name = mixer_str;
|
|
|
+ fe_app_type_cfg_control[0].private_value = rtd->dai_link->id;
|
|
|
+
|
|
|
+ fe_app_type_cfg_control[0].put =
|
|
|
+ msm_transcode_capture_app_type_cfg_put;
|
|
|
+ fe_app_type_cfg_control[0].get =
|
|
|
+ msm_transcode_capture_app_type_cfg_get;
|
|
|
+
|
|
|
pr_debug("Registering new mixer ctl %s", mixer_str);
|
|
|
snd_soc_add_component_controls(component,
|
|
|
fe_app_type_cfg_control,
|
|
@@ -1455,6 +1531,7 @@ static int msm_transcode_add_app_type_cfg_control(
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
static int msm_transcode_volume_info(struct snd_kcontrol *kcontrol,
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
{
|