From 0844bfbb618844dfd2643345d1099784012a23d2 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Wed, 5 Feb 2020 16:54:51 +0800 Subject: [PATCH] sec_mmi: report major and minor value in pixel unit. If dts defined size to pixel factor, report those two value in pixel unit. Change-Id: Ie89e8d9427cc80d82a742e4ab2efbe8c468ac16e Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1493096 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- drivers/input/touchscreen/sec_mmi/sec_ts.c | 18 ++++++++++++++---- drivers/input/touchscreen/sec_mmi/sec_ts.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/sec_mmi/sec_ts.c b/drivers/input/touchscreen/sec_mmi/sec_ts.c index b2dde8c618fa..ce34f7ea0582 100644 --- a/drivers/input/touchscreen/sec_mmi/sec_ts.c +++ b/drivers/input/touchscreen/sec_mmi/sec_ts.c @@ -795,8 +795,10 @@ static void sec_ts_read_event(struct sec_ts_data *ts) input_report_abs(ts->input_dev, ABS_MT_POSITION_X, ts->coord[t_id].x); input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, ts->coord[t_id].y); - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, ts->coord[t_id].major); - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MINOR, ts->coord[t_id].minor); + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, + (ts->coord[t_id].major * ts->plat_data->size_to_pixel_multiple_factor) >> 7); + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MINOR, + (ts->coord[t_id].minor * ts->plat_data->size_to_pixel_multiple_factor) >> 7); if (ts->brush_mode) input_report_abs(ts->input_dev, ABS_MT_CUSTOM, (ts->coord[t_id].z << 1) | ts->coord[t_id].palm); else @@ -841,8 +843,10 @@ static void sec_ts_read_event(struct sec_ts_data *ts) input_report_abs(ts->input_dev, ABS_MT_POSITION_X, ts->coord[t_id].x); input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, ts->coord[t_id].y); - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, ts->coord[t_id].major); - input_report_abs(ts->input_dev, ABS_MT_TOUCH_MINOR, ts->coord[t_id].minor); + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, + (ts->coord[t_id].major * ts->plat_data->size_to_pixel_multiple_factor) >> 7); + input_report_abs(ts->input_dev, ABS_MT_TOUCH_MINOR, + (ts->coord[t_id].minor * ts->plat_data->size_to_pixel_multiple_factor) >> 7); if (ts->brush_mode) input_report_abs(ts->input_dev, ABS_MT_CUSTOM, (ts->coord[t_id].z << 1) | ts->coord[t_id].palm); else @@ -1285,6 +1289,12 @@ static int sec_ts_parse_dt(struct i2c_client *client) pdata->max_minor = finger_size[1] - 1; } + if (of_property_read_u32(np, "sec,size_to_pixel_multiple_factor", &pdata->size_to_pixel_multiple_factor)) + /* multiple_factor not set in device_tree. Set as default value. + * report major and minor value = raw value * size_to_pixel_multiple_factor / 128 + */ + pdata->size_to_pixel_multiple_factor = 128; + pdata->tsp_id = of_get_named_gpio(np, "sec,tsp-id_gpio", 0); if (gpio_is_valid(pdata->tsp_id)) input_info(true, dev, "%s: TSP_ID : %d\n", __func__, gpio_get_value(pdata->tsp_id)); diff --git a/drivers/input/touchscreen/sec_mmi/sec_ts.h b/drivers/input/touchscreen/sec_mmi/sec_ts.h index 8ba6bab398a6..740596ed2a87 100644 --- a/drivers/input/touchscreen/sec_mmi/sec_ts.h +++ b/drivers/input/touchscreen/sec_mmi/sec_ts.h @@ -739,6 +739,7 @@ struct sec_ts_plat_data { int max_y; int max_major; int max_minor; + int size_to_pixel_multiple_factor; unsigned rst_gpio; unsigned irq_gpio; int irq_type;