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

&soc {
	tsens: thermal-sensor@c271000 {
		compatible = "qcom,tsens-v2";
		reg = <0x0c271000 0x1ff>, /* TM */
			<0x0c222000 0x1ff>; /* SROT */
		#qcom,sensors = <12>;
		interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 333 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "uplow","critical";
		#thermal-sensor-cells = <1>;
	};

	qcom,cpu-pause {
		compatible = "qcom,thermal-pause";

		cpu0_pause: cpu0-pause {
			qcom,cpus = <&CPU0>;
			qcom,cdev-alias = "thermal-pause-1";
			#cooling-cells = <2>;
		};

		cpu1_pause: cpu1-pause {
			qcom,cpus = <&CPU1>;
			qcom,cdev-alias = "thermal-pause-2";
			#cooling-cells = <2>;
		};

		cpu2_pause: cpu2-pause {
			qcom,cpus = <&CPU2>;
			qcom,cdev-alias = "thermal-pause-4";
			#cooling-cells = <2>;
		};

		cpu3_pause: cpu3-pause {
			qcom,cpus = <&CPU3>;
			qcom,cdev-alias = "thermal-pause-8";
			#cooling-cells = <2>;
		};

		/* Thermal-engine cooling devices */

		pause-cpu0 {
			qcom,cpus = <&CPU0>;
			qcom,cdev-alias = "pause-cpu0";
		};

		pause-cpu1 {
			qcom,cpus = <&CPU1>;
			qcom,cdev-alias = "pause-cpu1";
		};

		pause-cpu2 {
			qcom,cpus = <&CPU2>;
			qcom,cdev-alias = "pause-cpu2";
		};

		pause-cpu3 {
			qcom,cpus = <&CPU3>;
			qcom,cdev-alias = "pause-cpu3";
		};
	};

	qcom,cpu-hotplug {
		compatible = "qcom,cpu-hotplug";

		cpu0_hotplug: cpu0-hotplug {
			qcom,cpu = <&CPU0>;
			qcom,cdev-alias = "cpu-hotplug0";
			#cooling-cells = <2>;
		};

		cpu1_hotplug: cpu1-hotplug {
			qcom,cpu = <&CPU1>;
			qcom,cdev-alias = "cpu-hotplug1";
			#cooling-cells = <2>;
		};

		cpu2_hotplug: cpu2-hotplug {
			qcom,cpu = <&CPU2>;
			qcom,cdev-alias = "cpu-hotplug2";
			#cooling-cells = <2>;
		};

		cpu3_hotplug: cpu3-hotplug {
			qcom,cpu = <&CPU3>;
			qcom,cdev-alias = "cpu-hotplug3";
			#cooling-cells = <2>;
		};
	};

	qcom,cpufreq-cdev {
		compatible = "qcom,cpufreq-cdev";
		cpu-cluster0 {
			qcom,cpus = <&CPU0 &CPU1 &CPU2 &CPU3>;
		};
	};
};

#include "sdxpinn-thermal-modem.dtsi"

&thermal_zones {
	aoss-0 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 0>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};
	};

	cpuss-0 {
		polling-delay-passive = <10>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 1>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			cpuss_0_config0: active-config0 {
				temperature = <95000>;
				hysteresis = <2000>;
				type = "passive";
			};

			cpuss_0_config1: active-config1 {
				temperature = <97000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_0_config2: active-config2 {
				temperature = <99000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_0_emerg: cpuss-0-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};

			cpuss_0_emerg1: cpuss-0-emerg-cfg1 {
				temperature = <112000>;
				hysteresis = <12000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu_cdev0 {
				trip = <&cpuss_0_config0>;
				cooling-device = <&CPU0 1 1>;
			};

			cpu_cdev1 {
				trip = <&cpuss_0_config1>;
				cooling-device = <&CPU0 2 2>;
			};

			cpu_cdev2 {
				trip = <&cpuss_0_config2>;
				cooling-device = <&CPU0 3 THERMAL_NO_LIMIT>;
			};

			cpu_cdev3 {
				trip = <&cpuss_0_emerg>;
				cooling-device = <&cpu0_pause 1 1>;
			};

			cpu_cdev4 {
				trip = <&cpuss_0_emerg1>;
				cooling-device = <&cpu0_hotplug 1 1>;
			};
		};
	};

	cpuss-1 {
		polling-delay-passive = <10>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 2>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			cpuss_1_config0: active-config0 {
				temperature = <95000>;
				hysteresis = <2000>;
				type = "passive";
			};

			cpuss_1_config1: active-config1 {
				temperature = <97000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_1_config2: active-config2 {
				temperature = <99000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_1_emerg: cpuss-1-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};

			cpuss_1_emerg1: cpuss-1-emerg-cfg1 {
				temperature = <112000>;
				hysteresis = <12000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu_cdev0 {
				trip = <&cpuss_1_config0>;
				cooling-device = <&CPU0 1 1>;
			};

			cpu_cdev1 {
				trip = <&cpuss_1_config1>;
				cooling-device = <&CPU0 2 2>;
			};

			cpu_cdev2 {
				trip = <&cpuss_1_config2>;
				cooling-device = <&CPU0 3 THERMAL_NO_LIMIT>;
			};

			cpu_cdev3 {
				trip = <&cpuss_1_emerg>;
				cooling-device = <&cpu1_pause 1 1>;
			};

			cpu_cdev4 {
				trip = <&cpuss_1_emerg1>;
				cooling-device = <&cpu1_hotplug 1 1>;
			};
		};
	};

	cpuss-2 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 3>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			cpuss_2_config0: active-config0 {
				temperature = <95000>;
				hysteresis = <2000>;
				type = "passive";
			};

			cpuss_2_config1: active-config1 {
				temperature = <97000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_2_config2: active-config2 {
				temperature = <99000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_2_emerg: cpuss-2-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};

			cpuss_2_emerg1: cpuss-2-emerg-cfg1 {
				temperature = <112000>;
				hysteresis = <12000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu_cdev0 {
				trip = <&cpuss_2_config0>;
				cooling-device = <&CPU0 1 1>;
			};

			cpu_cdev1 {
				trip = <&cpuss_2_config1>;
				cooling-device = <&CPU0 2 2>;
			};

			cpu_cdev2 {
				trip = <&cpuss_2_config2>;
				cooling-device = <&CPU0 3 THERMAL_NO_LIMIT>;
			};

			cpu_cdev3 {
				trip = <&cpuss_2_emerg>;
				cooling-device = <&cpu2_pause 1 1>;
			};

			cpu_cdev4 {
				trip = <&cpuss_2_emerg1>;
				cooling-device = <&cpu2_hotplug 1 1>;
			};
		};
	};

	cpuss-3 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 4>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			cpuss_3_config0: active-config0 {
				temperature = <95000>;
				hysteresis = <2000>;
				type = "passive";
			};

			cpuss_3_config1: active-config1 {
				temperature = <97000>;
				hysteresis = <3000>;
				type = "passive";
			};

			cpuss_3_config2: active-config2 {
				temperature = <99000>;
				hysteresis = <3000>;
				type = "passive";
			};


			cpuss_3_emerg: cpuss-3-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};

			cpuss_3_emerg1: cpuss-3-emerg-cfg1 {
				temperature = <112000>;
				hysteresis = <12000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu_cdev0 {
				trip = <&cpuss_3_config0>;
				cooling-device = <&CPU0 1 1>;
			};

			cpu_cdev1 {
				trip = <&cpuss_3_config1>;
				cooling-device = <&CPU0 2 2>;
			};

			cpu_cdev2 {
				trip = <&cpuss_3_config2>;
				cooling-device = <&CPU0 3 THERMAL_NO_LIMIT>;
			};

			cpu_cdev3 {
				trip = <&cpuss_3_emerg>;
				cooling-device = <&cpu3_pause 1 1>;
			};

			cpu_cdev4 {
				trip = <&cpuss_3_emerg1>;
				cooling-device = <&cpu3_hotplug 1 1>;
			};
		};
	};

	ethphy-0 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 5>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};
	};

	mvmss-0 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 6>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};
	};

	mdmq6-0 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 7>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};
	};

	ctile {
		polling-delay-passive = <10>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 8>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};
	};

	mdmss-0 {
		polling-delay-passive = <10>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 9>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			mdmss0_config0: mdmss0-config0 {
				temperature = <101000>;
				hysteresis = <3000>;
				type = "passive";
			};

			mdmss0_config1: mdmss0-config1 {
				temperature = <105000>;
				hysteresis = <3000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			lte_cdev0 {
				trip = <&mdmss0_config0>;
				cooling-device = <&modem_lte_dsc 8 8>;
			};

			nr_scg_cdev0 {
				trip = <&mdmss0_config0>;
				cooling-device = <&modem_nr_scg_dsc 10 10>;
			};

			nr_cdev0 {
				trip = <&mdmss0_config0>;
				cooling-device = <&modem_nr_dsc 6 6>;
			};

			lte_cdev1 {
				trip = <&mdmss0_config1>;
				cooling-device = <&modem_lte_dsc 255 255>;
			};

			nr_cdev1 {
				trip = <&mdmss0_config1>;
				cooling-device = <&modem_nr_dsc 255 255>;
			};
		};
	};

	mdmss-1 {
		polling-delay-passive = <10>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 10>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			mdmss1_config0: mdmss1-config0 {
				temperature = <101000>;
				hysteresis = <3000>;
				type = "passive";
			};

			mdmss1_config1: mdmss1-config1 {
				temperature = <105000>;
				hysteresis = <3000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			lte_cdev0 {
				trip = <&mdmss1_config0>;
				cooling-device = <&modem_lte_dsc 8 8>;
			};

			nr_scg_cdev0 {
				trip = <&mdmss1_config0>;
				cooling-device = <&modem_nr_scg_dsc 10 10>;
			};

			nr_cdev0 {
				trip = <&mdmss1_config0>;
				cooling-device = <&modem_nr_dsc 6 6>;
			};

			lte_cdev1 {
				trip = <&mdmss1_config1>;
				cooling-device = <&modem_lte_dsc 255 255>;
			};

			nr_cdev1 {
				trip = <&mdmss1_config1>;
				cooling-device = <&modem_nr_dsc 255 255>;
			};
		};
	};

	mdmss-2 {
		polling-delay-passive = <10>;
		polling-delay = <0>;
		thermal-sensors = <&tsens 11>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			mdmss2_config0: mdmss2-config0 {
				temperature = <101000>;
				hysteresis = <3000>;
				type = "passive";
			};

			mdmss2_config1: mdmss2-config1 {
				temperature = <105000>;
				hysteresis = <3000>;
				type = "passive";
			};

			reset-mon-cfg {
				temperature = <115000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			lte_cdev0 {
				trip = <&mdmss2_config0>;
				cooling-device = <&modem_lte_dsc 8 8>;
			};

			nr_scg_cdev0 {
				trip = <&mdmss2_config0>;
				cooling-device = <&modem_nr_scg_dsc 10 10>;
			};

			nr_cdev0 {
				trip = <&mdmss2_config0>;
				cooling-device = <&modem_nr_dsc 6 6>;
			};

			lte_cdev1 {
				trip = <&mdmss2_config1>;
				cooling-device = <&modem_lte_dsc 255 255>;
			};

			nr_cdev1 {
				trip = <&mdmss2_config1>;
				cooling-device = <&modem_nr_dsc 255 255>;
			};
		};
	};
};
