Android 支持TP触摸唤醒
目录
修改的文件:
文件修改说明:
这个修改是我在全志6.0上增加的 , 当时的需求是 屏幕3分钟灭屏后可以通过触摸TP从而唤醒屏幕。原理是通过TP接收到触摸上报了个power key 灰常简单 思路万古不变 希望能帮到有需要的人。
这个修改主要对 Android 系统的触摸屏和显示驱动进行了优化,包括对触摸屏的睡眠唤醒功能的改进,以及对显示驱动的运行时挂起和恢复的优化。
修改的文件:
android/frameworks/base/packages/SettingsProvider/res/values/defaults.xmllichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx.clichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx_ts.hlichee/linux-3.10/drivers/video/sunxi/disp2/disp/dev_disp.c
文件修改说明:
defaults.xml: 修改了默认的屏幕关闭超时时间,从无限制改为180000毫秒。gt9xx.c: 添加了触摸屏的睡眠唤醒功能,当触摸屏处于睡眠状态时,可以通过触摸屏来唤醒设备。同时,也在驱动的初始化和挂起恢复过程中添加了相关的打印信息。gt9xx_ts.h: 在头文件中定义了一个宏GTP_WAKEUP_SLEEP_ENABLE,用于控制触摸屏的睡眠唤醒功能是否启用。dev_disp.c: 在显示驱动的运行时挂起和恢复过程中,添加了一个全局变量g_sleep_flag_for_tp,用于标记设备的睡眠状态。当设备处于睡眠状态时,g_sleep_flag_for_tp被设置为1,当设备恢复运行时,g_sleep_flag_for_tp被设置为0。这个变量的值可以通过函数get_sleep_state获取,从而在触摸屏驱动中判断设备是否处于睡眠状态。
---.../SettingsProvider/res/values/defaults.xml | 2 +-.../drivers/input/touchscreen/gt9xx_new/gt9xx.c | 15 ++++++++++++---.../input/touchscreen/gt9xx_new/gt9xx_ts.h | 2 +-.../drivers/video/sunxi/disp2/disp/dev_disp.c | 14 +++++++++++---4 files changed, 25 insertions(+), 8 deletions(-)diff --git a/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
index 98291007a0..d8fece99cd 100755
--- a/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ b/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -18,7 +18,7 @@-->true
- -1
+ 180000 -1 false false
diff --git a/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx.c b/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx.c
index babdd7e72b..96ce48b5e8 100755
--- a/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx.c
+++ b/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx.c
@@ -463,6 +463,7 @@ static void gtp_touch_down(struct goodix_ts_data* ts,s32 id,s32 x,s32 y,s32 w)}+extern int get_sleep_state(void);/*******************************************************Function:Touch up report function.
@@ -484,6 +485,12 @@ static void gtp_touch_up(struct goodix_ts_data* ts, s32 id)input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0);input_mt_sync(ts->input_dev);#endif
+#if GTP_WAKEUP_SLEEP_ENABLE == 1
+ if(get_sleep_state()) {
+ input_report_key(ts->input_dev, KEY_POWER, 1);
+ input_report_key(ts->input_dev, KEY_POWER, 0);
+ }
+#endif}/*******************************************************
@@ -998,7 +1005,9 @@ static s8 gtp_request_input_dev(struct goodix_ts_data *ts)input_set_capability(ts->input_dev,EV_KEY,touch_key_array[index]); }#endif
-
+#if GTP_WAKEUP_SLEEP_ENABLE == 1
+ input_set_capability(ts->input_dev,EV_KEY,KEY_POWER);
+#endif //#if GTP_CHANGE_X2Y// GTP_SWAP(ts->abs_x_max, ts->abs_y_max);//#endif
@@ -1214,7 +1223,7 @@ static void goodix_ts_early_suspend(struct early_suspend *h)struct goodix_ts_data *ts;s8 ret = -1; ts = container_of(h, struct goodix_ts_data, early_suspend);
-
+ printk(" goodix_ts_early_suspend\n");#if GTP_ESD_PROTECTts->gtp_is_suspend = 1;cancel_delayed_work_sync(>p_esd_check_work);
@@ -1248,7 +1257,7 @@ static void goodix_ts_late_resume(struct early_suspend *h){struct goodix_ts_data *ts;ts = container_of(h, struct goodix_ts_data, early_suspend);
-
+ printk(" goodix_ts_late_resume\n");queue_work(goodix_resume_wq, &goodix_resume_work);//gandy#if GTP_ESD_PROTECT
diff --git a/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx_ts.h b/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx_ts.h
index a766d628b9..fccb141cb4 100755
--- a/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx_ts.h
+++ b/lichee/linux-3.10/drivers/input/touchscreen/gt9xx_new/gt9xx_ts.h
@@ -106,7 +106,7 @@ extern struct ctp_config_info config_info;#define GTP_DEBUG_ON 0#define GTP_DEBUG_ARRAY_ON 0#define GTP_DEBUG_FUNC_ON 0
-
+#define GTP_WAKEUP_SLEEP_ENABLE 1//***************************PART2:TODO define**********************************//STEP_1(REQUIRED):Change config table./*TODO: puts the config info corresponded to your TP here, the following is just
diff --git a/lichee/linux-3.10/drivers/video/sunxi/disp2/disp/dev_disp.c b/lichee/linux-3.10/drivers/video/sunxi/disp2/disp/dev_disp.c
index 2c6fc65b25..b7a95bbf95 100755
--- a/lichee/linux-3.10/drivers/video/sunxi/disp2/disp/dev_disp.c
+++ b/lichee/linux-3.10/drivers/video/sunxi/disp2/disp/dev_disp.c
@@ -36,6 +36,14 @@ static struct device *display_dev;static unsigned int g_disp = 0, g_enhance_mode = 0, g_cvbs_enhance_mode = 0;static u32 DISP_print = 0xffff; //print cmd which eq DISP_printstatic bool g_pm_runtime_enable = 0; //when open the CONFIG_PM_RUNTIME,this bool can also control if use the PM_RUNTIME.
+
+static int g_sleep_flag_for_tp = 0;
+
+int get_sleep_state(void)
+{
+ return g_sleep_flag_for_tp;
+}
+EXPORT_SYMBOL(get_sleep_state);#ifndef CONFIG_OFstatic struct sunxi_disp_mod disp_mod[] = {{DISP_MOD_DE , "de" },
@@ -1437,7 +1445,7 @@ static int disp_runtime_suspend(struct device *dev)struct list_head* disp_list= NULL;pr_info("%s\n", __func__);
-
+ if (!g_pm_runtime_enable)return 0;@@ -1481,7 +1489,7 @@ static int disp_runtime_resume(struct device *dev)struct list_head* disp_list= NULL;pr_info("%s\n", __func__);
-
+ g_sleep_flag_for_tp = 0;if (!g_pm_runtime_enable)return 0;@@ -1531,7 +1539,7 @@ static int disp_runtime_resume(struct device *dev)static int disp_runtime_idle(struct device *dev){pr_info("%s\n", __func__);
-
+ g_sleep_flag_for_tp = 1;if (g_disp_drv.dev) {pm_runtime_mark_last_busy(g_disp_drv.dev);pm_request_autosuspend(g_disp_drv.dev);
--
2.25.1
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
