From 7833a07ab9ab6ffd4faff321f49a9539d0efde1a Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Sun, 10 Jul 2022 13:17:19 +0200 Subject: [PATCH 1/3] lk2nd: scripts: dtbTool: Clean up QCDT entries for Samsung MSM8916 The msm8916 samsung.dts results in a lot of QCDT entries (records) because each qcom,msm-id is combined with each qcom,board-id. However, each board-id is actually only valid for one particular msm-id, so we can save quite some space by cleaning them up here. This is a bit of a hack but since this is a custom copy of dtbTool anyway it's not much of a problem. Also, reverting this (or using the standard dtbTool) would not result in a functional difference, just a larger build result. --- lk2nd/scripts/dtbTool | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lk2nd/scripts/dtbTool b/lk2nd/scripts/dtbTool index 0ff8af85f..d3411e4e7 100755 --- a/lk2nd/scripts/dtbTool +++ b/lk2nd/scripts/dtbTool @@ -409,6 +409,16 @@ def generate_records(f, pagesize): x.pmic_id[2], x.pmic_id[3], 0, size, f, version) for x in ids] + if f.endswith('/lk2nd/device/dts/msm8916/samsung.dtb'): + # The msm8916 samsung.dts results in a lot of QCDT entries (records) + # because each qcom,msm-id is combined with each qcom,board-id. However, + # each board-id is actually only valid for one particular msm-id, + # so we can save quite some space by cleaning them up here. + records = filter(lambda r: + # Workaround for inconsistent qcom,board-id used on MSM8929 + r.plat_id & 0xff == r.variant_id >> 24 if r.variant_id & 0xfffff == 0x1ff01 + else r.plat_id in (r.variant_id >> 24, r.variant_id >> 20), records) + return records def write_padding(f, pagesize): From 26001846186cf9cb1452f484646decf892078778 Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Fri, 15 Jul 2022 11:32:55 +0200 Subject: [PATCH 2/3] Add some example DTs --- lk2nd/device/dts/msm8226/lumia.dts | 11 +++ lk2nd/device/dts/msm8226/rules.mk | 5 ++ lk2nd/device/dts/msm8916/apq8016-sbc.dts | 14 +++ .../msm8916-motorola-harpia-p1b-4d.dts | 6 ++ .../msm8916-motorola-harpia-p1b-4e.dts | 6 ++ .../dts/msm8916/msm8916-motorola-harpia.dtsi | 18 ++++ .../device/dts/msm8916/msm8916-motorola.dtsi | 17 ++++ lk2nd/device/dts/msm8916/msm8916-qrd-7+12.dts | 50 +++++++++++ lk2nd/device/dts/msm8916/msm8916-qrd-9.dts | 64 +++++++++++++ lk2nd/device/dts/msm8916/rules.mk | 10 +++ lk2nd/device/dts/msm8916/samsung.dts | 89 +++++++++++++++++++ lk2nd/device/dts/msm8960/bundle.dts | 28 ++++++ lk2nd/device/dts/msm8960/rules.mk | 5 ++ lk2nd/device/dts/msm8974/rules.mk | 5 ++ lk2nd/device/dts/msm8974/samsung.dts | 24 +++++ .../dts/msm8996/msm8996pro-oneplus3t.dts | 18 ++++ lk2nd/device/dts/msm8996/rules.mk | 5 ++ project/lk2nd-msm8960.mk | 1 + 18 files changed, 376 insertions(+) create mode 100644 lk2nd/device/dts/msm8226/lumia.dts create mode 100644 lk2nd/device/dts/msm8226/rules.mk create mode 100644 lk2nd/device/dts/msm8916/apq8016-sbc.dts create mode 100644 lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4d.dts create mode 100644 lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4e.dts create mode 100644 lk2nd/device/dts/msm8916/msm8916-motorola-harpia.dtsi create mode 100644 lk2nd/device/dts/msm8916/msm8916-motorola.dtsi create mode 100644 lk2nd/device/dts/msm8916/msm8916-qrd-7+12.dts create mode 100644 lk2nd/device/dts/msm8916/msm8916-qrd-9.dts create mode 100644 lk2nd/device/dts/msm8916/rules.mk create mode 100644 lk2nd/device/dts/msm8916/samsung.dts create mode 100644 lk2nd/device/dts/msm8960/bundle.dts create mode 100644 lk2nd/device/dts/msm8960/rules.mk create mode 100644 lk2nd/device/dts/msm8974/rules.mk create mode 100644 lk2nd/device/dts/msm8974/samsung.dts create mode 100644 lk2nd/device/dts/msm8996/msm8996pro-oneplus3t.dts create mode 100644 lk2nd/device/dts/msm8996/rules.mk diff --git a/lk2nd/device/dts/msm8226/lumia.dts b/lk2nd/device/dts/msm8226/lumia.dts new file mode 100644 index 000000000..1d308d952 --- /dev/null +++ b/lk2nd/device/dts/msm8226/lumia.dts @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include + +&lk2nd { + nokia-moneypenny { + model = "Nokia Lumia 630"; + compatible = "nokia,moneypenny"; + }; +}; diff --git a/lk2nd/device/dts/msm8226/rules.mk b/lk2nd/device/dts/msm8226/rules.mk new file mode 100644 index 000000000..e888eaa7e --- /dev/null +++ b/lk2nd/device/dts/msm8226/rules.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +LOCAL_DIR := $(GET_LOCAL_DIR) + +DTBS += \ + $(LOCAL_DIR)/lumia.dtb \ diff --git a/lk2nd/device/dts/msm8916/apq8016-sbc.dts b/lk2nd/device/dts/msm8916/apq8016-sbc.dts new file mode 100644 index 000000000..9bf29e5ff --- /dev/null +++ b/lk2nd/device/dts/msm8916/apq8016-sbc.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include +#include + +/ { + qcom,msm-id = ; + qcom,board-id = ; +}; + +&lk2nd { + model = "APQ8016 SBC"; + compatible = "apq8016,sbc"; +}; diff --git a/lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4d.dts b/lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4d.dts new file mode 100644 index 000000000..628f7c398 --- /dev/null +++ b/lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4d.dts @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "msm8916-motorola-harpia.dtsi" + +/ { + qcom,board-id = <0x4D 0x81B0>; +}; diff --git a/lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4e.dts b/lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4e.dts new file mode 100644 index 000000000..ca5a8a5c6 --- /dev/null +++ b/lk2nd/device/dts/msm8916/msm8916-motorola-harpia-p1b-4e.dts @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "msm8916-motorola-harpia.dtsi" + +/ { + qcom,board-id = <0x4E 0x81B0>; +}; diff --git a/lk2nd/device/dts/msm8916/msm8916-motorola-harpia.dtsi b/lk2nd/device/dts/msm8916/msm8916-motorola-harpia.dtsi new file mode 100644 index 000000000..a1cebeea3 --- /dev/null +++ b/lk2nd/device/dts/msm8916/msm8916-motorola-harpia.dtsi @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "msm8916-motorola.dtsi" + +&lk2nd { + model = "Motorola Moto G4 Play (harpia)"; + compatible = "motorola,harpia"; + + panel { + compatible = "motorola,harpia-panel", "lk2nd,panel"; + + qcom,mdss_dsi_mot_boe_499_720p_video_v1 { + compatible = "motorola,harpia-panel-boe"; + }; + qcom,mdss_dsi_mot_tianma_499_720p_video_v2 { + compatible = "motorola,harpia-panel-tianma"; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8916/msm8916-motorola.dtsi b/lk2nd/device/dts/msm8916/msm8916-motorola.dtsi new file mode 100644 index 000000000..a90139adc --- /dev/null +++ b/lk2nd/device/dts/msm8916/msm8916-motorola.dtsi @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/dts-v1/; + +#include +#include +#include + +/ { + qcom,msm-id = ; +}; + +&lk2nd { + unit-info { + compatible = "motorola,unit-info"; + }; +}; diff --git a/lk2nd/device/dts/msm8916/msm8916-qrd-7+12.dts b/lk2nd/device/dts/msm8916/msm8916-qrd-7+12.dts new file mode 100644 index 000000000..d9a6b8fab --- /dev/null +++ b/lk2nd/device/dts/msm8916/msm8916-qrd-7+12.dts @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include + +/ { + qcom,msm-id = ; + qcom,board-id = , ; +}; + +&lk2nd { + wingtech-wt88047 { + model = "Xiaomi Redmi 2 (Wingtech WT88047)"; + compatible = "wingtech,wt88047"; + lk2nd,match-panel; + + panel { + compatible = "wingtech,wt88047-panel"; + + qcom,mdss_dsi_r69431_720p_video { + compatible = "wingtech,sharp-r69431"; + }; + qcom,mdss_dsi_nt35521_720p_video { + compatible = "wingtech,auo-nt35521"; + }; + qcom,mdss_dsi_nt35521s_720p_video { + compatible = "wingtech,boe-nt35521s"; + }; + qcom,mdss_dsi_nt35521_ofilm_720p_video { + compatible = "wingtech,ofilm-nt35521"; + }; + /* qcom,mdss_dsi_otm1285a_720p_video is not supported */ + qcom,mdss_dsi_r61308_720p_video { + compatible = "wingtech,auo-r61308"; + }; + qcom,mdss_dsi_otm1285a_otp_720p_video { + compatible = "wingtech,ebbg-otm1285a"; + }; + qcom,mdss_dsi_r61308_s88047a1_720p_video { + compatible = "wingtech,auo-r61308"; + }; + }; + + smb1360 { + compatible = "wingtech,smb1360-wt88047", "qcom,smb1360"; + bat-id-gpios = <&pmic 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN | GPIO_BIAS_DISABLE | + GPIO_DRIVE_STR(3) | GPIO_PMIC_VIN_SEL(0))>; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8916/msm8916-qrd-9.dts b/lk2nd/device/dts/msm8916/msm8916-qrd-9.dts new file mode 100644 index 000000000..5311726ae --- /dev/null +++ b/lk2nd/device/dts/msm8916/msm8916-qrd-9.dts @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include + +/ { + qcom,msm-id = ; + qcom,board-id = ; +}; + +&lk2nd { + bq-paella { + model = "BQ Aquaris X5 (Longcheer L8910)"; + compatible = "bq,paella", "longcheer,l8910"; + lk2nd,match-bootloader = "paella-*"; + + panel { + compatible = "longcheer,l8910-panel", "lk2nd,panel"; + + qcom,mdss_dsi_truly_otm1288a_720p_video { + compatible = "longcheer,truly-otm1288a"; + }; + qcom,mdss_dsi_truly_otm1288a_720p_cmd { + compatible = "longcheer,truly-otm1288a"; + }; + qcom,mdss_dsi_yushun_NT35520_720p_cmd { + compatible = "longcheer,yushun-nt35520"; + }; + qcom,mdss_dsi_truly_HX8394_720p_video { + compatible = "longcheer,truly-hx8394"; + }; + qcom,mdss_dsi_yushun_NT35521S_720p_video { + compatible = "longcheer,yushun-nt35521s"; + }; + }; + + smb1360 { + compatible = "qcom,smb1360"; + qcom,batt-profile-select; + qcom,batt-id-vref-uv = <1800000>; + qcom,batt-id-rpullup-kohm = <100>; + qcom,profile-a-rid-kohm = <100>; + qcom,profile-b-rid-kohm = <200>; + }; + }; + + wileyfox-crackling { + model = "Wileyfox Swift (Longcheer L8150)"; + compatible = "wileyfox,crackling", "longcheer,l8150"; + lk2nd,match-bootloader = "crackling-*"; + + panel { + compatible = "longcheer,l8150-panel", "lk2nd,panel"; + + /* TODO: qcom,mdss_dsi_truly_otm1288a_720p_video */ + qcom,mdss_dsi_dijing_ILI9881C_720p_video { + compatible = "longcheer,dijing-ili9881c"; + }; + qcom,mdss_dsi_booyi_OTM1287_720p_video { + compatible = "longcheer,booyi-otm1287"; + }; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8916/rules.mk b/lk2nd/device/dts/msm8916/rules.mk new file mode 100644 index 000000000..78e63071c --- /dev/null +++ b/lk2nd/device/dts/msm8916/rules.mk @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +LOCAL_DIR := $(GET_LOCAL_DIR) + +QCDTBS += \ + $(LOCAL_DIR)/apq8016-sbc.dtb \ + $(LOCAL_DIR)/msm8916-motorola-harpia-p1b-4d.dtb \ + $(LOCAL_DIR)/msm8916-motorola-harpia-p1b-4e.dtb \ + $(LOCAL_DIR)/msm8916-qrd-7+12.dtb \ + $(LOCAL_DIR)/msm8916-qrd-9.dtb \ + $(LOCAL_DIR)/samsung.dtb \ diff --git a/lk2nd/device/dts/msm8916/samsung.dts b/lk2nd/device/dts/msm8916/samsung.dts new file mode 100644 index 000000000..7b15e59d2 --- /dev/null +++ b/lk2nd/device/dts/msm8916/samsung.dts @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include + +#define I2C_GPIO_FLAGS (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN | GPIO_BIAS_DISABLE) + +/ { + /* TODO: Add more */ + qcom,msm-id = ; + qcom,board-id = <0xCE08FF01 1>, <0xCE08FF01 3>, <0xCE08FF01 7>; +}; + +&lk2nd { + a3lte { + model = "Samsung Galaxy A3 (SM-A300F)"; + compatible = "samsung,a3lte", "samsung,a3"; + lk2nd,match-bootloader = "A300F*"; + + qcom,msm-id = ; + qcom,board-id = <0xCE08FF01 1>; + + gpio-keys { + compatible = "gpio-keys"; + home { + lk2nd,code = ; + gpios = <&tlmm 109 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + }; + + gt58lte { + model = "Samsung Galaxy Tab A 8.0 (LTE, SM-T355)"; + compatible = "samsung,gt58lte", "samsung,gt58"; + lk2nd,match-bootloader = "T355*"; + + qcom,msm-id = ; + qcom,board-id = <0xCE08FF01 1>; + + gpio-keys { + compatible = "gpio-keys"; + home { + lk2nd,code = ; + gpios = <&tlmm 109 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + }; + + gt510lte { + model = "Samsung Galaxy Tab A 9.7 (LTE, SM-T555)"; + compatible = "samsung,gt510lte", "samsung,gt510"; + lk2nd,match-bootloader = "T555*"; + + qcom,msm-id = ; + qcom,board-id = <0xCE08FF01 7>; + + gpio-keys { + compatible = "gpio-keys"; + home { + lk2nd,code = ; + gpios = <&tlmm 109 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + }; + + serranovelte { + model = "Samsung Galaxy S4 Mini Value Edition"; + compatible = "samsung,serranovelte", "samsung,serranove"; + lk2nd,match-bootloader = "I9195I*"; + + qcom,msm-id = ; + qcom,board-id = <0xCE08FF01 3>; + + muic-reset { + compatible = "samsung,muic-reset"; + i2c-reg = <0x14>; + i2c-sda-gpios = <&tlmm 105 I2C_GPIO_FLAGS>; + i2c-scl-gpios = <&tlmm 106 I2C_GPIO_FLAGS>; + }; + + gpio-keys { + compatible = "gpio-keys"; + home { + lk2nd,code = ; + gpios = <&tlmm 109 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8960/bundle.dts b/lk2nd/device/dts/msm8960/bundle.dts new file mode 100644 index 000000000..122c7ac26 --- /dev/null +++ b/lk2nd/device/dts/msm8960/bundle.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: BSD-3-Clause +#include +#include + +&lk2nd { + samsung-serrano { + model = "Samsung Galaxy S4 Mini (GT-I9195)"; + compatible = "samsung,serranolte", "samsung,serrano"; + lk2nd,match-bootloader = "I9195*"; + + gpio-keys { + compatible = "gpio-keys"; + + volume-up { + lk2nd,code = ; + gpios = <&tlmm 50 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + volume-down { + lk2nd,code = ; + gpios = <&tlmm 81 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + home { + lk2nd,code = ; + gpios = <&tlmm 35 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8960/rules.mk b/lk2nd/device/dts/msm8960/rules.mk new file mode 100644 index 000000000..84a61b30b --- /dev/null +++ b/lk2nd/device/dts/msm8960/rules.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +LOCAL_DIR := $(GET_LOCAL_DIR) + +DTBS += \ + $(LOCAL_DIR)/bundle.dtb \ diff --git a/lk2nd/device/dts/msm8974/rules.mk b/lk2nd/device/dts/msm8974/rules.mk new file mode 100644 index 000000000..8e14c5e8c --- /dev/null +++ b/lk2nd/device/dts/msm8974/rules.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +LOCAL_DIR := $(GET_LOCAL_DIR) + +QCDTBS += \ + $(LOCAL_DIR)/samsung.dtb \ diff --git a/lk2nd/device/dts/msm8974/samsung.dts b/lk2nd/device/dts/msm8974/samsung.dts new file mode 100644 index 000000000..86e4aec0b --- /dev/null +++ b/lk2nd/device/dts/msm8974/samsung.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include + +/ { + qcom,msm-id = <0xC208FF01 14 0x10000>; +}; + +&lk2nd { + klte { + model = "Samsung Galaxy S5 (SM-G900F)"; + compatible = "samsung,klte"; + lk2nd,match-bootloader = "G900F*"; + + gpio-keys { + compatible = "gpio-keys"; + home { + lk2nd,code = ; + gpios = <&pmic 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; + }; + }; +}; diff --git a/lk2nd/device/dts/msm8996/msm8996pro-oneplus3t.dts b/lk2nd/device/dts/msm8996/msm8996pro-oneplus3t.dts new file mode 100644 index 000000000..7de1aaac6 --- /dev/null +++ b/lk2nd/device/dts/msm8996/msm8996pro-oneplus3t.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: BSD-3-Clause + +#include +#include + +/ { + model = "OnePlus 3T"; + qcom,msm-id = ; + qcom,board-id = <8 0 15811 26>, + <8 0 15811 27>, + <8 0 15811 28>; + qcom,pmic-id = <0x20009 0x10013 0x0 0x0>; +}; + +&lk2nd { + model = "OnePlus 3T"; + compatible = "oneplus,oneplus3t"; +}; diff --git a/lk2nd/device/dts/msm8996/rules.mk b/lk2nd/device/dts/msm8996/rules.mk new file mode 100644 index 000000000..474361a26 --- /dev/null +++ b/lk2nd/device/dts/msm8996/rules.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +LOCAL_DIR := $(GET_LOCAL_DIR) + +ADTBS += \ + $(LOCAL_DIR)/msm8996pro-oneplus3t.dtb \ diff --git a/project/lk2nd-msm8960.mk b/project/lk2nd-msm8960.mk index 9410dda0d..2a75a0a25 100644 --- a/project/lk2nd-msm8960.mk +++ b/project/lk2nd-msm8960.mk @@ -1,3 +1,4 @@ # SPDX-License-Identifier: BSD-3-Clause TARGET := msm8960 +LK2ND_BUNDLE_DTB ?= bundle.dtb include lk2nd/project/lk2nd.mk From 50e806d2a9cf9631814de0ad043744b01a1065ca Mon Sep 17 00:00:00 2001 From: fekz115 Date: Tue, 2 Aug 2022 22:17:52 +0300 Subject: [PATCH 3/3] lk2nd: dts: msm8994: include xiaomi-libra dts Signed-off-by: Eugene Lepshy --- lk2nd/device/dts/msm8994/rules.mk | 4 ++++ lk2nd/device/dts/msm8994/xiaomi-libra.dts | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 lk2nd/device/dts/msm8994/rules.mk create mode 100644 lk2nd/device/dts/msm8994/xiaomi-libra.dts diff --git a/lk2nd/device/dts/msm8994/rules.mk b/lk2nd/device/dts/msm8994/rules.mk new file mode 100644 index 000000000..8c2bdfcaa --- /dev/null +++ b/lk2nd/device/dts/msm8994/rules.mk @@ -0,0 +1,4 @@ +LOCAL_DIR := $(GET_LOCAL_DIR) + +ADTBS += \ + $(LOCAL_DIR)/xiaomi-libra.dtb \ diff --git a/lk2nd/device/dts/msm8994/xiaomi-libra.dts b/lk2nd/device/dts/msm8994/xiaomi-libra.dts new file mode 100644 index 000000000..2e67f9b90 --- /dev/null +++ b/lk2nd/device/dts/msm8994/xiaomi-libra.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include +#include + +/ { + qcom,msm-id = , <252 0>; + qcom,board-id = <12 0>; +}; + +&lk2nd { + libra { + model = "Xiaomi Mi 4C"; + compatible = "xiaomi,libra"; + + qcom,board-id = <12 0>; + qcom,pmic-id = <65545 65546 0 0>; + }; +};