sdm710-common: power-libperfmgr: Enable dt2w
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
This commit is contained in:
parent
c69c3e3d54
commit
623f59e656
1 changed files with 30 additions and 1 deletions
|
@ -76,6 +76,32 @@ Power::Power(std::shared_ptr<DisplayLowPower> dlpw, std::shared_ptr<AdaptiveCpu>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sysfs_write(const char *path, const char *s)
|
||||||
|
{
|
||||||
|
char buf[80];
|
||||||
|
int len;
|
||||||
|
int ret = 0;
|
||||||
|
int fd = open(path, O_WRONLY);
|
||||||
|
|
||||||
|
if (fd < 0) {
|
||||||
|
strerror_r(errno, buf, sizeof(buf));
|
||||||
|
ALOGE("Error opening %s: %s\n", path, buf);
|
||||||
|
return -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = write(fd, s, strlen(s));
|
||||||
|
if (len < 0) {
|
||||||
|
strerror_r(errno, buf, sizeof(buf));
|
||||||
|
ALOGE("Error writing to %s: %s\n", path, buf);
|
||||||
|
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||||
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
|
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
|
||||||
if (HintManager::GetInstance()->GetAdpfProfile() &&
|
if (HintManager::GetInstance()->GetAdpfProfile() &&
|
||||||
|
@ -97,7 +123,10 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||||
[[fallthrough]];
|
{
|
||||||
|
sysfs_write("/sys/class/touch/tp_dev/gesture_on", enabled ? "1" : "0");
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Mode::FIXED_PERFORMANCE:
|
case Mode::FIXED_PERFORMANCE:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Mode::EXPENSIVE_RENDERING:
|
case Mode::EXPENSIVE_RENDERING:
|
||||||
|
|
Loading…
Reference in a new issue