Support touchscreen powersaving 66/218266/2 accepted/tizen/unified/20200129.022604 submit/tizen/20200116.064903 submit/tizen/20200121.085712 submit/tizen/20200121.090851 submit/tizen/20200122.232403
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 21 Nov 2019 03:04:19 +0000 (12:04 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 16 Jan 2020 08:04:07 +0000 (08:04 +0000)
Change-Id: Ia837c6b34740985afa55e31bd719112b82baadb6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
hw/touchscreen/touchscreen.c

index 5fe1cc6..3623557 100644 (file)
@@ -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;