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

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

&soc {
	#address-cells = <1>;
	#size-cells = <1>;
	lmh_dcvs0: qcom,limits-dcvs@f550800 {
		compatible = "qcom,msm-hw-limits";
		interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
		qcom,affinity = <0>;
		reg = <0xf550800 0x1000>,
			<0xf521000 0x1000>;
	};

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

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

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

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

		cpu3_pause: cpu3-pause {
			qcom,cpus = <&CPU3>;
			#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";
		};
	};

	tsens0:tsens@4410000 {
		compatible = "qcom,tsens26xx";
		reg = <0x04410000 0x20>,
			<0x04411000 0x140>;
		reg-names = "tsens_srot_physical",
				"tsens_tm_physical";
		interrupts-extended = <&intc GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH>,
				<&intc GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>,
				<&mpm 89 IRQ_TYPE_EDGE_RISING>;
		interrupt-names = "tsens-upper-lower",
				"tsens-critical",
				"tsens-0C";
		tsens-reinit-wa;
		0C-sensor-num = <16>;
		#thermal-sensor-cells = <1>;
	};

	qmi-tmd-devices {
		compatible = "qcom,qmi-cooling-devices";

		modem {
			qcom,instance-id = <QMI_MODEM_INST_ID>;

			modem_pa: modem_pa {
				qcom,qmi-dev-name = "pa";
				#cooling-cells = <2>;
			};

			modem_tj: modem_tj {
				qcom,qmi-dev-name = "modem";
				#cooling-cells = <2>;
			};

			modem_skin: modem_skin {
				qcom,qmi-dev-name = "modem_skin";
				#cooling-cells = <2>;
			};

			modem_wlan: modem_wlan {
				qcom,qmi-dev-name = "wlan";
				#cooling-cells = <2>;
			};

			modem_tmd_rf_cal: modem_tmd_rf_cal {
				qcom,qmi-dev-name = "tmd_rf_cal";
				#cooling-cells = <2>;
			};
		};

		adsp {
			qcom,instance-id = <QMI_ADSP_INST_ID>;

			adsp_vdd: adsp_vdd {
				qcom,qmi-dev-name = "cpuv_restriction_cold";
				#cooling-cells = <2>;
			};
		};
	};

	qmi_sensor: qmi-ts-sensors {
		compatible = "qcom,qmi-sensors";
		#thermal-sensor-cells = <1>;

		modem {
			qcom,instance-id = <QMI_MODEM_INST_ID>;
			qcom,qmi-sensor-names = "rf_cal";
		};
	};

	lmh_cpu_vdd: qcom,lmh-cpu-vdd@f550800 {
		compatible = "qcom,lmh-cpu-vdd";
		reg =  <0xf550800 0x1000>;
		#cooling-cells = <2>;
	};

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

	qcom,cpufreq-cdev {
		compatible = "qcom,cpufreq-cdev";
		qcom,cpus = <&CPU0>;
	};
};

&thermal_zones {
	mapss {
		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";
			};
		};
	};

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

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

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

			cpu0_2_config: cpu-0-2-config {
				temperature = <100000>;
				hysteresis = <10000>;
				type = "passive";
			};

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

		cooling-maps {
			cpu0_cdev {
				trip = <&cpu0_2_config>;
				cooling-device = <&cpu0_pause 1 1>;
			};

			cpu2_cdev {
				trip = <&cpu0_2_config>;
				cooling-device = <&cpu2_pause 1 1>;
			};
		};
	};

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

			cpu1_3_config: cpu-1-3-config {
				temperature = <100000>;
				hysteresis = <10000>;
				type = "passive";
			};

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

		cooling-maps {
			cpu1_cdev {
				trip = <&cpu1_3_config>;
				cooling-device = <&cpu1_pause 1 1>;
			};

			cpu3_cdev {
				trip = <&cpu1_3_config>;
				cooling-device = <&cpu3_pause 1 1>;
			};
		};
	};

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

			mdm0_cx_mon: mdm0-cx-mon {
				temperature = <90000>;
				hysteresis = <5000>;
				type = "passive";
			};

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

		cooling-maps {
			mdm0-cx-cdev0 {
				trip = <&mdm0_cx_mon>;
				cooling-device = <&msm_gpu THERMAL_MAX_LIMIT
							THERMAL_MAX_LIMIT>;
			};

			mdm0-cx-cdev1 {
				trip = <&mdm0_cx_mon>;
				cooling-device = <&modem_tj 3 3>;
			};
		};
	};

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

			mdm1_cx_mon: mdm1-cx-mon {
				temperature = <90000>;
				hysteresis = <5000>;
				type = "passive";
			};

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

		cooling-maps {
			mdm1-cx-cdev0 {
				trip = <&mdm1_cx_mon>;
				cooling-device = <&msm_gpu THERMAL_MAX_LIMIT
							THERMAL_MAX_LIMIT>;
			};

			mdm1-cx-cdev1 {
				trip = <&mdm1_cx_mon>;
				cooling-device = <&modem_tj 3 3>;
			};
		};
	};

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

			gpu_step_trip: gpu-trip {
				temperature = <85000>;
				hysteresis = <0>;
				type = "passive";
			};

			gpu_cx_mon: gpu-cx-mon {
				temperature = <90000>;
				hysteresis = <5000>;
				type = "passive";
			};

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

		cooling-maps {
			gpu-cdev {
				trip = <&gpu_step_trip>;
				cooling-device = <&msm_gpu THERMAL_NO_LIMIT
							THERMAL_NO_LIMIT>;
			};

			gpu-cx-cdev0 {
				trip = <&gpu_cx_mon>;
				cooling-device = <&msm_gpu THERMAL_MAX_LIMIT
							THERMAL_MAX_LIMIT>;
			};

			gpu-cx-cdev1 {
				trip = <&gpu_cx_mon>;
				cooling-device = <&modem_tj 3 3>;
			};
		};
	};

	camera {
		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";
			};
		};
	};

	zeroc {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&tsens0 16>;
		trips {
			zeroc_0_trip: active-config0 {
				temperature = <1>;
				hysteresis = <1>;
				type = "passive";
			};
		};

		cooling-maps {
			lmh_cpu_cdev {
				trip = <&zeroc_0_trip>;
				cooling-device = <&lmh_cpu_vdd 1 1>;
			};

			cx_vdd_cdev {
				trip = <&zeroc_0_trip>;
				cooling-device = <&cx_cdev 1 1>;
			};

			mx_vdd_cdev {
				trip = <&zeroc_0_trip>;
				cooling-device = <&mx_cdev 1 1>;
			};

			adsp_vdd_cdev {
				trip = <&zeroc_0_trip>;
				cooling-device = <&adsp_vdd 1 1>;
			};
		};
	};

	rf_cal {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&qmi_sensor
				(QMI_MODEM_INST_ID)>;
		trips {
			rf_cal_trip: rf-cal-config {
				temperature = <2000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};

		cooling-maps {
			bcl_off_cdev {
				trip = <&rf_cal_trip>;
				cooling-device = <&bcl_off 1 1>;
			};

			tmd_rf_cal_cdev {
				trip = <&rf_cal_trip>;
				cooling-device = <&modem_tmd_rf_cal 1 1>;
			};
		};
	};
};
