diff --git a/drivers/input/touchscreen/ili9882_mmi/Android.mk b/drivers/input/touchscreen/ili9882_mmi/Android.mk index ec6e0b7d6843..f269c01061c8 100644 --- a/drivers/input/touchscreen/ili9882_mmi/Android.mk +++ b/drivers/input/touchscreen/ili9882_mmi/Android.mk @@ -25,6 +25,12 @@ ifeq ($(ILITEK_GESTURE),true) KERNEL_CFLAGS += CONFIG_ILITEK_GESTURE=y endif +# enable gesture mode by panel config +# not all panels need enable gesture mode for some products +ifeq ($(ILITEK_PANEL_GESTURE),true) + KERNEL_CFLAGS += CONFIG_ILITEK_PANEL_GESTURE=y +endif + include $(CLEAR_VARS) LOCAL_MODULE := ili9882_mmi.ko LOCAL_MODULE_TAGS := optional diff --git a/drivers/input/touchscreen/ili9882_mmi/Kbuild b/drivers/input/touchscreen/ili9882_mmi/Kbuild index 1c7802521c05..ff2ed864fe94 100644 --- a/drivers/input/touchscreen/ili9882_mmi/Kbuild +++ b/drivers/input/touchscreen/ili9882_mmi/Kbuild @@ -27,6 +27,10 @@ ifneq ($(filter m y,$(CONFIG_ILITEK_GESTURE)),) EXTRA_CFLAGS += -DILI_CONFIG_GESTURE endif +ifneq ($(filter m y,$(CONFIG_ILITEK_PANEL_GESTURE)),) +EXTRA_CFLAGS += -DILI_CONFIG_PANEL_GESTURE +endif + ili9882_mmi-objs += ili9882.o ili9882_mmi-objs += ili9882_spi.o ili9882_mmi-objs += ili9882_qcom.o diff --git a/drivers/input/touchscreen/ili9882_mmi/ili9882.h b/drivers/input/touchscreen/ili9882_mmi/ili9882.h index f46a44428ee4..36e095943024 100755 --- a/drivers/input/touchscreen/ili9882_mmi/ili9882.h +++ b/drivers/input/touchscreen/ili9882_mmi/ili9882.h @@ -135,7 +135,7 @@ #define ENABLE_WQ_ESD DISABLE #endif #define ENABLE_WQ_BAT DISABLE -#ifdef ILI_CONFIG_GESTURE +#if defined(ILI_CONFIG_GESTURE) || defined(ILI_CONFIG_PANEL_GESTURE) #define ENABLE_GESTURE ENABLE #else #define ENABLE_GESTURE DISABLE @@ -864,6 +864,7 @@ struct ilitek_ts_data { bool wq_esd_ctrl; bool wq_bat_ctrl; + bool panel_gesture_enable; bool netlink; bool report; bool gesture; diff --git a/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c b/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c index c78642676504..c8960af95a52 100755 --- a/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c +++ b/drivers/input/touchscreen/ili9882_mmi/ili9882_qcom.c @@ -444,6 +444,20 @@ static int ilitek_plat_notifier_fb(struct notifier_block *self, unsigned long ev if (event == DRM_PANEL_EARLY_EVENT_BLANK) { #if ENABLE_GESTURE +#ifdef ILI_CONFIG_PANEL_GESTURE + if (ilits->panel_gesture_enable) { + if (ili_sleep_handler(TP_SUSPEND) < 0) + ILI_ERR("TP suspend failed!\n"); + else + ILI_INFO("TP suspend!\n"); + } else { + //enter deep sleep when panel not config gesture + if (ili_sleep_handler(TP_DEEP_SLEEP) < 0) + ILI_ERR("TP deep sleep in failed!\n"); + else + ILI_INFO("TP in deep sleep!\n"); + } +#else if (ilits->tp_module == MODEL_TM) { if (ili_sleep_handler(TP_DEEP_SLEEP) < 0) ILI_ERR("TP deep sleep in failed\n"); @@ -451,6 +465,7 @@ static int ilitek_plat_notifier_fb(struct notifier_block *self, unsigned long ev if (ili_sleep_handler(TP_SUSPEND) < 0) ILI_ERR("TP suspend failed\n"); } +#endif #else //enter deep sleep when not enable gesture if (ili_sleep_handler(TP_DEEP_SLEEP) < 0) @@ -461,7 +476,7 @@ static int ilitek_plat_notifier_fb(struct notifier_block *self, unsigned long ev } #endif -#ifdef ILI_CONFIG_GESTURE +#if defined(ILI_CONFIG_GESTURE) || defined(ILI_CONFIG_PANEL_GESTURE) touch_set_state(TOUCH_LOW_POWER_STATE, TOUCH_PANEL_IDX_PRIMARY); #endif } diff --git a/drivers/input/touchscreen/ili9882_mmi/ili9882_spi.c b/drivers/input/touchscreen/ili9882_mmi/ili9882_spi.c index 1f2641ec29b2..92bbe653bcf6 100755 --- a/drivers/input/touchscreen/ili9882_mmi/ili9882_spi.c +++ b/drivers/input/touchscreen/ili9882_mmi/ili9882_spi.c @@ -511,6 +511,36 @@ static int check_dt(struct device_node *np) pr_err("%s: %s not actived\n", __func__, node->name); return -ENODEV; } + +static int parse_dt(struct device_node *np) +{ + int32_t ret = 0; + +#ifdef ILI_CONFIG_PANEL_GESTURE + //parse gesture by panel config + if (active_panel_name) { + const char *panel_gesture; + int panel_num = of_property_count_strings(np, "ilitek,gesture_panel"); + if (panel_num > 0) { + int i; + ILI_INFO("%s: get ilitek,gesture_panel count=%d", __func__, panel_num); + for (i = 0; i < panel_num; i++) { + ret = of_property_read_string_index(np, "ilitek,gesture_panel", i, &panel_gesture); + if (ret < 0) { + ILI_INFO("%s: cannot parse gesture_panel, ret=%d\n", __func__, ret); + break; + } else if (panel_gesture && strstr(active_panel_name, panel_gesture)) { + ILI_INFO("%s: panel %s gesture enabled", __func__, panel_gesture); + ilits->panel_gesture_enable = true; + break; + } + } + } + } +#endif + + return ret; +} #endif static int ilitek_spi_probe(struct spi_device *spi) @@ -626,8 +656,15 @@ static int ilitek_spi_probe(struct spi_device *spi) ilits->info_from_hex = ENABLE; ilits->wait_int_timeout = AP_INT_TIMEOUT; + //---parse dts--- +#ifdef CONFIG_DRM + parse_dt(spi->dev.of_node); +#endif + #if ENABLE_GESTURE -#ifdef ILI_CONFIG_GESTURE +#ifdef ILI_CONFIG_PANEL_GESTURE + if (ilits->panel_gesture_enable) +#elif defined(ILI_CONFIG_GESTURE) if (MODEL_HLT == tp_module) #endif { @@ -651,6 +688,8 @@ static int ilitek_spi_probe(struct spi_device *spi) ilits->ges_sym.alphabet_two_line_2_bottom = ALPHABET_TWO_LINE_2_BOTTOM; ilits->ges_sym.alphabet_F = ALPHABET_F; ilits->ges_sym.alphabet_AT = ALPHABET_AT; + + ILI_INFO("ilitek: gesture eanble:%d\n", ilits->gesture); } #endif