Qualcomm Snapdragon 835 (MSM8998)

MSM8998 (or Snapdragon 835) is a high-end Qualcomm SoC released in 2017 with mainline support originally added for the MTP (proven reference design) board towards the end of 2018.

Booting
Assuming you derived your board DTS from the MSM8998 MTP ones, you'll likely notice a built kernel doesn't actually boot without any changes. This has been tracked down to CoreSight tracing activating, which seems to cause kernel panics on retail hardware. As per the linked patch, simply delete the added,  ,  ,  ,   &   nodes from your DTS.

Additionally enabling some options such as  may still cause the kernel to panic anyway. To avoid disabling "unused clocks" during, append   to your cmdline which can be done via modifying the bootimg, bootargs on DTS or setting CONFIG_CMDLINE in defconfig.

Display
Support for displays is currently marked as partial since mainline MSM8998 is completely missing device tree bindings for the MMCC, MDSS, MDP5 & DSI (as of 2020-11-16). However, unofficial patches for these are floating around and they seem to be fully working (as tested on the OnePlus 5 with a Samsung S6E3FA5 DSI cmd mode panel on Linux 5.10)!

For starters your best bet would be to setup  though which utilizes the device framebuffer left active by the UEFI bootloader (Qualcomm XBL).

1. Enable  in your defconfig

2. Apply a patch like this one to your board DTS while (as needed) replacing  with the screen width and   with the screen height (in pixels): --- a/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dtsi @@ -10,10 +10,36 @@ 	aliases { serial0 = &blsp2_uart1; serial1 = &blsp1_uart3; +		display0 = &framebuffer0; }; 	chosen { -		stdout-path = "serial0:115200n8"; +		#address-cells = <2>; +		#size-cells = <2>; +		ranges; + +		/* HACK: Use "display0" for simplefb; for UART console use "serial0:115200n8" instead */ +		stdout-path = "display0"; + +		/* +		 * Address and size extracted on-device using the following: +		 * # strings /dev/block/bootdevice/by-name/xbl | grep 'Display Reserved' +		 */ +		framebuffer0: framebuffer@9d400000 { +			compatible = "simple-framebuffer"; +			reg = <0 0x9d400000 0 0x2400000>; +			width = ; +			height = ; +			stride = <(1080 * 4)>; +			format = "a8r8g8b8"; +		}; +	}; + +	reserved-memory { +		cont_splash_mem: memory@9d400000 { +			reg = <0 0x9d400000 0 0x2400000>; +			no-map; +		}; 	};  	vph_pwr: vph-pwr-regulator {

USB
Enabling USB on MSM8998 boards will differ between devices which use a USB 3.0 and USB 2.0 port.

Needed modules on defconfig side should include the following (and even  can be dropped later if it turns out your device doesn't use this): CONFIG_USB_CONFIGFS=y CONFIG_PHY_QCOM_QMP=y CONFIG_PHY_QCOM_QUSB2=y

In general (and for USB 3.0 devices) the following in your DTS should be enough and you'll hopefully see the device detected on your host (assuming the kernel is configured with the needed modules):

&usb3_dwc3 { dr_mode = "peripheral"; /* Force to peripheral until we have Type-C hooked up */ };

For USB 2.0 devices utilizing the QUSB PHY however that alone isn't enough and you should remove the  node entirely from your DTS & add the following configuration: MSM8998 USB 2.0 configuration (DTS) &usb3 { /* Disable USB3 pipe_clk requirement */ qcom,select-utmi-as-pipe-clk; }; &usb3_dwc3 { /* Drop the unused USB 3 SuperSpeed PHY */ phys = <&qusb2phy>; phy-names = "usb2-phy"; /* We can only operate at USB 2.0 speeds */ maximum-speed = "high-speed"; };

In case you've adjusted the  regulator minimum value below   μV to match downstream and USB doesn't work with no (obvious) issues on device , try setting it back to to this higher 3.08V value to see if it helps; this was the case on the OnePlus 5 for example.

UFS internal storage
To enable the device's internal UFS 2.1 host controller (and 14nm UFS QMP PHY), compile the kernel with the following modules enabled: CONFIG_SCSI_UFS_QCOM=y CONFIG_PHY_QCOM_QMP=y

You can optionally set  for some additional speedup while booting. Consider also enabling  if you intend on writing data to a   partition formatted by Android where disk quotas are normally enabled by default for   volumes.

WLAN
For WLAN to work you need:

1. On the kernel side: 2. On the userspace side:
 * The MSS (modem) remoteproc needs to be running with firmware extracted from the device partitions
 * DTS needs to point to the firmware filenames under
 * Currently if you get FW details printed in dmesg from ath10k with nothing else seemingly happening, you'll most likely have to fake an MSA ready indication
 * Follow steps from jhugo's 5.5 MSM8998 Wi-Fi README (it's not perfect but should work)
 * Place all needed device firmware files to
 * Make sure your OEM  is in the same directory with   (or  )!
 * Install the following pmOS packages:,  ,   &
 * Enable the services for all of the above except   (it's started automatically if needed)
 * Run  from https://github.com/andersson/diag in case MSS remoteproc keeps crashing and networks can be seen in e.g.   soon after booting

iwd
By default iwd (on the OnePlus 5 at least) has an issue where it will refuse to connect, apparently related to. This can be worked around by adding the following to  (create the file if it doesn't exist).

"the EAPoL handshake is performed but we keep receiving packet 3/4 again and again on a 1 second interval. The replay key counter is never being increased so iwd just droped the packet and after a while the AP gives up"

The suggestion is either a wifi firmware bug, the driver not supporting nl80211 properly or an issue with the access point.

Bluetooth
Getting Bluetooth to work should be trivial assuming you compile the kernel with the following modules enabled: CONFIG_RFKILL=m CONFIG_BT_RFCOMM=y CONFIG_BT_BNEP=y CONFIG_BT_HIDP=y CONFIG_BT_HS=y CONFIG_BT_LE=y

After those are set and you've copied the needed kernel modules over to the rootfs in  you just need the following firmware files in  : crbtfw21.tlv crnv21.bin

Those can be supplied directly from  and they should work fine, but if not you'll need to grab the files from your device's firmware partitions.

Audio
OnePlus 5&5T has tfa9894 codec, so additional modules are needed. Add tfa98xx source code （Modyfied from https://github.com/J0SH1X/tfa98xx） 11 Download: https://stor.classfun.cn:4443/s/xPCE 5 Extract it and then copy the inc and src folder to linux/sound/soc/codecs

Modify Makefile and Kconfig： Modify Makefile： : snd-soc-tfa989x-objs := tfa989x.o +snd-soc-tfa98xx-objs += src/tfa98xx.o +snd-soc-tfa98xx-objs += src/tfa_container.o +snd-soc-tfa98xx-objs += src/tfa_dsp.o +snd-soc-tfa98xx-objs += src/tfa_init.o snd-soc-tlv320adc3xxx-objs := tlv320adc3xxx.o

obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o +obj-$(CONFIG_SND_SOC_TFA98XX) += snd-soc-tfa98xx.o obj-$(CONFIG_SND_SOC_TFA989X)  += snd-soc-tfa989x.o

Modify Kconfig: imply SND_SOC_TFA989X +imply SND_SOC_TFA98xx imply SND_SOC_TLV320ADC3XXX

add it in Kconfig: +config SND_SOC_TFA98XX +       tristate "NXP/Goodix TFA98XX (TFA1) amplifiers" +       depends on I2C +       select REGMAP_I2C +       help +         Enable support for NXP (now Goodix) TFA98XX (TFA1 family) speaker +         amplifiers, e.g. TFA98XX. +         Note that the driver currently bypasses the built-in "CoolFlux DSP" +         and does not support (hardware) volume control. +

GPS
GPS should "just work" when the modem is up. You should check whether the Position Determination Service (PDS) is running using : $ qrtr-lookup | grep PDS 16      2        0    0    83 Location service (~ PDS v2)

After this you can essentially install GPSD with the Qualcomm PDS patch, configure it to use  as the device during runtime and you should be good to go.

Real-time clock (RTC)
The RTC module found on the PM8998 PMIC block works with  enabled. It can be easily tested from userspace like so:
 * 1) cd /sys/class/rtc/rtc0/
 * 2) echo $((`cat since_epoch`+120)) > wakealarm

After running that and fully powering down the device it should power on by itself soon afterwards (2 minutes later to be exact).

Haptics
Haptics are supported, see Haptics for more details.

Who's working on it
(feel free to add yourself here if you're working on MSM8998 mainlining!)
 * User:Deathmist (@deathmist on Matrix)
 * User:R0551 (@r0551 on Matrix)
 * User:Degdag (@degdag on Matrix) [working on Xiaomi Mi 6]
 * User:kalube (@caleb on Matrix) [working on Pixel 2 XL]
 * User:learnchungchen
 * SoMainline [working on F(x)tec Pro1 & SoMC Yoshino]