From 5a93d307cdb68ac62e7afce72a4bd30bf71a576b Mon Sep 17 00:00:00 2001 From: haojl2 Date: Thu, 12 Jul 2018 18:37:55 +0800 Subject: [PATCH] synaptics_tcm: resume TP in workqueue Change-Id: I90ca3808a01dab77d8bf78561df92b3243583611 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1208807 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../synaptics_tcm_mmi/synaptics_tcm_core.c | 27 +++++++++++++++++-- .../synaptics_tcm_mmi/synaptics_tcm_core.h | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c b/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c index 2ebc77c8b7cc..bde8d5567b76 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c +++ b/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c @@ -3000,6 +3000,28 @@ static int syna_tcm_early_suspend(struct device *dev) return 0; } +static void syna_tcm_queued_resume(struct work_struct *w) +{ + struct syna_tcm_hcd *tcm_hcd = + container_of(w, struct syna_tcm_hcd, resume_work); + syna_tcm_resume(&(tcm_hcd->pdev->dev)); +} + +static inline int syna_tcm_display_off(struct device *dev) +{ + struct syna_tcm_hcd *tcm_hcd = dev_get_drvdata(dev); + cancel_work_sync(&tcm_hcd->resume_work); + return syna_tcm_suspend(dev); +} + +static inline int syna_tcm_display_on(struct device *dev) +{ + struct syna_tcm_hcd *tcm_hcd = dev_get_drvdata(dev); + pr_debug("queue resume\n"); + queue_work(system_wq, &tcm_hcd->resume_work); + return 0; +} + static int syna_tcm_fb_notifier_cb(struct notifier_block *nb, unsigned long action, void *data) { @@ -3018,10 +3040,10 @@ static int syna_tcm_fb_notifier_cb(struct notifier_block *nb, retval = syna_tcm_early_suspend(&tcm_hcd->pdev->dev); else if (action == FB_EVENT_BLANK) { if (*transition == FB_BLANK_POWERDOWN) { - retval = syna_tcm_suspend(&tcm_hcd->pdev->dev); + retval = syna_tcm_display_off(&tcm_hcd->pdev->dev); tcm_hcd->fb_ready = 0; } else if (*transition == FB_BLANK_UNBLANK) { - retval = syna_tcm_resume(&tcm_hcd->pdev->dev); + retval = syna_tcm_display_on(&tcm_hcd->pdev->dev); tcm_hcd->fb_ready++; } } @@ -3197,6 +3219,7 @@ static int syna_tcm_probe(struct platform_device *pdev) } } + INIT_WORK(&tcm_hcd->resume_work, syna_tcm_queued_resume); #ifdef CONFIG_FB tcm_hcd->fb_notifier.notifier_call = syna_tcm_fb_notifier_cb; retval = fb_register_client(&tcm_hcd->fb_notifier); diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.h b/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.h index 4c04c545677d..1319d14345aa 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.h +++ b/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.h @@ -413,6 +413,7 @@ struct syna_tcm_hcd { struct mutex identify_mutex; struct delayed_work polling_work; struct workqueue_struct *polling_workqueue; + struct work_struct resume_work; struct task_struct *notifier_thread; #ifdef CONFIG_FB struct notifier_block fb_notifier;