mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-02-01 07:50:47 +00:00
Do not do powerhint if current governor is not supported
Bug: 62913269 Test: Boot and verify powerhint works Change-Id: If2638ae5f107534b46412ca8cce9f02e9eb5d215
This commit is contained in:
committed by
Thierry Strudel
parent
dfc34ea32b
commit
f31c67caa8
@@ -44,6 +44,7 @@ LOCAL_SRC_FILES += power-8998.c
|
|||||||
LOCAL_CFLAGS += -DINTERACTION_BOOST -Werror
|
LOCAL_CFLAGS += -DINTERACTION_BOOST -Werror
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
|
libbase \
|
||||||
liblog \
|
liblog \
|
||||||
libcutils \
|
libcutils \
|
||||||
libdl \
|
libdl \
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#define LOG_TAG "android.hardware.power@1.1-service.wahoo"
|
#define LOG_TAG "android.hardware.power@1.1-service.wahoo"
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
#include <android-base/file.h>
|
||||||
|
#include <android-base/strings.h>
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include "Power.h"
|
#include "Power.h"
|
||||||
#include "power-common.h"
|
#include "power-common.h"
|
||||||
@@ -49,12 +51,18 @@ Power::Power() {
|
|||||||
|
|
||||||
// Methods from ::android::hardware::power::V1_0::IPower follow.
|
// Methods from ::android::hardware::power::V1_0::IPower follow.
|
||||||
Return<void> Power::setInteractive(bool interactive) {
|
Return<void> Power::setInteractive(bool interactive) {
|
||||||
|
if (!isSupportedGovernor()) {
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
power_set_interactive(interactive ? 1 : 0);
|
power_set_interactive(interactive ? 1 : 0);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> Power::powerHint(PowerHint hint, int32_t data) {
|
Return<void> Power::powerHint(PowerHint hint, int32_t data) {
|
||||||
power_hint_t h = static_cast<power_hint_t>(hint);
|
power_hint_t h = static_cast<power_hint_t>(hint);
|
||||||
|
if (!isSupportedGovernor()) {
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
if (h == POWER_HINT_INTERACTION) {
|
if (h == POWER_HINT_INTERACTION) {
|
||||||
mInteractionHandler.Acquire(data);
|
mInteractionHandler.Acquire(data);
|
||||||
return Void();
|
return Void();
|
||||||
@@ -169,6 +177,20 @@ done:
|
|||||||
return Void();
|
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 implementation
|
||||||
} // namespace V1_1
|
} // namespace V1_1
|
||||||
} // namespace power
|
} // namespace power
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ struct Power : public IPower {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
InteractionHandler mInteractionHandler;
|
InteractionHandler mInteractionHandler;
|
||||||
|
static bool isSupportedGovernor();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
#define SCALING_MIN_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
|
#define SCALING_MIN_FREQ "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq"
|
||||||
#define ONDEMAND_GOVERNOR "ondemand"
|
#define ONDEMAND_GOVERNOR "ondemand"
|
||||||
#define INTERACTIVE_GOVERNOR "interactive"
|
#define INTERACTIVE_GOVERNOR "interactive"
|
||||||
|
#define SCHEDUTIL_GOVERNOR "schedutil"
|
||||||
|
#define SCHED_GOVERNOR "sched"
|
||||||
|
|
||||||
#define MSMDCVS_GOVERNOR "msm-dcvs"
|
#define MSMDCVS_GOVERNOR "msm-dcvs"
|
||||||
#define SCHED_GOVERNOR "sched"
|
#define SCHED_GOVERNOR "sched"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user