mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
Optimize goodix gesture mode
Receive gesture type through extended API and remove redundant codes. Change-Id: I11d20bcebba4c00f352896f5fa8faed2aa2ab5fe Signed-off-by: Wenge Zhu <zhuwg1@motorola.com> Reviewed-on: https://gerrit.mot.com/2425685 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Reviewed-by: Wei Deng <dengwei1@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
1d1206c18f
commit
e81a2e15eb
3 changed files with 37 additions and 27 deletions
|
|
@ -45,6 +45,10 @@ ifeq ($(GTP_ENABLE_DDA_STYLUS),true)
|
|||
KBUILD_OPTIONS += CONFIG_GTP_DDA_STYLUS=y
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD_USES_DOUBLE_TAP_CTRL),true)
|
||||
KBUILD_OPTIONS += CONFIG_BOARD_USES_DOUBLE_TAP_CTRL=y
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := goodix_brl_mmi.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),)
|
|||
goodix_brl_mmi-objs += goodix_ts_mmi.o
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y, $(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_BOARD_USES_DOUBLE_TAP_CTRL
|
||||
endif
|
||||
|
||||
ifneq ($(findstring _factory,$(TARGET_PRODUCT)),)
|
||||
USE_TARGET_PRODUCT := $(strip $(subst _factory,, $(TARGET_PRODUCT)))
|
||||
else
|
||||
|
|
|
|||
|
|
@ -919,7 +919,10 @@ static int goodix_ts_mmi_panel_state(struct device *dev,
|
|||
struct goodix_ts_core *core_data;
|
||||
const struct goodix_ts_hw_ops *hw_ops;
|
||||
int ret = 0;
|
||||
static unsigned short gesture_cmd = 0xFFFF;
|
||||
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
||||
unsigned short gesture_cmd = 0xFFFF;
|
||||
unsigned char gesture_type = 0;
|
||||
#endif
|
||||
|
||||
GET_GOODIX_DATA(dev);
|
||||
hw_ops = core_data->hw_ops;
|
||||
|
|
@ -928,30 +931,23 @@ static int goodix_ts_mmi_panel_state(struct device *dev,
|
|||
case TS_MMI_PM_GESTURE:
|
||||
hw_ops->irq_enable(core_data, false);
|
||||
if (hw_ops->gesture)
|
||||
#if defined(PRODUCT_MIAMI)
|
||||
hw_ops->gesture(core_data, 0x80);
|
||||
#else
|
||||
hw_ops->gesture(core_data, 0);
|
||||
#endif
|
||||
msleep(16);
|
||||
hw_ops->irq_enable(core_data, true);
|
||||
enable_irq_wake(core_data->irq);
|
||||
core_data->gesture_enabled = true;
|
||||
break;
|
||||
case TS_MMI_PM_GESTURE_ZERO:
|
||||
gesture_cmd &= ~(1 << 5);
|
||||
ts_info("enable zero gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||
break;
|
||||
case TS_MMI_PM_GESTURE_SINGLE:
|
||||
gesture_cmd &= ~(1 << 4);
|
||||
ts_info("enable single gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||
break;
|
||||
case TS_MMI_PM_GESTURE_DOUBLE:
|
||||
gesture_cmd &= ~(1 << 15);
|
||||
ts_info("enable double gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||
break;
|
||||
case TS_MMI_PM_GESTURE_SWITCH:
|
||||
hw_ops->irq_enable(core_data, false);
|
||||
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
||||
if (core_data->imports && core_data->imports->get_gesture_type) {
|
||||
ret = core_data->imports->get_gesture_type(core_data->bus->dev, &gesture_type);
|
||||
}
|
||||
if (gesture_type & TS_MMI_GESTURE_ZERO) {
|
||||
gesture_cmd &= ~(1 << 5);
|
||||
ts_info("enable zero gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||
}
|
||||
if (gesture_type & TS_MMI_GESTURE_SINGLE) {
|
||||
gesture_cmd &= ~(1 << 4);
|
||||
ts_info("enable single gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||
}
|
||||
if (gesture_type & TS_MMI_GESTURE_DOUBLE) {
|
||||
gesture_cmd &= ~(1 << 15);
|
||||
ts_info("enable double gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||
}
|
||||
|
||||
ret = goodix_ts_send_cmd(core_data, ENTER_GESTURE_MODE_CMD, 6, 0xFF, 0xFF);
|
||||
if (ret < 0) {
|
||||
ts_err("Failed to send enter gesture mode\n");
|
||||
|
|
@ -961,8 +957,14 @@ static int goodix_ts_mmi_panel_state(struct device *dev,
|
|||
if (ret < 0) {
|
||||
ts_err("Failed to send enable gesture mode\n");
|
||||
}
|
||||
ts_info("Send enable gesture mode 0x%04x\n", gesture_cmd);
|
||||
gesture_cmd = 0xFFFF;
|
||||
ts_info("Send enable gesture mode 0x%04x, 0x%02x\n", gesture_cmd, gesture_type);
|
||||
#else
|
||||
#if defined(PRODUCT_MIAMI)
|
||||
hw_ops->gesture(core_data, 0x80);
|
||||
#else
|
||||
hw_ops->gesture(core_data, 0);
|
||||
#endif
|
||||
#endif
|
||||
msleep(16);
|
||||
hw_ops->irq_enable(core_data, true);
|
||||
enable_irq_wake(core_data->irq);
|
||||
|
|
|
|||
Loading…
Reference in a new issue