summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWendly Li <wendlyli@google.com>2023-05-29 08:18:04 +0000
committerWendly Li <wendlyli@google.com>2023-06-06 10:43:06 +0000
commit9db7315f72917445a6efb5c64a3dc144ca283449 (patch)
treecf54f2fe0e1920b1f0f7da098f5d8650cb62a019
parent76b22eda43dad43816ca19ccc35173f1ff745567 (diff)
downloadgoodix_touch-9db7315f72917445a6efb5c64a3dc144ca283449.tar.gz
touch/goodix: Reduce kernel2java latency
Move after_event_handler to post threadirq_func. Let gti process input first to reduce touch latency. Bug: 276385203 Test: touch works properly Change-Id: I4f7129a72960f34a35100de6886a3caf5b758bb9 Signed-off-by: Wendly Li <wendlyli@google.com>
-rw-r--r--goodix_brl_hw.c8
-rw-r--r--goodix_ts_core.c34
2 files changed, 34 insertions, 8 deletions
diff --git a/goodix_brl_hw.c b/goodix_brl_hw.c
index ebf5f9d..05d2c49 100644
--- a/goodix_brl_hw.c
+++ b/goodix_brl_hw.c
@@ -1180,6 +1180,9 @@ static int brl_event_handler(struct goodix_ts_core *cd,
struct goodix_ts_event_data *event_data;
int ret;
+ /* clean event buffer */
+ memset(ts_event, 0, sizeof(*ts_event));
+
if (!cd->touch_frame_package || !cd->touch_frame_size)
return -ENOMEM;
@@ -1204,17 +1207,12 @@ static int brl_event_handler(struct goodix_ts_core *cd,
}
/*~[GOOG]*/
- /* clean event buffer */
- memset(ts_event, 0, sizeof(*ts_event));
-
ts_event->event_type = EVENT_INVALID;
ts_event->clear_count1 = event_data->clear_count1;
ts_event->clear_count2 = event_data->clear_count2;
/* read status event */
if (event_data->status_changed) {
ts_event->event_type |= EVENT_STATUS;
- hw_ops->read(cd, 0x1021C, (u8 *)&ts_event->status_data,
- sizeof(ts_event->status_data));
}
/*
diff --git a/goodix_ts_core.c b/goodix_ts_core.c
index 78ba1f0..cc360e7 100644
--- a/goodix_ts_core.c
+++ b/goodix_ts_core.c
@@ -1864,16 +1864,20 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data)
core_data->coords_timestamp = core_data->isr_timestamp;
goodix_ts_report_pen(core_data, &ts_event->pen_data);
}
+ /* [GOOG]
+ * Move to goodix_ts_post_threadirq_func.
if (ts_event->event_type & EVENT_REQUEST)
goodix_ts_request_handle(core_data, ts_event);
if (ts_event->event_type & EVENT_STATUS)
goodix_ts_report_status(core_data, ts_event);
+ */
+ /* [GOOG]
+ * Don't need to report gesture events in our use cases.
if (ts_event->event_type & EVENT_GESTURE)
goodix_ts_report_gesture(core_data, ts_event);
-
- /* read done */
- hw_ops->after_event_handler(core_data); /* [GOOG] */
+ */
}
+
/* [GOOG]
* Remove the control to enable/disable the interrupt for bottom-half.
enable_irq(core_data->irq);
@@ -1882,6 +1886,29 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data)
return IRQ_HANDLED;
}
+static irqreturn_t goodix_ts_post_threadirq_func(int irq, void *data)
+{
+ struct goodix_ts_core *core_data = data;
+ struct goodix_ts_hw_ops *hw_ops = core_data->hw_ops;
+ struct goodix_ts_event *ts_event = &core_data->ts_event;
+
+ if (ts_event->event_type != EVENT_INVALID) {
+ if (ts_event->event_type & EVENT_REQUEST)
+ goodix_ts_request_handle(core_data, ts_event);
+
+ if (ts_event->event_type & EVENT_STATUS) {
+ hw_ops->read(core_data, 0x1021C, (u8 *)&ts_event->status_data,
+ sizeof(ts_event->status_data));
+ goodix_ts_report_status(core_data, ts_event);
+ }
+
+ /* read done */
+ hw_ops->after_event_handler(core_data); /* [GOOG] */
+ }
+
+ return IRQ_HANDLED;
+}
+
/**
* goodix_ts_init_irq - Request interrput line from system
* @core_data: pointer to touch core data
@@ -2680,6 +2707,7 @@ int goodix_ts_stage2_init(struct goodix_ts_core *cd)
options->selftest = gti_selftest;
options->get_context_driver = gti_get_context_driver;
options->set_report_rate = gti_set_report_rate;
+ options->post_irq_thread_fn = goodix_ts_post_threadirq_func;
cd->gti = goog_touch_interface_probe(
cd, cd->bus->dev, cd->input_dev, gti_default_handler, options);