Loading sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +8 −7 Original line number Diff line number Diff line Loading @@ -2712,10 +2712,10 @@ static int msm_compr_app_type_cfg_put(struct snd_kcontrol *kcontrol, acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, app_type, acdb_dev_id, sample_rate); pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate); acdb_dev_id, sample_rate, SESSION_TYPE_RX); return 0; } Loading @@ -2737,8 +2737,8 @@ static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol, goto done; } ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type, &acdb_dev_id, &sample_rate); ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, SESSION_TYPE_RX, &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); Loading @@ -2748,8 +2748,9 @@ static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol, 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); pr_debug("%s: fedai_id %llu, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_RX, app_type, acdb_dev_id, sample_rate); done: return ret; } Loading sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +187 −1 Original line number Diff line number Diff line Loading @@ -466,7 +466,7 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, return rc; } static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) static int msm_pcm_add_volume_controls(struct snd_soc_pcm_runtime *rtd) { struct snd_pcm *pcm = rtd->pcm->streams[0].pcm; struct snd_pcm_volume *volume_info; Loading @@ -486,6 +486,192 @@ static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) return 0; } static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; int app_type; int acdb_dev_id; int sample_rate = 48000; 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); return -EINVAL; } app_type = ucontrol->value.integer.value[0]; acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); return 0; } static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 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, SESSION_TYPE_RX, &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, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_RX, app_type, acdb_dev_id, sample_rate); done: return ret; } static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; int app_type; int acdb_dev_id; int sample_rate = 48000; 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); return -EINVAL; } app_type = ucontrol->value.integer.value[0]; acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); return 0; } static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 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, SESSION_TYPE_TX, &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, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_TX, app_type, acdb_dev_id, sample_rate); done: return ret; } static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd) { struct snd_pcm *pcm = rtd->pcm->streams[0].pcm; struct snd_pcm_usr *app_type_info; struct snd_kcontrol *kctl; const char *playback_mixer_ctl_name = "Audio Stream"; const char *capture_mixer_ctl_name = "Audio Stream Capture"; const char *deviceNo = "NN"; const char *suffix = "App Type Cfg"; int ctl_len, ret = 0; if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ctl_len = strlen(playback_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Playback app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) return ret; kctl = app_type_info->kctl; snprintf(kctl->id.name, ctl_len, "%s %d %s", playback_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_playback_app_type_cfg_ctl_put; kctl->get = msm_pcm_playback_app_type_cfg_ctl_get; } if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ctl_len = strlen(capture_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Capture app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_CAPTURE, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) return ret; kctl = app_type_info->kctl; snprintf(kctl->id.name, ctl_len, "%s %d %s", capture_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_capture_app_type_cfg_ctl_put; kctl->get = msm_pcm_capture_app_type_cfg_ctl_get; } return 0; } static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) { int ret = 0; pr_debug("%s\n", __func__); ret = msm_pcm_add_volume_controls(rtd); if (ret) pr_err("%s: pcm add volume controls failed:%d\n", __func__, ret); ret = msm_pcm_add_app_type_controls(rtd); if (ret) pr_err("%s: pcm add app type controls failed:%d\n", __func__, ret); return ret; } static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; Loading sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c +110 −25 Original line number Diff line number Diff line Loading @@ -1140,7 +1140,7 @@ static int msm_pcm_add_chmap_controls(struct snd_soc_pcm_runtime *rtd) return 0; } static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; Loading @@ -1159,15 +1159,15 @@ static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, app_type, acdb_dev_id, sample_rate); pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate); acdb_dev_id, sample_rate, SESSION_TYPE_RX); return 0; } static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; Loading @@ -1184,8 +1184,8 @@ static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, goto done; } ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type, &acdb_dev_id, &sample_rate); ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, SESSION_TYPE_RX, &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); Loading @@ -1195,8 +1195,71 @@ static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, 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); pr_debug("%s: fedai_id %llu, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_RX, app_type, acdb_dev_id, sample_rate); done: return ret; } static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; int app_type; int acdb_dev_id; int sample_rate = 48000; 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); return -EINVAL; } app_type = ucontrol->value.integer.value[0]; acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); return 0; } static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 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, SESSION_TYPE_TX, &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, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_TX, app_type, acdb_dev_id, sample_rate); done: return ret; } Loading @@ -1206,27 +1269,49 @@ static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd) struct snd_pcm *pcm = rtd->pcm; struct snd_pcm_usr *app_type_info; struct snd_kcontrol *kctl; const char *mixer_ctl_name = "Audio Stream"; const char *playback_mixer_ctl_name = "Audio Stream"; const char *capture_mixer_ctl_name = "Audio Stream Capture"; const char *deviceNo = "NN"; const char *suffix = "App Type Cfg"; int ctl_len, ret = 0; ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s, App type cntrl add\n", __func__); if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ctl_len = strlen(playback_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Playback app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) { pr_err("%s, app type cntrl add failed:%d\n", __func__, ret); pr_err("%s: playback app type cntrl add failed: %d\n", __func__, ret); return ret; } kctl = app_type_info->kctl; snprintf(kctl->id.name, ctl_len, "%s %d %s", mixer_ctl_name, rtd->pcm->device, suffix); snprintf(kctl->id.name, ctl_len, "%s %d %s", playback_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_playback_app_type_cfg_ctl_put; kctl->get = msm_pcm_playback_app_type_cfg_ctl_get; } if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ctl_len = strlen(capture_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Capture app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_CAPTURE, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) { pr_err("%s: capture app type cntrl add failed: %d\n", __func__, ret); return ret; } kctl = app_type_info->kctl; kctl->put = msm_pcm_app_type_cfg_ctl_put; kctl->get = msm_pcm_app_type_cfg_ctl_get; snprintf(kctl->id.name, ctl_len, "%s %d %s", capture_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_capture_app_type_cfg_ctl_put; kctl->get = msm_pcm_capture_app_type_cfg_ctl_get; } return 0; } Loading sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c +81 −51 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ static unsigned long session_copp_map[MSM_FRONTEND_DAI_MM_SIZE][2] [MSM_BACKEND_DAI_MAX]; static struct msm_pcm_routing_app_type_data app_type_cfg[MAX_APP_TYPES]; static struct msm_pcm_stream_app_type_cfg fe_dai_app_type_cfg[MSM_FRONTEND_DAI_MM_SIZE]; fe_dai_app_type_cfg[MSM_FRONTEND_DAI_MM_SIZE][2]; /* The caller of this should aqcuire routing lock */ void msm_pcm_routing_get_bedai_info(int be_idx, Loading Loading @@ -540,34 +540,43 @@ static int msm_pcm_routing_get_app_type_idx(int app_type) } void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type, int acdb_dev_id, int sample_rate) int acdb_dev_id, int sample_rate, int session_type) { pr_debug("%s: fedai_id %d, app_type %d, sample_rate %d\n", __func__, fedai_id, app_type, sample_rate); pr_debug("%s: fedai_id %d, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fedai_id, session_type, app_type, acdb_dev_id, sample_rate); if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_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; fe_dai_app_type_cfg[fedai_id].acdb_dev_id = acdb_dev_id; fe_dai_app_type_cfg[fedai_id].sample_rate = sample_rate; if (session_type != SESSION_TYPE_RX && session_type != SESSION_TYPE_TX) { pr_err("%s: Invalid session type %d\n", __func__, session_type); return; } fe_dai_app_type_cfg[fedai_id][session_type].app_type = app_type; fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id = acdb_dev_id; fe_dai_app_type_cfg[fedai_id][session_type].sample_rate = sample_rate; } /** * msm_pcm_routing_get_stream_app_type_cfg * * Receives fedai_id and populates app_type, acdb_dev_id, & * Receives fedai_id, session_type 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 * session_type - Passed value, session type 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 msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int session_type, int *app_type, int *acdb_dev_id, int *sample_rate) { int ret = 0; Loading @@ -588,13 +597,20 @@ int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int *app_type, __func__, fedai_id); ret = -EINVAL; goto done; } else if (session_type != SESSION_TYPE_RX && session_type != SESSION_TYPE_TX) { pr_err("%s: Invalid session type %d\n", __func__, session_type); 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; *app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; *acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; *sample_rate = fe_dai_app_type_cfg[fedai_id][session_type].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); pr_debug("%s: fedai_id %d, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fedai_id, session_type, *app_type, *acdb_dev_id, *sample_rate); done: return ret; } Loading Loading @@ -651,7 +667,8 @@ static struct cal_block_data *msm_routing_find_topology(int path, return msm_routing_find_topology_by_path(path); } static int msm_routing_get_adm_topology(int path, int fedai_id) static int msm_routing_get_adm_topology(int path, int fedai_id, int session_type) { int topology = NULL_COPP_TOPOLOGY; struct cal_block_data *cal_block = NULL; Loading @@ -664,11 +681,10 @@ static int msm_routing_get_adm_topology(int path, int fedai_id) mutex_lock(&cal_data->lock); if (path == RX_DEVICE) { 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; } app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; sample_rate = fe_dai_app_type_cfg[fedai_id][session_type].sample_rate; cal_block = msm_routing_find_topology(path, app_type, acdb_dev_id, sample_rate); if (cal_block == NULL) Loading Loading @@ -724,9 +740,12 @@ static void msm_pcm_routing_build_matrix(int fedai_id, int sess_type, if (num_copps) { payload.num_copps = num_copps; payload.session_id = fe_dai_map[fedai_id][sess_type].strm_id; payload.app_type = fe_dai_app_type_cfg[fedai_id].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate; payload.app_type = fe_dai_app_type_cfg[fedai_id][sess_type].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id][sess_type].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id][sess_type].sample_rate; adm_matrix_map(path_type, payload, perf_mode); msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode); } Loading Loading @@ -826,8 +845,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, bit_width = msm_routing_get_bit_width( msm_bedais[i].format); app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ? fe_dai_app_type_cfg[fe_id].app_type : 0; app_type = fe_dai_app_type_cfg[fe_id][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx( Loading @@ -839,9 +858,10 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, } else { sample_rate = msm_bedais[i].sample_rate; } acdb_dev_id = fe_dai_app_type_cfg[fe_id].acdb_dev_id; acdb_dev_id = fe_dai_app_type_cfg[fe_id][session_type].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, fe_id); fe_id, session_type); pr_err("%s: Before adm open topology %d\n", __func__, topology); Loading Loading @@ -886,8 +906,10 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, if (num_copps) { payload.num_copps = num_copps; payload.session_id = fe_dai_map[fe_id][session_type].strm_id; payload.app_type = fe_dai_app_type_cfg[fe_id].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fe_id].acdb_dev_id; payload.app_type = fe_dai_app_type_cfg[fe_id][session_type].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fe_id][session_type].acdb_dev_id; adm_matrix_map(path_type, payload, perf_mode); msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode); } Loading Loading @@ -977,21 +999,23 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, bits_per_sample = msm_routing_get_bit_width( msm_bedais[i].format); app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ? fe_dai_app_type_cfg[fedai_id].app_type : 0; app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx(app_type); sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate; fe_dai_app_type_cfg[fedai_id][session_type]. sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; } else sample_rate = msm_bedais[i].sample_rate; acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id; acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, fedai_id); fedai_id, session_type); copp_idx = adm_open(msm_bedais[i].port_id, path_type, sample_rate, channels, topology, perf_mode, bits_per_sample, Loading Loading @@ -1036,9 +1060,12 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, if (num_copps) { payload.num_copps = num_copps; payload.session_id = fe_dai_map[fedai_id][session_type].strm_id; payload.app_type = fe_dai_app_type_cfg[fedai_id].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate; payload.app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id][session_type].sample_rate; adm_matrix_map(path_type, payload, perf_mode); msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode); } Loading Loading @@ -1199,20 +1226,23 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) bits_per_sample = msm_routing_get_bit_width( msm_bedais[reg].format); app_type = (session_type == SESSION_TYPE_RX) ? fe_dai_app_type_cfg[val].app_type : 0; app_type = fe_dai_app_type_cfg[val][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx(app_type); sample_rate = fe_dai_app_type_cfg[val].sample_rate; fe_dai_app_type_cfg[val][session_type]. sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; } else sample_rate = msm_bedais[reg].sample_rate; topology = msm_routing_get_adm_topology(path_type, val); acdb_dev_id = fe_dai_app_type_cfg[val].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, val, session_type); acdb_dev_id = fe_dai_app_type_cfg[val][session_type].acdb_dev_id; copp_idx = adm_open(msm_bedais[reg].port_id, path_type, sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, Loading Loading @@ -9054,7 +9084,6 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) int i, path_type, session_type, topology; struct msm_pcm_routing_bdai_data *bedai; u32 channels, sample_rate; bool playback, capture; uint16_t bits_per_sample = 16, voc_path_type; struct msm_pcm_routing_fdai_data *fdai; u32 session_id; Loading Loading @@ -9090,8 +9119,6 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) * is started. */ bedai->active = 1; playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; capture = substream->stream == SNDRV_PCM_STREAM_CAPTURE; for_each_set_bit(i, &bedai->fe_sessions, MSM_FRONTEND_DAI_MM_SIZE) { fdai = &fe_dai_map[i][session_type]; Loading @@ -9113,20 +9140,23 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) bits_per_sample = msm_routing_get_bit_width( bedai->format); app_type = playback ? fe_dai_app_type_cfg[i].app_type : 0; app_type = fe_dai_app_type_cfg[i][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx(app_type); sample_rate = fe_dai_app_type_cfg[i].sample_rate; fe_dai_app_type_cfg[i][session_type]. sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; } else sample_rate = bedai->sample_rate; channels = bedai->channel; acdb_dev_id = fe_dai_app_type_cfg[i].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, i); acdb_dev_id = fe_dai_app_type_cfg[i][session_type].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, i, session_type); copp_idx = adm_open(bedai->port_id, path_type, sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, Loading sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h +3 −3 Original line number Diff line number Diff line Loading @@ -400,7 +400,7 @@ void msm_pcm_routing_acquire_lock(void); 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); int acdb_dev_id, int sample_rate, int session_type); int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int session_type, int *app_type, int *acdb_dev_id, int *sample_rate); #endif /*_MSM_PCM_H*/ Loading
sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +8 −7 Original line number Diff line number Diff line Loading @@ -2712,10 +2712,10 @@ static int msm_compr_app_type_cfg_put(struct snd_kcontrol *kcontrol, acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, app_type, acdb_dev_id, sample_rate); pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate); acdb_dev_id, sample_rate, SESSION_TYPE_RX); return 0; } Loading @@ -2737,8 +2737,8 @@ static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol, goto done; } ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type, &acdb_dev_id, &sample_rate); ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, SESSION_TYPE_RX, &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); Loading @@ -2748,8 +2748,9 @@ static int msm_compr_app_type_cfg_get(struct snd_kcontrol *kcontrol, 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); pr_debug("%s: fedai_id %llu, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_RX, app_type, acdb_dev_id, sample_rate); done: return ret; } Loading
sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +187 −1 Original line number Diff line number Diff line Loading @@ -466,7 +466,7 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, return rc; } static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) static int msm_pcm_add_volume_controls(struct snd_soc_pcm_runtime *rtd) { struct snd_pcm *pcm = rtd->pcm->streams[0].pcm; struct snd_pcm_volume *volume_info; Loading @@ -486,6 +486,192 @@ static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) return 0; } static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; int app_type; int acdb_dev_id; int sample_rate = 48000; 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); return -EINVAL; } app_type = ucontrol->value.integer.value[0]; acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); return 0; } static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 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, SESSION_TYPE_RX, &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, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_RX, app_type, acdb_dev_id, sample_rate); done: return ret; } static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; int app_type; int acdb_dev_id; int sample_rate = 48000; 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); return -EINVAL; } app_type = ucontrol->value.integer.value[0]; acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); return 0; } static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 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, SESSION_TYPE_TX, &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, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_TX, app_type, acdb_dev_id, sample_rate); done: return ret; } static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd) { struct snd_pcm *pcm = rtd->pcm->streams[0].pcm; struct snd_pcm_usr *app_type_info; struct snd_kcontrol *kctl; const char *playback_mixer_ctl_name = "Audio Stream"; const char *capture_mixer_ctl_name = "Audio Stream Capture"; const char *deviceNo = "NN"; const char *suffix = "App Type Cfg"; int ctl_len, ret = 0; if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ctl_len = strlen(playback_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Playback app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) return ret; kctl = app_type_info->kctl; snprintf(kctl->id.name, ctl_len, "%s %d %s", playback_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_playback_app_type_cfg_ctl_put; kctl->get = msm_pcm_playback_app_type_cfg_ctl_get; } if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ctl_len = strlen(capture_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Capture app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_CAPTURE, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) return ret; kctl = app_type_info->kctl; snprintf(kctl->id.name, ctl_len, "%s %d %s", capture_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_capture_app_type_cfg_ctl_put; kctl->get = msm_pcm_capture_app_type_cfg_ctl_get; } return 0; } static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) { int ret = 0; pr_debug("%s\n", __func__); ret = msm_pcm_add_volume_controls(rtd); if (ret) pr_err("%s: pcm add volume controls failed:%d\n", __func__, ret); ret = msm_pcm_add_app_type_controls(rtd); if (ret) pr_err("%s: pcm add app type controls failed:%d\n", __func__, ret); return ret; } static int msm_asoc_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; Loading
sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c +110 −25 Original line number Diff line number Diff line Loading @@ -1140,7 +1140,7 @@ static int msm_pcm_add_chmap_controls(struct snd_soc_pcm_runtime *rtd) return 0; } static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; Loading @@ -1159,15 +1159,15 @@ static int msm_pcm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, app_type, acdb_dev_id, sample_rate); pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_RX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate); acdb_dev_id, sample_rate, SESSION_TYPE_RX); return 0; } static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; Loading @@ -1184,8 +1184,8 @@ static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, goto done; } ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, &app_type, &acdb_dev_id, &sample_rate); ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, SESSION_TYPE_RX, &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); Loading @@ -1195,8 +1195,71 @@ static int msm_pcm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, 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); pr_debug("%s: fedai_id %llu, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_RX, app_type, acdb_dev_id, sample_rate); done: return ret; } static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { u64 fe_id = kcontrol->private_value; int app_type; int acdb_dev_id; int sample_rate = 48000; 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); return -EINVAL; } app_type = ucontrol->value.integer.value[0]; acdb_dev_id = ucontrol->value.integer.value[1]; if (0 != ucontrol->value.integer.value[2]) sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: app_type- %d acdb_dev_id- %d sample_rate- %d session_type- %d\n", __func__, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); msm_pcm_routing_reg_stream_app_type_cfg(fe_id, app_type, acdb_dev_id, sample_rate, SESSION_TYPE_TX); return 0; } static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { 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, SESSION_TYPE_TX, &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, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, SESSION_TYPE_TX, app_type, acdb_dev_id, sample_rate); done: return ret; } Loading @@ -1206,27 +1269,49 @@ static int msm_pcm_add_app_type_controls(struct snd_soc_pcm_runtime *rtd) struct snd_pcm *pcm = rtd->pcm; struct snd_pcm_usr *app_type_info; struct snd_kcontrol *kctl; const char *mixer_ctl_name = "Audio Stream"; const char *playback_mixer_ctl_name = "Audio Stream"; const char *capture_mixer_ctl_name = "Audio Stream Capture"; const char *deviceNo = "NN"; const char *suffix = "App Type Cfg"; int ctl_len, ret = 0; ctl_len = strlen(mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s, App type cntrl add\n", __func__); if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ctl_len = strlen(playback_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Playback app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) { pr_err("%s, app type cntrl add failed:%d\n", __func__, ret); pr_err("%s: playback app type cntrl add failed: %d\n", __func__, ret); return ret; } kctl = app_type_info->kctl; snprintf(kctl->id.name, ctl_len, "%s %d %s", mixer_ctl_name, rtd->pcm->device, suffix); snprintf(kctl->id.name, ctl_len, "%s %d %s", playback_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_playback_app_type_cfg_ctl_put; kctl->get = msm_pcm_playback_app_type_cfg_ctl_get; } if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ctl_len = strlen(capture_mixer_ctl_name) + 1 + strlen(deviceNo) + 1 + strlen(suffix) + 1; pr_debug("%s: Capture app type cntrl add\n", __func__); ret = snd_pcm_add_usr_ctls(pcm, SNDRV_PCM_STREAM_CAPTURE, NULL, 1, ctl_len, rtd->dai_link->be_id, &app_type_info); if (ret < 0) { pr_err("%s: capture app type cntrl add failed: %d\n", __func__, ret); return ret; } kctl = app_type_info->kctl; kctl->put = msm_pcm_app_type_cfg_ctl_put; kctl->get = msm_pcm_app_type_cfg_ctl_get; snprintf(kctl->id.name, ctl_len, "%s %d %s", capture_mixer_ctl_name, rtd->pcm->device, suffix); kctl->put = msm_pcm_capture_app_type_cfg_ctl_put; kctl->get = msm_pcm_capture_app_type_cfg_ctl_get; } return 0; } Loading
sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c +81 −51 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ static unsigned long session_copp_map[MSM_FRONTEND_DAI_MM_SIZE][2] [MSM_BACKEND_DAI_MAX]; static struct msm_pcm_routing_app_type_data app_type_cfg[MAX_APP_TYPES]; static struct msm_pcm_stream_app_type_cfg fe_dai_app_type_cfg[MSM_FRONTEND_DAI_MM_SIZE]; fe_dai_app_type_cfg[MSM_FRONTEND_DAI_MM_SIZE][2]; /* The caller of this should aqcuire routing lock */ void msm_pcm_routing_get_bedai_info(int be_idx, Loading Loading @@ -540,34 +540,43 @@ static int msm_pcm_routing_get_app_type_idx(int app_type) } void msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int app_type, int acdb_dev_id, int sample_rate) int acdb_dev_id, int sample_rate, int session_type) { pr_debug("%s: fedai_id %d, app_type %d, sample_rate %d\n", __func__, fedai_id, app_type, sample_rate); pr_debug("%s: fedai_id %d, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fedai_id, session_type, app_type, acdb_dev_id, sample_rate); if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_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; fe_dai_app_type_cfg[fedai_id].acdb_dev_id = acdb_dev_id; fe_dai_app_type_cfg[fedai_id].sample_rate = sample_rate; if (session_type != SESSION_TYPE_RX && session_type != SESSION_TYPE_TX) { pr_err("%s: Invalid session type %d\n", __func__, session_type); return; } fe_dai_app_type_cfg[fedai_id][session_type].app_type = app_type; fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id = acdb_dev_id; fe_dai_app_type_cfg[fedai_id][session_type].sample_rate = sample_rate; } /** * msm_pcm_routing_get_stream_app_type_cfg * * Receives fedai_id and populates app_type, acdb_dev_id, & * Receives fedai_id, session_type 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 * session_type - Passed value, session type 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 msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int session_type, int *app_type, int *acdb_dev_id, int *sample_rate) { int ret = 0; Loading @@ -588,13 +597,20 @@ int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int *app_type, __func__, fedai_id); ret = -EINVAL; goto done; } else if (session_type != SESSION_TYPE_RX && session_type != SESSION_TYPE_TX) { pr_err("%s: Invalid session type %d\n", __func__, session_type); 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; *app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; *acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; *sample_rate = fe_dai_app_type_cfg[fedai_id][session_type].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); pr_debug("%s: fedai_id %d, session_type %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fedai_id, session_type, *app_type, *acdb_dev_id, *sample_rate); done: return ret; } Loading Loading @@ -651,7 +667,8 @@ static struct cal_block_data *msm_routing_find_topology(int path, return msm_routing_find_topology_by_path(path); } static int msm_routing_get_adm_topology(int path, int fedai_id) static int msm_routing_get_adm_topology(int path, int fedai_id, int session_type) { int topology = NULL_COPP_TOPOLOGY; struct cal_block_data *cal_block = NULL; Loading @@ -664,11 +681,10 @@ static int msm_routing_get_adm_topology(int path, int fedai_id) mutex_lock(&cal_data->lock); if (path == RX_DEVICE) { 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; } app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; sample_rate = fe_dai_app_type_cfg[fedai_id][session_type].sample_rate; cal_block = msm_routing_find_topology(path, app_type, acdb_dev_id, sample_rate); if (cal_block == NULL) Loading Loading @@ -724,9 +740,12 @@ static void msm_pcm_routing_build_matrix(int fedai_id, int sess_type, if (num_copps) { payload.num_copps = num_copps; payload.session_id = fe_dai_map[fedai_id][sess_type].strm_id; payload.app_type = fe_dai_app_type_cfg[fedai_id].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate; payload.app_type = fe_dai_app_type_cfg[fedai_id][sess_type].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id][sess_type].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id][sess_type].sample_rate; adm_matrix_map(path_type, payload, perf_mode); msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode); } Loading Loading @@ -826,8 +845,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, bit_width = msm_routing_get_bit_width( msm_bedais[i].format); app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ? fe_dai_app_type_cfg[fe_id].app_type : 0; app_type = fe_dai_app_type_cfg[fe_id][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx( Loading @@ -839,9 +858,10 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, } else { sample_rate = msm_bedais[i].sample_rate; } acdb_dev_id = fe_dai_app_type_cfg[fe_id].acdb_dev_id; acdb_dev_id = fe_dai_app_type_cfg[fe_id][session_type].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, fe_id); fe_id, session_type); pr_err("%s: Before adm open topology %d\n", __func__, topology); Loading Loading @@ -886,8 +906,10 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, if (num_copps) { payload.num_copps = num_copps; payload.session_id = fe_dai_map[fe_id][session_type].strm_id; payload.app_type = fe_dai_app_type_cfg[fe_id].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fe_id].acdb_dev_id; payload.app_type = fe_dai_app_type_cfg[fe_id][session_type].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fe_id][session_type].acdb_dev_id; adm_matrix_map(path_type, payload, perf_mode); msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode); } Loading Loading @@ -977,21 +999,23 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, bits_per_sample = msm_routing_get_bit_width( msm_bedais[i].format); app_type = (stream_type == SNDRV_PCM_STREAM_PLAYBACK) ? fe_dai_app_type_cfg[fedai_id].app_type : 0; app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx(app_type); sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate; fe_dai_app_type_cfg[fedai_id][session_type]. sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; } else sample_rate = msm_bedais[i].sample_rate; acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id; acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, fedai_id); fedai_id, session_type); copp_idx = adm_open(msm_bedais[i].port_id, path_type, sample_rate, channels, topology, perf_mode, bits_per_sample, Loading Loading @@ -1036,9 +1060,12 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, if (num_copps) { payload.num_copps = num_copps; payload.session_id = fe_dai_map[fedai_id][session_type].strm_id; payload.app_type = fe_dai_app_type_cfg[fedai_id].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id].sample_rate; payload.app_type = fe_dai_app_type_cfg[fedai_id][session_type].app_type; payload.acdb_dev_id = fe_dai_app_type_cfg[fedai_id][session_type].acdb_dev_id; payload.sample_rate = fe_dai_app_type_cfg[fedai_id][session_type].sample_rate; adm_matrix_map(path_type, payload, perf_mode); msm_pcm_routng_cfg_matrix_map_pp(payload, path_type, perf_mode); } Loading Loading @@ -1199,20 +1226,23 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) bits_per_sample = msm_routing_get_bit_width( msm_bedais[reg].format); app_type = (session_type == SESSION_TYPE_RX) ? fe_dai_app_type_cfg[val].app_type : 0; app_type = fe_dai_app_type_cfg[val][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx(app_type); sample_rate = fe_dai_app_type_cfg[val].sample_rate; fe_dai_app_type_cfg[val][session_type]. sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; } else sample_rate = msm_bedais[reg].sample_rate; topology = msm_routing_get_adm_topology(path_type, val); acdb_dev_id = fe_dai_app_type_cfg[val].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, val, session_type); acdb_dev_id = fe_dai_app_type_cfg[val][session_type].acdb_dev_id; copp_idx = adm_open(msm_bedais[reg].port_id, path_type, sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, Loading Loading @@ -9054,7 +9084,6 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) int i, path_type, session_type, topology; struct msm_pcm_routing_bdai_data *bedai; u32 channels, sample_rate; bool playback, capture; uint16_t bits_per_sample = 16, voc_path_type; struct msm_pcm_routing_fdai_data *fdai; u32 session_id; Loading Loading @@ -9090,8 +9119,6 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) * is started. */ bedai->active = 1; playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; capture = substream->stream == SNDRV_PCM_STREAM_CAPTURE; for_each_set_bit(i, &bedai->fe_sessions, MSM_FRONTEND_DAI_MM_SIZE) { fdai = &fe_dai_map[i][session_type]; Loading @@ -9113,20 +9140,23 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) bits_per_sample = msm_routing_get_bit_width( bedai->format); app_type = playback ? fe_dai_app_type_cfg[i].app_type : 0; app_type = fe_dai_app_type_cfg[i][session_type].app_type; if (app_type) { app_type_idx = msm_pcm_routing_get_app_type_idx(app_type); sample_rate = fe_dai_app_type_cfg[i].sample_rate; fe_dai_app_type_cfg[i][session_type]. sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; } else sample_rate = bedai->sample_rate; channels = bedai->channel; acdb_dev_id = fe_dai_app_type_cfg[i].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, i); acdb_dev_id = fe_dai_app_type_cfg[i][session_type].acdb_dev_id; topology = msm_routing_get_adm_topology(path_type, i, session_type); copp_idx = adm_open(bedai->port_id, path_type, sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, Loading
sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h +3 −3 Original line number Diff line number Diff line Loading @@ -400,7 +400,7 @@ void msm_pcm_routing_acquire_lock(void); 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); int acdb_dev_id, int sample_rate, int session_type); int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int session_type, int *app_type, int *acdb_dev_id, int *sample_rate); #endif /*_MSM_PCM_H*/