Support touchscreen powersaving 74/222574/1 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200121.165908 accepted/tizen/5.5/unified/wearable/hotfix/20201027.123057 submit/tizen_5.5/20200116.082815 submit/tizen_5.5/20200121.093910 submit/tizen_5.5_wearable_hotfix/20201026.184301
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 21 Nov 2019 03:04:19 +0000 (12:04 +0900)
committeryoungjae cho <y0.cho@samsung.com>
Thu, 16 Jan 2020 08:13:05 +0000 (08:13 +0000)
Change-Id: Ia837c6b34740985afa55e31bd719112b82baadb6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
(cherry picked from commit 0dbad2d3d3487150a68276fd3520dcb0bfb119db)

hw/touchscreen/touchscreen.c

index 5fe1cc6c83302562a7671a7aa5fe8d4707e2fc63..362355714ce728a488ddc323d6638d02214e7319 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;