Browse Source

Merge "touch: goodix: Turn off touch power when display off"

qctecmdr 2 years ago
parent
commit
2797c9bf2b
2 changed files with 30 additions and 4 deletions
  1. 25 2
      goodix_berlin_driver/goodix_brl_hw.c
  2. 5 2
      goodix_berlin_driver/goodix_ts_core.c

+ 25 - 2
goodix_berlin_driver/goodix_brl_hw.c

@@ -1,6 +1,7 @@
  /*
   * Goodix Touchscreen Driver
   * Copyright (C) 2020 - 2021 Goodix, Inc.
+  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@ -260,19 +261,41 @@ power_off:
 #define GOODIX_SLEEP_CMD	0x84
 int brl_suspend(struct goodix_ts_core *cd)
 {
+#ifdef GOODIX_SUSPEND_GESTURE_ENABLE
 	struct goodix_ts_cmd sleep_cmd;
 
 	sleep_cmd.cmd = GOODIX_SLEEP_CMD;
 	sleep_cmd.len = 4;
 	if (cd->hw_ops->send_cmd(cd, &sleep_cmd))
 		ts_err("failed send sleep cmd");
-
+#else
+	if (cd->hw_ops->power_on(cd, 0))
+		ts_err("failed power off");
+#endif
 	return 0;
 }
 
 int brl_resume(struct goodix_ts_core *cd)
 {
-	return cd->hw_ops->reset(cd, GOODIX_NORMAL_RESET_DELAY_MS);
+	int ret = 0;
+
+#ifdef GOODIX_SUSPEND_GESTURE_ENABLE
+	ret = cd->hw_ops->reset(cd, GOODIX_NORMAL_RESET_DELAY_MS);
+#else
+	ret = cd->hw_ops->power_on(cd, 1);
+	if (ret) {
+		ts_err("failed power on");
+		return ret;
+	}
+
+	ret = cd->hw_ops->reset(cd, GOODIX_NORMAL_RESET_DELAY_MS);
+	if (ret) {
+		ts_err("failed reset tp");
+		return ret;
+	}
+#endif
+
+	return ret;
 }
 
 #define GOODIX_GESTURE_CMD_BA	0x12

+ 5 - 2
goodix_berlin_driver/goodix_ts_core.c

@@ -1,6 +1,7 @@
  /*
   * Goodix Touchscreen Driver
   * Copyright (C) 2020 - 2021 Goodix, Inc.
+  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
@@ -2066,10 +2067,10 @@ skip_goodix_ts_irq_setup:
 
 	/* create procfs files */
 	goodix_ts_procfs_init(cd);
-
+#ifdef GOODIX_SUSPEND_GESTURE_ENABLE
 	/* gesture init */
 	gesture_module_init();
-
+#endif
 	/* inspect init */
 	inspect_module_init();
 
@@ -2608,7 +2609,9 @@ static int goodix_ts_remove(struct platform_device *pdev)
 	goodix_tools_exit();
 
 	if (core_data->init_stage >= CORE_INIT_STAGE2) {
+	#ifdef GOODIX_SUSPEND_GESTURE_ENABLE
 		gesture_module_exit();
+	#endif
 		inspect_module_exit();
 		hw_ops->irq_enable(core_data, false);