From 0dbad2d3d3487150a68276fd3520dcb0bfb119db Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Thu, 21 Nov 2019 12:04:19 +0900 Subject: [PATCH] Support touchscreen powersaving Change-Id: Ia837c6b34740985afa55e31bd719112b82baadb6 Signed-off-by: Youngjae Cho --- hw/touchscreen/touchscreen.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hw/touchscreen/touchscreen.c b/hw/touchscreen/touchscreen.c index 5fe1cc6..3623557 100644 --- a/hw/touchscreen/touchscreen.c +++ b/hw/touchscreen/touchscreen.c @@ -32,6 +32,8 @@ #define ENABLED_PATH "/device/enabled" #define TOUCHSCREEN_CAPABILITY 400 +#define TOUCH_POWERSAVING_NODE "/sys/class/sec/tsp/mode" + #define TURNON_TOUCHSCREEN 1 #define TURNOFF_TOUCHSCREEN 0 @@ -133,6 +135,34 @@ static int touchscreen_set_state(enum touchscreen_state state) return ret; } +static int touchscreen_get_powersaving(int *data) +{ + int ret, state; + + if (!data) + return -EINVAL; + + ret = sys_get_int(TOUCH_POWERSAVING_NODE, &state); + if (ret < 0) { + _E("Failed to get touchscreen powersaving status."); + return ret; + } + + *data = state; + return ret; +} + +static int touchscreen_set_powersaving(int state) +{ + int ret; + + ret = sys_set_int(TOUCH_POWERSAVING_NODE, state); + if (ret < 0) + _E("Failed to set touchscreen powersaving status."); + + return ret; +} + static int touchscreen_open(struct hw_info *info, const char *id, struct hw_common **common) { @@ -151,6 +181,8 @@ static int touchscreen_open(struct hw_info *info, touchscreen_dev->common.info = info; touchscreen_dev->get_state = touchscreen_get_state; touchscreen_dev->set_state = touchscreen_set_state; + touchscreen_dev->get_powersaving = touchscreen_get_powersaving; + touchscreen_dev->set_powersaving = touchscreen_set_powersaving; *common = (struct hw_common *)touchscreen_dev; return 0; -- 2.7.4