From dd6bc1f102d3285f3028199813182477d9a3d22e Mon Sep 17 00:00:00 2001 From: davidycchen Date: Tue, 24 May 2022 11:37:24 +0800 Subject: synaptics: check touch status in work function Skip to send any command when the touch is off. Bug: 233023888 Test: build pass and touch works. Signed-off-by: davidycchen Change-Id: I4404714743e200a025a919df1d83dd60e5f7545b --- syna_tcm2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/syna_tcm2.c b/syna_tcm2.c index fdc48d5..5191f01 100644 --- a/syna_tcm2.c +++ b/syna_tcm2.c @@ -314,6 +314,11 @@ static void syna_motion_filter_work(struct work_struct *work) { struct syna_tcm *tcm = container_of(work, struct syna_tcm, motion_filter_work); + if (tcm->pwr_state != PWR_ON) { + LOGI("Touch is already off."); + return; + } + /* Send command to update filter state */ LOGD("setting motion filter = %s.\n", tcm->set_continuously_report ? "false" : "true"); @@ -330,6 +335,11 @@ static void syna_set_report_rate_work(struct work_struct *work) delayed_work = container_of(work, struct delayed_work, work); tcm = container_of(delayed_work, struct syna_tcm, set_report_rate_work); + if (tcm->pwr_state != PWR_ON) { + LOGI("Touch is already off."); + return; + } + if (tcm->touch_count != 0) { queue_delayed_work(tcm->event_wq, &tcm->set_report_rate_work, msecs_to_jiffies(10)); @@ -399,6 +409,11 @@ static void syna_dev_helper_work(struct work_struct *work) struct syna_tcm *tcm = container_of(helper, struct syna_tcm, helper); + if (tcm->pwr_state != PWR_ON) { + LOGI("Touch is already off."); + goto exit; + } + task = ATOMIC_GET(helper->task); switch (task) { @@ -410,6 +425,7 @@ static void syna_dev_helper_work(struct work_struct *work) break; } +exit: ATOMIC_SET(helper->task, HELP_NONE); } #endif -- cgit v1.2.3