#include <dt-bindings/input/input.h>
#include <dt-bindings/input/qcom,qpnp-power-on.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/spmi/spmi.h>
#include <dt-bindings/iio/qcom,spmi-vadc.h>

&spmi_bus {
	qcom,pm6125@0 {
		compatible = "qcom,spmi-pmic";
		reg = <0x0 0x0>;
		#address-cells = <1>;
		#size-cells = <0>;

		qcom,power-on@800 {
			compatible = "qcom,qpnp-power-on";
			reg = <0x800>;
			interrupts = <0x0 0x8 0x0 IRQ_TYPE_EDGE_BOTH>,
					<0x0 0x8 0x1 IRQ_TYPE_EDGE_BOTH>;
			interrupt-names = "kpdpwr", "resin";
			qcom,pon-dbc-delay = <15625>;
			qcom,kpdpwr-sw-debounce;
			qcom,system-reset;
			qcom,store-hard-reset-reason;

			qcom,pon_1 {
				qcom,pon-type = <PON_POWER_ON_TYPE_KPDPWR>;
				qcom,pull-up = <1>;
				linux,code = <KEY_POWER>;
			};

			qcom,pon_2 {
				qcom,pon-type = <PON_POWER_ON_TYPE_RESIN>;
				qcom,pull-up = <1>;
				linux,code = <KEY_VOLUMEDOWN>;
			};
		};

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

			/* Channel nodes */
			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>;
			};

			vph_pwr {
				reg = <ADC5_VPH_PWR>;
				label = "vph_pwr";
				qcom,pre-scaling = <1 3>;
			};

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

		pm6125_adc_tm: adc_tm@3500 {
			compatible = "qcom,spmi-adc-tm5";
			reg = <0x3500>;
			interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "pm-adc-tm5";
			#address-cells = <1>;
			#size-cells = <0>;
			#thermal-sensor-cells = <1>;
		};

		pm6125_tz: qcom,temp-alarm@2400 {
			compatible = "qcom,spmi-temp-alarm";
			reg = <0x2400>;
			interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_BOTH>;
			#thermal-sensor-cells = <0>;
			qcom,temperature-threshold-set = <1>;
		};

		pm6125_clkdiv: clock-controller@5b00 {
			compatible = "qcom,spmi-clkdiv";
			reg = <0x5b00>;
			#clock-cells = <1>;
			qcom,num-clkdivs = <1>;
			clock-output-names = "pm6125_div_clk1";
			clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>;
			clock-names = "xo";
			assigned-clocks = <&pm6125_clkdiv 1>;
			assigned-clock-rates = <9600000>;
		};

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

		pm6125_rtc: qcom,pm6125_rtc {
			compatible = "qcom,pm8941-rtc";
			interrupts = <0x0 0x61 0x1 IRQ_TYPE_NONE>;
		};
	};

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

		pm6125_pwm: qcom,pwms@b300 {
			status = "disabled";
			compatible = "qcom,pwm-lpg";
			reg = <0xb300>;
			reg-names = "lpg-base";
			qcom,num-lpg-channels = <1>;
			#pwm-cells = <2>;
		};
	};
};

&thermal_zones {
	pm6125-tz {
		polling-delay-passive = <100>;
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm6125_tz>;
		wake-capable-sensor;

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

			pm6125_trip1: trip1 {
				temperature = <115000>;
				hysteresis = <0>;
				type = "passive";
			};

			trip2 {
				temperature = <145000>;
				hysteresis = <0>;
				type = "passive";
			};
		};
	};
};
