From d4acdc632bc8be76b89502abeadfc1597cbcf6d8 Mon Sep 17 00:00:00 2001 From: PlayDay <18056374+playday3008@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:32:54 +0100 Subject: [PATCH 1/3] dts: msm8996-samsung: Add support for Samsung Galaxy (Note7 & S7 (Edge)) - Samsung Galaxy Note 7 (2016) - graceqlte - Samsung Galaxy S7 (2016) - herolte - Samsung Galaxy S7 Edge (2016) - hero2lte --- Documentation/devices.md | 3 + lk2nd/device/dts/msm8996/msm8996-samsung.dts | 212 +++++++++++++++++++ lk2nd/device/dts/msm8996/rules.mk | 1 + 3 files changed, 216 insertions(+) create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung.dts diff --git a/Documentation/devices.md b/Documentation/devices.md index 267f56e5f9..4221526960 100644 --- a/Documentation/devices.md +++ b/Documentation/devices.md @@ -183,6 +183,9 @@ - LG G5 - h850 - LG V20 - h990 - OnePlus 3T +- Samsung Galaxy Note 7 (2016) - SM-N9300, SM-N9308, SM-N930W8, SM-N930AZ, SM-N930A, SM-N930T1, SM-N930R6, SM-N930R7, SM-N930P, SM-N930T, SM-N930R4, SM-N930V, SM-N930U +- Samsung Galaxy S7 (2016) - SM-G9300, SM-G9308, SM-G930AZ, SM-G930A, SM-G930T1, SM-G930R6, SM-G930R7, SM-G930P, SM-G930T, SM-G930R4, SM-G930V, SM-G930VL, SM-G930U +- Samsung Galaxy S7 Edge (2016) - SM-G9350, SM-G935AZ, SM-G935A, SM-G935T1, SM-G935R6, SM-G935R7, SM-G935P, SM-G935T, SM-G935R4, SM-G935V, SM-G935VL, SM-G935U - Xiaomi Mi 5 - gemini - Xiaomi Mi 5s - capricorn - Xiaomi Mi 5s Plus - natrium diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung.dts b/lk2nd/device/dts/msm8996/msm8996-samsung.dts new file mode 100644 index 0000000000..7b19e93464 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung.dts @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include +#include + +#define I2C_GPIO_FLAGS (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN | GPIO_BIAS_DISABLE) + +/ { + qcom,msm-id = ; + qcom,board-id = , + , + , + , + , + , + , + , + , + , + , + , + ; + qcom,pmic-id = <0x20009 0x1000C 0x0 0x0>; + + /* bootloader refuses the dtb if it cannot delete some nodes. */ + soc { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x0 0xffffffff>; + compatible = "simple-bus"; + + qcom,memshare { + compatible = "qcom,memshare"; + memory-region = <&modem_shared_mem>; + + qcom,client_1 { + compatible = "qcom,memshare-peripheral"; + qcom,peripheral-size = <0x0>; + qcom,client-id = <1>; + label = "modem"; + }; + }; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + lk_region: lk_region@0 { + compatible = "removed-dma-pool"; + no-map; + reg = <0x0 0x84C00000 0x0 0x00400000>; + + }; + + sec_debug_region: sec_debug_region@0 { + compatible = "removed-dma-pool"; + no-map; + reg = <0x0 0x85000000 0x0 0x00800000>; + }; + + klog_region: klog_region@0 { + compatible = "removed-dma-pool"; + no-map; + reg = <0x0 0x851FF000 0x0 0x00201000>; + }; + + modem_shared_mem: modem_shared_mem_region@0x93000000 { + compatible = "removed-dma-pool"; + no-map; + reg = <0x0 0x93000000 0x0 0x6000000>; + }; + }; +}; + +&lk2nd { + graceqlte { + model = "Samsung Galaxy Note 7"; + compatible = "samsung,graceqlte"; + lk2nd,match-bootloader = "N930*"; + + lk2nd,dtb-files = "msm8996-samsung-graceqlte"; + + muic-reset { + compatible = "samsung,muic-reset"; + i2c-reg = <0x66>; + i2c-sda-gpios = <&tlmm 33 I2C_GPIO_FLAGS>; + i2c-scl-gpios = <&tlmm 32 I2C_GPIO_FLAGS>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + home-key { + lk2nd,code = ; + gpios = <&pmic 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + + vol-up-key { + lk2nd,code = ; + gpios = <&pmic 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + + panel { + compatible = "samsung,graceqlte-panel", "lk2nd,panel"; + + ss_dsi_panel_PBA_BOOTING_HD { + compatible = "samsung,ea8061v-ams391dt01"; + }; + ss_dsi_panel_S6E3HF4_AMB526JS01_WQHD { + compatible = "samsung,s6e3hf4-amb526js01"; + }; + ss_dsi_panel_S6E3HA5_AMB567MK01_WQHD { + compatible = "samsung,s6e3ha5-amb567mk01"; + }; + }; + }; + + heroqlte { + model = "Samsung Galaxy S7"; + compatible = "samsung,heroqlte"; + lk2nd,match-bootloader = "G930*"; + + lk2nd,dtb-files = "msm8996-samsung-heroqlte"; + + muic-reset { + compatible = "samsung,muic-reset"; + i2c-reg = <0x66>; + i2c-sda-gpios = <&tlmm 33 I2C_GPIO_FLAGS>; + i2c-scl-gpios = <&tlmm 32 I2C_GPIO_FLAGS>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + home-key { + lk2nd,code = ; + gpios = <&pmic 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + + vol-up-key { + lk2nd,code = ; + gpios = <&pmic 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + + panel { + compatible = "samsung,heroqlte-panel", "lk2nd,panel"; + + ss_dsi_panel_PBA_BOOTING_HD { + compatible = "samsung,ea8061v-ams391dt01"; + }; + ss_dsi_panel_S6E3HA2_AMS509ES01_WQHD { + compatible = "samsung,s6e3ha2-ams509es01"; + }; + ss_dsi_panel_S6E3HA3_AMS567JA01_WQHD { + compatible = "samsung,s6e3ha3-ams567ja01"; + }; + ss_dsi_panel_S6E3HF4_AMB526JS01_WQHD { + compatible = "samsung,s6e3hf4-amb526js01"; + }; + }; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge"; + compatible = "samsung,hero2qlte"; + lk2nd,match-bootloader = "G935*"; + + lk2nd,dtb-files = "msm8996-samsung-hero2qlte"; + + muic-reset { + compatible = "samsung,muic-reset"; + i2c-reg = <0x66>; + i2c-sda-gpios = <&tlmm 33 I2C_GPIO_FLAGS>; + i2c-scl-gpios = <&tlmm 32 I2C_GPIO_FLAGS>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + home-key { + lk2nd,code = ; + gpios = <&pmic 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + + vol-up-key { + lk2nd,code = ; + gpios = <&pmic 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + + panel { + compatible = "samsung,hero2qlte-panel", "lk2nd,panel"; + + ss_dsi_panel_PBA_BOOTING_HD { + compatible = "samsung,ea8061v-ams391dt01"; + }; + ss_dsi_panel_S6E3HA2_AMS509ES01_WQHD { + compatible = "samsung,s6e3ha2-ams509es01"; + }; + ss_dsi_panel_S6E3HA3_AMS567JA01_WQHD { + compatible = "samsung,s6e3ha3-ams567ja01"; + }; + ss_dsi_panel_S6E3HF4_AMB526JS01_WQHD { + compatible = "samsung,s6e3hf4-amb526js01"; + }; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8996/rules.mk b/lk2nd/device/dts/msm8996/rules.mk index 6946c1ad0b..01c2333c8e 100644 --- a/lk2nd/device/dts/msm8996/rules.mk +++ b/lk2nd/device/dts/msm8996/rules.mk @@ -5,6 +5,7 @@ ADTBS += \ $(LOCAL_DIR)/msm8996pro-oneplus3t.dtb \ $(LOCAL_DIR)/msm8996-lg-h850.dtb \ $(LOCAL_DIR)/msm8996-lg-h990.dtb \ + $(LOCAL_DIR)/msm8996-samsung.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5s.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5s-plus.dtb \ From 7042ae0e4956bc49dd23026ca8e39a7a9fce2cc5 Mon Sep 17 00:00:00 2001 From: PlayDay <18056374+playday3008@users.noreply.github.com> Date: Sat, 12 Jul 2025 21:41:48 +0200 Subject: [PATCH 2/3] feat(msm8996): Correct support for Samsung devices --- .../msm8996-samsung/msm8996-samsung-r00.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r01.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r02.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r03.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r05.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r06.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r07.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r08.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r09.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r10.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r11.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r13.dts | 23 ++++++++++++++ .../msm8996-samsung/msm8996-samsung-r15.dts | 23 ++++++++++++++ .../msm8996-samsung.dtsi} | 15 +--------- lk2nd/device/dts/msm8996/rules.mk | 13 +++++++- platform/msm_shared/dev_tree.c | 30 ++++++++++++------- 16 files changed, 332 insertions(+), 25 deletions(-) create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r00.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r01.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r02.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r03.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r05.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r06.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r07.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r08.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r09.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r10.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r11.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r13.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r15.dts rename lk2nd/device/dts/msm8996/{msm8996-samsung.dts => msm8996-samsung/msm8996-samsung.dtsi} (91%) diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r00.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r00.dts new file mode 100644 index 0000000000..ede8caac57 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r00.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=0 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev00"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev00"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev00"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r01.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r01.dts new file mode 100644 index 0000000000..2373e624ae --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r01.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=1 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev01"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev01"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev01"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r02.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r02.dts new file mode 100644 index 0000000000..46ae9a9cf4 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r02.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=2 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev02"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev02"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev02"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r03.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r03.dts new file mode 100644 index 0000000000..f0be0da3b3 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r03.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=3 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev03"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev03"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev03"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r05.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r05.dts new file mode 100644 index 0000000000..ebeffdf967 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r05.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=5 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev05"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev05"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev05"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r06.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r06.dts new file mode 100644 index 0000000000..1ce7f3c88a --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r06.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=6 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev06"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev06"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev06"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r07.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r07.dts new file mode 100644 index 0000000000..1ffdcbfb66 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r07.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=7 *"; + + graceqlte { + qcom,board-id = ; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev07"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev07"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r08.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r08.dts new file mode 100644 index 0000000000..06d394a6fd --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r08.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=8 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev08"; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev08"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev08"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r09.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r09.dts new file mode 100644 index 0000000000..1fd166b9fe --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r09.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=9 *"; + + graceqlte { + model = "Samsung Galaxy Note 7 Rev09"; + }; + + heroqlte { + qcom,board-id = ; + }; + + hero2qlte { + qcom,board-id = ; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r10.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r10.dts new file mode 100644 index 0000000000..8b9b59fd85 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r10.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=10 *"; + + graceqlte { + qcom,board-id = ; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev10"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev10"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r11.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r11.dts new file mode 100644 index 0000000000..f2dac25682 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r11.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=11 *"; + + graceqlte { + qcom,board-id = ; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev11"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev11"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r13.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r13.dts new file mode 100644 index 0000000000..b21f9483cd --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r13.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=13 *"; + + graceqlte { + qcom,board-id = ; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev13"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev13"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r15.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r15.dts new file mode 100644 index 0000000000..718a3cf116 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung-r15.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include "msm8996-samsung.dtsi" + +/ { + qcom,board-id = ; +}; + +&lk2nd { + lk2nd,match-cmdline = "* androidboot.revision=15 *"; + + graceqlte { + qcom,board-id = ; + }; + + heroqlte { + model = "Samsung Galaxy S7 Rev15"; + }; + + hero2qlte { + model = "Samsung Galaxy S7 Edge Rev15"; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung.dts b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi similarity index 91% rename from lk2nd/device/dts/msm8996/msm8996-samsung.dts rename to lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi index 7b19e93464..58b161a78e 100644 --- a/lk2nd/device/dts/msm8996/msm8996-samsung.dts +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi @@ -7,20 +7,7 @@ / { qcom,msm-id = ; - qcom,board-id = , - , - , - , - , - , - , - , - , - , - , - , - ; - qcom,pmic-id = <0x20009 0x1000C 0x0 0x0>; + qcom,pmic-id = <0x20009 0x1000C>; /* bootloader refuses the dtb if it cannot delete some nodes. */ soc { diff --git a/lk2nd/device/dts/msm8996/rules.mk b/lk2nd/device/dts/msm8996/rules.mk index 01c2333c8e..5bf3925b9a 100644 --- a/lk2nd/device/dts/msm8996/rules.mk +++ b/lk2nd/device/dts/msm8996/rules.mk @@ -5,7 +5,18 @@ ADTBS += \ $(LOCAL_DIR)/msm8996pro-oneplus3t.dtb \ $(LOCAL_DIR)/msm8996-lg-h850.dtb \ $(LOCAL_DIR)/msm8996-lg-h990.dtb \ - $(LOCAL_DIR)/msm8996-samsung.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r01.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r02.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r03.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r05.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r06.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r07.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r08.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r09.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r10.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r11.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r13.dtb \ + $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r15.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5s.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5s-plus.dtb \ diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c index 86757c0641..b0b326bc2c 100644 --- a/platform/msm_shared/dev_tree.c +++ b/platform/msm_shared/dev_tree.c @@ -965,6 +965,9 @@ if (DEBUGLEVEL >= SPEW) { /* If dtb version is v2.0, the pmic_data_count will be <= 0 */ pmic_data_count = (len_pmic_id / PMIC_ID_SIZE); + dprintf(SPEW, "DTB Version %d, board_data_count = %u, msm_data_count = %u, pmic_data_count = %u\n", + dtb_ver, board_data_count, msm_data_count, pmic_data_count); + #if WITH_LK2ND_DEVICE /* Cannot override with more than one entry */ if (dtb_list->dt_entry_m && (board_data_count > 1 || msm_data_count > 1 || pmic_data_count > 1)) { @@ -1096,31 +1099,31 @@ if (DEBUGLEVEL >= SPEW) { } for (i=0 ;i < num_entries; i++) { - dprintf(SPEW, "Found an appended flattened device tree (%s - %u %u %u 0x%x)\n", + dprintf(SPEW, "Found an appended flattened device tree (%s - %u 0x%x 0x%x 0x%x)\n", model ? model : "unknown", - dt_entry_array[i].platform_id, dt_entry_array[i].variant_id, dt_entry_array[i].board_hw_subtype, dt_entry_array[i].soc_rev); + dt_entry_array[i].platform_id, dt_entry_array[i].soc_rev, dt_entry_array[i].variant_id, dt_entry_array[i].board_hw_subtype); if (platform_dt_absolute_match(&(dt_entry_array[i]), dtb_list)) { - dprintf(SPEW, "Device tree exact match the board: <%u %u %u 0x%x> == <%u %u %u 0x%x>\n", + dprintf(SPEW, "Device tree exact match the board: <%u 0x%x 0x%x 0x%x> == <%u 0x%x 0x%x 0x%x>\n", dt_entry_array[i].platform_id, - dt_entry_array[i].variant_id, dt_entry_array[i].soc_rev, + dt_entry_array[i].variant_id, dt_entry_array[i].board_hw_subtype, board_platform_id(), + board_soc_version(), board_hardware_id(), - board_hardware_subtype(), - board_soc_version()); + board_hardware_subtype()); } else { - dprintf(SPEW, "Device tree's msm_id doesn't match the board: <%u %u %u 0x%x> != <%u %u %u 0x%x>\n", + dprintf(SPEW, "Device tree's msm_id doesn't match the board: <%u 0x%x 0x%x 0x%x> != <%u 0x%x 0x%x 0x%x>\n", dt_entry_array[i].platform_id, - dt_entry_array[i].variant_id, dt_entry_array[i].soc_rev, + dt_entry_array[i].variant_id, dt_entry_array[i].board_hw_subtype, board_platform_id(), + board_soc_version(), board_hardware_id(), - board_hardware_subtype(), - board_soc_version()); + board_hardware_subtype()); } } @@ -1951,6 +1954,13 @@ int dev_tree_get_entry_info(struct dt_table *table, struct dt_entry *dt_entry_in return -1; } + dprintf(SPEW, "DTB entry %u/0x%08x/0x%08x/0x%x/0x%x/0x%x/0x%x/0x%x/0x%x/0x%x\n", + cur_dt_entry->platform_id, cur_dt_entry->soc_rev, + cur_dt_entry->variant_id, cur_dt_entry->board_hw_subtype, + cur_dt_entry->pmic_rev[0], cur_dt_entry->pmic_rev[1], + cur_dt_entry->pmic_rev[2], cur_dt_entry->pmic_rev[3], + cur_dt_entry->offset, cur_dt_entry->size); + /* DTBs must match the platform_id, platform_hw_id, platform_subtype and DDR size. * The satisfactory DTBs are stored in dt_entry_queue */ From 5b38ff724ab6866a14fbe7ae4a8d9bed8b37163f Mon Sep 17 00:00:00 2001 From: PlayDay <18056374+playday3008@users.noreply.github.com> Date: Sat, 12 Jul 2025 21:42:09 +0200 Subject: [PATCH 3/3] fix(msm8996): Exclude some dts's from build for Samsung devices --- .../msm8996-samsung/msm8996-samsung.dtsi | 17 ++++++++++++++--- lk2nd/device/dts/msm8996/rules.mk | 4 ---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi index 58b161a78e..a4bca6f68a 100644 --- a/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi +++ b/lk2nd/device/dts/msm8996/msm8996-samsung/msm8996-samsung.dtsi @@ -1,5 +1,16 @@ // SPDX-License-Identifier: BSD-3-Clause +/** + Stock Samsung bootloader can choose any supported device tree it wants. + But that doesn't mean that stock Samsung kernel will support all of them. + For example (graceqlte): + - Bootloader selects msm8996-samsung-graceqlte-r11.dtb (from lk2nd) + - Kernel is built with: r02, r03, r06, r09 + While stock bootloader can resolve stock kernel by just using r09. + lk2nd will try to use r11, as it was selected by the stock bootloader. + To avoid such issue, some dts's are excluded from the build. + */ + #include #include @@ -63,7 +74,7 @@ &lk2nd { graceqlte { - model = "Samsung Galaxy Note 7"; + model = "Samsung Galaxy Note 7 RevXX"; compatible = "samsung,graceqlte"; lk2nd,match-bootloader = "N930*"; @@ -106,7 +117,7 @@ }; heroqlte { - model = "Samsung Galaxy S7"; + model = "Samsung Galaxy S7 RevXX"; compatible = "samsung,heroqlte"; lk2nd,match-bootloader = "G930*"; @@ -152,7 +163,7 @@ }; hero2qlte { - model = "Samsung Galaxy S7 Edge"; + model = "Samsung Galaxy S7 Edge RevXX"; compatible = "samsung,hero2qlte"; lk2nd,match-bootloader = "G935*"; diff --git a/lk2nd/device/dts/msm8996/rules.mk b/lk2nd/device/dts/msm8996/rules.mk index 5bf3925b9a..723a5d80f8 100644 --- a/lk2nd/device/dts/msm8996/rules.mk +++ b/lk2nd/device/dts/msm8996/rules.mk @@ -13,10 +13,6 @@ ADTBS += \ $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r07.dtb \ $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r08.dtb \ $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r09.dtb \ - $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r10.dtb \ - $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r11.dtb \ - $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r13.dtb \ - $(LOCAL_DIR)/msm8996-samsung/msm8996-samsung-r15.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5s.dtb \ $(LOCAL_DIR)/msm8996-xiaomi-mi5s-plus.dtb \