Christos Posted October 15, 2016 Posted October 15, 2016 Hi, Initially this started by trying to have proper capture and playback in PCM/I2S port, but it looks like that ALL H3 audio drivers got the same problem, they cannot capture at 24bits, they cannot do HiFi recording despite the Allwinner's datasheet that they do have 24bits in plain audio port and up to 32bits in PCM/I2S/HDMI. I made a very simple test in another thread here and anyone with any H3 board without anything else can do it too -> http://forum.armbian.com/index.php/topic/759-tutorial-i2s-on-orange-pi-h3/?p=17595 Then it popped to my mind to do the most simple of the tests, in the included/onboard audio codec, wich according to datasheet it is working to 24bits, so not even a PCM/I2S enabled board is needed, just a stock one. login as: root root@192.168.1.10's password: ___ ____ _ ___ / _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) / _ \ _ __ ___ | | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | | | | '_ \ / _ \ | |_| | | | (_| | | | | (_| | __/ | __/| | | |_| | | | | __/ \___/|_| \__,_|_| |_|\__, |\___| |_| |_| \___/|_| |_|\___| |___/ Welcome to ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i System load: 0.07 Up time: 2 hours Memory usage: 11 % of 494Mb IP: 192.168.1.10 CPU temp: 44°C Usage of /: 7% of 15G [ 2 updates to install: apt-get upgrade ] Last login: Sat Oct 15 08:21:07 2016 from 192.168.1.6 root@orangepione:~# cat /etc/asound.conf pcm.!default { type hw card 0 } ctl.!default { type hw card 0 } root@orangepione:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: audiocodec [audiocodec], device 0: SUNXI-CODEC sndcodec-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 root@orangepione:~# root@orangepione:~# alsacap/alsacap *** Scanning for playback devices *** Card 0, ID `audiocodec', name `audiocodec' Device 0, ID `SUNXI-CODEC sndcodec-0', name `', 1 subdevices (1 available) 1..2 channels, sampling rate 8000..192000 Hz Sample formats: S16_LE, S24_LE, S32_LE, S20_3LE Subdevice 0, name `subdevice #0' Card 1, ID `sndhdmi', name `sndhdmi' Device 0, ID `SUNXI-HDMIAUDIO sndhdmi-0', name `', 1 subdevices (1 available) 1..8 channels, sampling rate 8000..192000 Hz Sample formats: S16_LE, S24_LE, S32_LE, S20_3LE Subdevice 0, name `subdevice #0' root@orangepione:~# As you see, this is a plain stock OrangePi One and got the onboard audio codec displayed. There is an error in the above system reporting, the codec according to datasheet is able to go up to 48KHz and not up to 192KHz, that is an indication that whoever did the driver implementation didnt do it properly.. Next, I did the same test as in the PCM/I2S post above, this time with the onboard codec Card 0, ID `audiocodec', name `audiocodec' root@orangepione:~# arecord -t wav -c 2 -f S24_LE -r 48000 -d 10 testrec.wav Recording WAVE 'testrec.wav' : Signed 24 bit Little Endian, Rate 48000 Hz, Stereo root@orangepione:~# Requested a 10 seconds recording at 24bits. As previously, the system took 20 seconds of a recording.. Then did the aplay of the recorded file root@orangepione:~# aplay testrec.wav Playing WAVE 'testrec.wav' : Signed 24 bit Little Endian, Rate 48000 Hz, Stereo root@orangepione:~# which again did squeeze the 20 seconds of initial recording into 10 seconds.. Thus, if I look at it correctly, we have a more generic audio issue in H3 audio drivers and not only to PCM/I2S that initially thought. Could be the DMA implemetnation or timing, dont know. @Igor and admins, do you think we can report this to linux sunxi for rectification? Christos
tkaiser Posted October 15, 2016 Posted October 15, 2016 report this to linux sunxi for rectification? Well, I added an important piece of information to the thread title: "[legacy kernel]". The linux-sunxi developers are working on mainline kernel, BSP is used there if documentation sucks (looking into sources whether they have a proper license, if this is the case, look through the code, throw the BSP code away and implement stuff from scratch). You could try your luck in linux-sunxi IRC anyway
Igor Posted October 15, 2016 Posted October 15, 2016 Ask / try convincing @nikkov if he can try to fix the driver - he made a lot of audio related fixes on A20 legacy kernel.
Christos Posted October 15, 2016 Author Posted October 15, 2016 Ok Thomas, indeed needed the kernel clarification. It also eluded me that most likely the mainline devs couldnt care less for any legacy issues. On the other hand though, is there any way we can have audio in mainline for H3?? I'm not able to have audio drivers at vanilla in either OPi or NPi login as: root root@192.168.1.12's password: _ _ ____ _ _ _ | \ | | __ _ _ __ ___ | _ \(_) | \ | | ___ ___ | \| |/ _` | '_ \ / _ \| |_) | | | \| |/ _ \/ _ \ | |\ | (_| | | | | (_) | __/| | | |\ | __/ (_) | |_| \_|\__,_|_| |_|\___/|_| |_| |_| \_|\___|\___/ Welcome to ARMBIAN Debian GNU/Linux 8 (jessie) 4.7.6-sun8i System load: 0.44 Up time: 34 sec Memory usage: 8 % of 495Mb IP: 192.168.1.12 CPU temp: 26°C Usage of /: 7% of 15G Last login: Sat Oct 15 12:03:39 2016 from 192.168.1.6 root@nanopineo:~# aplay -l aplay: device_list:268: no soundcards found... root@nanopineo:~# Or is there any guide somewhere that we can enable even the onboard H3 audio? Christos
Igor Posted October 15, 2016 Posted October 15, 2016 Vanilla is (getting to) be server ready, no multimedia support. http://linux-sunxi.org/Linux_mainlining_effort#Status_Matrix
tkaiser Posted October 15, 2016 Posted October 15, 2016 Vanilla is (getting to) be server ready, no multimedia support. http://linux-sunxi.org/Linux_mainlining_effort#Status_Matrix I remember some linux-sunxi devs being pretty enthousiastic a few days ago when new HDMI drivers have been spotted in latest release of Allwinner's 3.4 BSP since this is the first time they got a proper license (and can now be used to implement HDMI in mainline kernel and u-boot). Maybe the same applies to Audio too (still no idea since enjoying the silence ) 1
jernej Posted October 15, 2016 Posted October 15, 2016 I remember some linux-sunxi devs being pretty enthousiastic a few days ago when new HDMI drivers have been spotted in latest release of Allwinner's 3.4 BSP since this is the first time they got a proper license (and can now be used to implement HDMI in mainline kernel and u-boot). Maybe the same applies to Audio too (still no idea since enjoying the silence ) Yes, all audio drivers also have proper license now. We should see more H3 media related work now. I already informed Jean-Francois Moine about that, the guy who works on DRM and HDMI video & audio driver for H3 and A83T. He said it will take couple of weeks to upload the driver. BTW, from what I saw, SPDIF driver should already work on mainline. I'm not sure about I2S driver though. It would be best if you ask codekipper or someone else about I2S on H3 status on IRC. IIRC someone already started working on some audio drivers, apart from SPDIF and HDMI audio.
Christos Posted October 15, 2016 Author Posted October 15, 2016 Yes, all audio drivers also have proper license now. We should see more H3 media related work now. I already informed Jean-Francois Moine about that, the guy who works on DRM and HDMI video & audio driver for H3 and A83T. He said it will take couple of weeks to upload the driver. BTW, from what I saw, SPDIF driver should already work on mainline. I'm not sure about I2S driver though. It would be best if you ask codekipper or someone else about I2S on H3 status on IRC. IIRC someone already started working on some audio drivers, apart from SPDIF and HDMI audio. Thanks for the info, really appreciated. If you happen to have the name of the relevant IRC (or a link) for me to keep an eye on would be great. Christos
jernej Posted October 15, 2016 Posted October 15, 2016 If you happen to have the name of the relevant IRC (or a link) for me to keep an eye on would be great. http://linux-sunxi.org/IRC IRC log can be found at: https://irclog.whitequark.org/linux-sunxi/ Unfortunatelly, this log has troubles sometimes, mostly over the weekends.
Christos Posted October 15, 2016 Author Posted October 15, 2016 I remember some linux-sunxi devs being pretty enthousiastic a few days ago when new HDMI drivers have been spotted in latest release of Allwinner's 3.4 BSP since this is the first time they got a proper license (and can now be used to implement HDMI in mainline kernel and u-boot). Maybe the same applies to Audio too (still no idea since enjoying the silence ) Seen some VERY INTERESTING diffs from orangepi's sourcetree there!! I will give it a try, make a little patch on the relevant device files and apply it to Igor's build.. If that is for real and works.. then............
tkaiser Posted October 15, 2016 Posted October 15, 2016 Seen some VERY INTERESTING diffs from orangepi's sourcetree there!! Be careful, Armbian sun8i legacy is here: https://github.com/igorpecovnik/linux/tree/sun8i And 'history' of Allwinner's 3.4 BSP used for H3 boards (this latest version not including) can be found there: http://forum.armbian.com/index.php/topic/1351-h3-board-buyers-guide/?p=10144 @jernej wanted to have a closer look into this new BSP variant -- he's away for a few days and might comment when he's back. Edit: LOL, totally missed that he already answered everything before
Christos Posted October 15, 2016 Author Posted October 15, 2016 Be careful, Armbian sun8i legacy is here: https://github.com/igorpecovnik/linux/tree/sun8i And 'history' of Allwinner's 3.4 BSP used for H3 boards (this latest version not including) can be found there: http://forum.armbian.com/index.php/topic/1351-h3-board-buyers-guide/?p=10144 @jernej wanted to have a closer look into this new BSP variant -- he's away for a few days and might comment when he's back. I understand. From a first glimpse, it shows that in this latest BSP they do have added handling of the 24bit resolution, its obvious from the diffs in sound/soc/sunxi. If the modifications in sound/soc drivers involve and require major other changes in different modules (eg dma or clock/timing), then I do not think I'm gonna get the whole of it done, its above me, if on the other hand changes are compartmentalized only to the driver files without any other dependants, then I'll give it a try.
martinayotte Posted October 15, 2016 Posted October 15, 2016 For those who are interested to JFMoine works, it is available here : http://moinejf.free.fr/opi2/index.html I've never try it myself, since all my OrangePi are headless ...
Christos Posted October 15, 2016 Author Posted October 15, 2016 "Houston, Tranquility Base here. The Eagle has landed." @tkaiser Thomas, a very big thank you!! Applied the driver files patch and everything works!! Got S24_LE working ok in 96K & 192K. Thanks again Christos
jernej Posted October 15, 2016 Posted October 15, 2016 Applied the driver files patch and everything works!! Which patch exactly?
Christos Posted October 15, 2016 Author Posted October 15, 2016 Did a diff between tkaiser's link above and Armbian's sun8i legacy treesource on sound/soc/sunxi, created myself a patch and applied it to Igor's build.
Da Alchemist Posted October 16, 2016 Posted October 16, 2016 What about the HDMI Sound drivers, is there any change,will there be a prper 8channel support?
Christos Posted October 16, 2016 Author Posted October 16, 2016 The diffs in sound/soc/sunxi/hdmiaudio are almost like a rewrite of the driver, there are way too many changes in there so I guess they took care of it like they did in daudio (PCM/I2S). I've kept it simple and patched only the later and tested just for my own purposes.
Recommended Posts