Does anyone have an idea if and how we can use audio output over hdmi?
Does anyone have an idea if and how we can use audio output over hdmi?
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
Hi - I’m currently examining the HDMI Audio driver that you’ve worked on so far - I’ve added it to 5.10-rc in my case.
By examining how some given driver that exists in both 4.4 and 5.10 - has changed - I will most likely be able to successfully port the 4.4 WM8960 HDMI implementation to 5.10 (I’ve written Linux drivers before and have worked on an audio library for many years)
However my knowledge regarding the DTS nodes is very weak. Clearly the 4.4 sound:sound node found in mt7623n.dtsi has more details than the audsys entry you have constructed so far.
If Ryder or anybody else at BPI/MediaTek can help us to get the DTS correct? I can handle the driver.
One problem was that mt2701 audio driver uses pcm instead of i2c,then some clocks were missing…but alex was more inside.
I also asked some of mtk people but got no response yet
When I understand things better? I might complete your _hdmi implementation - but after studying the code and the changes that are needed? I’m just going to port the entire original driver.
With the original values from the BSP DST and a driver that expects them as a such? we should be in a much better position to get it working.
Most work was done by alex…and it is also a try to port the old driver. As i currently have very limited freetime i have not continued work on it
I’ll do my best. Can you give me any information regarding what you’ve learned about the values in the original 4.4BSP DST - are there ‘conflicts’ that you’re aware of? the DST is where I’m going to struggle the most - so any thoughts or problems you’re aware of that pertain to the effort? please let me know when you have the time
It was some time ago…the main problem was that i did not full understand how the codec/machine needs to be initialized…then alex tries to do the init part.but mostly because of missing time we made no much progress
I wanted to ensure that we had the best chance of success, so :
I’ve added the original ‘mt8521p’ driver(s) to 5.10-rc.
Removed anything that isn’t a dependency of mt7623-wm8960.c
Now I’m fixing the source to compile in the new tree by tracing the errors to which kernel version introduced the given change - by using the ‘mt2701’ driver (where possible) as a reference for how those changes effected a soc sound driver.
It’s slow going but it’s just audio + I2C - it’s not changed THAT much - we’ve had CD quality audio sound in operating systems since the 90s
How much could they have altered in the kernel api? it’s not that much - just some contextual stuff - the replacement of some things with others - the occasional additional parameter to a function etc etc
please upload if you have any version compilable so we can see progress and do not same stuff twice. btw. there is a 5.10-main…you should not use the rc-branch
and cd quality is better than no sound
Hi Frank - can you please open up a branch on 5.18 (or whatever branch you’d prefer me to work on) as I have made significant progress on getting the wm8960 codec sound working for the newer kernel versions.
There are some DTS additions / changes required as well as a more complete version of the mt2701-hdmi driver I have worked on (started from the driver in 5.12-snd) (asoc card is appearing but no sound, hw_ptr error)
I’ve also ported the mt8521p driver from 4.4 with its “mt7623-wm8960” module and have that successfully compiling, loading - all internals spool up, no errors - however it’s an old format of driver without a dedicated AFE platform driver - so ALSA ASOC complains in general and the driver won’t start until a platform driver exists.
this driver will require either a dummy platform driver to trick ALSA into accepting the setup or the AFE portions need converting to a platform driver aka modern kernel style (see mt2701 driver) and may have other issues that won’t manifest until that’s complete.
So the wm8960 codec now works across I2C again - and we have two different nearly working driver sources - really good chance of getting the sound working again
Hi, just upload to your repo. Maybe use 5.12-snd as base or rebase on 5.18-rc.