From d4552d400908415d5a43ba6af0db1cc35314de6f Mon Sep 17 00:00:00 2001
From: Otto Urpelainen <oturpe@iki.fi>
Date: Sat, 26 Sep 2020 11:57:28 +0300
Subject: [PATCH] Include cust.dtsi created by DrvGen instead of running DrvGen
 during build

DrvGen is a MediaTek proprietary tool that automatically generates device
tree files. Getting the tool to run in postmarketOS build environment is quite
challenging, as the tool has been built using glibc, but postmarketOS uses
musl. Disabling the tool execution here, instead the generated file is directly
in the source tree.

Signed-off-by: Maanush Putcha <p.maanush@gmail.com>
---
 arch/arm64/Makefile         |   2 +-
 arch/arm64/boot/dts/manning/cust.dtsi | 685 ++++++++++++++++++++++++++++++++++++
 2 files changed, 686 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/boot/dts/manning

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 374c832bc22..413a162c78d 100755
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -76,7 +76,7 @@ all:	$(KBUILD_IMAGE) $(KBUILD_DTBS)
 MTK_PLATFORM := $(CONFIG_MTK_PLATFORM:"%"=%)
 MTK_PROJECT := $(CONFIG_ARCH_MTK_PROJECT:"%"=%)
 export MTK_PLATFORM MTK_PROJECT MTK_TARGET_PROJECT
--include $(srctree)/scripts/drvgen/drvgen.mk
+#-include $(srctree)/scripts/drvgen/drvgen.mk
 archprepare: $(DRVGEN_FILE_LIST)
 dtbs: $(DRVGEN_FILE_LIST)
 
diff --git a/arch/arm64/boot/dts/manning/cust.dtsi b/arch/arm64/boot/dts/manning/cust.dtsi
new file mode 100644
index 00000000000..d143df90a93
--- /dev/null
+++ b/arch/arm64/boot/dts/manning/cust.dtsi
@@ -0,0 +1,685 @@
+/*
+ * Generated by MTK SP DrvGen Version: 3.5.160809 for MT6797.
+ * 2025-08-06 14:39:10
+ * Do Not Modify The File.
+ * Copyright Mediatek Inc. (c) 2016.
+*/
+
+/*************************
+ * ADC DTSI File
+*************************/
+
+&auxadc {
+	adc_channel@ {
+		compatible = "mediatek,adc_channel";
+		mediatek,temperature0 = <0>;
+		mediatek,temperature1 = <1>;
+		mediatek,adc_fdd_rf_params_dynamic_custom_ch = <2>;
+		status = "okay";
+	};
+};
+
+
+/*************************
+ * CLK_BUF DTSI File
+*************************/
+
+&pmic_clock_buffer_ctrl {
+	mediatek,clkbuf-quantity = <4>;
+	mediatek,clkbuf-config = <0 0 0 0>;
+	mediatek,clkbuf-driving-current = <2 2 2 2>;
+	status = "okay";
+};
+
+&rf_clock_buffer_ctrl {
+	mediatek,clkbuf-quantity = <4>;
+	mediatek,clkbuf-config = <2 0 1 1>;
+	mediatek,clkbuf-driving-current = <2 2 2 2 >;
+	status = "okay";
+};
+
+
+/*************************
+ * I2C DTSI File
+*************************/
+
+&i2c0 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+	sw_charger_mtk:sw_charger@6a {
+		compatible = "mediatek,sw_charger";
+		reg = <0x6a>;
+		status = "okay";
+	};
+
+	i2c_lcd_bias_mtk:i2c_lcd_bias@3e {
+		compatible = "mediatek,i2c_lcd_bias";
+		reg = <0x3e>;
+		status = "okay";
+	};
+
+	buck_boost_mtk:buck_boost@70 {
+		compatible = "mediatek,buck_boost";
+		reg = <0x70>;
+		status = "okay";
+	};
+
+	strobe_main_mtk:strobe_main@63 {
+		compatible = "mediatek,strobe_main";
+		reg = <0x63>;
+		status = "okay";
+	};
+
+	smart_pa_mtk:smart_pa@58 {
+		compatible = "mediatek,smart_pa";
+		reg = <0x58>;
+		status = "okay";
+	};
+
+	usb_type_c_mtk:usb_type_c@22 {
+		compatible = "mediatek,usb_type_c";
+		reg = <0x22>;
+		status = "okay";
+	};
+
+};
+
+&i2c1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+	msensor_mtk:msensor@0c {
+		compatible = "mediatek,msensor";
+		reg = <0x0c>;
+		status = "okay";
+	};
+
+	gyro_mtk:gyro@69 {
+		compatible = "mediatek,gyro";
+		reg = <0x69>;
+		status = "okay";
+	};
+
+	gsensor_mtk:gsensor@68 {
+		compatible = "mediatek,gsensor";
+		reg = <0x68>;
+		status = "okay";
+	};
+
+	barometer_mtk:barometer@77 {
+		compatible = "mediatek,barometer";
+		reg = <0x77>;
+		status = "okay";
+	};
+
+	alsps_mtk:alsps@53 {
+		compatible = "mediatek,alsps";
+		reg = <0x53>;
+		status = "okay";
+	};
+
+	humidity_mtk:humidity@5f {
+		compatible = "mediatek,humidity";
+		reg = <0x5f>;
+		status = "okay";
+	};
+
+};
+
+&i2c2 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <300000>;
+	mediatek,use-open-drain;
+	camera_main_mtk:camera_main@36 {
+		compatible = "mediatek,camera_main";
+		reg = <0x36>;
+		status = "okay";
+	};
+
+	camera_main_af_mtk:camera_main_af@72 {
+		compatible = "mediatek,camera_main_af";
+		reg = <0x72>;
+		status = "okay";
+	};
+
+	camera_main_eeprom_mtk:camera_main_eeprom@37 {
+		compatible = "mediatek,camera_main_eeprom";
+		reg = <0x37>;
+		status = "okay";
+	};
+
+};
+
+&i2c3 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+	camera_sub_mtk:camera_sub@2d {
+		compatible = "mediatek,camera_sub";
+		reg = <0x2d>;
+		status = "okay";
+	};
+
+	camera_sub_af_mtk:camera_sub_af@0c {
+		compatible = "mediatek,camera_sub_af";
+		reg = <0x0c>;
+		status = "okay";
+	};
+
+	camera_sub_eeprom_mtk:camera_sub_eeprom@2e {
+		compatible = "mediatek,camera_sub_eeprom";
+		reg = <0x2e>;
+		status = "okay";
+	};
+
+};
+
+&i2c4 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+	cap_touch_mtk:cap_touch@38 {
+		compatible = "mediatek,cap_touch";
+		reg = <0x38>;
+		status = "okay";
+	};
+
+};
+
+&i2c5 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+	nfc_mtk:nfc@28 {
+		compatible = "mediatek,nfc";
+		reg = <0x28>;
+		status = "okay";
+	};
+
+};
+
+&i2c6 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <3400000>;
+	mediatek,use-push-pull;
+	vproc_buck_mtk:vproc_buck@68 {
+		compatible = "mediatek,vproc_buck";
+		reg = <0x68>;
+		status = "okay";
+	};
+
+};
+
+&i2c7 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <3400000>;
+	mediatek,use-push-pull;
+	vgpu_buck_mtk:vgpu_buck@60 {
+		compatible = "mediatek,vgpu_buck";
+		reg = <0x60>;
+		status = "okay";
+	};
+
+};
+
+&i2c8 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+	camera_main_hw_mtk:camera_main_hw@36 {
+		compatible = "mediatek,camera_main_hw";
+		reg = <0x36>;
+		status = "okay";
+	};
+
+};
+
+&i2c9 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	clock-frequency = <400000>;
+	mediatek,use-open-drain;
+};
+
+
+
+/*************************
+ * GPIO DTSI File
+*************************/
+
+&gpio_usage_mapping {
+	GPIO_SIM1_HOT_PLUG = <112>;
+	GPIO_SIM1_SCLK = <126>;
+	GPIO_SIM1_SRST = <127>;
+	GPIO_SIM1_SIO = <128>;
+	GPIO_SIM2_SCLK = <155>;
+	GPIO_SIM2_SRST = <156>;
+	GPIO_SIM2_SIO = <157>;
+};
+
+
+/*************************
+ * EINT DTSI File
+*************************/
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+&eintc {
+	mediatek,mapping_table_entry = <172>;
+			/* <gpio_pin, eint_pin> */
+	mediatek,mapping_table = <28 17>,
+					<29 18>,
+					<31 19>,
+					<32 20>,
+					<33 21>,
+					<34 22>,
+					<35 23>,
+					<36 24>,
+					<37 25>,
+					<38 26>,
+					<39 27>,
+					<40 28>,
+					<41 29>,
+					<42 30>,
+					<43 31>,
+					<44 32>,
+					<45 33>,
+					<46 34>,
+					<47 35>,
+					<48 36>,
+					<49 37>,
+					<50 38>,
+					<51 39>,
+					<52 40>,
+					<53 41>,
+					<54 42>,
+					<55 43>,
+					<56 44>,
+					<57 45>,
+					<58 46>,
+					<59 47>,
+					<60 48>,
+					<61 0>,
+					<62 1>,
+					<63 2>,
+					<64 3>,
+					<65 4>,
+					<66 5>,
+					<67 6>,
+					<68 7>,
+					<69 49>,
+					<70 50>,
+					<71 51>,
+					<72 52>,
+					<73 53>,
+					<74 54>,
+					<75 55>,
+					<76 56>,
+					<77 57>,
+					<78 58>,
+					<79 59>,
+					<80 60>,
+					<81 61>,
+					<82 62>,
+					<83 63>,
+					<84 64>,
+					<85 8>,
+					<86 9>,
+					<87 10>,
+					<88 11>,
+					<89 12>,
+					<90 13>,
+					<91 14>,
+					<92 15>,
+					<93 16>,
+					<94 65>,
+					<95 66>,
+					<96 67>,
+					<97 68>,
+					<98 69>,
+					<106 73>,
+					<107 74>,
+					<108 75>,
+					<109 76>,
+					<110 77>,
+					<111 78>,
+					<112 79>,
+					<113 80>,
+					<126 81>,
+					<127 82>,
+					<128 83>,
+					<129 84>,
+					<130 85>,
+					<131 86>,
+					<132 87>,
+					<133 88>,
+					<134 89>,
+					<135 90>,
+					<136 91>,
+					<137 92>,
+					<138 93>,
+					<139 94>,
+					<140 95>,
+					<141 96>,
+					<151 97>,
+					<152 98>,
+					<153 99>,
+					<154 100>,
+					<155 101>,
+					<156 102>,
+					<157 103>,
+					<179 104>,
+					<180 105>,
+					<181 106>,
+					<183 107>,
+					<184 108>,
+					<185 109>,
+					<186 110>,
+					<187 111>,
+					<188 112>,
+					<189 113>,
+					<190 114>,
+					<191 115>,
+					<192 116>,
+					<193 117>,
+					<194 118>,
+					<195 119>,
+					<196 120>,
+					<197 121>,
+					<198 122>,
+					<199 123>,
+					<200 124>,
+					<201 125>,
+					<202 126>,
+					<203 127>,
+					<204 128>,
+					<205 129>,
+					<206 130>,
+					<207 131>,
+					<208 132>,
+					<209 133>,
+					<210 134>,
+					<211 135>,
+					<212 136>,
+					<213 137>,
+					<214 138>,
+					<215 139>,
+					<216 140>,
+					<217 141>,
+					<218 142>,
+					<219 143>,
+					<232 144>,
+					<233 145>,
+					<234 146>,
+					<235 147>,
+					<236 148>,
+					<237 149>,
+					<238 150>,
+					<239 151>,
+					<240 152>,
+					<241 153>,
+					<242 154>,
+					<243 155>,
+					<244 156>,
+					<245 157>,
+					<246 158>,
+					<247 159>,
+					<248 160>,
+					<249 161>,
+					<250 162>,
+					<251 163>,
+					<252 164>,
+					<253 165>,
+					<254 166>,
+					<255 167>,
+					<256 168>,
+					<257 169>,
+					<258 170>,
+					<259 171>,
+					<260 172>,
+					<261 173>,
+					<262 176>;
+	mediatek,builtin_entry = <4>;
+					/* gpio, built-in func mode, built-in eint */
+	mediatek,builtin_mapping = <61 2 186>, /* 2:IDDIG */
+					<93 2 186>, /* 2:IDDIG */
+					<181 1 186>, /* 1:IDDIG */
+					<107 2 186>;};
+
+&ext_buck_oc {
+	interrupt-parent = <&eintc>;
+	interrupts = <61 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <61 0>;
+	status = "okay";
+};
+
+&gyro {
+	interrupt-parent = <&eintc>;
+	interrupts = <63 IRQ_TYPE_LEVEL_HIGH>;
+	debounce = <63 0>;
+	status = "okay";
+};
+
+&mse {
+	interrupt-parent = <&eintc>;
+	interrupts = <64 IRQ_TYPE_LEVEL_HIGH>;
+	debounce = <64 0>;
+	status = "okay";
+};
+
+&chr_stat {
+	interrupt-parent = <&eintc>;
+	interrupts = <66 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <66 0>;
+	status = "okay";
+};
+
+&touch {
+	interrupt-parent = <&eintc>;
+	interrupts = <68 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <68 0>;
+	status = "okay";
+};
+
+&goodix_fp {
+	interrupt-parent = <&eintc>;
+	interrupts = <86 IRQ_TYPE_LEVEL_HIGH>;
+	debounce = <86 0>;
+	status = "okay";
+};
+
+&eint_fusb300_det_in {
+	interrupt-parent = <&eintc>;
+	interrupts = <87 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <87 0>;
+	status = "okay";
+};
+
+&alsps_mtk {
+	interrupt-parent = <&eintc>;
+	interrupts = <88 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <88 0>;
+	status = "okay";
+};
+
+&accdet {
+	interrupt-parent = <&eintc>;
+	interrupts = <92 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <92 256000>;
+	status = "okay";
+};
+
+&mrdump_ext_rst {
+	interrupt-parent = <&eintc>;
+	interrupts = <93 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <93 512000>;
+	status = "okay";
+};
+
+&irq_nfc {
+	interrupt-parent = <&eintc>;
+	interrupts = <58 IRQ_TYPE_LEVEL_HIGH>;
+	debounce = <58 0>;
+	status = "okay";
+};
+
+&dsi_te {
+	interrupt-parent = <&eintc>;
+	interrupts = <179 IRQ_TYPE_EDGE_RISING>;
+	debounce = <179 0>;
+	status = "okay";
+};
+
+&otg_iddig {
+	interrupt-parent = <&eintc>;
+	interrupts = <181 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <181 0>;
+	status = "okay";
+};
+
+&swtp {
+	interrupt-parent = <&eintc>;
+	interrupts = <215 IRQ_TYPE_LEVEL_LOW>;
+	debounce = <215 256000>;
+	status = "okay";
+};
+
+
+
+/*************************
+ * MD1_EINT DTSI File
+*************************/
+
+&eintc {
+	MD1_SIM1_HOT_PLUG_EINT@0 {
+		compatible = "mediatek,MD1_SIM1_HOT_PLUG_EINT-eint";
+		interrupts = <0 8>;
+		debounce = <0 100000>;
+		dedicated = <0 0>;
+		src_pin = <0 1>;
+		sockettype = <0 0>;
+		status = "okay";
+	};
+
+	MD1_SIM2_HOT_PLUG_EINT@1 {
+		compatible = "mediatek,MD1_SIM2_HOT_PLUG_EINT-eint";
+		interrupts = <1 8>;
+		debounce = <1 100000>;
+		dedicated = <1 0>;
+		src_pin = <1 0>;
+		sockettype = <1 0>;
+		status = "okay";
+	};
+
+};
+
+
+/*************************
+ * PMIC DTSI File
+*************************/
+
+&mt_pmic_vcama_ldo_reg {
+	regulator-name = "vcama";
+	regulator-default-on = <1>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vsim1_ldo_reg {
+	regulator-name = "vsim1";
+	regulator-default-on = <1>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vsim2_ldo_reg {
+	regulator-name = "vsim2";
+	regulator-default-on = <1>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vldo28_ldo_reg {
+	regulator-name = "vldo28";
+	regulator-default-on = <2>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vgp3_ldo_reg {
+	regulator-name = "vgp3";
+	regulator-default-on = <0>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vibr_ldo_reg {
+	regulator-name = "vibr";
+	regulator-default-on = <1>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vcamd_ldo_reg {
+	regulator-name = "vcamd";
+	regulator-default-on = <1>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+&mt_pmic_vcamio_ldo_reg {
+	regulator-name = "vcamio";
+	regulator-default-on = <1>; /* 0:skip, 1: off, 2:on */
+	status = "okay";
+};
+
+&kd_camera_hw1 {
+	vcama-supply = <&mt_pmic_vcama_ldo_reg>;
+	vcama_main2-supply = <&mt_pmic_vcama_ldo_reg>;
+	vcama_sub-supply = <&mt_pmic_vcama_ldo_reg>;
+	vcamaf-supply = <&mt_pmic_vldo28_ldo_reg>;
+	vcamaf_main2-supply = <&mt_pmic_vldo28_ldo_reg>;
+	vcamaf_sub-supply = <&mt_pmic_vldo28_ldo_reg>;
+	vcamd-supply = <&mt_pmic_vcamd_ldo_reg>;
+	vcamd_main2-supply = <&mt_pmic_vcamd_ldo_reg>;
+	vcamd_sub-supply = <&mt_pmic_vcamd_ldo_reg>;
+	vcamio-supply = <&mt_pmic_vcamio_ldo_reg>;
+	vcamio_main2-supply = <&mt_pmic_vcamio_ldo_reg>;
+	vcamio_sub-supply = <&mt_pmic_vcamio_ldo_reg>;
+	status = "okay";
+};
+
+&touch {
+	vtouch-supply = <&mt_pmic_vldo28_ldo_reg>;
+	status = "okay";
+};
+
+
+/*************************
+ * POWER DTSI File
+*************************/
+
+
+
+/*************************
+ * KPD DTSI File
+*************************/
+
+&keypad {
+	mediatek,kpd-key-debounce = <1024>;
+	mediatek,kpd-sw-pwrkey = <116>;
+	mediatek,kpd-hw-pwrkey = <8>;
+	mediatek,kpd-sw-rstkey  = <114>;
+	mediatek,kpd-hw-rstkey = <17>;
+	mediatek,kpd-use-extend-type = <0>;
+	/*HW Keycode [0~71] -> Linux Keycode*/
+	mediatek,kpd-hw-map-num = <72>;
+	mediatek,kpd-hw-init-map = <115 485 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >;
+	mediatek,kpd-pwrkey-eint-gpio = <0>;
+	mediatek,kpd-pwkey-gpio-din  = <0>;
+	mediatek,kpd-hw-dl-key0 = <0>;
+	mediatek,kpd-hw-dl-key1 = <17>;
+	mediatek,kpd-hw-dl-key2 = <8>;
+	mediatek,kpd-hw-recovery-key = <0>;
+	mediatek,kpd-hw-factory-key = <17>;
+	status = "okay";
+};
+
+
-- 
2.50.1

