diff options
-rw-r--r-- | syna_tcm2.c | 8 | ||||
-rw-r--r-- | syna_tcm2_platform.h | 1 | ||||
-rw-r--r-- | syna_tcm2_platform_spi.c | 19 |
3 files changed, 26 insertions, 2 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c index 61d98c8..53169e4 100644 --- a/syna_tcm2.c +++ b/syna_tcm2.c @@ -662,6 +662,10 @@ static void syna_dev_report_input_events(struct syna_tcm *tcm) wx = object_data[idx].x_width; wy = object_data[idx].y_width; + /* Report major and minor in display pixels. */ + wx = wx * tcm->hw_if->pixels_per_mm; + wy = wy * tcm->hw_if->pixels_per_mm; + if (object_data[idx].z == 0) { z = 1; LOGW("Get a touch coordinate with pressure = 0"); @@ -811,9 +815,9 @@ static int syna_dev_create_input_device(struct syna_tcm *tcm) #ifdef REPORT_TOUCH_WIDTH input_set_abs_params(input_dev, - ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); + ABS_MT_TOUCH_MAJOR, 0, tcm_dev->max_x, 0, 0); input_set_abs_params(input_dev, - ABS_MT_TOUCH_MINOR, 0, 255, 0, 0); + ABS_MT_TOUCH_MINOR, 0, tcm_dev->max_y, 0, 0); #endif tcm->input_dev_params.max_x = tcm_dev->max_x; diff --git a/syna_tcm2_platform.h b/syna_tcm2_platform.h index 0e73b50..566387b 100644 --- a/syna_tcm2_platform.h +++ b/syna_tcm2_platform.h @@ -146,6 +146,7 @@ struct syna_hw_interface { struct syna_hw_rst_data bdata_rst; struct syna_hw_pwr_data bdata_pwr; const char *fw_name; + int pixels_per_mm; #if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD) u32 offload_id; #endif diff --git a/syna_tcm2_platform_spi.c b/syna_tcm2_platform_spi.c index ec3c921..56fb5ad 100644 --- a/syna_tcm2_platform_spi.c +++ b/syna_tcm2_platform_spi.c @@ -657,6 +657,25 @@ static int syna_spi_parse_dt(struct syna_hw_interface *hw_if, bus->spi_mode = 0; } + prop = of_find_property(np, "synaptics,pixels-per-mm", NULL); + if (prop && prop->length) { + retval = of_property_read_u32(np, "synaptics,pixels-per-mm", + &value); + if (retval < 0) { + LOGE("Fail to read synaptics,pixels-per-mm\n"); + return retval; + } + + hw_if->pixels_per_mm = value; + + } else { + /* + * Set default as 1 to let the driver report the value from the + * touch IC if pixels_per_mm is not set. + */ + hw_if->pixels_per_mm = 1; + } + #if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD) hw_if->offload_id = 0; retval = of_property_read_u8_array(np, "synaptics,touch_offload_id", |