Loading asoc/msm-pcm-loopback-v2.c +21 −10 Original line number Diff line number Diff line Loading @@ -627,16 +627,19 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -667,9 +670,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading @@ -680,16 +686,19 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -720,9 +729,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading asoc/msm-pcm-q6-v2.c +20 −10 Original line number Diff line number Diff line Loading @@ -1967,16 +1967,19 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -2007,9 +2010,11 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading @@ -2020,16 +2025,19 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -2060,9 +2068,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading asoc/msm-pcm-routing-v2.c +23 −8 Original line number Diff line number Diff line Loading @@ -1250,10 +1250,10 @@ int msm_pcm_routing_reg_stream_app_type_cfg( goto done; } pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d copp_token %d\n", __func__, fedai_id, session_type, be_id, cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->sample_rate); cfg_data->sample_rate, cfg_data->copp_token); if (!is_mm_lsm_fe_id(fedai_id)) { pr_err("%s: Invalid machine driver ID %d\n", Loading Loading @@ -1336,10 +1336,10 @@ int msm_pcm_routing_get_stream_app_type_cfg( *bedai_id = be_id; *cfg_data = fe_dai_app_type_cfg[fedai_id][session_type][be_id]; pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d copp_token %d\n", __func__, fedai_id, session_type, *bedai_id, cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->sample_rate); cfg_data->sample_rate, cfg_data->copp_token); done: return ret; } Loading Loading @@ -1626,6 +1626,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, u32 channels, sample_rate; u16 bit_width = 16, be_bit_width; bool is_lsm; uint32_t copp_token = 0; pr_debug("%s:fe_id[%d] perf_mode[%d] id[%d] stream_type[%d] passt[%d]", __func__, fe_id, perf_mode, dspst_id, Loading Loading @@ -1710,6 +1711,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, fe_dai_app_type_cfg[fe_id][session_type][i].sample_rate; bit_width = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[fe_id][session_type][i].copp_token; } else { sample_rate = msm_bedais[i].sample_rate; } Loading Loading @@ -1739,7 +1742,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, adm_open(port_id, path_type, sample_rate, channels, topology, perf_mode, bit_width, app_type, acdb_dev_id, session_type, passthr_mode); session_type, passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s:adm open failed coppid:%d\n", Loading Loading @@ -2014,6 +2017,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, uint16_t bits_per_sample = 16, be_bit_width; uint32_t passthr_mode = LEGACY_PCM; int ret = 0; uint32_t copp_token = 0; if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) { /* bad ID assigned in machine driver */ Loading Loading @@ -2070,6 +2074,9 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, .sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[fedai_id][session_type][i] .copp_token; } else sample_rate = msm_bedais[i].sample_rate; Loading @@ -2091,7 +2098,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, sample_rate, channels, topology, perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode); session_type, passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed copp_idx:%d\n", Loading Loading @@ -2254,6 +2261,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) struct msm_pcm_routing_fdai_data *fdai; uint32_t passthr_mode; bool is_lsm; uint32_t copp_token = 0; pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set); Loading Loading @@ -2352,6 +2360,9 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) .sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[val][session_type][reg] .copp_token; } else sample_rate = msm_bedais[reg].sample_rate; Loading @@ -2372,7 +2383,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode); session_type, passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed\n", __func__); Loading Loading @@ -30045,6 +30056,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) u32 session_id; struct media_format_info voc_be_media_format; bool is_lsm; uint32_t copp_token = 0; pr_debug("%s: substream->pcm->id:%s\n", __func__, substream->pcm->id); Loading Loading @@ -30128,6 +30140,9 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) [be_id].sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[i][session_type] [be_id].copp_token; } else sample_rate = bedai->sample_rate; /* Loading Loading @@ -30160,7 +30175,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, fdai->passthr_mode); session_type, fdai->passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed\n", __func__); asoc/msm-pcm-routing-v2.h +1 −0 Original line number Diff line number Diff line Loading @@ -607,6 +607,7 @@ struct msm_pcm_stream_app_type_cfg { int app_type; int acdb_dev_id; int sample_rate; uint32_t copp_token; }; /* dai_id: front-end ID, Loading dsp/q6adm.c +38 −3 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ struct adm_copp { atomic_t adm_delay_stat[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; uint32_t adm_delay[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; unsigned long adm_status[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; atomic_t token[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; }; struct source_tracking_data { Loading Loading @@ -104,6 +105,7 @@ struct adm_ctl { [PCM_FORMAT_MAX_NUM_CHANNEL_V8]; int ffecns_port_id; int native_mode; uint32_t copp_token; }; static struct adm_ctl this_adm; Loading Loading @@ -280,15 +282,45 @@ static int adm_get_copp_id(int port_idx, int copp_idx) return atomic_read(&this_adm.copp.id[port_idx][copp_idx]); } static int adm_get_idx_if_single_copp_exists(int port_idx, int topology, int mode, int rate, int bit_width, uint32_t copp_token) { int idx; pr_debug("%s: copp_token %d\n", __func__, copp_token); for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++) if ((topology == atomic_read(&this_adm.copp.topology[port_idx][idx])) && (mode == atomic_read(&this_adm.copp.mode[port_idx][idx])) && (rate == atomic_read(&this_adm.copp.rate[port_idx][idx])) && (bit_width == atomic_read(&this_adm.copp.bit_width[port_idx][idx])) && (copp_token == atomic_read(&this_adm.copp.token[port_idx][idx]))) return idx; return -EINVAL; } static int adm_get_idx_if_copp_exists(int port_idx, int topology, int mode, int rate, int bit_width, int app_type, int session_type) int session_type, uint32_t copp_token) { int idx; pr_debug("%s: port_idx-%d, topology-0x%x, mode-%d, rate-%d, bit_width-%d\n", __func__, port_idx, topology, mode, rate, bit_width); if (copp_token) return adm_get_idx_if_single_copp_exists(port_idx, topology, mode, rate, bit_width, copp_token); for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++) if ((topology == atomic_read(&this_adm.copp.topology[port_idx][idx])) && Loading Loading @@ -2991,7 +3023,7 @@ static int adm_copp_set_ec_ref_mfc_cfg(int port_id, int copp_idx, */ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, int perf_mode, uint16_t bit_width, int app_type, int acdb_id, int session_type, uint32_t passthr_mode) int session_type, uint32_t passthr_mode, uint32_t copp_token) { struct adm_cmd_device_open_v5 open; struct adm_cmd_device_open_v6 open_v6; Loading Loading @@ -3094,7 +3126,7 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, copp_idx = adm_get_idx_if_copp_exists(port_idx, topology, perf_mode, rate, bit_width, app_type, session_type); app_type, session_type, copp_token); if (copp_idx < 0) { copp_idx = adm_get_next_available_copp(port_idx); Loading @@ -3120,6 +3152,8 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, acdb_id); atomic_set(&this_adm.copp.session_type[port_idx][copp_idx], session_type); atomic_set(&this_adm.copp.token[port_idx][copp_idx], copp_token); set_bit(ADM_STATUS_CALIBRATION_REQUIRED, (void *)&this_adm.copp.adm_status[port_idx][copp_idx]); if ((path != ADM_PATH_COMPRESSED_RX) && Loading Loading @@ -3906,6 +3940,7 @@ int adm_close(int port_id, int perf_mode, int copp_idx) atomic_set(&this_adm.copp.bit_width[port_idx][copp_idx], 0); atomic_set(&this_adm.copp.app_type[port_idx][copp_idx], 0); atomic_set(&this_adm.copp.session_type[port_idx][copp_idx], 0); atomic_set(&this_adm.copp.token[port_idx][copp_idx], 0); clear_bit(ADM_STATUS_CALIBRATION_REQUIRED, (void *)&this_adm.copp.adm_status[port_idx][copp_idx]); Loading Loading
asoc/msm-pcm-loopback-v2.c +21 −10 Original line number Diff line number Diff line Loading @@ -627,16 +627,19 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -667,9 +670,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading @@ -680,16 +686,19 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -720,9 +729,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading
asoc/msm-pcm-q6-v2.c +20 −10 Original line number Diff line number Diff line Loading @@ -1967,16 +1967,19 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -2007,9 +2010,11 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading @@ -2020,16 +2025,19 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0}; int ret = 0; cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", if (ucontrol->value.integer.value[4] != 0) cfg_data.copp_token = ucontrol->value.integer.value[4]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, be_id, &cfg_data); if (ret < 0) Loading Loading @@ -2060,9 +2068,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[3] = 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", ucontrol->value.integer.value[4] = cfg_data.copp_token; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d copp_token %d\n", __func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate, cfg_data.copp_token); done: return ret; } Loading
asoc/msm-pcm-routing-v2.c +23 −8 Original line number Diff line number Diff line Loading @@ -1250,10 +1250,10 @@ int msm_pcm_routing_reg_stream_app_type_cfg( goto done; } pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d copp_token %d\n", __func__, fedai_id, session_type, be_id, cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->sample_rate); cfg_data->sample_rate, cfg_data->copp_token); if (!is_mm_lsm_fe_id(fedai_id)) { pr_err("%s: Invalid machine driver ID %d\n", Loading Loading @@ -1336,10 +1336,10 @@ int msm_pcm_routing_get_stream_app_type_cfg( *bedai_id = be_id; *cfg_data = fe_dai_app_type_cfg[fedai_id][session_type][be_id]; pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d copp_token %d\n", __func__, fedai_id, session_type, *bedai_id, cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->sample_rate); cfg_data->sample_rate, cfg_data->copp_token); done: return ret; } Loading Loading @@ -1626,6 +1626,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, u32 channels, sample_rate; u16 bit_width = 16, be_bit_width; bool is_lsm; uint32_t copp_token = 0; pr_debug("%s:fe_id[%d] perf_mode[%d] id[%d] stream_type[%d] passt[%d]", __func__, fe_id, perf_mode, dspst_id, Loading Loading @@ -1710,6 +1711,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, fe_dai_app_type_cfg[fe_id][session_type][i].sample_rate; bit_width = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[fe_id][session_type][i].copp_token; } else { sample_rate = msm_bedais[i].sample_rate; } Loading Loading @@ -1739,7 +1742,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, adm_open(port_id, path_type, sample_rate, channels, topology, perf_mode, bit_width, app_type, acdb_dev_id, session_type, passthr_mode); session_type, passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s:adm open failed coppid:%d\n", Loading Loading @@ -2014,6 +2017,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, uint16_t bits_per_sample = 16, be_bit_width; uint32_t passthr_mode = LEGACY_PCM; int ret = 0; uint32_t copp_token = 0; if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) { /* bad ID assigned in machine driver */ Loading Loading @@ -2070,6 +2074,9 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, .sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[fedai_id][session_type][i] .copp_token; } else sample_rate = msm_bedais[i].sample_rate; Loading @@ -2091,7 +2098,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, sample_rate, channels, topology, perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode); session_type, passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed copp_idx:%d\n", Loading Loading @@ -2254,6 +2261,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) struct msm_pcm_routing_fdai_data *fdai; uint32_t passthr_mode; bool is_lsm; uint32_t copp_token = 0; pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set); Loading Loading @@ -2352,6 +2360,9 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) .sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[val][session_type][reg] .copp_token; } else sample_rate = msm_bedais[reg].sample_rate; Loading @@ -2372,7 +2383,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, passthr_mode); session_type, passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed\n", __func__); Loading Loading @@ -30045,6 +30056,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) u32 session_id; struct media_format_info voc_be_media_format; bool is_lsm; uint32_t copp_token = 0; pr_debug("%s: substream->pcm->id:%s\n", __func__, substream->pcm->id); Loading Loading @@ -30128,6 +30140,9 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) [be_id].sample_rate; bits_per_sample = app_type_cfg[app_type_idx].bit_width; copp_token = fe_dai_app_type_cfg[i][session_type] [be_id].copp_token; } else sample_rate = bedai->sample_rate; /* Loading Loading @@ -30160,7 +30175,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, app_type, acdb_dev_id, session_type, fdai->passthr_mode); session_type, fdai->passthr_mode, copp_token); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed\n", __func__);
asoc/msm-pcm-routing-v2.h +1 −0 Original line number Diff line number Diff line Loading @@ -607,6 +607,7 @@ struct msm_pcm_stream_app_type_cfg { int app_type; int acdb_dev_id; int sample_rate; uint32_t copp_token; }; /* dai_id: front-end ID, Loading
dsp/q6adm.c +38 −3 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ struct adm_copp { atomic_t adm_delay_stat[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; uint32_t adm_delay[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; unsigned long adm_status[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; atomic_t token[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; }; struct source_tracking_data { Loading Loading @@ -104,6 +105,7 @@ struct adm_ctl { [PCM_FORMAT_MAX_NUM_CHANNEL_V8]; int ffecns_port_id; int native_mode; uint32_t copp_token; }; static struct adm_ctl this_adm; Loading Loading @@ -280,15 +282,45 @@ static int adm_get_copp_id(int port_idx, int copp_idx) return atomic_read(&this_adm.copp.id[port_idx][copp_idx]); } static int adm_get_idx_if_single_copp_exists(int port_idx, int topology, int mode, int rate, int bit_width, uint32_t copp_token) { int idx; pr_debug("%s: copp_token %d\n", __func__, copp_token); for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++) if ((topology == atomic_read(&this_adm.copp.topology[port_idx][idx])) && (mode == atomic_read(&this_adm.copp.mode[port_idx][idx])) && (rate == atomic_read(&this_adm.copp.rate[port_idx][idx])) && (bit_width == atomic_read(&this_adm.copp.bit_width[port_idx][idx])) && (copp_token == atomic_read(&this_adm.copp.token[port_idx][idx]))) return idx; return -EINVAL; } static int adm_get_idx_if_copp_exists(int port_idx, int topology, int mode, int rate, int bit_width, int app_type, int session_type) int session_type, uint32_t copp_token) { int idx; pr_debug("%s: port_idx-%d, topology-0x%x, mode-%d, rate-%d, bit_width-%d\n", __func__, port_idx, topology, mode, rate, bit_width); if (copp_token) return adm_get_idx_if_single_copp_exists(port_idx, topology, mode, rate, bit_width, copp_token); for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++) if ((topology == atomic_read(&this_adm.copp.topology[port_idx][idx])) && Loading Loading @@ -2991,7 +3023,7 @@ static int adm_copp_set_ec_ref_mfc_cfg(int port_id, int copp_idx, */ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, int perf_mode, uint16_t bit_width, int app_type, int acdb_id, int session_type, uint32_t passthr_mode) int session_type, uint32_t passthr_mode, uint32_t copp_token) { struct adm_cmd_device_open_v5 open; struct adm_cmd_device_open_v6 open_v6; Loading Loading @@ -3094,7 +3126,7 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, copp_idx = adm_get_idx_if_copp_exists(port_idx, topology, perf_mode, rate, bit_width, app_type, session_type); app_type, session_type, copp_token); if (copp_idx < 0) { copp_idx = adm_get_next_available_copp(port_idx); Loading @@ -3120,6 +3152,8 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, acdb_id); atomic_set(&this_adm.copp.session_type[port_idx][copp_idx], session_type); atomic_set(&this_adm.copp.token[port_idx][copp_idx], copp_token); set_bit(ADM_STATUS_CALIBRATION_REQUIRED, (void *)&this_adm.copp.adm_status[port_idx][copp_idx]); if ((path != ADM_PATH_COMPRESSED_RX) && Loading Loading @@ -3906,6 +3940,7 @@ int adm_close(int port_id, int perf_mode, int copp_idx) atomic_set(&this_adm.copp.bit_width[port_idx][copp_idx], 0); atomic_set(&this_adm.copp.app_type[port_idx][copp_idx], 0); atomic_set(&this_adm.copp.session_type[port_idx][copp_idx], 0); atomic_set(&this_adm.copp.token[port_idx][copp_idx], 0); clear_bit(ADM_STATUS_CALIBRATION_REQUIRED, (void *)&this_adm.copp.adm_status[port_idx][copp_idx]); Loading