power-mediatek: Run clang-format
Change-Id: I76ff3c8e6e541113d538d44a0b6810e3adfc445b Signed-off-by: bengris32 <bengris32@protonmail.ch>
This commit is contained in:
1
.clang-format
Symbolic link
1
.clang-format
Symbolic link
@@ -0,0 +1 @@
|
||||
../../build/soong/scripts/system-clang-format
|
||||
@@ -16,11 +16,11 @@
|
||||
#include <android-base/file.h>
|
||||
#endif
|
||||
|
||||
#define DLSYM_GET_FUNCTION(func_ptr, handle, func_name) \
|
||||
func_ptr = (typeof(func_ptr))dlsym(handle, #func_name); \
|
||||
if (func_ptr == NULL) { \
|
||||
#define DLSYM_GET_FUNCTION(func_ptr, handle, func_name) \
|
||||
func_ptr = (typeof(func_ptr))dlsym(handle, #func_name); \
|
||||
if (func_ptr == NULL) { \
|
||||
LOG(ERROR) << "Could not locate symbol " #func_name "."; \
|
||||
abort(); \
|
||||
abort(); \
|
||||
}
|
||||
|
||||
namespace aidl {
|
||||
@@ -57,7 +57,7 @@ Power::Power() {
|
||||
mPerf->Init(1);
|
||||
}
|
||||
|
||||
Power::~Power() { }
|
||||
Power::~Power() {}
|
||||
|
||||
long long Power::calcTimespanUs(struct timespec start, struct timespec end) {
|
||||
long long diff_in_us = 0;
|
||||
@@ -79,7 +79,7 @@ void Power::handleInteractionHint(int32_t targetDuration) {
|
||||
|
||||
if (targetDuration > durationMs) {
|
||||
durationMs = (targetDuration > kMaxInteractiveDuration) ? kMaxInteractiveDuration
|
||||
: targetDuration;
|
||||
: targetDuration;
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, ¤tInteractionTime);
|
||||
@@ -123,26 +123,24 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||
#endif
|
||||
switch (type) {
|
||||
#ifdef TAP_TO_WAKE_NODE
|
||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
{
|
||||
case Mode::DOUBLE_TAP_TO_WAKE: {
|
||||
::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case Mode::LAUNCH:
|
||||
{
|
||||
case Mode::LAUNCH: {
|
||||
if (mLaunchHandle > 0) {
|
||||
mPerf->LockRel(mLaunchHandle);
|
||||
mLaunchHandle = 0;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
mLaunchHandle = mPerf->CusLockHint(MTKPOWER_HINT_LAUNCH, kLaunchBoostDuration, getpid());
|
||||
mLaunchHandle =
|
||||
mPerf->CusLockHint(MTKPOWER_HINT_LAUNCH, kLaunchBoostDuration, getpid());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Mode::INTERACTIVE:
|
||||
{
|
||||
case Mode::INTERACTIVE: {
|
||||
if (enabled) {
|
||||
// Device is now in an interactive state,
|
||||
// resume all previously performing hints.
|
||||
|
||||
@@ -18,13 +18,13 @@ namespace power {
|
||||
namespace impl {
|
||||
namespace mediatek {
|
||||
|
||||
const int32_t kTouchBoostDuration = 25; /* ms */
|
||||
const int32_t kTouchBoostDuration = 25; /* ms */
|
||||
const int32_t kMinInteractiveDuration = 400; /* ms */
|
||||
const int32_t kMaxInteractiveDuration = 5000; /* ms */
|
||||
const int32_t kLaunchBoostDuration = 30000; /* ms */
|
||||
const int32_t kLaunchBoostDuration = 30000; /* ms */
|
||||
|
||||
class Power : public BnPower {
|
||||
public:
|
||||
public:
|
||||
Power();
|
||||
~Power();
|
||||
ndk::ScopedAStatus setMode(Mode type, bool enabled) override;
|
||||
@@ -36,11 +36,12 @@ public:
|
||||
int64_t durationNanos,
|
||||
std::shared_ptr<IPowerHintSession>* _aidl_return) override;
|
||||
ndk::ScopedAStatus getHintSessionPreferredRate(int64_t* outNanoseconds) override;
|
||||
private:
|
||||
|
||||
private:
|
||||
static long long calcTimespanUs(struct timespec start, struct timespec end);
|
||||
void handleInteractionHint(int32_t targetDuration);
|
||||
|
||||
libpowerhal_t *mPerf;
|
||||
libpowerhal_t* mPerf;
|
||||
|
||||
struct timespec mPreviousInteractionTime;
|
||||
int32_t mPreviousInteractionDuration;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define NSINUS 1000L
|
||||
|
||||
typedef struct libpowerhal_t {
|
||||
void *perfLib;
|
||||
void* perfLib;
|
||||
void (*Init)(int32_t);
|
||||
void (*LockRel)(int32_t);
|
||||
void (*UserScnDisableAll)(void);
|
||||
|
||||
Reference in New Issue
Block a user