* [PATCH] ASoC: Intel: avs: Provide support for fallback topology
@ 2023-09-05 9:31 Amadeusz Sławiński
2023-09-05 12:42 ` Pierre-Louis Bossart
2023-09-05 21:11 ` Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Amadeusz Sławiński @ 2023-09-05 9:31 UTC (permalink / raw)
To: Mark Brown
Cc: Cezary Rojewski, Takashi Iwai, Jaroslav Kysela, alsa-devel,
Amadeusz Sławiński
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>
---
sound/soc/intel/avs/pcm.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 1fbb2c2fadb5..8565a530706d 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] ASoC: Intel: avs: Provide support for fallback topology
2023-09-05 9:31 [PATCH] ASoC: Intel: avs: Provide support for fallback topology Amadeusz Sławiński
@ 2023-09-05 12:42 ` Pierre-Louis Bossart
2023-09-05 13:58 ` Amadeusz Sławiński
2023-09-05 21:11 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Pierre-Louis Bossart @ 2023-09-05 12:42 UTC (permalink / raw)
To: Amadeusz Sławiński, Mark Brown
Cc: Cezary Rojewski, Takashi Iwai, Jaroslav Kysela, alsa-devel
On 9/5/23 05:31, Amadeusz Sławiński wrote:
> 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>
> ---
> sound/soc/intel/avs/pcm.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
> index 1fbb2c2fadb5..8565a530706d 100644
> --- a/sound/soc/intel/avs/pcm.c
> +++ b/sound/soc/intel/avs/pcm.c
> @@ -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");
it's very odd to test for 0x8086 in a driver that only supports Intel
devices, isn't it?
One of these two branches is always-true or there's a missing
explanation on what this 0x8086 is used for?
> + 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;
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] ASoC: Intel: avs: Provide support for fallback topology
2023-09-05 12:42 ` Pierre-Louis Bossart
@ 2023-09-05 13:58 ` Amadeusz Sławiński
2023-09-05 14:10 ` Pierre-Louis Bossart
0 siblings, 1 reply; 5+ messages in thread
From: Amadeusz Sławiński @ 2023-09-05 13:58 UTC (permalink / raw)
To: Pierre-Louis Bossart, Mark Brown
Cc: Cezary Rojewski, Takashi Iwai, Jaroslav Kysela, alsa-devel
On 9/5/2023 2:42 PM, Pierre-Louis Bossart wrote:
>
>
> On 9/5/23 05:31, Amadeusz Sławiński wrote:
>> 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>
>> ---
>> sound/soc/intel/avs/pcm.c | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
>> index 1fbb2c2fadb5..8565a530706d 100644
>> --- a/sound/soc/intel/avs/pcm.c
>> +++ b/sound/soc/intel/avs/pcm.c
>> @@ -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");
>
> it's very odd to test for 0x8086 in a driver that only supports Intel
> devices, isn't it?
>
> One of these two branches is always-true or there's a missing
> explanation on what this 0x8086 is used for?
>
Differentiating between generic codecs
(https://github.com/thesofproject/avs-topology-xml/tree/main/hda) and
hdmi ones
(https://github.com/thesofproject/avs-topology-xml/tree/main/hdmi), as
topology targets codec.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] ASoC: Intel: avs: Provide support for fallback topology
2023-09-05 13:58 ` Amadeusz Sławiński
@ 2023-09-05 14:10 ` Pierre-Louis Bossart
0 siblings, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2023-09-05 14:10 UTC (permalink / raw)
To: Amadeusz Sławiński, Mark Brown
Cc: Cezary Rojewski, Takashi Iwai, Jaroslav Kysela, alsa-devel
On 9/5/23 09:58, Amadeusz Sławiński wrote:
> On 9/5/2023 2:42 PM, Pierre-Louis Bossart wrote:
>>
>>
>> On 9/5/23 05:31, Amadeusz Sławiński wrote:
>>> 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>
>>> ---
>>> sound/soc/intel/avs/pcm.c | 22 ++++++++++++++++++++++
>>> 1 file changed, 22 insertions(+)
>>>
>>> diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
>>> index 1fbb2c2fadb5..8565a530706d 100644
>>> --- a/sound/soc/intel/avs/pcm.c
>>> +++ b/sound/soc/intel/avs/pcm.c
>>> @@ -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");
>>
>> it's very odd to test for 0x8086 in a driver that only supports Intel
>> devices, isn't it?
>>
>> One of these two branches is always-true or there's a missing
>> explanation on what this 0x8086 is used for?
>>
>
> Differentiating between generic codecs
> (https://github.com/thesofproject/avs-topology-xml/tree/main/hda) and
> hdmi ones
> (https://github.com/thesofproject/avs-topology-xml/tree/main/hdmi), as
> topology targets codec.
Ah yes, 0x8086 for the codec vendor. I must admit I didn't click after a
4-day week-end...
BTW your list of topologies helps with my assertion that we are missing
a 'hardware layer' in the topology framework, it makes no sense to have
a proliferation of topology files that all look the same. We really need
the ability to tell which endpoints are active or not, and which
hardware interface to use on a given platform. copy-pasting and using
macros is going to lead us into a maintenance nightmare.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: Intel: avs: Provide support for fallback topology
2023-09-05 9:31 [PATCH] ASoC: Intel: avs: Provide support for fallback topology Amadeusz Sławiński
2023-09-05 12:42 ` Pierre-Louis Bossart
@ 2023-09-05 21:11 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2023-09-05 21:11 UTC (permalink / raw)
To: Amadeusz Sławiński
Cc: Cezary Rojewski, Takashi Iwai, Jaroslav Kysela, alsa-devel
On Tue, 05 Sep 2023 11:31:47 +0200, Amadeusz Sławiński wrote:
> HDA and HDMI devices are simple enough that in case of user not having
> topology tailored to their device, they can use fallback topology.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: Intel: avs: Provide support for fallback topology
commit: 739c031110da9ba966b0189fa25a2a1c0d42263c
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-05 21:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05 9:31 [PATCH] ASoC: Intel: avs: Provide support for fallback topology Amadeusz Sławiński
2023-09-05 12:42 ` Pierre-Louis Bossart
2023-09-05 13:58 ` Amadeusz Sławiński
2023-09-05 14:10 ` Pierre-Louis Bossart
2023-09-05 21:11 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.