Re: [PATCH 2/2] arm64: dts: qcom: Add device tree for Xiaomi Mi 9

From: Krzysztof Kozlowski
Date: Thu Oct 05 2023 - 12:22:04 EST


On 05/10/2023 16:31, ZeYan Li wrote:
> This commit adds initial support for the Xiaomi Mi 9.
>
> Signed-off-by: ZeYan Li <qaz6750@xxxxxxxxxxx>
> ---
> arch/arm64/boot/dts/qcom/Makefile | 1 +
> .../boot/dts/qcom/sm8150-xiaomi-cepheus.dts | 610 ++++++++++++++++++
> 2 files changed, 611 insertions(+)
> create mode 100644 arch/arm64/boot/dts/qcom/sm8150-xiaomi-cepheus.dts
>
> diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
> index d6cb840b7050..75e9657d7d57 100644
> --- a/arch/arm64/boot/dts/qcom/Makefile
> +++ b/arch/arm64/boot/dts/qcom/Makefile
> @@ -214,6 +214,7 @@ dtb-$(CONFIG_ARCH_QCOM) += sm8150-microsoft-surface-duo.dtb
> dtb-$(CONFIG_ARCH_QCOM) += sm8150-mtp.dtb
> dtb-$(CONFIG_ARCH_QCOM) += sm8150-sony-xperia-kumano-bahamut.dtb
> dtb-$(CONFIG_ARCH_QCOM) += sm8150-sony-xperia-kumano-griffin.dtb
> +dtb-$(CONFIG_ARCH_QCOM) += sm8150-xiaomi-cepheus.dtb
> dtb-$(CONFIG_ARCH_QCOM) += sm8250-hdk.dtb
> dtb-$(CONFIG_ARCH_QCOM) += sm8250-mtp.dtb
> dtb-$(CONFIG_ARCH_QCOM) += sm8250-sony-xperia-edo-pdx203.dtb
> diff --git a/arch/arm64/boot/dts/qcom/sm8150-xiaomi-cepheus.dts b/arch/arm64/boot/dts/qcom/sm8150-xiaomi-cepheus.dts
> new file mode 100644
> index 000000000000..bc4f3533455a
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/sm8150-xiaomi-cepheus.dts
> @@ -0,0 +1,610 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +/*
> + * Copyright (c) 2023, Zeyan Li <qaz6750@xxxxxxxxxxx>
> + */
> +
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/input/gpio-keys.h>
> +#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
> +#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
> +#include "sm8150.dtsi"
> +#include "pm8150.dtsi"
> +#include "pm8150b.dtsi"
> +#include "pm8150l.dtsi"
> +
> +/*
> + * Delete following upstream (sm8150.dtsi) reserved
> + * memory mappings which are different in this device.
> + */
> +/delete-node/ &tz_mem; /* same address but larger, no place for rmtfs_mem! */
> +/delete-node/ &rmtfs_mem; /* moved to completely different address */
> +/delete-node/ &adsp_mem; /* same start address, but larger size */
> +/delete-node/ &mpss_mem; /* same size, shifted higher, due to larger adsp_mem */
> +/delete-node/ &venus_mem; /* same size, shifted higher */
> +/delete-node/ &slpi_mem; /* same size, shifted higher */
> +/delete-node/ &ipa_fw_mem; /* same size, shifted higher */
> +/delete-node/ &ipa_gsi_mem; /* same size, shifted higher */
> +/delete-node/ &gpu_mem; /* same size, shifted higher */
> +/delete-node/ &spss_mem; /* same size, shifted higher */
> +/delete-node/ &cdsp_mem; /* same size, shifted higher */
> +
> +/ {
> + model = "xiaomi Mi 9";
> + compatible = "xiaomi,cepheus", "qcom,sm8150";
> + chassis-type = "handset";
> + /* Required for bootloader to select correct board */
> + qcom,board-id = <37 0>;
> +
> + aliases {
> + serial0 = &uart2;
> + display0 = &framebuffer;
> + };
> +
> + chosen {
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + framebuffer: framebuffer@9c000000 {
> + compatible = "simple-framebuffer";
> + reg = <0 0x9c000000 0 0x2400000>;
> + status = "okay";
> + width = <1080>;
> + height = <2340>;
> + stride = <(1080 * 4)>;
> + format = "a8r8g8b8";
> + /*
> + * That's (going to be) a lot of clocks, but it's necessary due
> + * to unused clk cleanup & no panel driver yet (& no dispcc either)..
> + */
> + clocks = <&gcc GCC_DISP_HF_AXI_CLK>,
> + <&gcc GCC_DISP_SF_AXI_CLK>;
> + };
> + };
> +
> + gpio_keys {

No underscores in node names.

gpio-keys
> + compatible = "gpio-keys";
> + pinctrl-names = "default";
> + pinctrl-0 = <&ai_key_pin_a &vol_up_pin_a>;
> +
> + vol_up {

It does not look like you tested the DTS against bindings. Please run
`make dtbs_check W=1` (see
Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).

No, do not upstream junky DTS from some vendor stuff. That's not how it
works. You must choose decent, latest DTS and customize it per your
needs. There is little point to review and ask the same bugs we fixed
months or years ago.


Best regards,
Krzysztof