Jump to content

Allwinner H6


balbes150

Recommended Posts

I found an answer to the question I posted on January 27. Setting the following options in the kernel configuration make ethernet work on my Tanix TX6 Tv-box:

 

CONFIG_REGULATOR_PWM=y
CONFIG_COMMON_CLK_PWM=y
CONFIG_PWM_SUN4I=y
CONFIG_AC200_PHY=y

Maybe not all of these are necessary

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

52 minutes ago, mtk said:

I found an answer to the question I posted on January 27. Setting the following options in the kernel configuration make ethernet work on my Tanix TX6 Tv-box:

 

CONFIG_REGULATOR_PWM=y
CONFIG_COMMON_CLK_PWM=y
CONFIG_PWM_SUN4I=y
CONFIG_AC200_PHY=y

Maybe not all of these are necessary

Thanks mtk!

 

It seems both

 

CONFIG_REGULATOR_PWM=y

CONFIG_COMMON_CLK_PWM=y

 

Have not been set in the 5.15 sunxi edge kernel I installed which may explain why I've got no ethernet.

 

Hopefully balbes will fix or tell me where I'm going wrong with his build script and spare me having to build a custom kernel.

Link to comment
Share on other sites

On 2/7/2022 at 9:10 AM, mtk said:

I found an answer to the question I posted on January 27. Setting the following options in the kernel configuration make ethernet work on my Tanix TX6 Tv-box:

 

CONFIG_REGULATOR_PWM=y
CONFIG_COMMON_CLK_PWM=y
CONFIG_PWM_SUN4I=y
CONFIG_AC200_PHY=y

Maybe not all of these are necessary

Only works with edge kernel, though. And I need to build using 'buster' debian version. When I try 'bullseye' the build fails with a debootstrap error. Anybody know how to fix this? On the other hand, I installed lightdm, xorg, xfce4 and firefox-esr and now have a working desktop.

Link to comment
Share on other sites

After the non-working DTS patch for Tanix TX6 XRadio XR819 was recently finally removed from balbes150 git repo and there is no outlook to bring back support for working TX6's wifi, I decided to create an alternative CLI release for my TX6 server with a priority for XR819 & AC200 network cards.
 

After many, many tries with the official Armbian repository  I gave up on them: apparently they are missing some magic from balbes150's versions ;) So I had to back in time in armbian-tv repo, merge some new stuff like latest kernel 5.10.*, remove some patches (including some custom cedrus patches, don't need them for CLI but they can be included back after the revision) that had conflicts with newer kernel, provide new patches and some improvement for kernel configuration, DTB wifi section and for XR819. None of XRadio XR819 drivers without the patch is compatible with current AArch64 crosscompiling and probably that's why it was removed even from the latest official Armbian AArch64 releases.
 

Works stable with fast SD card access and CPU governor: I tried also 5.15 and 5.16 kernels using mainstream Armbian versions but there are some problems with slower SD access (initial partition resizing took x5 longer than usually) and/or with the CPU governor (CPU was staying at 1.7GHz all the time). I have not observed it using 5.10.99 Bullseye CLI build based on armbian-tv. Will try to provide fully working 5.15 if possible. I'm thinking also about CPU downclocking because that box is really hot on default settings. Feel free to improve it further. Sources are available of course.
 

Tested configuration: current (5.10.99), Debian Bullseye, server. Enjoy!
https://github.com/awawa-dev/build/releases/tag/v2022.02.10

Link to comment
Share on other sites

On 2/10/2022 at 9:01 PM, awawa said:

After the non-working DTS patch for Tanix TX6 XRadio XR819 was recently finally removed from balbes150 git repo and there is no outlook to bring back support for working TX6's wifi, I decided to create an alternative CLI release for my TX6 server with a priority for XR819 & AC200 network cards.
 

After many, many tries with the official Armbian repository  I gave up on them: apparently they are missing some magic from balbes150's versions ;) So I had to back in time in armbian-tv repo, merge some new stuff like latest kernel 5.10.*, remove some patches (including some custom cedrus patches, don't need them for CLI but they can be included back after the revision) that had conflicts with newer kernel, provide new patches and some improvement for kernel configuration, DTB wifi section and for XR819. None of XRadio XR819 drivers without the patch is compatible with current AArch64 crosscompiling and probably that's why it was removed even from the latest official Armbian AArch64 releases.
 

Works stable with fast SD card access and CPU governor: I tried also 5.15 and 5.16 kernels using mainstream Armbian versions but there are some problems with slower SD access (initial partition resizing took x5 longer than usually) and/or with the CPU governor (CPU was staying at 1.7GHz all the time). I have not observed it using 5.10.99 Bullseye CLI build based on armbian-tv. Will try to provide fully working 5.15 if possible. I'm thinking also about CPU downclocking because that box is really hot on default settings. Feel free to improve it further. Sources are available of course.
 

Tested configuration: current (5.10.99), Debian Bullseye, server. Enjoy!
https://github.com/awawa-dev/build/releases/tag/v2022.02.10

 

 

Great work awawa!

 

I had noticed the wifi was no longer working in balbes recent H6 Armbian builds. I have tried your v2022.02.10 build on my T95 MAX and it boots and installs fine. I've tested the ethernet is working and I can see that I have a wlan0 device available when I run `ip l` so it looks like wifi is working.

 

A 5.15 version would be great!

Thanks

 

Link to comment
Share on other sites

I've not tested it under awawa's kernel yet but under the latest (5.10) balbes H6 bullseye builds if I disconnect and reconnect the HDMI the picture doesn't return on reconnection. This doesn't affect ssh connections etc thankfully. Is this a general xorg/AW H6 issue or is it just my box/display?

Link to comment
Share on other sites

On 2/10/2022 at 9:01 PM, awawa said:

After the non-working DTS patch for Tanix TX6 XRadio XR819 was recently finally removed from balbes150 git repo and there is no outlook to bring back support for working TX6's wifi, I decided to create an alternative CLI release for my TX6 server with a priority for XR819 & AC200 network cards.
 

After many, many tries with the official Armbian repository  I gave up on them: apparently they are missing some magic from balbes150's versions ;) So I had to back in time in armbian-tv repo, merge some new stuff like latest kernel 5.10.*, remove some patches (including some custom cedrus patches, don't need them for CLI but they can be included back after the revision) that had conflicts with newer kernel, provide new patches and some improvement for kernel configuration, DTB wifi section and for XR819. None of XRadio XR819 drivers without the patch is compatible with current AArch64 crosscompiling and probably that's why it was removed even from the latest official Armbian AArch64 releases.
 

Works stable with fast SD card access and CPU governor: I tried also 5.15 and 5.16 kernels using mainstream Armbian versions but there are some problems with slower SD access (initial partition resizing took x5 longer than usually) and/or with the CPU governor (CPU was staying at 1.7GHz all the time). I have not observed it using 5.10.99 Bullseye CLI build based on armbian-tv. Will try to provide fully working 5.15 if possible. I'm thinking also about CPU downclocking because that box is really hot on default settings. Feel free to improve it further. Sources are available of course.
 

Tested configuration: current (5.10.99), Debian Bullseye, server. Enjoy!
https://github.com/awawa-dev/build/releases/tag/v2022.02.10


Have you got a kernel headers package for your 5.10.99 (or 5.15) kernel available for download? The nearest kernel headers package I can see in the armbian bullseye repos is 5.10.92.

Link to comment
Share on other sites

@danboid I've got something even better ;) Support for 5.15 kernels, with kernel sources and headers packages this time.
 

There is a nasty bug (or let's rather say: something incompatible with TX6) introduced with the mainstream kernel 5.15 sunxi that completely breaks eMMC, introduces I/O instability and causes high CPU usage as sideeffect: FIXED.

Release (Tanix TX6, Allwinner H6, AC200/XR819 network cards):
https://github.com/awawa-dev/build/releases/tag/v2022.02.12

Link to comment
Share on other sites

Yes! I'd already spotted and installed it! Great to see you getting the H6 kernel fixed up fast!

 

I'm waiting to hear back from Jernej on what commands he would recommend for ffmpeg and mpv before I install X to test wifi and try removing and reinserting HDMI. Does that work OK on your device with your 5.15 kernel ie do you get a HDMI signal after re-inserting the cable?

 

https://github.com/bootlin/libva-v4l2-request/issues/35

Link to comment
Share on other sites

I have tested removing and re-inserting the HDMI cable with awawas 5.15 kernel and it works under under the GBM (ie not under X or wayland) console but it seems to be luck as to what res it chooses to use. I have to unplug and re-connect it a few times sometimes to get the 4K res back sometimes. I've not tested it under X yet.

 

Jernej has replied so I'm currently rebuilding ffmpeg and doing more tests to see if I can get the 4K video decoding working.

 

I'm happy with the thermals on my T95 MAX. Its in its case which I've not cut any holes in or added any heatsinks to anything, its been building ffmpeg for over 30 minutes and I've not seen the CPU temp exceed 50 degrees.

 

awawa: Have you tried installing Armbian to the eMMC of your H6 TV box?

Link to comment
Share on other sites

On my Tanix TX6 temperatures in idle are around 60C using 5.15. With moderate load while capturing&processing 1280x720x60fps video stream from USB3.0 grabber in HyperHDR it's around 80C and rarely hit 85C for a moment (throttling point which reduces CPU frequency, without it the stories are telling and the chip can go up to 120C). On 5.10 handling USB3.0 took more CPU resources. Unfortunately using official Armbian patches for 5.15 causing my device not to boot: heavily modified DTS is broken and that also affects LibreElec releases. I've not installed the system on eMMC because with TV boxes I've always preferred safer approach with SD cards.

Link to comment
Share on other sites

I have been unable to get ffmpeg v4l2-request hw video decoding working with this edge kernel.

 

The dev of the cedrus driver tells me that it has problems with IOMMU. There are a few IOMMU options enabled in this 5.15 Armbian kernel (see Device Drivers -> IOMMU hardware support in the Armbian custom kernel config menus). I'm not going to be running any VMs on my TV box so I'm currently rebuilding awawas fork with all of the IOMMU options unselected to see if it will fix cedrus.

Link to comment
Share on other sites

Update on video decoding:

 

The good news is that I was successful in rebuilding awawa's fork but I've not installed that image to test it yet. I could be wrong but I don't feel it is the IOMMU and awawa seems to thinks that the IOMMU options that are enabled in his kernel won't have an effect it seems.

 

I've not had any luck getting ffmpeg to play anything. I've pretty much dropped experimenting with that now because mpv is my fave video player and I have at least got mpv to play some UHD videos albeit only with software decoding using commands such as these:

 

mpv --vo=gpu --drm-connector=1.HDMI-A-1


mpv --vo=gpu --gpu-context=drm --hwdec=drm --drm-connector=1.HDMI-A-1

 

HDMI audio is working from the console, which is nice to see!

 

The dev of the H6 cedrus driver has been giving me tips to try and get ffmpeg working with cedrus but he doesn't know anything about mpv and isn't interested in 'desktop' Linux. I have tried to contact the dev who added v4l2-request support to mpv but my email bounced because his inbox is full.

 

I have not got to the point of trying to read the relevant parts of the mpv source code but my impression is that mpv probably requires libva-v4l2-request to be installed and working and I haven't been able to get that to successfully build yet. I have tried to build a fork of libva-v4l2-request that has been patched to supposedly work under Linux 5.14 but it failed to build for me under 5.15:

 

https://github.com/noneucat/libva-v4l2-request

 

https://github.com/bootlin/libva-v4l2-request/pull/38

 

awawa:

 

Have you tried using your Armbian fork to build a sid image yet? If I fail to get mpv working with cedrus accel, the alternative (but not my preferred method of video playback) is to use gstreamer 1.20 which Jernej says supports v4l2-request now. sid seems to meet this requirement and this could allow for 4K video playback under X and Wayland with apps like totem and parole, if we're lucky! I get the impression Jernej hasn't tried this out so...

Link to comment
Share on other sites

New build has just released and images are uploading. I've included now almost all new Kernel patches from official Armbian (a lot of changes for cedrus, sound mixer and media components): only these related to DTB/DTS and causing TX6 instability are excluded but they are not related to your subject. So @danboid in my opinion you can treat it almost as generic Armbian release in your straggling with accelerated ffmpeg. Can't help much more than that. Previous releases were primary targeting vanilla mainline Kernel using just few old balbes150 patches till I figured out where are the problems with current Armbian patches. Now I know why support for that board will probably never reach even Armbian's CSC level. I don't have a plan for sid release.

I think that's the last build for Tanix TX6 H6 till next major Kernel upgrade appears as everything seems OK now.
https://github.com/awawa-dev/build/releases/tag/v2022.02.14

Link to comment
Share on other sites

Thanks awawa!

 

I have installed the latest build on my T95 MAX and the cedrus stuff actually does seem happier with the v4l2-request patched ffmpeg now but I haven't worked out the correct ffmpeg or ffplay command to get them to display the video so not much use as is. mpv is the same as with the previous kernel. - software decoding only.

Link to comment
Share on other sites

I have tried awawas desktop image now with his latest kernel. The good news is WiFi does really work, as does ethernet. The bad news is that the HDMI signal doesn't recover from having the HDMI cable unplugged, like it does when you're not running X. I'm not sure if this is a kernel or a mesa problem or both? I suspect its mainly a mesa/X issue because it only happens when running X.

 

Have you tried to get to get the LED clock working on your TX6 awawa?

 

https://github.com/arthur-liberman/linux_openvfd

 

I don't suppose you've included support in your kernel for the RTL8822CS wifi/bt chip that is used in the slightly more expensive TX6?

Link to comment
Share on other sites

@danboidif you prefer, we can continue our discussion here.

 

Note, mesa has nothing to do with HDMI plug detection. GPU is distinct core from display engine (that's why you have two dri cards present). I would say it's X11 issue, but then, I have no experience with it on H6.

 

Regarding LED driver - you might make it work with above repo, but then there is easier way, at least if you have some python programming knowledge. I recently added a node for LED display in DT and it will debut with kernel 5.17:

https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix.dtsi#L32-L38

 

Once you have that in DT, together with enabled i2c-gpio and i2c-dev drivers, you can play with LED display as much as you want. For example, with python script using python-periphery library:

 

from periphery import I2C

i2c = I2C("/dev/i2c-0") # adjust path as needed

msgs = [I2C.Message([0x03], flags=I2C._I2C_M_IGNORE_NAK)]
i2c.transfer(0x24, msgs) # enable display

msgs = [I2C.Message([0xff, 0x67, 0x63, 0x63, 0x47], flags=I2C._I2C_M_IGNORE_NAK)]
i2c.transfer(0x33, msgs) # set LEDs

i2c.close()

 

Note, that ignore NAK flag is important. FD650 LED driver is not exactly your standard I2C device.

Link to comment
Share on other sites

That sounds very cool Jernej and it could well be an easier solution that using the repo I linked to when 5.17 is released. Have you already written a script to show the time on the LED using this method?

 

To save anyone else (awawa) having to go and read our github convo, Jernej says your kernel should include this patch:

 

https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Allwinner/patches/linux/0065-wip-fix-H6-4k-60.patch

 

Have you already merged that patch awawa? I have only been testing with 4K displays.

 

My current H6 TV box doesn't have an LED display but I've ordered a TX6, the one with 64 GB eMMC, dual-band wifi and BT that I presume is using the RTL8822CS I was asking about earlier. £50 off geekbuying. You can't ever have enough TV boxes and SBCs, right? I seemingly can't. It said its a H6 in their spec so they'll be getting it returned if its actually an AMLogic or Rockchip. RPi4's go for £100s now I see, as awawa highlights in his TX6 review. I think I only paid £60 for my 8 GB RPi 4 about a year ago so it was a good investment!

Link to comment
Share on other sites

11 minutes ago, danboid said:

Have you already written a script to show the time on the LED using this method?

No, that's the only script I wrote. Once things start to work, I lose interest :D And I'm not fond of python, either.

Link to comment
Share on other sites

I'm good at finding broken stuff! I'm glad you can fix these things. There's a distinct lack of Jernejs, too many Dans!

 

I'm indifferent on python. Its alright in its place. You can't escape python now, its just there. Its also one of the few languages I kinda know as an amateur coder.

 

Do you work for Collabora, if you don't mind me asking?

Link to comment
Share on other sites

How did you learn to write drivers? Whats the best book / guide / resource on reverse engineering?

 

I've been pretty fascinated watching Hector Martin port Linux to the M1. Its insane how much he knows about this stuff! Have you watched any of them? Obviously I'd need to learn to walk before I port Linux to the M1 :D

Link to comment
Share on other sites

Just now, danboid said:

Do you work for Collabora, if you don't mind me asking?

No, but I'm in contact with few of them. In fact, my job has nothing to do with Linux, although this will probably change in near future. It's just a hobby for getting some experience with developing various Linux drivers and learn how things work nowadays. You won't see me writting userspace apps, except for testing purposes or improving existing code which use drivers I'm working on.

 

2 minutes ago, danboid said:

How did you learn to write drivers?

I follow few tutorials for character devices on net. But I find it easier to study existing drivers, especially if working on something new. Linux has well documented common code and there is a ton of helper functions. Reading various slides from presentations of particular subsystem also helps. You have to find the method which works for you.

9 minutes ago, danboid said:

Whats the best book / guide / resource on reverse engineering?

There is no single source for that either. Also depends what you mean by reverse engineering. Nowadays there is BSP linux source which means you just have to understand that code, but many times even this is not an easy task. But if you mean hard core reverse engineering, like analyzing binaries and trying to understand what they do, that's another beast entirely. It helps if you learn assembly language for target system, read a lot of tutorials, guides, etc. If you can solve various crackmes, then you're already better in this than most people. But truthfully, you really don't need that to be good kernel developer. However, I already found few interesting things that way, because Allwinner hid some things in binaries which were later linked in driver directly.

Link to comment
Share on other sites

43 minutes ago, danboid said:

I've been pretty fascinated watching Hector Martin port Linux to the M1. Its insane how much he knows about this stuff! Have you watched any of them? Obviously I'd need to learn to walk before I port Linux to the M1 :D

No, because I don't care about Apple products.

Link to comment
Share on other sites

@danboid I like @jernej solution so I think we will wait until 5.17 and not use openvfd. There are already struggles with ofenvfd in the rk3318 / 3328 thread and it is not so easy to make it work properly and to include in my build. But @danboid there is a task for you if you want ;) Recent changes brought: legacy(5.10 without further support), current(5.15) and new edge version (5.16). Can you build & test 5.16? I tested it, but only to make sure it boots up and there are no errors in dmesg.  I've included H6 4K60 patch  from LibreElec for edge (5.16). If it works I include it to current. Also RTL8822CS driver is included now in default builds.

Link to comment
Share on other sites

1 hour ago, awawa said:

@danboid I'm sure that changes were successfully committed and pushed some time ago. Check build/config/sources/families/sun50iw6.conf for new configuration and lib/main.sh for new menu.

 

* Clone your repo

* cd build && compile.sh

* Full OS image -> Show kernel config menu -> Show CSC/WIP/EOS/TVB -> I understand and agree

 

Then you get a choice of CSC, WIP, EOS or TVB. I've tried all 4 and they all error out with 'Board configuration does not define a valid kernel config'. If you don't go into the CSC/WIP kernel config menu you only get a choice of 5.10 or 5.15. The same happens if you just try to build the kernel + u-boot.

Link to comment
Share on other sites

@danboid You don't have to go to CSC submenu anymore. Tanix TX6 is in the main menu now. Other boards are removed. In config/boards folder you should also have only one file tanix-tx6.conf. Please verify it in your the file system. If its different then you don't have the latest version or maybe it cached in the .cache folder (but it shouldn't). If you have further questions then please send me PM.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines