Ahh yes, Hub = 1GB while WP2=2GB. I'll need to go build that image..
Official LE13 Test Images for Amlogic (Kodi-22)
-
chewitt -
May 19, 2024 at 7:03 AM -
Thread is Unresolved
-
-
Using some initial work from https://github.com/mczerski - Claude and I (mostly Claude) have made some progress on mainline DVB support: https://paste.libreelec.tv/moving-lab.log .. the above is from a WeTek Play2 box.
Before anyone gets wildly excited, the vendor kernel demux driver that Marek started porting is a festering ifdef nightmare that looks like it needs a lot of work and I have no way to test DVB-C, DVB-T, or DVB-S things; so I have no clue if the now-showing-up adapters do more than look pretty. Marek appears to have more of a clue about DVB things than me so cross fingers

NB: I plan to dig out the DVB-S module for WP2 and an old O2.cz box that I have in a cupboard somewhere and get those working next. Once that's done I'll clean up the smorgasbord of patches, push branches to GitHub, and share some updated images.
-
Hi everyone,
I’ve managed to get the Amlogic mainline DVB driver working using software PID filtering. Currently, on the SM1 (S905X3 mecool K5 and magicsee c500 pro), it successfully detects and operates all Amlogic DVB modules and frontends using a single dmx0 driver. I have developed this according to modern kernel architecture. No high cpu usages. but libreelec vdec mpeg2 does not decode mpeg4 hw accelerations. software based decoding mpeg2 ok. But the video quality is not very good. It has nothing to do with the dvb driver anyway. But it streams perfectly to devices on the network.
However, I haven't been able to get dmx1 and dmx2 working yet, as I haven't identified the correct offsets. Once those are functional and stable, I intend to share the full driver with the community. It works flawlessly on single-frontend devices and is compatible with the upstream mainline kernel.
I have also drafted a new driver version for hardware PID filtering based on the vendor kernel architecture. If I can get the HW PID filter operational, I will share that as well. I believe this version serves as a solid starting point for further development."
Code
Display MoreLibreELEC:~ # uname -a Linux LibreELEC 6.19.0 #1 SMP Fri Mar 13 02:03:55 +03 2026 aarch64 GNU/Linux LibreELEC:~ # dmesg | grep -i dvb [ 10.600472] amlogic-dvb ffd06000.dvb: TS registers: [mem 0xffd06000-0xffd063ff] [ 10.600498] amlogic-dvb ffd06000.dvb: No 'demux' region — SM1: using 'ts' base (0xffd06000) for DMX registers [ 10.600603] amlogic-dvb ffd06000.dvb: Async FIFO registers: [mem 0xffd09000-0xffd0afff] [ 10.600714] debugfs: 'ffd06000.dvb-demux' already exists in 'regmap' [ 10.600760] amlogic-dvb ffd06000.dvb: Detected SM1 (S905X3/D3): 3 demux, 3 TS inputs, 32 PID filters, 2 async FIFO, 192 Mbps max [ 10.600768] amlogic-dvb ffd06000.dvb: CI+ support available [ 10.600791] amlogic-dvb ffd06000.dvb: Performing hardware reset [ 10.609896] amlogic-dvb ffd06000.dvb: Hardware reset completed [ 10.609959] amlogic-dvb ffd06000.dvb: rst_demux_top reset OK [ 10.610024] amlogic-dvb ffd06000.dvb: GPIO: 0 GPIO kaydedildi, /sys/kernel/debug/gpio'da görünür [ 10.610036] amlogic-dvb ffd06000.dvb: pinctrl: TS pin state aktif → /sys/kernel/debug/pinctrl [ 10.611856] dvbdev: DVB: registering new adapter (Amlogic DVB) [ 10.611878] amlogic-dvb ffd06000.dvb: ts_hw_init: starting [ 10.611886] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing TS input 0/3 [ 10.611898] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 0 DTS'de disabled, atlanıyor [ 10.611903] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing TS input 1/3 [ 10.612013] amlogic-dvb ffd06000.dvb: ts_input_init: TS1 ts_control=0x000 [ 10.612019] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 1 → PARALLEL mode [ 10.612024] amlogic-dvb ffd06000.dvb: ts_input_init: initializing TS input 1 [ 10.612040] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 1 OK (mode=0x30003 fec_ctrl=0x000 s2p_id=-1 clk_inv=0) [ 10.612047] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing TS input 2/3 [ 10.612053] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 2 DTS'de disabled, atlanıyor [ 10.612058] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing S2P 0/2 [ 10.612063] amlogic-dvb ffd06000.dvb: s2p_init: starting S2P 0 [ 10.612077] amlogic-dvb ffd06000.dvb: s2p_init: writing S2P 0 ctrl=0xcccc [ 10.612082] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing S2P 1/2 [ 10.612086] amlogic-dvb ffd06000.dvb: s2p_init: starting S2P 1 [ 10.612101] amlogic-dvb ffd06000.dvb: s2p_init: writing S2P 1 ctrl=0xcccc [ 10.612107] amlogic-dvb ffd06000.dvb: ts_hw_init: writing TS_TOP_CONFIG = 0x7700bb47 (sync_byte=0x47, packet_len=188) [ 10.612113] amlogic-dvb ffd06000.dvb: ts_hw_init: completed successfully [ 10.612131] amlogic-dvb ffd06000.dvb: asyncfifo_init: HW reset OK [ 10.612135] amlogic-dvb ffd06000.dvb: asyncfifo_init: starting, num=2 [ 10.612140] amlogic-dvb ffd06000.dvb: asyncfifo_init: initializing FIFO 0 [ 10.612257] amlogic-dvb ffd06000.dvb: FIFO 0: DVR rb OK (4 MB) [ 10.612266] amlogic-dvb ffd06000.dvb: afifo0: allocating coherent buffer (262144 bytes) [ 10.613506] amlogic-dvb ffd06000.dvb: afifo0: dma buffer virt=00000000f1542136 dma=0x0000000048440000 [ 10.613539] amlogic-dvb ffd06000.dvb: afifo0: REG0 (DMA addr) = 0x48440000 [ 10.613545] amlogic-dvb ffd06000.dvb: afifo0: REG1 reset pulse = 0x00600800 (flush_cnt=0x800) [ 10.613551] amlogic-dvb ffd06000.dvb: afifo0: REG1 (WRAP+FLUSH) = 0x00300800 [ 10.613557] amlogic-dvb ffd06000.dvb: afifo0: REG2 (FILL_EN, no src) = 0x00300000 [ 10.613562] amlogic-dvb ffd06000.dvb: afifo0: REG3 (IRQ thresh) = 0x2001ff (every 64KB) [ 10.613568] amlogic-dvb ffd06000.dvb: Async FIFO 0: base=0x0000000048440000 size=262144 flush=65536 REG1=0x00300800 CPU0 [ 10.613575] amlogic-dvb ffd06000.dvb: asyncfifo_init: initializing FIFO 1 [ 10.613725] amlogic-dvb ffd06000.dvb: FIFO 1: DVR rb OK (4 MB) [ 10.613736] amlogic-dvb ffd06000.dvb: afifo1: allocating coherent buffer (262144 bytes) [ 10.614030] amlogic-dvb ffd06000.dvb: afifo1: dma buffer virt=000000004cfdb751 dma=0x0000000048480000 [ 10.614054] amlogic-dvb ffd06000.dvb: afifo1: kept idle (vendor behaviour) [ 10.614059] amlogic-dvb ffd06000.dvb: Async FIFO 1: base=0x0000000048480000 size=262144 flush=65536 ctrl=0x00000000 CPU1 [ 10.614067] amlogic-dvb ffd06000.dvb: dsc0: init OK [ 10.614072] amlogic-dvb ffd06000.dvb: dsc1: init OK [ 10.614077] amlogic-dvb ffd06000.dvb: dmx0: hw_init [ 10.614269] amlogic-dvb ffd06000.dvb: dmx0: sec_buf OK 131072 bytes phys=0x48420000 base=0x4842 [ 10.614281] amlogic-dvb ffd06000.dvb: dmx0: sec_buf grp0=0x48420000 grp1=0x48428000 grp2=0x48430000 grp3=0x48438000 [ 10.614405] amlogic-dvb ffd06000.dvb: dmx0: PES buf OK phys=0x48410000 [ 10.614679] amlogic-dvb ffd06000.dvb: dmx0: subtitle buf OK phys=0x484c0000 len=65536 [ 10.614696] amlogic-dvb ffd06000.dvb: dmx0: hw_init OK [ 10.618161] amlogic-dvb ffd06000.dvb: dmx0: IRQ 28 [ 10.618421] amlogic-dvb ffd06000.dvb: dmx0: IRQ 28 registered OK [ 10.618437] amlogic-dvb ffd06000.dvb: dmx1: hw_init [ 10.618904] amlogic-dvb ffd06000.dvb: dmx1: sec_buf OK 131072 bytes phys=0x484e0000 base=0x484e [ 10.618923] amlogic-dvb ffd06000.dvb: dmx1: sec_buf grp0=0x484e0000 grp1=0x484e8000 grp2=0x484f0000 grp3=0x484f8000 [ 10.619014] amlogic-dvb ffd06000.dvb: dmx1: PES buf OK phys=0x484d0000 [ 10.619179] amlogic-dvb ffd06000.dvb: dmx1: subtitle buf OK phys=0x48500000 len=65536 [ 10.619192] amlogic-dvb ffd06000.dvb: dmx1: hw_init OK [ 10.619759] amlogic-dvb ffd06000.dvb: dmx1: IRQ 29 [ 10.620296] amlogic-dvb ffd06000.dvb: dmx1: IRQ 29 registered OK [ 10.620318] amlogic-dvb ffd06000.dvb: dmx2: hw_init [ 10.621058] amlogic-dvb ffd06000.dvb: dmx2: sec_buf OK 131072 bytes phys=0x48520000 base=0x4852 [ 10.621080] amlogic-dvb ffd06000.dvb: dmx2: sec_buf grp0=0x48520000 grp1=0x48528000 grp2=0x48530000 grp3=0x48538000 [ 10.621323] amlogic-dvb ffd06000.dvb: dmx2: PES buf OK phys=0x48510000 [ 10.626612] amlogic-dvb ffd06000.dvb: dmx2: subtitle buf OK phys=0x48540000 len=65536 [ 10.626636] amlogic-dvb ffd06000.dvb: dmx2: hw_init OK [ 10.631951] amlogic-dvb ffd06000.dvb: dmx2: IRQ 30 [ 10.632660] amlogic-dvb ffd06000.dvb: dmx2: IRQ 30 registered OK [ 10.632777] amlogic-dvb ffd06000.dvb: afifo0: IRQ 31 [ 10.632808] amlogic-dvb ffd06000.dvb: afifo0: IRQ 31 registered OK [ 10.632820] amlogic-dvb ffd06000.dvb: DEMUX_CONTROL(0) after IRQ setup = 0xc0000000 [ 10.632829] amlogic-dvb ffd06000.dvb: DVB adapter global listeye eklendi [ 10.632835] amlogic-dvb ffd06000.dvb: DVB adapter ready, expecting 1 frontend(s) [ 10.632842] amlogic-dvb ffd06000.dvb: [0] /soc/bus@ffd00000/i2c@1c000/dvb-frontend@14 [ 10.632947] debugfs: 'gpio' already exists in 'ffd06000.dvb' [ 10.632958] debugfs: 'pinctrl_state' already exists in 'ffd06000.dvb' [ 10.632971] amlogic-dvb ffd06000.dvb: sec_watchdog: başlatıldı (250ms) [ 10.632978] amlogic-dvb ffd06000.dvb: amlogic-dvb V2.54 loaded [ 10.707889] avl6862 3-0014: GPIO: amlogic-dvb-fe0-power → /sys/kernel/debug/gpio [ 10.707935] avl6862 3-0014: GPIO: amlogic-dvb-fe0-reset → /sys/kernel/debug/gpio [ 12.242544] amlogic-dvb ffd06000.dvb: runtime_resume: enabling clocks [ 12.242556] amlogic-dvb ffd06000.dvb: ts_hw_init: starting [ 12.242564] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing TS input 0/3 [ 12.242573] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 0 DTS'de disabled, atlanıyor [ 12.242579] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing TS input 1/3 [ 12.242589] amlogic-dvb ffd06000.dvb: ts_input_init: TS1 ts_control=0x000 [ 12.242595] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 1 → PARALLEL mode [ 12.242600] amlogic-dvb ffd06000.dvb: ts_input_init: initializing TS input 1 [ 12.242616] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 1 OK (mode=0x30003 fec_ctrl=0x000 s2p_id=-1 clk_inv=0) [ 12.242621] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing TS input 2/3 [ 12.242627] amlogic-dvb ffd06000.dvb: ts_input_init: TS input 2 DTS'de disabled, atlanıyor [ 12.242632] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing S2P 0/2 [ 12.242636] amlogic-dvb ffd06000.dvb: s2p_init: starting S2P 0 [ 12.242651] amlogic-dvb ffd06000.dvb: s2p_init: writing S2P 0 ctrl=0xcccc [ 12.242655] amlogic-dvb ffd06000.dvb: ts_hw_init: initializing S2P 1/2 [ 12.242660] amlogic-dvb ffd06000.dvb: s2p_init: starting S2P 1 [ 12.242674] amlogic-dvb ffd06000.dvb: s2p_init: writing S2P 1 ctrl=0xcccc [ 12.242681] amlogic-dvb ffd06000.dvb: ts_hw_init: writing TS_TOP_CONFIG = 0x7700bb47 (sync_byte=0x47, packet_len=188) [ 12.242686] amlogic-dvb ffd06000.dvb: ts_hw_init: completed successfully [ 12.242704] amlogic-dvb ffd06000.dvb: DVB: registering adapter 0 frontend 0 (Availink avl6862)... [ 12.245431] amlogic-dvb ffd06000.dvb: dmx0: kaynak=2 STB_TOP=0x00040000 FEC_CTRL=0x00000000 [ 12.245466] amlogic-dvb ffd06000.dvb: Demux 0 <- tsin_b (AML_TS_SRC_FRONTEND_TS1) [ 12.245474] amlogic-dvb ffd06000.dvb: afifo0: REG2 source=0 val=3 reg2=0x01b00000 [ 12.245485] amlogic-dvb ffd06000.dvb: afifo0: REG2 readback=0x03b00000 FILL=1 SRC=3 [ 12.245491] amlogic-dvb ffd06000.dvb: Async FIFO 0 source set to demux 0 [ 12.245498] amlogic-dvb ffd06000.dvb: TS rate set to 54 Mbps [ 12.245502] amlogic-dvb ffd06000.dvb: Frontend 0 registered (demod-initiated) [ 14.041314] i2c i2c-3: Load avl6862 firmware patch for DVB-S/S2 size=44108 [ 17.160632] Modules linked in: ir_rc6_decoder ir_nec_decoder 8021q bluetooth ecdh_generic ecc panfrost governor_simpleondemand drm_shmem_helper rtw88_8822cs rtw88_8822c rtw88_sdio rtw88_core mac80211 snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi meson_ir rtc_meson_vrtc meson_vdec(C) cfg80211 rfkill avl6862(O) amlogic_dvb(O) r912(O) r848(O) pkcs8_key_parser fuse nfnetlink [ 19.234123] amlogic-dvb ffd06000.dvb: DVB: adapter 0 frontend 0 frequency 0 out of range (175000000..2150000000) [ 19.239717] i2c i2c-3: Load avl6862 firmware patch for DVB-S/S2 size=44108 LibreELEC:~ # dmesg | grep -i gpio [ 0.130040] irq_meson_gpio: 100 to 8 gpio interrupt mux initialized [ 0.184374] pwrseq_emmc emmc-pwrseq: EMMC reset pin tied to a sleepy GPIO driver; reset on emergency-reboot disabled [ 0.449675] meson-gx-mmc ffe05000.mmc: Got CD GPIO [ 10.610024] amlogic-dvb ffd06000.dvb: GPIO: 0 GPIO kaydedildi, /sys/kernel/debug/gpio'da görünür [ 10.632947] debugfs: 'gpio' already exists in 'ffd06000.dvb' [ 10.707889] avl6862 3-0014: GPIO: amlogic-dvb-fe0-power → /sys/kernel/debug/gpio [ 10.707935] avl6862 3-0014: GPIO: amlogic-dvb-fe0-reset → /sys/kernel/debug/gpio [ 12.240599] avl6862 3-0014: fe0: GPIO sekans tamam (pwr_off=100 pwr_on=300 rst=600+500 ms) -
taki Interesting! .. but I would ask that you push current working code to a GitHub repo as it would make a lot of sense for Marek (and likely others) to collaborate on a clean demux rewrite that could eventually be upstreamed, than get too far down the road of reworking vendor code.
NB: I have been poking around in the vdec code recently and have one MPEG2 video that now decodes (badly) which I guess is an improvement on no videos decoding. I have a hunch the underlying issue is about alignment of buffers to frame dimensions, but neither I or Claude managed to spot the problem yet. It continues to be something I tinker with (among many things) though.
-
I think we must decide how we approach this topic. The work I did was more like a proof of concept that it is even possible to have DVB working under mainline kernel. To make it real it must be merged into upstream.
taki You said:
I have developed this according to modern kernel architecture.
Is that mean that You wrote it from scratch or did You take the vendor driver and adapted it like I did ?
One thing is to write driver code according to mainline kernel infrastructure, other thing is to have this driver merged into upstream. I do not have expirience in pushing code to mainline kernel but I think that the code from my branch is far from this goal
-
Ahh, rozpruwacz is Marek

I now have the DVB-S and DVB-T tuners for the WeTek Play2 and the DVB-T tuner in the O2.cz box showing up in Tvheadend. I am able to run a scan without errors. However I have no Satellite dish or Terrestrial antenna to connect them to so all scans find zero services (as expected) so it's impossible to tell whether anything is really working

I've pushed an updated set of images to my testing share. The WP2 image and 'box' image will boot the default WP2 device-tree which contains no DVB support, so you will need to edit extlinux.conf or uEnv.ini and change the dtb name to one of:
- meson-gxbb-wetek-play2-atsc.dtb <= might not work, I didn't find the ATSC tuner module to test yet
- meson-gxbb-wetek-play2-dvb-s.dtb
- meson-gxbb-wetek-play2-dvb-t.dtb
The O2.cz box (SML-5442TW) and the GTMEDIA GTT-2 box Marek has been using both have DVB support enabled.
Once WP2 is rebooted with the correct device-tree file dmesg should show the cards, and you can install Tvheadend43 (or VDR) to scan for services. I'm a bit vague on the remaining process as (as mentioned) I can't test anything.
rawnar I've also included a WeTek Hub image in the test share. Apologies for the long wait, I got a bit distracted.
-
Of course, I didn't write the driver from scratch. I’m not a professional programmer or developer; I’m doing this as a hobby. You likely know coding much better than I do. That said, I’m not completely clueless about Linux and C++; it would be impossible to create a driver of this complexity without at least some understanding. My goal isn't to upstream anything; it’s simply to enable DVB streaming since USB tuner prices have become so expensive.
Using the sti driver (from the Google Git kernel common) as a reference, I used DeepSeek to generate the backbone and developed the driver step-by-step by fixing numerous bugs. One of the biggest problems is that most of the demos and tuners used by amlogic devices are not available in the mainline kernel. While testing the driver, it was not possible to know whether the presence or absence of signal was due to the dvb driver or the frontend. Sometimes fake signal and i2c error etc. It was like looking for a needle in a haystack. Honestly, this could be a PhD thesis topic: creating a functional kernel module in a complex structure using guided AI. I conducted many tests, including address verification via devmem, etc.
The final piece of the puzzle is AML_MEM_REQ_EN_SW—everything works with it. However, it fails with AML_MEM_REQ_EN_HW. The software driver works perfectly on the S905X3 because that’s the device I have for testing. I can't guarantee it will work for chips newer than the S905X3 without the hardware on hand, but I believe rozpruacz can make it happen. I actually got into this because of the 'S905X4 built-in DVB' topic on the CoreELEC forum. He helped me a lot; without his guidance, I probably wouldn't have started this.
I had stepped away from Linux development for quite a while. To continue, I prepared this as a LibreELEC addon (similar to the avl6862 addon in CoreELEC) without touching the mainline kernel. The advantage is that you can add patches and compile easily without messing with Kconfig, etc. Plus, you can send the newly compiled driver and DTB to the device over the network for testing.
I also have an old S905 Mecool K2 Pro. There are minor differences; it has demod and tuner signal lock, but it needs small offset corrections compared to the S905 for the TS (Transport Stream) to flow. In short, I’m currently working on the HW demux and will share it as soon as possible. Here, architecture comes into play again: whether the demod/tuner will connect directly or via the DTS driver. There are specific wait times for the Amlogic hardware to become active. static const struct of_device_id aml_dvb_of_match[] = {
/* S905 (GXBB) */
{ .compatible = "amlogic,gxbb-dvb" },
/* S905X/D/W (GXL) */
{ .compatible = "amlogic,gxl-dvb" },
/* S912 (GXM) */
{ .compatible = "amlogic,gxm-dvb" },
/* S905X2/D2 (G12A) */
{ .compatible = "amlogic,g12a-dvb" },
/* S922X/A311D (G12B) */
{ .compatible = "amlogic,g12b-dvb" },
/* S905X3/D3 (SM1) */
{ .compatible = "amlogic,sm1-dvb" },
/* T962X3 (TL1) */
{ .compatible = "amlogic,tl1-dvb" },
/* S905X4/D4 (SC2) */
{ .compatible = "amlogic,sc2-dvb" },
/* T950X4/A311D2 (T7) */
{ .compatible = "amlogic,t7-dvb" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, aml_dvb_of_match); -