#include <dt-bindings/clock/qcom,rpmcc.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/input/qcom,qpnp-power-on.h>
#include <dt-bindings/spmi/spmi.h>

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

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

		pm6350_revid: qcom,revid@100 {
			compatible = "qcom,qpnp-revid";
			reg = <0x100>;
		};

		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;
				linux,code = <KEY_POWER>;
			};

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

		pm6350_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>;
		};

		pm6350_clkdiv: clock-controller@5b00 {
			compatible = "qcom,spmi-clkdiv";
			reg = <0x5b00>;
			#clock-cells = <1>;
			qcom,num-clkdivs = <1>;
			clock-output-names = "pm6350_div_clk1";
			clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>;
			clock-names = "xo";
			status = "disabled";
		};

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

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

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

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

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

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

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