mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
power: Keep boostpulse fd opened
No one else should be writing to this, so keep the fd opened. Change-Id: I4258f7f7d69250f4832a67807031ab3faa9ff586
This commit is contained in:
parent
a042209f66
commit
f21fbdb02e
1 changed files with 23 additions and 30 deletions
|
@ -62,7 +62,6 @@ enum power_profile_e {
|
|||
};
|
||||
|
||||
static enum power_profile_e current_power_profile = PROFILE_BALANCED;
|
||||
static bool boostpulse_warned = false;
|
||||
|
||||
/**********************************************************
|
||||
*** HELPER FUNCTIONS
|
||||
|
@ -140,29 +139,32 @@ static void boost(int32_t duration_us)
|
|||
close(fd);
|
||||
}
|
||||
|
||||
static void boostpulse_open(struct samsung_power_module *samsung_pwr)
|
||||
{
|
||||
samsung_pwr->boostpulse_fd = open(BOOSTPULSE_PATH, O_WRONLY);
|
||||
if (samsung_pwr->boostpulse_fd < 0) {
|
||||
ALOGE("Error opening %s: %s\n", BOOSTPULSE_PATH, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
static void send_boostpulse(int boostpulse_fd)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (boostpulse_fd < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
len = write(boostpulse_fd, "1", 1);
|
||||
if (len < 0) {
|
||||
ALOGE("Error writing to %s: %s", BOOSTPULSE_PATH, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
*** POWER FUNCTIONS
|
||||
**********************************************************/
|
||||
|
||||
/* You need to request the powerhal lock before calling this function */
|
||||
static int boostpulse_open(struct samsung_power_module *samsung_pwr)
|
||||
{
|
||||
char errno_str[64];
|
||||
|
||||
if (samsung_pwr->boostpulse_fd < 0) {
|
||||
samsung_pwr->boostpulse_fd = open(BOOSTPULSE_PATH, O_WRONLY);
|
||||
if (samsung_pwr->boostpulse_fd < 0) {
|
||||
if (!boostpulse_warned) {
|
||||
strerror_r(errno, errno_str, sizeof(errno_str));
|
||||
ALOGE("Error opening %s: %s", BOOSTPULSE_PATH, errno_str);
|
||||
boostpulse_warned = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return samsung_pwr->boostpulse_fd;
|
||||
}
|
||||
|
||||
static void set_power_profile(struct samsung_power_module *samsung_pwr,
|
||||
int profile)
|
||||
{
|
||||
|
@ -413,16 +415,7 @@ static void samsung_power_hint(struct power_module *module,
|
|||
}
|
||||
|
||||
ALOGV("%s: POWER_HINT_INTERACTION", __func__);
|
||||
|
||||
if (boostpulse_open(samsung_pwr) >= 0) {
|
||||
len = write(samsung_pwr->boostpulse_fd, "1", 1);
|
||||
|
||||
if (len < 0) {
|
||||
strerror_r(errno, errno_str, sizeof(errno_str));
|
||||
ALOGE("Error writing to %s: %s", BOOSTPULSE_PATH, errno_str);
|
||||
}
|
||||
}
|
||||
|
||||
send_boostpulse(samsung_pwr->boostpulse_fd);
|
||||
break;
|
||||
}
|
||||
case POWER_HINT_VSYNC: {
|
||||
|
|
Loading…
Reference in a new issue