]> www.infradead.org Git - users/hch/misc.git/commitdiff
ASoC: sof: ipc4-topology: Add support to sched_domain attribute
authorJyri Sarha <jyri.sarha@linux.intel.com>
Fri, 29 Aug 2025 15:11:01 +0000 (18:11 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 29 Aug 2025 18:52:20 +0000 (20:52 +0200)
Add SOF_TKN_COMP_SCHED_DOMAIN and connect it to struct snd_sof_widget
comp_domain member, with new get_token_comp_domain() function.

The logic is such that if the topology attribute is not present in the
widget node the corresponding IPC4 extension value is taken from the
module's manifest like before. But if the attribute is found and
recognized its value overrides what is there in the manifest.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Message-ID: <20250829151101.27327-1-peter.ujfalusi@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/uapi/sound/sof/tokens.h
sound/soc/sof/ipc4-topology.c
sound/soc/sof/ipc4-topology.h
sound/soc/sof/sof-audio.h

index c28c766270de01117181215c98da7f67e3443b31..9ce72fbd6f113a7b4d1e3e8d03bc9c0e80d9c480 100644 (file)
  */
 #define SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME 417
 
+#define SOF_TKN_COMP_SCHED_DOMAIN              418
+
 /* SSP */
 #define SOF_TKN_INTEL_SSP_CLKS_CONTROL         500
 #define SOF_TKN_INTEL_SSP_MCLK_ID              501
index 591ee30551baa8b08837670a157c1dbb66eeccb1..74a1319d4bd218ba3298c46cd0f14046962c97c5 100644 (file)
@@ -38,6 +38,36 @@ MODULE_PARM_DESC(ipc4_ignore_cpc,
 static DEFINE_IDA(alh_group_ida);
 static DEFINE_IDA(pipeline_ida);
 
+struct sof_comp_domains {
+       const char *name;
+       enum sof_comp_domain domain;
+};
+
+static const struct sof_comp_domains sof_domains[] = {
+       { "LL", SOF_COMP_DOMAIN_LL, },
+       { "DP", SOF_COMP_DOMAIN_DP, }
+};
+
+static enum sof_comp_domain find_domain(const char *name)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(sof_domains); i++) {
+               if (strcmp(name, sof_domains[i].name) == 0)
+                       return sof_domains[i].domain;
+       }
+       /* No valid value found, fall back to manifest value */
+       return SOF_COMP_DOMAIN_UNSET;
+}
+
+static int get_token_comp_domain(void *elem, void *object, u32 offset)
+{
+       u32 *val = (u32 *)((u8 *)object + offset);
+
+       *val = find_domain((const char *)elem);
+       return 0;
+}
+
 static const struct sof_topology_token ipc4_sched_tokens[] = {
        {SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
                offsetof(struct sof_ipc4_pipeline, lp_mode)},
@@ -127,6 +157,8 @@ static const struct sof_topology_token comp_ext_tokens[] = {
                offsetof(struct snd_sof_widget, uuid)},
        {SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
                offsetof(struct snd_sof_widget, core)},
+       {SOF_TKN_COMP_SCHED_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_comp_domain,
+               offsetof(struct snd_sof_widget, comp_domain)},
 };
 
 static const struct sof_topology_token gain_tokens[] = {
@@ -497,7 +529,17 @@ static int sof_ipc4_widget_setup_msg(struct snd_sof_widget *swidget, struct sof_
 
        msg->extension = SOF_IPC4_MOD_EXT_CORE_ID(swidget->core);
 
-       type = (fw_module->man4_module_entry.type & SOF_IPC4_MODULE_DP) ? 1 : 0;
+       switch (swidget->comp_domain) {
+       case SOF_COMP_DOMAIN_LL:
+               type = 0;
+               break;
+       case SOF_COMP_DOMAIN_DP:
+               type = 1;
+               break;
+       default:
+               type = (fw_module->man4_module_entry.type & SOF_IPC4_MODULE_DP) ? 1 : 0;
+               break;
+       }
        msg->extension |= SOF_IPC4_MOD_EXT_DOMAIN(type);
 
        return 0;
index 14ba58d2be03f8904388fb3df857773e0fb4118a..e8e8482333147faa769b3d1fba1ce417b5a28277 100644 (file)
@@ -109,6 +109,13 @@ enum sof_ipc4_copier_module_config_params {
        SOF_IPC4_COPIER_MODULE_CFG_ATTENUATION,
 };
 
+/* Scheduling domain, unset, Low Latency, or Data Processing */
+enum sof_comp_domain {
+       SOF_COMP_DOMAIN_UNSET = 0,      /* Take domain value from manifest */
+       SOF_COMP_DOMAIN_LL,             /* Low Latency scheduling domain */
+       SOF_COMP_DOMAIN_DP,             /* Data Processing scheduling domain */
+};
+
 struct sof_ipc4_copier_config_set_sink_format {
 /* Id of sink */
        u32 sink_id;
index 36ab75e11779d2458c39ad5b45c60b13995c6a7d..db6973c8eac311e8986f34bcdd423a1bc6be4052 100644 (file)
@@ -451,6 +451,9 @@ struct snd_sof_widget {
         */
        bool dynamic_pipeline_widget;
 
+       /* Scheduling domain (enum sof_comp_domain), unset, Low Latency, or Data Processing */
+       u32 comp_domain;
+
        struct snd_soc_dapm_widget *widget;
        struct list_head list;  /* list in sdev widget list */
        struct snd_sof_pipeline *spipe;