From 55a8cd2648270b74df54ce3ea203792adb601218 Mon Sep 17 00:00:00 2001 From: George Lee Date: Tue, 4 Jun 2019 14:57:03 -0700 Subject: Health: Add Battery Thermal control for SOC This is to enable to disabling of SOC based throttling when charging is enabled. Throttling is re-enabled once device is no longer charging. Bug: 131314951 Test: Use emul_temp and battery/capacity to emulate condition for checking if SOC thermal zone is disabled/enabled. Signed-off-by: George Lee Change-Id: Idbf460ba6e240b819aa02ba2962c5176da991b7d --- health/HealthService.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'health') diff --git a/health/HealthService.cpp b/health/HealthService.cpp index 37c1c248..7d780f16 100644 --- a/health/HealthService.cpp +++ b/health/HealthService.cpp @@ -14,9 +14,8 @@ * limitations under the License. */ #define LOG_TAG "android.hardware.health@2.0-service.bonito" -#include - #include +#include #include #include #include @@ -24,18 +23,20 @@ #include #include #include +#include #include #include #include -#include "BatteryRechargingControl.h" -#include "BatteryInfoUpdate.h" -#include "LearnedCapacityBackupRestore.h" #include #include #include #include +#include "BatteryInfoUpdate.h" +#include "BatteryRechargingControl.h" +#include "LearnedCapacityBackupRestore.h" + namespace { using android::hardware::health::V2_0::DiskStats; @@ -45,6 +46,7 @@ using ::device::google::bonito::health::BatteryRechargingControl; using ::device::google::bonito::health::BatteryInfoUpdate; using ::device::google::bonito::health::LearnedCapacityBackupRestore; using hardware::google::pixel::health::BatteryMetricsLogger; +using hardware::google::pixel::health::BatteryThermalControl; using hardware::google::pixel::health::CycleCountBackupRestore; using hardware::google::pixel::health::DeviceHealth; using hardware::google::pixel::health::LowBatteryShutdownMetrics; @@ -57,6 +59,7 @@ constexpr char kCycleCountsBins[] {FG_DIR "/bms/device/cycle_counts_bins"}; static BatteryRechargingControl battRechargingControl; static BatteryInfoUpdate battInfoUpdate; +static BatteryThermalControl battThermalControl("sys/devices/virtual/thermal/tz-by-name/soc/mode"); static BatteryMetricsLogger battMetricsLogger(kBatteryResistance, kBatteryOCV); static LowBatteryShutdownMetrics shutdownMetrics(kVoltageAvg); static CycleCountBackupRestore ccBackupRestoreBMS( @@ -111,6 +114,7 @@ void healthd_board_init(struct healthd_config*) { int healthd_board_battery_update(struct android::BatteryProperties *props) { battRechargingControl.updateBatteryProperties(props); deviceHealth.update(props); + battThermalControl.updateThermalState(props); battInfoUpdate.update(props); battMetricsLogger.logBatteryProperties(props); shutdownMetrics.logShutdownVoltage(props); -- cgit v1.2.3