It was a match made in heaven: two years ago AmLogic and BayLibre joined forces to bring top-notch support for AmLogic SoCs into the mainline Linux kernel.

Since that time AmLogic has continued to become one of the most relevant and widely used silicon vendors in the world. Similarly, BayLibre has expanded the variety of SoCs, drivers and frameworks supported upstream all while supporting a growing number of OEMs basing their products off of recent kernel releases.

Along the way Baylibre has collaborated with a great community of product makers, kernel hackers and hobbyists to improve the AmLogic Meson SoC support in mainline Linux. We’ve added support for 64-bit SoCs, new drivers, and we’ve become maintainers for the AmLogic platform in Linux.

Our goal is straightforward: AmLogic system-on-chip processors should be so well-supported in the mainline Linux kernel that OEMs will go to market using the latest stable kernel release.

Last year at Embedded Linux Conference 2017 and this year at Linux Conf Australia, Neil Armstrong gave a well-received talk on our work. This post expands on Neil’s presentation and provides an update on some of the changes we’ve been involved with recently.

The Linux Meson project

The Linux Meson project is an effort to get support for the ARM-based SoCs produced by AmLogic into the upstream Linux kernel and GNU/Linux distributions. AmLogic chips are found in many Android-based multimedia devices such as set-top boxes, smart TVs, projectors, and tablets but are also starting to appear in products in the smart speaker market. Popular consumer products and community boards using the AmLogic Meson SoC include:

Amazon Fire TV (gen3)

Wetek Play/Hub

Nexbox A1/A95

Hardkernel ODROID-C2

Tronsmart Vega S96

R-Box Pro

HwaCom AmazeTV

Libre Tech CC (a.k.a “Le Potato”)

Khadas VIM and VIM2

NanoPi K2

AmLogic provides a kernel release and SDK that supports their hardware but it’s a heavily-modified 3.10-based or 3.14-based kernel for Android. Thankfully, most of the changes are confined to the `drivers/amlogic` directory and it has been possible to use them as a starting point to write the upstream support.

Carlo Caione added the initial support for the 32-bit Meson6 SoC in Linux 3.18, with Beniamino Galvani adding support for Ethernet and Andreas Färber contributing code for the GXBB platform. Since then, support has been added for Meson8, Meson8b, and the 64-bit ARM Meson GXBB, Meson GXL and GXM SoCs and a whole host of hardware. Codenames for the 64-bit SoCs are used in the kernel source and the following table shows how they map to their respective product names:

Codename Product name GXBB S905 GXL S905X, S905D GXM S912 AXG A111, A112, A113

Here’s How We Helped

Our efforts have mainly been focused on adding support for the 64-bit Meson SoCs. Kevin Hilman generalized the boot and serial console code for the 64-bit AmLogic family of SoCs so that more boards could be supported, starting with the Hardkernel ODROID-C2).

Michael Turquette reworked the Meson SoC clock driver to move to the `platform_driver` API and replaced the dynamic configuration code with statically initialized data. That was in preparation for adding clock driver support for the S905 SoC. We’ve also added S905 AO (Always-On) clock and reset controller drivers and support for PWM, RNG, Watchdog, IR, I2C, SPIFC devices.

Because some of AmLogic SoCs use a legacy version of the System Control and Power Interface (SCPI) protocol (pre-v1.0), we pushed changes to the upstream SCPI driver to support it. The SCPI driver is used for Dynamic Voltage and Frequency Scaling (DVFS) with the CPUFreq subsystem to dynamically alter the processor’s speed.

We’ve added a driver for the AmLogic SPI Communication Controller (SPICC) that’s capable of full-duplex transfers up to 30MHz. And in v4.10 Kevin added a brand new SD/eMMC driver that supports the host controller found on the AmLogic S905/GX* family of SoCs.

Neil wrote the AmLogic Meson DRM driver and has added HDMI support since his last update during his talk at Embedded Linux Conference 2017.

As the following graph shows, the number of Meson patches merged into the kernel has risen steadily over the last few kernel releases, and Baylibre is responsible for hundreds of them.



And because of our knowledge of the Meson code, we’ve had the honour of becoming (co-)maintainers for the majority of it.

Meson SoC code (Kevin Hilman)

DRM display driver (Neil Armstrong)

AO-CEC driver (Neil Armstrong)

Meson SoC clock framework (Neil Armstrong and Jerome Brunet)

As the number of supported boards has grown, it’s become increasingly important to maintain quality across all devices. For that, we’ve leaned heavily on kernelci.org. Baylibre is a founding member of kCI and you can expect more details in an upcoming blog post.

kernelci.org has been extremely useful for our AmLogic work. Part of our lab is made up of 8 AmLogic Meson boards which we use to check for regressions across 6 kernel trees. The kernelci.org infrastructure recently caught a kernel regression in the SCPI code which resulted in CPUFreq failures on boot. Thanks to kernelci.org and our collection of Meson boards, we were able to get the offending patch reverted before the final v4.15 release.

Links to Community Resources

AmLogic Meson support has come a long way in the last two years. That progress has been possible thanks to the supportive Linux Meson community and the kernel hackers (shout out to Martin Blumenstringl for his contributions as well as Carlo Caione and Andreas Färber for their early work and ongoing reviews) helping to improve the upstream AmLogic code. There’s lots more to come and we are currently working on support for the new AXG SoC (including audio) which is targeted at the smart speaker market.

If you want to know more about Linux Meson development you can subscribe to the linux-amlogic mailing list or join the #linux-amlogic IRC channel on irc.freenode.net. Also, the Linux Meson wiki is updated as support for new devices and SoCs lands in mainline Linux.

Post header image by Hardkernel – http://odroid.com/dokuwiki/doku.php?id=en:odroid-c2, CC BY-SA 3.0, Link