diff --git a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.c b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.c index dffe1d2f8bc4..9a133bc367c9 100755 --- a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.c +++ b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.c @@ -71,11 +71,25 @@ static int sec_enable_black_gesture(struct chip_data_s6sy771 *chip_info, bool en { int ret = 0; int i = 0; + bool single_tap_support_b = 0; + bool ear_sense_support_b = 0; + struct touchpanel_data *ts = i2c_get_clientdata(chip_info->client); + + if (ts) { + single_tap_support_b = ts->single_tap_support; + ear_sense_support_b = ts->ear_sense_support; + } - TPD_INFO("%s, enable = %d\n", __func__, enable); + TPD_INFO("%s, enable = %d,single_tap_support_b = %d,ear_sense_support_b =%d\n", __func__, enable, single_tap_support_b, ear_sense_support_b); if (enable) { - touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + if (single_tap_support_b) { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFFFF); + } else { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + } + + for (i = 0; i < 20; i++) { touch_i2c_write_byte(chip_info->client, SEC_CMD_SET_POWER_MODE, 0x01); sec_mdelay(10); @@ -125,12 +139,22 @@ static void sec_enable_gesture_mask(void *chip_data, uint32_t enable) struct chip_data_s6sy771 *chip_info = (struct chip_data_s6sy771 *)chip_data; int ret = -1; int i = 0; + bool single_tap_support_b = 0; + struct touchpanel_data *ts = i2c_get_clientdata(chip_info->client); - TPD_INFO("%s, enable = %d\n", __func__, enable); + if (ts) { + single_tap_support_b = ts->single_tap_support; + } + + TPD_INFO("%s, enable = %d,single_tap_support_b =%d\n", __func__, enable, single_tap_support_b); if (enable) { for (i = 0; i < 20; i++) { - touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + if (single_tap_support_b) { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFFFF); + } else { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + } touch_i2c_write_byte(chip_info->client, SEC_CMD_SET_POWER_MODE, 0x01); sec_mdelay(10); ret = touch_i2c_read_byte(chip_info->client, SEC_CMD_SET_POWER_MODE); @@ -1276,13 +1300,19 @@ static int sec_get_gesture_info(void *chip_data, struct gesture_info *gesture) struct Coordinate limitPoint[4]; struct sec_gesture_status *p_event_gesture = NULL; struct chip_data_s6sy771 *chip_info = (struct chip_data_s6sy771 *)chip_data; + bool ear_sense_support_b = 0; + struct touchpanel_data *ts = i2c_get_clientdata(chip_info->client); + + if (ts) { + ear_sense_support_b = ts->ear_sense_support; + } p_event_gesture = (struct sec_gesture_status *)chip_info->first_event; if (p_event_gesture->coordLen > 18) { p_event_gesture->coordLen = 18; } - if (p_event_gesture->gestureId == GESTURE_EARSENSE) { + if ((p_event_gesture->gestureId == GESTURE_EARSENSE) && (ear_sense_support_b)) { TPD_DETAIL("earsense gesture: away from panel\n"); return 0; } @@ -1439,6 +1469,24 @@ static int sec_get_gesture_info(void *chip_data, struct gesture_info *gesture) gesture->Point_end.x = (coord[12] << 4) | ((coord[14] >> 4) & 0x0F); gesture->Point_end.y = (coord[13] << 4) | ((coord[14] >> 0) & 0x0F); break; + + case GESTURE_SINGLE_TAP: + gesture->gesture_type = SingleTap; + gesture->Point_start.x = (coord[0] << 4) | ((coord[2] >> 4) & 0x0F); + gesture->Point_start.y = (coord[1] << 4) | ((coord[2] >> 0) & 0x0F); + break; + + case GESTURE_S: + gesture->gesture_type = Sgestrue; + gesture->Point_start.x = (coord[0] << 4) | ((coord[2] >> 4) & 0x0F); + gesture->Point_start.y = (coord[1] << 4) | ((coord[2] >> 0) & 0x0F); + gesture->Point_1st.x = (coord[3] << 4) | ((coord[5] >> 4) & 0x0F); + gesture->Point_1st.y = (coord[4] << 4) | ((coord[5] >> 0) & 0x0F); + gesture->Point_2nd.x = (coord[6] << 4) | ((coord[8] >> 4) & 0x0F); + gesture->Point_2nd.y = (coord[7] << 4) | ((coord[8] >> 0) & 0x0F); + gesture->Point_end.x = (coord[9] << 4) | ((coord[11] >> 4) & 0x0F); + gesture->Point_end.y = (coord[10] << 4) | ((coord[11] >> 0) & 0x0F); + break; default: gesture->gesture_type = UnkownGesture; diff --git a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.h b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.h index 72442a277c68..1c6d6e8406b5 100755 --- a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.h +++ b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY771/sec_drivers_s6sy771.h @@ -28,6 +28,8 @@ #define GESTURE_M 0x0A #define GESTURE_W 0x0B #define GESTURE_DOUBLE_LINE 0x0C +#define GESTURE_SINGLE_TAP 0x0E +#define GESTURE_S 0x0F #define GESTURE_EARSENSE 0x0E #define RESET_TO_NORMAL_TIME (70) diff --git a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.c b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.c index cadc5090cec9..4cfb2bff251b 100755 --- a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.c +++ b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.c @@ -72,11 +72,23 @@ static int sec_enable_black_gesture(struct chip_data_s6sy791 *chip_info, bool en { int ret = 0; int i = 0; + bool single_tap_support_b = 0; + bool ear_sense_support_b = 0; + struct touchpanel_data *ts = i2c_get_clientdata(chip_info->client); + + if (ts) { + single_tap_support_b = ts->single_tap_support; + ear_sense_support_b = ts->ear_sense_support; + } - TPD_INFO("%s, enable = %d\n", __func__, enable); + TPD_INFO("%s, enable = %d,single_tap_support_b = %d,ear_sense_support_b =%d\n", __func__, enable, single_tap_support_b, ear_sense_support_b); if (enable) { - touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + if (single_tap_support_b) { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFFFF); + } else { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + } for (i = 0; i < 20; i++) { touch_i2c_write_byte(chip_info->client, SEC_CMD_SET_POWER_MODE, 0x01); sec_mdelay(10); @@ -127,12 +139,22 @@ static void sec_enable_gesture_mask(void *chip_data, uint32_t enable) struct chip_data_s6sy791 *chip_info = (struct chip_data_s6sy791 *)chip_data; int ret = -1; int i = 0; + bool single_tap_support_b = 0; + struct touchpanel_data *ts = i2c_get_clientdata(chip_info->client); - TPD_INFO("%s, enable = %d\n", __func__, enable); + if (ts) { + single_tap_support_b = ts->single_tap_support; + } + + TPD_INFO("%s, enable = %d,single_tap_support_b =%d\n", __func__, enable, single_tap_support_b); if (enable) { for (i = 0; i < 20; i++) { - touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + if (single_tap_support_b) { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFFFF); + } else { + touch_i2c_write_word(chip_info->client, SEC_CMD_WAKEUP_GESTURE_MODE, 0xFF1F); + } touch_i2c_write_byte(chip_info->client, SEC_CMD_SET_POWER_MODE, 0x01); sec_mdelay(10); ret = touch_i2c_read_byte(chip_info->client, SEC_CMD_SET_POWER_MODE); @@ -1216,13 +1238,19 @@ static int sec_get_gesture_info(void *chip_data, struct gesture_info *gesture) struct Coordinate limitPoint[4]; struct sec_gesture_status *p_event_gesture = NULL; struct chip_data_s6sy791 *chip_info = (struct chip_data_s6sy791 *)chip_data; + bool ear_sense_support_b = 0; + struct touchpanel_data *ts = i2c_get_clientdata(chip_info->client); + + if (ts) { + ear_sense_support_b = ts->ear_sense_support; + } p_event_gesture = (struct sec_gesture_status *)chip_info->first_event; if (p_event_gesture->coordLen > 18) { p_event_gesture->coordLen = 18; } - if (p_event_gesture->gestureId == GESTURE_EARSENSE) { + if ((p_event_gesture->gestureId == GESTURE_EARSENSE) && (ear_sense_support_b)) { TPD_DETAIL("earsense gesture: away from panel\n"); return 0; } @@ -1379,6 +1407,24 @@ static int sec_get_gesture_info(void *chip_data, struct gesture_info *gesture) gesture->Point_end.x = (coord[12] << 4) | ((coord[14] >> 4) & 0x0F); gesture->Point_end.y = (coord[13] << 4) | ((coord[14] >> 0) & 0x0F); break; + + case GESTURE_SINGLE_TAP: + gesture->gesture_type = SingleTap; + gesture->Point_start.x = (coord[0] << 4) | ((coord[2] >> 4) & 0x0F); + gesture->Point_start.y = (coord[1] << 4) | ((coord[2] >> 0) & 0x0F); + break; + + case GESTURE_S: + gesture->gesture_type = Sgestrue; + gesture->Point_start.x = (coord[0] << 4) | ((coord[2] >> 4) & 0x0F); + gesture->Point_start.y = (coord[1] << 4) | ((coord[2] >> 0) & 0x0F); + gesture->Point_1st.x = (coord[3] << 4) | ((coord[5] >> 4) & 0x0F); + gesture->Point_1st.y = (coord[4] << 4) | ((coord[5] >> 0) & 0x0F); + gesture->Point_2nd.x = (coord[6] << 4) | ((coord[8] >> 4) & 0x0F); + gesture->Point_2nd.y = (coord[7] << 4) | ((coord[8] >> 0) & 0x0F); + gesture->Point_end.x = (coord[9] << 4) | ((coord[11] >> 4) & 0x0F); + gesture->Point_end.y = (coord[10] << 4) | ((coord[11] >> 0) & 0x0F); + break; default: gesture->gesture_type = UnkownGesture; diff --git a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.h b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.h index fb276aa277ab..30048208c5c6 100755 --- a/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.h +++ b/drivers/input/touchscreen/oplus_touchscreen/Samsung/S6SY791/sec_drivers_s6sy791.h @@ -28,6 +28,8 @@ #define GESTURE_M 0x0A #define GESTURE_W 0x0B #define GESTURE_DOUBLE_LINE 0x0C +#define GESTURE_SINGLE_TAP 0x0E +#define GESTURE_S 0x0F #define GESTURE_EARSENSE 0x0E #define RESET_TO_NORMAL_TIME (70) diff --git a/drivers/input/touchscreen/oplus_touchscreen/touchpanel_common_driver.c b/drivers/input/touchscreen/oplus_touchscreen/touchpanel_common_driver.c index c5939bfd3989..6c01d43ddcdc 100755 --- a/drivers/input/touchscreen/oplus_touchscreen/touchpanel_common_driver.c +++ b/drivers/input/touchscreen/oplus_touchscreen/touchpanel_common_driver.c @@ -92,6 +92,13 @@ static int pm_qos_state = 0; #define PM_QOS_TOUCH_WAKEUP_VALUE 400 #endif +static int sigle_num = 0; +static struct timeval tpstart, tpend; +static int pointx[2] = {0, 0}; +static int pointy[2] = {0, 0}; + +#define ABS(a, b) ((a - b > 0) ? a - b : b - a) + /*******Part2:declear Area********************************/ void tp_delta_debug_read_func_another(void); @@ -463,6 +470,36 @@ static void tp_geture_info_transform(struct gesture_info *gesture, struct resolu gesture->Point_4th.y = gesture->Point_4th.y * resolution_info->LCD_HEIGHT / (resolution_info->max_y); } +int sec_double_tap(struct gesture_info *gesture) +{ + uint32_t timeuse = 0; + + if (sigle_num == 0) { + do_gettimeofday(&tpstart); + pointx[0] = gesture->Point_start.x; + pointy[0] = gesture->Point_start.y; + sigle_num++; + TPD_DEBUG("first enter double tap\n"); + } else if (sigle_num == 1) { + do_gettimeofday(&tpend); + pointx[1] = gesture->Point_start.x; + pointy[1] = gesture->Point_start.y; + sigle_num = 0; + timeuse = 1000000 * (tpend.tv_sec-tpstart.tv_sec) + tpend.tv_usec-tpstart.tv_usec; + TPD_DEBUG("timeuse = %d, distance[x] = %d, distance[y] = %d\n", timeuse, ABS(pointx[0], pointx[1]), ABS(pointy[0], pointy[1])); + if ((ABS(pointx[0], pointx[1]) < 150) && (ABS(pointy[0], pointy[1]) < 200) && (timeuse < 500000)) { + return 1; + } else { + TPD_DEBUG("not match double tap\n"); + do_gettimeofday(&tpstart); + pointx[0] = gesture->Point_start.x; + pointy[0] = gesture->Point_start.y; + sigle_num = 1; + } + } + return 0; +} + static void tp_gesture_handle(struct touchpanel_data *ts) { struct gesture_info gesture_info_temp; @@ -481,6 +518,13 @@ static void tp_gesture_handle(struct touchpanel_data *ts) } tp_geture_info_transform(&gesture_info_temp, &ts->resolution_info); + if (ts->single_tap_support) { + if (gesture_info_temp.gesture_type == SingleTap) { + if (sec_double_tap(&gesture_info_temp) == 1) { + gesture_info_temp.gesture_type = DouTap; + } + } + } TPD_INFO("detect %s gesture\n", gesture_info_temp.gesture_type == DouTap ? "double tap" : gesture_info_temp.gesture_type == UpVee ? "up vee" :