fogor: touch: add 2nd ili9883c tp demands

1. add single tap to wakeup.
2. add double tap to wakeup.
3. add timestamp.
4. add charge state check.

Change-Id: I2fa738930851dbdd9e582660f7ec4146ea8ac659
Signed-off-by: ontim52 <ontim52@motorola.com>
Reviewed-on: https://gerrit.mot.com/2671970
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jun Weng <wengjun1@motorola.com>
Reviewed-by: Hujun Liao <liaohj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
ontim52 2023-07-11 15:55:03 +08:00 • committed by ontim51
commit f204d240db
6 changed files with 47 additions and 24 deletions

View file

@ -9,7 +9,7 @@ ifeq ($(BOARD_USES_DOUBLE_TAP_CTRL),true)
KERNEL_CFLAGS += CONFIG_BOARD_USES_DOUBLE_TAP_CTRL=y
endif
ifneq ($(CONFIG_INPUT_SET_TOUCH_STATE),)
ifneq ($(MOTO_PANEL_CHECK_TOUCH_STATE),)
KERNEL_CFLAGS += CONFIG_INPUT_ILI_SET_TOUCH_STATE=y
endif

View file

@ -73,7 +73,7 @@ static int ilitek_charger_notifier_callback(struct notifier_block *nb, unsigned
}
}
if (!ret) {
if((prop.intval == USB_DETECT_IN) || (prop.intval == USB_DETECT_OUT)) {
if((prop.intval == USB_DETECT_IN) || (prop.intval == USB_DETECT_OUT) || (prop.intval == USB_DETECT_OUT_QCOM)) {
if(ilits->usb_plug_status != prop.intval) {
ILI_INFO("usb prop.intval =%d\n", prop.intval);
ilits->usb_plug_status = prop.intval;
@ -800,7 +800,7 @@ int ili_fw_upgrade_handler(void *data)
ILI_INFO("charge status is %d\n", ilits->usb_plug_status);
if (ilits->usb_plug_status == USB_DETECT_IN) {
ret = ili_ic_func_ctrl("plug", 0);/* plug in */
} else if (ilits->usb_plug_status == USB_DETECT_OUT) {
} else if ((ilits->usb_plug_status == USB_DETECT_OUT) || (ilits->usb_plug_status == USB_DETECT_OUT_QCOM)) {
ret = ili_ic_func_ctrl("plug", 1);/* plug out */
}
if (ret < 0) {

View file

@ -167,7 +167,10 @@
#define USB_DETECT_IN 1
#define USB_DETECT_OUT 2
#else
#define CHARGER_NOTIFIER_CALLBACK DISABLE
#define USB_DETECT_IN 1
#define USB_DETECT_OUT 2
#define USB_DETECT_OUT_QCOM 0
#define CHARGER_NOTIFIER_CALLBACK ENABLE
#endif
#define ENABLE_EDGE_PALM_PARA DISABLE
#define MULTI_REPORT_RATE DISABLE
@ -1343,6 +1346,7 @@ struct ilitek_ts_data {
#ifdef ILI_DOUBLE_TAP_CTRL
uint8_t supported_gesture_type;
uint8_t sys_gesture_type;
uint8_t rst_pull_flag;
#endif
struct mutex state_mutex;
struct ili_sensor_platform_data *sensor_pdata;

View file

@ -624,9 +624,30 @@ static int drm_notifier_callback(struct notifier_block *self, unsigned long even
break;
case DRM_PANEL_BLANK_POWERDOWN:
if (DRM_PANEL_EARLY_EVENT_BLANK == event) {
ILI_INFO("suspend: event = %lu, TP_SUSPEND\n", event);
#ifdef ILI_DOUBLE_TAP_CTRL
if (ilits->should_enable_gesture) {
ILI_INFO("TP suspend: tap gesture suspend\n");
if (ili_sleep_handler(TP_SUSPEND) < 0)
ILI_ERR("TP suspend failed\n");
#ifdef ILI_SET_TOUCH_STATE
touch_set_state(TOUCH_LOW_POWER_STATE, TOUCH_PANEL_IDX_PRIMARY);
#endif
}
else {
ILI_INFO("TP suspend: TP_DEEP_SLEEP event = %lu\n", event);
if (ili_sleep_handler(TP_DEEP_SLEEP) < 0)
ILI_ERR("TP suspend deep sleep fail\n");
#ifdef ILI_SET_TOUCH_STATE
touch_set_state(TOUCH_DEEP_SLEEP_STATE, TOUCH_PANEL_IDX_PRIMARY);
#endif
if (ilits->rst_pull_flag && gpio_get_value(ilits->tp_rst))
gpio_set_value(ilits->tp_rst, 0);
}
#else //ILI_DOUBLE_TAP_CTRL
ILI_INFO("TP suspend: event = %lu, TP_DEEP_SLEEP\n", event);
if (ili_sleep_handler(TP_DEEP_SLEEP) < 0)
ILI_ERR("TP suspend failed\n");
ILI_ERR("TP suspend deep sleep failed\n");
#endif //ILI_DOUBLE_TAP_CTRL
} else if (DRM_PANEL_EVENT_BLANK == event) {
ILI_INFO("suspend: event = %lu, not care\n", event);
}
@ -768,9 +789,9 @@ static int ili_sensor_init(struct ilitek_ts_data *data)
if (data->report_gesture_key) {
__set_bit(EV_KEY, sensor_input_dev->evbit);
__set_bit(KEY_F1, sensor_input_dev->keybit);
__set_bit(BTN_TRIGGER_HAPPY3, sensor_input_dev->keybit);
#ifdef ILI_DOUBLE_TAP_CTRL
__set_bit(KEY_F4, sensor_input_dev->keybit);
__set_bit(BTN_TRIGGER_HAPPY6, sensor_input_dev->keybit);
#endif
} else {
__set_bit(EV_ABS, sensor_input_dev->evbit);

View file

@ -639,6 +639,13 @@ static int parse_dt(struct device_node *np)
}
else
ILI_INFO("warn: supported_gesture_type not set\n");
if (of_property_read_bool(np, "ilitek,rst-pull-flag")) {
ILI_INFO("ilitek,rst pull flag set");
ilits->rst_pull_flag = 1;
} else {
ilits->rst_pull_flag = 0;
}
#endif //ILI_DOUBLE_TAP_CTRL
#ifdef ILI_SENSOR_EN

View file

@ -1223,9 +1223,6 @@ void ili_touch_release_all_point(void)
}
static struct ilitek_touch_info touch_info[MAX_TOUCH_NUM + MAX_PEN_NUM];
#ifdef ILI_TOUCH_LAST_TIME
static bool time_flag = 1;
#endif
void ili_report_ap_mode(u8 *buf, int len)
{
@ -1304,13 +1301,6 @@ void ili_report_ap_mode(u8 *buf, int len)
ILI_DBG("figner number = %d, LastTouch = %d\n", ilits->finger, ilits->last_touch);
if (ilits->finger) {
#ifdef ILI_TOUCH_LAST_TIME
if (time_flag) {
ilits->last_event_time = ktime_get_boottime();
time_flag = 0;
ILI_DBG("set last_event_time\n");
}
#endif
if (MT_B_TYPE) {
for (i = 0; i < ilits->finger; i++) {
input_report_key(ilits->input, BTN_TOUCH, 1);
@ -1330,10 +1320,6 @@ void ili_report_ap_mode(u8 *buf, int len)
ilits->last_touch = ilits->finger;
} else {
if (ilits->last_touch) {
#ifdef ILI_TOUCH_LAST_TIME
time_flag = 1;
ILI_DBG("last touch, reset time_flag\n");
#endif
if (MT_B_TYPE) {
for (i = 0; i < MAX_TOUCH_NUM; i++) {
if (ilits->curt_touch[i] == 0 && ilits->prev_touch[i] == 1)
@ -1347,6 +1333,11 @@ void ili_report_ap_mode(u8 *buf, int len)
}
input_sync(ilits->input);
ilits->last_touch = 0;
#ifdef ILI_TOUCH_LAST_TIME
//save last timestamp after last touch reported to avoid impacting multi and swipe touch
ilits->last_event_time = ktime_get_boottime();
ILI_DBG("last touch, save last_event_time\n");
#endif
}
}
ilitek_tddi_touch_customer_data_parsing(buf);
@ -2111,10 +2102,10 @@ void ili_report_gesture_mode(u8 *buf, int len)
return;
}
if (ilits->report_gesture_key) {
int key_code = KEY_F1;
int key_code = BTN_TRIGGER_HAPPY3;
#ifdef ILI_DOUBLE_TAP_CTRL
if (GESTURE_DOUBLECLICK == gc->code) {
key_code = KEY_F4;
key_code = BTN_TRIGGER_HAPPY6;
}
#endif
input_report_key(ilits->sensor_pdata->input_sensor_dev, key_code, 1);