// SPDX-License-Identifier: BSD-3-Clause
/*
 * Copyright (c) 2021, AngeloGioacchino Del Regno
 *                     <angelogioacchino.delregno@somainline.org>
 * Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org>
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include "msm8998.dtsi"
#include "pm8005.dtsi"
#include "pm8998.dtsi"
#include "pmi8998.dtsi"

/ {
	/* required for bootloader to select correct board */
	qcom,msm-id = <0x124 0x20000>, <0x124 0x20001>; /* 8998v2, v2.1 */
	qcom,board-id = <8 0>;

	clocks {
		div1_mclk: divclk1 {
			compatible = "gpio-gate-clock";
			pinctrl-0 = <&div_clk1>;
			pinctrl-names = "default";
			clocks = <&rpmcc RPM_SMD_DIV_CLK1>;
			#clock-cells = <0>;
			enable-gpios = <&pm8998_gpios 13 GPIO_ACTIVE_HIGH>;
		};
	};

	board_vbat: vbat-regulator {
		compatible = "regulator-fixed";
		regulator-name = "VBAT";

		regulator-min-microvolt = <4000000>;
		regulator-max-microvolt = <4000000>;
		regulator-always-on;
		regulator-boot-on;
	};

	cam0_vdig_vreg: cam0-vdig {
		compatible = "regulator-fixed";
		regulator-name = "cam0_vdig";
		startup-delay-us = <0>;
		enable-active-high;
		gpio = <&tlmm 21 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&main_cam_pwr_en>;
	};

	cam1_vdig_vreg: cam1-vdig {
		compatible = "regulator-fixed";
		regulator-name = "cam1_vdig";
		startup-delay-us = <0>;
		enable-active-high;
		gpio = <&tlmm 25 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&chat_cam_pwr_en>;
		vin-supply = <&vreg_s3a_1p35>;
	};

	cam_vio_vreg: cam-vio-vreg {
		compatible = "regulator-fixed";
		regulator-name = "cam_vio_vreg";
		startup-delay-us = <0>;
		enable-active-high;
		gpio = <&pmi8998_gpios 1 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&main_cam_pwr_io_en>;
		vin-supply = <&vreg_lvs1a_1p8>;
	};

	touch_vddio_vreg: touch-vddio-vreg {
		compatible = "regulator-fixed";
		regulator-name = "touch_vddio_vreg";
		startup-delay-us = <10000>;
		gpio = <&tlmm 133 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&ts_vddio_en>;
	};

	vph_pwr: vph-pwr-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vph_pwr";
		regulator-always-on;
		regulator-boot-on;
	};

	extcon_usb: extcon-usb {
		compatible = "linux,extcon-usb-gpio";
		id-gpios = <&tlmm 38 GPIO_ACTIVE_HIGH>;
		vbus-gpios = <&tlmm 128 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&cc_dir_default &usb_detect_en>;
	};

	gpio-keys {
		compatible = "gpio-keys";
		label = "Side buttons";
		pinctrl-0 = <&focus_n &snapshot_n &vol_down_n &vol_up_n>;
		pinctrl-names = "default";
		button-camera-focus {
			label = "Camera Focus";
			gpios = <&pm8998_gpios 8 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_CAMERA_FOCUS>;
			debounce-interval = <15>;
		};

		button-camera-snapshot {
			label = "Camera Snapshot";
			gpios = <&pm8998_gpios 7 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_CAMERA>;
			debounce-interval = <15>;
		};

		button-vol-down {
			label = "Volume Down";
			gpios = <&pm8998_gpios 5 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_VOLUMEDOWN>;
			wakeup-source;
			debounce-interval = <15>;
		};

		button-vol-up {
			label = "Volume Up";
			gpios = <&pm8998_gpios 6 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_VOLUMEUP>;
			wakeup-source;
			debounce-interval = <15>;
		};
	};

	gpio-hall-sensor {
		compatible = "gpio-keys";
		label = "Hall sensors";
		pinctrl-names = "default";
		pinctrl-0 = <&acc_cover_open>;

		event-hall-sensor0 {
			label = "Cover Hall Sensor";
			gpios = <&tlmm 124 GPIO_ACTIVE_LOW>;
			linux,input-type = <EV_SW>;
			linux,code = <SW_LID>;
			wakeup-source;
			debounce-interval = <30>;
		};
	};

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		hyp_mem: memory@85800000 {
			reg = <0x0 0x85800000 0x0 0x3700000>;
			no-map;
		};

		cont_splash_mem: memory@9d400000 {
			reg = <0x0 0x9d400000 0x0 0x2400000>;
			no-map;
		};

		zap_shader_region: memory@f6400000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0xf6400000 0x0 0x2000>;
			no-map;
		};

		adsp_region: memory@fe000000 {
			reg = <0x0 0xfe000000 0x0 0x800000>;
			no-map;
		};

		qseecom_region: memory@fe800000 {
			reg = <0x0 0xfe800000 0x0 0x1400000>;
			no-map;
		};

		ramoops@ffc00000 {
			compatible = "ramoops";
			reg = <0x0 0xffc00000 0x0 0x100000>;
			record-size = <0x10000>;
			console-size = <0x60000>;
			ftrace-size = <0x10000>;
			pmsg-size = <0x20000>;
			ecc-size = <16>;
		};
	};

	vibrator {
		compatible = "gpio-vibrator";
		enable-gpios = <&pmi8998_gpios 5 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&vib_ldo_en>;
	};
};

&blsp1_i2c5 {
	status = "okay";
	clock-frequency = <355000>;

	touchscreen@2c {
		compatible = "syna,rmi4-i2c";
		reg = <0x2c>;
		#address-cells = <1>;
		#size-cells = <0>;
		interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>;

		pinctrl-names = "default";
		pinctrl-0 = <&ts_int_n>;

		vdd-supply = <&vreg_l28_3p0>;
		vio-supply = <&touch_vddio_vreg>;

		syna,reset-delay-ms = <220>;
		syna,startup-delay-ms = <1000>;

		rmi4-f01@1 {
			reg = <0x01>;
			syna,nosleep-mode = <1>;
		};

		rmi4-f11@11 {
			reg = <0x11>;
			syna,sensor-type = <1>;
		};
	};
};

&blsp1_i2c5_sleep {
	bias-disable;
};

&blsp1_uart3 {
	status = "okay";

	bluetooth {
		compatible = "qcom,wcn3990-bt";

		vddio-supply = <&vreg_s4a_1p8>;
		vddxo-supply = <&vreg_l7a_1p8>;
		vddrf-supply = <&vreg_l17a_1p3>;
		vddch0-supply = <&vreg_l25a_3p3>;
		max-speed = <3200000>;

		clocks = <&rpmcc RPM_SMD_RF_CLK2_PIN>;
	};
};

&blsp2_uart1 {
	status = "okay";
};

&blsp2_i2c2 {
	status = "okay";

	proximity@29 {
		compatible = "st,vl53l0x";
		reg = <0x29>;

		interrupt-parent = <&tlmm>;
		interrupts = <22 IRQ_TYPE_EDGE_FALLING>;

		reset-gpios = <&tlmm 27 GPIO_ACTIVE_LOW>;
		vdd-supply = <&cam_vio_vreg>;

		pinctrl-names = "default";
		pinctrl-0 = <&tof_int_n &tof_reset>;
	};
};

&ibb {
	regulator-min-microamp = <800000>;
	regulator-max-microamp = <800000>;
	regulator-enable-ramp-delay = <200>;
	regulator-over-current-protection;
	regulator-pull-down;
	regulator-ramp-delay = <1>;
	regulator-settling-time-up-us = <600>;
	regulator-settling-time-down-us = <1000>;
	regulator-soft-start;
	qcom,discharge-resistor-kohms = <300>;
};

&lab {
	regulator-min-microamp = <200000>;
	regulator-max-microamp = <200000>;
	regulator-enable-ramp-delay = <500>;
	regulator-over-current-protection;
	regulator-pull-down;
	regulator-ramp-delay = <1>;
	regulator-settling-time-up-us = <50000>;
	regulator-settling-time-down-us = <3000>;
	regulator-soft-start;
};

&pm8005_gpios {
	gpio-line-names = "NC", /* GPIO_1 */
			  "NC",
			  "SLB",
			  "OPTION_1_PM8005";
};

&pm8005_regulators {
	/* VDD_GFX supply */
	pm8005_s1: s1 {
		regulator-min-microvolt = <524000>;
		regulator-max-microvolt = <1088000>;
		regulator-enable-ramp-delay = <500>;
		/* Hack until we rig up the gpu consumer */
		regulator-always-on;
	};
};

&pm8998_gpios {
	gpio-line-names = "UIM_BATT_ALARM", /* GPIO_1 */
			  "NC",
			  "WLAN_SW_CTRL (DISALLOWED)",
			  "SSC_PWR_EN",
			  "VOL_DOWN_N",
			  "VOL_UP_N",
			  "SNAPSHOT_N",
			  "FOCUS_N",
			  "FLASH_THERM",
			  "", /* GPIO_10 */
			  "",
			  "",
			  "DIV_CLK1",
			  "NC",
			  "NC (DISALLOWED)",
			  "DIV_CLK3",
			  "NC",
			  "NC",
			  "NC",
			  "NC (DISALLOWED)", /* GPIO_20 */
			  "NFC_CLK_REQ",
			  "NC (DISALLOWED)",
			  "WCSS_PWR_REQ",
			  "OPTION_1 (DISALLOWED)",
			  "OPTION_2 (DISALLOWED)",
			  "PM_SLB (DISALLOWED)";

	vol_down_n: vol-down-n-state {
		pins = "gpio5";
		function = PMIC_GPIO_FUNC_NORMAL;
		bias-pull-up;
		input-enable;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
	};

	vol_up_n: vol-up-n-state {
		pins = "gpio6";
		function = PMIC_GPIO_FUNC_NORMAL;
		bias-pull-up;
		input-enable;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
	};

	focus_n: focus-n-state {
		pins = "gpio7";
		function = PMIC_GPIO_FUNC_NORMAL;
		bias-pull-up;
		input-enable;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
	};

	snapshot_n: snapshot-n-state {
		pins = "gpio8";
		function = PMIC_GPIO_FUNC_NORMAL;
		bias-pull-up;
		input-enable;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
	};

	div_clk1: div-clk1-state {
		pins = "gpio13";
		function = "func2";
		power-source = <0>;
	};
};

&pmi8998_gpios {
	gpio-line-names = "MAIN_CAM_PWR_IO_EN", /* GPIO_1 */
			  "NC",
			  "NC",
			  "TYPEC_UUSB_SEL",
			  "VIB_LDO_EN",
			  "NC",
			  "DISPLAY_TYPE_SEL",
			  "NC",
			  "NC",
			  "NC", /* GPIO_10 */
			  "NC",
			  "DIV_CLK3",
			  "SPMI_I2C_SEL",
			  "NC";

	main_cam_pwr_io_en: main-cam-pwr-io-en-state {
		pins = "gpio1";
		function = PMIC_GPIO_FUNC_NORMAL;
		bias-disable;
		drive-push-pull;
		output-low;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_HIGH>;
		power-source = <1>;
	};

	vib_ldo_en: vib-ldo-en-state {
		pins = "gpio5";
		function = PMIC_GPIO_FUNC_NORMAL;
		bias-disable;
		drive-push-pull;
		output-low;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
		power-source = <0>;
	};
};

&pmi8998_lpg {
	qcom,power-source = <1>;

	status = "okay";

	multi-led {
		color = <LED_COLOR_ID_RGB>;
		function = LED_FUNCTION_STATUS;

		#address-cells = <1>;
		#size-cells = <0>;

		led@3 {
			reg = <3>;
			color = <LED_COLOR_ID_BLUE>;
		};

		led@4 {
			reg = <4>;
			color = <LED_COLOR_ID_GREEN>;
		};

		led@5 {
			reg = <5>;
			color = <LED_COLOR_ID_RED>;
		};
	};
};

&qusb2phy {
	status = "okay";

	vdda-pll-supply = <&vreg_l12a_1p8>;
	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
};

&rpm_requests {
	regulators-0 {
		compatible = "qcom,rpm-pm8998-regulators";

		vdd_s1-supply = <&vph_pwr>;
		vdd_s2-supply = <&vph_pwr>;
		vdd_s3-supply = <&vph_pwr>;
		vdd_s4-supply = <&vph_pwr>;
		vdd_s5-supply = <&vph_pwr>;
		vdd_s6-supply = <&vph_pwr>;
		vdd_s7-supply = <&vph_pwr>;
		vdd_s8-supply = <&vph_pwr>;
		vdd_s9-supply = <&vph_pwr>;
		vdd_s10-supply = <&vph_pwr>;
		vdd_s11-supply = <&vph_pwr>;
		vdd_s12-supply = <&vph_pwr>;
		vdd_s13-supply = <&vph_pwr>;
		vdd_l1_l27-supply = <&vreg_s7a_1p025>;
		vdd_l2_l8_l17-supply = <&vreg_s3a_1p35>;
		vdd_l3_l11-supply = <&vreg_s7a_1p025>;
		vdd_l4_l5-supply = <&vreg_s7a_1p025>;
		vdd_l6-supply = <&vreg_s5a_2p04>;
		vdd_l7_l12_l14_l15-supply = <&vreg_s5a_2p04>;
		vdd_l9-supply = <&vreg_bob>;
		vdd_l10_l23_l25-supply = <&vreg_bob>;
		vdd_l13_l19_l21-supply = <&vreg_bob>;
		vdd_l16_l28-supply = <&vreg_bob>;
		vdd_l18_l22-supply = <&vreg_bob>;
		vdd_l20_l24-supply = <&vreg_bob>;
		vdd_l26-supply = <&vreg_s3a_1p35>;
		vdd_lvs1_lvs2-supply = <&vreg_s4a_1p8>;

		vreg_s3a_1p35: s3 {
			regulator-min-microvolt = <1352000>;
			regulator-max-microvolt = <1352000>;
		};

		vreg_s4a_1p8: s4 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-system-load = <100000>;
			regulator-allow-set-load;
		};

		vreg_s5a_2p04: s5 {
			regulator-min-microvolt = <1904000>;
			regulator-max-microvolt = <2032000>;
		};

		vreg_s7a_1p025: s7 {
			regulator-min-microvolt = <900000>;
			regulator-max-microvolt = <1028000>;
		};

		vreg_l1a_0p875: l1 {
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <880000>;
			regulator-system-load = <73400>;
			regulator-allow-set-load;
		};

		vreg_l2a_1p2: l2 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-system-load = <12560>;
			regulator-allow-set-load;
		};

		vreg_l3a_1p0: l3 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};

		vreg_l5a_0p8: l5 {
			regulator-min-microvolt = <800000>;
			regulator-max-microvolt = <800000>;
		};

		vreg_l6a_1p8: l6 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		vreg_l7a_1p8: l7 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		vreg_l8a_1p2: l8 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
		};

		vreg_l9a_1p8: l9 {
			regulator-min-microvolt = <1808000>;
			regulator-max-microvolt = <2960000>;
		};

		vreg_l10a_1p8: l10 {
			regulator-min-microvolt = <1808000>;
			regulator-max-microvolt = <2960000>;
		};

		vreg_l11a_1p0: l11 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};

		vreg_l12a_1p8: l12 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		vreg_l13a_2p95: l13 {
			regulator-min-microvolt = <1808000>;
			regulator-max-microvolt = <2960000>;
			regulator-allow-set-load;
		};

		vreg_l14a_1p85: l14 {
			regulator-min-microvolt = <1848000>;
			regulator-max-microvolt = <1856000>;
			regulator-system-load = <32000>;
			regulator-allow-set-load;
		};

		vreg_l15a_1p8: l15 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		vreg_l16a_2p7: l16 {
			regulator-min-microvolt = <2704000>;
			regulator-max-microvolt = <2704000>;
		};

		vreg_l17a_1p3: l17 {
			regulator-min-microvolt = <1304000>;
			regulator-max-microvolt = <1304000>;
		};

		vreg_l18a_2p85: l18 { };

		vreg_l19a_2p7: l19 {
			regulator-min-microvolt = <2696000>;
			regulator-max-microvolt = <2704000>;
		};

		vreg_l20a_2p95: l20 {
			regulator-min-microvolt = <2960000>;
			regulator-max-microvolt = <2960000>;
			regulator-system-load = <10000>;
			regulator-allow-set-load;
		};

		vreg_l21a_2p95: l21 {
			regulator-min-microvolt = <2960000>;
			regulator-max-microvolt = <2960000>;
			regulator-system-load = <800000>;
			regulator-allow-set-load;
		};

		vreg_l22a_2p85: l22 { };

		vreg_l23a_3p3: l23 {
			regulator-min-microvolt = <3312000>;
			regulator-max-microvolt = <3312000>;
		};

		vreg_l24a_3p075: l24 {
			regulator-min-microvolt = <3088000>;
			regulator-max-microvolt = <3088000>;
		};

		vreg_l25a_3p3: l25 {
			regulator-min-microvolt = <3104000>;
			regulator-max-microvolt = <3312000>;
		};

		vreg_l26a_1p2: l26 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-allow-set-load;
		};

		vreg_l28_3p0: l28 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
		};

		vreg_lvs1a_1p8: lvs1 { };

		vreg_lvs2a_1p8: lvs2 { };
	};

	regulators-1 {
		compatible = "qcom,rpm-pmi8998-regulators";

		vdd_bob-supply = <&vph_pwr>;

		vreg_bob: bob {
			regulator-min-microvolt = <3312000>;
			regulator-max-microvolt = <3600000>;
		};
	};
};

&sdhc2 {
	status = "okay";
	cd-gpios = <&tlmm 95 GPIO_ACTIVE_HIGH>;

	vmmc-supply = <&vreg_l21a_2p95>;
	vqmmc-supply = <&vreg_l13a_2p95>;

	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sdc2_on &sdc2_cd>;
	pinctrl-1 = <&sdc2_off &sdc2_cd>;
};

&tlmm {
	gpio-reserved-ranges = <0 4>, <81 4>;
	gpio-line-names = "", /* GPIO_0 */
			  "",
			  "",
			  "",
			  "DEBUG_UART_TX",
			  "DEBUG_UART_RX",
			  "CAMSENSOR_I2C_SDA",
			  "CAMSENSOR_I2C_SCL",
			  "NC",
			  "NC",
			  "MDP_VSYNC_P", /* GPIO_10 */
			  "RGBC_IR_INT",
			  "NFC_VEN",
			  "CAM_MCLK0",
			  "CAM_MCLK1",
			  "NC",
			  "NC",
			  "CCI_I2C_SDA0",
			  "CCI_I2C_SCL0",
			  "CCI_I2C_SDA1",
			  "CCI_I2C_SCL1", /* GPIO_20 */
			  "MAIN_CAM_PWR_EN",
			  "TOF_INT_N",
			  "NC",
			  "NC",
			  "CHAT_CAM_PWR_EN",
			  "NC",
			  "TOF_RESET_N",
			  "CAM2_RSTN",
			  "NC",
			  "CAM1_RSTN", /* GPIO_30 */
			  "NC",
			  "NC",
			  "NC",
			  "NC",
			  "NC",
			  "NC",
			  "NC",
			  "CC_DIR",
			  "UIM2_DETECT_EN",
			  "FP_RESET_N", /* GPIO_40 */
			  "NC",
			  "NC",
			  "NC",
			  "NC",
			  "BT_HCI_UART_TXD",
			  "BT_HCI_UART_RXD",
			  "BT_HCI_UART_CTS_N",
			  "BT_HCI_UART_RFR_N",
			  "NC",
			  "NC", /* GPIO_50 */
			  "NC",
			  "NC",
			  "CODEC_INT2_N",
			  "CODEC_INT1_N",
			  "APPS_I2C_SDA",
			  "APPS_I2C_SCL",
			  "FORCED_USB_BOOT",
			  "NC",
			  "NC",
			  "NC", /* GPIO_60 */
			  "NC",
			  "NC",
			  "TRAY2_DET_DS",
			  "CODEC_RST_N",
			  "WSA_L_EN",
			  "WSA_R_EN",
			  "NC",
			  "NC",
			  "NC",
			  "LPASS_SLIMBUS_CLK", /* GPIO_70 */
			  "LPASS_SLIMBUS_DATA0",
			  "LPASS_SLIMBUS_DATA1",
			  "BT_FM_SLIMBUS_DATA",
			  "BT_FM_SLIMBUS_CLK",
			  "NC",
			  "RF_LCD_ID_EN",
			  "NC",
			  "NC",
			  "NC",
			  "NC", /* GPIO_80 */
			  "SW_SERVICE",
			  "TX_GTR_THRES_IN",
			  "HW_ID0",
			  "HW_ID1",
			  "NC",
			  "NC",
			  "TS_I2C_SDA",
			  "TS_I2C_SCL",
			  "TS_RESET_N",
			  "NC", /* GPIO_90 */
			  "NC",
			  "NFC_IRQ",
			  "NFC_DWLD_EN",
			  "DISP_RESET_N",
			  "TRAY2_DET",
			  "CAM_SOF",
			  "RFFE6_CLK",
			  "RFFE6_DATA",
			  "DEBUG_GPIO0",
			  "DEBUG_GPIO1", /* GPIO_100 */
			  "GRFC4",
			  "NC",
			  "NC",
			  "RSVD",
			  "UIM2_DATA",
			  "UIM2_CLK",
			  "UIM2_RESET",
			  "UIM2_PRESENT",
			  "UIM1_DATA",
			  "UIM1_CLK", /* GPIO_110 */
			  "UIM1_RST",
			  "UIM1_PRESENT",
			  "UIM_BATT_ALARM",
			  "RSVD",
			  "NC",
			  "NC",
			  "ACCEL_INT",
			  "GYRO_INT",
			  "COMPASS_INT",
			  "ALS_PROX_INT_N", /* GPIO_120 */
			  "FP_INT_N",
			  "NC",
			  "BAROMETER_INT",
			  "ACC_COVER_OPEN",
			  "TS_INT_N",
			  "NC",
			  "NC",
			  "USB_DETECT_EN",
			  "NC",
			  "QLINK_REQUEST", /* GPIO_130 */
			  "QLINK_ENABLE",
			  "NC",
			  "NC",
			  "WMSS_RESET_N",
			  "PA_INDICATOR_OR",
			  "NC",
			  "RFFE3_DATA",
			  "RFFE3_CLK",
			  "RFFE4_DATA",
			  "RFFE4_CLK", /* GPIO_140 */
			  "RFFE5_DATA",
			  "RFFE5_CLK",
			  "GNSS_EN",
			  "MSS_LTE_COXM_TXD",
			  "MSS_LTE_COXM_RXD",
			  "RFFE2_DATA",
			  "RFFE2_CLK",
			  "RFFE1_DATA",
			  "RFFE1_CLK";

	mdp_vsync_p: mdp-vsync-p-state {
		pins = "gpio10";
		function = "mdp_vsync_a";
		drive-strength = <2>;
		bias-pull-down;
	};

	nfc_ven: nfc-ven-state {
		pins = "gpio12";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
		output-low;
	};

	cam_mclk0_active: cam-mclk0-active-state {
		pins = "gpio13";
		function = "cam_mclk";
		drive-strength = <2>;
		bias-disable;
	};

	cam_mclk1_active: cam-mclk1-active-state {
		pins = "gpio14";
		function = "cam_mclk";
		drive-strength = <2>;
		bias-disable;
	};

	cci0_default: cci0-default-state {
		pins = "gpio18", "gpio19";
		function = "cci_i2c";
		bias-disable;
		drive-strength = <2>;
	};

	cci1_default: cci1-default-state {
		pins = "gpio19", "gpio20";
		function = "cci_i2c";
		bias-disable;
		drive-strength = <2>;
	};

	main_cam_pwr_en: main-cam-pwr-en-default-state {
		pins = "gpio21";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
	};

	tof_int_n: tof-int-n-state {
		pins = "gpio22";
		function = "gpio";
		bias-pull-up;
		drive-strength = <2>;
	};

	chat_cam_pwr_en: chat-cam-pwr-en-default-state {
		pins = "gpio25";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
	};

	tof_reset: tof-reset-state {
		pins = "gpio27";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
	};

	cc_dir_default: cc-dir-active-state {
		pins = "gpio38";
		function = "gpio";
		bias-disable;
		drive-strength = <16>;
	};

	acc_cover_open: acc-cover-open-state {
		pins = "gpio124";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
	};

	ts_int_n: ts-int-n-state {
		pins = "gpio125";
		function = "gpio";
		drive-strength = <8>;
		bias-pull-up;
	};

	usb_detect_en: usb-detect-en-active-state {
		pins = "gpio128";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
		output-low;
	};

	ts_vddio_en: ts-vddio-en-default-state {
		pins = "gpio133";
		function = "gpio";
		bias-disable;
		drive-strength = <2>;
		output-low;
	};
};

/*
 * WARNING:
 * Disable UFS until card quirks are in to avoid unrecoverable hard-brick
 * that would happen as soon as the UFS card gets probed as, without the
 * required quirks, the bootloader will be erased right after card probe.
 */
&ufshc {
	status = "disabled";
};

&ufsphy {
	status = "disabled";
};

&usb3 {
	status = "okay";
};

&usb3_dwc3 {
	/* Force to peripheral until we have Type-C hooked up */
	dr_mode = "peripheral";
	extcon = <&extcon_usb>;
};

&usb3phy {
	status = "okay";

	vdda-phy-supply = <&vreg_l1a_0p875>;
	vdda-pll-supply = <&vreg_l2a_1p2>;
};
