Mainline Linux kernel for the Jolla C2

Since I got my Jolla C2, I’ve been trying to get a (close-to-)mainline Linux kernel running on it. Now that at least some things are working, I’ve decided to create this thread to report the mainlining progress.

The following things are working right now:

  • Display
  • Touchscreen
  • GPU
  • USB in peripheral mode (no host mode yet)
  • Battery charging and fuel gauge
  • Power off (but no reboot for some reason)

The changes are available at Files · ums9230 · linux-mainlining / Linux · GitLab.

To boot this kernel, use this U-Boot fork as a secondary bootloader. The installation process is described here.

42 Likes

Uh, nice! Please continue your work! It always bothers me to use decades old kernels on embedded devices.

2 Likes

Even though i dislike the C2 i have to give MAJOR props for your work. :slightly_smiling_face:

1 Like

Sailfish OS community port for the Jolla C2

A Sailfish OS community port is now available for the Jolla C2 based on the experimental close-to-mainline kernel. The currently recommended way to boot it is from an SD card, which allows you to keep your existing Sailfish OS data. However, this port is provided without any warranty, so data loss is still possible. Install at your own risk!

A prebuilt image for the Sailfish OS part is available here. Kernel building and SD card partitioning still need to be done manually.

Updated kernel build instructions are here: linux-mainlining / Sailfish OS porting / Jolla C2 kernel building · GitLab

I’ve also started writing a WiFi driver, which is still in an early stage but should already be enough to connect to the internet.

Supported features

  • WiFi, tested with a WPA2 network. Internet connectivity works.
  • Bluetooth
  • Display, Touchscreen, GPU
  • Battery charging and fuel gauge
  • USB, USB power delivery protocol (disabled in Jolla’s downstream kernel) and WIP host mode support
  • Initial code for modem bringup

Features that are not working yet

  • Standby mode (lipstick is not even blanking the display properly)
  • Audio, but Bluetooth audio works
  • Mobile data
  • WiFi AP mode (tethering)
  • GPS
  • Sensors
  • Camera
  • Video acceleration (but videos play anyway)
  • AppSupport (because this is a community port, but also because the version offered with Sailfish OS does not support mainline kernels)

Known issues

  • Bluetooth crashes when trying to use a headset in handsfree mode (if possible at all), but A2DP should work
  • WiFi and Bluetooth sometimes do not work. This happens when the wireless connectivity processor is booted before the GNSS processor, which is currently broken and causes a connectivity crash. This does not happen on every boot, so reboot if you experience this problem
  • USB host mode only works with simple devices like mouse and keyboard, USB storage is broken
  • Jolla store offers AppSupport installation because this is a C2, but it does not work and is not officially supported
  • Data role switching with USB PD might still be broken
21 Likes

Mobile data is now implemented in the close-to-mainline kernel port! SMS also seems to work, but this may depend on the provider since there is no VoLTE support yet. Only the first SIM slot works, but this will be fixed later.

For those who are interested, here are the changes I had to make to oFono: Comparing sailfishos:master...affenull2345:unisoc · sailfishos/ofono · GitHub

To avoid having to keep old images on my server, there will only be a single link to the latest image from now on: https://storage.abscue.de/private/zImage/Sailfish_OS-s19mps-latest.zip

The installation process was simplified so that the image can now be downloaded and installed directly on the Jolla C2. The kernel no longer needs to be built separately. After downloading the image, just run the following commands on the phone (make sure an SD card is inserted and there is no important data on it):

unzip SailfishOS-5.0.0.62-s19mps-0.0.1.202503152044.zip
cd SailfishOS-5.0.0.62-s19mps-0.0.1.202503152044/
./install-on-device.sh

See the localbuild repository linked in the previous post for more information about booting back to the original Sailfish OS.

9 Likes

The latest update adds support for audio. Here is the current feature status:

Already working

  • WiFi in client mode
  • Bluetooth
  • Display and GPU
  • Display blanking (lipstick PR)
  • Touchscreen
  • Battery and charging control
  • USB
  • Modem, mobile data (first SIM only, needs to be selected in settings)
  • Audio (speakers, microphone, earpiece, headphones)

Not working yet

  • Calls (currently no sound, but almost there)
  • Headphone detection
  • VoLTE
  • Suspend
  • WiFi AP mode
  • GPS
  • Sensors
  • Camera
  • Video acceleration

To select the headphones manually, run the following command:

pactl set-sink-port alsa_output.platform-sound.HiFi___ucm0001.hw_reeders19mps_0__sink "[Out] Headphones"

The communication with the modem may occasionally hang, which can be solved by turning the phone off and on again. The other known issues remain the same.

8 Likes

I’ve uploaded a new version in which voice calls should work. However, VoLTE is not working yet, and it seems that the phone cannot fall back to 2G/3G unless the call is initiated by the user.

I was hoping to get the “Network mode” switch working in settings so that you can at least switch 4G off manually, but for some reason the modem fails to power off its LTE hardware and crashes when the setting is changed (or when flight mode is enabled):

Platform Version: MOCORTM_22B_W23.08.5_Debug
Project Version:   qogirl6_pub
BASE  Version:    4G_MODEM_22B_W23.08.5
HW Version:        qogirl6_modem
02-24-2023 04:20:30
File:  PS/stack/nas/emm/src/control/nam/nam.c
Line:  15330
PASSERT(0)
NAM_IND_AS_AL_shutDown_Confirm failure!
Current thread info:
                        ID:               0x94
                        Name:             MM Task
                        Tcb_Addr:         0x8c26f63c
                        Last_Err:         0x0
                        Stack_Start:      0x8c9f1cdc
                        Stack_End:        0x8c9f632b
                        Queue_Name:       MM Q
                        Queue_Total:      200
                        Queue_Used:       0
                        Queue_Available:  200
                        Queue_Start:      0x8c9ad08c
                        Queue_End:        0x8c9add0c
Current status is SVC, below is the registers before assert:
Current mode:
        R0  = 0x00000000    R1   = 0x8c9f610c
        R2  = 0x8c9f6110    R3   = 0x800000d3
        R4  = 0x00000000    R5   = 0x00000000
        R6  = 0x8d106430    R7   = 0x8c9f6150
        R8  = 0x00000000    R9   = 0x8af2f17c
        R10 = 0x00000000    R11  = 0x00003be2
        R12 = 0x0000000a    R13  = 0x8c9f60f4
        R14 = 0x8b7e40e1    PC   = 0x8bd21060
        SPSR= 0x80000013    CPSR = 0x800000d3
SVC mode:
        R13 = 0x8c9f60f4    R14  = 0x8b7e40e1
        SPSR = 0x80000013
IRQ mode:
        R13 = 0x8d83b7d8    R14  = 0x8b111eb8
        SPSR = 0x80000013
Abort mode:
        R13 = 0x8d8351b0    R14  = 0x00000000
        SPSR = 0x00000010
Undefined mode:
        R13 = 0x8ce807f8    R14  = 0x00000000
        SPSR = 0x00000010
FIQ mode:
        R13 = 0x8d8355d0    R14  = 0x00000000
        SPSR = 0x00000010
Assert Debug Menu:
0. Print help info.
1. Print assert info.
2. Print important registers.
3. Dump all memory to a file.
4. Print memory allocated info.
5. Print memory pools info.
6. Print tasks info.
7. Print stack info.
8. Print callback function list.
a. Dump task usage.
b. Dump definite memory to a file.
c. Dump TaskSwitch memory to a file.
d. Print Event list information.
e. Print Mutex list information.
g. Print Semaphore list information.
h. Print Fat system control block info.
i. Print Byte Pool infomation
j. Print PS tasks queue info
k. Print PS function call stack
l. Print timer list infomation.
m. Print DSP assert info.
o. Mini dump info.
t. Print the all assert information.
v. Print Version Information.
z. Reset MCU.

The network technology switch is disabled for now, which means that you cannot receive incoming calls when a 4G network is available.

5 Likes