User:Antonroots/pinephone sxmo notes

From postmarketOS Wiki

PP/SXMO configuration

As of 09/11/2024 - stable configuration

In short : a bunch of notes regarding my SXMO setup on my Pinephone 1.2b (Manjaro Edition)

CPU setup

For testing purpose I used to overclock/undervolt the CPU and disable 2 or 3 cores depending on my usage.

Modifying the existing DTB/DTS doesn't seems to be the suitable solution to me.

It's a better option to download a copy of the kernel and run a make dtbs which will place the include statements in the right place.

RAM

You can easily do a "small" overclock of your DRAM by switching to a the right copy of U-Boot.

PmOS provides 3 images located in /usr/share/u-boot/pine64-pinephone/ - the default @528MHz - the previously used in PmOS @552MHz - another @624MHz

You can install one of those pre-compiled U-Boot copy by using this command :

$ sudo update-u-boot -r 552

Mine is running pretty well @576. (not provided, you have to build your own copy of U-Boot)

Bluetooth

- Bluetooth keyboards require the hidapi package to be installed.

$ sudo apk add hidapi

Ensure module uhid is loaded on startup.

- Bluetooth headset / multimedia keys support (volume, next, prev, pause...)

Add this to .config/sxmo/sway

exec 'mpris-proxy &'

Modem firmware

- Check version

$ echo 'AT+QGMR' | sudo atinout - /dev/ttyUSB2 -

- Upgrade your stock firmware

Use https://github.com/Biktorgj/quectel_eg25_recovery

Required before going to custom firmware.

Be sure you are on one of the intermediate release from here :

https://github.com/the-modem-distro/pinephone_modem_sdk/blob/scarthgap/docs/FLASHING.md#adsp-versions

1.0.0.1 still installed on most Pinephone missed a lot of issues.

$ sudo ./qfirehose -f .

- Switch to the custom modem firmware

From https://github.com/the-modem-distro/pinephone_modem_sdk

Great work ! Fixing most of modem hangs & disconnect. Save also a lot of power.

Get latest package from here https://github.com/Biktorgj/pinephone_modem_sdk/releases/latest

I'm using 0.8.0 which is the latest at the moment and the best modem experience I had on Pinephone !

Ensure your battery is FULL and your phone PLUGGED IN before doing anything.

$ sudo apk add android-tools
$ sudo ./flashall

Take the power back

Monitor :

$ watch -n 60 "upower -i /org/freedesktop/UPower/devices/battery_axp20x_battery"

Fix current level decreasing in desktop mode :

# echo 3000000 > /sys/class/power_supply/axp20x-usb/input_current_limit

This is happening often when using USB PD charger but working fine on regular USB power like a Raspberry Pi power supply.

More swap for desktop usage

PmOS uses zram as primary swap. On my PP with 3GB its creates a 1.5G zram0 device. Sometimes I would like to open multiple large file at the same time and need additional free ram and more swap.

Just create a swap file anywhere you want (here 30 x 100M = 3GB):

$ dd if=/dev/zero of=/data/swapfile bs=100M count=30 status=progress

Convert the file to a swap volume :

# chmod 0600 /data/swapfile && mkswap /data/swapfile

Then use the swapon command to enable the file swap :

# swapon /data/swapfile && swapoff /dev/zram0

Fstab

To get a smoother experience with Firefox, I mounted /tmp and /home/user/.cache to ram. 512M seems to be quiet enough, even using 20 or 30 tabs.

Add this to /etc/fstab and reboot :

tmpfs /tmp tmpfs rw,nodev,nosuid,size=512M 0 0
tmpfs /home/user/.cache tmpfs rw,nosuid,nodev,size=512M 0 0

Waydroid

Working out of the box.

Quick install :

$ sudo apk add waydroid waydroid-images
$ sudo rc-service waydroid-container start
$ sudo rc-update add waydroid-container default
$ sudo waydroid init

Start session :

$ waydroid session start

Stop session :

$ waydroid session stop

LID Backlight

Read :

$ cat /sys/class/backlight/backlight/brightness

Set to 30% :

$ sudo echo 300 > /sys/class/backlight/backlight/brightness