goodix_blr_mmi: wakeup gesture gt9966
This change formilizes gesture mode setup for GT9916 and GT9966
Goodix touch ICs. There are 2 major differnces between these two:
1) gesture mode command length
2) gesture enable mask
Command length is 6 bytes for GT9916 and 8 bytes for GT9966.
Gesture enable mask:
9916 -> 0 is enabled and 1 disabled
9966 -> 1 is enabled and 0 disabled
double tap single tap
| |
|V--------------|------V--------|
| | | | | | | | | | | | | | | | |
|---------------|---------------|
Byte 5 Byte 6
Change-Id: I76f9735addc45ed2b94a50569a3929b1b73084d0
Signed-off-by: Konstantin Makariev <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/2549731
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: <zhuwg1@motorola.com>
Reviewed-by: Wei Deng <dengwei1@motorola.com>
Reviewed-by: Qing Chang <qing@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
1 parent
f68d0640c1
commit
e2435909dc
5 files changed
+107
-73
No files matched your search
@@ -253,17 +253,22 @@ int brl_resume(struct goodix_ts_core *cd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GOODIX_GESTURE_CMD 0xA6
|
#define GOODIX_GESTURE_CMD 0xA6
|
||||||
int brl_gesture(struct goodix_ts_core *cd, int gesture_type)
|
int brl_gesture(struct goodix_ts_core *cd, unsigned int gesture_type)
|
||||||
{
|
{
|
||||||
struct goodix_ts_cmd cmd;
|
struct goodix_ts_cmd cmd;
|
||||||
|
|
||||||
cmd.cmd = GOODIX_GESTURE_CMD;
|
cmd.cmd = GOODIX_GESTURE_CMD;
|
||||||
#ifdef CONFIG_GTP_FOD
|
cmd.data[0] = gesture_type & 0xFF;
|
||||||
cmd.len = 6;
|
if (cd->bus->ic_type == IC_TYPE_BERLIN_D) {
|
||||||
#else
|
cmd.len = 6;
|
||||||
cmd.len = 5;
|
cmd.data[1] = (gesture_type >> 8) & 0xFF;
|
||||||
#endif
|
} else if (cd->bus->ic_type == IC_TYPE_BERLIN_B) {
|
||||||
cmd.data[0] = gesture_type;
|
cmd.len = 8;
|
||||||
|
cmd.data[2] = (gesture_type >> 16) & 0xFF;
|
||||||
|
cmd.data[3] = (gesture_type >> 24) & 0xFF;
|
||||||
|
} else
|
||||||
|
cmd.len = 5;
|
||||||
|
|
||||||
if (cd->hw_ops->send_cmd(cd, &cmd))
|
if (cd->hw_ops->send_cmd(cd, &cmd))
|
||||||
ts_err("failed send gesture cmd");
|
ts_err("failed send gesture cmd");
|
||||||
|
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ struct goodix_ts_hw_ops {
|
|||||||
int (*dev_confirm)(struct goodix_ts_core *cd);
|
int (*dev_confirm)(struct goodix_ts_core *cd);
|
||||||
int (*resume)(struct goodix_ts_core *cd);
|
int (*resume)(struct goodix_ts_core *cd);
|
||||||
int (*suspend)(struct goodix_ts_core *cd);
|
int (*suspend)(struct goodix_ts_core *cd);
|
||||||
int (*gesture)(struct goodix_ts_core *cd, int gesture_type);
|
int (*gesture)(struct goodix_ts_core *cd, unsigned int gesture_type);
|
||||||
int (*reset)(struct goodix_ts_core *cd, int delay_ms);
|
int (*reset)(struct goodix_ts_core *cd, int delay_ms);
|
||||||
int (*irq_enable)(struct goodix_ts_core *cd, bool enable);
|
int (*irq_enable)(struct goodix_ts_core *cd, bool enable);
|
||||||
int (*read)(struct goodix_ts_core *cd, unsigned int addr,
|
int (*read)(struct goodix_ts_core *cd, unsigned int addr,
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
|
|||||||
#ifdef GOODIX_PALM_SENSOR_EN
|
#ifdef GOODIX_PALM_SENSOR_EN
|
||||||
int palm_flag = 0;
|
int palm_flag = 0;
|
||||||
#endif
|
#endif
|
||||||
|
unsigned int gesture_cmd = 0;
|
||||||
|
|
||||||
if (atomic_read(&cd->suspended) == 0)
|
if (atomic_read(&cd->suspended) == 0)
|
||||||
return EVT_CONTINUE;
|
return EVT_CONTINUE;
|
||||||
@@ -310,12 +311,12 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
re_send_ges_cmd:
|
re_send_ges_cmd:
|
||||||
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
#if defined(PRODUCT_MIAMI)
|
||||||
if (goodix_ts_send_cmd(cd, ENTER_GESTURE_MODE_CMD, 6, (cd->gesture_cmd) >> 8,
|
gesture_cmd = 0x80;
|
||||||
cd->gesture_cmd & 0xFF) < 0)
|
#elif defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
||||||
#else
|
gesture_cmd = cd->gesture_cmd;
|
||||||
if (hw_ops->gesture(cd, 0))
|
|
||||||
#endif
|
#endif
|
||||||
|
if (hw_ops->gesture(cd, gesture_cmd))
|
||||||
ts_info("warning: failed re_send gesture cmd");
|
ts_info("warning: failed re_send gesture cmd");
|
||||||
gesture_ist_exit:
|
gesture_ist_exit:
|
||||||
if (!cd->tools_ctrl_sync)
|
if (!cd->tools_ctrl_sync)
|
||||||
|
|||||||
@@ -367,6 +367,7 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
|
|||||||
struct goodix_ts_event gs_event = {0};
|
struct goodix_ts_event gs_event = {0};
|
||||||
__maybe_unused int fodx, fody, overlay_area;
|
__maybe_unused int fodx, fody, overlay_area;
|
||||||
int ret;
|
int ret;
|
||||||
|
unsigned int gesture_cmd = 0;
|
||||||
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
|
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
|
||||||
struct gesture_event_data mmi_event;
|
struct gesture_event_data mmi_event;
|
||||||
static unsigned long start = 0;
|
static unsigned long start = 0;
|
||||||
@@ -536,13 +537,11 @@ static int gsx_gesture_ist(struct goodix_ts_core *cd,
|
|||||||
|
|
||||||
re_send_ges_cmd:
|
re_send_ges_cmd:
|
||||||
#if defined(PRODUCT_MIAMI)
|
#if defined(PRODUCT_MIAMI)
|
||||||
if (hw_ops->gesture(cd, 0x80))
|
gesture_cmd = 0x80;
|
||||||
#elif defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
#elif defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
||||||
if (goodix_ts_send_cmd(cd, ENTER_GESTURE_MODE_CMD, 6, (cd->gesture_cmd) >> 8,
|
gesture_cmd = cd->gesture_cmd;
|
||||||
cd->gesture_cmd & 0xFF) < 0)
|
|
||||||
#else
|
|
||||||
if (hw_ops->gesture(cd, 0))
|
|
||||||
#endif
|
#endif
|
||||||
|
if (hw_ops->gesture(cd, gesture_cmd))
|
||||||
ts_info("warning: failed re_send gesture cmd");
|
ts_info("warning: failed re_send gesture cmd");
|
||||||
gesture_ist_exit:
|
gesture_ist_exit:
|
||||||
if (!cd->tools_ctrl_sync)
|
if (!cd->tools_ctrl_sync)
|
||||||
|
|||||||
@@ -959,17 +959,90 @@ static int goodix_ts_mmi_charger_mode(struct device *dev, int mode)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
||||||
|
static unsigned int set_bit_in_pos(unsigned int val, int bit_pos)
|
||||||
|
{
|
||||||
|
return val |= (1 << bit_pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int clear_bit_in_pos(unsigned int val, int bit_pos)
|
||||||
|
{
|
||||||
|
return val &= ~(1 << bit_pos);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int goodix_berlin_gesture_setup(struct goodix_ts_core *core_data)
|
||||||
|
{
|
||||||
|
const struct goodix_ts_hw_ops *hw_ops = core_data->hw_ops;
|
||||||
|
unsigned int gesture_cmd = 0;
|
||||||
|
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
||||||
|
int ret = 0;
|
||||||
|
unsigned char gesture_type = 0;
|
||||||
|
unsigned int (*mod_func)(unsigned int, int) = set_bit_in_pos;
|
||||||
|
|
||||||
|
/* Goodix provided definitive description of gesture mode setting
|
||||||
|
for 9916 and 9966 touch ICs. It's safer to fail for any others
|
||||||
|
until it's confirmed!!!
|
||||||
|
*/
|
||||||
|
if (core_data->bus->ic_type != IC_TYPE_BERLIN_B &&
|
||||||
|
core_data->bus->ic_type != IC_TYPE_BERLIN_D) {
|
||||||
|
ts_err("GT%s gestures not set\n", core_data->fw_version.patch_pid);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (core_data->imports && core_data->imports->get_gesture_type) {
|
||||||
|
ret = core_data->imports->get_gesture_type(core_data->bus->dev, &gesture_type);
|
||||||
|
ts_info("Provisioned gestures 0x%02x; rc = %d\n", gesture_type, ret);
|
||||||
|
}
|
||||||
|
if (core_data->bus->ic_type == IC_TYPE_BERLIN_D) {
|
||||||
|
gesture_cmd = 0xFFFF;
|
||||||
|
mod_func = clear_bit_in_pos;
|
||||||
|
}
|
||||||
|
if (gesture_type & TS_MMI_GESTURE_ZERO) {
|
||||||
|
gesture_cmd = mod_func(gesture_cmd, 5);
|
||||||
|
ts_info("enable zero gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||||
|
}
|
||||||
|
if (gesture_type & TS_MMI_GESTURE_SINGLE) {
|
||||||
|
gesture_cmd = mod_func(gesture_cmd, 12);
|
||||||
|
ts_info("enable single gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||||
|
}
|
||||||
|
if (gesture_type & TS_MMI_GESTURE_DOUBLE) {
|
||||||
|
gesture_cmd = mod_func(gesture_cmd, 7);
|
||||||
|
ts_info("enable double gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||||
|
}
|
||||||
|
#ifdef GOODIX_PALM_SENSOR_EN
|
||||||
|
if (gesture_type & TS_MMI_GESTURE_PALM) {
|
||||||
|
/* override previous setting */
|
||||||
|
gesture_cmd = 0xFFFF;
|
||||||
|
ts_info("enable palm gesture mode cmd 0x%04x\n", gesture_cmd);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
core_data->gesture_cmd = gesture_cmd;
|
||||||
|
if (core_data->bus->ic_type == IC_TYPE_BERLIN_D) {
|
||||||
|
/* TODO Is this really necessary??? */
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#if defined(PRODUCT_MIAMI)
|
||||||
|
/* TODO Check if Miami 9916??? */
|
||||||
|
gesture_cmd = 0x80;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
hw_ops->gesture(core_data, gesture_cmd);
|
||||||
|
ts_info("Send enable gesture mode 0x%x\n", gesture_cmd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int goodix_ts_mmi_panel_state(struct device *dev,
|
static int goodix_ts_mmi_panel_state(struct device *dev,
|
||||||
enum ts_mmi_pm_mode from, enum ts_mmi_pm_mode to)
|
enum ts_mmi_pm_mode from, enum ts_mmi_pm_mode to)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct goodix_ts_core *core_data;
|
struct goodix_ts_core *core_data;
|
||||||
const struct goodix_ts_hw_ops *hw_ops;
|
const struct goodix_ts_hw_ops *hw_ops;
|
||||||
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
|
||||||
int ret = 0;
|
|
||||||
unsigned short gesture_cmd = 0xFFFF;
|
|
||||||
unsigned char gesture_type = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GET_GOODIX_DATA(dev);
|
GET_GOODIX_DATA(dev);
|
||||||
hw_ops = core_data->hw_ops;
|
hw_ops = core_data->hw_ops;
|
||||||
@@ -977,57 +1050,13 @@ static int goodix_ts_mmi_panel_state(struct device *dev,
|
|||||||
switch (to) {
|
switch (to) {
|
||||||
case TS_MMI_PM_GESTURE:
|
case TS_MMI_PM_GESTURE:
|
||||||
hw_ops->irq_enable(core_data, false);
|
hw_ops->irq_enable(core_data, false);
|
||||||
if (hw_ops->gesture)
|
if (hw_ops->gesture) {
|
||||||
#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
|
goodix_berlin_gesture_setup(core_data);
|
||||||
if (core_data->imports && core_data->imports->get_gesture_type) {
|
msleep(16);
|
||||||
ret = core_data->imports->get_gesture_type(core_data->bus->dev, &gesture_type);
|
hw_ops->irq_enable(core_data, true);
|
||||||
|
enable_irq_wake(core_data->irq);
|
||||||
|
core_data->gesture_enabled = true;
|
||||||
}
|
}
|
||||||
#ifdef GOODIX_PALM_SENSOR_EN
|
|
||||||
if (gesture_type & TS_MMI_GESTURE_PALM) {
|
|
||||||
//override previous setting
|
|
||||||
gesture_cmd = 0xFFFF;
|
|
||||||
ts_info("enable palm gesture mode cmd 0x%04x\n", gesture_cmd);
|
|
||||||
goto palm_detection;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GOODIX_PALM_SENSOR_EN
|
|
||||||
palm_detection:
|
|
||||||
#endif
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
ret = goodix_ts_send_cmd(core_data, ENTER_GESTURE_MODE_CMD, 6, gesture_cmd >> 8,
|
|
||||||
gesture_cmd & 0xFF);
|
|
||||||
if (ret < 0) {
|
|
||||||
ts_err("Failed to send enable gesture mode\n");
|
|
||||||
}
|
|
||||||
core_data->gesture_cmd = gesture_cmd;
|
|
||||||
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);
|
|
||||||
core_data->gesture_enabled = true;
|
|
||||||
break;
|
break;
|
||||||
case TS_MMI_PM_DEEPSLEEP:
|
case TS_MMI_PM_DEEPSLEEP:
|
||||||
/* enter sleep mode or power off */
|
/* enter sleep mode or power off */
|
||||||
|
|||||||
Reference in new issue
Block a user