Skip to contentSkip to conversation

Introduce support for Xiaomi Mi 8

PATCH In review David Heidelberg 4 participants 9 messages Sep 15 – Oct 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Introduce support for Xiaomi Mi 8

Currently only Mi 8 itself is supported, but the sdm845-xiaomi-dipper-common should ensure, that other family members such as Mi 8 Pro, Mi 8 Explorer will be likely supported too without much of additional work. These variants should differ only in the small details (such as battery size, fingerprint sensor etc.).

Minimal viable support for xiaomi-dipper. Enough to get basic u-boot and Linux functional. More improvements will follow.

The display and touchscreen support are work-in-progress, but waiting for other bits to land.

---
Changes in v2:
- Deduplicate simplified xiaomi,dipper compatbile from the dt-binding.
- Reorder reserved-memory by address.
- vreg-s4a-1p8 -> regulator-vreg-s4a-1p8. (Konrad)
- adsp firmware moved to dipper variant (as I cannot test others) (Konrad)
- Removed Bluetooth path comment. (Konrad)
- Link to v1: https://patch.msgid.link/[email protected]

---
David Heidelberg (2):
dt-bindings: arm: qcom: Add Xiaomi Mi 8 family compatibles
arm64: dts: qcom: add Xiaomi Mi 8 (dipper)

 Documentation/devicetree/bindings/arm/qcom.yaml    |   9 +
 arch/arm64/boot/dts/qcom/Makefile                  |   1 +
 .../boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi | 607 +++++++++++++++++++++
 arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper.dts  |  36 ++
 4 files changed, 653 insertions(+)

---
base-commit: 7079a12d7506b07fb53b54a664bfad5fa9b16d70
change-id: 20260720-dipper-8fd3f1e475bc

Best regards,

Signature · 1 line
David Heidelberg <[email protected]>
#1 lore raw

PATCH v2 1/2 dt-bindings: arm: qcom: Add Xiaomi Mi 8 family compatibles

This smartphone codenamed dipper is now supported by this series, variants such as ursa and equuleus just documented.

---
 Documentation/devicetree/bindings/arm/qcom.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/arm/qcom.yaml +9 -0
index ff8a35df7862d..c3491630e56d1 100644
@@ -945,16 +945,25 @@ properties:
           - const: qcom,sdm670
 
       - items:
           - enum:
               - google,bonito-tianma
           - const: google,bonito
           - const: qcom,sdm670
 
+      - description: Xiaomi Mi 8 family
+        items:
+          - enum:
+              - xiaomi,dipper
+              - xiaomi,equuleus
+              - xiaomi,ursa
+          - const: xiaomi,dipper-common
+          - const: qcom,sdm845
+
       - description: Xiaomi Poco F1
         items:
           - enum:
               - xiaomi,beryllium-ebbg
               - xiaomi,beryllium-tianma
           - const: xiaomi,beryllium
           - const: qcom,sdm845
 
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: arm: qcom: Add Xiaomi Mi 8 family compatibles

Documentation/devicetree/bindings/arm/qcom.yaml properties: · line 959

Quoted 7 lines · David Heidelberg
Documentation/devicetree/bindings/arm/qcom.yaml +7 -0
+      - description: Xiaomi Mi 8 family
+        items:
+          - enum:
+              - xiaomi,dipper
+              - xiaomi,equuleus
+              - xiaomi,ursa
+          - const: xiaomi,dipper-common

We do not make "common" compatibles.
git grep common -- Documentation/devicetree/bindings/arm/qcom.yaml

See other examples how this can be named, even one below:

Documentation/devicetree/bindings/arm/qcom.yaml properties: · line 968

Quoted 9 lines
Documentation/devicetree/bindings/arm/qcom.yaml +2 -0
+          - const: qcom,sdm845
+
       - description: Xiaomi Poco F1
         items:
           - enum:
               - xiaomi,beryllium-ebbg
               - xiaomi,beryllium-tianma
           - const: xiaomi,beryllium
           - const: qcom,sdm845

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v2 1/2] dt-bindings: arm: qcom: Add Xiaomi Mi 8 family compatibles

Quoted 11 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/arm/qcom.yaml properties: · line 959

Quoted 7 lines · David Heidelberg
Documentation/devicetree/bindings/arm/qcom.yaml +7 -0
+      - description: Xiaomi Mi 8 family
+        items:
+          - enum:
+              - xiaomi,dipper
+              - xiaomi,equuleus
+              - xiaomi,ursa
+          - const: xiaomi,dipper-common

We do not make "common" compatibles.
git grep common -- Documentation/devicetree/bindings/arm/qcom.yaml

TBH I have mental issue with calling it xiaomi,dipper-dipper

All three devices are branded as own devices, just based on 99.9% same base.

I'm not aware of any internal name which group these devices.

I could call it like xiaomi,common, but there is the polaris and beryllium, which aren't "that common" with these three.

Do you have idea what to do in this situation?

David

Quoted 16 lines

See other examples how this can be named, even one below:

Documentation/devicetree/bindings/arm/qcom.yaml properties: · line 968

Quoted 9 lines
Documentation/devicetree/bindings/arm/qcom.yaml +2 -0
+          - const: qcom,sdm845
+
        - description: Xiaomi Poco F1
          items:
            - enum:
                - xiaomi,beryllium-ebbg
                - xiaomi,beryllium-tianma
            - const: xiaomi,beryllium
            - const: qcom,sdm845

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v2 1/2] dt-bindings: arm: qcom: Add Xiaomi Mi 8 family compatibles

Quoted 15 lines · David Heidelberg
Quoted 11 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/arm/qcom.yaml properties: · line 959

Quoted 7 lines · David Heidelberg
Documentation/devicetree/bindings/arm/qcom.yaml +7 -0
+      - description: Xiaomi Mi 8 family
+        items:
+          - enum:
+              - xiaomi,dipper
+              - xiaomi,equuleus
+              - xiaomi,ursa
+          - const: xiaomi,dipper-common

We do not make "common" compatibles.
git grep common -- Documentation/devicetree/bindings/arm/qcom.yaml

TBH I have mental issue with calling it xiaomi,dipper-dipper

Quoted 8 lines

All three devices are branded as own devices, just based on 99.9% same base.

I'm not aware of any internal name which group these devices.

I could call it like xiaomi,common, but there is the polaris and beryllium, which aren't "that common" with these three.

Do you have idea what to do in this situation?

Just don't use "common" or "generic" or anything close to it, because it confuses future contributors thinking "common" compatible is allowed. It's not.

Except above, the actual names of compatibles are irrelevant, they just need to uniquely identify the device. Personally, I would not use nicknames at all for devices because they tell me nothing. Maybe they tell to you because you read internal source code, but not to me.

And if you google for Xiaomi Dipper, you will find first forks of code, so again not source information but derivative. Only fifth result is gsmarena website, but weirdly it does not have even "dipper" text mentioned. So basically using such names is counter productive to me, confusing and bringing downstream - postmarketos or lineageos - practices to upstream. Basically downstream forks create some codename and you push it to the usptream. You can, but I don't find it useful.

I would use proper model names, e.g. "xiaomi,mi-8" for final compatibles. Codename for family is fine, because simply there is no product which we could identify as common base...

Best regards,
Krzysztof

#5 lore raw

PATCH v2 2/2 arm64: dts: qcom: add Xiaomi Mi 8 (dipper)

In reply to David Heidelberg

Initial submission for one member of the prime Xiaomi Mi 8 family. Mi 8 Pro (equuleus) and Mi 8 Explorer (ursa) are nearly identical. Known differences are battery capacity and fingerprint sensor placement. This submission includes basic abstraction for other developers to be able easily extend it to support other variants.

What does work: framebuffer, USB, UFS, Bluetooth, Wi-Fi.

Based on work of multiple people trying to bring the device in the past. Last attempt was done by Max Furman.

---
 arch/arm64/boot/dts/qcom/Makefile                  |   1 +
 .../boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi | 607 +++++++++++++++++++++
 arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper.dts  |  36 ++
 3 files changed, 644 insertions(+)
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 1c86e7e98f55d..02793d00503e3 100644
@@ -325,16 +325,17 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-oneplus-enchilada.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-oneplus-fajita.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-samsung-starqltechn.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-sony-xperia-tama-akari.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-sony-xperia-tama-akatsuki.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-sony-xperia-tama-apollo.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-xiaomi-beryllium-ebbg.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-xiaomi-beryllium-tianma.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-xiaomi-dipper.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-xiaomi-polaris.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm845-shift-axolotl.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-huawei-matebook-e-2019.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-lenovo-yoga-c630.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdm850-samsung-w737.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sdx75-idp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= shikra-cqm-evk.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= shikra-cqs-evk.dtb
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +607 -0

607 lines not on this page · raw message

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper.dts new file +36 -0
new file mode 100644
index 0000000000000..bf45fe8fde80b
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Xiaomi Mi 8 (dipper).
+ *
+ * Copyright David Heidelberg.
+ */
+
+/dts-v1/;
+
+#include "sdm845-xiaomi-dipper-common.dtsi"
+
+/ {
+	model = "Xiaomi Mi 8";
+	compatible = "xiaomi,dipper", "xiaomi,dipper-common", "qcom,sdm845";
+
+	qcom,board-id = <55 0>;
+
+	battery: battery {
+		compatible = "simple-battery";
+
+		charge-full-design-microamp-hours = <3400000>;
+		voltage-min-design-microvolt = <3400000>;
+		voltage-max-design-microvolt = <4400000>;
+	};
+
+};
+
+&adsp_pas {
+	firmware-name = "qcom/sdm845/Xiaomi/dipper/adsp.mbn";
+
+	status = "okay";
+};
+
+&wifi {
+	qcom,calibration-variant = "Xiaomi_dipper";
+};
Signature · 1 line
2.55.0
#6 lore raw

Re: [PATCH v2 2/2] arm64: dts: qcom: add Xiaomi Mi 8 (dipper)

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] arm64: dts: qcom: missing TrustZone reserved memory redefinition --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] arm64: dts: qcom: missing TrustZone reserved memory redefinition --

commit 02ae202c9e4a6dda959a1b0bd255a44620dacac8
Author: David Heidelberg <[email protected]>

arm64: dts: qcom: add Xiaomi Mi 8 (dipper)

Initial submission for one member of the prime Xiaomi Mi 8 family. Mi 8 Pro (equuleus) and Mi 8 Explorer (ursa) are nearly identical. Known differences are battery capacity and fingerprint sensor placement.

Quoted 6 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +0 -0
new file mode 100644
index 0000000000000..eb4243e7f2c07
@@ -0,0 +1,607 @@

[ ... ]

Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +5 -0
+/delete-node/ &slpi_mem;
+/delete-node/ &spss_mem;
+/delete-node/ &tz_mem;
+/delete-node/ &venus_mem;
+/delete-node/ &wlan_msa_mem;

[ ... ]

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 133

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +10 -0
+	reserved-memory {
+		/*
+		 * It seems like reserving the old rmtfs_mem region is
+		 * also needed to prevent random crashes
+		 */
+		old-rmtfs@88f00000 {
+			reg = <0 0x88f00000 0 0x200000>;
+			no-map;
+		};
+

[Severity: High]
Does this code accidentally leave TrustZone memory unreserved?

By explicitly deleting the default tz_mem node with /delete-node/ &tz_mem; at the top of the file but failing to redefine it here in the reserved-memory block with device-specific sizes, Linux will map the TrustZone memory space as general-purpose System RAM.

When the buddy allocator hands out pages from this unreserved TrustZone memory range, the system will experience random hard crashes (Synchronous Aborts or Secure Watchdog Bites/XPU violations) when the kernel allocates and accesses it.

The workaround of reserving old-rmtfs at 0x88f00000 to mask random crashes appears to be a direct symptom of this missing reservation, since that memory region falls within the unreserved TrustZone space.

Quoted 4 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +4 -0
+		adsp_mem: adsp@8c500000 {
+			reg = <0 0x8c500000 0 0x1e00000>;
+			no-map;
+		};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#7 lore raw

Re: [PATCH v2 2/2] arm64: dts: qcom: add Xiaomi Mi 8 (dipper)

In reply to David Heidelberg
Quoted 4 lines · On 9/15/26 4:32 PM, David Heidelberg via B4 Relay wrote:

From: David Heidelberg <[email protected]>

Initial submission for one member of the prime Xiaomi Mi 8 family. Mi 8 Pro (equuleus) and Mi 8 Explorer (ursa) are nearly identical.

[...]

Quoted 2 lines

+ * Xiaomi Mi 8 family common device tree source.
+ * Covers Mi 8 Explorer Edition (equuleus), Mi 8 (dipper), Mi 8 Pro (urza).

								"ursa"? ^

[...]

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 127

Quoted 4 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +4 -0
+	reserved-memory {
+		/*
+		 * It seems like reserving the old rmtfs_mem region is
+		 * also needed to prevent random crashes

Have you verified that with e.g. memtest=1?

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 130

Quoted 3 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +3 -0
+		 */
+		old-rmtfs@88f00000 {
+			reg = <0 0x88f00000 0 0x200000>;

0 -> 0x0, please

[...]

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 523

Quoted 2 lines

+&tlmm {

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +1 -0
+	gpio-reserved-ranges = < 0 4>, /* SPI (Goodix Fingerprint) */

drop the leading space inside the value

Konrad

#8 lore raw

Re: [PATCH v2 2/2] arm64: dts: qcom: add Xiaomi Mi 8 (dipper)

Quoted 21 lines · Konrad Dybcio
Quoted 4 lines · On 9/15/26 4:32 PM, David Heidelberg via B4 Relay wrote:

From: David Heidelberg <[email protected]>

Initial submission for one member of the prime Xiaomi Mi 8 family. Mi 8 Pro (equuleus) and Mi 8 Explorer (ursa) are nearly identical.

[...]

Quoted 2 lines

+ * Xiaomi Mi 8 family common device tree source.
+ * Covers Mi 8 Explorer Edition (equuleus), Mi 8 (dipper), Mi 8 Pro (urza).

								"ursa"? ^

[...]

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 127

Quoted 4 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +4 -0
+	reserved-memory {
+		/*
+		 * It seems like reserving the old rmtfs_mem region is
+		 * also needed to prevent random crashes

Have you verified that with e.g. memtest=1?

Quoted 5 lines

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 130

Quoted 3 lines
arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +3 -0
+		 */
+		old-rmtfs@88f00000 {
+			reg = <0 0x88f00000 0 0x200000>;

0 -> 0x0, please

Isn't this a bit overkill? We just +2 chars for no gain here..

Quoted 7 lines

[...]

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi line 523

Quoted 2 lines

+&tlmm {

arch/arm64/boot/dts/qcom/sdm845-xiaomi-dipper-common.dtsi new file +1 -0
+	gpio-reserved-ranges = < 0 4>, /* SPI (Goodix Fingerprint) */

drop the leading space inside the value

dropped, but added space before the comment so it aligns for better readability..

David

Quoted 2 lines

Konrad