Skip to content

Commit 739c031

Browse files
Amadeusz Sławińskibroonie
authored andcommitted
ASoC: Intel: avs: Provide support for fallback topology
HDA and HDMI devices are simple enough that in case of user not having topology tailored to their device, they can use fallback topology. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230905093147.1960675-1-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5366a64 commit 739c031

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

sound/soc/intel/avs/pcm.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,28 @@ static int avs_component_probe(struct snd_soc_component *component)
796796

797797
ret = avs_load_topology(component, filename);
798798
kfree(filename);
799+
if (ret == -ENOENT && !strncmp(mach->tplg_filename, "hda-", 4)) {
800+
unsigned int vendor_id;
801+
802+
if (sscanf(mach->tplg_filename, "hda-%08x-tplg.bin", &vendor_id) != 1)
803+
return ret;
804+
805+
if (((vendor_id >> 16) & 0xFFFF) == 0x8086)
806+
mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
807+
"hda-8086-generic-tplg.bin");
808+
else
809+
mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
810+
"hda-generic-tplg.bin");
811+
812+
filename = kasprintf(GFP_KERNEL, "%s/%s", component->driver->topology_name_prefix,
813+
mach->tplg_filename);
814+
if (!filename)
815+
return -ENOMEM;
816+
817+
dev_info(card->dev, "trying to load fallback topology %s\n", mach->tplg_filename);
818+
ret = avs_load_topology(component, filename);
819+
kfree(filename);
820+
}
799821
if (ret < 0)
800822
return ret;
801823

0 commit comments

Comments
 (0)