[BPI-R2] HDMI Sound


Does anyone have an idea if and how we can use audio output over hdmi?

Regards Frank

cuurently R2 HDMI hardware interface can support HDMI audio, But I never verified the function.

Afair there needs to be a soundcard (alsa) be emulated to let user configure output. Which driver should be used here?

Edit: maybe this: https://www.alsa-project.org/pipermail/alsa-devel/2016-April/106911.html

i guess we need a dts change similar to this: http://lists.infradead.org/pipermail/linux-mediatek/2016-April/004935.html but i have not found a hdmi binding yet…maybe something like this

Afaik hdmi connector has no dedicated sound pins,only 3 data blocks with 3pins each.

After a bit googling, it seems that audio is embedded in these data blocks and maybe we need to enable tmds again (which caused display issues)

As @deadmeat did some work i catched his code,applied to 5.9 and fixed it to be compilable. i guess audiorouting in dts is wrong for hdmi,but i found no comparable dts code.


root@bpi-r2:~# aplay -l
aplay: device_list:272: no soundcards found...

root@bpi-r2:~# dmesg | grep snd
[    0.000000] Linux version 5.9.0-rc7-bpi-r2-hdmisnd (frank@frank-G5-U20) (arm-linux-gnueabihf-gcc (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binuti0
[    6.091494] mt2701-hdmi sound: mt2701_hdmi_machine_probe snd_soc_register_card fail -517
[    7.114907] mt2701-hdmi sound: mt2701_hdmi_machine_probe snd_soc_register_card fail -517
[    7.130099] mt2701-hdmi sound: mt2701_hdmi_machine_probe snd_soc_register_card fail -517
[    7.769756] mt2701-hdmi sound: mt2701_hdmi_machine_probe snd_soc_register_card fail -517

strange is that i don’t find the error-code in source, but i found this while debugging:

mt2701-hdmi sound: ASoC: CPU DAI HDMI not registered

[    8.510288] DEBUG: Passed snd_soc_find_dai 824 i2s-hifi==HDMI||i2s-hifi==HDMI                                                                             
[    8.521792] DEBUG: Passed snd_soc_find_dai 824 snd-soc-dummy-dai==HDMI||snd-soc-dummy-dai==HDMI                                                           
[    8.534859] DEBUG: Passed snd_soc_add_pcm_runtime 1023                                                                                                    
[    8.544399] mt2701-hdmi sound: ASoC: CPU DAI HDMI not registered

i found out that the 2 left values came from ./sound/soc/codecs/hdmi-codec.c and not from out mt2701 driver. i also tried to modify mt2701 afe driver like it’s done for mt8173, but it seems it is not called (of couse i have changed the compatible)

Maybe we can use mt8173 sound driver for hdmi because i see some hdmi-nodes i got from @ryder.lee also had mt8173 fallback compatible. Some of them i had changed to mt2701 (because of driver changes),but e.g.cec and ddc are still mt8173

And mt8173 audio driver has hdmi support. https://elixir.bootlin.com/linux/v5.9-rc7/source/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c#L1176

tried to use mt8173 by changing compatible (and full node) of sound and afe, but hang on different const names for clocks where i cannot include the mt8173 bindings due to duplicates. maybe we can add the missing one to mt2701 bindings or add hdmi support to mt2701 driver (platform driver first)

@zuowei8 can you help getting mt2701 hdmi audio working? Currently it is not implemented