+#ifdef CONFIG_SND_SOC_DRIVER_NAMES
if (!card->driver_name) {
dev_warn(card->dev,
"ASoC: Card driver does not set the driver name\n");
return -EINVAL;
}
I am all for Jaroslav's proposal of making the driver name the basis for UCM identification. we've been working on this since e.g. the addition of the sof- prefix creates a driver name that makes no sense after a truncation of the card name to 16 characters [1] [2] - still WIP.
Making the card name more user-friendly is also a good thing, there's also a nice hidden feature when the card name contains spaces, the last word - typically the codec - is used for the card ID.
But reporting an error when the driver name is not set is a bit extreme and would break all Intel boards. I think we want to encourage people to move to the suggested solution, but do we want to break existing setups? I must admit I also don't see a generic solution when the card is generated from a DT description, it's not straightforward to translate parsed elements into human-readable ones.
While I am at it, I think we should probably avoid using the DMI information for the long card name. It's just awful. It might be a better idea to add it in the component strings (if it fits) so that UCM can use it internally, but it's really horrible. Even with the clean-ups suggested by Jaroslav I ended-up with this horror of a long name on my test device:
root@Zotac:~# cat /proc/asound/cards 0 [rt5640 ]: SOF - sof-bytcht rt5640 ZOTAC-XXXXXX-XX-CherryTrailFFD
If we really wanted to be user-friendly we'd use something like
"SOF card for Baytrail/Cherrytrail devices with Realtek RT5640 codec"
and apply the same pattern for all machine drivers.
[1] https://github.com/thesofproject/linux/pull/2021
[2] https://github.com/alsa-project/alsa-ucm-conf/pull/20/commits/4cc7fe4493c237...