summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2022-08-09 14:24:27 +0800
committerdavidycchen <davidycchen@google.com>2022-08-18 10:50:05 +0800
commit2fe4deefbfab75db7d802ee60a53300a6e14ffb6 (patch)
tree562c636908b4a0a57d907285caa95eabe8b98636
parent981e7cf7d7180b7400a4499dc228e40e02b658ee (diff)
downloadsynaptics_touch-2fe4deefbfab75db7d802ee60a53300a6e14ffb6.tar.gz
synaptics: correct the error handling in suspend function
Remove the early return in the suspend function to make sure the reset process in resume function can help recover the touch issue. Use the same event workqueue for reset callback to make sure the callback won't run after device suspend. Bug: 240887667 Test: Add the error code in suspend function and make sure the touch can be recover by the error handling. Signed-off-by: davidycchen <davidycchen@google.com> Change-Id: I5ec126964ba445ebc5a406a68c945e99ab4f27b8
-rw-r--r--syna_tcm2.c18
-rw-r--r--syna_tcm2.h1
2 files changed, 3 insertions, 16 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c
index 06a15c7..ec61618 100644
--- a/syna_tcm2.c
+++ b/syna_tcm2.c
@@ -413,7 +413,7 @@ static void syna_set_palm_mode_work(struct work_struct *work)
/**
* syna_dev_reset_detected_cb()
*
- * Callback to assign a task to helper thread.
+ * Callback to assign a task to event workqueue.
*
* Please be noted that this function will be invoked in ISR so don't
* issue another touchcomm command here.
@@ -428,11 +428,6 @@ static void syna_dev_reset_detected_cb(void *callback_data)
{
struct syna_tcm *tcm = (struct syna_tcm *)callback_data;
- if (!tcm->helper.workqueue) {
- LOGW("No helper thread created\n");
- return;
- }
-
#ifdef RESET_ON_RESUME
if (tcm->pwr_state != PWR_ON)
return;
@@ -441,7 +436,7 @@ static void syna_dev_reset_detected_cb(void *callback_data)
if (ATOMIC_GET(tcm->helper.task) == HELP_NONE) {
ATOMIC_SET(tcm->helper.task, HELP_RESET_DETECTED);
- queue_work(tcm->helper.workqueue, &tcm->helper.work);
+ queue_work(tcm->event_wq, &tcm->helper.work);
}
}
/**
@@ -2252,13 +2247,10 @@ static int syna_dev_suspend(struct device *dev)
LOGE("Fail to complete hw reset, ret = %d, status = %d\n",
retval, status);
}
- return retval;
}
retval = syna_dev_enter_lowpwr_sensing(tcm);
- if (retval < 0) {
+ if (retval < 0)
LOGE("Fail to enter suspended power mode after reset.\n");
- return retval;
- }
}
tcm->pwr_state = LOW_PWR;
#else
@@ -3056,8 +3048,6 @@ static int syna_dev_probe(struct platform_device *pdev)
#if defined(ENABLE_HELPER)
ATOMIC_SET(tcm->helper.task, HELP_NONE);
- tcm->helper.workqueue =
- create_singlethread_workqueue("synaptics_tcm_helper");
INIT_WORK(&tcm->helper.work, syna_dev_helper_work);
/* set up custom touch data parsing method */
syna_tcm_set_reset_occurrence_callback(tcm_dev,
@@ -3128,8 +3118,6 @@ static int syna_dev_remove(struct platform_device *pdev)
}
#if defined(ENABLE_HELPER)
cancel_work_sync(&tcm->helper.work);
- flush_workqueue(tcm->helper.workqueue);
- destroy_workqueue(tcm->helper.workqueue);
#endif
cancel_work_sync(&tcm->suspend_work);
diff --git a/syna_tcm2.h b/syna_tcm2.h
index cd52b28..51eb378 100644
--- a/syna_tcm2.h
+++ b/syna_tcm2.h
@@ -338,7 +338,6 @@ enum helper_task {
struct syna_tcm_helper {
syna_pal_atomic_t task;
struct work_struct work;
- struct workqueue_struct *workqueue;
};
#endif