Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: sof: ipc4-topology: Add support to sched_domain attribute

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>

authored by

Jyri Sarha and committed by
Mark Brown
3d439e1e f522da9a

+55 -1
+2
include/uapi/sound/sof/tokens.h
··· 106 106 */ 107 107 #define SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME 417 108 108 109 + #define SOF_TKN_COMP_SCHED_DOMAIN 418 110 + 109 111 /* SSP */ 110 112 #define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500 111 113 #define SOF_TKN_INTEL_SSP_MCLK_ID 501
+43 -1
sound/soc/sof/ipc4-topology.c
··· 38 38 static DEFINE_IDA(alh_group_ida); 39 39 static DEFINE_IDA(pipeline_ida); 40 40 41 + struct sof_comp_domains { 42 + const char *name; 43 + enum sof_comp_domain domain; 44 + }; 45 + 46 + static const struct sof_comp_domains sof_domains[] = { 47 + { "LL", SOF_COMP_DOMAIN_LL, }, 48 + { "DP", SOF_COMP_DOMAIN_DP, } 49 + }; 50 + 51 + static enum sof_comp_domain find_domain(const char *name) 52 + { 53 + int i; 54 + 55 + for (i = 0; i < ARRAY_SIZE(sof_domains); i++) { 56 + if (strcmp(name, sof_domains[i].name) == 0) 57 + return sof_domains[i].domain; 58 + } 59 + /* No valid value found, fall back to manifest value */ 60 + return SOF_COMP_DOMAIN_UNSET; 61 + } 62 + 63 + static int get_token_comp_domain(void *elem, void *object, u32 offset) 64 + { 65 + u32 *val = (u32 *)((u8 *)object + offset); 66 + 67 + *val = find_domain((const char *)elem); 68 + return 0; 69 + } 70 + 41 71 static const struct sof_topology_token ipc4_sched_tokens[] = { 42 72 {SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, 43 73 offsetof(struct sof_ipc4_pipeline, lp_mode)}, ··· 157 127 offsetof(struct snd_sof_widget, uuid)}, 158 128 {SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, 159 129 offsetof(struct snd_sof_widget, core)}, 130 + {SOF_TKN_COMP_SCHED_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_comp_domain, 131 + offsetof(struct snd_sof_widget, comp_domain)}, 160 132 }; 161 133 162 134 static const struct sof_topology_token gain_tokens[] = { ··· 529 497 530 498 msg->extension = SOF_IPC4_MOD_EXT_CORE_ID(swidget->core); 531 499 532 - type = (fw_module->man4_module_entry.type & SOF_IPC4_MODULE_DP) ? 1 : 0; 500 + switch (swidget->comp_domain) { 501 + case SOF_COMP_DOMAIN_LL: 502 + type = 0; 503 + break; 504 + case SOF_COMP_DOMAIN_DP: 505 + type = 1; 506 + break; 507 + default: 508 + type = (fw_module->man4_module_entry.type & SOF_IPC4_MODULE_DP) ? 1 : 0; 509 + break; 510 + } 533 511 msg->extension |= SOF_IPC4_MOD_EXT_DOMAIN(type); 534 512 535 513 return 0;
+7
sound/soc/sof/ipc4-topology.h
··· 109 109 SOF_IPC4_COPIER_MODULE_CFG_ATTENUATION, 110 110 }; 111 111 112 + /* Scheduling domain, unset, Low Latency, or Data Processing */ 113 + enum sof_comp_domain { 114 + SOF_COMP_DOMAIN_UNSET = 0, /* Take domain value from manifest */ 115 + SOF_COMP_DOMAIN_LL, /* Low Latency scheduling domain */ 116 + SOF_COMP_DOMAIN_DP, /* Data Processing scheduling domain */ 117 + }; 118 + 112 119 struct sof_ipc4_copier_config_set_sink_format { 113 120 /* Id of sink */ 114 121 u32 sink_id;
+3
sound/soc/sof/sof-audio.h
··· 451 451 */ 452 452 bool dynamic_pipeline_widget; 453 453 454 + /* Scheduling domain (enum sof_comp_domain), unset, Low Latency, or Data Processing */ 455 + u32 comp_domain; 456 + 454 457 struct snd_soc_dapm_widget *widget; 455 458 struct list_head list; /* list in sdev widget list */ 456 459 struct snd_sof_pipeline *spipe;