diff options
author | Fugang Duan <fugang.duan@nxp.com> | 2017-08-29 17:10:28 +0800 |
---|---|---|
committer | Fugang Duan <fugang.duan@nxp.com> | 2017-08-29 18:29:14 +0800 |
commit | 8e85cfa29fa33b9a6c1335e9f1355290d0f0fab7 (patch) | |
tree | 24605f08e61be0da87323fe312089490480480e6 | |
parent | bd6d2152e9486e7946d3cda5ee39808e5ea9edc3 (diff) |
MLK-15348-01 input: touch: focaltech: add more property to support multiple panel
Add device node more property to support multiple panel.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
5 files changed, 26 insertions, 14 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/focaltech-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/focaltech-ts.txt index b8e46cc8f8e8..8e5257db88f6 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/focaltech-ts.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/focaltech-ts.txt @@ -22,6 +22,8 @@ Optional properties: - focaltech,key-y-coord : constant y coordinate of keys, depends on the y resolution - focaltech,key-x-coords : constant x coordinates of keys, depends on the x resolution - focaltech,swap-xy : swap x-y coordinates + - focaltech,panel-type : set panel type, default is FT5416 panel + - focaltech,scaling-down-half : scale down the x-y coordiantes to half Example: 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 { |