megi's PinePhone Development Log RSS


2024–02–11: Small tidbits and magnetometer driver upstreaming

I've made some effort to clean up and add features to magnetometer driver written by Icenowy for magnetometer used on Pinephone and Pinephone Pro called AF8133J.

Originally the driver did not have buffer mode, so it was not possible to read all X/Y/Z values of magnetic flux density. You could only read X, Y and Z in sequence sampled at different points in time. Not optimal.

I've added buffered mode to the driver and some power management. While AF8133J doesn't benefit much from this power management, it is important to have it due to shared nature of some resources, like power regulators.

Here's the patch series.

Small recent bugs, and stuff

Other than that, nothing that unusual is going on. I continue to maintain my kernel branches, as usual.

Some PineTab2 work

I've extended the RK817 PMIC driver to allow fine control over charging current and voltage via sysfs, and implemented charger detection via USB-PD. Most of that work is available in my pt2–6.8 branch, along with the initial upstreamed version of PT2 device tree.

The are some unresolved issues with USB data role switching, but other than that, the port now has working power negotiation.

I helped review PineTab2 upstreaming patches, and PT2 support landed upstream recently, thanks to upstreaming effort of Manuel Traut.

Jonas Karlman (kwiboo) already sent patches to support PT2 to U-Boot, based on the above work.

Rockchip blobs, U-Boot and Linux kernel are plenty fast on PT2. Boot times to Linux console are on the order of ~5s if you disable some useless DT nodes that delay boot time by quite a lot. One is PCIe controller, and the other is internal WiFi SDIO interface. Manufacturer's firmware/driver for internal WiFi is really not very trustworthy to me. So I use this solution based on rtl8822bu WiFi driver, which has excellent performance, nice upstream manufacturer supported drivers (rtw88), and just works. :) Sad that internal WiFi situation is such as it is, but at least the 360° C-A connector adapter is quite robust and avoids most accidental disconnects or port damage. WiFi adapter is nicely hidden behind the tablet. And thankfully, PT2 has 2 USB ports, so I can still charge it with USB WiFi adapter inserted.

Upstream WiFi driver for Pinehone

This development by airtower-luna is also very exciting. She extended the above mentioned upstream rtw88 driver to support Pinephone's RTL8723CS WiFi chip. This means that it may soon be possible to shed the massive out of tree driver for this WiFi chip that kept WiFi working on original Pinephone, up to now.

I've been trying this driver and integrated it into my orange-pi-6.8 branch to be able to test it more. It works, but there are some issues with reception. Reception speed is quite limited to about 1–2mbit/s compared to ~30mbit/s that the out of tree driver is capable of on the same network. I'm happy to see this progress.

New releases of my bootloader builds

Thanks to kwiboo's awesome work on all kinds of rockchip boards and SoCs in U-Boot, I'll soon be able to build bootloaders for all the many boards I have from a unified source code tree. The new U-Boot version seems to support booting from NVMe on Orange Pi 5 Plus and Pine Quartz boards, which is quite exciting, too.

I did a rebase of my remaining patches for Pinephone Pro display support on top of kwiboo's U-Boot 2024.01 and while it doesn't work, yet, it should not be hard to figure out why and look at upstreaming more of the remaining patches.