#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/spmi/spmi.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pmx35.h>

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

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

		pmx35_tz: qcom,temp-alarm@a00 {
			compatible = "qcom,spmi-temp-alarm";
			reg = <0xa00>;
			interrupts = <0x0 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
			#thermal-sensor-cells = <0>;
		};

		pon_hlos@1300 {
			compatible = "qcom,pm8998-pon";
			reg = <0x1300>, <0x800>;
			reg-names = "pon_hlos", "pon_pbs";
			qcom,log-kpd-event;

			pwrkey {
				compatible = "qcom,pmk8350-pwrkey";
				interrupts = <0x0 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
				linux,code = <KEY_POWER>;
			};

			resin{
				compatible = "qcom,pmk8350-resin";
				interrupts = <0x0 0x13 0x6 IRQ_TYPE_EDGE_BOTH>;
				linux,code = <KEY_VOLUMEDOWN>;
			};
		};


		pmx35_vbus_detect: qcom,pmd-vbus-det@1900 {
			compatible = "qcom,pm8941-misc";
			reg = <0x1900>;
			interrupts = <0x0 0x19 0x0 IRQ_TYPE_EDGE_BOTH>;
			interrupt-names = "usb_vbus";
			status = "disabled";
		};

		pmx35_gpios: pinctrl@8800 {
			compatible = "qcom,pmx35-gpio";
			reg = <0x8800>;
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};

		pmx35_pwm: pwms@e800 {
			compatible = "qcom,pwm-lpg";
			reg = <0xe800>;
			reg-names = "lpg-base";
			#pwm-cells = <2>;
			qcom,num-lpg-channels = <4>;
		};

		pmx35_rtc: rtc@6400 {
			compatible = "qcom,pm5100-rtc";
			reg = <0x6400>, <0x6500>;
			reg-names = "rtc", "alarm";
			interrupts = <0x0 0x65 0x1 IRQ_TYPE_EDGE_RISING>;
		};

		pmx35_sdam_2: sdam@7100 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7100>;
			#address-cells = <1>;
			#size-cells = <1>;
		};

		pmx35_sdam_5: sdam@7400 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7400>;
		};

		pmx35_vadc: qcom,pmx35_vadc {
			compatible = "qcom,spmi-adc5-gen3";
			reg = <0x7700>;
			#address-cells = <1>;
			#size-cells = <0>;
			interrupts = <0x0 0x77 0x1 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "adc-sdam0";
			#io-channel-cells = <1>;
			#thermal-sensor-cells = <1>;
			status = "disabled";

			pmx35_ref_gnd {
				reg = <PMX35_ADC5_GEN3_OFFSET_REF>;
				label = "pmx35_ref_gnd";
				qcom,pre-scaling = <1 1>;
			};

			pmx35_vref_1p25 {
				reg = <PMX35_ADC5_GEN3_1P25VREF>;
				label = "pmx35_vref_1p25";
				qcom,pre-scaling = <1 1>;
			};

			pmx35_die_temp {
				reg = <PMX35_ADC5_GEN3_DIE_TEMP>;
				label = "pmx35_die_temp";
				qcom,pre-scaling = <1 1>;
			};
		};
	};
};

&thermal_zones {
	pmx35_temp_alarm: pmx35_tz {
		polling-delay-passive = <100>;
		polling-delay = <0>;
		thermal-sensors = <&pmx35_tz>;

		trips {
			pmx35_trip0: trip0 {
				temperature = <95000>;
				hysteresis = <0>;
				type = "passive";
			};

			pmx35_trip1: trip1 {
				temperature = <115000>;
				hysteresis = <0>;
				type = "critical";
			};

			pmx35_trip2: trip2 {
				temperature = <145000>;
				hysteresis = <0>;
				type = "critical";
			};
		};
	};
};
