diff options
Diffstat (limited to 'drivers/input/touchscreen/focaltech_touch')
4 files changed, 24 insertions, 14 deletions
diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_common.h b/drivers/input/touchscreen/focaltech_touch/focaltech_common.h index c55c5904a3dc..ae4807c7b700 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_common.h +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_common.h @@ -44,10 +44,6 @@ #define FLAG_ICSERIALS_LEN 5 #define FLAG_IDC_BIT 11 -#define IC_SERIALS (FTS_CHIP_TYPE & FLAGBITS(0, FLAG_ICSERIALS_LEN-1)) -#define FTS_CHIP_IDC \ - ((FTS_CHIP_TYPE & FLAGBIT(FLAG_IDC_BIT)) == FLAGBIT(FLAG_IDC_BIT)) - #define FTS_CHIP_TYPE_MAPPING { \ {0x01, 0x58, 0x22, 0x58, 0x22, 0x00, 0x00, 0x58, 0x2C}, \ {0x02, 0x54, 0x22, 0x54, 0x22, 0x00, 0x00, 0x54, 0x2C}, \ diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_config.h b/drivers/input/touchscreen/focaltech_touch/focaltech_config.h index 1d19f53ec5d8..87b622e77942 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_config.h +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_config.h @@ -78,13 +78,6 @@ #define _FT3267 0x32670004 #define _FT3367 0x33670004 -/*************************************************/ - -/* - * choose your ic chip type of focaltech - */ -#define FTS_CHIP_TYPE _FT5416 - /******************* Enables *********************/ /*********** 1 to enable, 0 to disable ***********/ diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_core.c b/drivers/input/touchscreen/focaltech_touch/focaltech_core.c index 0e3da4229968..38aa6c88f7e0 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_core.c @@ -78,6 +78,12 @@ static void fts_release_all_finger(void); static int fts_ts_suspend(struct device *dev); static int fts_ts_resume(struct device *dev); +static bool fts_chip_idc(struct fts_ts_data *data) +{ + return ((data->pdata->fts_chip_type & FLAGBIT(FLAG_IDC_BIT)) == + FLAGBIT(FLAG_IDC_BIT)); +} + /***************************************************************************** * Name: fts_wait_tp_to_valid * Brief: Read chip id until TP FW become valid, @@ -720,6 +726,11 @@ static int fts_read_touchdata(struct fts_ts_data *data) if (data->pdata->swap) swap(event->au16_x[i], event->au16_y[i]); + if (data->pdata->scaling_down_half) { + event->au16_x[i] = event->au16_x[i] >> 1; + event->au16_y[i] = event->au16_y[i] >> 1; + } + event->au8_finger_id[i] = (buf[FTS_TOUCH_ID_POS + FTS_ONE_TCH_LEN * i]) >> 4; event->area[i] = @@ -914,6 +925,12 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) FTS_FUNC_ENTER(); + pdata->fts_chip_type = _FT5416; + rc = of_property_read_u32(np, "focaltech,panel-type", + &pdata->fts_chip_type); + if (rc) + FTS_ERROR("Panel type is undefined, use default panel FT5416"); + rc = fts_get_dt_coords(dev, "focaltech,display-coords", pdata); if (rc) FTS_ERROR("Unable to get display-coords"); @@ -969,6 +986,8 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) } pdata->swap = of_property_read_bool(np, "focaltech,swap-xy"); + pdata->scaling_down_half = of_property_read_bool(np, + "focaltech,scaling-down-half"); FTS_FUNC_EXIT(); return 0; @@ -1316,9 +1335,9 @@ static int fts_ts_resume(struct device *dev) FTS_FUNC_EXIT(); return -1; } -#if (!FTS_CHIP_IDC) - fts_reset_proc(200); -#endif + + if (!fts_chip_idc(data)) + fts_reset_proc(200); fts_tp_state_recovery(data->client); diff --git a/drivers/input/touchscreen/focaltech_touch/focaltech_core.h b/drivers/input/touchscreen/focaltech_touch/focaltech_core.h index 55ab92cecc73..b8ef41f58420 100644 --- a/drivers/input/touchscreen/focaltech_touch/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_touch/focaltech_core.h @@ -104,6 +104,7 @@ *****************************************************************************/ struct fts_ts_platform_data { + u32 fts_chip_type; u32 irq_gpio; u32 irq_gpio_flags; u32 reset_gpio; @@ -120,6 +121,7 @@ struct fts_ts_platform_data { u32 max_touch_number; bool swap; + bool scaling_down_half; }; struct ts_event { |