From cf6c77763e718ec001f20537339739a7039e9bb1 Mon Sep 17 00:00:00 2001 From: litong20 Date: Mon, 22 Nov 2021 11:12:55 +0800 Subject: [PATCH] Add pm_qos control to reduce the interrupt responce time request pm_qos during the interrupt processing to prevent the CPU from going to sleep state. Change-Id: I78a67ef1aa9a363e9d7f9546b8d4c20a81ac04c4 Reviewed-on: https://gerrit.mot.com/2107618 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- .../touchscreen/goodix_berlin_mmi/goodix_ts_core.c | 14 ++++++++++++++ .../touchscreen/goodix_berlin_mmi/goodix_ts_core.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c index b131ccb5d4ae..92516e2c10a7 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.c @@ -1097,6 +1097,11 @@ static int goodix_parse_dt(struct device_node *node, } } + board_data->pm_qos_enable = of_property_read_bool(node, + "goodix,pm_qos-enable"); + if (board_data->pm_qos_enable) + ts_info("goodix pm_qos enabled"); + board_data->sensitivity_ctrl = of_property_read_bool(node, "goodix,sensitivity-ctrl"); if (board_data->sensitivity_ctrl) @@ -1227,8 +1232,13 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data) struct goodix_ext_module *ext_module, *next; struct goodix_ts_event *ts_event = &core_data->ts_event; struct goodix_ts_esd *ts_esd = &core_data->ts_esd; + const struct goodix_ts_board_data *ts_bdata = board_data(core_data); int ret; + if (ts_bdata->pm_qos_enable) + cpu_latency_qos_add_request(&core_data->goodix_pm_qos, 0); + + ts_esd->irq_status = true; core_data->irq_trig_cnt++; /* inform external module */ @@ -1267,6 +1277,10 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data) hw_ops->after_event_handler(core_data); ts_event->retry = 0; + if (ts_bdata->pm_qos_enable) + cpu_latency_qos_remove_request(&core_data->goodix_pm_qos); + + return IRQ_HANDLED; } diff --git a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h index 5db68daba2ed..c2ffb36278d1 100644 --- a/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h +++ b/drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_core.h @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef CONFIG_OF #include #include @@ -272,6 +273,7 @@ struct goodix_ts_board_data { unsigned int panel_max_p; /*pressure*/ bool pen_enable; + bool pm_qos_enable; char fw_name[GOODIX_MAX_STR_LABLE_LEN]; char cfg_bin_name[GOODIX_MAX_STR_LABLE_LEN]; char stylus_clk_src[GOODIX_MAX_STR_LABLE_LEN]; /*stylus clock source*/ @@ -489,6 +491,7 @@ struct goodix_ts_core { struct wakeup_source *gesture_wakelock; struct notifier_block ts_notifier; struct goodix_ts_esd ts_esd; + struct pm_qos_request goodix_pm_qos; #ifdef CONFIG_FB struct notifier_block fb_notifier;