summaryrefslogtreecommitdiff
path: root/health
diff options
context:
space:
mode:
authorGeorge Lee <geolee@google.com>2019-06-04 14:57:03 -0700
committerGeorge Lee <geolee@google.com>2019-06-04 15:05:07 -0700
commit55a8cd2648270b74df54ce3ea203792adb601218 (patch)
tree044885e69a1e92790c887d42e64db74e610fdfbb /health
parente90547188e3f17d3b3eac038352b654dee8179f3 (diff)
downloadbonito-55a8cd2648270b74df54ce3ea203792adb601218.tar.gz
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 <geolee@google.com> Change-Id: Idbf460ba6e240b819aa02ba2962c5176da991b7d
Diffstat (limited to 'health')
-rw-r--r--health/HealthService.cpp14
1 files changed, 9 insertions, 5 deletions
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 <android-base/logging.h>
-
#include <android-base/file.h>
+#include <android-base/logging.h>
#include <android-base/parseint.h>
#include <android-base/strings.h>
#include <health2/Health.h>
@@ -24,18 +23,20 @@
#include <healthd/healthd.h>
#include <hidl/HidlTransportSupport.h>
#include <pixelhealth/BatteryMetricsLogger.h>
+#include <pixelhealth/BatteryThermalControl.h>
#include <pixelhealth/CycleCountBackupRestore.h>
#include <pixelhealth/DeviceHealth.h>
#include <pixelhealth/LowBatteryShutdownMetrics.h>
-#include "BatteryRechargingControl.h"
-#include "BatteryInfoUpdate.h"
-#include "LearnedCapacityBackupRestore.h"
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
+#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);