From 2f5576dee0dd716fdcc38ef85ddfe9ecbfccd8cb Mon Sep 17 00:00:00 2001 From: TeYuan Wang Date: Wed, 3 Mar 2021 15:03:53 +0800 Subject: thermal: Clear thermal protection when disable.thermal.control is enabled Bug: 181349449 Test: Monitor the user_vote status with switching vendor.disable.thermal.control Change-Id: I206d25ec0f7d580b297f0463dfddf1a7ca963b38 Signed-off-by: TeYuan Wang --- thermal/pixel-thermal-logd.rc | 4 ++++ thermal/thermal-helper.cpp | 14 ++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'thermal') diff --git a/thermal/pixel-thermal-logd.rc b/thermal/pixel-thermal-logd.rc index cb0340c6..b03778dd 100644 --- a/thermal/pixel-thermal-logd.rc +++ b/thermal/pixel-thermal-logd.rc @@ -26,6 +26,7 @@ on property:persist.vendor.disable.thermal.tj.control=* on property:vendor.disable.thermal.control=1 && property:vendor.thermal.link_ready=1 # common stop vendor.thermal-engine + restart vendor.thermal-hal-2-0 # sdm845 write /dev/thermal/tz-by-name/quiet-therm-adc/mode disabled write /dev/thermal/tz-by-name/quiet-therm-monitor/mode disabled @@ -61,6 +62,7 @@ on property:vendor.disable.thermal.control=1 && property:vendor.thermal.link_rea on property:vendor.disable.thermal.control=0 && property:vendor.thermal.link_ready=1 # common start vendor.thermal-engine + restart vendor.thermal-hal-2-0 # sdm845 write /dev/thermal/tz-by-name/quiet-therm-adc/mode enabled write /dev/thermal/tz-by-name/quiet-therm-monitor/mode enabled @@ -102,6 +104,7 @@ on property:vendor.disable.thermal.tj.control=1 write /dev/thermal/tz-by-name/G3D/mode disabled write /dev/thermal/tz-by-name/ISP/mode disabled write /dev/thermal/tz-by-name/TPU/mode disabled + write /sys/kernel/debug/gs101-thermal/emul_call 1 on property:vendor.disable.thermal.tj.control=0 # P21 @@ -111,6 +114,7 @@ on property:vendor.disable.thermal.tj.control=0 write /dev/thermal/tz-by-name/G3D/mode enabled write /dev/thermal/tz-by-name/ISP/mode enabled write /dev/thermal/tz-by-name/TPU/mode enabled + write /sys/kernel/debug/gs101-thermal/emul_call 0 # Switch USB port overheat protection on property:vendor.disable.usb.overheat.mitigation.control=1 diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp index 26dcd314..7b341fdf 100644 --- a/thermal/thermal-helper.cpp +++ b/thermal/thermal-helper.cpp @@ -53,6 +53,7 @@ constexpr std::string_view kCoolingDeviceCurStateSuffix("cur_state"); constexpr std::string_view kConfigProperty("vendor.thermal.config"); constexpr std::string_view kConfigDefaultFileName("thermal_info_config.json"); constexpr std::string_view kThermalGenlProperty("persist.vendor.enable.thermal.genl"); +constexpr std::string_view kThermalDisabledProperty("vendor.disable.thermal.control"); namespace { using android::base::StringPrintf; @@ -323,6 +324,19 @@ ThermalHelper::ThermalHelper(const NotificationCallback &cb) LOG(FATAL) << "ThermalHAL could not be initialized properly."; } + const bool thermal_throttling_disabled = + android::base::GetBoolProperty(kThermalDisabledProperty.data(), false); + + if (thermal_throttling_disabled) { + LOG(INFO) << kThermalDisabledProperty.data() << " is true"; + for (const auto &cdev_pair : cooling_device_info_map_) { + if (cooling_devices_.writeCdevFile(cdev_pair.first, std::to_string(0))) { + LOG(INFO) << "Successfully clear cdev " << cdev_pair.first << " to 0"; + } + } + return; + } + const bool thermal_genl_enabled = android::base::GetBoolProperty(kThermalGenlProperty.data(), false); -- cgit v1.2.3