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

&msm_gpu {
    #cooling-cells = <2>;
};

&soc {
	tsens0: thermal-sensor@c263000 {
		compatible = "qcom,tsens-v2";
		reg = <0x0c263000 0x1ff>, /* TM */
			<0x0c222000 0x1ff>; /* SROT */
		#qcom,sensors = <16>;
		interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>,
			<GIC_SPI 500 IRQ_TYPE_EDGE_RISING>;
		interrupt-names = "uplow","critical", "cold";
		#thermal-sensor-cells = <1>;
	};

	tsens1: thermal-sensor@c265000 {
		compatible = "qcom,tsens-v2";
		reg = <0x0c265000 0x1ff>, /* TM */
			<0x0c223000 0x1ff>; /* SROT */
		#qcom,sensors = <16>;
		interrupts = <GIC_SPI 507 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 509 IRQ_TYPE_LEVEL_HIGH>,
			<GIC_SPI 501 IRQ_TYPE_EDGE_RISING>;
		interrupt-names = "uplow","critical", "cold";
		#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>;
		};

		cpu4_pause: cpu4-pause {
			qcom,cpus = <&CPU4>;
			qcom,cdev-alias = "thermal-pause-10";
			#cooling-cells = <2>;
		};

		cpu5_pause: cpu5-pause {
			qcom,cpus = <&CPU5>;
			qcom,cdev-alias = "thermal-pause-20";
			#cooling-cells = <2>;
		};

		cpu6_pause: cpu6-pause {
			qcom,cpus = <&CPU6>;
			qcom,cdev-alias = "thermal-pause-40";
			#cooling-cells = <2>;
		};

		cpu7_pause: cpu7-pause {
			qcom,cpus = <&CPU7>;
			qcom,cdev-alias = "thermal-pause-80";
			#cooling-cells = <2>;
		};

		cpu_6_7_pause: cpu-6-7-pause {
			qcom,cpus = <&CPU6 &CPU7>;
			qcom,cdev-alias = "thermal-pause-C0";
			#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";
		};

		pause-cpu4 {
			qcom,cpus = <&CPU4>;
			qcom,cdev-alias = "pause-cpu4";
		};

		pause-cpu5 {
			qcom,cpus = <&CPU5>;
			qcom,cdev-alias = "pause-cpu5";
		};

		pause-cpu6 {
			qcom,cpus = <&CPU6>;
			qcom,cdev-alias = "pause-cpu6";
		};

		pause-cpu7 {
			qcom,cpus = <&CPU7>;
			qcom,cdev-alias = "pause-cpu7";
		};
	};

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

		cpu4_hotplug: cpu4-hotplug {
			qcom,cpu = <&CPU4>;
			qcom,cdev-alias = "cpu-hotplug4";
			#cooling-cells = <2>;
		};

		cpu5_hotplug: cpu5-hotplug {
			qcom,cpu = <&CPU5>;
			qcom,cdev-alias = "cpu-hotplug5";
			#cooling-cells = <2>;
		};

		cpu6_hotplug: cpu6-hotplug {
			qcom,cpu = <&CPU6>;
			qcom,cdev-alias = "cpu-hotplug6";
			#cooling-cells = <2>;
		};

		cpu7_hotplug: cpu7-hotplug {
			qcom,cpu = <&CPU7>;
			qcom,cdev-alias = "cpu-hotplug7";
			#cooling-cells = <2>;
		};
	};

	thermal_ddr_freq_table: thermal-ddr-freq-table {
		qcom,freq-tbl = < 2092800 >;
	};

	ddr_cdev: qcom,ddr-cdev {
		compatible = "qcom,ddr-cooling-device";
		#cooling-cells = <2>;
		qcom,freq-table = <&thermal_ddr_freq_table>;
		qcom,bus-width = <4>;
		interconnects = <&mc_virt MASTER_LLCC &mc_virt SLAVE_EBI1>;
	};

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

		cpu-cluster1 {
			qcom,cpus = <&CPU6 &CPU7>;
		};
	};

	qcom,devfreq-cdev {
		compatible = "qcom,devfreq-cdev";
		qcom,devfreq = <&msm_gpu>;
	};

	qcom,userspace-cdev {
		compatible = "qcom,userspace-cooling-devices";

		display_fps: display-fps {
			qcom,max-level = <3>;
			#cooling-cells = <2>;
		};
	};

	cx_sdpm@634000 {
		compatible = "qcom,sdpm";
		reg = <0x00634000 0x1000>;
		clock-names = "gpu_cc_gx_gfx3d",
			"cam_cc_camnoc_axi",
			"cam_cc_bps",
			"gcc_video_venus",
			"disp_cc_mdss_mdp";
		clocks = <&gpucc GPU_CC_GX_GFX3D_CLK_SRC>,
			<&camcc CAM_CC_CAMNOC_AXI_CLK_SRC>,
			<&camcc CAM_CC_BPS_CLK_SRC>,
			<&gcc GCC_VIDEO_VENUS_CLK_SRC>,
			<&dispcc DISP_CC_MDSS_MDP_CLK_SRC>;
		csr-id = <0 1 2 6 7>;
	};

	cx_pe: cx_rdpm_pe@635000 {
		compatible = "qcom,policy-engine";
		#thermal-sensor-cells = <0>;
		reg = <0x635000 0x1000>;
		interrupts = <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>;
	};
};

#include "ravelin-thermal-modem.dtsi"

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

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

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu0_emerg: cpu0-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu00_cdev {
				trip = <&cpu0_emerg>;
				cooling-device = <&cpu0_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu1_emerg: cpu1-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu01_cdev {
				trip = <&cpu1_emerg>;
				cooling-device = <&cpu1_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu2_emerg: cpu2-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu02_cdev {
				trip = <&cpu2_emerg>;
				cooling-device = <&cpu2_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu3_emerg: cpu3-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu03_cdev {
				trip = <&cpu3_emerg>;
				cooling-device = <&cpu3_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu4_emerg: cpu4-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu04_cdev {
				trip = <&cpu4_emerg>;
				cooling-device = <&cpu4_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu5_emerg: cpu5-emerg-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu05_cdev {
				trip = <&cpu5_emerg>;
				cooling-device = <&cpu5_pause 1 1>;
			};
		};
	};

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

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

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

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

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu6_emerg0: cpu6-emerg0-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu10_cdev {
				trip = <&cpu6_emerg0>;
				cooling-device = <&cpu6_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu6_emerg1: cpu6-emerg1-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu11_cdev {
				trip = <&cpu6_emerg1>;
				cooling-device = <&cpu6_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu7_emerg0: cpu7-emerg0-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu12_cdev {
				trip = <&cpu7_emerg0>;
				cooling-device = <&cpu7_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			cpu7_emerg1: cpu7-emerg1-cfg {
				temperature = <110000>;
				hysteresis = <10000>;
				type = "passive";
			};
		};

		cooling-maps {
			cpu13_cdev {
				trip = <&cpu7_emerg1>;
				cooling-device = <&cpu7_pause 1 1>;
			};
		};
	};

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

			thermal-hal-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

			gpu_tj_cfg: tj_cfg {
				temperature = <95000>;
				hysteresis = <5000>;
				type = "passive";
			};
		};

		cooling-maps {
			gpu_cdev {
				trip = <&gpu_tj_cfg>;
				cooling-device = <&msm_gpu 0 THERMAL_NO_LIMIT>;
			};
		};
	};

	camera {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens0 14>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

	video {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens0 15>;
		trips {
			thermal-engine-config {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

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

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

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

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

			ddr_config0: ddr0-config {
				temperature = <90000>;
				hysteresis = <5000>;
				type = "passive";
			};

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

		cooling-maps {
			ddr_cdev {
				trip = <&ddr_config0>;
				cooling-device = <&ddr_cdev 1 1>;
			};
		};
	};

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

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

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

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

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

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

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

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

	zeroc-0-step {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens0 128>;
		trips {
			thermal-engine-config {
				temperature = <1>;
				hysteresis = <1>;
				type = "passive";
			};

			min_temp_0_trip: cold-trip {
				temperature = <1>;
				hysteresis = <1>;
				type = "passive";
			};
		};

		cooling-maps {
			wcss_cx_vdd_cdev {
				trip = <&min_temp_0_trip>;
				cooling-device = <&cx_cdev 1 1>;
			};
		};
	};

	zeroc-1-step {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens1 128>;
		trips {
			thermal-engine-config {
				temperature = <1>;
				hysteresis = <1>;
				type = "passive";
			};

			min_temp_1_trip: cold-trip {
				temperature = <1>;
				hysteresis = <1>;
				type = "passive";
			};
		};

		cooling-maps {
			wcss_cx_vdd_cdev {
				trip = <&min_temp_1_trip>;
				cooling-device = <&cx_cdev 1 1>;
			};
		};
	};

	cx-pe {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&cx_pe>;

		trips {
			cx_pe_config1: cx-pe-config1 {
				temperature = <1>;
				hysteresis = <1>;
				type = "passive";
			};
		};

		cooling-maps {
			 gpu_cdev {
				trip = <&cx_pe_config1>;
				cooling-device = <&msm_gpu 3 3>;
			};

		};
	};
};
