Commit 5f267aa4 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: avs: Assign I2S gateway when parsing topology

For formatted port - ssp%d - descriptions to have an effect, copier
module templates need to be updated with specified port value. This
value is later propagated to the firmware when module instances are
being instantiated.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220707124153.1858249-3-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c50cea05
...@@ -808,6 +808,30 @@ static const struct avs_tplg_token_parser pin_format_parsers[] = { ...@@ -808,6 +808,30 @@ static const struct avs_tplg_token_parser pin_format_parsers[] = {
}, },
}; };
static void
assign_copier_gtw_instance(struct snd_soc_component *comp, struct avs_tplg_modcfg_ext *cfg)
{
struct snd_soc_acpi_mach *mach;
if (!guid_equal(&cfg->type, &AVS_COPIER_MOD_UUID))
return;
/* Only I2S boards assign port instance in ->i2s_link_mask. */
switch (cfg->copier.dma_type) {
case AVS_DMA_I2S_LINK_OUTPUT:
case AVS_DMA_I2S_LINK_INPUT:
break;
default:
return;
}
mach = dev_get_platdata(comp->card->dev);
/* Automatic assignment only when board describes single SSP. */
if (hweight_long(mach->mach_params.i2s_link_mask) == 1 && !cfg->copier.vindex.i2s.instance)
cfg->copier.vindex.i2s.instance = __ffs(mach->mach_params.i2s_link_mask);
}
static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp, static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp,
struct avs_tplg_modcfg_ext *cfg, struct avs_tplg_modcfg_ext *cfg,
struct snd_soc_tplg_vendor_array *tuples, struct snd_soc_tplg_vendor_array *tuples,
...@@ -827,6 +851,9 @@ static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp, ...@@ -827,6 +851,9 @@ static int avs_tplg_parse_modcfg_ext(struct snd_soc_component *comp,
if (ret) if (ret)
return ret; return ret;
/* Update copier gateway based on board's i2s_link_mask. */
assign_copier_gtw_instance(comp, cfg);
block_size -= esize; block_size -= esize;
/* Parse trailing in/out pin formats if any. */ /* Parse trailing in/out pin formats if any. */
if (block_size) { if (block_size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment