#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/iio/qcom,spmi-vadc.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/clock/qcom,gcc-khaje.h>
#include "bengal-thermal-overlay.dtsi"

&qupv3_se4_2uart {
	status = "ok";
};

&pm6125_vadc {
	pinctrl-0 = <&camera_therm_default &emmc_therm_default &rf_pa1_therm_default>;

	rf_pa1_therm {
		reg = <ADC5_GPIO4_100K_PU>;
		label = "rf_pa1_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};
};

&pm6125_adc_tm {
	status = "ok";

	rf_pa1_therm {
		reg = <3>;
		io-channels = <&pm6125_vadc ADC5_GPIO4_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time-us = <200>;
	};
};

&thermal_zones {
	rf-pa1-therm-usr {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm6125_adc_tm 3>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};

&pm6125_gpios {

	rf_pa1_therm {
		rf_pa1_therm_default: rf_pa1_therm_default {
			pins = "gpio7";
			 bias-high-impedance;
		};
	};

	key_vol_up {
		key_vol_up_default: key_vol_up_default {
			pins = "gpio5";
			function = "normal";
			input-enable;
			bias-pull-up;
			power-source = <0>;
		};
	};

	eldo9_pin {
		usb_eldo9:gpio@c000 {
			pins = "gpio1";
			function = "normal";
			qcom,drive-strength = <2>;
			power-source = <0>;
			bias-disable;
			output-high;
		};
	};
};

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

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

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

	vdda_usb_ss_dp_core: vdda_usb_ss_dp_core {
		compatible = "regulator-fixed";
		regulator-name = "vdd_supply";
		regulator-min-microvolt = <880000>;
		regulator-max-microvolt = <880000>;
		enable-active-high;
		gpio = <&pm6125_gpios 1 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&usb_eldo9>;
	};
};

&usb_qmp_dp_phy {
	vdd-supply = <&vdda_usb_ss_dp_core>;
};

&qupv3_se1_i2c {
	awinic@64 {
		compatible = "awinic,aw2016_led";
		reg = <0x64>;

		awinic,red {
			awinic,name = "red";
			awinic,id = <0>;
			awinic,imax = <2>;
			awinic,led-current = <3>;
			awinic,max-brightness = <255>;
			awinic,rise-time-ms = <6>;
			awinic,hold-time-ms = <0>;
			awinic,fall-time-ms = <6>;
			awinic,off-time-ms = <4>;
		};

		awinic,green {
			awinic,name = "green";
			awinic,id = <1>;
			awinic,imax = <2>;
			awinic,led-current = <3>;
			awinic,max-brightness = <255>;
			awinic,rise-time-ms = <6>;
			awinic,hold-time-ms = <0>;
			awinic,fall-time-ms = <6>;
			awinic,off-time-ms = <4>;
		};

		awinic,blue {
			awinic,name = "blue";
			awinic,id = <2>;
			awinic,imax = <2>;
			awinic,led-current = <3>;
			awinic,max-brightness = <255>;
			awinic,rise-time-ms = <6>;
			awinic,hold-time-ms = <0>;
			awinic,fall-time-ms = <6>;
			awinic,off-time-ms = <4>;
		};

	};
};

&sdhc_1 {
	vdd-supply = <&L24A>;
	qcom,vdd-voltage-level = <2960000 2960000>;
	qcom,vdd-current-level = <0 570000>;

	vdd-io-supply = <&L11A>;
	qcom,vdd-io-always-on;
	qcom,vdd-io-lpm-sup;
	qcom,vdd-io-voltage-level = <1800000 1800000>;
	qcom,vdd-io-current-level = <0 325000>;

	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sdc1_on>;
	pinctrl-1 = <&sdc1_off>;

	status = "ok";
};

&sdhc_2 {
	vdd-supply = <&L22A>;
	qcom,vdd-voltage-level = <2960000 2960000>;
	qcom,vdd-current-level = <0 800000>;

	vdd-io-supply = <&L5A>;
	qcom,vdd-io-voltage-level = <1800000 2960000>;
	qcom,vdd-io-current-level = <0 22000>;

	vdd-io-bias-supply = <&L7A>;
	qcom,vdd-io-bias-voltage-level = <1256000 1256000>;
	qcom,vdd-io-bias-current-level = <0 6000>;

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

	cd-gpios = <&tlmm 88 GPIO_ACTIVE_LOW>;
	status = "ok";
};

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

	vdda-phy-supply = <&L4A>; /* 0.9v */
	vdda-pll-supply = <&L18A>; /* 1.8v */
	vdda-phy-max-microamp = <85700>;
	vdda-pll-max-microamp = <18300>;

	status = "ok";
};

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

	vcc-supply = <&L24A>;
	vcc-max-microamp = <800000>;

	vccq2-supply = <&L11A>;
	vccq2-max-microamp = <800000>;

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

	reset-gpios = <&tlmm 113 GPIO_ACTIVE_LOW>;
	resets = <&gcc GCC_UFS_PHY_BCR>;
	reset-names = "rst";

	status = "ok";
};

&pm6125_pwm {
	status = "ok";
};

&qupv3_se2_i2c {
	status = "okay";
	qcom,i2c-touch-active="synaptics,tcm-i2c";

	synaptics_tcm@20 {
		compatible = "synaptics,tcm-i2c";
		reg = <0x20>;
		interrupt-parent = <&tlmm>;
		interrupts = <80 0x2008>;
		pinctrl-names = "pmx_ts_active","pmx_ts_suspend",
			"pmx_ts_release";
		pinctrl-0 = <&ts_int_active &ts_reset_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		pinctrl-2 = <&ts_release>;
		synaptics,irq-gpio = <&tlmm 80 0x2008>;
		synaptics,irq-on-state = <0>;
		synaptics,reset-gpio = <&tlmm 86 0x00>;
		synaptics,reset-on-state = <0>;
		synaptics,reset-active-ms = <20>;
		synaptics,reset-delay-ms = <200>;
		synaptics,power-delay-ms = <200>;
		synaptics,ubl-i2c-addr = <0x20>;
		synaptics,extend_report;
		synaptics,firmware-name = "synaptics_firmware_k.img";

	};

	novatek@62 {
		reg = <0x62>;
		status = "ok";

		interrupt-parent = <&tlmm>;
		interrupts = <80 0x2008>;
		pinctrl-names = "pmx_ts_active","pmx_ts_suspend",
			"pmx_ts_release";
		pinctrl-0 = <&ts_int_active &ts_reset_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		pinctrl-2 = <&ts_release>;

		novatek,reset-gpio = <&tlmm 86 0x00>;
		novatek,irq-gpio = <&tlmm 80 0x2008>;

	};

};
