Mainline Linux on AmLogic SoCs

LinuxConf Australia 2018

Kernel MiniConf

Neil Armstrong - BayLibre

BayLibre is an embedded software engineering firm. We specialize in embedded Linux, custom firmware, SoC support and product development.

1) Initial State of the Art

Amlogic SoC Family

Amlogic designs System-On-Chips for :

  • Set-Top-Boxes
  • Tablets, TVs or Projectors
  • Smart home hub

Well Known SoCs :

  • GXBB : S905
  • GXL : S905X
  • GXM : S912

The AXG family (A113D SoC) is designed for Smart Speakers with Amazon Alexa for example.

Amlogic SoC Family

ARM 64bit SoC

Amlogic GX Family (GXBB, GXL, GXM, AXG) has :

  • 4 or 8 ARM Cortex-A53 up to 1,5GHz+
  • Mali-450 on GXBB/GXL or Mali-T820 on GXM
  • HDMI 2.0a 4K HDR display support, only DSI on AXG
  • H.264, H.265, VP9 (+10bit) HW Decoder on GXBB/GXL/GXM
  • H.264 (+H.265 for GXM) HW Encoder on GXBB/GXL/GXM
  • Gigabit Ethernet, USB2.0 Host+Device

S905/S905X/S912 Products

Amlogic Community Boards

Amlogic Community Boards

Linux Support

Kernel and U-boot source are available from the official Amlogic website :

Heavily changed 3.10/3.14 kernel for Android is available for up to GXM SoCs.

But since early 2017, a 4.9 port is also available for GXL and newer SoCs. New 4.9 kernel is used for "Linux" products, has support for Wayland Mali OpenGL acceleration.

Upstream Support

Before 4.7, only some minimal support was pushed by some independent kernel hackers :

  • Carlo Caoine, Beniamino Galvani, Andreas Färber, ...

Minimal boot was supported on S805, AML7826MX and very early GXBB support. Community work started on :

  • #linux-amlogic on Freenode
  • and later on

2) Work Achieved so far

Mainline work since 4.1

BayLibre Development

BayLibre develops and maintains the AmLogic kernel upstream, along with community contributions.

Linux Maintainers are :

  • arm-soc Amlogic : Kevin Hilman and Carlo Caione
  • DRM Display driver : Neil Armstrong
  • Amlogic Clock driver : Jerome Brunet and Neil Armstrong
  • Amlogic Media drivers : Neil Armstrong

The DRM maintainance goes through the shared drm-misc git repository using the Intel DIM tools.

ARM 64bit SoC Upstreaming

Work was concentrated on 64bit SoCs, but support for older SoCs is added if possible (i.e PWM, Reset, ...)

Support for GXBB landed and evolved since 4.7

Support for GXL and GXM landed on 4.10

Best support is from 4.14 with :

  • MMC with up to HS200
  • SCPI for DVFS
  • DRM Driver for Display (Composite + HDMI)
  • USB for GXBB
  • Ethernet, I2C, SPI, PWM, ...

General I/O Upstreaming

"Basic" support was pushed/fixed first :

  • Clock rework in 4.8
  • Random Generator v4.8
  • Watchdog v4.8
  • Already pushed IR v4.8
  • PWM v4.9
  • Already pushed I2C v4.9
  • Already pushed SPIFC v4.9


System Control and Power Interface is the protocol implementation between the ARM Cortex cores and the "System Control Processor" usually implemented using a Cortex-M3 core in an Always-On power domain.


Having stable Firmware protocols seems a good idea, but in this case Amlogic based it's SCPI firmware implementation on an early Juno released to Cortex-A53 licensees.

But ARM reworked and pushed an updated version of the SCPI protocols upstream.

Hopefully (sic), Rockchip used the same SCPI version for their SCPI implementation.

Mailbox for SCPI

All communications to the SCP firmware are required to use a Mailbox to synchronize.

  • Based on ARM MHU
  • Was am "AMBA" device
  • Needs a proper driver for Platform
  • Mixed driver was a geant Spaguetti Monster
  • Thanks Jassi Brar for your support !

The driver was pushed for Linux 4.9

SCPI final push

SCPI now supports GXBB on Linux 4.10.

Support for GXL and GXM has been done in 4.11 by :

  • Moving SCPI nodes to common dtsi
  • Adding second "scpi_clock" clock name in the GXM dts
  • Adding SCPI clock to second GXM Cortex-A53 cluster


Kevin Hilman wrote a brand new MMC host driver from Amlogic's implementation and the provided public Datasheet.

The driver was updated for Linux 4.14 and supports :

  • 1bit or 4bit bus width
  • High-Speed up to 50MHz
  • DDR/SDR modes up to SDR104, HS200/HS400
  • Make use of the scatter-gather compatible DMA


In the end of 2016 Amlogic published the code for their GXL and GXM family variants.

These SoCs are enhanced version of the S905 with support for 4k VP9 and H.265 decoding.

Since these SoCs are very close to thre S905, a new hierarchical DT structure has been pushed for 4.10 :

  • GX
    • GXBB ->boards
    • GXL -> boards
      • GXM -> boards


Amlogic SoCs has a complex and feature-full Video Display pipeline that can easily match the Linux DRM structure.

Classic view in DRM Structure :


Mapping of Amlogic Video Processing Unit :

HDMI Progress

The Amlogic SoCs uses a Synopsys DesignWare HDMI Controller like multiple other SoCs.

Hopefully, a clean dw-hdmi bridge driver has been pushed a while ago.

HDMI Support for GXBB, GXL, GXM was merged in 4.2 :

  • PHY is custom, needed advance integration and separate callbacks
  • HPD is custom, needed to be handled out of the dw-hdmi driver

Support for previous generations will need support for un Unknown HDMI Controller.

GXL & GXM Internal PHY

The new GXL and GXM SoCs features an embedded RMII 10/100 Ethernet PHY muxed with the external RGMII 10/100/1000 interface.

Support for 32bit mux registers for MDIO has been pushed along the PHY support for Linux 4.10

Lately, a fix to fix stability and reliability has been pushed for stable and 4.16.

CEC Support

CEC is a single-line multi-master network protocol used between all HDMI devices to communicate, exchange information and ask for routing changes.

CEC is used for (+ a lot more) :

  • switch the TV input source
  • power on/off the TV
  • use the TV remote control for external devices

The Amlogic CEC driver has been merged for 4.14 using the CEC Framework maintained by Hans Verkuil.

Mali integration

GXBB and GXL embeds a Mali-450 MP3 IP that renders OpenGL ES 1 & ES 2.

Mali integration

ARM provides a GPL kernel driver that discusses with the user-space OpenGL shared library.

Support for GXBB and GXL has been added to the ARM Mali kernel driver :


Still need some work on GXM to support the Mali-T820.

User-Space library must be generate by the SoC vendor and must match the hardware config and kernel driver version.

What about LIMA ?

A first initiative to create a full open-source alternative to the ARM binaries was launched in 2012 : LIMA driver

But it stalled in late 2016 since the driver design did not fit in the classic scheme : DRM driver + Gallium Driver

An (ex ?) AMD employee started a new driver at :

It can render kmscube on Mali-400 and has basic support for Mali-450 embedded in Amlogic SoCs.

3) Work in Progress

Video Display work

To provide better display experience the support of the following are necessary :

  • Cursor Plane
  • Overlay Planes
  • OSD Scaling
  • Overlay Scaling
  • MIPI-DSI Output

DRM Architecture

DRM Planes

Current Situation :

  • Only primary plane, no scaling
  • No overlay planes
  • No cursor plane

Missing support :

  • Add primary plane scaling
  • Add overlay planes with support for YUV 4:4:4, 4:2:2, 4:1:1, YUYV, NV12 or NV21.
  • Add overlay planes scaling
  • Add cursor plane without scaling


The SoC provide S/PDIF, I2S, PCM input and output.

Basic I2S output has been written and works throught HDMI or external DAC.

Missing support of :

  • S/PDIF input and output
  • I2S input
  • PCM input and output
  • GXL and GXM embedded stereo DAC

Video Hardware Acceleration

One of the best features of those Amlogic SoCs is the Hardware Video Decoding and Encoding.

This will be handled as V4L2 driver to support full control from user-space application.

With support of Overlay planes in the DRM Display Driver, such decoded video frames could be played from graphical applications like VLC.


The GXL and GXm SoCs has a DesignWare USB3 controller forced to USB2 only (sic), with up to 3 PHYs to be configured.

This is why, Martin Blumenstingl, is pushing for a "Generic Roothub" interface to route PHY commands (Init, Enable, Disable, ...) to all PHYs at the same time.

PHY Driver is already upstream since 4.13

4) Overview of the Community

Huge community

A lot of people loves to hack the Odroid-C2 board, and great applications like LibreELEC with KODI runs on these platforms.

A big part of Raspberry Pi projects are modified to run on the S905 platform, thanks to it's more powefull Mali-450 GPU and 4K Video Output and Video Decoding capability.

Emmergent Mainline Hacker Community

A few independent hacker pushes regurlary patchs to fix and support more features on the Amlogic SoCs.

For example, USB support for S905 and ADC support was pushed by an independant german hacker on his spare time (thanks Martin Blumenstingl !)

Such work keeps us focus on bigger features and we provide the community tests and integration to kernelci for automated boot testing.

Growing Single Board Computer diversity

Starting with the Odroid-C2 in 2016, there is now 5 Single Board Computers easing the Mainline support of these Amlogic SoCs.

Particularly, the new Libre Computer project "LibreTech-CC" board, succesfully backed on Kickstarter, wants to have Mainline support and is funding BayLibre for this task.

Thank you,

any questions ?

Presentation made with :
impress.js, Pandoc, Hovercraft!, Bootstrap, GIMP, ...
Hosted on :

→, ←, moletteDiapo suivante, précédente
↑, double-clicVue d'ensemble
PConsole de présentation
HCette aide