Skip to content

Commit 33b3efb

Browse files
author
Jyri Sarha
committed
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>
1 parent fb66eed commit 33b3efb

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

include/uapi/sound/sof/tokens.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
*/
107107
#define SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME 417
108108

109+
#define SOF_TKN_COMP_SCHED_DOMAIN 418
110+
109111
/* SSP */
110112
#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500
111113
#define SOF_TKN_INTEL_SSP_MCLK_ID 501

sound/soc/sof/ipc4-topology.c

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,36 @@ MODULE_PARM_DESC(ipc4_ignore_cpc,
3838
static DEFINE_IDA(alh_group_ida);
3939
static DEFINE_IDA(pipeline_ida);
4040

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+
4171
static const struct sof_topology_token ipc4_sched_tokens[] = {
4272
{SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
4373
offsetof(struct sof_ipc4_pipeline, lp_mode)},
@@ -127,6 +157,8 @@ static const struct sof_topology_token comp_ext_tokens[] = {
127157
offsetof(struct snd_sof_widget, uuid)},
128158
{SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
129159
offsetof(struct snd_sof_widget, core)},
160+
{SOF_TKN_COMP_SCHED_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_comp_domain,
161+
offsetof(struct snd_sof_widget, comp_domain)},
130162
};
131163

132164
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_
497529

498530
msg->extension = SOF_IPC4_MOD_EXT_CORE_ID(swidget->core);
499531

500-
type = (fw_module->man4_module_entry.type & SOF_IPC4_MODULE_DP) ? 1 : 0;
532+
switch (swidget->comp_domain) {
533+
case SOF_COMP_DOMAIN_LL:
534+
type = 0;
535+
break;
536+
case SOF_COMP_DOMAIN_DP:
537+
type = 1;
538+
break;
539+
default:
540+
type = (fw_module->man4_module_entry.type & SOF_IPC4_MODULE_DP) ? 1 : 0;
541+
break;
542+
}
501543
msg->extension |= SOF_IPC4_MOD_EXT_DOMAIN(type);
502544

503545
return 0;

sound/soc/sof/ipc4-topology.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ enum sof_ipc4_copier_module_config_params {
108108
SOF_IPC4_COPIER_MODULE_CFG_ATTENUATION,
109109
};
110110

111+
/* Scheduling domain, unset, Low Latency, or Data Processing */
112+
enum sof_comp_domain {
113+
SOF_COMP_DOMAIN_UNSET = 0, /* Take domain value from manifest */
114+
SOF_COMP_DOMAIN_LL, /* Low Latency scheduling domain */
115+
SOF_COMP_DOMAIN_DP, /* Data Processing scheduling domain */
116+
};
117+
111118
struct sof_ipc4_copier_config_set_sink_format {
112119
/* Id of sink */
113120
u32 sink_id;

sound/soc/sof/sof-audio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ struct snd_sof_widget {
456456
*/
457457
bool dynamic_pipeline_widget;
458458

459+
/* Scheduling domain (enum sof_comp_domain), unset, Low Latency, or Data Processing */
460+
u32 comp_domain;
461+
459462
struct snd_soc_dapm_widget *widget;
460463
struct list_head list; /* list in sdev widget list */
461464
struct snd_sof_pipeline *spipe;

0 commit comments

Comments
 (0)