summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2019-11-21 12:04:19 +0900
committerHyotaek Shim <hyotaek.shim@samsung.com>2020-01-16 08:04:07 +0000
commit0dbad2d3d3487150a68276fd3520dcb0bfb119db (patch)
treeda5e630fa8cc8d36a7dbab225f603220750a6559
parentcea6ca162361fe3e5eaef7708c39c41c439a1c37 (diff)
downloaddevice-tw3-0dbad2d3d3487150a68276fd3520dcb0bfb119db.tar.gz
device-tw3-0dbad2d3d3487150a68276fd3520dcb0bfb119db.tar.bz2
device-tw3-0dbad2d3d3487150a68276fd3520dcb0bfb119db.zip
Support touchscreen powersaving
Change-Id: Ia837c6b34740985afa55e31bd719112b82baadb6 Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r--hw/touchscreen/touchscreen.c32
1 files changed, 32 insertions, 0 deletions
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;