Mainline Linux on AmLogic SoCs

ELC North America 2017

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 Multimedia System-On-Chips for :

  • Set-Top-Boxes
  • Tablets
  • TVs or Projectors

Latest ARM 64bit based Families are

  • GXBB, GXL, GXM for Set-Top-Boxes
  • GXTVBB, TXL for Tvs

Older ARM 32bit Families includes :

  • AML8726, M8, MX for Tablets
  • S8 for Set-Top-Boxes
  • M6, T8, T9 for TV or Projectors

Amlogic SoC Family

Amlogic SoC products

Well-Known products are essentially based on the :

  • S805 : Quad Cortex-A5
  • S905 and S905X : Quad Cortex-A53
  • S912 : Octo Cortex-A53

More Informations on : https://en.wikipedia.org/wiki/Amlogic

ARM 64bit SoC

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

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

S905/S905X/S912 Products

Amlogic Community Boards


Linux Support

All SoCs have off-tree linux support,

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

http://openlinux.amlogic.com/

Only heavily changed 3.10/3.14 kernel for Android is available.

But most of the changes are in drivers/amlogic kernel source directory

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 :

  • http://linux-meson.com
  • #linux-amlogic on Freenode
  • and later on linux-amlogic@lists.infradead.org

2) Work Achieved

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

I recently been added to the experimental drm-misc write group where I can push Acked patches for small changes in drivers directly in the git repository.

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.10 with :

  • MMC
  • SCPI for DVFS
  • DRM Driver for Display (Composite)
  • USB for GXBB

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

SCPI for DVFS

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

SCPI for DVFS

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 will be done in 4.11 by :

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

eMMC/SDIO/SDCard

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

The hardware supports :

  • eMMC : 4bit, 8bit, HS-SDR, HS-DDR, HS400
  • SDCard : 4bit, SDR, DDR50
  • SDIO : 4bit, SDR, DDR50, SDIO IRQ

The driver was pushed for Linux 4.10 with only support for :

  • 1bit or 4bit
  • High-Speed up to 50MHz

GXL & GXM

In the end of 2016 Amlogic published the code for their GXL ang 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

DRM for CVBS

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

Classic view in DRM Structure :

DRM for CVBS

Mapping of Amlogic Video Processing Unit :

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

3) Work in Progress

MMC Performance Optimizations

To Achieve max performances the following are in the work :

  • DDR modes
  • HS200/HS400 with calibration support
  • Make use of the scatter-gather compatible DMA

Last round of optimization make possible to achieve 140Mbytes/s on eMMC.

Heiner Kallweit, an hobbyist is currently pushing support for these features.

Mali integration

GXBB 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 :

  • https://github.com/superna9999/meson_gx_mali_450

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.

Video Display work

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

  • HDMI Controller and PHY
  • Cursor Plane
  • Overlay Planes
  • OSD Scaling
  • Overlay Scaling

DRM Architecture

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.

But :

  • PHY is custom, need advance integration and separate callbacks
  • HPD is custom, need to be handled out of the dw-hdmi driver
  • CEC is handled by Amlogic custom Hardware

Patches are ready, we target Linux 4.12

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

Audio

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.

4) Overview of the Community

Huge community

A lot of people loves to hack the Odroid-C2 board, and great applications like OpenELEC, LibreELEC of 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 ans 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.

Thank you,

any questions ?



Presentation made with :
impress.js, Pandoc, Hovercraft!, Bootstrap, GIMP, ...
Hosted on :
https://people.freedesktop.org/~narmstrong/elcna-2017-amlogic

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