Jump to content

Qualcomm mainline porting

From postmarketOS Wiki
Note Work in progress and untested. Please improve this page (or merge it together with the non-Qualcomm-specific mainlining wiki page) when you try any of this.

Devices with Qualcomm SoCs are generally good candidates for porting mainline Linux, considering the great support those SoCs have. It usually doesn't take a lot of work to get a device running mainline with a decent amount of working features, provided the SoC is already supported.

Supported SoCs

SoC Arch Year UART USB Storage Display CPU GPU Pinctrl I²C Audio Video Thermal WiFi BT Modem GPS Camera Suspend
Qualcomm 215 aarch64 2019 Y Y Y Y Y Y Y Y Y N Y Y Y P N Y N
Qualcomm APQ8064 armv7 2013 Y Y Y Y Y N Y Y N Y Y N - -
Qualcomm Dragonwing QCM6490 aarch64 2022 Y Y Y Y Y Y Y Y Y Y Y Y Y P Y
Qualcomm MSM8212 armv7 2013 Y Y Y P Y Y - -
Qualcomm MSM8226 armv7 2013 Y Y Y Y P Y Y Y N N Y Y Y N Y P N
Qualcomm MSM8227 armv7 2012 Y P P P Y Y P Y - -
Qualcomm MSM8909 armv7 2015 Y Y Y P Y P Y Y N P N N - N -
Qualcomm MSM8930 armv7 2012 Y Y P P Y - -
Qualcomm MSM8960 armv7 2012 Y Y Y Y Y Y P P P - -
Qualcomm MSM8974 armv7 2013 Y Y Y Y P P Y Y N N Y Y Y P N N N
Qualcomm MSM8976 aarch64 2016 Y P Y Y P Y Y Y N N Y Y Y P - N N
Qualcomm QSD8250 armv7 2008 Y Y P P P Y - -
Qualcomm Snapdragon 410/412 aarch64 2014 Y Y Y Y P Y Y Y Y Y Y Y Y Y Y P P
Qualcomm Snapdragon 415 aarch64 2014 Y Y Y P P Y Y Y Y Y Y Y Y Y Y P -
Qualcomm Snapdragon 425 aarch64 2016 Y Y Y Y Y Y Y Y Y P Y Y Y P P Y Y
Qualcomm Snapdragon 430 aarch64 2016 Y Y Y Y Y Y Y Y Y N Y Y Y P N Y Y
Qualcomm Snapdragon 435 aarch64 2016 Y Y Y Y Y Y Y Y Y N Y Y Y N N N Y
Qualcomm Snapdragon 439 aarch64 2018 Y Y Y P Y P Y Y P N Y Y Y N N N
Qualcomm Snapdragon 450 aarch64 2017 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 460 aarch64 2020 Y Y Y Y Y Y Y N Y Y Y N Y
Qualcomm Snapdragon 615 aarch64 2014 Y Y Y Y P Y Y Y Y Y Y Y Y Y -
Qualcomm Snapdragon 616 aarch64 2014 Y Y Y Y P Y Y Y Y Y Y Y Y Y -
Qualcomm Snapdragon 625 aarch64 2016 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 626 aarch64 2016 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 630 aarch64 2017 Y P Y Y P P Y Y P Y Y Y Y P N P N
Qualcomm Snapdragon 632 aarch64 2018 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 636 aarch64 2017 Y P Y Y P P Y Y P Y Y Y Y P N P N
Qualcomm Snapdragon 660 aarch64 2017 Y P Y Y P P Y Y P Y Y Y Y P N P N
Qualcomm Snapdragon 662 aarch64 2020 Y Y Y Y Y Y Y N Y Y Y N Y
Qualcomm Snapdragon 665 aarch64 2019 Y Y Y P N Y N N N P N N N - N -
Qualcomm Snapdragon 670 aarch64 2018 N P P Y P Y Y Y P P Y Y Y Y Y
Qualcomm Snapdragon 675 aarch64 2018 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 680 aarch64 2019 N N P P N N N N N N N N N - N -
Qualcomm Snapdragon 690 5G aarch64 2020 Y Y Y Y Y Y Y Y N N P Y - Y N P
Qualcomm Snapdragon 695 5G aarch64 2021 Y Y P N Y N Y Y N N P Y - Y - N -
Qualcomm Snapdragon 7+ Gen 3 aarch64 2024 Y Y Y Y Y Y Y Y P Y Y
Qualcomm Snapdragon 710 aarch64 2018 Y P Y Y Y Y Y Y P Y P N Y Y Y P P
Qualcomm Snapdragon 720G aarch64 2020 Y Y Y Y Y Y Y Y Y Y P - -
Qualcomm Snapdragon 730 aarch64 2019 Y Y Y Y Y Y Y Y P N Y Y Y Y P P Y
Qualcomm Snapdragon 730G aarch64 2020 Y Y Y Y Y Y Y Y P N Y Y Y Y P P Y
Qualcomm Snapdragon 732G aarch64 2020 Y Y Y Y Y Y Y Y P N Y Y Y Y P P Y
Qualcomm Snapdragon 778G aarch64 2021 Y Y Y Y Y Y Y Y Y Y Y Y Y P Y
Qualcomm Snapdragon 778G+ aarch64 2021 Y Y Y Y Y Y Y Y Y Y Y Y Y P Y
Qualcomm Snapdragon 782G aarch64 2022 Y Y Y Y Y Y Y Y Y Y Y Y Y P Y
Qualcomm Snapdragon 7c aarch64 2019 Y Y Y Y Y Y Y Y Y Y Y Y Y - - N Y
Qualcomm Snapdragon 7c Gen 2 aarch64 2021 Y Y Y Y Y Y Y Y Y Y Y Y Y - - N Y
Qualcomm Snapdragon 7s Gen 3 aarch64 2024 Y P Y Y Y Y Y Y N Y Y Y Y Y N N
Qualcomm Snapdragon 7s Gen 4 aarch64 2025 Y P Y Y Y Y Y Y N Y Y Y Y Y N N
Qualcomm Snapdragon 8 Elite aarch64 2024 Y Y Y Y Y P Y Y Y Y Y P P Y
Qualcomm Snapdragon 8 Elite Gen 5 aarch64 2025 Y Y Y Y Y Y Y Y Y Y Y Y Y P Y Y
Qualcomm Snapdragon 8 Gen 1 aarch64 2021 Y Y Y Y Y Y Y Y Y Y Y Y Y - -
Qualcomm Snapdragon 8 Gen 2 aarch64 2022 Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 8 Gen 3 aarch64 2023 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 8 Gen 3 aarch64 2023 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 8 Gen 3 aarch64 2023 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 8 Gen 3 aarch64 2023 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 8 Gen 3 Leading Version aarch64 2023 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y
Qualcomm Snapdragon 8+ Gen 1 aarch64 2022 Y Y Y Y Y Y Y Y Y Y - -
Qualcomm Snapdragon 805 armv7 2013
Qualcomm Snapdragon 808 aarch64 2015 Y Y P P Y N Y N - N
Qualcomm Snapdragon 810 aarch64 2015 Y Y P P Y N Y N - N
Qualcomm Snapdragon 820 aarch64 2016 Y Y P Y P Y Y Y Y Y Y - - P - P N
Qualcomm Snapdragon 821 aarch64 2016 Y Y P Y P Y Y Y Y Y Y - - P - P N
Qualcomm Snapdragon 835 aarch64 2017 Y N Y P P N Y Y Y Y Y Y P Y
Qualcomm Snapdragon 845/850 aarch64 2018 Y Y Y Y Y Y Y Y Y Y Y Y Y P Y Y Y
Qualcomm Snapdragon 855 aarch64 2019 Y Y Y Y Y Y Y Y P N Y Y Y P P P Y
Qualcomm Snapdragon 860 aarch64 2019 Y Y Y Y Y Y Y Y P N Y Y Y P P P Y
Qualcomm Snapdragon 865 aarch64 2019 Y Y Y P Y Y Y Y Y Y Y Y - -
Qualcomm Snapdragon 865+ aarch64 2020 Y Y Y P Y Y Y Y Y Y Y Y - -
Qualcomm Snapdragon 870 aarch64 2021 Y Y Y P Y Y Y Y Y Y Y Y - -
Qualcomm Snapdragon 888 aarch64 2021 P Y P Y - -
Qualcomm Snapdragon 8cx Gen 3 aarch64 2021 Y Y Y Y Y Y Y Y P P Y P P Y P P
Qualcomm Snapdragon 8s Gen 3 aarch64 2024 Y Y Y Y Y Y Y Y P Y Y N N N
Qualcomm Snapdragon X Elite aarch64 2023
Qualcomm Snapdragon X Elite aarch64 2023
Qualcomm Snapdragon X Elite aarch64 2023
Qualcomm Snapdragon X Elite aarch64 2024 Y Y Y Y Y Y Y Y N Y Y Y - - N N
Qualcomm Snapdragon X2 Elite aarch64 2025
Qualcomm Snapdragon X2 Elite aarch64 2025
Qualcomm Snapdragon X2 Elite aarch64 2025
Qualcomm Snapdragon X2 Elite aarch64 2025
Qualcomm Snapdragon X2 Elite Extreme aarch64 2025
Qualcomm Snapdragon X2 Elite Extreme aarch64 2025

Prerequisites

  • Downstream kernel source code: This is the main source of reference when porting the mainline kernel.
  • Board schematics: An additional source of reference that can be really helpful considering the usually poor quality of downstream code including the device trees. Will allow you to confirm the wiring of all components, and will also show any hardware that is misrepresented in the downstream device tree, such as fixed regulators which are often modeled as enable pins.
  • Having the mainline source code of a similar device can be very helpful: https://wiki.postmarketos.org/wiki/Mainlining#Supported_SoCs

First steps

You must find a method for getting feedback from the device when booting the mainline kernel. This will be necessary for debugging.

UART

Perhaps the most useful method, since it allows for getting early kernel messages, and even bootloader logs which can help when the device is not finding or refusing your DTB. You will have to find the location of the UART port on your device, see (video tutorial | Identifying serial ports) and Serial debugging

Simple Framebuffer

This should be the easiest method to get working, provided you have a video-mode panel and your bootloader leaves a framebuffer configured for continuous splash. It will allow Linux to print its logs to the screen, and it will also allow you to actually make use of the screen before writing a panel driver, although to a limited extent.

RAM Console / ramoops

This method is more of a last resort, considering it is usually unreliable and in many instances quite difficult to get working.

Relevant chat log

Thanks to opendata and bshah for the following log. Let's make this more wiki friendly once we try it out.

  • Copy fairphone2 DTs and change device info
    • (alas, if you are using Nexus 4, apq8064 based device would be good start i.e Nexus 7 2013 (yes, it's most complete device now))
      • Not sure about 8064, I would do the same thing but base off yuga
  • Look for a file named msm8974-regulator.dtsi in devices android kernel tree
  • Look for pm8841_s1: regulator-s1 then look at the voltages and make sure your DTS is the same, if not change it.
  • Do the same operation for the other regulators:
    • pm8841_s2: regulator-s2
    • pm8841_s3: regulator-s3
    • pm8841_s4: regulator-s4
    • pm8941_s1: regulator-s1
    • pm8941_s2: regulator-s2
    • pm8941_s3: regulator-s3
    • ...
    • pm8941_l1: regulator-l1
    • ...
    • pm8941_l24: regulator-l24
  • Then look in your devices android DTSi and look for any regulator configs if you find any change the corresponding regulator in the dts
  • This should be enough to boot with USB telnet

Display Driver

A display driver can be generated from the downstream devicetree using linux mdss dsi panel driver generator. See the instructions in the README of the project on how to do so.

Often times the generated display driver works without changes. If it does not work correctly you can try booting android with a modified kernel to compare the DSI commands with downstream.

Follow the instructions in Modifying the Android kernel for debugging and add this patch.

diff --git a/techpack/display/msm/dsi/dsi_panel.c b/techpack/display/msm/dsi/dsi_panel.c
index a45a2d8f5..6204cc97b 100644
--- a/techpack/display/msm/dsi/dsi_panel.c
+++ b/techpack/display/msm/dsi/dsi_panel.c
@@ -1008,6 +1008,13 @@ int dsi_panel_tx_cmd_set(struct dsi_panel *panel, enum dsi_cmd_set_type type)
 	cmds = mode->priv_info->cmd_sets[type].cmds;
 	count = mode->priv_info->cmd_sets[type].count;
 	state = mode->priv_info->cmd_sets[type].state;
+
+	printk("dsi_panel_tx_cmd_set: type: %d msgs: %d", type, count);
+	for (int j = 0; j < count; j++) {
+		struct mipi_dsi_msg msg = cmds[j].msg;
+		printk("dsi_panel_tx_cmd_set[%d]: channel: %d data: %*ph", j, msg.channel, msg.tx_len, msg.tx_buf);
+	}
+
 	SDE_EVT32(type, state, count);
 
 #ifdef OPLUS_BUG_STABILITY

Then after a reboot, you should see the DSI commands being sent whenever the display is toggled.

SoC-specific guides

There are detailed guides for some SoCs:

The mainlining procedures are quite similar, so you should be able to follow them to some extent even if you have a different SoC.

See also