Recently on BlissOS chat some people feedback about their audio on their Intel Atom tablets doesn't work. More specifically 2 cases of different tablets with bytcr-rt5651. While I don't have this audio card, I have an ASUS T100TA which uses bytcr-rt5640 instead.
I can be able to replicate the error that they sent me, something like:
dpcm_fe_dai_prepare() failed (-22)
no backend DAIs enabled for Audio Port
by removing all alsa state in /system/etc/alsa. But that made me realize that saving alsa state is not a good idea as you need to gather hardware in order to get these alsa state. So I decided to find a better solution.
Thankfully, I've found out about alsaucm, a program that both us here on BlissOS and also Android-x86 already included in the source but left unused. I've found out that the ucm configuration we copied serve a purpose. Apparently you can use it to activate a "verb"
alsaucm -c $d set _verb HiFi
This verb then provide audio devices like Speaker/Headphones/Internal Mic/Headset Mic which you can enable
For example, in my case with the T100TA, I can use this command to enable Speaker on my device
alsaucm -c bytcr-5640 set _verb HiFi set _enadev Speaker
And with that, we can be able to completely remove the pre-configured alsa state on our OS. we still leave the init function though in case some people need it. We also make the script looking for extra dir (/data/vendor/alsa) in case the system is not writable.
Currently we've been tested these audio cards and can prove that they are working:
- bytcr-rt5640
- bytcr-rt5651 (2 of them)
- chtnau8824
- acp5x on the Steam Deck (we can only verify enable HiFi verb work, back then the audio is being handled by a bunch of custom amixer commands + HiFi verb enable)