Merge tag 'LA.VENDOR.14.3.0.r1-21600-lanai.QSSI15.0' into staging/lineage-22.2_merge-LA.VENDOR.14.3.0.r1-21600-lanai.QSSI15.0
LA.VENDOR.14.3.0.r1-21600-lanai.QSSI15.0
* tag 'LA.VENDOR.14.3.0.r1-21600-lanai.QSSI15.0':
thermal-hal: Return failure only for uninitialized sensor request
thermal-hal: Add severity aggregation logic for display sensors for neo vxr
thermal-hal: Add namespace configuration for google specific path
thermal-hal: Add skin disp sensors support for neo vxp variant
thermal-hal: Add support for neo configuration
thermal-hal: Update proper skin thermistors for seraph
thermal-hal: Update hal settings for monaco
Conflicts:
Android.bp
thermalConfig.cpp
Change-Id: I5a7306af51f4d8472891d0342d28029fefd0df5d
diff --git a/Android.bp b/Android.bp
index 2b04957..a5c90da 100644
--- a/Android.bp
+++ b/Android.bp
@@ -2,6 +2,29 @@
}
soong_config_module_type {
+ name: "thermal_hal_namespace",
+ module_type: "soong_namespace",
+ config_namespace: "qcom_vendor_config",
+ bool_variables: ["ar1_la3_path", "qcom_path"],
+ properties: ["imports"],
+}
+
+thermal_hal_namespace {
+ soong_config_variables: {
+ ar1_la3_path: {
+ imports: [
+ "vendor/qcom/ar1-la3/proprietary",
+ ],
+ },
+ qcom_path: {
+ imports: [
+ "vendor/qcom/proprietary",
+ ],
+ },
+ },
+}
+
+soong_config_module_type {
name: "qti_thermal_hal_cc_defaults",
module_type: "cc_defaults",
config_namespace: "qti_thermal",
diff --git a/thermal.cpp b/thermal.cpp
index cca9caa..7134abd 100644
--- a/thermal.cpp
+++ b/thermal.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) 2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause-Clear */
#include <ctype.h>
@@ -139,9 +139,9 @@
std::vector<Temperature> temperatures;
- if (!utils.isSensorInitialized())
+ if (!utils.isSensorInitialized(in_type))
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ThermalHAL not initialized properly.");
+ "ThermalHAL given sensor type Not initialized.");
else {
if (utils.readTemperatures(in_type, temperatures) <= 0)
LOG(VERBOSE) << __func__ << "Sensor Temperature read failure.";
@@ -159,7 +159,7 @@
if (!utils.isSensorInitialized())
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ThermalHAL not initialized properly.");
+ "ThermalHAL for sensor not initialized.");
if (utils.readTemperatureThreshold(thresh) <= 0)
LOG(VERBOSE) << __func__ << "Sensor Threshold read failure or type not supported.";
@@ -176,9 +176,9 @@
std::vector<TemperatureThreshold> thresh;
- if (!utils.isSensorInitialized())
+ if (!utils.isSensorInitialized(in_type))
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
- "ThermalHAL not initialized properly.");
+ "ThermalHAL given sensor type not initialized.");
else{
if (utils.readTemperatureThreshold(in_type, thresh) <= 0)
LOG(VERBOSE) << __func__ << "Sensor Threshold read failure or type not supported.";
diff --git a/thermalCommon.cpp b/thermalCommon.cpp
index f13fd06..d45fa44 100644
--- a/thermalCommon.cpp
+++ b/thermalCommon.cpp
@@ -310,6 +310,17 @@
return 0;
}
+int ThermalCommon::initNewThermalZone(struct target_therm_cfg& cfg)
+{
+
+ if (cfg.type == TemperatureType::CPU)
+ initializeCpuSensor(cfg);
+ else
+ initialize_sensor(cfg, 0);
+
+ return 1;
+}
+
int ThermalCommon::initThermalZones(std::vector<struct target_therm_cfg>& cfg)
{
std::vector<struct target_therm_cfg>::iterator it;
@@ -321,14 +332,10 @@
for (it = cfg.begin(); it != cfg.end(); it++)
{
- if (it->type == TemperatureType::CPU) {
- if (initializeCpuSensor(*it) < 0)
- return -1;
- continue;
- }
- if (initialize_sensor(*it, 0) < 0) {
- return -1;
- }
+ if (it->type == TemperatureType::CPU)
+ initializeCpuSensor(*it);
+ else
+ initialize_sensor(*it, 0);
}
return sens.size();
@@ -475,6 +482,30 @@
sensor.lastThrottleStatus = sensor.t.throttlingStatus;
sensor.t.throttlingStatus = severity;
+ if (sensor.sensor_name == "disp-lea-left" || sensor.sensor_name == "disp-lea-right") {
+ ThrottlingSeverity cur_severity =
+ std::max(left_display_throttle_severity, right_display_throttle_severity);
+ if (sensor.sensor_name == "disp-lea-left") {
+ left_display_throttle_severity = severity;
+ } else if (sensor.sensor_name == "disp-lea-right") {
+ right_display_throttle_severity = severity;
+ }
+
+ ThrottlingSeverity new_severity =
+ std::max(left_display_throttle_severity, right_display_throttle_severity);
+
+ LOG(DEBUG) << "Current display severity: " << (int)cur_severity
+ << " New severity L: " << (int)left_display_throttle_severity
+ << " New severity R: " << (int)right_display_throttle_severity
+ << " New severity combined: " << (int)new_severity << std::endl;
+
+ if (cur_severity != new_severity) {
+ return (int)new_severity;
+ } else {
+ return -1;
+ }
+ }
+
return (int)severity;
}
diff --git a/thermalCommon.h b/thermalCommon.h
index ef96179..618df93 100644
--- a/thermalCommon.h
+++ b/thermalCommon.h
@@ -47,6 +47,7 @@
int readFromFile(std::string_view path, std::string& out);
int initThermalZones(std::vector<struct target_therm_cfg>& cfg);
+ int initNewThermalZone(struct target_therm_cfg& cfg);
void initThreshold(struct therm_sensor& sens);
int initCdev();
@@ -70,6 +71,9 @@
std::vector<struct therm_sensor> sens;
std::vector<struct therm_cdev> cdev;
+ ThrottlingSeverity left_display_throttle_severity{ThrottlingSeverity::NONE};
+ ThrottlingSeverity right_display_throttle_severity{ThrottlingSeverity::NONE};
+
int initializeCpuSensor(struct target_therm_cfg& cpu_cfg);
int initialize_sensor(struct target_therm_cfg& cfg,
int sens_idx);
diff --git a/thermalConfig.cpp b/thermalConfig.cpp
index c4cf29c..e07ae9c 100644
--- a/thermalConfig.cpp
+++ b/thermalConfig.cpp
@@ -1486,6 +1486,23 @@
115000,
true,
},
+ // Google specific changes for aurora vxp product.
+ {
+ TemperatureType::SKIN,
+ { "disp-lea-right" },
+ "SKIN-DISP-LEA",
+ 65000,
+ 85000,
+ true,
+ },
+ {
+ TemperatureType::SKIN,
+ { "disp-lea-left" },
+ "SKIN-DISP-LEA",
+ 65000,
+ 85000,
+ true,
+ },
};
std::vector<std::string> cpu_sensors_parrot =
@@ -1919,7 +1936,7 @@
TemperatureType::CPU,
cpu_sensors_monaco,
"",
- 95000,
+ 85000,
115000,
true,
},
@@ -1927,7 +1944,7 @@
TemperatureType::GPU,
{ "gpu" },
"gpu",
- 95000,
+ 85000,
115000,
true,
},
@@ -2194,7 +2211,7 @@
std::vector<struct target_therm_cfg> seraph_specific = {
{
TemperatureType::SKIN,
- { "sys-therm-0" },
+ { "sys-therm-1" },
"skin",
60000,
95000,
diff --git a/thermalUtilsNetlink.cpp b/thermalUtilsNetlink.cpp
index 7a6c86d..1a0e3a2 100644
--- a/thermalUtilsNetlink.cpp
+++ b/thermalUtilsNetlink.cpp
@@ -31,7 +31,7 @@
/* Changes from Qualcomm Innovation Center are provided under the following license:
-Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+Copyright (c) 2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause-Clear */
#include <android-base/file.h>
@@ -66,11 +66,9 @@
std::vector<struct therm_sensor> sensorList;
std::vector<struct target_therm_cfg> therm_cfg = cfg.fetchConfig();
- is_sensor_init = false;
is_cdev_init = false;
ret = cmnInst.initThermalZones(therm_cfg);
if (ret > 0) {
- is_sensor_init = true;
sensorList = cmnInst.fetch_sensor_list();
std::lock_guard<std::mutex> _lock(sens_cb_mutex);
for (struct therm_sensor sens: sensorList) {
@@ -88,6 +86,34 @@
}
}
+bool ThermalUtils::isSensorInitialized()
+{
+ std::lock_guard<std::mutex> _lock(sens_cb_mutex);
+
+ if (thermalConfig.begin() == thermalConfig.end())
+ return false;
+
+ return true;
+}
+
+bool ThermalUtils::isSensorInitialized(TemperatureType type)
+{
+ std::unordered_map<int, struct therm_sensor>::iterator it;
+ std::lock_guard<std::mutex> _lock(sens_cb_mutex);
+
+ if (thermalConfig.begin() == thermalConfig.end())
+ return false;
+
+ for (it = thermalConfig.begin(); it != thermalConfig.end();
+ it++) {
+ struct therm_sensor& sens = it->second;
+ if (sens.t.type == type)
+ return true;
+ }
+
+ return false;
+}
+
void ThermalUtils::Notify(struct therm_sensor& sens)
{
int severity = cmnInst.estimateSeverity(sens);
@@ -136,8 +162,9 @@
std::vector<struct target_therm_cfg>::iterator it_vec;
std::vector<std::string>::iterator it;
- if (isSensorInitialized())
+ if (thermalConfig.find(tzn) != thermalConfig.end())
return;
+
for (it_vec = therm_cfg.begin();
it_vec != therm_cfg.end(); it_vec++) {
for (it = it_vec->sensor_list.begin();
@@ -153,16 +180,18 @@
<< std::endl;
return;
}
- ret = cmnInst.initThermalZones(therm_cfg);
+ ret = cmnInst.initNewThermalZone(*it_vec);
if (ret > 0) {
- is_sensor_init = true;
sensorList = cmnInst.fetch_sensor_list();
std::lock_guard<std::mutex> _lock(sens_cb_mutex);
for (struct therm_sensor sens: sensorList) {
+ if (sens.sensor_name != name)
+ continue;
thermalConfig[sens.tzn] = sens;
cmnInst.read_temperature(sens);
cmnInst.estimateSeverity(sens);
cmnInst.initThreshold(sens);
+ break;
}
}
}
diff --git a/thermalUtilsNetlink.h b/thermalUtilsNetlink.h
index 8900c9f..bee0fbc 100644
--- a/thermalUtilsNetlink.h
+++ b/thermalUtilsNetlink.h
@@ -31,7 +31,7 @@
/* Changes from Qualcomm Innovation Center are provided under the following license:
-Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+Copyright (c) 2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause-Clear */
#ifndef THERMAL_THERMAL_UTILS_H__
@@ -56,10 +56,8 @@
public:
ThermalUtils(const ueventCB &inp_cb);
~ThermalUtils() = default;
- bool isSensorInitialized()
- {
- return is_sensor_init;
- };
+ bool isSensorInitialized();
+ bool isSensorInitialized(TemperatureType type);
bool isCdevInitialized()
{
return is_cdev_init;
@@ -74,7 +72,6 @@
int readCdevStates(cdevType type,
std::vector<CoolingDevice>& cdev);
private:
- bool is_sensor_init;
bool is_cdev_init;
ThermalConfig cfg;
ThermalCommon cmnInst;