
#include "pm8150.dtsi"

pm8150_1_tz: &pm8150_tz {
};

pm8150_1_clkdiv: &pm8150_clkdiv {
	clock-output-names = "pm8150_1_div_clk1", "pm8150_1_div_clk2";
};

pm8150_1_rtc: &pm8150_rtc {
	qcom,disable-alarm-wakeup;
};

pm8150_1_gpios: &pm8150_gpios {
};

pm8150_1_vadc: &pm8150_vadc {
	xo_therm {
		reg = <ADC5_XO_THERM_100K_PU>;
		label = "xo_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <1>;
		qcom,pre-scaling = <1 1>;
	};
};

pm8150_1_adc_tm: &pm8150_adc_tm {
	io-channels = <&pm8150_1_vadc ADC5_XO_THERM_100K_PU>;

	xo_therm@0 {
		reg = <0>;
		io-channels = <&pm8150_1_vadc ADC5_XO_THERM_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <1>;
	};
};

/* PM8150_2: */
&spmi_bus {
	#address-cells = <2>;
	#size-cells = <0>;
	interrupt-controller;
	#interrupt-cells = <4>;

	qcom,pm8150@4 {
		compatible = "qcom,spmi-pmic";
		reg = <4 SPMI_USID>;
		#address-cells = <1>;
		#size-cells = <0>;

		pm8150_2_tz: qcom,temp-alarm@2400 {
			compatible = "qcom,spmi-temp-alarm";
			reg = <0x2400>;
			interrupts = <0x4 0x24 0x0 IRQ_TYPE_EDGE_BOTH>;
			io-channels = <&pm8150_2_vadc ADC5_DIE_TEMP>;
			io-channel-names = "thermal";
			#thermal-sensor-cells = <0>;
		};

		qcom,power-on@800 {
			compatible = "qcom,pm8998-pon";
			reg = <0x800>;
		};

		pm8150_2_clkdiv: clock-controller@5b00 {
			compatible = "qcom,spmi-clkdiv";
			reg = <0x5b00>;
			#clock-cells = <1>;
			qcom,num-clkdivs = <2>;
			clock-output-names = "pm8150_2_div_clk1",
						"pm8150_2_div_clk2";
			clocks = <&rpmhcc RPMH_CXO_CLK>;
			clock-names = "xo";
		};

		pm8150_2_gpios: pinctrl@c000 {
			compatible = "qcom,pm8150-gpio";
			reg = <0xc000>;
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};

		pm8150_2_vadc: vadc@3100 {
			compatible = "qcom,spmi-adc5";
			reg = <0x3100>;
			#address-cells = <1>;
			#size-cells = <0>;
			interrupts = <0x4 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "eoc-int-en-set";
			#io-channel-cells = <1>;
			io-channel-ranges;

			/* Channel node */
			ref_gnd {
				reg = <ADC5_REF_GND>;
				label = "ref_gnd";
				qcom,pre-scaling = <1 1>;
			};

			vref_1p25 {
				reg = <ADC5_1P25VREF>;
				label = "vref_1p25";
				qcom,pre-scaling = <1 1>;
			};

			die_temp {
				reg = <ADC5_DIE_TEMP>;
				label = "die_temp";
				qcom,pre-scaling = <1 1>;
			};

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

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

		pm8150_2_adc_tm: adc_tm@3500 {
			compatible = "qcom,spmi-adc-tm5";
			reg = <0x3500>;
			interrupts = <0x4 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "threshold";
			#address-cells = <1>;
			#size-cells = <0>;
			#thermal-sensor-cells = <1>;
			io-channels = <&pm8150_2_vadc ADC5_XO_THERM_100K_PU>,
					<&pm8150_2_vadc ADC5_AMUX_THM1_100K_PU>;

			ufs_therm@0 {
				reg = <0>;
				io-channels = <&pm8150_2_vadc ADC5_XO_THERM_100K_PU>;
				qcom,ratiometric;
				qcom,hw-settle-time = <200>;
			};

			soc_therm@1 {
				reg = <1>;
				io-channels = <&pm8150_2_vadc ADC5_AMUX_THM1_100K_PU>;
				qcom,ratiometric;
				qcom,hw-settle-time = <200>;
			};
		};
	};

	qcom,pm8150@5 {
		compatible ="qcom,spmi-pmic";
		reg = <5 SPMI_USID>;
		#address-cells = <1>;
		#size-cells = <1>;
	};
};

/* PMIC GPIO pin control configurations: */
&pm8150_1_gpios {
	key_home {
		key_home_default: key_home_default {
			pins = "gpio1";
			function = "normal";
			input-enable;
			bias-pull-up;
			power-source = <0>;
		};
	};

	storage_sd_detect {
		storage_cd_default: storage_cd_default {
			pins = "gpio4";
			function = "normal";
			input-enable;
			bias-pull-up;
			power-source = <0>;
		};
	};

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

#include <dt-bindings/thermal/thermal_qti.h>

&thermal_zones {
	pm8150_2_temp_alarm: pm8150_2_tz {
		polling-delay-passive = <100>;
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm8150_2_tz>;

		trips {
			pm8150_2_trip0: trip0 {
				temperature = <105000>;
				hysteresis = <0>;
				type = "passive";
			};

			pm8150_2_trip1: trip1 {
				temperature = <125000>;
				hysteresis = <0>;
				type = "passive";
			};

			trip2 {
				temperature = <155000>;
				hysteresis = <0>;
				type = "critical";
			};
		};

	};

	xo-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm8150_1_adc_tm 0>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	ufs-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm8150_2_adc_tm 0>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	soc-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm8150_2_adc_tm 1>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};
