From f2192684df4cf3f56e0549330db2b838708ed0ed Mon Sep 17 00:00:00 2001 From: Wenge Zhu Date: Mon, 26 Sep 2022 11:34:26 +0800 Subject: [PATCH] Add a macro to control if cli_gesture created Add a macro to control if cli_gesture created,only if CLI touch supports double tap gesture,this node should be created to receive gesture type notifications. Change-Id: I2a877b4257c758c1129c1bb3353cfbe59f2a452d Signed-off-by: Wenge Zhu Reviewed-on: https://gerrit.mot.com/2391205 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Shicheng Gong Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- drivers/input/touchscreen/touchscreen_mmi/Android.mk | 4 ++++ drivers/input/touchscreen/touchscreen_mmi/Kbuild | 3 +++ .../input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c | 4 ++++ .../touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c | 3 ++- .../input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c | 3 ++- .../input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c | 2 ++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/touchscreen_mmi/Android.mk b/drivers/input/touchscreen/touchscreen_mmi/Android.mk index fe10a4d5ae97..7d3b518992c5 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/Android.mk +++ b/drivers/input/touchscreen/touchscreen_mmi/Android.mk @@ -37,6 +37,10 @@ ifeq ($(BOARD_USES_DOUBLE_TAP_CTRL),true) KBUILD_OPTIONS += CONFIG_BOARD_USES_DOUBLE_TAP_CTRL=y endif +ifeq ($(BOARD_USES_CLI_DOUBLE_TAP_CTRL),true) + KBUILD_OPTIONS += CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL=y +endif + include $(CLEAR_VARS) LOCAL_MODULE := touchscreen_mmi.ko LOCAL_MODULE_TAGS := optional diff --git a/drivers/input/touchscreen/touchscreen_mmi/Kbuild b/drivers/input/touchscreen/touchscreen_mmi/Kbuild index f937be291cf6..fb6d36612901 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/Kbuild +++ b/drivers/input/touchscreen/touchscreen_mmi/Kbuild @@ -32,6 +32,9 @@ endif ifneq ($(filter m y, $(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)),) EXTRA_CFLAGS += -DCONFIG_BOARD_USES_DOUBLE_TAP_CTRL endif +ifneq ($(filter m y, $(CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL)),) + EXTRA_CFLAGS += -DCONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL +endif obj-m := touchscreen_mmi.o touchscreen_mmi-objs := touchscreen_mmi_class.o touchscreen_mmi_panel.o touchscreen_mmi_notif.o touchscreen_mmi_gesture.o diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c index 5460576db453..ed61f4a04cdc 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_class.c @@ -386,7 +386,9 @@ static ssize_t gesture_store(struct device *dev, return size; } static DEVICE_ATTR(gesture, (S_IWUSR | S_IWGRP | S_IRUGO), gesture_show, gesture_store); +#endif +#ifdef CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL /* * cli_gesture value used to indicate which gesture mode type is enabled */ @@ -482,6 +484,8 @@ static struct attribute *sysfs_class_attrs[] = { #endif #ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL &dev_attr_gesture.attr, +#endif +#ifdef CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL &dev_attr_cli_gesture.attr, #endif NULL, diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c index 609d292eb6df..2cf634f04d48 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_gesture.c @@ -382,7 +382,8 @@ bool ts_mmi_is_sensor_enable(void) static int ts_mmi_sensor_set_enable(struct sensors_classdev *sensors_cdev, unsigned int enable) { -#ifndef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL +#if !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL) && \ + !defined(CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL) struct ts_mmi_sensor_platform_data *sensor_pdata = container_of( sensors_cdev, struct ts_mmi_sensor_platform_data, ps_cdev); struct ts_mmi_dev *touch_cdev = sensor_pdata->touch_cdev; diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c index e4dc701af170..50c25cacb7c6 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_notif.c @@ -60,7 +60,8 @@ static int ts_mmi_panel_off(struct ts_mmi_dev *touch_cdev) { TRY_TO_CALL(pre_suspend); if (touch_cdev->pdata.gestures_enabled || touch_cdev->pdata.cli_gestures_enabled) { -#ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL +#if defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL) || \ + defined(CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL) if(touch_cdev->gesture_mode_type != 0) { if(touch_cdev->gesture_mode_type & 0x01) { dev_info(DEV_MMI, "%s: try to enter zero Gesture mode\n", __func__); diff --git a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c index 528ea5e73ceb..8f41df12aab8 100644 --- a/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c +++ b/drivers/input/touchscreen/touchscreen_mmi/touchscreen_mmi_panel.c @@ -165,7 +165,9 @@ int ts_mmi_parse_dt(struct ts_mmi_dev *touch_cdev, if (!of_property_read_u32(of_node, "mmi,supported_gesture_type", &ppdata->supported_gesture_type)) dev_info(DEV_TS, "%s: supported_gesture_type property %02x\n", __func__, ppdata->supported_gesture_type); +#endif +#ifdef CONFIG_BOARD_USES_CLI_DOUBLE_TAP_CTRL if (!of_property_read_u32(of_node, "mmi,cli_supported_gesture_type", &ppdata->cli_supported_gesture_type)) dev_info(DEV_TS, "%s: cli_supported_gesture_type property %02x\n", __func__, ppdata->cli_supported_gesture_type);