Banana Pi BPI-M2 Zero new image : Ubuntu 19.10 Eoan Ermine Kernel 5.3.5

@igorpec It’s the last commit over here, based on the upstream sunxi-next tree:

@avaf, can you please share your sources?

I’m quite the beginner here, you’ve already done the heavy lifting, and it would benefit everybody. I can keep going on to see whether I can replicate your work, hunt down patches from jernejsk, etc. etc. Or you can just share your branch on github. Much easier for everyone, and creates a much bigger impact! And it would honour the GPL too.

I will cleanup the sources and push it to github (kernel tree is not with git versioning). This can take some time for me.

Kernel 5.3.18 is rock-solid on BPI M2Z and BPI Ultra with the following working (both boards):

  • HDMI
  • HDMI sound
  • Analog sound (M2U)
  • i2c
  • cedrus
  • mali

Meanwhile i will add some new functions to the htop 2.2.2 for the armhf (branch armhf):

Try any latest Mainline release from 5.3 and above, it has good Lima support but for lima to work you will need the latest Mesa package for the distro you want to test it on.

Lima have good support on Wayland so you can try KDE with Wayland if your distro have KDE

Lima should work out of the box only when you have the latest mesa installed and also you dont need fbturbo drivers which is used for software acceleration.

There is no X11 support in Lima. So try Wayland.

All the best.

@avaf - you wrote:

Okay, sounds great! Hope to hear from you soon, I’m just starting a week of holidays, so I have a bit of time on my hands :slight_smile: MESSAGE EDITED BECAUSE I FIXED THE BLUETOOTH THING (KERNEL CONFIG ISSUE).

I did succeed in replicating most of your work on the device tree. I do get a hdmi sound device now, I’ve added cpu frequencies for 120, 240 and 480 MHz, I’ve added the code for the display engine, I tried to add some code for bluetooth. However, I appear to be hitting a couple of walls. Can you perhaps lend me a hand with hdmi sound out? Patches are on github, on top of sunxi-next, although I only tested the device tree on armbian 5.5: https://github.com/PJBrs/linux_kernel/tree/bananapim2zero

Regarding hdmi sound out, can you please check whether I missed anything obvious? I had expected that the following three commits should have done it, but I get no sound if I aplay one of the .wavs in Ubuntu, and it seems fishy to me that alsamixer does not show any controls, although it recognises the device:

@spikerguy Thanks for all the suggestions. I’m now on kernel 5.5 and Ubuntu 20.04.

This must be a complete newbie question, but how do I even find which mesa package contains the lima drivers? Coming from Slackware, Ubuntu package management has quite the steep learning curve. I’m not even sure whether mesa was built with lima support, and even if it was, I wouldn’t know how to find out on Ubuntu. But I can’t seem to find anything lima related:

dpkg -S *lima*
linux-image-dev-sunxi: /lib/modules/5.5.4-sunxi/kernel/drivers/gpu/drm/lima/lima.ko
linux-libc-dev:armhf: /usr/include/drm/lima_drm.h
linux-image-dev-sunxi: /lib/modules/5.5.4-sunxi/kernel/drivers/gpu/drm/lima

I don’t know how to query all packages in a repository to find which one contains lima. I’m sure that Focal Fossa’s mesa version is sufficiently new for lima, but I’m starting to fear that it isn’t packaged… Any pointers are welcome!

*** EDIT *** I have this file, though: /usr/lib/arm-linux-gnueabihf/dri/lima_dri.so.

@spikerguy @igorpec

Ok, lima does work, on the armbian kernel. Tested with kmscube and weston-launch.

@igorpec, I have a strange bluetooth issue. I can’t get it to work on the armbian kernel, and I don’t know why. Here are the changes that I made:

/lib/firmware/brcm/BCM43430A1.hcd -> /lib/firmware/ap6212/bcm43438a1.hcd
/lib/firmware/brcm/brcmfmac43430-sdio.sinovoip,bpi-m2-zero.txt

(I think I can just link that last one to /lib/firmware/ap6212/nvram.txt)

I’ve compiled my own kernel based on sunxi-next, and there bluetooth works without further configuration. On the armbian kernel, basically nothings happens, not even when I manually load the hci_uart module. Also, the bluetooth rfkill device doesn’t show up, whereas with my own kernel config, it does. (Conversely, I can’t get lima to work with my sunxi-next config).

@igorpec, if you have any suggestions for getting bluetooth working, I’d be very happy to hear them! I would love to get the above changes in armbian as well…

Finally, I can play a sound file with aplay, but I can’t hear it… Any suggestions more than welcome!

root@bananapim2zero:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: allwinnerhdmi [allwinner,hdmi], device 0: 1c22800.i2s-i2s-hifi i2s-hifi-0 [1c22800.i2s-i2s-hifi i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@bananapim2zero:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
default:CARD=allwinnerhdmi
    allwinner,hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0
    Default Audio Device
sysdefault:CARD=allwinnerhdmi
    allwinner,hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0
    Default Audio Device
dmix:CARD=allwinnerhdmi,DEV=0
    allwinner,hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0
    Direct sample mixing device
dsnoop:CARD=allwinnerhdmi,DEV=0
    allwinner,hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0
    Direct sample snooping device
hw:CARD=allwinnerhdmi,DEV=0
    allwinner,hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0
    Direct hardware device without any conversions
plughw:CARD=allwinnerhdmi,DEV=0
    allwinner,hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0
    Hardware device with all software conversions
usbstream:CARD=allwinnerhdmi
    allwinner,hdmi
    USB Stream Output

If i recall correctly i could only play wav files with 16-bit channels (not 8-bit)

Maybe you can get a clue reading this thread:

ubuntu@bpi-m2z:~$ play file_example_WAV_1MG.wav

file_example_WAV_1MG.wav:

 File Size: 1.07M     Bit Rate: 256k
  Encoding: Signed PCM    
  Channels: 2 @ 16-bit   
Samplerate: 8000Hz       
Replaygain: off         
  Duration: 00:00:33.53  

I don’t see anything missing but the code for hdmi out on kernel 5.5 is significantly different from 5.3

I’ve pushed my work to kernel 5.6.y here:

You can add your fixes and patches. Feel free.

Thanks! What did you use as base? 5.6-rc3? And from mainline or sunxi-next?

Mainline Kernel 5.6-rc3. Please apply your sunxi-next changes, there are still some necessary fixes.

OK - I’m finally getting somewhere.

  1. lima just works, if you remember to test kmscube as root, because otherwise kmscube will use llvm instead of lima.
  2. Audio out over hdmi works on Armbian, given sufficient patches to the devicetree. I finally got that to work, with the armbian kernel, but not on sunxi-next or on the orangepi branch of megous https://github.com/megous/linux . Apparently armbian adds some patches that I haven’t located upstream.
  3. Somehow, my kernel config just loads bluetooth, wheres the armbian sunxi-current and sunxi-dev kernel configs don’t do anything for bluetooth. Very strange…

@igorpec, I’ve added a couple of dts patches for the bananapi, if you’re interested! Or should I try to upstream these to sunxi-devel? See here: https://github.com/PJBrs/armbian-build/commits/master

I am. Perhaps just make a PR?

Share your working kernel config. I am confused as to which kernel you are working on.

I don’t see the patches you are applying and in which kernel (only for the Armbian), so I can try or find some workaround. All your changes are on your github kernel tree?

I just send you one. I hope. Never did this before, so I hope it all works. EDIT: Definitely didn’t work, hahaha! EDIT2: I think I succeeded now.

@avafinger - config.gz (27,6 KB)

I’m now working on top of the kernel used in Armbian, so megous, branch 5.5, with a couple of patches that, among other things, enable hdmi audio out. I’m hoping to figure out how to change the armbian kernel config so that it loads bluetooth the way it should.

Yeah, it looks fine and doesn’t break building. Thanks!

Kernel 5.6-rc3 is up and running.

Bluetooth:

Devices:
	hci0	CC:B8:A8:A9:E5:67

Modules:

Module                  Size  Used by
loop                   28672  0
snd_soc_hdmi_codec     16384  1
sunxi_cir              16384  0
lima                   36864  0
dw_hdmi_i2s_audio      16384  0
dw_hdmi_cec            16384  0
gpu_sched              24576  1 lima
brcmfmac              262144  0
brcmutil               16384  1 brcmfmac
hci_uart               24576  0
btbcm                  16384  1 hci_uart
sunxi_cedrus           32768  0
sun8i_di               20480  0
v4l2_mem2mem           20480  2 sunxi_cedrus,sun8i_di
videobuf2_dma_contig    20480  2 sunxi_cedrus,sun8i_di
videobuf2_memops       16384  1 videobuf2_dma_contig
videobuf2_v4l2         20480  3 sunxi_cedrus,sun8i_di,v4l2_mem2mem
videobuf2_common       36864  4 sunxi_cedrus,sun8i_di,v4l2_mem2mem,videobuf2_v4l2

I am going to run kmscube… switching to wild mode…

 0 [Codec          ]: H3_Audio_Codec - H3 Audio Codec
                      H3 Audio Codec
 1 [allwinnerhdmi  ]: allwinner_hdmi - allwinner,hdmi
                      allwinner,hdmi

HDMI sound out works!

@avaf nice going there!

@igorpec I sent another two pull request, which should fix bluetooth on the BananaPi M2 Zero, and possibly a few other devices.

For now, I’m fine with using the Armbian tree as it is. But do you know whether “megous” is upstreaming his work on the orangepi kernel branches that armbian uses? And if so, do you think it would be an idea to submit the BananaPi M2 Zero devicetree patches to him?

Final fun fact, I installed lxde and xorg, and it was able to load the right drivers for a hardware-accelerated desktop on lima! Not bad at all! I might still persuade this little device to act as a dvd player after all.

https://linux-sunxi.org/Linux_mainlining_effort#How_to_upstream

We have lime in the kernel for two years, since introduction of 4.19.y :slight_smile:

Things needs a lot of time before getting to mainline. Some stuff never arrives.

Hi! I’m having issues getting any connectivity. Both ethernet and wifi. Using bpi-m2z-8GB-sd-ubuntu_eoan_kernel_fbdev_5.3.11.img

Here’s the beginning of the boot log: U-Boot SPL 2017.09-h2 (Jul 06 2018 - 10:16:12) DRAM: 512 MiB Trying to boot from MMC1 BPI: skip sunxi_mmc_getcd pin 166(1)

U-Boot 2017.09-h2 (Jul 06 2018 - 10:16:12 -0300) Allwinner Technology
 
CPU:   Allwinner H3 (SUN8I 1680)
Model: Banana Pi BPI-M2-Zero
DRAM:  512 MiB
MMC:   SUNXI SD/MMC: 0
BPI: skip sunxi_mmc_getcd pin 166(1)
*** Warning - bad CRC, using default environment
 
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
starting USB...
No controllers found

When it boots the console is spammed by “brcmf_cfg80211_scan: scan error (-110)” errors.

Any ideas?