Merge "ASoC: msm: extend audio stream app type cfg mixer with bit width"

This commit is contained in:
qctecmdr 2021-07-24 11:19:19 -07:00 • committed by Gerrit - the friendly Code Review server
commit a80fc839ea
4 changed files with 63 additions and 36 deletions

36
asoc/msm-pcm-loopback-v2.c Executable file → Normal file
View file

@ -683,7 +683,7 @@ 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, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -692,10 +692,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.sample_rate = ucontrol->value.integer.value[2];
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.copp_token);
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -727,10 +729,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id;
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",
ucontrol->value.integer.value[5] = cfg_data.bit_width;
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id,
cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
cfg_data.copp_token);
cfg_data.copp_token, cfg_data.bit_width);
done:
return ret;
@ -742,7 +746,7 @@ 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, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -751,10 +755,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.sample_rate = ucontrol->value.integer.value[2];
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.copp_token);
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -786,10 +792,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id;
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",
ucontrol->value.integer.value[5] = cfg_data.bit_width;
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id,
cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate,
cfg_data.copp_token);
cfg_data.copp_token, cfg_data.bit_width);
done:
return ret;
}

42
asoc/msm-pcm-q6-v2.c Executable file → Normal file
View file

@ -2091,7 +2091,7 @@ 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, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -2100,10 +2100,12 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.sample_rate = ucontrol->value.integer.value[2];
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.copp_token);
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -2135,10 +2137,11 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id;
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.copp_token);
ucontrol->value.integer.value[5] = cfg_data.bit_width;
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
done:
return ret;
}
@ -2149,7 +2152,7 @@ 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, 0};
struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000, 0, 0};
int ret = 0;
cfg_data.app_type = ucontrol->value.integer.value[0];
@ -2158,10 +2161,12 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol,
cfg_data.sample_rate = ucontrol->value.integer.value[2];
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.copp_token);
if (ucontrol->value.integer.value[5] != 0)
cfg_data.bit_width = ucontrol->value.integer.value[5];
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type,
be_id, &cfg_data);
if (ret < 0)
@ -2193,10 +2198,11 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol,
ucontrol->value.integer.value[2] = cfg_data.sample_rate;
ucontrol->value.integer.value[3] = be_id;
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.copp_token);
ucontrol->value.integer.value[5] = cfg_data.bit_width;
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 bit_width- %d\n",
__func__, fe_id, session_type, be_id, cfg_data.app_type, cfg_data.acdb_dev_id,
cfg_data.sample_rate, cfg_data.copp_token, cfg_data.bit_width);
done:
return ret;
}

View file

@ -1480,10 +1480,12 @@ 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 copp_token %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, bit_width %d\n",
__func__, fedai_id, session_type, be_id,
cfg_data->app_type, cfg_data->acdb_dev_id,
cfg_data->sample_rate, cfg_data->copp_token);
cfg_data->sample_rate, cfg_data->copp_token,
cfg_data->bit_width);
if (!is_mm_lsm_fe_id(fedai_id)) {
pr_err("%s: Invalid machine driver ID %d\n",
@ -1566,10 +1568,12 @@ 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 copp_token %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, bit_width %d\n",
__func__, fedai_id, session_type, *bedai_id,
cfg_data->app_type, cfg_data->acdb_dev_id,
cfg_data->sample_rate, cfg_data->copp_token);
cfg_data->sample_rate, cfg_data->copp_token,
cfg_data->bit_width);
done:
return ret;
}
@ -1990,6 +1994,8 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
sample_rate =
fe_dai_app_type_cfg[fe_id][session_type][i].sample_rate;
bit_width =
(fe_dai_app_type_cfg[fe_id][session_type][i].bit_width) ?
fe_dai_app_type_cfg[fe_id][session_type][i].bit_width :
app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[fe_id][session_type][i].copp_token;
@ -2362,6 +2368,8 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
fe_dai_app_type_cfg[fedai_id][session_type][i]
.sample_rate;
bits_per_sample =
(fe_dai_app_type_cfg[fedai_id][session_type][i].bit_width) ?
fe_dai_app_type_cfg[fedai_id][session_type][i].bit_width :
app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[fedai_id][session_type][i]
@ -2674,6 +2682,8 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
fe_dai_app_type_cfg[val][session_type][reg]
.sample_rate;
bits_per_sample =
(fe_dai_app_type_cfg[val][session_type][reg].bit_width) ?
fe_dai_app_type_cfg[val][session_type][reg].bit_width :
app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[val][session_type][reg]
@ -41457,6 +41467,8 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
fe_dai_app_type_cfg[i][session_type]
[be_id].sample_rate;
bits_per_sample =
(fe_dai_app_type_cfg[i][session_type][be_id].bit_width) ?
fe_dai_app_type_cfg[i][session_type][be_id].bit_width :
app_type_cfg[app_type_idx].bit_width;
copp_token =
fe_dai_app_type_cfg[i][session_type]

View file

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