Merge tag 'LA.VENDOR.13.2.0.r1-22400-KAILUA.QSSI14.0' into staging/lineage-21.0_merge-LA.VENDOR.13.2.0.r1-22400-KAILUA.QSSI14.0

LA.VENDOR.13.2.0.r1-22400-KAILUA.QSSI14.0

# By Nitesh Kumar (2) and Priyansh Jain (1)
# Via Linux Build Service Account (2) and Brahmaiah Gunturu (1)
* tag 'LA.VENDOR.13.2.0.r1-22400-KAILUA.QSSI14.0':
  thermal-hal: Add camano 4G soc id
  thermal-hal: Add camano 4G soc id
  thermal-hal: Enable support for lemans auto target

Change-Id: Id3e6d574396c5effabbc147fc0f2933308755924
diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..7d6f0fd
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/hardware/qcom/thermal
diff --git a/Android.bp b/Android.bp
index 8acb48b..930ec37 100644
--- a/Android.bp
+++ b/Android.bp
@@ -19,7 +19,6 @@
 		"libbase",
 		"libcutils",
 		"libhidlbase",
-		"libhidltransport",
 		"libutils",
 		"liblog",
 		"android.hardware.thermal@1.0",
diff --git a/android.hardware.thermal@2.0-service.qti-v2.rc b/android.hardware.thermal@2.0-service.qti-v2.rc
index 29d9cbc..e58bb9d 100644
--- a/android.hardware.thermal@2.0-service.qti-v2.rc
+++ b/android.hardware.thermal@2.0-service.qti-v2.rc
@@ -33,3 +33,7 @@
 	class hal
 	user root
 	group root
+
+on boot
+    wait /sys/kernel/boot_adsp/boot
+    restart android.thermal-hal
diff --git a/thermal.cpp b/thermal.cpp
index cb379c8..c1211a6 100644
--- a/thermal.cpp
+++ b/thermal.cpp
@@ -26,6 +26,39 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *   * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <ctype.h>
@@ -59,6 +92,13 @@
 	.vrThrottlingThreshold = 40,
 };
 
+static const Temperature dummy_temp_2_0 = {
+	.type = TemperatureType::SKIN,
+	.name = "test sensor",
+	.value = 25.0,
+	.throttlingStatus = ThrottlingSeverity::NONE,
+};
+
 template <typename A, typename B>
 Return<void> exit_hal(A _cb, hidl_vec<B> _data, std::string_view _msg) {
 	ThermalStatus _status;
@@ -169,9 +209,15 @@
 		return exit_hal(_hidl_cb, temperatures,
 			"ThermalHAL not initialized properly.");
 
-	if (utils.readTemperatures(filterType, type, temperatures) <= 0)
-		return exit_hal(_hidl_cb, temperatures,
-				"Sensor Temperature read failure.");
+	if (utils.readTemperatures(filterType, type, temperatures) <= 0) {
+		if (filterType && type != dummy_temp_2_0.type) {
+			status.code = ThermalStatusCode::FAILURE;
+			status.debugMessage = "Failed to read dummy temperature value";
+		} else {
+			temperatures = {dummy_temp_2_0};
+			LOG(INFO) << "Returning Dummy Temperature Value" << std::endl;
+		}
+	}
 
 	_hidl_cb(status, temperatures);
 
diff --git a/thermalCommon.cpp b/thermalCommon.cpp
index 9c9d632..5e9ac15 100644
--- a/thermalCommon.cpp
+++ b/thermalCommon.cpp
@@ -26,6 +26,38 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *	* Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ *	* Redistributions in binary form must reproduce the above
+ *	  copyright notice, this list of conditions and the following
+ *	  disclaimer in the documentation and/or other materials provided
+ *	  with the distribution.
+ *	* Neither the name of Qualcomm Innovation Center, Inc. nor the
+ *	  names of its contributors may be used to endorse or promote products
+ *	  derived from this software without specific prior written permission.
+ *
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+ * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <cstdio>
@@ -262,6 +294,7 @@
 	sensor.lastThrottleStatus = sensor.t.throttlingStatus =
 		ThrottlingSeverity::NONE;
 	sensor.thresh.type = sensor.t.type = cfg.type;
+	sensor.throt_severity = cfg.throt_severity;
 	sensor.thresh.vrThrottlingThreshold =
 	UNKNOWN_TEMPERATURE;
 	for (idx = 0; idx <= (size_t)ThrottlingSeverity::SHUTDOWN; idx++) {
@@ -271,10 +304,10 @@
 	}
 
 	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 0b1830b..75e0a75 100644
--- a/thermalConfig.cpp
+++ b/thermalConfig.cpp
@@ -28,13 +28,14 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * Changes from Qualcomm Innovation Center are provided under the following license:
- * Copyright (c) 2022 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 <unordered_map>
 #include <android-base/logging.h>
 #include <android/hardware/thermal/2.0/IThermal.h>
+#include <utility>
 
 #include "thermalData.h"
 #include "thermalConfig.h"
@@ -45,6 +46,255 @@
 namespace V2_0 {
 namespace implementation {
 	constexpr std::string_view socIDPath("/sys/devices/soc0/soc_id");
+	constexpr std::string_view hwPlatformPath("/sys/devices/soc0/hw_platform");
+
+	std::vector<std::string> cpu_sensors_439 =
+	{
+		"apc1-cpu0-usr",
+		"apc1-cpu1-usr",
+		"apc1-cpu2-usr",
+		"apc1-cpu3-usr",
+		"cpuss0-usr",
+		"cpuss0-usr",
+		"cpuss0-usr",
+		"cpuss0-usr",
+	};
+
+	std::vector<struct target_therm_cfg> sensor_cfg_sdm632 =
+	{
+		{
+			TemperatureType::CPU,
+			cpu_sensors_439,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpu0-usr" },
+			"GPU",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{ "xo-therm-adc" },
+			"skin",
+			40000,
+			95000,
+			40000,
+			true,
+		},
+		{
+			TemperatureType::BCL_VOLTAGE,
+			{ "pmi-vbat-lvl0" },
+			"vbat",
+			3200,
+			3000,
+			3200,
+			false,
+		},
+		{
+			TemperatureType::BCL_CURRENT,
+			{ "pmi-ibat-lvl0" },
+			"ibat",
+			4200,
+			4400,
+			4200,
+			true,
+		},
+		{
+			TemperatureType::BCL_PERCENTAGE,
+			{ "soc" },
+			"soc",
+			10,
+			2,
+			10,
+			false,
+		},
+	};
+
+	std::vector<struct target_therm_cfg> sensor_cfg_439 =
+	{
+		{
+			TemperatureType::CPU,
+			cpu_sensors_439,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpu-usr" },
+			"GPU",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{ "quiet-therm-adc" },
+			"skin",
+			40000,
+			95000,
+			40000,
+			true,
+		},
+		{
+			TemperatureType::BCL_VOLTAGE,
+			{ "vbat_adc" },
+			"vbat",
+			3200,
+			3000,
+			3200,
+			false,
+		},
+		{
+			TemperatureType::BCL_CURRENT,
+			{ "ibat-high" },
+			"ibat",
+			4200,
+			4400,
+			4200,
+			true,
+		},
+		{
+			TemperatureType::BCL_PERCENTAGE,
+			{ "soc" },
+			"soc",
+			10,
+			2,
+			10,
+			false,
+		},
+	};
+
+	std::vector<std::string> cpu_sensors_sdm710 =
+	{
+		"cpu0-silver-usr",
+		"cpu1-silver-usr",
+		"cpu2-silver-usr",
+		"cpu3-silver-usr",
+		"cpu4-silver-usr",
+		"cpu5-silver-usr",
+		"cpu0-gold-usr",
+		"cpu1-gold-usr",
+	};
+
+	std::vector<struct target_therm_cfg> sensor_cfg_sdm710 = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_sdm710,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{"gpu0-usr"},
+			"gpu0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{"gpu1-usr"},
+			"gpu1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{"xo-therm-adc"},
+			"skin",
+			55000,
+			95000,
+			55000,
+			true,
+		},
+		{
+			TemperatureType::BCL_PERCENTAGE,
+			{"soc"},
+			"soc",
+			10,
+			2,
+			10,
+			false,
+		},
+	};
+
+	std::vector<std::string> cpu_sensors_sdm845 =
+	{
+		"cpu0-silver-usr",
+		"cpu1-silver-usr",
+		"cpu2-silver-usr",
+		"cpu3-silver-usr",
+		"cpu0-gold-usr",
+		"cpu1-gold-usr",
+		"cpu2-gold-usr",
+		"cpu3-gold-usr",
+	};
+
+	std::vector<struct target_therm_cfg> sensor_cfg_sdm845 = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_sdm845,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{"gpu0-usr"},
+			"gpu0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{"gpu1-usr"},
+			"gpu1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{"xo-therm-adc"},
+			"skin",
+			55000,
+			95000,
+			55000,
+			true,
+		},
+		{
+			TemperatureType::BCL_PERCENTAGE,
+			{"soc"},
+			"soc",
+			10,
+			2,
+			10,
+			false,
+		},
+	};
 
 	std::vector<std::string> cpu_sensors_bengal =
 	{
@@ -256,6 +506,46 @@
 		},
 	};
 
+	std::vector<struct target_therm_cfg> sensor_cfg_sdm660 =
+	{
+		{
+			TemperatureType::CPU,
+			cpu_sensors_trinket,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpu-usr" },
+			"GPU",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{ "xo-therm-adc" },
+			"skin",
+			40000,
+			95000,
+			40000,
+			true,
+		},
+		{
+			TemperatureType::BCL_PERCENTAGE,
+			{ "soc" },
+			"soc",
+			10,
+			2,
+			10,
+			false,
+		},
+	};
+
 	std::vector<std::string> cpu_sensors_monaco =
 	{
 		"cpuss-0",
@@ -340,9 +630,9 @@
 			TemperatureType::SKIN,
 			{ "xo-therm-usr" },
 			"skin",
-			40000,
+			55000,
 			95000,
-			40000,
+			55000,
 			true,
 		},
 		{
@@ -865,6 +1155,69 @@
 		},
 	};
 
+	std::vector<struct target_therm_cfg>  diwali_common = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_waipio,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-0" },
+			"GPU0",
+			95000,
+			115000,
+			95000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-1" },
+			"GPU1",
+			95000,
+			115000,
+			95000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-0" },
+			"nsp0",
+			95000,
+			115000,
+			95000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-1" },
+			"nsp1",
+			95000,
+			115000,
+			95000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-2" },
+			"nsp2",
+			95000,
+			115000,
+			95000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+	};
+
 	std::vector<struct target_therm_cfg>  waipio_specific = {
 		{
 			TemperatureType::BCL_CURRENT,
@@ -1123,7 +1476,154 @@
 	std::vector<struct target_therm_cfg>  diwali_specific = {
 		{
 			TemperatureType::BCL_CURRENT,
-			{ "pm8350b-ibat-lvl0" },
+			{ "pm7250b-ibat-lvl0" },
+			"ibat",
+			9000,
+			9500,
+			9000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{ "quiet-therm" },
+			"skin",
+			46000,
+			95000,
+			46000,
+			true,
+			ThrottlingSeverity::LIGHT,
+		},
+	};
+
+	std::vector<std::string> cpu_sensors_neo =
+	{
+		"cpu-0-0",
+		"cpu-0-1",
+		"cpu-0-2",
+		"cpu-0-3",
+	};
+
+	std::vector<struct target_therm_cfg>  neo_common = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_neo,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-0" },
+			"GPU0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-1" },
+			"GPU1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-0" },
+			"nsp0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-1" },
+			"nsp1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-2" },
+			"nsp2",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+	};
+
+	std::vector<std::string> cpu_sensors_parrot =
+	{
+		"cpu-0-0",
+		"cpu-0-1",
+		"cpu-0-2",
+		"cpu-0-3",
+		"cpu-1-0",
+		"cpu-1-2",
+		"cpu-1-4",
+		"cpu-1-6",
+	};
+
+	std::vector<struct target_therm_cfg>  parrot_common = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_parrot,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-0" },
+			"GPU0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-1" },
+			"GPU1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-0" },
+			"nsp0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-1" },
+			"nsp1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+	};
+
+	std::vector<struct target_therm_cfg>  parrot_specific = {
+		{
+			TemperatureType::BCL_CURRENT,
+			{ "pm7250b-ibat-lvl0" },
 			"ibat",
 			6000,
 			7500,
@@ -1132,11 +1632,224 @@
 		},
 		{
 			TemperatureType::SKIN,
-			{ "quiet-therm" },
+			{ "xo-therm" },
 			"skin",
-			40000,
+			55000,
 			95000,
-			40000,
+			55000,
+			true,
+		},
+	};
+
+	std::vector<std::string> cpu_sensors_anorak =
+	{
+		"cpu-0-0-0",
+		"cpu-0-0-1",
+		"cpu-0-1-0",
+		"cpu-0-1-1",
+		"cpu-1-0-0",
+		"cpu-1-0-1",
+		"cpu-1-1-0",
+		"cpu-1-1-1",
+		"cpu-1-2-0",
+		"cpu-1-2-1",
+		"cpu-1-3-0",
+		"cpu-1-3-1",
+	};
+
+	std::vector<struct target_therm_cfg>  anorak_common = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_anorak,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-0" },
+			"nsp0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-1" },
+			"nsp1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::NPU,
+			{ "nspss-2" },
+			"nsp2",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-0" },
+			"GPU0",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-1" },
+			"GPU1",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-2" },
+			"GPU2",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-3" },
+			"GPU3",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-4" },
+			"GPU4",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-5" },
+			"GPU5",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-6" },
+			"GPU6",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss-7" },
+			"GPU7",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+	};
+	std::vector<struct target_therm_cfg>  anorak_specific = {
+		{
+			TemperatureType::BCL_CURRENT,
+			{ "pm8550b-ibat-lvl0" },
+			"ibat",
+			9000,
+			10000,
+			9000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{ "sys-therm-0" },
+			"skin",
+			55000,
+			95000,
+			55000,
+			true,
+		},
+	};
+
+	std::vector<std::string> cpu_sensors_ravelin =
+	{
+		"cpu-0-0",
+		"cpu-0-1",
+		"cpu-0-2",
+		"cpu-0-3",
+		"cpu-0-4",
+		"cpu-0-5",
+		"cpu-1-0",
+		"cpu-1-2",
+	};
+
+	std::vector<struct target_therm_cfg>  ravelin_common = {
+		{
+			TemperatureType::CPU,
+			cpu_sensors_ravelin,
+			"",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::GPU,
+			{ "gpuss" },
+			"GPU",
+			95000,
+			115000,
+			95000,
+			true,
+		},
+		{
+			TemperatureType::SKIN,
+			{ "sys-therm-1" },
+			"skin",
+			55000,
+			95000,
+			55000,
+			true,
+		},
+	};
+
+	std::vector<struct target_therm_cfg>  ravelin_specific_qrd = {
+		{
+			TemperatureType::BCL_CURRENT,
+			{ "pmi632-ibat-lvl0" },
+			"ibat",
+			6000,
+			7500,
+			6000,
+			true,
+		},
+	};
+
+	std::vector<struct target_therm_cfg>  ravelin_specific_idp = {
+		{
+			TemperatureType::BCL_CURRENT,
+			{ "pm7250b-ibat-lvl0" },
+			"ibat",
+			6000,
+			7500,
+			6000,
 			true,
 		},
 	};
@@ -1243,6 +1956,18 @@
 
 	const std::unordered_map<int, std::vector<struct target_therm_cfg>>
 		msm_soc_map = {
+		{353, sensor_cfg_439},
+		{354, sensor_cfg_439},
+		{363, sensor_cfg_439},
+		{364, sensor_cfg_439},
+		{416, sensor_cfg_439},
+		{437, sensor_cfg_439},
+		{349, sensor_cfg_sdm632},
+		{336, sensor_cfg_sdm710}, // SDM670
+		{360, sensor_cfg_sdm710}, // SDM710
+		{393, sensor_cfg_sdm710}, // SDM712
+		{321, sensor_cfg_sdm845},
+		{341, sensor_cfg_sdm845},
 		{417, sensor_cfg_bengal}, // bengal
 		{420, sensor_cfg_bengal},
 		{444, sensor_cfg_bengal},
@@ -1258,6 +1983,10 @@
 		{394, sensor_cfg_trinket},
 		{467, sensor_cfg_trinket},
 		{468, sensor_cfg_trinket},
+		{317, sensor_cfg_sdm660},
+		{318, sensor_cfg_sdm660}, // sdm630
+		{345, sensor_cfg_sdm660}, // sdm636
+		{385, sensor_cfg_sdm660}, // sdm455
 		{400, sensor_cfg_lito}, // lito
 		{440, sensor_cfg_lito},
 		{407, sensor_cfg_lito}, // atoll
@@ -1281,15 +2010,29 @@
 		{502, lahaina_common},
 		{450, lahaina_common}, // shima
 		{454, sensor_cfg_holi}, // holi
+		{507, sensor_cfg_holi}, // blair
 		{475, sensor_cfg_yupik}, // yupik
 		{515, sensor_cfg_yupik}, // YUPIK-LTE
 		{457, waipio_common}, //Waipio
 		{482, waipio_common}, //Waipio
 		{552, waipio_common}, //Waipio-LTE
-		{506, waipio_common}, //diwali
+		{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
+		{525, neo_common},
+		{554, neo_common},
+		{537, parrot_common}, //Netrani mobile
+		{583, parrot_common}, //Netrani mobile without modem
+		{613, parrot_common}, //Netrani APQ
+		{631, parrot_common},
+		{549, anorak_common},
+		{568, ravelin_common}, //Clarence Mobile
+		{581, ravelin_common}, //Clarence IOT
+		{582, ravelin_common}, //Clarence IOT without modem
+		{591, waipio_common}, //ukee
 		{519, kalama_common}, //Kalama
 		{536, kalama_common}, //Kalamap
 		{600, kalama_common}, //Kalama_sg
@@ -1318,9 +2061,17 @@
 		{482, waipio_specific}, //Waipio
 		{552, waipio_specific}, //Waipio-LTE
 		{506, diwali_specific}, //diwali
+		{547, diwali_specific}, //diwali
+		{564, diwali_specific}, //diwali-LTE
 		{530, waipio_specific}, // cape
 		{531, waipio_specific}, // cape
 		{540, waipio_specific}, // cape
+		{537, parrot_specific}, //Netrani mobile
+		{583, parrot_specific}, //Netrani mobile without modem
+		{613, parrot_specific}, //Netrani APQ
+		{631, parrot_specific},
+		{549, anorak_specific},
+		{591, waipio_specific}, //ukee
 		{519, kalama_specific}, //Kalama
 		{536, kalama_specific}, //Kalamap
 		{600, kalama_specific}, //Kalama_sg
@@ -1331,18 +2082,37 @@
 		{644, crow_specific}, //crow
 	};
 
+	const std::unordered_multimap<int, std::pair<std::string,
+				std::vector<struct target_therm_cfg>>>
+		msm_platform_specific = {
+		{568, std::make_pair("QRD", ravelin_specific_qrd)},
+		{568, std::make_pair("IDP", ravelin_specific_idp)},
+	};
+
 	std::vector<struct target_therm_cfg> add_target_config(
-			int socID,
+			int socID, std::string hwPlatform,
 			std::vector<struct target_therm_cfg> conf)
 	{
 		std::vector<struct target_therm_cfg> targetConf;
 
-		if (msm_soc_specific.find(socID) == msm_soc_specific.end())
-			return conf;
-		targetConf = (msm_soc_specific.find(socID))->second;
-
-		conf.insert(conf.end(), targetConf.begin(),
+		if (msm_soc_specific.find(socID) != msm_soc_specific.end()) {
+			targetConf = (msm_soc_specific.find(socID))->second;
+			conf.insert(conf.end(), targetConf.begin(),
 					targetConf.end());
+		}
+
+		auto range = msm_platform_specific.equal_range(socID);
+		auto it = range.first;
+		for (; it != range.second; ++it) {
+			if (it->second.first != hwPlatform)
+				continue;
+
+			targetConf = it->second.second;
+			conf.insert(conf.end(), targetConf.begin(),
+					targetConf.end());
+			break;
+		}
+
 		return conf;
 	}
 
@@ -1355,11 +2125,18 @@
 		int ct = 0;
 		bool read_ok = false;
 
+		soc_id = 0;
 		do {
 			if (cmnInst.readFromFile(socIDPath, soc_val) <= 0) {
 				LOG(ERROR) <<"soc ID fetch error";
 				return;
 			}
+
+			if (cmnInst.readFromFile(hwPlatformPath, hw_platform) <= 0) {
+				LOG(ERROR) <<"hw Platform fetch error";
+				continue;
+			}
+
 			try {
 				soc_id = std::stoi(soc_val, nullptr, 0);
 				read_ok = true;
@@ -1368,8 +2145,7 @@
 				LOG(ERROR) <<"soc id stoi err:" << err.what()
 					<< " buf:" << soc_val;
 			}
-			ct++;
-		} while (!read_ok && ct < RETRY_CT);
+		} while (ct++ && !read_ok && ct < RETRY_CT);
 		if (soc_id <= 0) {
 			LOG(ERROR) << "Invalid soc ID: " << soc_id;
 			return;
@@ -1379,7 +2155,7 @@
 			LOG(ERROR) << "No config for soc ID: " << soc_id;
 			return;
 		}
-		thermalConfig = add_target_config(soc_id, it->second);
+		thermalConfig = add_target_config(soc_id, hw_platform, it->second);
 		for (it_vec = thermalConfig.begin();
 				it_vec != thermalConfig.end(); it_vec++) {
 			if (it_vec->type == TemperatureType::BCL_PERCENTAGE)
diff --git a/thermalConfig.h b/thermalConfig.h
index 07f3375..4614616 100644
--- a/thermalConfig.h
+++ b/thermalConfig.h
@@ -26,6 +26,38 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *	* Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ *	* Redistributions in binary form must reproduce the above
+ *	  copyright notice, this list of conditions and the following
+ *	  disclaimer in the documentation and/or other materials provided
+ *	  with the distribution.
+ *	* Neither the name of Qualcomm Innovation Center, Inc. nor the
+ *	  names of its contributors may be used to endorse or promote products
+ *	  derived from this software without specific prior written permission.
+ *
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+ * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef THERMAL_THERMAL_CONFIG_H__
@@ -55,6 +87,7 @@
 	private:
 		std::vector<struct target_therm_cfg> thermalConfig;
 		int soc_id;
+		std::string hw_platform;
 		ThermalCommon cmnInst;
 };
 
diff --git a/thermalData.h b/thermalData.h
index 93eb5cc..ded1441 100644
--- a/thermalData.h
+++ b/thermalData.h
@@ -26,6 +26,38 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *	* Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ *	* Redistributions in binary form must reproduce the above
+ *	  copyright notice, this list of conditions and the following
+ *	  disclaimer in the documentation and/or other materials provided
+ *	  with the distribution.
+ *	* Neither the name of Qualcomm Innovation Center, Inc. nor the
+ *	  names of its contributors may be used to endorse or promote products
+ *	  derived from this software without specific prior written permission.
+ *
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+ * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef THERMAL_THERMAL_DATA_H__
@@ -70,6 +102,7 @@
 		int shutdwn_thresh;
 		int vr_thresh;
 		bool positive_thresh_ramp;
+		ThrottlingSeverity throt_severity = ThrottlingSeverity::SEVERE;
 	};
 
 	struct therm_sensor {
@@ -80,6 +113,7 @@
 		ThrottlingSeverity lastThrottleStatus;
 		Temperature t;
 		TemperatureThreshold thresh;
+		ThrottlingSeverity throt_severity;
 	};
 
 	struct therm_cdev {
diff --git a/thermalUtils.cpp b/thermalUtils.cpp
index 4cd94a2..f6216cc 100644
--- a/thermalUtils.cpp
+++ b/thermalUtils.cpp
@@ -26,6 +26,38 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *	* Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ *	* Redistributions in binary form must reproduce the above
+ *	  copyright notice, this list of conditions and the following
+ *	  disclaimer in the documentation and/or other materials provided
+ *	  with the distribution.
+ *	* Neither the name of Qualcomm Innovation Center, Inc. nor the
+ *	  names of its contributors may be used to endorse or promote products
+ *	  derived from this software without specific prior written permission.
+ *
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+ * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <android-base/file.h>
@@ -131,7 +163,7 @@
 		_temp.name = sens.t.name;
 		_temp.type = (TemperatureType_1_0)sens.t.type;
 		_temp.throttlingThreshold = sens.thresh.hotThrottlingThresholds[
-					(size_t)ThrottlingSeverity::SEVERE];
+					(size_t)sens.throt_severity];
 		_temp.shutdownThreshold = sens.thresh.hotThrottlingThresholds[
 					(size_t)ThrottlingSeverity::SHUTDOWN];
 		_temp.vrThrottlingThreshold = sens.thresh.vrThrottlingThreshold;
diff --git a/thermalUtilsNetlink.cpp b/thermalUtilsNetlink.cpp
index 2b340f8..aced9c2 100644
--- a/thermalUtilsNetlink.cpp
+++ b/thermalUtilsNetlink.cpp
@@ -27,6 +27,38 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *	* Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ *	* Redistributions in binary form must reproduce the above
+ *	  copyright notice, this list of conditions and the following
+ *	  disclaimer in the documentation and/or other materials provided
+ *	  with the distribution.
+ *	* Neither the name of Qualcomm Innovation Center, Inc. nor the
+ *	  names of its contributors may be used to endorse or promote products
+ *	  derived from this software without specific prior written permission.
+ *
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+ * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <android-base/file.h>
@@ -189,7 +221,7 @@
 		_temp.name = sens.t.name;
 		_temp.type = (TemperatureType_1_0)sens.t.type;
 		_temp.throttlingThreshold = sens.thresh.hotThrottlingThresholds[
-					(size_t)ThrottlingSeverity::SEVERE];
+					(size_t)sens.throt_severity];
 		_temp.shutdownThreshold = sens.thresh.hotThrottlingThresholds[
 					(size_t)ThrottlingSeverity::SHUTDOWN];
 		_temp.vrThrottlingThreshold = sens.thresh.vrThrottlingThreshold;