// 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 "msm8996.dtsi"
#include "pm8994.dtsi"
#include "pmi8994.dtsi"
#include "pmi8996.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>

/delete-node/ &adsp_mem;
/delete-node/ &slpi_mem;
/delete-node/ &venus_mem;
/delete-node/ &gpu_mem;

/ {
	qcom,msm-id = <246 0x30001>; /* MSM8996 V3.1 (Final) */
	qcom,board-id = <8 0>;

	chosen {
		bootargs = "maxcpus=2";
	};

	reserved-memory {
		ramoops@a7f00000 {
			compatible = "ramoops";
			reg = <0 0xa7f00000 0 0x100000>;
			record-size = <0x20000>;
			console-size = <0x40000>;
			ftrace-size = <0x20000>;
			pmsg-size = <0x20000>;
			ecc-size = <16>;
		};

		adsp_mem: adsp@8ea00000 {
			reg = <0x0 0x8ea00000 0x0 0x1a00000>;
			no-map;
		};

		gpu_mem: gpu@90400000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x90400000 0x0 0x2000>;
			no-map;
		};

		slpi_mem: memory@90500000 {
			reg = <0 0x90500000 0 0xa00000>;
			no-map;
		};

		venus_mem: memory@90f00000 {
			reg = <0 0x90f00000 0 0x500000>;
			no-map;
		};
	};

	panel_tvdd: tvdd-regulator {
		compatible = "regulator-fixed";
		regulator-name = "panel_tvdd";
		gpio = <&tlmm 50 GPIO_ACTIVE_LOW>;
		pinctrl-0 = <&tp_vddio_en>;
		pinctrl-names = "default";
	};

	usb3_id: usb3-id {
		compatible = "linux,extcon-usb-gpio";
		id-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb_detect>;
	};

	vph_pwr: vph-pwr-regulator {
		compatible = "regulator-fixed";
		regulator-min-microvolt = <3700000>;
		regulator-max-microvolt = <3700000>;
		regulator-name = "vph_pwr";
		regulator-always-on;
		regulator-boot-on;
	};

	wlan_en: wlan-en-1-8v {
		compatible = "regulator-fixed";
		regulator-name = "wlan-en-regulator";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		gpio = <&tlmm 84 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&wl_reg_on>;

		/* WLAN card specific delay */
		startup-delay-us = <70000>;
		enable-active-high;
	};
};

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

	tof_sensor: vl53l0x@29 {
		compatible = "st,vl53l0x";
		reg = <0x29>;
	};
};

&blsp1_uart2 {
	status = "okay";
};

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

	/* FUSB301 USB-C controller */
};

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

	synaptics@2c {
		compatible = "syna,rmi4-i2c";
		reg = <0x2c>;
		interrupt-parent = <&tlmm>;
		interrupts = <125 IRQ_TYPE_EDGE_FALLING>;
		vdd-supply = <&panel_tvdd>;

		syna,reset-delay-ms = <220>;
		syna,startup-delay-ms = <220>;
		#address-cells = <1>;
		#size-cells = <0>;

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

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

&blsp2_uart2 {
	status = "okay";
};

&camera0_mclk {
	drive-strength = <2>;
	output-low;
};

&camera0_pwdn {
	drive-strength = <2>;
	output-low;
};

&camera0_rst {
	pins = "gpio30";
	drive-strength = <2>;
	output-low;
};

&camera2_mclk {
	drive-strength = <2>;
	output-low;
};

&camera2_rst {
	drive-strength = <2>;
	output-low;
};

&hsusb_phy1 {
	vdd-supply = <&pm8994_l28>;
	vdda-pll-supply = <&pm8994_l12>;
	vdda-phy-dpdm-supply = <&pm8994_l24>;
	status = "okay";
};

&mmcc {
	vdd-gfx-supply = <&vdd_gfx>;
};

&pcie0 {
	perst-gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
	wake-gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
	vddpe-3v3-supply = <&wlan_en>;
	vdda-supply = <&pm8994_l28>;
	status = "okay";
};

&pcie_phy {
	vdda-phy-supply = <&pm8994_l28>;
	vdda-pll-supply = <&pm8994_l12>;
	status = "okay";
};

&pm8994_gpios {
	pinctrl-names = "default";
	pinctrl-0 = <&pm8994_gpios_defaults>;
	gpio-line-names =
		"NC",
		"VOL_DOWN_N",
		"VOL_UP_N",
		"SNAPSHOT_N",
		"FOCUS_N",
		"NC",
		"NFC_VEN",
		"NC",
		"NC",
		"NC",
		"NC",
		"NC",
		"EAR_EN",
		"NC",
		"PM_DIVCLK1",
		"PMI_CLK",
		"NC",
		"WL_SLEEP_CLK",
		"NC",
		"PMIC_SPON",
		"UIM_BATT_ALARM",
		"PMK_SLEEP_CLK";

	/*
	 * We don't yet know for sure which GPIOs are of our interest, but what
	 * we do know is that if a vendor sets the pins to a non-default state, there's
	 * probably a reason for it, and just to be on the safe side, we follow suit.
	 */
	pm8994_gpios_defaults: pm8994-gpios-default-state {
		pm8994-gpio1-nc-pins {
			pins = "gpio1";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			bias-high-impedance;
		};

		vol-down-n-pins {
			pins = "gpio2";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-pull-up;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_S4>;
		};

		vol-up-n-pins {
			pins = "gpio3";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-pull-up;
			power-source = <PM8994_GPIO_S4>;
		};

		camera-snapshot-n-pins {
			pins = "gpio4";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-pull-up;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_S4>;
		};

		camera-focus-n-pins {
			pins = "gpio5";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-pull-up;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_S4>;
		};

		pm8994-gpio6-nc-pins {
			pins = "gpio6";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			bias-high-impedance;
			power-source = <PM8994_GPIO_VPH>;
		};

		nfc-download-pins {
			pins = "gpio7";
			function = PMIC_GPIO_FUNC_NORMAL;
			output-low;
			drive-push-pull;
			bias-disable;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_S4>;
		};

		pm8994-gpio8-nc-pins {
			pins = "gpio8";
			function = PMIC_GPIO_FUNC_NORMAL;
			output-low;
			drive-push-pull;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_VPH>;
		};

		pm8994-gpio9-nc-pins {
			pins = "gpio9";
			function = PMIC_GPIO_FUNC_NORMAL;
			output-high;
			drive-push-pull;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_VPH>;
		};

		nfc-clock-pins {
			pins = "gpio10";
			function = PMIC_GPIO_FUNC_NORMAL;
			input-enable;
			drive-push-pull;
			bias-pull-down;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_S4>;
		};

		pm8994-gpio11-nc-pins {
			pins = "gpio11";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			bias-high-impedance;
			power-source = <PM8994_GPIO_VPH>;
		};

		pm8994-gpio12-nc-pins {
			pins = "gpio12";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			bias-high-impedance;
			power-source = <PM8994_GPIO_VPH>;
		};

		ear-enable-pins {
			pins = "gpio13";
			function = PMIC_GPIO_FUNC_NORMAL;
			output-high;
			drive-push-pull;
			bias-disable;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_S4>;
		};

		pm8994-gpio14-nc-pins {
			pins = "gpio14";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_VPH>;
		};

		pm-divclk1-gpio-pins {
			pins = "gpio15";
			function = "func1";
			output-high;
			drive-push-pull;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_VPH>;
		};

		pmi-clk-gpio-pins {
			pins = "gpio16";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
		};

		pm8994-gpio17-nc-pins {
			pins = "gpio17";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			bias-high-impedance;
			power-source = <PM8994_GPIO_VPH>;
		};

		rome-sleep-pins {
			pins = "gpio18";
			function = PMIC_GPIO_FUNC_FUNC2;
			output-low;
			drive-push-pull;
			bias-disable;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_MED>;
			power-source = <PM8994_GPIO_S4>;
		};

		pm8994-gpio19-nc-pins {
			pins = "gpio19";
			function = PMIC_GPIO_FUNC_NORMAL;
			output-low;
			drive-push-pull;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_VPH>;
		};

		pm8994-gpio22-nc-pins {
			pins = "gpio22";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			bias-high-impedance;
			power-source = <PM8994_GPIO_VPH>;
		};
	};
};

&pm8994_mpps {
	pinctrl-names = "default";
	pinctrl-0 = <&pm8994_mpps_defaults>;

	gpio-line-names =
		"SDC_UIM_VBIAS",
		"LCD_ID_ADC",
		"VREF_DACX",
		"NC",
		"FLASH_THERM",
		"NC",
		"NC",
		"RF_ID";

	pm8994_mpps_defaults: pm8994-mpps-default-state {
		lcd-id_adc-mpp-pins {
			pins = "mpp2";
			function = "analog";
			input-enable;
			qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH6>;
		};

		pm-mpp4-nc-pins {
			pins = "mpp4";
			function = "digital";
			bias-high-impedance;
			power-source = <PM8994_GPIO_VPH>;
		};

		flash-therm-mpp-pins {
			pins = "mpp5";
			function = "analog";
			input-enable;
			qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH5>;
		};

		mpp6-nc-pins {
			pins = "mpp6";
			function = "digital";
			bias-high-impedance;
		};

		rf-id-mpp-pins {
			pins = "mpp8";
			function = "analog";
			input-enable;
			qcom,amux-route = <PMIC_MPP_AMUX_ROUTE_CH8>;
		};
	};
};

&pm8994_resin {
	linux,code = <KEY_VOLUMEUP>;
	status = "okay";
};

&pmi8994_gpios {
	pinctrl-names = "default";
	pinctrl-0 = <&pmi8994_gpios_defaults>;

	gpio-line-names =
		"VIB_LDO_EN",
		"NC",
		"NC",
		"NC",
		"NC",
		"NC",
		"NC",
		"NC",
		"USB_SWITCH_SEL",
		"NC";

	pmi8994_gpios_defaults: pmi8994-gpios-default-state {
		vib-ldo-en-gpio-pins {
			pins = "gpio1";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			output-low;
			bias-disable;
			power-source = <PM8994_GPIO_S4>;
		};

		pmi-gpio2-nc-pins {
			pins = "gpio2";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_VPH>;
		};

		pmi-gpio3-nc-pins {
			pins = "gpio3";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			input-enable;
			bias-high-impedance;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_VPH>;
		};

		pmi-gpio4-nc-pins {
			pins = "gpio4";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			output-high;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_S4>;
		};

		pmi-gpio5-nc-pins {
			pins = "gpio5";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			output-high;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_S4>;
		};

		pmi-gpio6-nc-pins {
			pins = "gpio6";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			output-high;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_S4>;
		};

		pmi-gpio7-nc-pins {
			pins = "gpio7";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			output-high;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_S4>;
		};

		pmi-gpio8-nc-pins {
			pins = "gpio8";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
			output-high;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
			power-source = <PM8994_GPIO_S4>;
		};

		usb-switch-sel-pins {
			pins = "gpio9";
			function = PMIC_GPIO_FUNC_NORMAL;
			drive-push-pull;
		};

		pmi-gpio10-nc-pins {
			pins = "gpio10";
			function = PMIC_GPIO_FUNC_NORMAL;
			output-low;
			drive-push-pull;
			bias-disable;
			qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
			power-source = <PM8994_GPIO_S4>;
		};
	};
};

&pm8994_spmi_regulators {
	qcom,saw-reg = <&saw3>;

	pm8994_s9: s9 {
		qcom,saw-slave;
	};

	pm8994_s10: s10 {
		qcom,saw-slave;
	};

	pm8994_s11: s11 {
		qcom,saw-leader;
		regulator-name = "vdd_apcc";
		regulator-always-on;
		regulator-min-microvolt = <470000>;
		regulator-max-microvolt = <1140000>;
	};
};

&pmi8994_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@1 {
			reg = <1>;
			color = <LED_COLOR_ID_BLUE>;
		};

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

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

&pmi8994_spmi_regulators {
	vdd_gfx:
	pmi8994_s2: s2 {
		/* Pinned to a high value for now to avoid random crashes. */
		regulator-min-microvolt = <1015000>;
		regulator-max-microvolt = <1015000>;
		regulator-name = "vdd_gfx";
		regulator-always-on;
	};
};

&pmi8994_wled {
	default-brightness = <512>;
	qcom,num-strings = <3>;
	status = "okay";
};

&rpm_requests {
	regulators-0 {
		compatible = "qcom,rpm-pm8994-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_l1-supply = <&pm8994_s3>;
		vdd_l2_l26_l28-supply = <&pm8994_s3>;
		vdd_l3_l11-supply = <&pm8994_s3>;
		vdd_l4_l27_l31-supply = <&pm8994_s3>;
		vdd_l5_l7-supply = <&pm8994_s5>;
		vdd_l6_l12_l32-supply = <&pm8994_s5>;
		vdd_l8_l16_l30-supply = <&vph_pwr>;
		vdd_l14_l15-supply = <&pm8994_s5>;
		vdd_l20_l21-supply = <&pm8994_s5>;
		vdd_l25-supply = <&pm8994_s3>;
		vdd_lvs1_2-supply = <&pm8994_s4>;

		pm8994_s3: s3 {
			regulator-min-microvolt = <1300000>;
			regulator-max-microvolt = <1300000>;
		};

		pm8994_s4: s4 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-system-load = <325000>;
			regulator-always-on;
		};

		pm8994_s5: s5 {
			regulator-min-microvolt = <2150000>;
			regulator-max-microvolt = <2150000>;
		};

		pm8994_s7: s7 {
			regulator-min-microvolt = <800000>;
			regulator-max-microvolt = <800000>;
		};

		pm8994_l1: l1 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};

		pm8994_l2: l2 {
			regulator-min-microvolt = <1250000>;
			regulator-max-microvolt = <1250000>;
		};

		pm8994_l3: l3 {
			regulator-min-microvolt = <1100000>;
			regulator-max-microvolt = <1100000>;
		};

		pm8994_l4: l4 {
			regulator-min-microvolt = <1225000>;
			regulator-max-microvolt = <1225000>;
		};

		/* L6 and L7 seem unused. */

		pm8994_l8: l8 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l9: l9 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l10: l10 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l11: l11 {
			regulator-min-microvolt = <1100000>;
			regulator-max-microvolt = <1100000>;
		};

		pm8994_l12: l12 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-allow-set-load;
		};

		pm8994_l13: l13 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <2950000>;
			regulator-system-load = <22000>;
			regulator-allow-set-load;
		};

		pm8994_l14: l14 {
			regulator-min-microvolt = <1700000>;
			regulator-max-microvolt = <1900000>;
		};

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

		pm8994_l16: l16 {
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2700000>;
		};

		pm8994_l17: l17 {
			regulator-min-microvolt = <2200000>;
			regulator-max-microvolt = <2500000>;
		};

		pm8994_l18: l18 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l19: l19 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
		};

		pm8994_l20: l20 {
			regulator-min-microvolt = <2950000>;
			regulator-max-microvolt = <2950000>;
			regulator-system-load = <570000>;
			regulator-allow-set-load;
		};

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

		pm8994_l22: l22 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
		};

		pm8994_l23: l23 {
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2700000>;
		};

		pm8994_l24: l24 {
			regulator-min-microvolt = <3075000>;
			regulator-max-microvolt = <3075000>;
			regulator-allow-set-load;
		};

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

		pm8994_l27: l27 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1200000>;
		};

		pm8994_l28: l28 {
			regulator-min-microvolt = <925000>;
			regulator-max-microvolt = <925000>;
			regulator-allow-set-load;
		};

		pm8994_l29: l29 {
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2700000>;
		};

		pm8994_l30: l30 { };

		pm8994_l32: l32 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
	};
};

&sdhc1 {
	vmmc-supply = <&pm8994_l20>;
	vqmmc-supply = <&pm8994_s4>;
	mmc-hs400-1_8v;
	mmc-hs200-1_8v;
	status = "okay";
};

&sdhc2 {
	cd-gpios = <&tlmm 40 GPIO_ACTIVE_HIGH>;
	vmmc-supply = <&pm8994_l21>;
	vqmmc-supply = <&pm8994_l13>;
	status = "okay";
};

&tlmm {
	gpio-reserved-ranges = <0 4>;
	pinctrl-0 = <&sw_service_gpio>;
	pinctrl-names = "default";

	disp_reset_n_gpio: disp-reset-n-state {
		pins = "gpio8";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	mdp_vsync_p_gpio: mdp-vsync-p-state {
		pins = "gpio10";
		function = "mdp_vsync";
		drive-strength = <2>;
		bias-disable;
	};

	sw_service_gpio: sw-service-gpio-state {
		pins = "gpio16";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-up;
	};

	usb_detect: usb-detect-state {
		pins = "gpio25";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
		output-high;
	};

	uim_detect_en: uim-detect-en-state {
		pins = "gpio29";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
		output-high;
	};

	tray_det_pin: tray-det-state {
		pins = "gpio40";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	tp_vddio_en: tp-vddio-en-state {
		pins = "gpio50";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
		output-high;
	};

	lcd_vddio_en: lcd-vddio-en-state {
		pins = "gpio51";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
		output-low;
	};

	wl_host_wake: wl-host-wake-state {
		pins = "gpio79";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-down;
	};

	wl_reg_on: wl-reg-on-state {
		pins = "gpio84";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
		output-low;
	};

	ts_reset_n: ts-rst-n-state {
		pins = "gpio89";
		function = "gpio";
		drive-strength = <2>;
	};

	touch_int_n: touch-int-n-state {
		pins = "gpio125";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-up;
	};

	touch_int_sleep: touch-int-sleep-state {
		pins = "gpio125";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-down;
	};
};

&usb3 {
	qcom,select-utmi-as-pipe-clk;
	status = "okay";
};

&usb3_dwc3 {
	extcon = <&usb3_id>;
	dr_mode = "peripheral";
	maximum-speed = "high-speed";
	phys = <&hsusb_phy1>;
	phy-names = "usb2-phy";
	snps,hird-threshold = /bits/ 8 <0>;
};