// SPDX-License-Identifier: BSD-3-Clause
/*
 * Copyright (c) 2023, Linaro Limited
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/spmi/spmi.h>

/ {
	thermal-zones {
		pmm8654au_0_thermal: pm8775-0-thermal {
			polling-delay-passive = <100>;
			polling-delay = <0>;
			thermal-sensors = <&pmm8654au_0_temp_alarm>;

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

				trip1 {
					temperature = <125000>;
					hysteresis = <0>;
					type = "critical";
				};
			};
		};

		pmm8654au_1_thermal: pm8775-1-thermal {
			polling-delay-passive = <100>;
			polling-delay = <0>;
			thermal-sensors = <&pmm8654au_1_temp_alarm>;

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

				trip1 {
					temperature = <125000>;
					hysteresis = <0>;
					type = "critical";
				};
			};
		};

		pmm8654au_2_thermal: pm8775-2-thermal {
			polling-delay-passive = <100>;
			polling-delay = <0>;
			thermal-sensors = <&pmm8654au_2_temp_alarm>;

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

				trip1 {
					temperature = <125000>;
					hysteresis = <0>;
					type = "critical";
				};
			};
		};

		pmm8654au_3_thermal: pm8775-3-thermal {
			polling-delay-passive = <100>;
			polling-delay = <0>;
			thermal-sensors = <&pmm8654au_3_temp_alarm>;

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

				trip1 {
					temperature = <125000>;
					hysteresis = <0>;
					type = "critical";
				};
			};
		};
	};

	reboot-mode {
		compatible = "nvmem-reboot-mode";
		nvmem-cells = <&reboot_reason>;
		nvmem-cell-names = "reboot-mode";
		mode-recovery = <0x01>;
		mode-bootloader = <0x02>;
	};
};

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

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

		pmm8654au_0_pon: pon@1200 {
			compatible = "qcom,pmk8350-pon";
			reg = <0x1200>, <0x800>;
			reg-names = "hlos", "pbs";

			pmm8654au_0_pon_pwrkey: pwrkey {
				compatible = "qcom,pmk8350-pwrkey";
				interrupts-extended = <&spmi_bus 0x0 0x12 0x7 IRQ_TYPE_EDGE_BOTH>;
				linux,code = <KEY_POWER>;
				debounce = <15625>;
			};

			pmm8654au_0_pon_resin: resin {
				compatible = "qcom,pmk8350-resin";
				interrupts-extended = <&spmi_bus 0x0 0x12 0x6 IRQ_TYPE_EDGE_BOTH>;
				debounce = <15625>;
				status = "disabled";
			};
		};

		pmm8654au_0_gpios: gpio@8800 {
			compatible = "qcom,pmm8654au-gpio", "qcom,spmi-gpio";
			reg = <0x8800>;
			gpio-controller;
			gpio-ranges = <&pmm8654au_0_gpios 0 0 12>;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};

		pmm8654au_0_sdam_0: nvram@7100 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7100>;
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = <0 0x7100 0x100>;

			reboot_reason: reboot-reason@48 {
				reg = <0x48 0x1>;
				bits = <1 7>;
			};
		};
	};

	pmm8654au_1: pmic@2 {
		compatible = "qcom,pmm8654au", "qcom,spmi-pmic";
		reg = <0x2 SPMI_USID>;
		#address-cells = <1>;
		#size-cells = <0>;

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

		pmm8654au_1_gpios: gpio@8800 {
			compatible = "qcom,pmm8654au-gpio", "qcom,spmi-gpio";
			reg = <0x8800>;
			gpio-controller;
			gpio-ranges = <&pmm8654au_1_gpios 0 0 12>;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};
	};

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

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

		pmm8654au_2_gpios: gpio@8800 {
			compatible = "qcom,pmm8654au-gpio", "qcom,spmi-gpio";
			reg = <0x8800>;
			gpio-controller;
			gpio-ranges = <&pmm8654au_2_gpios 0 0 12>;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};
	};

	pmm8654au_3: pmic@6 {
		compatible = "qcom,pmm8654au", "qcom,spmi-pmic";
		reg = <0x6 SPMI_USID>;
		#address-cells = <1>;
		#size-cells = <0>;

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

		pmm8654au_3_gpios: gpio@8800 {
			compatible = "qcom,pmm8654au-gpio", "qcom,spmi-gpio";
			reg = <0x8800>;
			gpio-controller;
			gpio-ranges = <&pmm8654au_3_gpios 0 0 12>;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};
	};
};