summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com>2023-06-11 18:33:33 -0700
committerSecurityBot <android-nexus-securitybot@system.gserviceaccount.com>2023-06-11 18:33:33 -0700
commit4fbc17d12b94014d0a0364608ce22740de2fd685 (patch)
treede85a4a837be8a2e107daec900e3f93e98fc43f4
parentfcc49005d03158bee5077feb83ed7487a9fb4fd4 (diff)
parent1a4c1912d1c67b7835e89eeb0ccc4ebbc3151d24 (diff)
downloadcommon-4fbc17d12b94014d0a0364608ce22740de2fd685.tar.gz
Merge android14-gs-pixel-5.15-udc-d1 into android14-gs-pixel-5.15-udc-qpr1
SBMerger: 526756187 Change-Id: I60fcd343b3fde514e31eb0ced10c196f0899fe6e Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
-rw-r--r--goog_touch_interface.c30
-rw-r--r--goog_touch_interface.h15
2 files changed, 40 insertions, 5 deletions
diff --git a/goog_touch_interface.c b/goog_touch_interface.c
index 7eb143c..23053b5 100644
--- a/goog_touch_interface.c
+++ b/goog_touch_interface.c
@@ -2834,9 +2834,17 @@ void goog_input_report_abs(
switch (code) {
case ABS_MT_POSITION_X:
gti->offload.coords[gti->slot].x = value;
+ if ((value > gti->abs_x_max) || (value < gti->abs_x_min)) {
+ GOOG_WARN(gti, "Unexpected x-coord (slot#%d range#(%d, %d)), x: %d!",
+ gti->slot, gti->abs_x_min, gti->abs_x_max, value);
+ }
break;
case ABS_MT_POSITION_Y:
gti->offload.coords[gti->slot].y = value;
+ if ((value > gti->abs_y_max) || (value < gti->abs_y_min)) {
+ GOOG_WARN(gti, "Unexpected y-coord (slot#%d range#(%d, %d)), y: %d!",
+ gti->slot, gti->abs_y_min, gti->abs_y_max, value);
+ }
break;
case ABS_MT_TOUCH_MAJOR:
gti->offload.coords[gti->slot].major = value;
@@ -3082,6 +3090,11 @@ void goog_init_input(struct goog_touch_interface *gti)
gti->debug_input[i].slot = i;
if (gti->vendor_dev && gti->vendor_input_dev) {
+ gti->abs_x_max = input_abs_get_max(gti->vendor_input_dev, ABS_MT_POSITION_X);
+ gti->abs_x_min = input_abs_get_min(gti->vendor_input_dev, ABS_MT_POSITION_X);
+ gti->abs_y_max = input_abs_get_max(gti->vendor_input_dev, ABS_MT_POSITION_Y);
+ gti->abs_y_min = input_abs_get_min(gti->vendor_input_dev, ABS_MT_POSITION_Y);
+
/*
* Initialize the ABS_MT_ORIENTATION to support orientation reporting.
* Initialize the ABS_MT_TOUCH_MAJOR and ABS_MT_TOUCH_MINOR depending on
@@ -3089,11 +3102,11 @@ void goog_init_input(struct goog_touch_interface *gti)
* shape algo reporting.
*/
if (gti->offload.caps.rotation_reporting) {
- int abs_x_max = input_abs_get_max(gti->vendor_input_dev, ABS_MT_POSITION_X);
- int abs_x_min = input_abs_get_min(gti->vendor_input_dev, ABS_MT_POSITION_X);
+ int abs_x_max = gti->abs_x_max;
+ int abs_x_min = gti->abs_x_min;
int abs_x_res = input_abs_get_res(gti->vendor_input_dev, ABS_MT_POSITION_X);
- int abs_y_max = input_abs_get_max(gti->vendor_input_dev, ABS_MT_POSITION_Y);
- int abs_y_min = input_abs_get_min(gti->vendor_input_dev, ABS_MT_POSITION_Y);
+ int abs_y_max = gti->abs_y_max;
+ int abs_y_min = gti->abs_y_min;
int abs_y_res = input_abs_get_res(gti->vendor_input_dev, ABS_MT_POSITION_Y);
int abs_major_max = abs_x_max;
int abs_major_min = abs_x_min;
@@ -3235,6 +3248,8 @@ void goog_init_options(struct goog_touch_interface *gti,
gti->options.set_screen_protector_mode = options->set_screen_protector_mode;
if (options->set_sensing_mode)
gti->options.set_sensing_mode = options->set_sensing_mode;
+
+ gti->options.post_irq_thread_fn = options->post_irq_thread_fn;
}
}
@@ -3762,7 +3777,7 @@ static irqreturn_t gti_irq_thread_fn(int irq, void *data)
*/
mutex_lock(&gti->input_process_lock);
- if (gti->vendor_irq_thread_fn)
+ if (gti->vendor_irq_thread_fn != NULL)
ret = gti->vendor_irq_thread_fn(irq, gti->vendor_irq_cookie);
else
ret = IRQ_HANDLED;
@@ -3771,6 +3786,11 @@ static irqreturn_t gti_irq_thread_fn(int irq, void *data)
mutex_unlock(&gti->input_process_lock);
+ if (ret == IRQ_HANDLED && gti->vendor_irq_thread_fn != NULL &&
+ gti->options.post_irq_thread_fn != NULL) {
+ ret = gti->options.post_irq_thread_fn(irq, gti->vendor_irq_cookie);
+ }
+
gti_debug_hc_update(gti, false);
cpu_latency_qos_update_request(&gti->pm_qos_req, PM_QOS_DEFAULT_VALUE);
if (gti->tbn_enabled)
diff --git a/goog_touch_interface.h b/goog_touch_interface.h
index 0cb0490..684bf22 100644
--- a/goog_touch_interface.h
+++ b/goog_touch_interface.h
@@ -480,8 +480,13 @@ struct gti_fw_status_data {
* @set_scan_mode: vendor driver operation to set scan mode.
* @set_screen_protector_mode: vendor driver operation to set screen protector mode.
* @set_sensing_mode: vendor driver operation to set sensing mode.
+ * @post_irq_thread_fn: post irq thread function that register by vendor driver.
*/
struct gti_optional_configuration {
+ /*
+ * Vendor command with GTI default NOP handler.
+ * No need to check before use.
+ */
int (*get_context_driver)(void *private_data, struct gti_context_driver_cmd *cmd);
int (*get_context_stylus)(void *private_data, struct gti_context_stylus_cmd *cmd);
int (*get_coord_filter_enabled)(void *private_data, struct gti_coord_filter_cmd *cmd);
@@ -511,6 +516,12 @@ struct gti_optional_configuration {
int (*set_screen_protector_mode)(void *private_data,
struct gti_screen_protector_mode_cmd *cmd);
int (*set_sensing_mode)(void *private_data, struct gti_sensing_cmd *cmd);
+
+ /*
+ * Vendor command without GTI default NOP handler.
+ * Need to check before use.
+ */
+ irq_handler_t post_irq_thread_fn;
};
/**
@@ -645,6 +656,10 @@ struct goog_touch_interface {
struct delayed_work set_report_rate_work;
u32 increase_report_rate_delay;
u32 decrease_report_rate_delay;
+ int abs_x_min;
+ int abs_x_max;
+ int abs_y_min;
+ int abs_y_max;
int display_vrefresh;
enum gti_display_state_setting display_state;