|
|
|
@ -41,41 +41,44 @@ static const struct sof_topology_token ipc4_comp_tokens[] = {
|
|
|
|
|
offsetof(struct sof_ipc4_base_module_cfg, is_pages)},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct sof_topology_token ipc4_audio_format_buffer_size_tokens[] = {
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IBS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_base_module_cfg, ibs)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OBS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_base_module_cfg, obs)},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct sof_topology_token ipc4_in_audio_format_tokens[] = {
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IN_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, sampling_frequency)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.sampling_frequency)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IN_BIT_DEPTH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, bit_depth)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.bit_depth)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_MAP, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, ch_map)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.ch_map)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IN_CH_CFG, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, ch_cfg)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.ch_cfg)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IN_INTERLEAVING_STYLE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
|
|
|
|
get_token_u32, offsetof(struct sof_ipc4_audio_format, interleaving_style)},
|
|
|
|
|
get_token_u32, offsetof(struct sof_ipc4_pin_format,
|
|
|
|
|
audio_fmt.interleaving_style)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IN_FMT_CFG, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, fmt_cfg)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.fmt_cfg)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_PIN_INDEX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, pin_index)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_IBS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, buffer_size)},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct sof_topology_token ipc4_out_audio_format_tokens[] = {
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OUT_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, sampling_frequency)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.sampling_frequency)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OUT_BIT_DEPTH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, bit_depth)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.bit_depth)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_MAP, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, ch_map)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.ch_map)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OUT_CH_CFG, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, ch_cfg)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.ch_cfg)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OUT_INTERLEAVING_STYLE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
|
|
|
|
get_token_u32, offsetof(struct sof_ipc4_audio_format, interleaving_style)},
|
|
|
|
|
get_token_u32, offsetof(struct sof_ipc4_pin_format,
|
|
|
|
|
audio_fmt.interleaving_style)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OUT_FMT_CFG, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_audio_format, fmt_cfg)},
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, audio_fmt.fmt_cfg)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_PIN_INDEX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, pin_index)},
|
|
|
|
|
{SOF_TKN_CAVS_AUDIO_FORMAT_OBS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
|
|
|
|
offsetof(struct sof_ipc4_pin_format, buffer_size)},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct sof_topology_token ipc4_copier_deep_buffer_tokens[] = {
|
|
|
|
@ -135,9 +138,6 @@ static const struct sof_token_info ipc4_token_list[SOF_TOKEN_COUNT] = {
|
|
|
|
|
ipc4_in_audio_format_tokens, ARRAY_SIZE(ipc4_in_audio_format_tokens)},
|
|
|
|
|
[SOF_OUT_AUDIO_FORMAT_TOKENS] = {"IPC4 Output Audio format tokens",
|
|
|
|
|
ipc4_out_audio_format_tokens, ARRAY_SIZE(ipc4_out_audio_format_tokens)},
|
|
|
|
|
[SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS] = {"IPC4 Audio format buffer size tokens",
|
|
|
|
|
ipc4_audio_format_buffer_size_tokens,
|
|
|
|
|
ARRAY_SIZE(ipc4_audio_format_buffer_size_tokens)},
|
|
|
|
|
[SOF_COPIER_DEEP_BUFFER_TOKENS] = {"IPC4 Copier deep buffer tokens",
|
|
|
|
|
ipc4_copier_deep_buffer_tokens, ARRAY_SIZE(ipc4_copier_deep_buffer_tokens)},
|
|
|
|
|
[SOF_COPIER_TOKENS] = {"IPC4 Copier tokens", ipc4_copier_tokens,
|
|
|
|
@ -148,20 +148,18 @@ static const struct sof_token_info ipc4_token_list[SOF_TOKEN_COUNT] = {
|
|
|
|
|
[SOF_SRC_TOKENS] = {"SRC tokens", src_tokens, ARRAY_SIZE(src_tokens)},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void sof_ipc4_dbg_audio_format(struct device *dev,
|
|
|
|
|
struct sof_ipc4_audio_format *format,
|
|
|
|
|
size_t object_size, int num_format)
|
|
|
|
|
static void sof_ipc4_dbg_audio_format(struct device *dev, struct sof_ipc4_pin_format *pin_fmt,
|
|
|
|
|
int num_formats)
|
|
|
|
|
{
|
|
|
|
|
struct sof_ipc4_audio_format *fmt;
|
|
|
|
|
void *ptr = format;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_format; i++, ptr = (u8 *)ptr + object_size) {
|
|
|
|
|
fmt = ptr;
|
|
|
|
|
for (i = 0; i < num_formats; i++) {
|
|
|
|
|
struct sof_ipc4_audio_format *fmt = &pin_fmt[i].audio_fmt;
|
|
|
|
|
dev_dbg(dev,
|
|
|
|
|
" #%d: %uHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x)\n",
|
|
|
|
|
i, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map,
|
|
|
|
|
fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg);
|
|
|
|
|
"Pin index #%d: %uHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n",
|
|
|
|
|
pin_fmt[i].pin_index, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map,
|
|
|
|
|
fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg,
|
|
|
|
|
pin_fmt[i].buffer_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -179,10 +177,9 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
|
|
|
|
|
struct sof_ipc4_available_audio_format *available_fmt,
|
|
|
|
|
struct sof_ipc4_base_module_cfg *module_base_cfg)
|
|
|
|
|
{
|
|
|
|
|
struct sof_ipc4_base_module_cfg *base_config;
|
|
|
|
|
struct sof_ipc4_audio_format *out_format, *in_format;
|
|
|
|
|
struct sof_ipc4_pin_format *out_format, *in_format;
|
|
|
|
|
int audio_fmt_num = 0;
|
|
|
|
|
int ret, i;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = sof_update_ipc_object(scomp, &audio_fmt_num,
|
|
|
|
|
SOF_AUDIO_FMT_NUM_TOKENS, swidget->tuples,
|
|
|
|
@ -195,47 +192,25 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
|
|
|
|
|
|
|
|
|
|
dev_dbg(scomp->dev, "Number of audio formats: %d\n", available_fmt->audio_fmt_num);
|
|
|
|
|
|
|
|
|
|
base_config = kcalloc(available_fmt->audio_fmt_num, sizeof(*base_config), GFP_KERNEL);
|
|
|
|
|
if (!base_config)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
/* set cpc and is_pages in the module's base_config */
|
|
|
|
|
ret = sof_update_ipc_object(scomp, module_base_cfg, SOF_COMP_TOKENS, swidget->tuples,
|
|
|
|
|
swidget->num_tuples, sizeof(*module_base_cfg), 1);
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(scomp->dev, "parse comp tokens for %s failed, error: %d\n",
|
|
|
|
|
swidget->widget->name, ret);
|
|
|
|
|
goto err;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev_dbg(scomp->dev, "widget %s cpc: %d is_pages: %d\n",
|
|
|
|
|
swidget->widget->name, module_base_cfg->cpc, module_base_cfg->is_pages);
|
|
|
|
|
|
|
|
|
|
/* copy the ibs/obs for each base_cfg */
|
|
|
|
|
ret = sof_update_ipc_object(scomp, base_config,
|
|
|
|
|
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS, swidget->tuples,
|
|
|
|
|
swidget->num_tuples, sizeof(*base_config),
|
|
|
|
|
available_fmt->audio_fmt_num);
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(scomp->dev, "parse buffer size tokens failed %d\n", ret);
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
in_format = kcalloc(available_fmt->audio_fmt_num, sizeof(*in_format), GFP_KERNEL);
|
|
|
|
|
if (!in_format)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < available_fmt->audio_fmt_num; i++)
|
|
|
|
|
dev_dbg(scomp->dev, "%d: ibs: %d obs: %d\n", i,
|
|
|
|
|
base_config[i].ibs, base_config[i].obs);
|
|
|
|
|
|
|
|
|
|
in_format = kcalloc(available_fmt->audio_fmt_num,
|
|
|
|
|
sizeof(struct sof_ipc4_audio_format), GFP_KERNEL);
|
|
|
|
|
if (!in_format) {
|
|
|
|
|
kfree(base_config);
|
|
|
|
|
ret = -ENOMEM;
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = sof_update_ipc_object(scomp, available_fmt->input_audio_fmts,
|
|
|
|
|
ret = sof_update_ipc_object(scomp, in_format,
|
|
|
|
|
SOF_IN_AUDIO_FORMAT_TOKENS, swidget->tuples,
|
|
|
|
|
swidget->num_tuples, sizeof(struct sof_ipc4_audio_format),
|
|
|
|
|
swidget->num_tuples, sizeof(*in_format),
|
|
|
|
|
available_fmt->audio_fmt_num);
|
|
|
|
|
if (ret) {
|
|
|
|
|
dev_err(scomp->dev, "parse base_config audio_fmt tokens failed %d\n", ret);
|
|
|
|
@ -243,8 +218,7 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev_dbg(scomp->dev, "Get input audio formats for %s\n", swidget->widget->name);
|
|
|
|
|
sof_ipc4_dbg_audio_format(scomp->dev, available_fmt->input_audio_fmts,
|
|
|
|
|
sizeof(struct sof_ipc4_audio_format),
|
|
|
|
|
sof_ipc4_dbg_audio_format(scomp->dev, available_fmt->input_pin_fmts,
|
|
|
|
|
available_fmt->audio_fmt_num);
|
|
|
|
|
|
|
|
|
|
out_format = kcalloc(available_fmt->audio_fmt_num, sizeof(*out_format), GFP_KERNEL);
|
|
|
|
@ -264,12 +238,10 @@ static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev_dbg(scomp->dev, "Get output audio formats for %s\n", swidget->widget->name);
|
|
|
|
|
sof_ipc4_dbg_audio_format(scomp->dev, out_format, sizeof(*out_format),
|
|
|
|
|
available_fmt->audio_fmt_num);
|
|
|
|
|
sof_ipc4_dbg_audio_format(scomp->dev, out_format, available_fmt->audio_fmt_num);
|
|
|
|
|
|
|
|
|
|
available_fmt->base_config = base_config;
|
|
|
|
|
available_fmt->out_audio_fmt = out_format;
|
|
|
|
|
available_fmt->input_audio_fmts = in_format;
|
|
|
|
|
available_fmt->output_pin_fmts = out_format;
|
|
|
|
|
available_fmt->input_pin_fmts = in_format;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
@ -277,8 +249,6 @@ err_out:
|
|
|
|
|
kfree(out_format);
|
|
|
|
|
err_in:
|
|
|
|
|
kfree(in_format);
|
|
|
|
|
err:
|
|
|
|
|
kfree(base_config);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -286,12 +256,10 @@ err:
|
|
|
|
|
static void sof_ipc4_free_audio_fmt(struct sof_ipc4_available_audio_format *available_fmt)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
kfree(available_fmt->base_config);
|
|
|
|
|
available_fmt->base_config = NULL;
|
|
|
|
|
kfree(available_fmt->out_audio_fmt);
|
|
|
|
|
available_fmt->out_audio_fmt = NULL;
|
|
|
|
|
kfree(available_fmt->input_audio_fmts);
|
|
|
|
|
available_fmt->input_audio_fmts = NULL;
|
|
|
|
|
kfree(available_fmt->output_pin_fmts);
|
|
|
|
|
available_fmt->output_pin_fmts = NULL;
|
|
|
|
|
kfree(available_fmt->input_pin_fmts);
|
|
|
|
|
available_fmt->input_pin_fmts = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void sof_ipc4_widget_free_comp_pipeline(struct snd_sof_widget *swidget)
|
|
|
|
@ -431,8 +399,7 @@ static void sof_ipc4_widget_free_comp_pcm(struct snd_sof_widget *swidget)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
available_fmt = &ipc4_copier->available_fmt;
|
|
|
|
|
kfree(available_fmt->base_config);
|
|
|
|
|
kfree(available_fmt->out_audio_fmt);
|
|
|
|
|
kfree(available_fmt->output_pin_fmts);
|
|
|
|
|
kfree(ipc4_copier->gtw_attr);
|
|
|
|
|
kfree(ipc4_copier);
|
|
|
|
|
swidget->private = NULL;
|
|
|
|
@ -584,8 +551,7 @@ static void sof_ipc4_widget_free_comp_dai(struct snd_sof_widget *swidget)
|
|
|
|
|
ipc4_copier = dai->private;
|
|
|
|
|
available_fmt = &ipc4_copier->available_fmt;
|
|
|
|
|
|
|
|
|
|
kfree(available_fmt->base_config);
|
|
|
|
|
kfree(available_fmt->out_audio_fmt);
|
|
|
|
|
kfree(available_fmt->output_pin_fmts);
|
|
|
|
|
if (ipc4_copier->dai_type != SOF_DAI_INTEL_SSP &&
|
|
|
|
|
ipc4_copier->dai_type != SOF_DAI_INTEL_DMIC)
|
|
|
|
|
kfree(ipc4_copier->copier_config);
|
|
|
|
@ -866,14 +832,14 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
|
|
|
|
|
struct snd_pcm_hw_params *params,
|
|
|
|
|
struct sof_ipc4_available_audio_format *available_fmt)
|
|
|
|
|
{
|
|
|
|
|
struct sof_ipc4_audio_format *fmt = available_fmt->ref_audio_fmt;
|
|
|
|
|
struct sof_ipc4_pin_format *pin_fmt = available_fmt->ref_audio_fmt;
|
|
|
|
|
u32 valid_bits;
|
|
|
|
|
u32 channels;
|
|
|
|
|
u32 rate;
|
|
|
|
|
int sample_valid_bits;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (!fmt) {
|
|
|
|
|
if (!pin_fmt) {
|
|
|
|
|
dev_err(sdev->dev, "no reference formats for %s\n", swidget->widget->name);
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
@ -902,7 +868,9 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
|
|
|
|
|
* Search supported audio formats to match rate, channels ,and
|
|
|
|
|
* sample_valid_bytes from runtime params
|
|
|
|
|
*/
|
|
|
|
|
for (i = 0; i < available_fmt->audio_fmt_num; i++, fmt++) {
|
|
|
|
|
for (i = 0; i < available_fmt->audio_fmt_num; i++) {
|
|
|
|
|
struct sof_ipc4_audio_format *fmt = &pin_fmt[i].audio_fmt;
|
|
|
|
|
|
|
|
|
|
rate = fmt->sampling_frequency;
|
|
|
|
|
channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg);
|
|
|
|
|
valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg);
|
|
|
|
@ -921,15 +889,16 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* copy input format */
|
|
|
|
|
memcpy(&base_config->audio_fmt, &available_fmt->input_audio_fmts[i], sizeof(*fmt));
|
|
|
|
|
memcpy(&base_config->audio_fmt, &available_fmt->input_pin_fmts[i].audio_fmt,
|
|
|
|
|
sizeof(*out_format));
|
|
|
|
|
|
|
|
|
|
/* set base_cfg ibs/obs */
|
|
|
|
|
base_config->ibs = available_fmt->base_config[i].ibs;
|
|
|
|
|
base_config->obs = available_fmt->base_config[i].obs;
|
|
|
|
|
base_config->ibs = available_fmt->input_pin_fmts[i].buffer_size;
|
|
|
|
|
base_config->obs = available_fmt->output_pin_fmts[i].buffer_size;
|
|
|
|
|
|
|
|
|
|
dev_dbg(sdev->dev, "Init input audio formats for %s\n", swidget->widget->name);
|
|
|
|
|
sof_ipc4_dbg_audio_format(sdev->dev, &base_config->audio_fmt,
|
|
|
|
|
sizeof(*base_config), 1);
|
|
|
|
|
sof_ipc4_dbg_audio_format(sdev->dev, &available_fmt->input_pin_fmts[i], 1);
|
|
|
|
|
|
|
|
|
|
if (out_format) {
|
|
|
|
|
/*
|
|
|
|
|
* Current topology defines pin 0 input and output formats only in pairs.
|
|
|
|
@ -938,10 +907,10 @@ static int sof_ipc4_init_audio_fmt(struct snd_sof_dev *sdev,
|
|
|
|
|
* input format. This logic will need to be updated when the format definitions
|
|
|
|
|
* in topology change.
|
|
|
|
|
*/
|
|
|
|
|
memcpy(out_format, &available_fmt->out_audio_fmt[i], sizeof(*fmt));
|
|
|
|
|
memcpy(out_format, &available_fmt->output_pin_fmts[i].audio_fmt,
|
|
|
|
|
sizeof(*out_format));
|
|
|
|
|
dev_dbg(sdev->dev, "Init output audio formats for %s\n", swidget->widget->name);
|
|
|
|
|
sof_ipc4_dbg_audio_format(sdev->dev, out_format,
|
|
|
|
|
sizeof(*out_format), 1);
|
|
|
|
|
sof_ipc4_dbg_audio_format(sdev->dev, &available_fmt->output_pin_fmts[i], 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the index of the matched format */
|
|
|
|
@ -1144,13 +1113,13 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
|
|
|
|
|
available_fmt = &ipc4_copier->available_fmt;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Use the input_audio_fmts to match pcm params for playback and the out_audio_fmt
|
|
|
|
|
* Use the input_pin_fmts to match pcm params for playback and the output_pin_fmts
|
|
|
|
|
* for capture.
|
|
|
|
|
*/
|
|
|
|
|
if (dir == SNDRV_PCM_STREAM_PLAYBACK)
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_audio_fmts;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
|
|
|
|
|
else
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->out_audio_fmt;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->output_pin_fmts;
|
|
|
|
|
|
|
|
|
|
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
|
|
|
|
|
copier_data->gtw_cfg.node_id |=
|
|
|
|
@ -1170,7 +1139,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
|
|
|
|
|
copier_data = &ipc4_copier->data;
|
|
|
|
|
available_fmt = &ipc4_copier->available_fmt;
|
|
|
|
|
if (dir == SNDRV_PCM_STREAM_CAPTURE) {
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->out_audio_fmt;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->output_pin_fmts;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* modify the input params for the dai copier as it only supports
|
|
|
|
@ -1180,7 +1149,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
|
|
|
|
|
snd_mask_none(fmt);
|
|
|
|
|
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
|
|
|
|
|
} else {
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_audio_fmts;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref_params = pipeline_params;
|
|
|
|
@ -1201,7 +1170,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
|
|
|
|
|
available_fmt = &ipc4_copier->available_fmt;
|
|
|
|
|
|
|
|
|
|
/* Use the input formats as the reference to match pcm params */
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_audio_fmts;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
|
|
|
|
|
ref_params = pipeline_params;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
@ -1388,7 +1357,7 @@ static int sof_ipc4_prepare_gain_module(struct snd_sof_widget *swidget,
|
|
|
|
|
struct sof_ipc4_available_audio_format *available_fmt = &gain->available_fmt;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_audio_fmts;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
|
|
|
|
|
|
|
|
|
|
/* output format is not required to be sent to the FW for gain */
|
|
|
|
|
ret = sof_ipc4_init_audio_fmt(sdev, swidget, &gain->base_config,
|
|
|
|
@ -1414,7 +1383,7 @@ static int sof_ipc4_prepare_mixer_module(struct snd_sof_widget *swidget,
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
/* only 32bit is supported by mixer */
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_audio_fmts;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
|
|
|
|
|
|
|
|
|
|
/* output format is not required to be sent to the FW for mixer */
|
|
|
|
|
ret = sof_ipc4_init_audio_fmt(sdev, swidget, &mixer->base_config,
|
|
|
|
@ -1440,7 +1409,7 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget,
|
|
|
|
|
struct snd_interval *rate;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_audio_fmts;
|
|
|
|
|
available_fmt->ref_audio_fmt = available_fmt->input_pin_fmts;
|
|
|
|
|
|
|
|
|
|
/* output format is not required to be sent to the FW for SRC */
|
|
|
|
|
ret = sof_ipc4_init_audio_fmt(sdev, swidget, &src->base_config,
|
|
|
|
@ -2147,7 +2116,6 @@ static int sof_ipc4_link_setup(struct snd_sof_dev *sdev, struct snd_soc_dai_link
|
|
|
|
|
static enum sof_tokens common_copier_token_list[] = {
|
|
|
|
|
SOF_COMP_TOKENS,
|
|
|
|
|
SOF_AUDIO_FMT_NUM_TOKENS,
|
|
|
|
|
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
|
|
|
|
|
SOF_IN_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_OUT_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_COPIER_DEEP_BUFFER_TOKENS,
|
|
|
|
@ -2163,7 +2131,6 @@ static enum sof_tokens pipeline_token_list[] = {
|
|
|
|
|
static enum sof_tokens dai_token_list[] = {
|
|
|
|
|
SOF_COMP_TOKENS,
|
|
|
|
|
SOF_AUDIO_FMT_NUM_TOKENS,
|
|
|
|
|
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
|
|
|
|
|
SOF_IN_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_OUT_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_COPIER_TOKENS,
|
|
|
|
@ -2175,8 +2142,8 @@ static enum sof_tokens pga_token_list[] = {
|
|
|
|
|
SOF_COMP_TOKENS,
|
|
|
|
|
SOF_GAIN_TOKENS,
|
|
|
|
|
SOF_AUDIO_FMT_NUM_TOKENS,
|
|
|
|
|
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
|
|
|
|
|
SOF_IN_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_OUT_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_COMP_EXT_TOKENS,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -2184,7 +2151,7 @@ static enum sof_tokens mixer_token_list[] = {
|
|
|
|
|
SOF_COMP_TOKENS,
|
|
|
|
|
SOF_AUDIO_FMT_NUM_TOKENS,
|
|
|
|
|
SOF_IN_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
|
|
|
|
|
SOF_OUT_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_COMP_EXT_TOKENS,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -2193,7 +2160,7 @@ static enum sof_tokens src_token_list[] = {
|
|
|
|
|
SOF_SRC_TOKENS,
|
|
|
|
|
SOF_AUDIO_FMT_NUM_TOKENS,
|
|
|
|
|
SOF_IN_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
|
|
|
|
|
SOF_OUT_AUDIO_FORMAT_TOKENS,
|
|
|
|
|
SOF_COMP_EXT_TOKENS,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|