gts3l-common: power: Merge power-ext function in the power HAL and apply ours

As we're building our power HAL ourselves, the
TARGET_POWERHAL_SET_INTERACTIVE_EXT flag doesn't working at all. So I
merged this feature to our power HAL to use the extension works, which
is disabling S-Pen panel, LCD, hardware touch key power.

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
This commit is contained in:
Deokgyu Yang 2022-02-20 21:41:48 +09:00
parent f54275789c
commit a00f867501
5 changed files with 9 additions and 21 deletions

View file

@ -157,7 +157,6 @@ TARGET_PROVIDES_KEYMASTER := true
# Power
TARGET_USES_INTERACTION_BOOST := true
TARGET_POWERHAL_SET_INTERACTIVE_EXT := $(COMMON_PATH)/power_ext/power_ext.c
# Properties
TARGET_SYSTEM_PROP += $(COMMON_PATH)/system.prop

View file

@ -24,6 +24,7 @@ cc_binary {
srcs: [
"service.cpp",
"Power.cpp",
"power-ext.c",
"power-helper.c",
"metadata-parser.c",
"utils.c",

View file

@ -21,31 +21,13 @@
#define LOG_TAG "PowerHAL_TR_Ext"
#include <utils/Log.h>
#include "utils.h"
#define TOUCHKEY_POWER "/sys/class/input/input6/enabled"
#define SPEN_POWER "/sys/class/input/input3/enabled"
#define TSP_POWER "/sys/class/input/input2/enabled"
#define LCD_POWER "/sys/class/power_supply/battery/lcd"
static void sysfs_write(char *path, char *s) {
char buf[80];
int len;
int fd = open(path, O_WRONLY);
if (fd < 0) {
strerror_r(errno, buf, sizeof(buf));
ALOGE("Error opening %s: %s\n", path, buf);
return;
}
len = write(fd, s, strlen(s));
if (len < 0) {
strerror_r(errno, buf, sizeof(buf));
ALOGE("Error writing to %s: %s\n", path, buf);
}
close(fd);
}
void power_set_interactive_ext(int on) {
ALOGD("%s: %s input devices", __func__, on ? "enabling" : "disabling");
sysfs_write(TSP_POWER, on ? "1" : "0");

View file

@ -350,6 +350,9 @@ void power_set_interactive(int on)
struct video_encode_metadata_t video_encode_metadata;
int rc = 0;
/* Invoke the extension */
power_set_interactive_ext(on);
if (set_interactive_override(on) == HINT_HANDLED) {
return;
}

View file

@ -81,6 +81,9 @@ void power_hint(power_hint_t hint, void *data);
void power_set_interactive(int on);
int extract_platform_stats(uint64_t *list);
// Get an extension function
extern void power_set_interactive_ext(int on);
#ifdef __cplusplus
}
#endif