Skip to content

Commit e3b8865

Browse files
committed
ASoC: Intel: common / SOF: Use function topologies for
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>: support for NVL-S and the support using functional topology fragments for Soundwire configurations is introduced in 6.19-rc1 in parallel. The SOF projects plan is to not create individual topology files for NVL as with SDCA and the functional topology support can handle most if not all soundwire devices going forward. However one issue have been identified with the functional topology only support, which was masked by the presence of a single topology file: if the device contains a dai link for which we don't have topology fragment, then the probe will fail. This worked with a fallback to a monolithic topology file - which made the dai link to be ignored. The first patch in the series adds a flag to instruct the function discovery to make a best effort to form a card by ignoring functions without corresponding fragment (and print this out for developers) in case there is no fallback topology available. The second patch removes the match entry to refer to a topology file which will not be built by the SOF project.
2 parents 544c049 + 91b7f7d commit e3b8865

5 files changed

Lines changed: 26 additions & 53 deletions

File tree

include/sound/soc-acpi.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ struct snd_soc_acpi_link_adr {
203203
* @mach: the pointer of the machine driver
204204
* @prefix: the prefix of the topology file name. Typically, it is the path.
205205
* @tplg_files: the pointer of the array of the topology file names.
206+
* @best_effort: ignore non supported links and try to build the card in best effort
207+
* with supported links
206208
*/
207209
/* Descriptor for SST ASoC machine driver */
208210
struct snd_soc_acpi_mach {
@@ -224,7 +226,8 @@ struct snd_soc_acpi_mach {
224226
const u32 tplg_quirk_mask;
225227
int (*get_function_tplg_files)(struct snd_soc_card *card,
226228
const struct snd_soc_acpi_mach *mach,
227-
const char *prefix, const char ***tplg_files);
229+
const char *prefix, const char ***tplg_files,
230+
bool best_effort);
228231
};
229232

230233
#define SND_SOC_ACPI_MAX_CODECS 3

sound/soc/intel/common/soc-acpi-intel-nvl-match.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_machines[] = {
1515
};
1616
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_nvl_machines);
1717

18-
/*
19-
* Multi-function codecs with three endpoints created for
20-
* headset, amp and dmic functions.
21-
*/
22-
static const struct snd_soc_acpi_endpoint rt_mf_endpoints[] = {
23-
{
24-
.num = 0,
25-
.aggregated = 0,
26-
.group_position = 0,
27-
.group_id = 0,
28-
},
29-
{
30-
.num = 1,
31-
.aggregated = 0,
32-
.group_position = 0,
33-
.group_id = 0,
34-
},
35-
{
36-
.num = 2,
37-
.aggregated = 0,
38-
.group_position = 0,
39-
.group_id = 0,
40-
},
41-
};
42-
43-
static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = {
44-
{
45-
.adr = 0x000330025d072201ull,
46-
.num_endpoints = ARRAY_SIZE(rt_mf_endpoints),
47-
.endpoints = rt_mf_endpoints,
48-
.name_prefix = "rt722"
49-
}
50-
};
51-
52-
static const struct snd_soc_acpi_link_adr nvl_rt722_l3[] = {
53-
{
54-
.mask = BIT(3),
55-
.num_adr = ARRAY_SIZE(rt722_3_single_adr),
56-
.adr_d = rt722_3_single_adr,
57-
},
58-
{}
59-
};
60-
6118
/* this table is used when there is no I2S codec present */
6219
struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_sdw_machines[] = {
6320
/* mockup tests need to be first */
@@ -79,12 +36,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_sdw_machines[] = {
7936
.drv_name = "sof_sdw",
8037
.sof_tplg_filename = "sof-nvl-rt715-rt711-rt1308-mono.tplg",
8138
},
82-
{
83-
.link_mask = BIT(3),
84-
.links = nvl_rt722_l3,
85-
.drv_name = "sof_sdw",
86-
.sof_tplg_filename = "sof-nvl-rt722.tplg",
87-
},
8839
{},
8940
};
9041
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_nvl_sdw_machines);

sound/soc/intel/common/sof-function-topology-lib.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum tplg_device_id {
2828
#define SOF_INTEL_PLATFORM_NAME_MAX 4
2929

3030
int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_mach *mach,
31-
const char *prefix, const char ***tplg_files)
31+
const char *prefix, const char ***tplg_files, bool best_effort)
3232
{
3333
struct snd_soc_acpi_mach_params mach_params = mach->mach_params;
3434
struct snd_soc_dai_link *dai_link;
@@ -87,6 +87,9 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
8787
dev_dbg(card->dev,
8888
"dai_link %s is not supported by separated tplg yet\n",
8989
dai_link->name);
90+
if (best_effort)
91+
continue;
92+
9093
return 0;
9194
}
9295
if (tplg_mask & BIT(tplg_dev))

sound/soc/intel/common/sof-function-topology-lib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
#define _SND_SOC_ACPI_INTEL_GET_TPLG_H
1111

1212
int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_mach *mach,
13-
const char *prefix, const char ***tplg_files);
13+
const char *prefix, const char ***tplg_files, bool best_effort);
1414

1515
#endif

sound/soc/sof/topology.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2506,12 +2506,28 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file)
25062506
if (!tplg_files)
25072507
return -ENOMEM;
25082508

2509+
/* Try to use function topologies if possible */
25092510
if (!sof_pdata->disable_function_topology && !disable_function_topology &&
25102511
sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) {
2512+
/*
2513+
* When the topology name contains 'dummy' word, it means that
2514+
* there is no fallback option to monolithic topology in case
2515+
* any of the function topologies might be missing.
2516+
* In this case we should use best effort to form the card,
2517+
* ignoring functionalities that we are missing a fragment for.
2518+
*
2519+
* Note: monolithic topologies also ignore these possibly
2520+
* missing functions, so the functionality of the card would be
2521+
* identical to the case if there would be a fallback monolithic
2522+
* topology created for the configuration.
2523+
*/
2524+
bool no_fallback = strstr(file, "dummy");
2525+
25112526
tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card,
25122527
sof_pdata->machine,
25132528
tplg_filename_prefix,
2514-
&tplg_files);
2529+
&tplg_files,
2530+
no_fallback);
25152531
if (tplg_cnt < 0) {
25162532
kfree(tplg_files);
25172533
return tplg_cnt;

0 commit comments

Comments
 (0)