summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2018-07-03 21:29:54 +0300
committerMichael Bestas <mkbestas@lineageos.org>2018-07-14 13:25:33 +0200
commit64de35fa398ee654a1d0f5d7a5714fa82f73888e (patch)
treec5d224b0a76f9bf82e1aad7504a14e7fc59ff225
parent2d1ce22188bd7601e462bcbc60d13aac6b2b628d (diff)
downloadandroid_hardware_qcom_power-64de35fa398ee654a1d0f5d7a5714fa82f73888e.tar.gz
android_hardware_qcom_power-64de35fa398ee654a1d0f5d7a5714fa82f73888e.tar.bz2
android_hardware_qcom_power-64de35fa398ee654a1d0f5d7a5714fa82f73888e.zip
power: Allow devices disabling power stats completely
* On some devices even attempting to read the stats nodes results in kernel lockup and reboot from watchdog bite. This has been noticed on a lot of msm8916 devices, so add a way to disable stats completely in order to allow using the binderized power HAL and get rid of the old one from device/qcom/common Change-Id: I134c40548dd883aaf72cf0c212be978305366521
-rw-r--r--Android.mk4
-rw-r--r--Power.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 09d659a..2a24ad6 100644
--- a/Android.mk
+++ b/Android.mk
@@ -134,6 +134,10 @@ ifeq ($(TARGET_HAS_LEGACY_POWER_STATS),true)
LOCAL_CFLAGS += -DLEGACY_STATS
endif
+ifeq ($(TARGET_HAS_NO_POWER_STATS),true)
+ LOCAL_CFLAGS += -DNO_STATS
+endif
+
ifneq ($(TARGET_RPM_STAT),)
LOCAL_CFLAGS += -DRPM_STAT=\"$(TARGET_RPM_STAT)\"
endif
diff --git a/Power.cpp b/Power.cpp
index f857041..eb4a746 100644
--- a/Power.cpp
+++ b/Power.cpp
@@ -76,6 +76,11 @@ Return<void> Power::setFeature(Feature feature, bool activate) {
Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
hidl_vec<PowerStatePlatformSleepState> states;
+#ifdef NO_STATS
+ states.resize(0);
+ _hidl_cb(states, Status::SUCCESS);
+ return Void();
+#else
uint64_t stats[MAX_PLATFORM_STATS * MAX_RPM_PARAMS] = {0};
#ifndef LEGACY_STATS
uint64_t *values;
@@ -168,6 +173,7 @@ Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_c
done:
_hidl_cb(states, Status::SUCCESS);
return Void();
+#endif
}
#ifndef V1_0_HAL