diff options
author | Wendly Li <wendlyli@google.com> | 2022-02-15 15:40:27 +0000 |
---|---|---|
committer | Wendly Li <wendlyli@google.com> | 2022-02-15 17:32:22 +0000 |
commit | fb0814d17d7f3fd80a22ecdc7c22bfc58f84261a (patch) | |
tree | b4d559156f974d8f3a8a9add5eed71e21b5a01b5 | |
parent | b6096bc9122860432ebf55fc7538518d99a429a6 (diff) | |
download | goodix_touch-fb0814d17d7f3fd80a22ecdc7c22bfc58f84261a.tar.gz |
Register touch power manager
Bug: 214118711
Test: Check suspend and resume works when display on/off
Signed-off-by: Wendly Li <wendlyli@google.com>
Change-Id: Iff62c310c419891850c25555c238818182ecc010
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | goodix_ts_core.c | 23 | ||||
-rw-r--r-- | goodix_ts_core.h | 6 |
3 files changed, 29 insertions, 2 deletions
@@ -4,10 +4,10 @@ M ?= $(shell pwd) KBUILD_OPTIONS += CONFIG_TOUCHSCREEN_GOODIX_BRL=m EXTRA_CFLAGS += -DDYNAMIC_DEBUG_MODULE EXTRA_CFLAGS += -DCONFIG_TOUCHSCREEN_GOODIX_BRL_SPI +EXTRA_CFLAGS += -DCONFIG_TOUCHSCREEN_PM #EXTRA_CFLAGS += -DCONFIG_TOUCHSCREEN_TBN #EXTRA_CFLAGS += -DCONFIG_TOUCHSCREEN_HEATMAP #EXTRA_CFLAGS += -DCONFIG_TOUCHSCREEN_OFFLOAD -EXTRA_CFLAGS += -DCONFIG_FS EXTRA_CFLAGS += -I$(KERNEL_SRC)/../google-modules/display EXTRA_CFLAGS += -I$(KERNEL_SRC)/../google-modules/touch/common EXTRA_CFLAGS += -I$(KERNEL_SRC)/../google-modules/touch/common/include diff --git a/goodix_ts_core.c b/goodix_ts_core.c index 57bc14a..ab694f7 100644 --- a/goodix_ts_core.c +++ b/goodix_ts_core.c @@ -2039,6 +2039,19 @@ int goodix_ts_stage2_init(struct goodix_ts_core *cd) } } +#if IS_ENABLED(CONFIG_TOUCHSCREEN_PM) + cd->tpm.pdev = cd->pdev; +#ifdef CONFIG_OF + cd->tpm.of_node = cd->bus->dev->of_node; +#endif + cd->tpm.resume = goodix_ts_pm_resume; + cd->tpm.suspend = goodix_ts_pm_suspend; + ret = tpm_register_notification(&cd->tpm); + if (ret < 0) { + ts_info("Failed to egister touch pm"); + goto err_init_tpm; + } +#endif #if IS_ENABLED(CONFIG_FB) cd->fb_notifier.notifier_call = goodix_ts_fb_notifier_callback; if (fb_register_client(&cd->fb_notifier)) @@ -2122,6 +2135,10 @@ err_init_sysfs: #if IS_ENABLED(CONFIG_FB) fb_unregister_client(&cd->fb_notifier); #endif +#if IS_ENABLED(CONFIG_TOUCHSCREEN_PM) + tpm_unregister_notification(&cd->tpm); +err_init_tpm: +#endif goodix_ts_pen_dev_remove(cd); err_finger: goodix_ts_input_dev_remove(cd); @@ -2404,6 +2421,9 @@ static int goodix_ts_remove(struct platform_device *pdev) gesture_module_exit(); inspect_module_exit(); hw_ops->irq_enable(core_data, false); +#if IS_ENABLED(CONFIG_TOUCHSCREEN_PM) + tpm_unregister_notification(&core_data->tpm); +#endif #if IS_ENABLED(CONFIG_FB) fb_unregister_client(&core_data->fb_notifier); #endif @@ -2424,7 +2444,8 @@ static int goodix_ts_remove(struct platform_device *pdev) #if IS_ENABLED(CONFIG_PM) static const struct dev_pm_ops dev_pm_ops = { -#if !IS_ENABLED(CONFIG_FB) && !IS_ENABLED(CONFIG_HAS_EARLYSUSPEND) +#if !IS_ENABLED(CONFIG_FB) && !IS_ENABLED(CONFIG_HAS_EARLYSUSPEND) && \ + !IS_ENABLED(CONFIG_TOUCHSCREEN_PM) .suspend = goodix_ts_pm_suspend, .resume = goodix_ts_pm_resume, #endif diff --git a/goodix_ts_core.h b/goodix_ts_core.h index f774f0d..e9143cb 100644 --- a/goodix_ts_core.h +++ b/goodix_ts_core.h @@ -40,6 +40,9 @@ #include <linux/notifier.h> #endif #include "touch_apis.h" +#if IS_ENABLED(CONFIG_TOUCHSCREEN_PM) +#include "touch_pm.h" +#endif #define GOODIX_CORE_DRIVER_NAME "goodix_ts" #define GOODIX_PEN_DRIVER_NAME "goodix_ts,pen" @@ -529,6 +532,9 @@ struct goodix_ts_core { #if IS_ENABLED(CONFIG_FB) struct notifier_block fb_notifier; #endif +#if IS_ENABLED(CONFIG_TOUCHSCREEN_PM) + struct touch_pm tpm; +#endif }; /* external module structures */ |