diff options
author | Erfan Abdi <erfangplus@gmail.com> | 2020-03-07 03:18:08 +0330 |
---|---|---|
committer | Sebastiano Barezzi <barezzisebastiano@gmail.com> | 2021-03-12 21:12:14 +0100 |
commit | d85e2325d44e94f92968a184532e50eeb79c3a3e (patch) | |
tree | c6bc2b0107c497b3fb9b23e590b7c9137de12306 /drivers/input | |
parent | 6d8755f8896a2061c11cb6b6a586b932194a0b52 (diff) |
input: synaptics_tcm_d2t: Enable DT2W node using tp_common
Change-Id: I8ca9447557b69f47e448b519a11326aef48879b2
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_core.c | 43 | ||||
-rw-r--r-- | drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_touch.c | 12 |
2 files changed, 55 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_core.c b/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_core.c index 23cbb59938ff..aad87e25f740 100644 --- a/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_core.c +++ b/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_core.c @@ -38,6 +38,9 @@ #include "synaptics_tcm_core.h" #include <linux/uaccess.h> #include <linux/debugfs.h> +#ifdef CONFIG_TOUCHSCREEN_COMMON +#include <linux/input/tp_common.h> +#endif /*#define RESET_ON_RESUME*/ #define RESET_ON_RESUME_DELAY_MS 20 @@ -415,6 +418,37 @@ exit: return retval; } +#ifdef CONFIG_TOUCHSCREEN_COMMON +extern void change_double_tap_status(int enabled); + +static ssize_t double_tap_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", tcm_hcd->gesture_enabled); +} + +static ssize_t double_tap_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, + size_t count) +{ + int rc, val; + + rc = kstrtoint(buf, 10, &val); + if (rc) + return -EINVAL; + + tcm_hcd->gesture_enabled = !!val; + change_double_tap_status(tcm_hcd->gesture_enabled); + + return count; +} + +static struct tp_common_ops double_tap_ops = { + .show = double_tap_show, + .store = double_tap_store +}; +#endif + static ssize_t syna_tcm_sysfs_reset_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -3535,6 +3569,15 @@ static int syna_tcm_probe(struct platform_device *pdev) goto err_config_gpio; } +#ifdef CONFIG_TOUCHSCREEN_COMMON + retval = tp_common_set_double_tap_ops(&double_tap_ops); + if (retval < 0) { + dev_err(&pdev->dev, + "%s: Failed to create double_tap node err=%d\n", + __func__, retval); + } +#endif + sysfs_dir = kobject_create_and_add(PLATFORM_DRIVER_NAME, &pdev->dev.kobj); if (!sysfs_dir) { diff --git a/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_touch.c b/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_touch.c index 1df24959f0c0..23590b9cb0c1 100644 --- a/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_touch.c +++ b/drivers/input/touchscreen/synaptics_tcm_d2t/synaptics_tcm_touch.c @@ -151,6 +151,18 @@ static void syna_tcm_switch_mode_work(struct work_struct *work); static struct touch_hcd *touch_hcd; +#ifdef CONFIG_TOUCHSCREEN_COMMON +void change_double_tap_status(int enabled) { + struct touch_data *touch_data; + + touch_data = &touch_hcd->touch_data; + + touch_data->gesture_double_tap = enabled; + + return; +} +#endif + /** * touch_free_objects() - Free all touch objects * |