summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/ipc3-topology.c
diff options
context:
space:
mode:
authorV sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>2022-11-29 11:00:59 +0100
committerMark Brown <broonie@kernel.org>2022-11-29 13:56:09 +0100
commit75af41991955205fa0958feb587ce22b35aaa7b0 (patch)
treee2f61028b2d6e18bad7df4c54c49dc87cf006cbe /sound/soc/sof/ipc3-topology.c
parentASoC: Merge up fixes (diff)
downloadlinux-75af41991955205fa0958feb587ce22b35aaa7b0.tar.xz
linux-75af41991955205fa0958feb587ce22b35aaa7b0.zip
ASoC: SOF: Add DAI configuration support for AMD platforms.
Add support for configuring sp and hs DAI from topology. Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com> Link: https://lore.kernel.org/r/20221129100102.826781-1-vsujithkumar.reddy@amd.corp-partner.google.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc3-topology.c')
-rw-r--r--sound/soc/sof/ipc3-topology.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c
index 0720e1eae084..b94cc40485ed 100644
--- a/sound/soc/sof/ipc3-topology.c
+++ b/sound/soc/sof/ipc3-topology.c
@@ -276,6 +276,16 @@ static const struct sof_topology_token acpdmic_tokens[] = {
offsetof(struct sof_ipc_dai_acpdmic_params, pdm_ch)},
};
+/* ACPI2S */
+static const struct sof_topology_token acpi2s_tokens[] = {
+ {SOF_TKN_AMD_ACPI2S_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
+ offsetof(struct sof_ipc_dai_acp_params, fsync_rate)},
+ {SOF_TKN_AMD_ACPI2S_CH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
+ offsetof(struct sof_ipc_dai_acp_params, tdm_slots)},
+ {SOF_TKN_AMD_ACPI2S_TDM_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
+ offsetof(struct sof_ipc_dai_acp_params, tdm_mode)},
+};
+
/* Core tokens */
static const struct sof_topology_token core_tokens[] = {
{SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
@@ -311,6 +321,7 @@ static const struct sof_token_info ipc3_token_list[SOF_TOKEN_COUNT] = {
[SOF_SAI_TOKENS] = {"SAI tokens", sai_tokens, ARRAY_SIZE(sai_tokens)},
[SOF_AFE_TOKENS] = {"AFE tokens", afe_tokens, ARRAY_SIZE(afe_tokens)},
[SOF_ACPDMIC_TOKENS] = {"ACPDMIC tokens", acpdmic_tokens, ARRAY_SIZE(acpdmic_tokens)},
+ [SOF_ACPI2S_TOKENS] = {"ACPI2S tokens", acpi2s_tokens, ARRAY_SIZE(acpi2s_tokens)},
};
/**
@@ -1193,6 +1204,7 @@ static int sof_link_acp_sp_load(struct snd_soc_component *scomp, struct snd_sof_
struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs;
struct sof_dai_private_data *private = dai->private;
u32 size = sizeof(*config);
+ int ret;
/* handle master/slave and inverted clocks */
sof_dai_set_format(hw_config, config);
@@ -1201,12 +1213,15 @@ static int sof_link_acp_sp_load(struct snd_soc_component *scomp, struct snd_sof_
memset(&config->acpsp, 0, sizeof(config->acpsp));
config->hdr.size = size;
- config->acpsp.fsync_rate = le32_to_cpu(hw_config->fsync_rate);
- config->acpsp.tdm_slots = le32_to_cpu(hw_config->tdm_slots);
+ ret = sof_update_ipc_object(scomp, &config->acpsp, SOF_ACPI2S_TOKENS, slink->tuples,
+ slink->num_tuples, size, slink->num_hw_configs);
+ if (ret < 0)
+ return ret;
- dev_info(scomp->dev, "ACP_SP config ACP%d channel %d rate %d\n",
+
+ dev_info(scomp->dev, "ACP_SP config ACP%d channel %d rate %d tdm_mode %d\n",
config->dai_index, config->acpsp.tdm_slots,
- config->acpsp.fsync_rate);
+ config->acpsp.fsync_rate, config->acpsp.tdm_mode);
dai->number_configs = 1;
dai->current_config = 0;
@@ -1223,6 +1238,7 @@ static int sof_link_acp_hs_load(struct snd_soc_component *scomp, struct snd_sof_
struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs;
struct sof_dai_private_data *private = dai->private;
u32 size = sizeof(*config);
+ int ret;
/* Configures the DAI hardware format and inverted clocks */
sof_dai_set_format(hw_config, config);
@@ -1231,12 +1247,14 @@ static int sof_link_acp_hs_load(struct snd_soc_component *scomp, struct snd_sof_
memset(&config->acphs, 0, sizeof(config->acphs));
config->hdr.size = size;
- config->acphs.fsync_rate = le32_to_cpu(hw_config->fsync_rate);
- config->acphs.tdm_slots = le32_to_cpu(hw_config->tdm_slots);
+ ret = sof_update_ipc_object(scomp, &config->acphs, SOF_ACPI2S_TOKENS, slink->tuples,
+ slink->num_tuples, size, slink->num_hw_configs);
+ if (ret < 0)
+ return ret;
- dev_info(scomp->dev, "ACP_HS config ACP%d channel %d rate %d\n",
+ dev_info(scomp->dev, "ACP_HS config ACP%d channel %d rate %d tdm_mode %d\n",
config->dai_index, config->acphs.tdm_slots,
- config->acphs.fsync_rate);
+ config->acphs.fsync_rate, config->acphs.tdm_mode);
dai->number_configs = 1;
dai->current_config = 0;
@@ -1545,9 +1563,11 @@ static int sof_ipc3_widget_setup_comp_dai(struct snd_sof_widget *swidget)
ret = sof_link_acp_bt_load(scomp, slink, config, dai);
break;
case SOF_DAI_AMD_SP:
+ case SOF_DAI_AMD_SP_VIRTUAL:
ret = sof_link_acp_sp_load(scomp, slink, config, dai);
break;
case SOF_DAI_AMD_HS:
+ case SOF_DAI_AMD_HS_VIRTUAL:
ret = sof_link_acp_hs_load(scomp, slink, config, dai);
break;
case SOF_DAI_AMD_DMIC: