mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
driver/TP: Support for touch stowed detection when gesture mode.
Fogo 5G NA Touch. Support for touch stowed detection when gesture mode. Change-Id: I890556c988c1a0d931fe72a411b761b0f6ee2864 Signed-off-by: lixuehan <hq126@motorola.com> Reviewed-on: https://gerrit.mot.com/2723590 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jun Weng <wengjun1@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
b7d8088544
commit
117db75a3c
9 changed files with 156 additions and 8 deletions
|
|
@ -25,6 +25,10 @@ ifeq ($(ILITEK_MULTI_TP_MODULE),true)
|
|||
KERNEL_CFLAGS += CONFIG_ILITEK_MULTI_TP_MODULE=y
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STOWED_MODE_EN),true)
|
||||
KERNEL_CFLAGS += CONFIG_STOWED_MODE_EN=y
|
||||
endif
|
||||
|
||||
ifneq ($(ILITEK_RESUME_BY_DDI),)
|
||||
KERNEL_CFLAGS += CONFIG_ILITEK_RESUME_BY_DDI=y
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ endif
|
|||
ifeq ($(TARGET_BUILD_VARIANT),user)
|
||||
EXTRA_CFLAGS += -DGKI_EN_FLAG
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y, $(CONFIG_STOWED_MODE_EN)),)
|
||||
EXTRA_CFLAGS += -DILI_STOWED_MODE_EN
|
||||
endif
|
||||
ilitek_v3_mmi-objs += ilitek_v3.o
|
||||
ilitek_v3_mmi-objs += ilitek_v3_spi.o
|
||||
ilitek_v3_mmi-objs += ilitek_v3_qcom.o
|
||||
|
|
|
|||
|
|
@ -687,6 +687,12 @@ int ili_sleep_handler(int mode)
|
|||
if (ili_ic_func_ctrl("sleep", SLEEP_IN) < 0)
|
||||
ILI_ERR("Write sleep in cmd failed\n");
|
||||
}
|
||||
#endif
|
||||
#if defined (ILI_STOWED_MODE_EN) && defined (ILI_SENSOR_EN)
|
||||
if (ilits->should_enable_gesture && ilits->stowed && ilits->tp_suspend) {
|
||||
ili_proximity_near(DDI_POWER_ON);
|
||||
ILI_INFO("Enable stowed mode suspend\n");
|
||||
}
|
||||
#endif
|
||||
ILI_INFO("TP suspend end\n");
|
||||
break;
|
||||
|
|
@ -749,16 +755,22 @@ int ili_sleep_handler(int mode)
|
|||
}
|
||||
|
||||
#ifdef ILI_SENSOR_EN
|
||||
if (ilits->wakeable) {
|
||||
disable_irq_wake(ilits->irq_num);
|
||||
ilits->gesture_enabled = false;
|
||||
ilits->wakeable = false;
|
||||
}
|
||||
if (ilits->wakeable) {
|
||||
disable_irq_wake(ilits->irq_num);
|
||||
ilits->gesture_enabled = false;
|
||||
ilits->wakeable = false;
|
||||
}
|
||||
#else
|
||||
if (ilits->gesture)
|
||||
disable_irq_wake(ilits->irq_num);
|
||||
if (ilits->gesture)
|
||||
disable_irq_wake(ilits->irq_num);
|
||||
#endif
|
||||
#if defined (ILI_STOWED_MODE_EN) && defined (ILI_SENSOR_EN)
|
||||
if (ilits->stowed) {
|
||||
ilits->stowed = 0;
|
||||
ilits->prox_near = false;
|
||||
ILI_ERR("ilits->stowed = %d,ilits->prox_near = %d\n", ilits->stowed,ilits->prox_near);
|
||||
}
|
||||
#endif
|
||||
|
||||
ILI_INFO("TP resume end\n");
|
||||
#else
|
||||
ili_resume_by_ddi();
|
||||
|
|
|
|||
|
|
@ -1338,6 +1338,7 @@ struct ilitek_ts_data {
|
|||
atomic_t cmd_int_check;
|
||||
atomic_t esd_stat;
|
||||
|
||||
int stowed;
|
||||
#ifdef ILI_SENSOR_EN
|
||||
bool wakeable;
|
||||
bool should_enable_gesture;
|
||||
|
|
|
|||
|
|
@ -4067,6 +4067,54 @@ static ssize_t gesture_store(struct device *dev,
|
|||
return err;
|
||||
}
|
||||
|
||||
#if defined (ILI_STOWED_MODE_EN) && defined (ILI_SENSOR_EN)
|
||||
static ssize_t stowed_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ILI_INFO("Stowed state = %d.\n", ilits->stowed);
|
||||
return scnprintf(buf, PAGE_SIZE, "0x%02x", ilits->stowed);
|
||||
}
|
||||
|
||||
static ssize_t stowed_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long mode = 0;
|
||||
|
||||
ret = kstrtoul(buf, 0, &mode);
|
||||
if (ret < 0) {
|
||||
ILI_INFO("Failed to convert value.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ilits->stowed == mode) {
|
||||
ILI_INFO("The value = %lu is same, so not to write", mode);
|
||||
ret = size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
mutex_lock(&ilits->touch_mutex);
|
||||
if (ilits->tp_suspend && ilits->should_enable_gesture) {
|
||||
if (mode) {
|
||||
ili_proximity_near(DDI_POWER_ON);
|
||||
} else {
|
||||
ili_proximity_far(WAKE_UP_SWITCH_GESTURE_MODE);
|
||||
}
|
||||
} else {
|
||||
ILI_INFO("Skip stowed mode setting suspended:%d,ilits->should_enable_gesture:%d", ilits->tp_suspend,ilits->should_enable_gesture);
|
||||
ret = size;
|
||||
mutex_unlock(&ilits->touch_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ilits->stowed = mode;
|
||||
ret = size;
|
||||
ILI_INFO("Success to set stowed mode %lu\n", mode);
|
||||
mutex_unlock(&ilits->touch_mutex);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gesture type debug value used for nvt driver to check current gesture mode
|
||||
*/
|
||||
|
|
@ -4137,6 +4185,9 @@ static struct device_attribute touchscreen_attributes[] = {
|
|||
#ifdef ILI_DOUBLE_TAP_CTRL
|
||||
__ATTR(gesture, S_IRUGO | S_IWUSR | S_IWGRP, gesture_show, gesture_store),
|
||||
__ATTR(gesture_type_dbg, S_IRUGO | S_IWUSR | S_IWGRP, gesture_type_dbg_show, gesture_type_dbg_store),
|
||||
#endif
|
||||
#if defined (ILI_STOWED_MODE_EN) && defined (ILI_SENSOR_EN)
|
||||
__ATTR(stowed, S_IRUGO | S_IWUSR | S_IWGRP, stowed_show, stowed_store),
|
||||
#endif
|
||||
__ATTR_NULL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ ifeq ($(CONFIG_INPUT_HIGH_RESOLUTION_4),true)
|
|||
KERNEL_CFLAGS += CONFIG_INPUT_HIGH_RESOLUTION_4=y
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STOWED_MODE_EN),true)
|
||||
KERNEL_CFLAGS += CONFIG_STOWED_MODE_EN=y
|
||||
endif
|
||||
|
||||
ifneq ($(MOTO_PANEL_CHECK_TOUCH_STATE),)
|
||||
KBUILD_OPTIONS += CONFIG_INPUT_NOVA_0FLASH_MMI_NOTIFY_TOUCH_STATE=y
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ ifneq ($(filter m y, $(CONFIG_INPUT_HIGH_RESOLUTION_4)),)
|
|||
EXTRA_CFLAGS += -DCONFIG_INPUT_HIGH_RESOLUTION_4
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y, $(CONFIG_STOWED_MODE_EN)),)
|
||||
EXTRA_CFLAGS += -DNOVA_STOWED_MODE_EN
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_INPUT_NOVA_PANEL_NOTIFICATIONS)),)
|
||||
EXTRA_CFLAGS += -DNVT_CONFIG_PANEL_NOTIFICATIONS
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -2765,6 +2765,54 @@ static ssize_t gesture_store(struct device *dev,
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(NVT_SENSOR_EN) && defined(NOVA_STOWED_MODE_EN)
|
||||
static ssize_t stowed_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long mode = 0;
|
||||
|
||||
ret = kstrtoul(buf, 0, &mode);
|
||||
if (ret < 0) {
|
||||
NVT_LOG("Failed to convert value.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ts->stowed == mode) {
|
||||
NVT_LOG("The value = %lu is same, so not to write", mode);
|
||||
ret = size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
mutex_lock(&ts->lock);
|
||||
if (!ts->bTouchIsAwake && ts->should_enable_gesture) {
|
||||
if (mode) {
|
||||
nvt_cmd_ext_store(NVT_STOWED_MODE_CMD, NVT_STOWED_MODE_EN);
|
||||
} else {
|
||||
nvt_cmd_ext_store(NVT_STOWED_MODE_CMD, NVT_STOWED_MODE_DIS);
|
||||
}
|
||||
} else {
|
||||
NVT_LOG("Skip stowed mode setting suspended:%d,should_enable_gesture:%d", ts->bTouchIsAwake,ts->should_enable_gesture);
|
||||
ret = size;
|
||||
mutex_unlock(&ts->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ts->stowed = mode;
|
||||
ret = size;
|
||||
NVT_LOG("Success to set stowed mode %lu\n", mode);
|
||||
mutex_unlock(&ts->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t stowed_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
NVT_LOG("Stowed state = %d.\n", ts->stowed);
|
||||
return scnprintf(buf, PAGE_SIZE, "0x%02x", ts->stowed);
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct device_attribute touchscreen_attributes[] = {
|
||||
__ATTR_RO(path),
|
||||
__ATTR_RO(vendor),
|
||||
|
|
@ -2775,6 +2823,9 @@ static struct device_attribute touchscreen_attributes[] = {
|
|||
#ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL
|
||||
__ATTR_RW(gesture),
|
||||
#endif
|
||||
#if defined(NVT_SENSOR_EN) && defined(NOVA_STOWED_MODE_EN)
|
||||
__ATTR_RW(stowed),
|
||||
#endif
|
||||
|
||||
#ifdef PALM_GESTURE
|
||||
__ATTR(palm_settings, S_IRUGO | S_IWUSR | S_IWGRP, nvt_palm_settings_show, nvt_palm_settings_store),
|
||||
|
|
@ -3844,6 +3895,14 @@ int32_t nvt_ts_suspend(struct device *dev)
|
|||
CTP_SPI_WRITE(ts->client, buf, 2);
|
||||
#endif // WAKEUP_GESTURE
|
||||
|
||||
|
||||
#if defined(NVT_SENSOR_EN) && defined(NOVA_STOWED_MODE_EN)
|
||||
if (ts->should_enable_gesture && ts->stowed && (!ts->bTouchIsAwake)) {
|
||||
nvt_cmd_ext_store(NVT_STOWED_MODE_CMD, NVT_STOWED_MODE_EN);
|
||||
NVT_LOG("Enable stowed mode suspend\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
mutex_unlock(&ts->lock);
|
||||
|
||||
release_all_touches();
|
||||
|
|
@ -3945,6 +4004,11 @@ int32_t nvt_ts_resume(struct device *dev)
|
|||
nvt_cmd_write(ts->rotate_cmd, 0, 0, 1);
|
||||
}
|
||||
#endif
|
||||
#if defined(NVT_SENSOR_EN) && defined(NOVA_STOWED_MODE_EN)
|
||||
if (ts->stowed) {
|
||||
ts->stowed = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
NVT_LOG("end\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ extern const uint16_t touch_key_array[TOUCH_KEY_NUM];
|
|||
#define VERTICAL 1
|
||||
#define LEFT_UP 2
|
||||
#define RIGHT_UP 3
|
||||
#define NVT_STOWED_MODE_CMD 0x7C
|
||||
#define NVT_STOWED_MODE_EN 0x01
|
||||
#define NVT_STOWED_MODE_DIS 0x00
|
||||
|
||||
/* Enable only when module have tp reset pin and connected to host */
|
||||
#define NVT_TOUCH_SUPPORT_HW_RST 0
|
||||
|
|
@ -300,6 +303,7 @@ struct nvt_ts_data {
|
|||
uint8_t edge_cmd[3]; /* /< edge switching command */
|
||||
uint8_t rotate_cmd; /* /< rotate switching command */
|
||||
bool edge_ctrl; /* /< edge rate switching */
|
||||
int stowed;
|
||||
};
|
||||
|
||||
#if NVT_TOUCH_PROC
|
||||
|
|
|
|||
Loading…
Reference in a new issue