# Sonim XP8 (XP8800)
The **Sonim XP8** is a rugged Android smartphone that works with gloves and when wet. It uses the
Qualcomm **Snapdragon 630 (SDM630)** platform. It has a screw-secured IP68/IP69K shell and a battery that you
can remove. The market rating of the battery is 4,900 mAh. It also has a full 1080p panel, USB-C, NFC, and a fingerprint reader. A small number of other rugged phones have all of these items together.
The phone has dedicated physical keys: **push-to-talk (PTT)**, **SOS**, and programmable buttons.
These keys make the XP8 a good field device for users who want to change the hardware or software.
This wiki is a **standalone hardware and firmware reference**. It collects facts about the SoC, PMIC,
display, touch, audio, and wireless parts of the XP8800. It also has facts about the cameras, sensors,
connectors, pin map, memory map, and partitions. The wiki also describes the boot chain, the
bootloader-unlock mechanism, and the condition of mainline Linux support. With this wiki, a new owner of an XP8 does not
have to find the low-level details again.
All facts come from public sources and from one personally owned retail AT&T unit (stock build
`8A.0.10-19-10.0.0-10.34.03`). This wiki does not include per-unit data. Per-unit data is the IMEI,
the radio calibration, and the device keys. If a fact depends on how the author got it, the page
gives a confidence label:
| Label | Meaning |
|---|---|
| **Unit** | Read from the phone itself. Examples are a chip ID register, a sysfs value, or a working test. |
| **Stock** | Named by the stock device tree, a stock config file, or a vendor driver or firmware string. It shows what the software was built for. It does not always show what is soldered on. |
| **Inferred** | Deduced from indirect evidence or general knowledge. Use it as a lead. Make sure that it is correct. |
> **WARNING:** Make a full backup before you unlock the bootloader or write a partition. Make sure that the backup is correct.
> These actions can permanently brick the phone. The bootloader-unlock mechanism in this wiki was
> validated on one unit. It can work differently on a different unit, or not work. See
> [NV partitions and backup](nv-partitions-and-backup.md) and [Bootloader unlock](bootloader-unlock.md).
> **WARNING:** Do not overwrite the `modemst1`, `modemst2`, `fsg`, `fsc`, or `persist` partition with
> data from a different unit. These partitions hold the IMEI, the radio calibration, and the per-unit keys.
> Reports say that you cannot recover the phone after you do this.
## Contents
- [Device overview](device-overview.md): model numbers, market specifications, rugged ratings, carriers, and the reference unit
- [Processor, PMICs, and memory](processor-and-memory.md): Snapdragon 630, PM660/PM660L, LPDDR4, eMMC, and firmware versions
- [Display](display.md): the JDI NT35696 1080×1920 command-mode DSI panel, timings, supplies, and DCS sequences
- [Touchscreen](touchscreen.md): Parade/Cypress TrueTouch Gen5 on I²C, its protocol, geometry, and power sequence
- [Buttons and keys](buttons-and-keys.md): all nine physical keys, their sources, polarities, and Linux key codes
- [Audio](audio.md): WCD934x codec, dual TFA9890 amplifiers, MI2S routing, and accessory audio
- [Wireless](wireless.md): WCN3990 Wi-Fi/Bluetooth, the SDR660 transceiver, and the modem/Wi-Fi dependency
- [Cameras](cameras.md): OV12A10 rear and OV8856 front sensors, MIPI CSI slots, actuators, and flash
- [Sensors](sensors.md): the ADSP-attached IMU, magnetometer, proximity/light, barometer, and hall sensors
- [NFC](nfc.md): the NXP NCI controller, its pins, power-up sequence, and secure-element line
- [Power and battery](power-and-battery.md): PM660 charger and fuel gauge, battery profile, USB-PD, haptics, and LEDs
- [Connectors and accessories](connectors.md): USB-C, the side SecureAudio port, the top SPI connector, and the rear XPand interface
- [Security](security.md): TrustZone-reserved pins, the Goodix fingerprint sensor, the secure element, and verified boot
- [Pin map](pin-map.md): TLMM, PM660, and PM660L GPIO assignments
- [Memory map](memory-map.md): the fixed DRAM reservations that the stock firmware expects
- [Partitions](partitions.md): the full eMMC GPT partition list and the Android boot-image layout
- [Boot chain](boot-chain.md): PBL → XBL → ABL → U-Boot → Linux, and how each stage is packaged
- [Bootloader unlock](bootloader-unlock.md): the `abl_a` + `frp` EDL unlock, why it works, and its risks
- [EDL and Firehose](edl.md): Qualcomm Emergency Download mode, the programmer, and read-only access
- [Fastboot](fastboot.md): the ABL fastboot command table, `getvar` variables, and slot behavior
- [NV partitions and backup](nv-partitions-and-backup.md): the partitions that hold the IMEI, calibration, and keys, and how to back them up
- [Stock firmware](stock-firmware.md): how to extract the stock device tree, kernel config, and firmware blobs
- [Mainline Linux](mainline-linux.md): upstream SDM630 support, driver status for each peripheral, and bring-up notes
- [Reverse-engineering notes](reverse-engineering-notes.md): the tools and methods behind these facts
- [References](references.md): datasheets, upstream projects, and public sources
## How the pages fit together
```mermaid
flowchart LR
subgraph HW["Hardware"]
DEV["Device overview"]
SOC["Processor and memory"]
PER["Display · Touch · Keys · Audio · Wireless · Cameras · Sensors · NFC · Power · Connectors"]
MAP["Pin map · Memory map"]
end
subgraph FW["Firmware and boot"]
PART["Partitions"]
BOOT["Boot chain"]
UNLOCK["Bootloader unlock"]
EDL["EDL and Firehose"]
FB["Fastboot"]
NV["NV partitions and backup"]
STOCK["Stock firmware"]
end
subgraph OS["Operating system"]
LIN["Mainline Linux"]
RE["Reverse-engineering notes"]
end
DEV --> SOC --> PER
SOC --> MAP
PART --> BOOT --> UNLOCK
EDL --> UNLOCK
FB --> BOOT
NV --> STOCK --> LIN
PER --> LIN
RE --> PER
```
The next diagram shows the major on-board parts of the XP8800 at system level.
```mermaid
flowchart TB
subgraph SoC["Qualcomm SDM630 SoC"]
CPU["8x ARM Cortex-A53"]
GPU["Adreno 508"]
MDSS["MDSS / DSI0 display"]
CAMSS["CAMSS / ISP"]
SLIM["SLIMbus"]
QUP["QUP: I2C · SPI · UART"]
DWC3["USB DWC3"]
ADSP["ADSP (Hexagon)"]
MSS["Modem (Hexagon)"]
end
PMIC["PM660 + PM660L"]
EMMC["Samsung eMMC 64 GB"]
SD["microSD"]
DSI["JDI NT35696 panel"]
TOUCH["Cypress TrueTouch Gen5"]
AMP["2x NXP TFA9890"]
WCN["WCN3990 Wi-Fi/BT"]
RF["SDR660 transceiver"]
NFC["NXP NCI + eSE"]
FP["Goodix fingerprint (TEE)"]
CAM["OV12A10 + OV8856"]
SENS["IMU · mag · light · baro (via ADSP)"]
CPU --- PMIC
CPU --> EMMC
CPU --> SD
MDSS --> DSI
QUP --> TOUCH
QUP --> AMP
QUP --> NFC
QUP --> FP
SLIM --- AMP
CAMSS --> CAM
DWC3 --> PMIC
ADSP --> SENS
MSS --> WCN
MSS --> RF
```
## Safety first
A correct full EDL dump in a second offline location is the only safe starting point.
1. Before you do a destructive task, make a full EDL dump.
2. Make sure that the dump is correct.
3. Copy the dump to a second offline location.
> **WARNING:** Do not write the `modemst1`, `modemst2`, `fsg`, `fsc`, or `persist` partition of
> a different unit. This can break the IMEI and the calibration data of the phone.
> **WARNING:** Do not flash `keymaster*`, `xbl*`, `tz*`, `rpm*`, `hyp*`, `pmic*`, `keystore`,
> `devcfg*`, `cmnlib*`, or `devinfo`. Reports say that this hard-bricks the phone.
> **CAUTION:** Keep `rmtfs` read-only when the modem DSP operates. Wi-Fi is not possible without the modem DSP.
> A read-only `rmtfs` cannot write to the live NV partitions.
## License
This repository has two licenses:
- **Code and utilities** are released under the **MIT license** (see the `LICENSE` file). They are
the scripts, the tools, and the documentation website in `web/`.
- **Documentation** is released under the **Creative Commons Attribution-ShareAlike 4.0
International license (CC BY-SA 4.0)**: .
The documentation is the Markdown pages in this repository, including this page. See the
`LICENSE-DOCS` file for the full legal text.
The hardware facts have no warranty.
---
# Audio
The audio path has a Qualcomm **WCD934x "Tavil"** codec on SLIMbus. It also has **two NXP TFA9890** Class-D speaker amplifiers on I²C and on a tertiary MI2S link.
The side **SecureAudio** connector and the rear **XPand** interface use the same path for remote speaker microphones and accessories.
## Codec: WCD934x
| Item | Value | Confidence |
|---|---|---|
| Part | Qualcomm WCD934x ("Tavil") | Stock |
| Bus | SLIMbus | Stock |
| Sound card name | `sdm660-tavil-snd-card` | Stock |
| Variant | Not known: WCD9340 or WCD9341 | None |
| Stock driver | Only `SND_SOC_WCD934X` is on. The internal `sdm660-snd-card` is off | Stock |
| Companion | `wcd-spi-v2` node on SPI. The WSA881x SoundWire amplifier nodes are reference-design leftovers | Stock |
The codec connects to the microphones, the headset, and the voice path.
Mainline has a `wcd934x` driver. The driver can operate only after the ADSP and SLIMbus operate. Its bring-up milestone is after the milestone for the speaker amplifiers.
## Speaker amplifiers: 2× TFA9890
| Item | Value | Confidence |
|---|---|---|
| Part | Two NXP TFA9890 (revision register `0x0080`) | Unit |
| Bus | I²C `c176000` (TLMM 6 / 7) | Unit |
| Addresses | `0x34` and `0x35` | Unit |
| Reset | TLMM 12, active high | Unit |
| Interrupt | TLMM 21 | Stock |
| Audio feed | Tertiary MI2S | Stock |
| Tuning file | `/vendor/firmware/tfa98xx.cnt`, patch `TFA9890_N1C3_2_1_1` | Stock |
| Mainline driver | `tfa989x` (`nxp,tfa9890`) | Unit |
Each chip sends the TFA9890 revision value `0x0080` on I²C when reset (TLMM 12) is low.
In mainline, a sound card that routes MultiMedia1 to the tertiary MI2S sends a tone to the two amplifiers. The tertiary MI2S pins are **LPI GPIO 4–7** (clock, word select, data 0, data 1). Playback data uses line 1.
The TFA9890 has an on-board DSP for speaker protection. Without the vendor tuning file, the output operates but is not calibrated for the XP8 enclosure.
## Signal path
```mermaid
flowchart LR
ADSP["ADSP audio"] --> SLIM["SLIMbus"]
SLIM --> CODEC["WCD934x Tavil codec"]
AP["Application processor"] -->|Tertiary MI2S
LPI GPIO 4-7| AMP["2x TFA9890
I2C c176000 @0x34/0x35"]
CODEC --> AMP
AMP --> SPK["Dual front speakers"]
BT["WCN3990 SLIMbus slave"] --> CODEC
SIDE["Side SecureAudio / XPand connector"] --> CODEC
```
## Accessory and Bluetooth audio
- **Bluetooth audio** uses the WCN3990 as a SLIMbus slave.
- **Accessory audio** defines `ptt-headphones` mixer paths in `mixer_paths_tavil.xml` for the side connector. The WSA881x nodes are reference-design leftovers.
- **Modem voice-call routing** (modem DSP → SLIMbus → WCD934x → speaker/mic) uses a different ALSA UCM configuration that is not simple. It is not part of basic audio bring-up.
## Related pages
- [Connectors and accessories](connectors.md)
- [Wireless](wireless.md)
- [Mainline Linux](mainline-linux.md)
---
# Boot chain
The XP8800 uses the standard Qualcomm SDM630 boot flow. The primary boot loader (PBL) in mask ROM starts the XBL/UEFI firmware. The XBL/UEFI firmware then starts the Android Boot Loader (ABL).
The **ABL is an AArch64 UEFI application**. It loads an Android `boot.img` or a UEFI payload that can start.
## Stages
```mermaid
flowchart TB
PBL["PBL (mask ROM)
Qualcomm primary boot loader"]
XBL["XBL / UEFI firmware
+ TZ, RPM, hyp, devcfg, pmic, cmnlib"]
ABL["abl_a — Android Boot Loader
AArch64 UEFI app (LinuxLoader.efi)"]
AVB{"Bootloader unlocked?"}
SKIP["Skip AVB boot verification"]
ENFORCE["Enforce verified boot / dm-verity"]
BOOTIMG["Android boot.img
gzip kernel + appended DTB"]
UBOOT["U-Boot (payload in boot.img)
simplefb, storage, USB, extlinux/EFI"]
LINUX["Linux arm64
+ sdm630-sonim-xp8.dtb + initramfs"]
PBL --> XBL --> ABL --> AVB
AVB -->|yes| SKIP
AVB -->|no| ENFORCE
SKIP --> BOOTIMG --> UBOOT --> LINUX
ENFORCE --> BOOTIMG
```
## ABL is UEFI, not a raw ELF
The `abl_a` partition on disk is an ELF32 ARM container. But the real boot loader in it is a **PE32+ EFI application for AArch64**. An **EFI Firmware Volume** with an LZMA payload holds it. The PE debug path shows where it comes from:
```
.../out/target/product/XP8812/obj/ABL_OBJ/Build/DEBUG_CLANG35/AARCH64/
QcomModulePkg/Application/LinuxLoader/LinuxLoader/DEBUG/LinuxLoader.dll
```
Consequences:
- The ABL is a UEFI `LinuxLoader`, and it reads an Android `boot.img`. It can also start UEFI payloads such as U-Boot.
- **There is no `dtbo` partition.** Put the device tree **directly after** the gzip-compressed kernel in the `boot.img`. Do not put it in its own partition.
- When the bootloader is unlocked, the ABL records *"Device is unlocked, Skipping boot verification"*. It then makes AVB less strict.
## Android boot-image format
| Field | Value |
|---|---|
| Header | Android boot header v0 |
| Page size | 4096 bytes |
| Kernel offset | `0x00008000` |
| Ramdisk offset | `0x01000000` |
| Tags offset | `0x00000100` |
| Kernel | gzip `Image.gz` (ARM64) |
| Appended | The DTB catalog. The last DTB is `dtb_101.dtb` for the board. |
Usually, you make a custom boot image for this device as follows:
```
u-boot-nodtb.bin.gz ++ sdm630-sonim-xp8.dtb → boot.img
```
Use an empty ramdisk, 4096-byte pages, and the kernel offset above. These values agree with the stock `boot.img` header.
## Installing a custom boot loader
During bring-up, a usual safe procedure is to chainload a custom boot loader in RAM first. Write it to `boot_a` only after it boots reliably.
`fastboot boot` of a small (~640 KiB) U-Boot image operates on this platform. Reports say that multi-megabyte TWRP images hang while the host sends them.
## Slot behaviour and recovery
- The active slot at the inspection was `_a`.
- A new slot starts with retry count **7**. After some boots that do not succeed, the bootloader marks the slot as unbootable and stops in fastboot. On an unlocked bootloader, `fastboot set_active a` recovers the phone.
- **Keep `abl_b` and `boot_b` stock.** The stock ABL on `_b` has no `flash` and no `set_active`. A change to `_b` can brick the phone.
- If `abl_a` is corrupt, or XBL does not accept it, **XBL does not use `abl_b`**. Write the stock `abl_a` again with EDL.
## Fastboot hygiene
Query **one variable in each command** (`getvar unlocked`, `getvar current-slot`).
WARNING: DO NOT RUN `getvar all`. IT CAN RETURN `unknown command` OR STOP THE USB ENDPOINT.
After a fastboot write, wait `(bytes / 15_000_000) + 5` seconds before the next command. The ABL sends its acknowledgment immediately. But it continues to write to the eMMC at 15 MB/s (approximately).
## Related pages
- [Bootloader unlock](bootloader-unlock.md)
- [Fastboot](fastboot.md)
- [EDL and Firehose](edl.md)
- [Partitions](partitions.md)
---
# Bootloader unlock
The stock Android 10 boot loader on the XP8800 has **no** `fastboot flashing` commands. It also does
**not** keep its lock state in the `devinfo` partition (`devinfo` is 4 KiB of zeros on stock). The
unlock method uses two items together: a **userdebug boot loader** and a flag byte in the `frp`
partition.
> **WARNING:** Make a verified full backup before you unlock the boot loader. The unlock wipes
> `userdata` and permanently changes the trust model of the device. If you write the incorrect partitions,
> the phone can hard-brick. Do this only on a device that you own. The behavior can change between
> builds. See [NV partitions and backup](nv-partitions-and-backup.md).
## Why the obvious path is blocked
| Blocker | Why it does not stop this method |
|---|---|
| Developer Options "OEM unlocking" is grey (`sys.oem_unlock_allowed=0`) | You do the unlock from EDL and fastboot, not from Android |
| Stock Android 10 ABL has no `fastboot flashing` commands | The AT&T **8.1 userdebug** ABL has them and also boots stock Android 10 |
| Carrier SIM lock or activation lock | This lock is in the encrypted modem NV. The **bootloader** lock is a different lock |
| Profile-owner or supervised account restrictions | These restrictions do not apply to the EDL and fastboot path |
## The two ingredients
1. **An ABL that can unlock.** The AT&T Android 8.1 userdebug `abl.elf` (110,592 bytes) has
`fastboot flashing get_unlock_ability` and `unlock`. It boots the stock Android 10 system. It has the
**same root certificate and `HW_ID` (`3007…`)** as stock. Its `SW_ID` image type is `0x1C` and its
anti-rollback version is `0`. Secure boot is expected to accept it.
2. **The `frp` unlock flag.** `fastboot flashing get_unlock_ability` reads the **last byte of the
`frp` partition** (offset **524287**). When you set this byte to `0x01`, the check passes.
## The mechanism
```mermaid
flowchart TB
EDL["EDL session"] --> W1["Write userdebug ABL into abl_a"]
EDL --> W2["Set frp byte 524287 = 0x01"]
W2 --> CK{"Magic 0x19901873
at frp bytes 32..36?"}
CK -->|yes| SUM["Recompute frp[0:32] = sha256(0x00*32 ++ frp[32:])"]
CK -->|no| READY
SUM --> READY["Reboot"]
W1 --> READY
READY --> FASTBOOT["fastboot flashing get_unlock_ability → 1"]
FASTBOOT --> UNLOCK["fastboot flashing unlock"]
UNLOCK --> WIPE["ABL writes recovery --wipe_data to misc,
wipes userdata, sets unlocked state"]
```
> **WARNING:** Make sure that you have a verified full backup before you do these steps. Steps 1, 3, and 5
> write partitions. Incorrect writes can hard-brick the phone. Step 8 wipes all user data.
1. In one EDL session, write the userdebug ABL into `abl_a`. Zero-pad the ABL to 1 MiB first.
> **WARNING:** Write only to `abl_a`. A write to a different partition can hard-brick the phone.
2. Read `abl_a` back to verify the write.
3. Set `frp[524287] = 0x01`.
> **WARNING:** Write only to `frp`. Do not write to `modemst1`, `modemst2`, `fsg`, `fsc`, or
> `persist`. These partitions hold per-unit data that you cannot recover.
4. If the big-endian magic `0x19901873` is at bytes `32..36` of `frp`, recompute the `frp` SHA-256
checksum over `0x00 × 32 || frp[32:]`.
5. Write the checksum to `frp[0:32]`.
6. Reboot the phone.
7. Make sure that `fastboot flashing get_unlock_ability` gives `1`.
8. Use `fastboot flashing unlock`.
> **WARNING:** Do not use this command if you did not make a backup. The command wipes `userdata`.
The ABL writes `recovery --wipe_data --reason=MasterClearConfirm --locale=en_US` to `misc`. Then it
does the `userdata` wipe.
9. Let the one-time stock recovery format finish.
10. Boot the phone cleanly one time. Then the active slot stays marked `successful`.
The procedure writes only `abl_a` and `frp`. **`abl_b` stays unchanged** as a stock fallback for the
boot loader.
## What the decompiled ABL shows
Static analysis of the userdebug ABL (an AArch64 UEFI `LinuxLoader`) confirms the mechanism:
| Function | Role |
|---|---|
| Unlock setter | Writes the persistent unlock flag (`param 0` = normal, `1` = critical). Emits the `recovery --wipe_data` command |
| Unlock gate | Allows a state change only if `param_2 == 0 (lock)` **or** `IsAllowUnlock != 0` |
| Fastboot init | Finds the partition named `frp`, reads it, and sets `IsAllowUnlock = frp[partitionsize-1] & 1` |
| State getters | `unlocked`, `unlock_critical`, and verity mode. `oem device-info` prints all of them |
| Boot verify | *"Device is unlocked, Skipping boot verification"*. Sets the verified-boot state |
Strings in the payload include *"By unlocking the bootloader…"*, *"Creating unlock keys detect event"*,
*"Device unlocked"*, and *"flashing get_unlock_ability"*.
## Risks and gotchas
- **Anti-rollback fuse.** The userdebug ABL has rollback version 0. A subsequent OTA can make the vendor
ARB fuse higher. Then secure boot rejects `abl_a` and the phone shows a black screen. XBL does not
use `abl_b` as a fallback. To recover, write stock `abl_a` back over EDL. You can get to EDL with the
keys from any software state, unless the early boot firmware or the hardware is damaged.
- **`userdata` wipe.** The unlock always wipes the user data.
- **Slot `_b` is a trap for custom images.** The stock `abl_b` has no `flash` or `set_active`.
- **Hard-brick profile.** Do not write `keymaster*`, `xbl*`, `tz*`, `rpm*`, `hyp*`, `pmic*`,
`keystore`, `devcfg*`, `cmnlib*`, or `devinfo`.
- **Carrier lock stays.** The unlock of the boot loader does not remove a carrier SIM lock. The
carrier SIM lock is in the encrypted modem NV.
## Re-locking
> **WARNING:** Do not re-lock the boot loader without a reviewed procedure for your device. An
> incompatible re-lock can prevent the phone from booting.
A re-lock is a high-risk task. Treat the re-lock as a different restoration procedure for one device only. The
procedure has these steps:
1. Make sure that the userdebug ABL stays in `abl_a`.
2. Use `fastboot flashing lock`.
3. Over EDL, write stock `abl_a` and `abl_b`, a `frp` of zeros, and a `misc` recovery-wipe request.
## Related pages
- [Boot chain](boot-chain.md)
- [EDL and Firehose](edl.md)
- [Fastboot](fastboot.md)
- [NV partitions and backup](nv-partitions-and-backup.md)
---
# Buttons and keys
The XP8800 has **nine physical keys**. Most are usual active-low GPIO keys. The PM660 PMIC (PON block) gives the power key and the volume-down key. A PM660L GPIO gives the volume-up key.
The dedicated **push-to-talk (PTT)** and **SOS** keys make the device useful as a field handheld.
## Key map
| Key | Source | Polarity | Linux code (name) |
|---|---|---|---|
| Power | PM660 PON `pwrkey` | — | `0x74` (`KEY_POWER`) |
| Volume down | PM660 PON `resin` | — | `0x72` (`KEY_VOLUMEDOWN`) |
| Volume up | PM660L GPIO 7 | Active low | `0x73` (`KEY_VOLUMEUP`) |
| Home | PM660 GPIO 11 | Active low | `0xac` (`KEY_HOME`) |
| App switch / Menu | TLMM 40 | Active low | `0x244` (`KEY_ALL_APPLICATIONS`) |
| Back | TLMM 64 | Active low | `0x9e` (`KEY_BACK`) |
| SOS | TLMM 75 | Active low | `0x94` (`KEY_PROG1`, decimal 148) |
| PTT | TLMM 76 | Active low | `0x95` (`KEY_PROG2`, decimal 149) |
| Camera / programmable | TLMM 113 | Active low | `0xd4` (`KEY_CAMERA`, stock uses `0x2fe`) |
All nine keys were verified in `evtest` on the reference unit. Each key gave one push and one release.
The stock camera code `0x2fe` is a vendor value. It maps to `KEY_CAMERA` (`0xd4`) in Linux.
> **The volume keys are the opposite of the volume keys on Sony SDM630 phones.** On the XP8, volume-up is a PM660L GPIO and volume-down is the PMIC `resin` input. Device trees that you copy from the Sony Xperia XA2 (`sony-pioneer`) have these two keys swapped.
## Key assignments
```mermaid
flowchart TB
subgraph PMIC["PM660 / PM660L"]
PWR["Power — PON pwrkey — KEY_POWER 0x74"]
VOLD["Volume down — PON resin — KEY_VOLUMEDOWN 0x72"]
VOLU["Volume up — PM660L GPIO 7 — KEY_VOLUMEUP 0x73"]
HOME["Home — PM660 GPIO 11 — KEY_HOME 0xac"]
end
subgraph TLMM["TLMM GPIO keys (active low)"]
MENU["App switch — TLMM 40 — KEY_ALL_APPLICATIONS 0x244"]
BACK["Back — TLMM 64 — KEY_BACK 0x9e"]
SOS["SOS — TLMM 75 — KEY_PROG1 0x94"]
PTT["PTT — TLMM 76 — KEY_PROG2 0x95"]
CAM["Camera — TLMM 113 — KEY_CAMERA 0xd4"]
end
```
## PTT and SOS meaning
At the hardware level, the two keys are plain GPIO keys. Software decides the meaning:
- **PTT** is a short-action control (hold to speak). A daemon usually reads `KEY_PROG2` and sends push and release events.
- **SOS** is usually a *guarded* action. For example, the user must hold the key for some seconds before the system arms and releases the task.
What SOS *does* (voice call, message, beacon) is a policy decision, not a hardware decision.
## Related pages
- [Pin map](pin-map.md)
- [Power and battery](power-and-battery.md)
- [Mainline Linux](mainline-linux.md)
---
# Cameras
The XP8800 has a 12 MP rear camera and an 8 MP front camera. The two cameras use OmniVision sensors.
All camera facts below are **Stock** (from `/vendor/etc/camera/camera_config.xml` and the sensor libraries in the image) except where a label shows a different confidence. Nobody has operated the sensors in mainline.
## Camera modules
| Item | Rear | Front |
|---|---|---|
| Sensor | OmniVision OV12A10 (12 MP) | OmniVision OV8856 (8 MP) |
| Module | Sunny, `GT24P64A` EEPROM | `ov_8856` EEPROM |
| Focus | `raa3015` autofocus actuator (vendor part not known) | Fixed |
| Flash | PM660L flash LEDs | None |
| MIPI CSI slot / CSID | Slot 0, CSID 0 | Slot 2, CSID 2 |
| Lanes | Four (`LaneMask 0x1F`, `LaneAssign 0x4320`) | The image has a 2-lane library and a 4-lane library. The lane count is open |
| Mount angle | 90° | 270° |
| Lens | 3.83 mm, f/2.2 | 2.56 mm, f/2.2 |
| Stock library | `libmmcamera_ov12a10.so`, `libactuator_raa3015.so`, `libmmcamera_sunny_gt24p64a_ov12a10_eeprom.so` | `libmmcamera_ov8856.so` |
## Signal path
```mermaid
flowchart LR
subgraph Sensors["Camera sensors"]
REAR["OV12A10 rear
Sunny GT24P64A EEPROM + raa3015 AF"]
FRONT["OV8856 front
ov_8856 EEPROM"]
end
REAR -->|Slot 0 / CSID 0, 4 lanes| CAMSS["SDM630 CAMSS / ISP"]
FRONT -->|Slot 2 / CSID 2| CAMSS
CAMSS --> AP["Application processor"]
FLASH["PM660L flash LEDs"] --> REAR
CCI["CCI bus"] --> REAR
CCI --> FRONT
```
## Laser range-finder leftover
The stock device tree contains an `st,stmvl53l0` laser-ranging node at CCI address `0x29`, with IRQ TLMM 45 and enable TLMM 42.
The **NFC firmware and VEN lines** use the same two pins. The stock kernel has no VL53L0 driver. The node is an **unpopulated reference-design leftover** (this is an assumption).
## Mainline status
| Sensor | Driver | Status |
|---|---|---|
| OV8856 (front) | `ov8856` (`ovti,ov8856`) | Driver exists. You must add camera interface nodes for SDM630 |
| OV12A10 (rear) | None in mainline | You must write a new sensor driver |
To bring up a camera through `camss`, you must also set up these items:
- the SoC camera subsystem
- the CCI bus
- the clock (the mainline driver expects 19.2 MHz, but stock used 24 MHz)
- the standby pin
- the analog rail
The link frequency, Bayer order, exposure and gain formats, and chip ID of the rear sensor are assumptions.
## Related pages
- [Mainline Linux](mainline-linux.md)
- [Pin map](pin-map.md)
---
# Connectors and accessories
The XP8800 has four external interfaces: a **USB-C** port, a threaded side **SecureAudio** port, a top **SPI** connector, and the rear **XPand** pogo-pin accessory interface.
We know only some details of the side protocol, the top protocol, and the push-to-talk (PTT) protocol.
## USB-C
| Item | Value | Confidence |
|---|---|---|
| Controller | DWC3 at `a800000` | Unit |
| PHY | QUSB2 high-speed PHY at `c012000` | Unit |
| DisplayPort orientation pin | TLMM 58 (`mdss_dp_usbplug_cc`) | Stock |
| Power Delivery | PM660 `qpnp-pdphy` | Stock |
| Vendor `sonim_cptt` | "SONIM USB-C PTT" kernel module. The protocol is not known | Stock |
USB networking (RNDIS/NCM) and SSH operate in mainline.
If you bind the USB gadget while a host is connected, the phone can reset (the **attached-bind reset**). Refer to [Mainline Linux](mainline-linux.md).
## Side connector (SecureAudio)
| Item | Value | Confidence |
|---|---|---|
| UART | `c170000` (BLSP1 UART2) | Stock |
| TX / RX | TLMM 4 / TLMM 5 | Stock |
| Power enable | TLMM 61 | Stock |
| Stock behavior | The software switches the pins between GPIO and UART states. It registers a PTT button and an "xpand port" through the codec driver | Stock |
| Stock symbols | `side_con_register_ptt_btn`, `side_con_register_xpand_port`, `tavil_side_con_parse_dt` | Stock |
The side port combines power, serial, GPIO, and audio for remote speaker microphones (RSMs) and wired PTT accessories. Nobody has mapped its **pinout and protocol**.
## Top connector
| Item | Value | Confidence |
|---|---|---|
| Bus | SPI8 at `c1b8000` | Stock |
| Pins | TLMM 28–31 | Stock |
| Speed | About 1 MHz | Stock |
| Kernel binding | `spidev` (`rohm,dh2228fv`) | Stock |
| Power enable | TLMM 74 (the stock `top_con_pwr_en` state connects SPI8 to this pin) | Stock |
The top connector is a `spidev` in stock. Its **purpose and pinout are not known**.
## Rear XPand interface
The XPand port is the proprietary pogo-pin backpack interface of Sonim on the back of the phone. The side **SecureAudio** port is the threaded accessory connector. The two ports have no public pinout.
The `xpand_port` and `ptt-headphones` mixer paths of the stock software are possible signs of the function of the ports. They possibly give power, serial/SPI/GPIO, and audio to accessories such as RSMs.
## Interface map
```mermaid
flowchart TB
subgraph Phone["XP8800"]
AP["SDM630 application processor"]
AP --> USBCTRL["DWC3 a800000 + QUSB2 c012000"]
AP --> SIDEC["UART c170000
TX TLMM4 · RX TLMM5 · pwr TLMM61"]
AP --> TOPC["SPI8 c1b8000
TLMM28-31 · pwr TLMM74"]
AP --> XPP["XPand port
power + serial + GPIO + audio"]
end
USBCTRL --> USBC["USB-C
data · PD · DP alt-mode · USB-C PTT"]
SIDEC --> SIDE["SecureAudio threaded port
RSM / wired PTT"]
TOPC --> TOP["Top SPI connector"]
XPP --> XP["Rear pogo-pin backpack"]
```
## Open items
- Pinout and protocol of the side connector, and the audio routing through the codec.
- Pinout and purpose of the top connector.
- Protocol of USB-C PTT (`sonim_cptt`).
- Electrical and mechanical interface of XPand.
## Related pages
- [Audio](audio.md)
- [Pin map](pin-map.md)
- [Mainline Linux](mainline-linux.md)
---
# Device overview
The Sonim XP8 is a rugged Android phone that Sonim announced in 2018. Sonim sold it mainly to first responders and field workers through AT&T, Verizon, and FirstNet. An unlocked variant also exists.
This page collects the market specifications. It also gives the identity of the reference unit that this wiki uses.
## Identity
| Field | Value | Confidence |
|---|---|---|
| Marketing name | Sonim XP8 | High |
| Model | `XP8800` | Unit |
| Board / product | `XP8812` | Unit |
| SoC | Qualcomm Snapdragon 630 (`SDM630`), 14 nm | Unit |
| Stock build (reference unit) | `8A.0.10-19-10.0.0-10.34.03` (AT&T) | Unit |
| Android version | 10 (SDK 29), security patch 2022-03-01 | Unit |
| First API level | 25 (shipped Android 7.1) | Unit |
| Build flavour | `X-ATT-T-01`, hardware revision `PVT` | Unit |
| FCC IDs | `WYPPG4032` and `WYPPC4000` | High |
The board device tree identifies the platform with `qcom,msid = <0x13e 0>` (318 = SDM630). It also uses `qcom,board-id = <8 0>` (MTP, "SDM 630 PM660 + PM660L MTP"). Android reports `ro.product.device=XP8812`.
## Market specifications
| Item | Value | Confidence |
|---|---|---|
| SoC | Snapdragon 630, 8× Cortex-A53 (2.2 GHz and 1.8 GHz clusters, from the spec sheets) | High |
| GPU | Adreno 508 | High |
| RAM | 4 GB class (3.7 GB available to Android) | High |
| Storage | 64 GB eMMC + microSDXC | High |
| Display | 5.0 in, 1080 × 1920 IPS LCD, with glove-touch and wet-touch operation | High |
| Battery | 4,900 mAh market rating, removable battery (`BAT-04900-01S`), Quick Charge 4 (18 W), bottom pogo pins | High |
| Rear camera | 12 MP (OmniVision OV12A10) | Stock |
| Front camera | Market listings show 2 MP or 8 MP. The stock software sets up an 8 MP OmniVision OV8856. | Stock |
| Wi-Fi / Bluetooth | Qualcomm WCN3990 | Stock |
| Cellular | Qualcomm SDR660 transceiver, LTE | Stock |
| NFC | NXP NCI 1.0 controller with a secure element | Unit |
| Fingerprint | Goodix capacitive sensor (TrustZone controls it) | Stock |
| Ruggedness | IP68 / IP69K, MIL-STD-810G, Class I Division 2 (non-incendive) | High |
| Expansion | Rear **XPand** pogo-pin accessory interface and side threaded **SecureAudio** port | High |
| Launch OS | Android 7.1, then an update to Android 10 | High |
The market rating of the battery is 4,900 mAh (part `BAT-04900-01S`). The stock software profile `2917401_sonim_xp8vk_4950mah` gives a nominal capacity of 4,950 mAh. See [Power and battery](power-and-battery.md).
The sources give different CPU clock figures. The SDM630 hardware supports per-core DVFS. But mainline has no working CPU frequency driver for the stock kernel. No test on the unit confirms the reported clocks.
## What makes the XP8 unusual
- **Dedicated PTT and SOS keys.** Two of the nine physical keys have the Linux codes `KEY_PROG2` (PTT) and `KEY_PROG1` (SOS). See [Buttons and keys](buttons-and-keys.md).
- **Three accessory connectors.** The first is a rear pogo-pin **XPand** interface. The second is a side **SecureAudio** port that combines UART, GPIO, power, and audio for remote speaker microphones. The third is a top SPI connector. Only some of the pinouts are known. See [Connectors and accessories](connectors.md).
- **No `recovery` partition and no `dtbo` partition.** The stock image uses A/B slots and system-as-root. A recovery tool that must have one of these partitions does not operate correctly. See [Partitions](partitions.md).
- **The stock kernel does not change.** Linux `4.4.205-perf+` was built on 2022-04-14. **No public GPL kernel source from Sonim exists, as far as this wiki knows.** For a modern kernel, use mainline Linux with a custom device tree. See [Mainline Linux](mainline-linux.md).
## Firmware and software state of the reference unit
| Item | Value |
|---|---|
| Kernel | `Linux 4.4.205-perf+ (jenkins@andbuild12)`, built 2022-04-14 |
| Baseband | `MPSS.AT.3.1.c16-00026-SDM660-ATT` |
| Boot firmware | `BOOT.XF.1.4-00286-S660LZB-7` |
| TrustZone | `TZ.BF.4.0.7-00219` |
| RPM | `RPM.BF.1.8-00067` |
| A/B slots | Active slot is `_a`. There are no dynamic (super) partitions. |
| Treble | `ro.treble.enabled=false`, `ro.vndk.lite=true` (non-Treble, and `vendor_a` is empty on stock) |
| Verified boot | Locked at the first inspection: `ro.boot.flash.locked=1`, verified-boot state green, dm-verity enforcing |
| OEM unlock toggle | Supported (`ro.oem_unlock_supported=1`), but the toggle is grey (`sys.oem_unlock_allowed=0`) |
## Related pages
- [Processor, PMICs, and memory](processor-and-memory.md)
- [Partitions](partitions.md)
- [Boot chain](boot-chain.md)
- [Mainline Linux](mainline-linux.md)
---
# Display
The XP8800 has a 5.0-inch, 1080 × 1920 IPS LCD. A four-lane MIPI DSI link in **command mode** operates the panel.
The panel is a Japan Display Inc. (JDI) module with an **NT35696** controller. It is the only panel that the stock software selects by default. The boot loader also contains entries for other reference panels.
## Panel summary
| Item | Value | Confidence |
|---|---|---|
| Manufacturer / controller | JDI / Novatek NT35696 | Stock |
| Resolution | 1080 × 1920, 24 bpp | Unit |
| Size | 5.0 in (stock gives a 61 × 110 mm active area) | Stock |
| Mode | DSI command mode, RGB888, four lanes, 60 Hz | Stock |
| Stock DT node | `qcom,mdss_dsi_nt35696_jdi_fhd_cmd` (DSI0 default) | Stock |
| Bootloader entry | `nt35696_jdi_1080p_cmd`, XML name `A432A-JD35696` | Stock |
| Physical panel proof | Not found on the glass. The boot loader also lists Truly NT35695b, HX8399, and RM67195 entries | — |
## Timings and signals
| Item | Value |
|---|---|
| Horizontal front / back / sync | 96 / 64 / 16 |
| Vertical front / back / sync | 4 / 16 / 1 |
| Reset pin | TLMM 53 (high → low → high, 12 ms each) |
| Tearing-effect (TE) pin | TLMM 59 |
| Backlight enable | TLMM 13 |
| Backlight block | PM660L WLED, strings 0–2 |
| I/O and analog supplies | PM660L LDOs |
| Bias rails | PM660L **LCDB** block at `0xec00`: `lcdb_ldo` and `lcdb_ncp`, 4.0–6.0 V |
The stock tree keeps the LAB/IBB bias block off. The panel bias comes from the **LCDB** block.
This is important for mainline bring-up because no upstream LCDB driver exists. A usual workaround is a fixed regulator. It uses the rails that the boot loader turned on.
## Signal path
```mermaid
flowchart LR
SoC["SDM630 MDSS + DSI0"] -->|4 lanes, RGB888| PANEL["JDI NT35696 panel"]
TLMM53["TLMM 53 reset"] --> PANEL
TLMM59["TLMM 59 tearing effect"] --> SoC
TLMM13["TLMM 13 backlight enable"] --> WLED["PM660L WLED"]
WLED --> BL["Panel backlight"]
LCDB["PM660L LCDB bias rails"] --> PANEL
```
## Stock DCS command sequences
This data comes from the stock JDI device-tree node. The first column is the DSI packet type in hex. The payloads include the command byte and the trailing zero of the stock table. Delays are in milliseconds.
**Display on (LP mode):**
| Type | Delay | Payload |
|---|---:|---|
| `39` | 0 | `35 00` |
| `39` | 0 | `36 00` |
| `39` | 0 | `3a 77` |
| `39` | 0 | `2a 00 00 04 37` |
| `39` | 0 | `2b 00 00 07 7f` |
| `39` | 0 | `44 07 08` |
| `39` | 120 | `11 00` |
| `39` | 0 | `2c 00` |
| `39` | 0 | `29 00` |
**Display off (HS mode):**
| Type | Delay | Payload |
|---|---:|---|
| `05` | 2 | `28 00` |
| `05` | 121 | `10 00` |
You can make a panel driver from these tables with the `linux-mdss-dsi-panel-driver-generator` tool (refer to [Reverse-engineering notes](reverse-engineering-notes.md)). The generated draft has the correct timings and reset sequence.
Before you use the draft, correct these items:
- `height_mm` (the stock property name is misspelled and gives 0)
- the zero arguments that the panel does not need
- the compatible string
- the supply and reset references
## Mainline status
There is **no dedicated upstream NT35696 panel driver**. You must write a panel driver (or make one with the generator tool and clean it up). Then connect it to the `drm/msm` DSI node.
When the panel operates natively, the display pipeline of the kernel replaces the simple framebuffer of the boot loader. Until then, `simpledrm` on the splash framebuffer of the boot loader is sufficient for console output.
### Known mainline pitfalls
- The display pipeline uses interconnect bandwidth, RPM power-domain levels, and multimedia SMMU clocks. If the kernel releases these at `sync_state` (usually about 10 s after boot), the panel goes dark. The `simple-framebuffer` node must hold them explicitly.
- Each blank cycle can cause a `wait_for_idle` timeout in the log from the command-mode encoder. The panel wakes correctly.
- TLMM 13 (the backlight enable line) possibly supplies the capacitive key backlights. They then come on when the panel comes on.
## Related pages
- [Touchscreen](touchscreen.md)
- [Power and battery](power-and-battery.md)
- [Mainline Linux](mainline-linux.md)
---
# EDL and Firehose
**EDL** (Emergency Download mode) is the low-level recovery protocol of the Qualcomm primary boot
loader. It is in the **mask ROM**. It shows a USB device ID of `05c6:9008`. It accepts a signed
**Firehose** programmer that can read and write the eMMC. EDL is in the boot ROM, so you can get to it
from almost any software state. EDL is the most powerful recovery tool and also the most
dangerous tool.
> **WARNING:** Use only read-only commands (`printgpt` and partition reads) until you have a verified
> backup. EDL can write every partition on the device. An incorrect write can brick the phone. Do not
> write NV partitions. See [NV partitions and backup](nv-partitions-and-backup.md).
## Entering EDL
| Method | Detail |
|---|---|
| Hardware keys | Turn the phone off. Hold **Volume+ and Volume−**. Then connect the USB cable. Do not push Power |
| `adb reboot edl` | Can work on some builds |
| Host check | `lsusb` shows `05c6:9008 Qualcomm, Inc.` |
On the reference unit, EDL entry was most reliable when both volume keys were held and the cable went
into a direct host port. EDL dropped out on a hub. The stock ABL does **not** support
`fastboot oem edl`.
## USB IDs
| Mode | Vendor:Product |
|---|---|
| Android (adb) | `18d1:4ee7` |
| Fastboot | `18d1:d00d` |
| EDL | `05c6:9008` |
The device uses generic Android USB IDs. It does not use the vendor ID of Sonim.
## Sahara and the Firehose programmer
EDL starts with the **Sahara** handshake. During the handshake, the host must supply a matching signed
**Firehose** programmer. The programmer is for one device and one platform.
| Item | Value |
|---|---|
| Programmer | `prog_emmc_ufs_firehose_Sdm660_ddr.elf` (also known as the Sonim peek loader) |
| SHA-256 | `d25b298ca36f467c3e30293e25492f08ea4831b4e98140313ff9ebca065c59b2` |
| Size | 631,232 bytes |
| Format | ELF64 ARM with an embedded aarch64 ELF at `0x87400` |
| Sahara HWID | `0x0AC0E1` = SDM630 (from the config tables of Qualcomm) |
On this platform, the SDM630 and SDM660 firehose builds are interchangeable. The loader above is the
same byte-for-byte file that is used for SDM660-family XP8 flashing. In some collections, its filename
starts with `0008c0e1`.
> **CAUTION:** Do not trust the programmer until its SHA-256 is the same as the value above. ClamAV can
> flag the programmer as `Heuristics.Broken.Executable`. This is expected for a Firehose blob and does
> not show malware.
## Tooling
The usual host tool is **[bkerler/edl](https://github.com/bkerler/edl)**. It operates Sahara and
Firehose. It can dump and flash partitions. These commands give a read-only start:
```sh
edl printgpt # list the GPT, no writes
edl r out.img
```
Keep the Python tooling in its own virtual environment. Do not use the system Python.
## EDL reachability and failure modes
- You can get to EDL with the keys from these states: power-off, Android, ABL, fastboot, or U-Boot.
- EDL is **not** always available if early boot-chain partitions (`xbl*`, `keymaster*`, `tz*`) or the
hardware are damaged.
- EDL reports the device state over USB. A bad cable or hub can cause dropouts during a data transfer. Use a
direct, known-good port.
## Typical uses
| Task | Command |
|---|---|
| Read the GPT | `edl printgpt` |
| Dump a partition | `edl r ` |
| Write a partition | `edl w ` (**destructive**) |
| Reset | `edl reset` |
> **WARNING:** Make a verified backup before you use `edl w`. The command overwrites the partition. Do
> not use it on `modemst1`, `modemst2`, `fsg`, `fsc`, or `persist`. These partitions hold per-unit data
> that you cannot recover.
## Related pages
- [Boot chain](boot-chain.md)
- [Bootloader unlock](bootloader-unlock.md)
- [NV partitions and backup](nv-partitions-and-backup.md)
- [Partitions](partitions.md)
---
# Fastboot
The **ABL** (Android Boot Loader) supplies fastboot. The stock Android 10 ABL has only basic flashing
and query commands. The **AT&T 8.1 userdebug ABL** adds the `flashing` subcommands that change the
lock state. This page describes the command set and the quirks seen on the XP8800.
## Command table
The ABL registers its commands from a fixed table. These are the commands that were seen:
| Command | Purpose |
|---|---|
| `flash:` | Write a partition |
| `erase:` | Erase a partition |
| `set_active` | Select the active A/B slot |
| `getvar:` | Read a variable |
| `download:` | Bulk-download a payload |
| `continue` | Continue the boot |
| `reboot-bootloader` | Reboot back to the boot loader |
| `flashing get_unlock_ability` | Print if unlock is permitted |
| `flashing unlock` | Unlock the boot loader |
| `flashing lock` | Lock the boot loader again |
| `flashing unlock_critical` | Unlock critical partitions |
| `flashing lock_critical` | Lock critical partitions again |
| `oem device-info` | Print the lock and verity state |
| `oem select-display-panel` | Select a boot splash panel |
| `oem enable-charger-screen` / `oem disable-charger-screen` | Charger UI |
| `oem off-mode-charge` | Charge while "off" |
> **WARNING:** Make a verified backup before you use `flash:`, `erase:`, or the `flashing` commands.
> These commands change partitions or the lock state. An incorrect partition can hard-brick the phone. Do
> not write `modemst1`, `modemst2`, `fsg`, `fsc`, or `persist`. See
> [NV partitions and backup](nv-partitions-and-backup.md).
The ABL also registers a **critical-partition list** (`devcfg frp cdt cmnlib cmnlib64 keymaster mdtp …`).
The `*_critical` commands operate on those partitions.
## Lock state
- `get_unlock_ability` reads the **last byte of the `frp` partition** (offset 524287). See
[Bootloader unlock](bootloader-unlock.md).
- The ABL variables hold `unlocked`, `unlock_critical`, and the verity state. `oem device-info` prints
them.
- The stock ABL does **not** have `get_unlock_ability`. It returns `unknown command`.
## A/B slots
| Item | Value |
|---|---|
| Active slot | `_a` at inspection |
| Retry count for a slot that was just written | 7 |
| Failed-boot behavior | The slot is marked unbootable. The phone stops in fastboot |
| Recovery on an unlocked boot loader | `fastboot set_active a` |
| `_b` caution | Stock `abl_b` has no `flash` or `set_active`. Do not switch to it with a custom image |
## Variables
Read one variable in each call. These are the common `getvar` values:
| Variable | Meaning |
|---|---|
| `unlocked` | `yes` / `no` |
| `current-slot` | `a` / `b` |
| `secure` | Secure boot flag |
| `product` | `sdm630` |
| `kernel` | `uefi` |
| `variant` | `SDM EMMC` |
| `max-download-size` | About 768 MB on this platform |
| `version-bootloader` | Can be blank on the Sonim ABL |
| `partition-size:` | Size of a partition |
> **WARNING:** Do not use `fastboot getvar all`. On this ABL, it can return `unknown command` or stop
> the USB endpoint. Query single variables.
## Write timing
After each `fastboot flash`, wait this number of seconds before the next command:
```
(bytes / 15_000_000) + 5 seconds
```
The ABL acknowledges the write immediately. It keeps writing to the eMMC at approximately 15 MB/s.
> **CAUTION:** Do not send the next command before the wait time ends. The ABL can continue to write to the
> eMMC.
## Example session
```sh
fastboot getvar unlocked
fastboot getvar current-slot
fastboot oem device-info
fastboot flashing get_unlock_ability
fastboot flashing unlock
```
> **WARNING:** Do not use `fastboot flashing unlock` if you did not make a verified backup. The command
> wipes `userdata`.
## Related pages
- [Boot chain](boot-chain.md)
- [Bootloader unlock](bootloader-unlock.md)
- [Partitions](partitions.md)
---
# Mainline Linux
The stock kernel (`4.4.205-perf+`, built 2022-04-14) cannot be rebuilt or
patched, and no public GPL kernel source has been found from Sonim. A modern
kernel therefore means **mainline Linux plus a custom XP8 device tree**
(`sdm630-sonim-xp8.dts`) built on the SDM630 upstream support.
## Upstream support (approximate)
The SDM630 family has broad upstream support via the SoMainline project and the
`sdm660-mainline` community, packaged by **Nura** (formerly postmarketOS) as
`linux-postmarketos-qcom-sdm660`. Rows marked *SoC level* mean the SoC block is
supported but the XP8 board still needs its own nodes.
| Subsystem | Status | Since |
|---|---|---|
| Clocks (GCC, RPM) | Upstream | 5.11+ |
| Pinctrl (TLMM) | Upstream | 5.11+ |
| Interconnects | Upstream | 5.11+ |
| UART / I²C / SPI | Upstream | 5.11+ |
| SPMI (PMIC bus) | Upstream | 5.11+ |
| Storage (eMMC / SDHCI) | Upstream | 5.11+ |
| CPUfreq / CPUidle / SMP | Upstream (SoC) | 5.11–5.15 |
| GPU (Adreno 508) | Upstream (SoC) | 5.14+ |
| USB (DWC3) | Upstream | 5.11+ |
| Remoteproc (modem, DSP) | Upstream | 5.11+ |
| Display (DPU via `drm/msm`) | Upstream (SoC) | 5.15+ |
| Camera (CAMSS) | Upstream (SoC) | 5.15+ |
| Audio (WCD934x, SLIMbus) | Upstream (SoC) | 5.11+ |
| Wi-Fi (WCN3990) | Upstream | 5.11+ |
| Bluetooth (WCN3990) | Upstream | 5.11+ |
Reference devices with similar hardware: **Sony Xperia XA2** (`sony-pioneer`,
the original SDM630 reference), **Xiaomi Redmi Note 7** (`lavender`, SDM660),
**Xiaomi Mi Pad 4** (`clover`, SDM660), and **Vsmart Active 1** (SDM660). Their
device trees are useful blueprints but **do not copy board details** — the XP8
differs in keys, GPIO reservations, panel, and connectors.
## Per-peripheral status
| Part | Mainline driver | XP8 status |
|---|---|---|
| Cypress/Parade Gen5 touch | `cyttsp5` | Works (multi-touch verified) |
| Two TFA9890 amplifiers | `tfa989x` | Works (tone played) |
| WCD934x codec | `wcd934x` | Driver exists; needs ADSP + SLIMbus |
| NFC | `nxp-nci` (I²C) | Powers up; no tag read |
| OV8856 front camera | `ov8856` | Driver exists; needs camera nodes |
| OV12A10 rear camera | none | New driver required |
| IMU / mag / pressure | `st_lsm6dsx` / `bmi160`, `ak8975`, `st_pressure` | Behind the ADSP (SSC) |
| STK3420 prox/light | `stk3310` lacks the ID | Needs an ID or out-of-tree driver; behind the ADSP |
| PM660 charger | `qcom_smbx` | Works |
| PM660 fuel gauge | not in mainline | Fork driver works |
| PM660 haptics | not in mainline | Fork driver runs; vibration unconfirmed |
| PM660L WLED / flash / RGB | `qcom-wled`, `leds-qcom-flash`, `leds-qcom-lpg` | Works |
| Panel | none dedicated | Local NT35696 driver works |
| WCN3990 | `ath10k_snoc`, `hci_qca` | Bluetooth up; Wi-Fi blocked by the aggre2 SMMU |
| aggre2 SMMU | `arm-smmu` | Hangs on probe; needs a skip-init-style change |
| Adreno 508 | `drm/msm` + Freedreno | Works (OpenGL ES 3.1; no Vulkan on Adreno 5xx) |
| Fingerprint | none | TEE-bound; out of scope |
## Bring-up order
A low-risk order that proves control early:
1. **Core I/O and keys** — storage (microSD boot, eMMC read-only), UART, and
the nine GPIO/PMIC keys.
2. **Display and input** — the DSI panel under `drm/msm`, then touch.
3. **GPU** — Adreno 508 with the signed `a508_zap` firmware.
4. **Power** — charger, fuel gauge, battery ID, suspend-to-idle.
5. **Wireless** — `qcom_q6v5_mss` + read-only `rmtfs` + `pd-mapper` +
`tqftpserv` + WCN3990 Wi-Fi/Bluetooth.
6. **Remaining peripherals** — audio, NFC, LEDs/flash, haptics, connectors,
cameras, sensors.
## XP8-specific quirks
- **TrustZone GPIOs.** The device tree must carry
`gpio-reserved-ranges = <0 4>, <8 4>`. Omitting `<0 4>` triggers an instant
SoC reset during pinctrl init.
- **microSD.** The slot has no card-detect line; use `non-removable;`.
- **Touch power.** PM660L L3 must be at 2.8 V before the controller answers.
- **Interconnect / power-domain / clock `sync_state` traps.** Around 10 s after
boot, the interconnect, RPM power-domain, and MMCC providers can drop the
display's bandwidth and power, blanking the panel. The `simple-framebuffer`
node must hold the `mdp0-mem` interconnect and the multimedia SMMU clocks, and
the RPM power-domain levels must be pinned (`required-opps`).
- **USB attached-bind reset.** Binding the USB gadget while a host is attached
resets the phone within ~0.3 s. Booting with the cable detached and binding
later works. Avoid re-binding the UDC with a host attached.
- **No CPU frequency scaling.** No SDM630 cpufreq driver in the baseline;
thermal passive trips cannot act, so guard sustained loads (critical shutdown
is 110 °C).
- **`rmtfs` read-only.** Any modem/WLAN bring-up must keep `rmtfs` read-only.
- **Debug output.** The stock/derived kernel may have `CONFIG_PANIC_TIMEOUT=-1`,
which reboots instantly on panic — pass `panic=0` and log to storage while
debugging.
- **Slot A boot counter.** After flashing `boot_a`, mark slot A successful
again, or the phone fails over to slot B.
## Graphics notes
- Adreno 508 needs the stock signed `a508_zap.*` firmware to leave TrustZone
secure mode.
- Mesa `freedreno` provides OpenGL 4.5 / OpenGL ES 3.2. Mesa **`turnip`
(Vulkan) does not support Adreno 5xx**, so UI toolkits must use GLES or
software rendering.
- Rust UI built for `aarch64-unknown-linux-musl` defaults to static linking,
which breaks `dlopen` of Mesa `libEGL`/`libgbm`/`freedreno_dri.so`. Build
dynamically (`-C target-feature=-crt-static`) or link natively.
## Related pages
- [Display](display.md) · [Touchscreen](touchscreen.md) · [Wireless](wireless.md)
- [Memory map](memory-map.md) · [Pin map](pin-map.md)
- [Reverse-engineering notes](reverse-engineering-notes.md)
---
# Memory map
The stock firmware needs a set of **fixed DRAM reservations**. These are for the firmware that operates on the modem, ADSP, WLAN, and video processors. One more reservation is for the framebuffer that the boot loader uses for the splash screen. A custom device tree must have the same reservations. If it does not, the applicable processor reads or writes incorrect memory.
## Fixed reservations
| Region | Address | Size | Purpose |
|---|---|---|---|
| WLAN guard | `0x85600000` | 1 MiB | Guard region around the WLAN MSA |
| WLAN MSA | `0x85700000` | 1 MiB | WLAN memory-sharing area |
| `rmtfs` | `0x85e00000` | 2 MiB | Shared memory for the `rmtfs` QMI service |
| Modem | `0x8ac00000` | 126 MiB | Modem Hexagon firmware/memory |
| ADSP | `0x92a00000` | 30 MiB | ADSP (audio/sensor) Hexagon memory |
| MBA | `0x94800000` | 2 MiB | Modem boot authenticator |
| Splash framebuffer | `0x9d400000` | `0x023ff000` (~36 MiB) | 1080p framebuffer that the boot loader sets up, `no-map` |
| Venus | Dynamic | 8 MiB | Video decoder pool |
All fixed reservations are between `0x85600000` and `0x9f800000`.
## DRAM banks
| Bank | Base | Size |
|---|---|---|
| 0 | `0x80000000` | 2 GiB |
| 1 | `0x100000000` | ~2 GiB (`0x7e4c0000`) |
High memory (bank 1) is usually where a boot loader puts the kernel, ramdisk, and device-tree buffers. For example, U-Boot on this class of device usually loads the kernel near `0x174a00000`. It loads the ramdisk near `0x16ca00000` and the FDT near `0x161000000`.
## GPU zap-shader region
The stock `a508_zap` loader node does **not** have a fixed memory region. The stock firmware gives it memory dynamically. A usual workaround is to reserve ~56 KiB for the zap shader. On the reference unit, `0xfe49c000` (56 KiB) is ordinary RAM. It is not in a fixed stock reservation. It is larger than the single 5,204-byte loadable segment of the zap image. TrustZone accepts the image in that region.
## Layout

```mermaid
flowchart TB
subgraph DRAM["Physical DRAM"]
direction TB
B0["Bank 0 @0x80000000 — 2 GiB"]
B1["Bank 1 @0x100000000 — ~2 GiB"]
end
subgraph FIXED["Fixed reservations (stock)"]
WLAN["0x85600000 WLAN guard 1 MiB"]
MSA["0x85700000 WLAN MSA 1 MiB"]
RMTFS["0x85e00000 rmtfs 2 MiB"]
MODEM["0x8ac00000 Modem 126 MiB"]
ADSP["0x92a00000 ADSP 30 MiB"]
MBA["0x94800000 MBA 2 MiB"]
SPLASH["0x9d400000 Splash framebuffer ~36 MiB"]
end
B0 --- FIXED
B1 -.->|boot loader buffers| BOOTBUF["kernel / ramdisk / FDT"]
B0 -.->|zap shader| ZAP["0xfe49c000 — 56 KiB (Sony-derived)"]
```
## Why this matters for porting
- The `rmtfs`, modem, ADSP, and MBA regions must be the same as the stock values. The Hypervisor and TrustZone firmware and the DSPs get these values from another source. If the values are incorrect, the firmware corrupts other memory.
- The boot loader gives the splash framebuffer to Linux. `simpledrm` can operate it for console output before the native display controller operates.
- The zap-shader reservation is necessary only when you start the Adreno GPU. Without it, the GPU cannot go out of TrustZone secure mode.
## Related pages
- [Wireless](wireless.md) · [Sensors](sensors.md) · [Display](display.md)
- [Boot chain](boot-chain.md)
---
# NFC
The XP8800 has an **NXP NCI 1.0** NFC controller on I²C. It has a dedicated secure-element (eSE) power line.
The controller operates with the standard NCI reset and init sequence. The mainline `nxp-nci` I²C driver is a realistic path. Nobody has read a tag. The clock-request line is not fully described.
## Controller summary
| Item | Value | Confidence |
|---|---|---|
| Controller | NXP NCI 1.0 controller | Unit |
| Manufacturer ID | `0x04` (NXP) | Unit |
| Hardware version | `0x51` (the Qualcomm driver possibly names it **NQ330**) | Unit |
| ROM version | `0x11` | Unit |
| Firmware version | 1.29 (`0x01`, `0x1d`) | Unit |
| Bus | I²C `c1b6000` (TLMM 22 / 23), address `0x28` | Unit |
| Mainline driver | `nxp-nci` (I²C), stock `qcom,nq-nci` | Stock |
| Stock stack | `libnfc-*-NQ3XX/NQ4XX.conf`, `vendor.nxp.hardware.nfc@1.2`, `eseservice` trusted app | Stock |
## Pins
| Signal | Pin |
|---|---|
| IRQ | TLMM 43 |
| Enable (VEN) | TLMM 42 |
| Firmware download | TLMM 45 |
| Secure-element power | TLMM 48 |
| Clock request | PM660 GPIO 4 |
## Power-up sequence
- Send a **low-then-high pulse on VEN (TLMM 42)** before the controller operates.
- Hold the firmware-download pin (TLMM 45) **low**.
- When the controller has no data, it does **not** send an ACK for plain reads. The IRQ line (TLMM 43) shows that data is available.
- In mainline `nxp-nci`, the controller starts through the kernel NFC interface (NCI reset and init).
## Signal path
```mermaid
flowchart LR
SoC["SDM630
I2C c1b6000"] <-->|SDA TLMM22 / SCL TLMM23| NFC["NXP NCI @0x28"]
IRQ["TLMM 43 IRQ"] --> SoC
VEN["TLMM 42 VEN (low→high pulse)"] --> NFC
FW["TLMM 45 firmware download (low)"] --> NFC
ESE["TLMM 48 eSE power"] --> NFC
CLK["PM660 GPIO 4 clock request"] --> SoC
```
## Secure element
The controller has an eSE power line (TLMM 48). The stock image contains an `eseservice` trusted app. The NFC subsystem is a route to a secure element on TrustZone. No code has used it.
## Regulatory note
The XP8800 has the FCC IDs `WYPPG4032` and `WYPPC4000`. The two IDs list a 13.56 MHz Part 15C transmitter. This agrees with NFC.
The schematics, the block diagram, and the bill of materials (BOM) are confidential.
## Related pages
- [Security](security.md)
- [Pin map](pin-map.md)
---
# NV partitions and backup
Five partitions hold **per-unit** identity and calibration data. You cannot make this data again from
a different phone, from a firmware package, or from the cloud. Reports say that an overwrite of these
partitions is effectively not recoverable. This is true especially with data from a different device. An
overwrite can permanently break the modem.
## The five protected partitions
| Partition | Contents |
|---|---|
| `modemst1` | Modem working copy: IMEI and network calibration |
| `modemst2` | Modem working copy (second store) |
| `fsg` | Factory "golden" copy of the radio data |
| `fsc` | Modem NV and factory data |
| `persist` | Wi-Fi/Bluetooth MAC addresses, sensor calibration, and device keys |
> **WARNING:** Do not write the `modemst1`, `modemst2`, `fsg`, `fsc`, or `persist` partition of
> a different unit. This can damage the IMEI and the calibration of the phone. A poster who did this reported that the
> phone stayed on a previous Android version with a patched baseband, band restrictions, and no OTA. The
> poster said there was "no way back".
## Why a backup is mandatory
- The unlock of the boot loader **wipes `userdata`**.
- If you are not careful, a flash of an OS over EDL can overwrite NV.
- Wi-Fi does not work again without `persist` after a reflash. `modemst*` and `fsg` hold the IMEI and the
calibration.
- A mainline or Linux bring-up can start the **modem DSP**. Wi-Fi is not possible without the modem DSP. The `rmtfs`
service of the modem DSP reads these partitions. If `rmtfs` is writable, it can corrupt them.
## Safe backup order
1. Document the plan. Make a list of the partitions that the dump does not include.
2. Do a full EDL partition dump. Use `printgpt`, then read each partition except the partitions on the list.
3. Write a `SHA256SUMS` manifest.
4. Make sure that the manifest is correct.
5. Copy the backup to a second, offline location.
6. Make sure that the copy is correct.
7. Only then, write to the device.
> **WARNING:** Do not write to the device before steps 1 to 6 are complete. A write without a verified
> backup can destroy per-unit data that you cannot recover.
A typical EDL dump does not include `userdata` (it is large and personal). It usually also does not include `system_b`,
`vendor_a`, and `vendor_b` (they are empty or redundant). The dump must include the NV set and the
stock firmware partitions that are necessary for a subsequent restore:
```text
modemst1 modemst2 fsg fsc persist
abl_a frp boot_a oem_a modem_a dsp_a bluetooth_a system_a
```
## rmtfs safety
On SDM630, `WCN3990` Wi-Fi runs its WLAN MAC on the **modem Hexagon**. `rmtfs` gives `modemst1`,
`modemst2`, and `fsg` to the modem Hexagon over QMI.
> **WARNING:** Always operate `rmtfs` as read-only. Use `-r` in each command. If `rmtfs` can write, it can
> corrupt the live NV partitions.
These are the read-only commands:
```sh
rmtfs -r -o /run/rmtfs-copy # isolated tmpfs copies, no -P
# or
rmtfs -r -P -s
```
- Always pass `-r`.
- Use `-o` with copies in RAM or tmpfs. Then the live eMMC partitions are not open for writing.
- During bring-up, do not start `rmtfs` without `-r`.
## Secondary backup (QCN)
Some builds have a diagnostic or QCN path for the modem NV. An example is a USB test mode with `QPST`
or QCP tooling. If this path is available, make this backup **before** an unlock or an EDL write. It is
a second copy that is separate from the EDL dump. It does not replace the EDL dump, and the EDL dump does not replace it.
## Restore caveats
- A backup does not prove that a **restoration** works. Practice on a device that you do not need, or
accept the risk.
- Do not use the NV images of a different unit.
- Keep the NV set offline and not shared. It has the IMEI and device keys.
## Related pages
- [EDL and Firehose](edl.md)
- [Bootloader unlock](bootloader-unlock.md)
- [Wireless](wireless.md)
- [Partitions](partitions.md)
---
# Partitions
The XP8800 has a **GUID Partition Table (GPT)** on the internal eMMC. It uses an A/B (dual-slot) scheme and has **no dynamic (super) partitions**. The stock image is system-as-root.
Many Android devices have the `recovery` and `dtbo` partitions. This platform does **not** have these two partitions. Recovery and custom boot images need a different procedure.
## Partition list
The GPT defines 69 named partitions and some unallocated space. Names that end in `_a` or `_b` are A/B slot pairs.
| Group | Partitions |
|---|---|
| Boot chain | `xbl_a/b`, `abl_a/b`, `tz_a/b`, `hyp_a/b`, `rpm_a/b`, `pmic_a/b`, `devcfg_a/b`, `keystore`, `devinfo` |
| Secure / DRM | `cmnlib_a/b`, `cmnlib64_a/b`, `keymaster_a/b`, `mdtp_a/b`, `mdtpsecapp_a/b`, `storsec`, `sec`, `msadp`, `apdp`, `dip`, `dpo`, `limits` |
| Boot / OS | `boot_a/b`, `system_a/b`, `vendor_a/b`, `oem_a/b`, `vbmeta_a/b`, `misc`, `userdata` |
| Peripherals | `modem_a/b`, `dsp_a/b`, `bluetooth_a/b`, `splash` |
| Radio NV / calibration | `modemst1`, `modemst2`, `fsg`, `fsc`, `persist` |
| Diagnostics / logs | `logdump`, `logfs`, `rawdump`, `ddr`, `ssd`, `sti`, `toolsfv`, `frp`, `reserve0`, `reserve3`, `reserve4`, `reserve5` |
> WARNING: DO NOT WRITE DATA FROM ANOTHER UNIT TO THE FIVE **RADIO NV AND CALIBRATION** PARTITIONS (`modemst1`, `modemst2`, `fsg`, `fsc`, `persist`). THE DATA IS DIFFERENT FOR EACH UNIT. See [NV partitions and backup](nv-partitions-and-backup.md).
## Approximate sizes
These sizes come from fastboot and from an inspection of the GPT:
| Partition | Size |
|---|---|
| `boot_a` | 64 MB |
| `system_a` | 4 GB |
| `vendor_a` | 1 GB (empty filesystem on stock, non-Treble) |
| `oem_a` | 512 MB |
| `userdata` | ~46 GB |
| `modem_a` | ~110 MB |
| `bluetooth_a` | ~1 MB |
The raw-program manifest gives the slot-A images in 512-byte sectors:
| Image | Start sector | Sectors |
|---|---:|---:|
| `boot_a` | 262144 | 131072 |
| `system_a` | 524288 | 8388608 |
| `oem_a` | 21495808 | 1048576 |
| `modem_a` | 23752704 | 225280 |
| `dsp_a` | 24203264 | 32768 |
| `bluetooth_a` | 24549104 | 2048 |
## Layout
```mermaid
flowchart TB
subgraph GPT["eMMC GPT (mmcblk1) — slot A / slot B"]
direction TB
XBL["xbl_a / xbl_b — boot loaders"]
ABL["abl_a / abl_b — Android bootloader (unlock target: abl_a)"]
TRUST["tz / hyp / rpm / pmic / devcfg / keymaster / cmnlib"]
BOOT["boot_a / boot_b — kernel + ramdisk + appended DTBs"]
SYS["system_a / system_b — 4 GB Android"]
VEN["vendor_a / vendor_b — empty on stock"]
OEM["oem_a / oem_b"]
PERIPH["modem_a/b · dsp_a/b · bluetooth_a/b"]
NV["modemst1 · modemst2 · fsg · fsc · persist — per-unit, never overwrite"]
MISC["misc · frp · devinfo · vbmeta_a/b"]
DATA["userdata — ~46 GB, wiped by unlock"]
end
XBL --> ABL --> BOOT --> SYS
```
## Android boot-image format
The stock `boot_a` is an **Android boot header v0** image:
| Field | Value |
|---|---|
| Header version | 0 |
| Page size | 4096 bytes |
| Base address | `0x00000000` |
| Kernel offset | `0x00008000` |
| Ramdisk offset | `0x01000000` |
| Tags offset | `0x00000100` |
| OS version | 10.0.0 |
| OS patch level | 2022-03 |
| Kernel | gzip-compressed ARM64 `Image.gz` |
| Appended data | 12 Qualcomm DTBs after the gzip stream |
The device tree of the XP8800 is the appended `dtb_101.dtb` (SHA-256 `1a2dced5ec5f26a89d6d46105807435ae2d75e9b94a81007ed3868af08fb2e1e`). There is **no `dtbo` partition**, so the DTB comes directly after the gzip-compressed kernel. It is not in its own partition.
## A/B slot behaviour
- The active slot at the reference inspection was `_a`.
- A new slot starts with a **retry count of 7**. After some boots that do not succeed, the bootloader marks that slot as unbootable and stops in fastboot.
- **Slot `_b` is not a safe fallback for custom images.** The stock `abl_b` has no `fastboot flash` or `set_active`. It also enforces verified boot. A change to `_b` can brick the phone.
- Keep `abl_b` and `boot_b` stock. Keep a recovery procedure that you know is good. See [Boot chain](boot-chain.md) and [Fastboot](fastboot.md).
- On an unlocked bootloader, `fastboot set_active a` usually recovers a phone that is stuck in fastboot.
## Related pages
- [Boot chain](boot-chain.md)
- [NV partitions and backup](nv-partitions-and-backup.md)
- [Stock firmware](stock-firmware.md)
---
# Pin map
This page lists the known GPIO assignments of the XP8800. Pins are **TLMM** pins (the Top-Level Mode Multiplexer or pinctrl of the SoC), unless the table shows a different type.
## TLMM pins
| Pin | Function |
|---|---|
| 0–3 | Fingerprint SPI (`BLSP1_QUP1`), TrustZone-locked |
| 4 | Side connector UART TX (`BLSP1_UART2`) |
| 5 | Side connector UART RX |
| 6 | I²C `c176000` (speaker amplifiers), data |
| 7 | I²C `c176000`, clock |
| 8–11 | TrustZone-locked (`BLSP1_QUP3`) |
| 12 | Speaker amplifier reset (active high) |
| 13 | Display backlight enable |
| 14 | I²C `c178000` (touch), data |
| 15 | I²C `c178000`, clock |
| 20 | Fingerprint reset |
| 21 | Speaker amplifier IRQ |
| 22 | I²C `c1b6000` (NFC), data |
| 23 | I²C `c1b6000`, clock |
| 28–31 | SPI8, top connector |
| 35 | Touch power enable |
| 40 | App switch / Menu key |
| 42 | NFC enable (VEN) |
| 43 | NFC IRQ |
| 45 | NFC firmware download |
| 48 | NFC secure-element power |
| 53 | Display panel reset |
| 58 | DisplayPort plug orientation (`mdss_dp_usbplug_cc`) |
| 59 | Display panel tearing effect (TE) |
| 61 | Side connector power enable |
| 64 | Back key |
| 66 | Touch reset |
| 67 | Touch IRQ (falling) |
| 72 | Fingerprint IRQ |
| 74 | Top connector power enable |
| 75 | SOS key |
| 76 | Push-to-talk (PTT) key |
| 113 | Camera / programmable key |
## PM660 GPIOs
| Pin | Function |
|---|---|
| PM660 GPIO 4 | NFC clock request |
| PM660 GPIO 11 | Home key |
## PM660L GPIOs
| Pin | Function |
|---|---|
| PM660L GPIO 7 | Volume-up key |
## Grouping by function
```mermaid
flowchart TB
subgraph I2C["I2C buses"]
I2CA["c176000 — TLMM 6/7 — TFA9890 amps @0x34/0x35"]
I2CB["c178000 — TLMM 14/15 — touch @0x24"]
I2CC["c1b6000 — TLMM 22/23 — NFC @0x28"]
end
subgraph SPI["SPI buses"]
SPIA["BLSP1_QUP1 — TLMM 0-3 — fingerprint (TEE)"]
SPIB["SPI8 — TLMM 28-31 — top connector"]
end
subgraph UART["UART"]
UARTA["BLSP1_UART2 — TLMM 4/5 — side connector"]
UARTB["c1af000 — WCN3990 Bluetooth HCI"]
end
subgraph KEYS["Key GPIOs"]
K["TLMM 40, 64, 75, 76, 113 · PM660 GPIO 11 · PM660L GPIO 7"]
end
subgraph TZ["TrustZone-locked"]
T["TLMM 0-3, 8-11"]
end
```
## Important device-tree constraints
- Include `gpio-reserved-ranges = <0 4>, <8 4>`. Then Linux does not touch the TrustZone-locked banks.
- Before the touch controller sends an ACK on I²C, **PM660L L3** must be at 2.8 V.
- The backlight-enable line (TLMM 13) possibly also supplies the capacitive key backlights.
## Related pages
- [Touchscreen](touchscreen.md) · [Display](display.md) · [Audio](audio.md) ·
[NFC](nfc.md) · [Connectors and accessories](connectors.md)
---
# Power and battery
The PM660 contains the charger, the fuel gauge, the PD PHY, and the haptics. The PM660L contains the LEDs, the flash, and the backlight.
The user can replace the battery pack. The market rating of the pack is 4,900 mAh (part BAT-04900-01S). The stock software profile `2917401_sonim_xp8vk_4950mah` gives 4,950 mAh.
The pack has an ID resistor. The phone uses the ID resistor to select the correct charging profile.
## Charger and fuel gauge
| Item | Value | Confidence |
|---|---|---|
| Charger | PM660 SMB2 (`qcom,qpnp-smb2`) | Stock |
| Fuel gauge | PM660 FG Gen3 | Stock |
| USB Power Delivery | PM660 `qpnp-pdphy` | Stock |
| Mainline charger driver | `qcom_smbx` (`qcom,pm660-charger`) | Unit |
| Mainline fuel-gauge driver | Not in mainline. A fork (`pmi8998_fg`-style) operates on the unit | Unit |
## Battery profile
| Item | Value |
|---|---|
| Market rating | 4,900 mAh (part BAT-04900-01S) |
| Profile name | `2917401_sonim_xp8vk_4950mah` |
| Nominal capacity | 4,950 mAh (stock software profile) |
| ID resistor | 100 kΩ (measured about 100 kΩ on two usable current sources) |
| Float voltage | 4.40 V |
| Maximum charge current | 2.4 A |
| Fast-charge current | 2.45 A (profile) |
| USB input limit | 2.0 A |
| DC input limit | 2.0 A |
| Cutoff | 3.35 V |
| Termination | 200 mA |
## Haptics
| Item | Value |
|---|---|
| Actuator | LRA on PM660 |
| Block | PMIC peripheral `0xc000` |
| Drive | 2.3 V maximum, 800 mA limit, 4,255 µs period (about 235 Hz), square wave |
| Mainline | No PM660 entry in `pm8xxx-vibrator`. A fork SPMI haptics driver operates on the unit |
Nobody has confirmed by feel that the LRA vibrates. The driver starts the effects and the PMIC shows a busy status.
## LEDs, flash, and backlight
| Function | PM660L block |
|---|---|
| RGB notification LED | `0xd000` |
| WLED backlight | `0xd800` |
| Flash and torch channels (×3) | `0xd300` |
**Verified on hardware:** torch channel 1 turns on the rear LED. The RGB LED maps as channel 1 = blue, 2 = green, 3 = red.
Nobody has tested channels 2–3 and the strobe. Upstream, `qcom-wled`, `leds-qcom-flash`, and `leds-qcom-lpg` control the RGB, WLED, and flash functions.
## Power tree
```mermaid
flowchart TB
USB["USB-C / pogo pins"] --> SMB2["PM660 SMB2 charger"]
DC["DC input"] --> SMB2
SMB2 --> BAT["4,950 mAh pack
100 kΩ ID"]
BAT --> FG["PM660 FG Gen3 fuel gauge"]
SMB2 --> RAILS["PM660 / PM660L regulators"]
RAILS --> SOC["SDM630"]
RAILS --> PERIPH["Display · touch · storage · wireless"]
PD["PM660 PD PHY"] --> SMB2
HAP["PM660 LRA haptics 0xc000"] -.->|vibrate| BAT
LED["PM660L RGB / WLED / flash"] -.->|indicators| SOC
```
## Verified behavior and open items
These results come from the reference unit:
- The charger and the fuel gauge register. Their values look correct.
- The battery ID reads about 100 kΩ. This agrees with the stock profile.
- Discharge test with a load: the battery goes from 100 % to 88 % in about 40 minutes at 0.78–0.80 A.
- Charging from a USB data port operates at the port limit. The input is about 474 mA and +350 mA goes into the battery, with the display off.
- Suspend-to-idle operates and wakes on an RTC alarm. The unit did **not** get to the deep SoC low-power states.
Open items:
1. Charge at full current from a wall charger and from the pogo pins.
2. **No CPU frequency scaling.** The mainline baseline has no SDM630 driver, so nothing can use the thermal passive trips that are below the 110 °C critical shutdown. Idle-injection cooling can replace throttling, but it does not give the power saving.
3. Deep sleep (find what keeps the SoC awake).
## Related pages
- [Processor, PMICs, and memory](processor-and-memory.md)
- [Connectors and accessories](connectors.md)
- [Pin map](pin-map.md)
---
# Processor, PMICs, and memory
The XP8800 uses a Qualcomm **SDM630** SoC. It has the **PM660** and **PM660L** power-management ICs and a standard Snapdragon 6-series memory and storage layout.
This page gives the silicon identities, the storage devices, and the firmware versions that the platform reports.
## SoC: Snapdragon 630
| Field | Value | Confidence |
|---|---|---|
| Part | Qualcomm SDM630 (Snapdragon 630), 14 nm | Unit |
| CPU | 8× ARM Cortex-A53, Armv8-A (AArch64), big.LITTLE clusters | High |
| GPU | Adreno 508 (`FD508` under Mesa `freedreno`) | Unit |
| `soc_id` | 318 (`0x13e`), revision 1.0, foundry ID 3 | Unit |
| Hardware platform | 8 (MTP), subtype 0 | Unit |
| Linux `machine` | Qualcomm Technologies, Inc. SDM 630 PM660 + PM660L MTP | Unit |
| Secure boot | Qualcomm PBL → XBL → ABL chain with signed images | High |
The SDM630 has the same device-tree family (`sdm630.dtsi`) as the related SDM636 and SDM660. Upstream supports much of the SoC. This includes clocks, pinctrl, interconnects, UART, I²C, SPI, SPMI, storage, USB, remoteproc, and GPU. See [Mainline Linux](mainline-linux.md) for the status of each block.
## Power-management ICs
| PMIC | Die revision | Role | Confidence |
|---|---|---|---|
| PM660 | 1.1 | Primary PMIC with PON (power and reset keys), RTC, ADC, SMB2 charger, FG fuel gauge, PD PHY, GPIOs, haptics, and regulators | Unit |
| PM660L | 2.0 | Companion PMIC with more LDOs, WLED backlight, RGB LED, flash and torch channels, LCDB panel-bias block, and GPIOs | Unit |
PM660 and PM660L are on the SPMI bus. The SPMI bus is the shared control bus for the PMICs. The PMICs supply power to the SoC, storage, display, touch, and most peripherals. The [Pin map](pin-map.md) and [Power and battery](power-and-battery.md) pages show their regulators and GPIOs.
## RAM
| Field | Value |
|---|---|
| Class | 4 GB (LPDDR4/LPDDR4X class) |
| Reported at boot | 4,166,400 kB |
| `MemTotal` | 3,691,992 kB |
| Vendor | Unknown. The FCC internal photos are the best source of information. |
The bootloader can see two physical DRAM banks. Bank 0 is at `0x80000000` (2 GiB). Bank 1 is at `0x100000000` (~2 GiB). The two banks are important for bootloaders that put buffers in high memory. See [Memory map](memory-map.md).
## eMMC
| Field | Value | Confidence |
|---|---|---|
| Controller | `sdhci@c0c4000` | Unit |
| Manufacturer CID | `0x15` (Samsung) | Unit |
| OEM CID | `0x0100` | Unit |
| Product name | `DH6DMB` | Unit |
| Capacity | 58.2 GiB (~64 GB class) | Unit |
| Date | 10/2017 | Unit |
| Interface | HS400 enhanced strobe | Unit |
| Health | Life-time estimates `0x01` and `0x01`, pre-EOL `0x01` (the best band) | Unit |
| Likely order code | Samsung `KLMCG2UCTA-B041` (no check against the package) | Inferred |
The eMMC has two boot areas (`mmcblk1boot0` and `mmcblk1boot1`) and a main user area (`mmcblk1`). A GPT divides the main user area into partitions. In a Linux boot, the eMMC is `mmcblk1`. In U-Boot, it is `mmc1`. See [Partitions](partitions.md).
## microSD
| Field | Value | Confidence |
|---|---|---|
| Controller | `sdhci@c084000`, UHS-I SDR104 | Unit |
| Card detect | **None**. The stock tree marks the slot `qcom,nonhotplug` under the bolted battery door. | Stock |
| Mainline fix | Use `non-removable;` in place of a card-detect GPIO | Unit |
There is no card-detect line, so a mainline device tree must mark the microSD slot as non-removable. The slot is then `mmcblk2` in Linux and `mmc2` in U-Boot.
## Boot firmware versions
| Firmware | Version |
|---|---|
| Boot | `BOOT.XF.1.4-00286-S660LZB-7` |
| TrustZone | `TZ.BF.4.0.7-00219` |
| RPM | `RPM.BF.1.8-00067` |
| Modem baseband | `MPSS.AT.3.1.c16-00026-SDM660-ATT` |
## Storage topology
```mermaid
flowchart LR
SoC["SDM630 SDHCI"]
SoC -->|c0c4000| EMMC["Samsung eMMC 64 GB
mmcblk1 · mmc1"]
SoC -->|c084000| SD["microSD
mmcblk2 · mmc2 (non-removable)"]
EMMC --> BOOT0["boot0 area"]
EMMC --> BOOT1["boot1 area"]
EMMC --> GPT["GPT + 69 partitions"]
```
## Notes for porting
- The LPDDR4 vendor is not known. If a board file or timing table is necessary, look at the FCC internal photos.
- The eMMC order code is an assumption. The marking on the package can make sure that it is correct.
- The microSD controller is one of the first storage devices that mainline probes. It is a good target for the first bring-up.
---
# References
This page lists the public sources, upstream projects, and tools that we used to make this wiki. The links are in groups by topic.
Examine each downloaded item before you use it.
## Device and platform
- GSMArena, Sonim XP8 specifications:
- Esper, Sonim XP8 device page:
- AT&T, XP8 software update support:
- Sonim, XP8 user guide (PDF):
- e/OS forum, XP8 custom-OS discussion:
## Regulatory
- FCC ID `WYPPG4032`:
- FCC ID `WYPPC4000`:
- FCC OET database (internal photos, RF exhibits):
## Qualcomm tools and protocol
- bkerler/edl, Qualcomm EDL/Sahara/Firehose tool:
- Aleph Security, Qualcomm EDL research:
## Mainline Linux for SDM630 / SDM660
- sdm660-mainline, Linux and U-Boot:
- SDM630 mainline patches (lore):
- Qualcomm mainline status:
- Nura (formerly postmarketOS):
- SDM660 kernel package:
- Sony Xperia XA2 (`sony-pioneer`) pmOS wiki:
- Rust-for-Linux: and
## XP8-specific community work
- ndoo/sonim-xp8-gsi, EDL backup/unlock scripts and Android GSI:
- XDA, Sonim XP8 (Root?) thread:
- rightiswrong/LineageOS-Sonim-XP8-8800, `SOURCE-PORT.md` (GPL request, CodeLinaro):
- HoldYouClose1988/genesisXP8, fastboot/TWRP findings:
- AndroidFileHost Sonim XP8 folder:
## Panel and driver tooling
- linux-mdss-dsi-panel-driver-generator:
## Android platform references
- Android boot image header format:
- A/B (seamless) system updates:
## Licenses cited
- MIT:
- Creative Commons Attribution-ShareAlike 4.0 International:
## Related pages
- [Reverse-engineering notes](reverse-engineering-notes.md)
- [Mainline Linux](mainline-linux.md)
---
# Reverse-engineering notes
Most of the facts in this wiki were derived without a public schematic. This
page records **how** they were obtained, so the work can be repeated, checked,
or extended. Nothing here requires exotic equipment beyond a host PC, a USB
cable, and the phone.
## Sources of truth, best first
1. **The stock device tree** — panel, GPIOs, regulators, memory reservations.
2. **The stock kernel configuration** (if IKCONFIG is embedded) — build choices.
3. **The stock userspace** — sensor/camera/audio config and libraries.
4. **On-device reads** — chip IDs over I²C/SPI, sysfs, `evtest`.
5. **Static analysis** — boot loader and firmware binaries.
6. **Web / FCC filings** — market specs, regulatory IDs, internal photos.
## 1. Extracting the stock device tree
`boot_a` is an Android boot image whose kernel is gzip-compressed and followed
by a DTB catalog. Decompress the kernel, carve the DTBs, and decompile the XP8
one:
```sh
dtc -I dtb -O dts dtb_101.dtb -o stock_xp8.dts
```
A fresh decompile should match the on-disk bytes. Record the DTB's SHA-256 so
later work is reproducible.
## 2. Recovering the kernel config
If the vendor built with IKCONFIG, the config is embedded in the kernel image
and can be recovered into a `.config`. It reveals which drivers the vendor
compiled in or out — useful for separating real hardware from reference-design
leftovers.
## 3. Extracting the vendor userspace
The system-as-root image is an ext filesystem. Extract it read-only, for
example with `debugfs`:
```sh
debugfs -R "rdump / /tmp/vendor-extract" system_a.img
```
Then read `/vendor/etc/camera/camera_config.xml`,
`/vendor/etc/sensors/sensor_def_sonim.conf`, `mixer_paths_tavil.xml`, and the
WLAN/NFC config files. Keep the extracted tree **private**.
## 4. Reading chip IDs on the unit
To read an I²C/SPI chip ID you need a boot that enables the bus and a small
probe program. On a mainline Linux boot:
- Build a **test device tree** that enables the target controllers
(`i2c@c176000`, `i2c@c178000`, `i2c@c1b6000`, …).
- Boot it as a **one-shot entry**, so a bad bus setting cannot brick the
default boot.
- Send only **standard query commands**, never configuration writes.
- Power the device under test first (for example PM660L L3 at 2.8 V for the
touch controller).
Results from this method on the XP8800: TFA9890 revision `0x0080`, the Cypress
HID descriptor and system information, and the NXP NCI hardware version `0x51`.
A read-only sysfs/procfs collector can capture SoC/PMIC IDs, storage CID,
regulators, GPIO state, and deferred probes without touching `/dev/mem` or
performing bus transfers. **Omit serial numbers** from anything you publish.
## 5. Static analysis of the boot loader
The ABL is more layered than its filename suggests:
| Layer | Detail |
|---|---|
| Outer file | ELF32 ARM container (`abl.elf`) |
| Payload | LZMA blob (e.g. at `0x3078`), ~80 KB compressed |
| Decompressed | **EFI Firmware Volume** (`_FVH`) |
| Inside | **PE32+ EFI application, AArch64** (`MZ`, three sections) |
To analyse it, carve the PE by signature and decompile with **Ghidra**
(`analyzeHeadless`). A small script can decompile every function to C. On the
reference ABL this yielded the complete fastboot command table and the unlock
logic (see [Bootloader unlock](bootloader-unlock.md)).
Cross-check with **radare2** if desired: r2 maps the PE at image base `0x10000`,
so `r2_vaddr = ghidra_addr + 0x10000`.
The **Firehose programmer** is ELF64 ARM with an embedded aarch64 ELF (e.g. at
`0x87400`); its integrity rests on its SHA-256.
> **Tooling caveat.** `floss` and `capa` are x86-only; the aarch64 impapi module
> is missing, so they cannot analyse these payloads. Use Ghidra or radare2 for
> ARM/ARM64.
## 6. Verifying downloaded artifacts
Treat every file from the network as untrusted until its **SHA-256** matches a
recorded value:
```sh
sha256sum FILE
```
Then, where appropriate:
- **ClamAV** for malware (a Firehose blob may trip `Heuristics.Broken.Executable`
— expected).
- **YARA** rulesets (e.g. Neo23x0 `signature-base`, YARA-Rules) for packers,
constants, and generic heuristics.
- **jadx / apktool** for APK analysis.
- **Ghidra** for native binaries.
Keep a **trust ledger** keyed on SHA-256 + size, with the source, date, method,
and verdict, so future work can skip re-analysis when the hash matches.
## 7. Analysing the stock Android apps
Two shipped apps carry DEX on the reference unit:
- **XP8Updater** — network code targets a project update URL; no `exec`,
`Runtime`, `ProcessBuilder`, or `DexClassLoader`.
- **XP8Buttons** — uses `ServiceManager.checkService` reflection to reach the
health HAL; no `exec`/`su`/network. Several exported activities/receivers are
needed for programmable-key broadcasts (a minor hardening note).
All five APKs were signed with the public **AOSP test keys**.
## 8. Reading protected registers safely
Some register blocks (for example the aggre2 SMMU) are partly protected by the
hypervisor or TrustZone. **Reading one bad register can hang the phone.** Read
**one register per boot**, from a RAM boot with a one-shot entry, so a hang
costs only a power press. On the aggre2 SMMU, offsets `0x00`, `0x04`, `0x20`,
`0x24`, `0x800`, `0xc00` read safely; `0x10` hangs the device.
## 9. Generating and fixing drivers
- **Panel:** `linux-mdss-dsi-panel-driver-generator` turns the stock DTB panel
node into a DRM panel driver. Always clean up the generated draft (see
[Stock firmware](stock-firmware.md)).
- **CPUfreq:** the SoC needs a CPRh/OSM driver plus fuse-derived OPP tables;
part of the data is in the stock tree, the rest is vendor source.
## 10. Where to look next
- **FCC internal photos** (exhibits under the FCC IDs) are the best remaining
source for chip markings: eMMC order code, LPDDR4 vendor, RF front end.
- **Datasheets** for parts whose identity is known (see [References](references.md)).
## Related pages
- [Stock firmware](stock-firmware.md)
- [Bootloader unlock](bootloader-unlock.md)
- [Mainline Linux](mainline-linux.md)
---
# Security
The security model of the XP8800 has three parts. These are Qualcomm Secure Boot and TrustZone, a fingerprint sensor that TrustZone controls, and an NFC secure element. TrustZone locks some GPIO banks. This is a hard limit for each custom device tree.
## TrustZone-reserved GPIO banks
| Pins | Owner | Consequence |
|---|---|---|
| TLMM 0–3 (`BLSP1_QUP1`) | TrustZone / TEE | Fingerprint SPI bus. Linux cannot use it. |
| TLMM 8–11 (`BLSP1_QUP3`) | TrustZone / TEE | Linux cannot use it. |
A device tree **must** have `gpio-reserved-ranges = <0 4>, <8 4>`. If you do not include `<0 4>`, the pinctrl driver reads a TrustZone-locked register during `msm_pinctrl_init`. This causes an **SoC reset** immediately after boot.
```mermaid
flowchart LR
subgraph TZ["TrustZone (secure world)"]
TEE["QSEE / TEE"]
FP["Goodix fingerprint"]
ESE["NFC secure element"]
end
subgraph HLOS["Linux / Android (non-secure)"]
AP["Application processor"]
end
AP -.->|TLMM 0-3, 8-11 locked| TZ
FP -->|SPI BLSP1 QUP1, TEE-owned| TZ
ESE -->|eSE power TLMM 48| TZ
AP -->|NFC NCI| NFC["NXP NCI controller"]
NFC --> ESE
```
## Fingerprint sensor
| Item | Value | Confidence |
|---|---|---|
| Part | Goodix capacitive sensor, "Milan" family | Stock |
| Bus | SPI on BLSP1 QUP1 (TLMM 0–3), TrustZone-owned | Stock |
| Reset | TLMM 20 | Stock |
| IRQ | TLMM 72 | Stock |
| Supply | PM660L L3 | Stock |
| Stock stack | `CONFIG_GOODIX_FINGERPRINT`, `gx_fpd`, `gxfingerprint.default.so`, `goodixfp` trusted app | Stock |
| Mainline | No path. The TEE holds the sensor. | — |
TrustZone owns the bus, and the `goodixfp` trusted application operates it. Mainline has no path to the sensor. Carrier documentation describes fingerprint enrolment on the XP8. This agrees with the enabled device tree node.
## Secure element
The NFC controller has an eSE power line (TLMM 48). The stock image has an `eseservice` trusted app. This secure element is TrustZone-backed. The NFC subsystem gives access to it.
## Verified boot and bootloader lock
| Item | Value |
|---|---|
| Lock state storage | **Not** in `devinfo`. On a stock Android 10 build, `devinfo` is 4 KiB of zeros. |
| Verified-boot state | `green` when locked, dm-verity enforcing |
| OEM unlock gate | The last byte of the `frp` partition (offset 524287) |
| Unlock command | Only the AT&T 8.1 **userdebug** ABL has the command. The stock Android 10 ABL does not have it. |
An unlock of the bootloader changes the verified-boot threat model.
WARNING: DO NOT LOCK THE BOOTLOADER AGAIN WITHOUT A REVIEWED, TESTED PROCEDURE FOR THIS DEVICE. THE PHONE CAN BECOME UNBOOTABLE. See [Bootloader unlock](bootloader-unlock.md).
## Hard-brick profile
A write to one of `keymaster*`, `xbl*`, `tz*`, `rpm*`, `hyp*`, `pmic*`, `keystore`, `devcfg*`, `cmnlib*`, or `devinfo` is the reported hard-brick profile. A legitimate unlock changes only `abl_a` and `frp`.
## Related pages
- [NFC](nfc.md)
- [Bootloader unlock](bootloader-unlock.md)
- [Pin map](pin-map.md)
---
# Sensors
The movement, environmental, and proximity sensors are **not** on the I²C/SPI buses of the application processor. They are on the **ADSP sensor core (SSC)**.
A Linux IIO driver on the application processor cannot connect to them, unless you move those buses to the application processor.
The sensor identities come from `/vendor/etc/sensors/sensor_def_sonim.conf` and from the driver UUIDs in the ADSP image (**Stock**).
## Sensor inventory
| Sensor | Part | Bus | Interrupt | Confidence |
|---|---|---|---|---|
| Accelerometer + gyroscope (IMU) | ST LSM6DS3 **or** Bosch BMI160 (config file names the two) | SSC SPI, CS 0 | SSC GPIO 68 | Stock |
| Magnetometer | AKM AK09915 | SSC SPI, CS 1 | SSC GPIO 70 | Stock |
| Proximity + ambient light | Sensortek STK3420 | SSC I²C bus 3, `0x58`, 2.8 V | SSC GPIO 71 | Stock |
| Barometer | ST LPS22HB | SSC I²C bus 3, `0x5C` | SSC GPIO 73 | Stock |
| Hall switch | Generic hall-effect | SSC GPIO (`hall_int_n`) | — | Stock |
It is not known which IMU the unit has (LSM6DS3 or BMI160). The config comment names the two IMUs. The ADSP image contains the strings `lsm6ds3`, `lsm6dsm`, and `bmi160`.
A read of `WHO_AM_I` during bring-up shows which IMU the unit has.
## Stock axis map
| Sensor | X | Y | Z |
|---|---|---|---|
| Accelerometer | +1 | +2 | +3 |
| Gyroscope | +1 | +2 | +3 |
| Magnetometer | −1 | −2 | +3 |
## Architecture
```mermaid
flowchart TB
subgraph SSC["ADSP sensor core (SSC)"]
IMU["IMU — LSM6DS3/BMI160
SPI CS0 — GPIO 68"]
MAG["AK09915 magnetometer
SPI CS1 — GPIO 70"]
LIGHT["STK3420 prox/light
I2C3 @0x58 — GPIO 71"]
BARO["LPS22HB barometer
I2C3 @0x5C — GPIO 73"]
HALL["Hall switch — hall_int_n"]
end
SSC -->|Hexagon RPC| ADSP["ADSP"]
ADSP --> AP["Application processor"]
```
## Reaching the sensors from Linux
The parts are behind the ADSP, so a mainline stack needs a userspace bridge, and a plain IIO driver is not sufficient. The usual method on SDM660-class devices uses:
- `hexagonrpcd` (ADSP RPC daemon)
- `libssc` (sensor core client library)
- `iio-sensor-proxy` (gives the sensors to the desktop and the UI)
- the sensor registry files from the stock firmware
These are distribution packages, not upstream kernel drivers. They operate only when the ADSP operates.
## Related pages
- [Mainline Linux](mainline-linux.md)
- [Memory map](memory-map.md) (ADSP reservation)
---
# Stock firmware
No public GPL kernel source exists for the XP8800, so the **stock firmware is the primary reference** for facts about the hardware. A full EDL dump has all the necessary data. With it, you can extract the device tree, the kernel configuration, the vendor userspace, and the proprietary firmware blobs.
> WARNING: KEEP THE EXTRACTED VENDOR TREE AND FIRMWARE BLOBS **PRIVATE**. THEY CONTAIN DATA FOR EACH UNIT AND SONIM-PROPRIETARY CODE THAT HAS NO REDISTRIBUTION LICENSE.
## What to extract
| Source partition | What it yields |
|---|---|
| `boot_a` | Stock Android boot header, gzip kernel, and appended DTB catalog (the XP8 tree is `dtb_101.dtb`) |
| `system_a` | The Android system-as-root image, which includes `/system/vendor/firmware` (for example `a508_zap.*`) |
| `oem_a` | On stock, only the root listing (`lost+found`) |
| `modem_a` | FAT16: `mba.mbn`, `modem.mdt` + segments, `wlanmdsp.mbn`, 26 `bdwlan.*` candidates, ADSP and Venus headers/segments |
| `dsp_a` | ext4 ADSP runtime modules |
| `bluetooth_a` | FAT16: `crbtfw21.tlv`, `crnv21.bin` |
| `modemst1/2`, `fsg`, `fsc`, `persist` | **NV data for each unit. Make a backup. Do not share or change it.** |
## Extracting the device tree
1. Decompress the kernel from `boot_a`.
2. Read the stream after the gzip kernel to find the **DTB catalog** (12 DTBs on this platform).
3. Find the XP8800 tree (`dtb_101.dtb`, SHA-256 `1a2dced5ec5f26a89d6d46105807435ae2d75e9b94a81007ed3868af08fb2e1e`).
4. Decompile the tree:
```sh
dtc -I dtb -O dts dtb_101.dtb -o stock_xp8.dts
```
The decompiled tree is the source of truth for these items:
- Panel timings and DCS sequences
- Touch pins
- Key GPIOs
- Regulator topology
- Memory reservations
- Legacy pin-muxing names
## Recovering the kernel configuration
If the stock kernel has **IKCONFIG** (`CONFIG_IKCONFIG` and `CONFIG_IKCONFIG_PROC`), the configuration is in the kernel. On the reference kernel, the configuration came from the decompressed image. It shows the options that the vendor selected, for example:
| Option | Meaning |
|---|---|
| `CONFIG_FB_MSM` | Legacy MSM framebuffer |
| `CONFIG_KEYBOARD_GPIO` | GPIO keys |
| `CONFIG_MMC_SDHCI_MSM` | Qualcomm SDHCI storage |
| `CONFIG_USB_DWC3` | USB device controller |
| `CONFIG_ICNSS` | Integrated connectivity (WLAN/BT) |
| `CONFIG_MSM_PIL` | Peripheral image loader (remoteproc) |
| `CONFIG_BPF_SYSCALL` (disabled) | No eBPF. The vendor selected this option. |
## Extracting the vendor userspace
The system-as-root image has an ext filesystem. It contains the vendor files, which include `/vendor/etc/camera/camera_config.xml`, `/vendor/etc/sensors/sensor_def_sonim.conf`, mixer paths, and the sensor and WLAN libraries. Extract it as read-only, for example with `debugfs rdump`. Keep the result private.
## Generating a panel driver
**[linux-mdss-dsi-panel-driver-generator](https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator)** can change the panel node of the stock DTB into a Linux DRM panel driver:
```sh
linux-mdss-dsi-panel-driver-generator dtb_101.dtb -r vddio -r lab -r ibb
```
The generated driver has the same timings, reset sequence, and DCS command tables as the stock tree. But it is a **draft**. Correct these items in it:
- `height_mm` (the stock property name has a spelling error and gives 0)
- The zero arguments that the panel does not need on sleep-out and display-on
- The compatible string
- The supply and reset-GPIO references
## Staging the Linux firmware blobs
You can put the proprietary blobs in a filesystem layout that the mainline drivers use, for example:
| Component | Candidate path |
|---|---|
| Adreno 508 | `lib/firmware/qcom/a508_zap.mdt` + `.b00`–`.b02` |
| Modem | `lib/firmware/qcom/sdm630/Sonim/xp8/{mba.mbn,modem.mdt,modem.b*}` |
| ADSP | `lib/firmware/qcom/sdm630/Sonim/xp8/{adsp.mdt,adsp.b00`–`b21}` |
| Bluetooth | `lib/firmware/qca/{crbtfw21.tlv,crnv21.bin}` |
| Venus | `lib/firmware/qcom/venus-4.4/{venus.mdt,venus.b00`–`b04}` |
| WLAN DSP | `lib/firmware/qcom/sdm630/Sonim/xp8/wlanmdsp.mbn` |
| Wi-Fi board data | One of the 26 `bdwlan.*` candidates (no selection made) |
The project selected the Sonim directory name. The `firmware-name` properties must use the same name. Compare each MDT with the sizes of its segments.
## Blob verification
Before you use a blob or tool from the network, compare its **SHA-256** with a recorded manifest. Keep a trust ledger. In it, write what you checked, how you checked it, and when. See [Reverse-engineering notes](reverse-engineering-notes.md).
## Related pages
- [Partitions](partitions.md)
- [Display](display.md)
- [Mainline Linux](mainline-linux.md)
- [Reverse-engineering notes](reverse-engineering-notes.md)
---
# Touchscreen
The XP8800 uses a **Parade / Cypress TrueTouch Gen5** capacitive controller. It uses the HID-over-I²C protocol. The mainline Linux driver `cyttsp5` (`compatible = "cypress,tt21000"`) operates with this protocol.
The controller can operate without custom software, if you follow the power sequence.
## Controller summary
| Item | Value | Confidence |
|---|---|---|
| Controller | Parade/Cypress TrueTouch Gen5 | Unit |
| HID vendor / product | `0x04b4` / `0xc101` | Unit |
| Silicon ID words | `0x1591`, `0x0250` (no Parade part number found) | Unit |
| Firmware | PIP 1.2, firmware 2.0, revision control 800007, config `0x0022`, bootloader 2.0 | Unit |
| Stock driver | `TTDA.03.07.844339`, firmware file `cyttsp5_fw.bin` | Stock |
| Bus | I²C `c178000`, address `0x24` | Unit |
| Geometry | 13 × 23 electrodes, 62.89 × 111.02 mm, panel ID 1 | Unit |
| Reported resolution | 1080 × 1920, 32 slots | Unit |
| Extra inputs | The stock driver also has button and proximity inputs | Stock |
## Pins and power
| Signal | Pin | Notes |
|---|---|---|
| SDA / SCL | TLMM 14 / 15 | I²C `c178000` |
| Interrupt (attention) | TLMM 67 | Falling edge |
| Reset | TLMM 66 | Active low |
| Power enable | TLMM 35 | |
| `vdd` | PM660L L3 at 2.8 V | Stock requests 2.8 V, 500 mA maximum |
| `vddio` / `vddi2c` | PM660 L11 at 1.8 V | I²C I/O rail |
**Power-sequence requirement:** the controller does **not** send an ACK on I²C until **PM660L L3 is on**.
When L3 is at 2.8 V, power-enable is high, and reset is high, the controller sends a correct HID descriptor and system information. This is the most important item for bring-up.
## Protocol
The mainline driver `cyttsp5` uses the same HID framing as the unit:
| Item | Value |
|---|---|
| Packet ID | `0xf7` |
| Input register | `0x0003` |
| Output register | `0x0004` |
| HID descriptor register | `0x01` |
The stock device tree sets the HID descriptor register to `0x01`. The stock kernel contains the symbols `cyttsp5_get_hid_descriptor` and `cyttsp5_hid_output_get_sysinfo`. These symbols show that the protocol is the same.
## Power and data path
```mermaid
flowchart LR
SoC["SDM630 BLSP QUP
I2C c178000"] <-->|SDA TLMM14 / SCL TLMM15| TOUCH["TrueTouch Gen5 @0x24"]
IRQ["TLMM 67 IRQ (falling)"] --> SoC
RST["TLMM 66 reset"] --> TOUCH
EN["TLMM 35 power enable"] --> TOUCH
L3["PM660L L3 2.8 V"] --> TOUCH
L11["PM660 L11 1.8 V"] --> TOUCH
```
## Verified behavior
When L3 is on and power-enable and reset are high, the controller sends a Cypress HID descriptor and system information at `0x24`.
With mainline `cyttsp5`, the controller follows five touches at the same time. Two-finger tracking covers X 53–1030 and Y 58–1881 in a 1080 × 1920 coordinate space.
Nobody has tested **glove** use and **wet** use. The marketing information says that the panel can operate with gloves and with water. The stock driver can apply more tuning for these modes.
## Related pages
- [Display](display.md)
- [Pin map](pin-map.md)
- [Mainline Linux](mainline-linux.md)
---
# Wireless
The XP8800 has a Qualcomm **WCN3990** Wi-Fi/Bluetooth combo and an **SDR660** cellular transceiver. The WLAN MAC of the WCN3990 operates on the modem Hexagon DSP.
On this platform, **Wi-Fi operates only with the modem processor**. A Wi-Fi-only build must also start the modem firmware and the `rmtfs`/`pd-mapper`/`tqftpserv` userspace stack.
## WCN3990 (Wi-Fi + Bluetooth)
| Item | Value | Confidence |
|---|---|---|
| Part | Qualcomm WCN3990 | Stock |
| Bluetooth HCI | `uart@c1af000` (the only high-speed UART that is on) | Unit |
| Bluetooth driver | `hci_qca` | Unit |
| Bluetooth SoC version | `0x40020140`, ROM `0x0201` | Unit |
| Bluetooth firmware | `qca/crbtfw21.tlv` + `qca/crnv21.bin` | Unit |
| Wi-Fi driver | `ath10k_snoc` | Stock |
| Wi-Fi chip id / family | `0x140` / `0x4002` | Unit |
| Wi-Fi board id | `0xff` (not programmed, so you must select a calibration variant name) | Unit |
| Wi-Fi firmware version | `WLAN.HL.1.0.1.c2-01187` | Unit |
| Supplies (stock) | PM660 L5 (0.85 V), L9 (1.8 V), L6 (1.3 V), L19 (3.3 V) | Stock |
The Bluetooth controller starts in mainline with `hci_qca`. Wi-Fi does not operate. The firmware starts, then the modem shows a WLAN runtime error because of the **aggre2 SMMU**, which is not protected (refer to the aggre2 section below).
### Wi-Fi board file selection
The WCN3990 firmware needs a board-data file (`bdwlan.*` / `board-2.bin`). The QMI board ID selects the file.
On this unit, the board id reads `0xff`, so you must select one of the 26 `bdwlan` candidates in the modem image (or the generic `bdwlan.bin`). All candidates are 19,152 bytes. They have 19 different payloads by SHA-256. This selection is open.
## The modem dependency
On SDM630, `ath10k_snoc` loads its WLAN MAC firmware (`wlanmdsp.mbn`) onto the **modem Hexagon QDSP6** (`qcom_q6v5_mss`). Wi-Fi needs these items:
- `qcom_q6v5_mss` (modem remoteproc) and the SoC `mss` node
- `qrtr`, `pd-mapper`, and `tqftpserv`
- **`rmtfs`**, which supplies the EFS/NV partitions (`modemst1`, `modemst2`, `fsg`) through QMI
```mermaid
flowchart LR
WLAN["ath10k_snoc"] -->|loads wlanmdsp.mbn| MSS["Modem Hexagon (qcom_q6v5_mss)"]
MSS --> QRTR["qrtr / QMI"]
QRTR --> RMTFS["rmtfs"]
QRTR --> PD["pd-mapper"]
QRTR --> TQ["tqftpserv"]
RMTFS -->|reads| NV["modemst1 · modemst2 · fsg"]
MSS --> RF["SDR660 transceiver"]
```
> WARNING: Operate `rmtfs` in **read-only** mode during bring-up. Always use the `-r` flag. Do not let `rmtfs` open a live eMMC NV partition for writing. A write can change the NV data of the modem.
>
> Preferred: `rmtfs -r -o /run/rmtfs-copy` with isolated tmpfs copies (without `-P`). Alternative: `rmtfs -r -P -s`.
>
> Refer to [NV partitions and backup](nv-partitions-and-backup.md).
## Cellular: SDR660
| Item | Value | Confidence |
|---|---|---|
| Transceiver | Qualcomm SDR660 | Stock |
| Owner | Modem processor | Stock |
| Modem firmware | `mba.mbn` + `modem.mdt` (+ segments) | Stock |
| Front-end parts | Not identified. Not necessary for mainline | None |
The modem processor starts in mainline with the `mba.mbn` and `modem.mdt` of this unit.
**Cellular voice, SMS, and data do not operate correctly** on all mainline SDM630/660 devices (ModemManager/oFono, `ipa`, and voice-audio UCM). They are a different task. Do them after Wi-Fi.
## The aggre2 SMMU blocker
The bus master of Wi-Fi is behind the **aggre2 SMMU** at `iommu@16c0000` (stream IDs `0x1a00`, `0x1a01`). The boot firmware keeps it on. Unmatched streams cause a fault:
| Register | Value |
|---|---|
| `sCR0` | `0x00200626` |
| `ID0` | `0x48017a06` |
| `ID1` | `0x4000800b` |
| `SMR0` | `0` |
| `S2CR0` | `0x000200ff` (fault) |
A read of offset `0x10` (auxiliary control) on a running system makes the phone stop operating. The mainline `arm-smmu` driver makes the kernel stop when it probes this block. The hypervisor or TrustZone protects some registers.
You can read these registers: `0x00`, `0x04`, `0x20`, `0x24`, `0x800`, `0xc00`. The stock tree marks this SMMU `qcom,skip-init`. This agrees with the observation.
| Observation | Result |
|---|---|
| Wi-Fi with SMMU off | The firmware starts, then stops with an error about 2.5 s later (`EX:wlan_process:1:WLAN RT`) |
| Wi-Fi with SMMU on | The kernel stops before the console starts, during probe |
| Readable registers | `0x00`, `0x04`, `0x20`, `0x24`, `0x800`, `0xc00` |
| Register that stops the system | `0x10` (auxiliary control) |
| Clock | The a2noc interconnect provider has the clock. A hold on the clock does **not** remove the problem |
To make Wi-Fi operate, you must change the mainline SMMU driver. The driver must skip the protected accesses for this block.
## Wireless memory reservations
The stock device tree reserves fixed DRAM regions for the modem/WLAN path. Refer to [Memory map](memory-map.md) for the full table (`rmtfs` `0x85e00000`, modem `0x8ac00000`, ADSP `0x92a00000`, and others).
## Related pages
- [Memory map](memory-map.md)
- [Mainline Linux](mainline-linux.md)
- [NV partitions and backup](nv-partitions-and-backup.md)