From bcabfcd7b204b8530b4ce2e2515b06f31b8138ce Mon Sep 17 00:00:00 2001 From: litong Date: Mon, 23 Mar 2020 17:14:33 +0800 Subject: [PATCH] Add synaptics major and minor TP: Add synaptics major and minor events reporting. Change-Id: Iaff3ee25c7e96d81b5d5694481f55633d6112cdc Reviewed-on: https://gerrit.mot.com/1501279 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jialei Hao Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../synaptics_tcm_mmi_v2/synaptics_i2c.c | 15 +++++++++++++++ .../synaptics_tcm_mmi_v2/synaptics_tcm.h | 1 + .../synaptics_tcm_mmi_v2/synaptics_touch.c | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_i2c.c b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_i2c.c index 0d6de29a8e01..fafcadfa9bb6 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_i2c.c +++ b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_i2c.c @@ -185,6 +185,21 @@ static int parse_dt(struct device *dev, struct syna_tcm_board_data *bdata) bdata->tpio_reset_gpio = -1; } + prop = of_find_property(np, "synaptics,size_to_pixel_multiple_factor", NULL); + if (prop && prop->length) { + retval = of_property_read_u32(np, "synaptics,size_to_pixel_multiple_factor", + &value); + if (retval < 0) { + LOGE(dev, + "Unable to read synaptics,size_to_pixel_multiple_factor property\n"); + return retval; + } else { + bdata->size_to_pixel_multiple_factor = value; + } + } else { + bdata->size_to_pixel_multiple_factor = 128; + } + prop = of_find_property(np, "synaptics,x-flip", NULL); bdata->x_flip = prop > 0 ? true : false; diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_tcm.h b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_tcm.h index d324a332c506..2274fbd601eb 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_tcm.h +++ b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_tcm.h @@ -40,6 +40,7 @@ struct syna_tcm_board_data { bool x_flip; bool y_flip; bool swap_axes; + int size_to_pixel_multiple_factor; int irq_gpio; int irq_on_state; int power_gpio; diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_touch.c b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_touch.c index 9c0fa607d4cf..720b2e53cab1 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_touch.c +++ b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_touch.c @@ -632,6 +632,8 @@ static void touch_report(void) unsigned int idx; unsigned int x; unsigned int y; + unsigned int major; + unsigned int minor; unsigned int temp; unsigned int status; unsigned int touch_count; @@ -697,6 +699,8 @@ static void touch_report(void) case GLOVED_FINGER: x = object_data[idx].x_pos; y = object_data[idx].y_pos; + minor = object_data[idx].x_width * bdata->size_to_pixel_multiple_factor; + major = object_data[idx].y_width * bdata->size_to_pixel_multiple_factor; if (bdata->swap_axes) { temp = x; x = y; @@ -719,12 +723,16 @@ static void touch_report(void) ABS_MT_POSITION_X, x); input_report_abs(touch_hcd->input_dev, ABS_MT_POSITION_Y, y); + input_report_abs(touch_hcd->input_dev, + ABS_MT_TOUCH_MAJOR, major); + input_report_abs(touch_hcd->input_dev, + ABS_MT_TOUCH_MINOR, minor); #ifndef TYPE_B_PROTOCOL input_mt_sync(touch_hcd->input_dev); #endif LOGD(tcm_hcd->pdev->dev.parent, - "Finger %d: x = %d, y = %d\n", - idx, x, y); + "Finger %d: x = %d, y = %d, x_width = %d, y_width = %d\n", + idx, x, y, object_data[idx].x_width, object_data[idx].y_width); touch_count++; break; default: @@ -767,6 +775,10 @@ static int touch_set_input_params(void) ABS_MT_POSITION_X, 0, touch_hcd->max_x, 0, 0); input_set_abs_params(touch_hcd->input_dev, ABS_MT_POSITION_Y, 0, touch_hcd->max_y, 0, 0); + input_set_abs_params(touch_hcd->input_dev, + ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); + input_set_abs_params(touch_hcd->input_dev, + ABS_MT_TOUCH_MINOR, 0, 255, 0, 0); input_mt_init_slots(touch_hcd->input_dev, touch_hcd->max_objects, INPUT_MT_DIRECT);