sdm710-common: power-libperfmgr: Enable dt2w

Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
This commit is contained in:
SamarV-121 2021-01-01 20:31:40 +05:30 committed by giasen
parent c69c3e3d54
commit 623f59e656

View file

@ -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) {
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
if (HintManager::GetInstance()->GetAdpfProfile() &&
@ -97,7 +123,10 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
}
[[fallthrough]];
case Mode::DOUBLE_TAP_TO_WAKE:
[[fallthrough]];
{
sysfs_write("/sys/class/touch/tp_dev/gesture_on", enabled ? "1" : "0");
}
break;
case Mode::FIXED_PERFORMANCE:
[[fallthrough]];
case Mode::EXPENSIVE_RENDERING: