Input: touchscreen-gt9xx: enable the gt9xx SLOT REPORT
authorCaesar Wang <wxt@rock-chips.com>
Wed, 30 Mar 2016 09:01:29 +0000 (17:01 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Fri, 1 Apr 2016 06:44:38 +0000 (14:44 +0800)
On the moment, the gt9xx touchscreen driver can't work on chromeos.
Since the driver report event has *not* judge correct by the chromeos.

We need report the singel point touch information for event firstly,
otherwise the chromeos will force a signel point to work.

That's seem a chromeos issue/leak.
Anyway, we can report the point including the signal information
to workaround.

Verify on rk3399evb board with chromeos.

root@localhost / # evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      goodix-ts
/dev/input/event1:      rk29-keypad
Select the device event number [0-1]: 0
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0xdead product 0xbeef version 0x28bb
Input device name: "goodix-ts"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
  Event code 0 (ABS_X)
  ...

  Event: time 1450321044.293221, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 0
  Event: time 1450321044.293221, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 4095
  Event: time 1450321044.293221, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 4083
  Event: time 1450321044.293221, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 8
  Event: time 1450321044.293221, type 3 (EV_ABS), code 50 (ABS_MT_WIDTH_MAJOR), value 8
  Event: time 1450321044.293221, -------------- SYN_REPORT ------------
  Event: time 1450321044.384655, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
  Event: time 1450321044.384655, -------------- SYN_REPORT ------------

Change-Id: Ic41327a673632e471429ded35b68eecbbd7f3069
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
drivers/input/touchscreen/gt9xx/gt9xx.c
drivers/input/touchscreen/gt9xx/gt9xx.h

index bbc19b4be221818531e92af19de0f45ce01e3071..47b43f611ed077d19f4d92b116ecd42934251ab1 100755 (executable)
@@ -482,7 +482,7 @@ static void gtp_pen_init(struct goodix_ts_data *ts)
     ts->pen_dev->evbit[0] = BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) ;
     
 #if GTP_ICS_SLOT_REPORT
-    input_mt_init_slots(ts->pen_dev, 16);               // 
+    input_mt_init_slots(ts->pen_dev, 16, INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
 #else
     ts->pen_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 #endif
@@ -2021,7 +2021,8 @@ Output:
     Executive outcomes.
         0: succeed, otherwise: failed.
 *******************************************************/
-static s8 gtp_request_input_dev(struct goodix_ts_data *ts)
+static s8 gtp_request_input_dev(struct i2c_client *client,
+                                struct goodix_ts_data *ts)
 {
     s8 ret = -1;
     s8 phys[32];
@@ -2030,7 +2031,7 @@ static s8 gtp_request_input_dev(struct goodix_ts_data *ts)
 #endif
     GTP_DEBUG_FUNC();
   
-    ts->input_dev = input_allocate_device();
+    ts->input_dev = devm_input_allocate_device(&client->dev);
     if (ts->input_dev == NULL)
     {
         GTP_ERROR("Failed to allocate input device.");
@@ -2039,7 +2040,7 @@ static s8 gtp_request_input_dev(struct goodix_ts_data *ts)
 
     ts->input_dev->evbit[0] = BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) ;
 #if GTP_ICS_SLOT_REPORT
-    input_mt_init_slots(ts->input_dev, 16);     // in case of "out of memory"
+    input_mt_init_slots(ts->input_dev, 16, INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);     // in case of "out of memory"
 #else
     ts->input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 #endif
@@ -2060,6 +2061,10 @@ static s8 gtp_request_input_dev(struct goodix_ts_data *ts)
         GTP_SWAP(ts->abs_x_max, ts->abs_y_max);
     }
 
+#if defined(CONFIG_CHROME_PLATFORMS)
+    input_set_abs_params(ts->input_dev, ABS_X, 0, ts->abs_x_max, 0, 0);
+    input_set_abs_params(ts->input_dev, ABS_Y, 0, ts->abs_y_max, 0, 0);
+#endif
     input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, ts->abs_x_max, 0, 0);
     input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, ts->abs_y_max, 0, 0);
     input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
@@ -2717,7 +2722,7 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id
     }
 #endif
 
-    ret = gtp_request_input_dev(ts);
+    ret = gtp_request_input_dev(client, ts);
     if (ret < 0)
     {
         GTP_ERROR("GTP request input dev failed");
index 2e16a2b318d0af052c38062cfce3290d0bd6e1c7..dc5c59413e2a9deeef24511b8c064813a16e5e18 100755 (executable)
 #define GTP_DRIVER_SEND_CFG   1
 #define GTP_HAVE_TOUCH_KEY    0
 #define GTP_POWER_CTRL_SLEEP  0
+
+#if defined(CONFIG_CHROME_PLATFORMS)
+#define GTP_ICS_SLOT_REPORT   1
+#else
 #define GTP_ICS_SLOT_REPORT   0
+#endif
 
 #define GTP_AUTO_UPDATE       0    // auto update fw by .bin file as default
 #define GTP_HEADER_FW_UPDATE  0    // auto update fw by gtp_default_FW in gt9xx_firmware.h, function together with GTP_AUTO_UPDATE