#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

#include "lahaina-pmic-overlay.dtsi"
#include "lahaina-thermal-overlay.dtsi"

&spmi_debug_bus {
	status = "ok";
};

&spmi_glink_debug {
	status = "ok";
};

&soc {
	gpio_keys {
		compatible = "gpio-keys";
		label = "gpio-keys";

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

		vol_up {
			label = "volume_up";
			gpios = <&pm8350_gpios 6 GPIO_ACTIVE_LOW>;
			linux,input-type = <1>;
			linux,code = <KEY_VOLUMEUP>;
			gpio-key,wakeup;
			debounce-interval = <15>;
			linux,can-disable;
		};
	};

	qcom,qbt_handler {
		compatible = "qcom,qbt-handler";
		qcom,ipc-gpio = <&tlmm 38 0>;
		qcom,finger-detect-gpio = <&tlmm 39 0>;
	};

	extcon_usb1: extcon_usb1 {
		compatible = "linux,extcon-usb-gpio";
		vbus-gpio =  <&pm8350_gpios 9 GPIO_ACTIVE_HIGH>;
		id-gpio = <&tlmm 51 GPIO_ACTIVE_HIGH>;
		vbus-out-gpio = <&pm8350_gpios 8 GPIO_ACTIVE_HIGH>;

		pinctrl-names = "default";
		pinctrl-0 = <&usb2_vbus_det_default
			     &usb2_id_det_default
			     &usb2_vbus_boost_default>;
	};
};

&qupv3_se4_i2c {
	#address-cells = <1>;
	#size-cells = <0>;

	status = "ok";
	qcom,i2c-touch-active = "st,fts";

	st_fts@49 {
		compatible = "st,fts";
		reg = <0x49>;
		interrupt-parent = <&tlmm>;
		interrupts = <23 0x2008>;
		vdd-supply = <&L8C>;
		avdd-supply = <&L3C>;
		pinctrl-names = "pmx_ts_active", "pmx_ts_suspend";
		pinctrl-0 = <&ts_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		st,irq-gpio = <&tlmm 23 0x2008>;
		st,reset-gpio = <&tlmm 22 0x00>;
		st,x-flip = <1>;
		st,y-flip = <1>;
		st,regulator_dvdd = "vdd";
		st,regulator_avdd = "avdd";
		st,trusted-touch-mode = "vm_mode";
		st,touch-environment = "pvm";
		st,trusted-touch-spi-irq = <566>;
		st,trusted-touch-io-bases = <0xF114000 0xF115000 0xF116000 0xF117000 0x990000 0x00910000>;
		st,trusted-touch-io-sizes = <0x1000 0x1000 0x1000 0x1000 0x1000 0x4000>;
	};

	focaltech@38 {
		compatible = "focaltech,fts_ts";
		reg = <0x38>;
		interrupt-parent = <&tlmm>;
		interrupts = <23 0x2008>;
		focaltech,reset-gpio = <&tlmm 22 0x00>;
		focaltech,irq-gpio = <&tlmm 23 0x2008>;
		focaltech,max-touch-number = <5>;
		focaltech,display-coords = <0 0 1080 2340>;

		vdd-supply = <&L3C>;
		vcc_i2c-supply = <&L8C>;

		pinctrl-names = "pmx_ts_active", "pmx_ts_suspend","pmx_ts_release";
		pinctrl-0 = <&ts_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		pinctrl-2 = <&ts_release>;
	};
};

&sdhc_2 {
	vdd-supply = <&pm8350c_l9>;
	qcom,vdd-voltage-level = <2950000 2960000>;
	qcom,vdd-current-level = <200 800000>;

	vdd-io-supply = <&pm8350c_l6>;
	qcom,vdd-io-voltage-level = <1808000 2960000>;
	qcom,vdd-io-current-level = <200 22000>;

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

	cd-gpios = <&tlmm 92 GPIO_ACTIVE_LOW>;

	status = "ok";
};


&ufsphy_mem {
	compatible = "qcom,ufs-phy-qmp-v4-lahaina";

	vdda-phy-supply = <&pm8350_l5>;
	vdda-phy-always-on;
	vdda-pll-supply = <&pm8350_l6>;
	vdda-phy-max-microamp = <91600>;
	vdda-pll-max-microamp = <19000>;

	status = "ok";
};

&ufshc_mem {
	vdd-hba-supply = <&gcc_ufs_phy_gdsc>;
	vdd-hba-fixed-regulator;

	vcc-supply = <&pm8350_l7>;
	vcc-voltage-level = <2504000 2950000>;
	vcc-low-voltage-sup;
	vcc-max-microamp = <800000>;

	vccq-supply = <&pm8350_l9>;
	vccq-max-microamp = <900000>;

	qcom,vddp-ref-clk-supply = <&pm8350_l9>;
	qcom,vddp-ref-clk-max-microamp = <100>;

	qcom,vccq-parent-supply = <&pm8350_s12>;
	qcom,vccq-parent-max-microamp = <210000>;

	status = "ok";
};

&pm8350b_haptics {
	status = "ok";
};

&pm8350c_switch0 {
	qcom,led-mask = <9>; /* Channels 1 & 4 */
	qcom,symmetry-en;
};

&pm8350c_switch1 {
	qcom,led-mask = <6>; /* Channels 2 & 3 */
	qcom,symmetry-en;
};

&pm8350c_switch2 {
	qcom,led-mask = <15>; /* All Channels */
	qcom,symmetry-en;
};

&pm8350c_flash {
	status = "ok";
};

&usb1 {
	extcon = <&extcon_usb1>;
};

&battery_charger {
	qcom,thermal-mitigation = <3000000 1500000 1000000 500000>;
	qcom,wireless-fw-name = "idt9412.bin";
};

&wil6210 {
	status = "ok";
};

&qupv3_se15_i2c {
	status = "ok";
	qcom,clk-freq-out = <1000000>;
	#address-cells = <1>;
	#size-cells = <0>;
	nq@28 {
		compatible = "qcom,sn-nci";
		reg = <0x28>;
		qcom,sn-irq = <&tlmm 87 0x00>;
		qcom,sn-ven = <&tlmm 62 0x00>;
		qcom,sn-firm = <&tlmm 86 0x00>;
		qcom,sn-clkreq = <&tlmm 63 0x00>;
		interrupt-parent = <&tlmm>;
		interrupts = <87 0>;
		interrupt-names = "nfc_irq";
		pinctrl-names = "nfc_active", "nfc_suspend";
		pinctrl-0 = <&nfc_int_active &nfc_enable_active
				&nfc_clk_req_active &nfc_fwdl_active>;
		pinctrl-1 = <&nfc_int_suspend &nfc_enable_suspend
				&nfc_clk_req_suspend &nfc_fwdl_suspend>;
	};
};
