mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-02-01 03:40:35 +00:00
Do not do powerhint if current governor is not supported am: f31c67caa8
am: 815b65857d
Change-Id: I50185f7d7c84cd6c0f802948357aeb2eba80779d
This commit is contained in:
@@ -44,6 +44,7 @@ LOCAL_SRC_FILES += power-8998.c
|
||||
LOCAL_CFLAGS += -DINTERACTION_BOOST -Werror
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libbase \
|
||||
liblog \
|
||||
libcutils \
|
||||
libdl \
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#define LOG_TAG "android.hardware.power@1.1-service.wahoo"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <utils/Log.h>
|
||||
#include "Power.h"
|
||||
#include "power-common.h"
|
||||
@@ -49,12 +51,18 @@ Power::Power() {
|
||||
|
||||
// Methods from ::android::hardware::power::V1_0::IPower follow.
|
||||
Return<void> Power::setInteractive(bool interactive) {
|
||||
if (!isSupportedGovernor()) {
|
||||
return Void();
|
||||
}
|
||||
power_set_interactive(interactive ? 1 : 0);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::powerHint(PowerHint hint, int32_t data) {
|
||||
power_hint_t h = static_cast<power_hint_t>(hint);
|
||||
if (!isSupportedGovernor()) {
|
||||
return Void();
|
||||
}
|
||||
if (h == POWER_HINT_INTERACTION) {
|
||||
mInteractionHandler.Acquire(data);
|
||||
return Void();
|
||||
@@ -169,6 +177,20 @@ done:
|
||||
return Void();
|
||||
}
|
||||
|
||||
bool Power::isSupportedGovernor() {
|
||||
std::string buf;
|
||||
if (android::base::ReadFileToString(SCALING_GOVERNOR_PATH, &buf)) {
|
||||
buf = android::base::Trim(buf);
|
||||
}
|
||||
// Only support EAS 1.2, legacy EAS and HMP
|
||||
if (buf == SCHEDUTIL_GOVERNOR || buf == SCHED_GOVERNOR || buf == INTERACTIVE_GOVERNOR) {
|
||||
return true;
|
||||
} else {
|
||||
ALOGE("Governor not supported by powerHAL, skipping");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_1
|
||||
} // namespace power
|
||||
|
||||
@@ -54,6 +54,7 @@ struct Power : public IPower {
|
||||
|
||||
private:
|
||||
InteractionHandler mInteractionHandler;
|
||||
static bool isSupportedGovernor();
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#define SCALING_MIN_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
|
||||
#define ONDEMAND_GOVERNOR "ondemand"
|
||||
#define INTERACTIVE_GOVERNOR "interactive"
|
||||
#define SCHEDUTIL_GOVERNOR "schedutil"
|
||||
#define SCHED_GOVERNOR "sched"
|
||||
|
||||
#define MSMDCVS_GOVERNOR "msm-dcvs"
|
||||
#define SCHED_GOVERNOR "sched"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user