From 0ed37169aefc75f36a4bfbf67883670184ad791c Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Tue, 8 Apr 2025 05:23:50 +0300 Subject: [PATCH] input: touchscreen: nova_0flash_mmi: Rework gesture node Make gesture_show actually report the current enabled gestures and move away from supported_gesture_type since that is just hardcoded in dts. Rewrite gesture_store so that we are can toggle dt2w from userspace with a simple 0/1 write. Change-Id: I95192b990267a1135b3099521f155407bdc8738e --- .../touchscreen/nova_0flash_mmi/nt36xxx.c | 44 +++---------------- .../touchscreen/nova_0flash_mmi/nt36xxx.h | 1 - 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index ccf2309eab2e..3eb7752eaa47 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -1406,14 +1406,6 @@ static int32_t nvt_parse_dt(struct device *dev) #endif - -#ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL - uint32_t value; - if (!of_property_read_u32(np, "novatek,supported_gesture_type", &value)){ - ts->supported_gesture_type = (uint8_t)value; - } -#endif - #if NVT_TOUCH_SUPPORT_HW_RST ts->reset_gpio = of_get_named_gpio_flags(np, "novatek,reset-gpio", 0, &ts->reset_flags); NVT_LOG("novatek,reset-gpio=%d\n", ts->reset_gpio); @@ -2703,18 +2695,15 @@ static void nvt_gesture_state_switch(void) static ssize_t gesture_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct nvt_ts_data *nvt_data = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%02x\n", nvt_data->supported_gesture_type); + return scnprintf(buf, PAGE_SIZE, "%u\n", ts->d_tap_flag); } static ssize_t gesture_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - unsigned int value = 0; int err = 0; - //struct nvt_ts_data *nvt_data = dev_get_drvdata(dev); err = sscanf(buf, "%d", &value); if (err < 0) { @@ -2723,41 +2712,22 @@ static ssize_t gesture_store(struct device *dev, } switch (value) { - case 0x10: - nvt_cmd_ext_store(0x7B,0x01); - NVT_LOG("zero tap disable..."); - ts->s_tap_flag = false; - ts->d_tap_flag = false; - break; - case 0x11: - break; - case 0x20: - NVT_LOG("single tap disable..."); - ts->s_tap_flag = false; - break; - case 0x21: - nvt_cmd_ext_store(0x7B,0x02); - NVT_LOG("single tap enable..."); - ts->s_tap_flag = true; - break; - case 0x30: - NVT_LOG("double tap disable..."); - ts->d_tap_flag = false; - break; - case 0x31: + case 1: nvt_cmd_ext_store(0x7B,0x04); - NVT_LOG("double tap enable..."); + ts->s_tap_flag = false; ts->d_tap_flag = true; break; default: - NVT_LOG("unsupport gesture mode type"); + nvt_cmd_ext_store(0x7B,0x01); + ts->s_tap_flag = false; + ts->d_tap_flag = false; + break; } #ifdef NVT_WAKEUP_GESTURE_CTRL nvt_gesture_state_switch(); #endif return count; - } #endif diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h index cc3342a7d9f2..5bde499d54aa 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h @@ -218,7 +218,6 @@ struct nvt_ts_data { bool gesture_wait_pm; const char *panel_supplier; #ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL - int supported_gesture_type; bool d_tap_flag; bool s_tap_flag; #endif