Merge "ASoC: msm: Support different POPPs to single COPP"

This commit is contained in:
qctecmdr
2020-07-17 22:40:14 -07:00
committed by Gerrit - the friendly Code Review server
6 changed files with 104 additions and 32 deletions

View File

@@ -627,16 +627,19 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value; u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_RX; int session_type = SESSION_TYPE_RX;
int be_id = ucontrol->value.integer.value[3]; 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; int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.app_type = ucontrol->value.integer.value[0];
cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1];
if (ucontrol->value.integer.value[2] != 0) if (ucontrol->value.integer.value[2] != 0)
cfg_data.sample_rate = ucontrol->value.integer.value[2]; 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, __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, ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data); be_id, &cfg_data);
if (ret < 0) if (ret < 0)
@@ -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[1] = cfg_data.acdb_dev_id;
ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id; 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, __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: done:
return ret; return ret;
} }
@@ -680,16 +686,19 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value; u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_TX; int session_type = SESSION_TYPE_TX;
int be_id = ucontrol->value.integer.value[3]; 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; int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.app_type = ucontrol->value.integer.value[0];
cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1];
if (ucontrol->value.integer.value[2] != 0) if (ucontrol->value.integer.value[2] != 0)
cfg_data.sample_rate = ucontrol->value.integer.value[2]; 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, __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, ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data); be_id, &cfg_data);
if (ret < 0) if (ret < 0)
@@ -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[1] = cfg_data.acdb_dev_id;
ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id; 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, __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: done:
return ret; return ret;
} }

View File

@@ -1967,16 +1967,19 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value; u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_RX; int session_type = SESSION_TYPE_RX;
int be_id = ucontrol->value.integer.value[3]; 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; int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.app_type = ucontrol->value.integer.value[0];
cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1];
if (ucontrol->value.integer.value[2] != 0) if (ucontrol->value.integer.value[2] != 0)
cfg_data.sample_rate = ucontrol->value.integer.value[2]; 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, __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, ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data); be_id, &cfg_data);
if (ret < 0) if (ret < 0)
@@ -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[1] = cfg_data.acdb_dev_id;
ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id; 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, __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: done:
return ret; return ret;
} }
@@ -2020,16 +2025,19 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
u64 fe_id = kcontrol->private_value; u64 fe_id = kcontrol->private_value;
int session_type = SESSION_TYPE_TX; int session_type = SESSION_TYPE_TX;
int be_id = ucontrol->value.integer.value[3]; 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; int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0]; cfg_data.app_type = ucontrol->value.integer.value[0];
cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; cfg_data.acdb_dev_id = ucontrol->value.integer.value[1];
if (ucontrol->value.integer.value[2] != 0) if (ucontrol->value.integer.value[2] != 0)
cfg_data.sample_rate = ucontrol->value.integer.value[2]; 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, __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, ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data); be_id, &cfg_data);
if (ret < 0) if (ret < 0)
@@ -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[1] = cfg_data.acdb_dev_id;
ucontrol->value.integer.value[2] = cfg_data.sample_rate; ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id; 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, __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: done:
return ret; return ret;
} }

View File

@@ -1250,10 +1250,10 @@ int msm_pcm_routing_reg_stream_app_type_cfg(
goto done; 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, __func__, fedai_id, session_type, be_id,
cfg_data->app_type, cfg_data->acdb_dev_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)) { if (!is_mm_lsm_fe_id(fedai_id)) {
pr_err("%s: Invalid machine driver ID %d\n", pr_err("%s: Invalid machine driver ID %d\n",
@@ -1336,10 +1336,10 @@ int msm_pcm_routing_get_stream_app_type_cfg(
*bedai_id = be_id; *bedai_id = be_id;
*cfg_data = fe_dai_app_type_cfg[fedai_id][session_type][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, __func__, fedai_id, session_type, *bedai_id,
cfg_data->app_type, cfg_data->acdb_dev_id, cfg_data->app_type, cfg_data->acdb_dev_id,
cfg_data->sample_rate); cfg_data->sample_rate, cfg_data->copp_token);
done: done:
return ret; return ret;
} }
@@ -1626,6 +1626,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
u32 channels, sample_rate; u32 channels, sample_rate;
u16 bit_width = 16, be_bit_width; u16 bit_width = 16, be_bit_width;
bool is_lsm; bool is_lsm;
uint32_t copp_token = 0;
pr_debug("%s:fe_id[%d] perf_mode[%d] id[%d] stream_type[%d] passt[%d]", pr_debug("%s:fe_id[%d] perf_mode[%d] id[%d] stream_type[%d] passt[%d]",
__func__, fe_id, perf_mode, dspst_id, __func__, fe_id, perf_mode, dspst_id,
@@ -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; fe_dai_app_type_cfg[fe_id][session_type][i].sample_rate;
bit_width = bit_width =
app_type_cfg[app_type_idx].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 { } else {
sample_rate = msm_bedais[i].sample_rate; sample_rate = msm_bedais[i].sample_rate;
} }
@@ -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, adm_open(port_id, path_type, sample_rate,
channels, topology, perf_mode, channels, topology, perf_mode,
bit_width, app_type, acdb_dev_id, bit_width, app_type, acdb_dev_id,
session_type, passthr_mode); session_type, passthr_mode, copp_token);
if ((copp_idx < 0) || if ((copp_idx < 0) ||
(copp_idx >= MAX_COPPS_PER_PORT)) { (copp_idx >= MAX_COPPS_PER_PORT)) {
pr_err("%s:adm open failed coppid:%d\n", pr_err("%s:adm open failed coppid:%d\n",
@@ -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; uint16_t bits_per_sample = 16, be_bit_width;
uint32_t passthr_mode = LEGACY_PCM; uint32_t passthr_mode = LEGACY_PCM;
int ret = 0; int ret = 0;
uint32_t copp_token = 0;
if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) { if (fedai_id > MSM_FRONTEND_DAI_MM_MAX_ID) {
/* bad ID assigned in machine driver */ /* bad ID assigned in machine driver */
@@ -2070,6 +2074,9 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
.sample_rate; .sample_rate;
bits_per_sample = bits_per_sample =
app_type_cfg[app_type_idx].bit_width; app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[fedai_id][session_type][i]
.copp_token;
} else } else
sample_rate = msm_bedais[i].sample_rate; sample_rate = msm_bedais[i].sample_rate;
@@ -2091,7 +2098,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
sample_rate, channels, topology, sample_rate, channels, topology,
perf_mode, bits_per_sample, perf_mode, bits_per_sample,
app_type, acdb_dev_id, app_type, acdb_dev_id,
session_type, passthr_mode); session_type, passthr_mode, copp_token);
if ((copp_idx < 0) || if ((copp_idx < 0) ||
(copp_idx >= MAX_COPPS_PER_PORT)) { (copp_idx >= MAX_COPPS_PER_PORT)) {
pr_err("%s: adm open failed copp_idx:%d\n", pr_err("%s: adm open failed copp_idx:%d\n",
@@ -2254,6 +2261,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
struct msm_pcm_routing_fdai_data *fdai; struct msm_pcm_routing_fdai_data *fdai;
uint32_t passthr_mode; uint32_t passthr_mode;
bool is_lsm; bool is_lsm;
uint32_t copp_token = 0;
pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set); pr_debug("%s: reg %x val %x set %x\n", __func__, reg, val, set);
@@ -2352,6 +2360,9 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
.sample_rate; .sample_rate;
bits_per_sample = bits_per_sample =
app_type_cfg[app_type_idx].bit_width; app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[val][session_type][reg]
.copp_token;
} else } else
sample_rate = msm_bedais[reg].sample_rate; sample_rate = msm_bedais[reg].sample_rate;
@@ -2372,7 +2383,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
sample_rate, channels, topology, sample_rate, channels, topology,
fdai->perf_mode, bits_per_sample, fdai->perf_mode, bits_per_sample,
app_type, acdb_dev_id, app_type, acdb_dev_id,
session_type, passthr_mode); session_type, passthr_mode, copp_token);
if ((copp_idx < 0) || if ((copp_idx < 0) ||
(copp_idx >= MAX_COPPS_PER_PORT)) { (copp_idx >= MAX_COPPS_PER_PORT)) {
pr_err("%s: adm open failed\n", __func__); pr_err("%s: adm open failed\n", __func__);
@@ -30045,6 +30056,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
u32 session_id; u32 session_id;
struct media_format_info voc_be_media_format; struct media_format_info voc_be_media_format;
bool is_lsm; bool is_lsm;
uint32_t copp_token = 0;
pr_debug("%s: substream->pcm->id:%s\n", pr_debug("%s: substream->pcm->id:%s\n",
__func__, substream->pcm->id); __func__, substream->pcm->id);
@@ -30128,6 +30140,9 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
[be_id].sample_rate; [be_id].sample_rate;
bits_per_sample = bits_per_sample =
app_type_cfg[app_type_idx].bit_width; app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[i][session_type]
[be_id].copp_token;
} else } else
sample_rate = bedai->sample_rate; sample_rate = bedai->sample_rate;
/* /*
@@ -30160,7 +30175,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
sample_rate, channels, topology, sample_rate, channels, topology,
fdai->perf_mode, bits_per_sample, fdai->perf_mode, bits_per_sample,
app_type, acdb_dev_id, app_type, acdb_dev_id,
session_type, fdai->passthr_mode); session_type, fdai->passthr_mode, copp_token);
if ((copp_idx < 0) || if ((copp_idx < 0) ||
(copp_idx >= MAX_COPPS_PER_PORT)) { (copp_idx >= MAX_COPPS_PER_PORT)) {
pr_err("%s: adm open failed\n", __func__); pr_err("%s: adm open failed\n", __func__);

View File

@@ -607,6 +607,7 @@ struct msm_pcm_stream_app_type_cfg {
int app_type; int app_type;
int acdb_dev_id; int acdb_dev_id;
int sample_rate; int sample_rate;
uint32_t copp_token;
}; };
/* dai_id: front-end ID, /* dai_id: front-end ID,

View File

@@ -67,6 +67,7 @@ struct adm_copp {
atomic_t adm_delay_stat[AFE_MAX_PORTS][MAX_COPPS_PER_PORT]; atomic_t adm_delay_stat[AFE_MAX_PORTS][MAX_COPPS_PER_PORT];
uint32_t adm_delay[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]; 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 { struct source_tracking_data {
@@ -104,6 +105,7 @@ struct adm_ctl {
[PCM_FORMAT_MAX_NUM_CHANNEL_V8]; [PCM_FORMAT_MAX_NUM_CHANNEL_V8];
int ffecns_port_id; int ffecns_port_id;
int native_mode; int native_mode;
uint32_t copp_token;
}; };
static struct adm_ctl this_adm; static struct adm_ctl this_adm;
@@ -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]); 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, static int adm_get_idx_if_copp_exists(int port_idx, int topology, int mode,
int rate, int bit_width, int app_type, int rate, int bit_width, int app_type,
int session_type) int session_type, uint32_t copp_token)
{ {
int idx; int idx;
pr_debug("%s: port_idx-%d, topology-0x%x, mode-%d, rate-%d, bit_width-%d\n", 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); __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++) for (idx = 0; idx < MAX_COPPS_PER_PORT; idx++)
if ((topology == if ((topology ==
atomic_read(&this_adm.copp.topology[port_idx][idx])) && atomic_read(&this_adm.copp.topology[port_idx][idx])) &&
@@ -2991,7 +3023,7 @@ exit:
*/ */
int adm_open(int port_id, int path, int rate, int channel_mode, int topology, 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 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_v5 open;
struct adm_cmd_device_open_v6 open_v6; struct adm_cmd_device_open_v6 open_v6;
@@ -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, copp_idx = adm_get_idx_if_copp_exists(port_idx, topology,
perf_mode, perf_mode,
rate, bit_width, rate, bit_width,
app_type, session_type); app_type, session_type, copp_token);
if (copp_idx < 0) { if (copp_idx < 0) {
copp_idx = adm_get_next_available_copp(port_idx); copp_idx = adm_get_next_available_copp(port_idx);
@@ -3120,6 +3152,8 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
acdb_id); acdb_id);
atomic_set(&this_adm.copp.session_type[port_idx][copp_idx], atomic_set(&this_adm.copp.session_type[port_idx][copp_idx],
session_type); session_type);
atomic_set(&this_adm.copp.token[port_idx][copp_idx],
copp_token);
set_bit(ADM_STATUS_CALIBRATION_REQUIRED, set_bit(ADM_STATUS_CALIBRATION_REQUIRED,
(void *)&this_adm.copp.adm_status[port_idx][copp_idx]); (void *)&this_adm.copp.adm_status[port_idx][copp_idx]);
if ((path != ADM_PATH_COMPRESSED_RX) && if ((path != ADM_PATH_COMPRESSED_RX) &&
@@ -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.bit_width[port_idx][copp_idx], 0);
atomic_set(&this_adm.copp.app_type[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.session_type[port_idx][copp_idx], 0);
atomic_set(&this_adm.copp.token[port_idx][copp_idx], 0);
clear_bit(ADM_STATUS_CALIBRATION_REQUIRED, clear_bit(ADM_STATUS_CALIBRATION_REQUIRED,
(void *)&this_adm.copp.adm_status[port_idx][copp_idx]); (void *)&this_adm.copp.adm_status[port_idx][copp_idx]);

View File

@@ -120,7 +120,7 @@ int adm_pack_and_set_one_pp_param(int port_id, int copp_idx,
int adm_open(int port, int path, int rate, int mode, int topology, int adm_open(int port, int path, int rate, int mode, int topology,
int perf_mode, uint16_t bits_per_sample, int perf_mode, uint16_t bits_per_sample,
int app_type, int acdbdev_id, int session_type, int app_type, int acdbdev_id, int session_type,
uint32_t pass_thr); uint32_t pass_thr, uint32_t copp_token);
int adm_map_rtac_block(struct rtac_cal_block_data *cal_block); int adm_map_rtac_block(struct rtac_cal_block_data *cal_block);