Skip to content

Commit

Permalink
ASoC: Intel: avs: Provide support for fallback topology
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Amadeusz Sławiński authored and broonie committed Sep 5, 2023
1 parent 5366a64 commit 739c031
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sound/soc/intel/avs/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,28 @@ static int avs_component_probe(struct snd_soc_component *component)

ret = avs_load_topology(component, filename);
kfree(filename);
if (ret == -ENOENT && !strncmp(mach->tplg_filename, "hda-", 4)) {
unsigned int vendor_id;

if (sscanf(mach->tplg_filename, "hda-%08x-tplg.bin", &vendor_id) != 1)
return ret;

if (((vendor_id >> 16) & 0xFFFF) == 0x8086)
mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
"hda-8086-generic-tplg.bin");
else
mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
"hda-generic-tplg.bin");

filename = kasprintf(GFP_KERNEL, "%s/%s", component->driver->topology_name_prefix,
mach->tplg_filename);
if (!filename)
return -ENOMEM;

dev_info(card->dev, "trying to load fallback topology %s\n", mach->tplg_filename);
ret = avs_load_topology(component, filename);
kfree(filename);
}
if (ret < 0)
return ret;

Expand Down

0 comments on commit 739c031

Please sign in to comment.