thermal-hal: add support for severity in HAL config for throttling threshold

Add support to selectively configure thermal HAL severity for
throttling threshold for any HAL config.

Change-Id: Ia502bfffaa9fb3db3f5c3c61e65acb1b1c83d509
Signed-off-by: Priyansh Jain <quic_priyjain@quicinc.com>
diff --git a/thermalCommon.cpp b/thermalCommon.cpp
index 1bbe2cf..d1e18e7 100644
--- a/thermalCommon.cpp
+++ b/thermalCommon.cpp
@@ -30,7 +30,7 @@
 
 /* Changes from Qualcomm Innovation Center are provided under the following license:
 
-Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 SPDX-License-Identifier: BSD-3-Clause-Clear */
 
 #include <cstdio>
@@ -266,16 +266,17 @@
 	sensor.lastThrottleStatus = sensor.t.throttlingStatus =
 		ThrottlingSeverity::NONE;
 	sensor.thresh.type = sensor.t.type = cfg.type;
+	sensor.throt_severity = cfg.throt_severity;
 	for (idx = 0; idx <= (size_t)ThrottlingSeverity::SHUTDOWN; idx++) {
 		sensor.thresh.hotThrottlingThresholds.push_back(UNKNOWN_TEMPERATURE);
 		sensor.thresh.coldThrottlingThresholds.push_back(UNKNOWN_TEMPERATURE);
 	}
 
 	if (cfg.throt_thresh != 0 && cfg.positive_thresh_ramp)
-		sensor.thresh.hotThrottlingThresholds[(size_t)ThrottlingSeverity::SEVERE] =
+		sensor.thresh.hotThrottlingThresholds[(size_t)sensor.throt_severity] =
 			cfg.throt_thresh / (float)sensor.mulFactor;
 	else if (cfg.throt_thresh != 0 && !cfg.positive_thresh_ramp)
-		sensor.thresh.coldThrottlingThresholds[(size_t)ThrottlingSeverity::SEVERE] =
+		sensor.thresh.coldThrottlingThresholds[(size_t)sensor.throt_severity] =
 			cfg.throt_thresh / (float)sensor.mulFactor;
 
 	if (cfg.shutdwn_thresh != 0 && cfg.positive_thresh_ramp)
diff --git a/thermalConfig.cpp b/thermalConfig.cpp
index ac05acb..c40919a 100644
--- a/thermalConfig.cpp
+++ b/thermalConfig.cpp
@@ -864,6 +864,63 @@
 		},
 	};
 
+	std::vector<struct target_therm_cfg>  diwali_common = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_waipio,
+			"",
+			95000,
+			115000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-0" },
+			"GPU0",
+			95000,
+			115000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-1" },
+			"GPU1",
+			95000,
+			115000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-0" },
+			"nsp0",
+			95000,
+			115000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-1" },
+			"nsp1",
+			95000,
+			115000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-2" },
+			"nsp2",
+			95000,
+			115000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+	};
+
 	std::vector<struct target_therm_cfg>  waipio_specific = {
 		{
 			TemperatureType::BCL_CURRENT,
@@ -1037,6 +1094,7 @@
 			46000,
 			95000,
 			true,
+			ThrottlingSeverity::LIGHT,
 		},
 	};
 
@@ -1929,9 +1987,9 @@
 		{457, waipio_common}, //Waipio
 		{482, waipio_common}, //Waipio
 		{552, waipio_common}, //Waipio-LTE
-		{506, waipio_common}, //diwali
-		{547, waipio_common}, //diwali
-		{564, waipio_common}, //diwali-LTE
+		{506, diwali_common}, //diwali
+		{547, diwali_common}, //diwali
+		{564, diwali_common}, //diwali-LTE
 		{530, waipio_common}, // cape
 		{531, waipio_common}, // cape
 		{540, waipio_common}, // cape
diff --git a/thermalData.h b/thermalData.h
index 03866d6..e45c2b4 100644
--- a/thermalData.h
+++ b/thermalData.h
@@ -30,7 +30,7 @@
 
   /* Changes from Qualcomm Innovation Center are provided under the following license:
 
-Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 SPDX-License-Identifier: BSD-3-Clause-Clear */
 
 #ifndef THERMAL_THERMAL_DATA_H__
@@ -68,6 +68,7 @@
 		int throt_thresh;
 		int shutdwn_thresh;
 		bool positive_thresh_ramp;
+		ThrottlingSeverity throt_severity = ThrottlingSeverity::SEVERE;
 	};
 
 	struct therm_sensor {
@@ -78,6 +79,7 @@
 		ThrottlingSeverity lastThrottleStatus;
 		Temperature t;
 		TemperatureThreshold thresh;
+		ThrottlingSeverity throt_severity;
 	};
 
 	struct therm_cdev {