Porting FreeBSD to Pinephone Pro (help needed)

Hi! As mentioned in the FreeBSD quarterly update, I am attempting to port FreeBSD to the PinePhone Pro with support from Honeyguide group. I am new to FreeBSD and kernel/driver development, so help is welcomed.

See the code repo at https://codeberg.org/Honeyguide/freebsd-pinephonepro for the current status, but in short, FreeBSD boots, but nothing works (not even the screen), but you can interact with the OS via UART over headphone jack. So far I've implemented a driver for the RK818 power management chip and the real-time clock.

Next I'll try to implement a driver for the battery status and battery charger. I'm struggling to find documentation on how to do this though, and I can't even find the source code for the "simple-battery" driver being referenced in the device tree of various devices, so any pointers would be appreciated.

Otherwise, if you'd like to give it a go, instructions are in the code repo.
 
There's been some progress! Battery driver and charging is working and console output now appears on the display:

ppp_freebsd_screen.jpg
 
mario wants to know if it is a MIPI DSI Display?
How did you get the display working? Are you using DT overlays?

 
Looks like it is MIPI DSI:

Code:
    /* MIPI DSI panel 1.8v supply */
    vcc1v8_lcd: vcc1v8-lcd {
        compatible = "regulator-fixed";
        enable-active-high;
        regulator-always-on;
        regulator-boot-on;
        regulator-name = "vcc1v8_lcd";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
        vin-supply = <&vcc3v3_sys>;
        gpio = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>;
        pinctrl-names = "default";
        pinctrl-0 = <&display_pwren1>;
    };

    /* MIPI DSI panel 2.8v supply */
    vcc2v8_lcd: vcc2v8-lcd {
        compatible = "regulator-fixed";
        enable-active-high;
        regulator-always-on;
        regulator-boot-on;
        regulator-name = "vcc2v8_lcd";
        regulator-min-microvolt = <2800000>;
        regulator-max-microvolt = <2800000>;
        vin-supply = <&vcc3v3_sys>;
        gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>;
        pinctrl-names = "default";
        pinctrl-0 = <&display_pwren>;

 
mario wants to know if it is a MIPI DSI Display? How did you get the display working? Are you using DT overlays?

Yes it is MIPI DSI. I got it working by using the UEFI GOP (EFI framebuffer), i.e. I use Megi's U-Boot which sets up the display and the FreeBSD kernel can use that for it's console output. While this should automatically "just work", I had to add patches to prevent the display from being reset/blanked during bootup. This is not a complete solution, there's no 2D or 3D acceleration, but it should support X via the scfb driver (I have not tested this yet).
 
UPDATE: We now have a working desktop with touch support! I've created a flashable image for anyone to try out on their Pinephone Pro. Details are in the code repo:

https://codeberg.org/Honeyguide/freebsd-pinephonepro#releases

If you have a Pinephone Pro, please test and report back! Any feedback would be helpful.

If you are a FreeBSD developer, the image contains the kernel source, build tools, vim, and an example driver that you can use to start implementing or porting drivers directly on-device. Right now, porting the WiFi driver from Linux and/or getting the USB subsystem working would be very useful, so any help in that regard would be most welcome.
 
Back
Top