summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeYuan Wang <kamewang@google.com>2023-02-10 17:39:23 +0800
committerKame(TeYuan) Wang <kamewang@google.com>2023-02-24 13:42:11 +0000
commit60838fc7a637c497067def75e04e84c681858eb7 (patch)
treec9cc9edb9d65510fdb90e175b1535ce33400c4e1
parent4fcdaf781fb173f2d318df1b32abd76ad280e6c5 (diff)
downloadpixel-60838fc7a637c497067def75e04e84c681858eb7.tar.gz
thermal: Fix throttle/release step bypass issue
The throttle/release step check will be bypassed if the sensor has no binded power rail or the power data is still collecting. Fix this issue with adding a check. Bug: 269730273 Test: verified by emul_temp Change-Id: I79ce02fa589a79bbe2dd0983c86099f36acd3c06
-rw-r--r--thermal/utils/thermal_throttling.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/thermal/utils/thermal_throttling.cpp b/thermal/utils/thermal_throttling.cpp
index 0a5f926b..b2fd9d26 100644
--- a/thermal/utils/thermal_throttling.cpp
+++ b/thermal/utils/thermal_throttling.cpp
@@ -427,7 +427,7 @@ bool ThermalThrottling::allocatePowerToCdev(
if (binded_cdev_info_pair.second.max_release_step !=
std::numeric_limits<int>::max() &&
- cdev_power_adjustment > 0) {
+ (power_data_invalid || cdev_power_adjustment > 0)) {
auto target_state =
std::max(curr_state - binded_cdev_info_pair.second.max_release_step, 0);
cdev_power_budget =
@@ -436,7 +436,7 @@ bool ThermalThrottling::allocatePowerToCdev(
if (binded_cdev_info_pair.second.max_throttle_step !=
std::numeric_limits<int>::max() &&
- cdev_power_adjustment < 0) {
+ (power_data_invalid || cdev_power_adjustment < 0)) {
auto target_state =
std::min(curr_state + binded_cdev_info_pair.second.max_throttle_step,
cdev_info.max_state);