Add cooling maps and trip points for CPU cooling

- Mediatek's config in 4.4 starts throttling at 85C, so we do that, for
now. Define trip points every 5C from there, up to the 105C junction. We
remove one available OPP at each step.

Change-Id: I37f94218c977f70af00d2dc444cea701eab2442a
diff --git a/arch/arm64/boot/dts/mediatek/mt8167-coral.dts b/arch/arm64/boot/dts/mediatek/mt8167-coral.dts
index d860910..083089c 100644
--- a/arch/arm64/boot/dts/mediatek/mt8167-coral.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8167-coral.dts
@@ -122,7 +122,59 @@
 		cpu_thermal: cpu_thermal {
 			polling-delay-passive = <1000>; /* ms */
 			polling-delay = <1000>; /* ms */
+
 			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu_alert0: trip0 {
+					temperature = <85000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_alert1: trip1 {
+					temperature = <90000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_alert2: trip2 {
+					temperature = <95000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_alert3: trip3 {
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit0: trip4 {
+					temperature = <105000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device = <&cpu0 0 4>;
+				};
+				map1 {
+					trip = <&cpu_alert1>;
+					cooling-device = <&cpu0 0 3>;
+				};
+				map2 {
+					trip = <&cpu_alert2>;
+					cooling-device = <&cpu0 0 2>;
+				};
+				map3 {
+					trip = <&cpu_alert3>;
+					cooling-device = <&cpu0 0 1>;
+				};
+			};
 		};
 	};
 };
diff --git a/arch/arm64/boot/dts/mediatek/mt8516.dtsi b/arch/arm64/boot/dts/mediatek/mt8516.dtsi
index 1aa0152..aab0b64 100644
--- a/arch/arm64/boot/dts/mediatek/mt8516.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8516.dtsi
@@ -58,6 +58,7 @@
 				 <&topckgen CLK_TOP_MAINPLL_D2>,
 				 <&apmixedsys CLK_APMIXED_ARMPLL>;
 			clock-names = "cpu", "intermediate", "armpll";
+			#cooling-cells = <2>;
 			operating-points-v2 = <&cluster0_opp>;
 		};
 
@@ -72,6 +73,7 @@
 				 <&topckgen CLK_TOP_MAINPLL_D2>,
 				 <&apmixedsys CLK_APMIXED_ARMPLL>;
 			clock-names = "cpu", "intermediate", "armpll";
+			#cooling-cells = <2>;
 			operating-points-v2 = <&cluster0_opp>;
 		};
 
@@ -86,6 +88,7 @@
 				 <&topckgen CLK_TOP_MAINPLL_D2>,
 				 <&apmixedsys CLK_APMIXED_ARMPLL>;
 			clock-names = "cpu", "intermediate", "armpll";
+			#cooling-cells = <2>;
 			operating-points-v2 = <&cluster0_opp>;
 		};
 
@@ -100,6 +103,7 @@
 				 <&topckgen CLK_TOP_MAINPLL_D2>,
 				 <&apmixedsys CLK_APMIXED_ARMPLL>;
 			clock-names = "cpu", "intermediate", "armpll";
+			#cooling-cells = <2>;
 			operating-points-v2 = <&cluster0_opp>;
 		};