diff --git a/drivers/input/touchscreen/nova_0flash_mmi/Android.mk b/drivers/input/touchscreen/nova_0flash_mmi/Android.mk index 445bf9f5345d..e44cbbddc181 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/Android.mk +++ b/drivers/input/touchscreen/nova_0flash_mmi/Android.mk @@ -46,6 +46,9 @@ endif ifneq ($(BOARD_USES_STYLUS_PALM_RANGE),) KERNEL_CFLAGS += CONFIG_INPUT_NOVA_0FLASH_MMI_STYLUS_PALM_RANGE=y endif +ifneq ($(BOARD_USES_EDGE_SUPPRESSION),) + KERNEL_CFLAGS += CONFIG_INPUT_NOVA_EDGE_SUPPRESSION=y +endif include $(CLEAR_VARS) ifneq ($(BOARD_USES_DOUBLE_TAP),) LOCAL_ADDITIONAL_DEPENDENCIES += $(KERNEL_MODULES_OUT)/sensors_class.ko diff --git a/drivers/input/touchscreen/nova_0flash_mmi/Kbuild b/drivers/input/touchscreen/nova_0flash_mmi/Kbuild index 02acd9aa0fbc..09c547098f41 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/Kbuild +++ b/drivers/input/touchscreen/nova_0flash_mmi/Kbuild @@ -43,6 +43,10 @@ ifneq ($(filter m y,$(CONFIG_INPUT_NOVA_0FLASH_MMI_PEN_NOTIFIER)),) KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../misc/pen/$(GKI_OBJ_MODULE_DIR)/Module.symvers EXTRA_CFLAGS += -DNOVATECH_PEN_NOTIFIER endif +ifneq ($(filter m y,$(CONFIG_INPUT_NOVA_EDGE_SUPPRESSION)),) + EXTRA_CFLAGS += -DEDGE_SUPPRESSION +endif + nova_0flash_mmi-objs += nt36xxx.o nova_0flash_mmi-objs += nt36xxx_ext_proc.o nova_0flash_mmi-objs += nt36xxx_fw_update.o diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c index e375d4caf814..aaee1ab3b7c0 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.c @@ -2014,12 +2014,47 @@ static ssize_t nvt_palm_settings_store(struct device *dev, } #endif +#ifdef EDGE_SUPPRESSION +static ssize_t nvt_edge_reject_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { + int res = 0; + uint8_t state; + + res = kstrtou8(buf, 0, &state); + if (res < 0) + return res; + + ts->edge_reject_state = state; + + NVT_LOG("edge_reject_state %d!\n", state); + nvt_edge_reject_set(ts->edge_reject_state); + + return count; +} + +static ssize_t nvt_edge_reject_show(struct device *dev, + struct device_attribute *attr, char *buf) { + + if(ts->edge_reject_state == VERTICAL) + return scnprintf(buf, PAGE_SIZE, "VERTICAL\n"); + else if(ts->edge_reject_state == LEFT_UP) + return scnprintf(buf, PAGE_SIZE, "LEFT_UP\n"); + else if(ts->edge_reject_state == RIGHT_UP) + return scnprintf(buf, PAGE_SIZE, "RIGHT_UP\n"); + else + return scnprintf(buf, PAGE_SIZE, "Not Support!\n"); +} +#endif + static struct device_attribute touchscreen_attributes[] = { __ATTR_RO(path), __ATTR_RO(vendor), __ATTR_RO(ic_ver), #ifdef PALM_GESTURE __ATTR(palm_settings, S_IRUGO | S_IWUSR | S_IWGRP, nvt_palm_settings_show, nvt_palm_settings_store), +#endif +#ifdef EDGE_SUPPRESSION + __ATTR(rotate, S_IRUGO | S_IWUSR | S_IWGRP, nvt_edge_reject_show, nvt_edge_reject_store), #endif __ATTR_NULL }; @@ -2046,7 +2081,7 @@ int32_t nvt_fw_class_init(bool create) static int minor; if (create) { -#ifdef PALM_GESTURE +#if defined (PALM_GESTURE) || defined (EDGE_SUPPRESSION) ret = alloc_chrdev_region(&devno, 0, 1, NVT_PRIMARY_NAME); #else ret = alloc_chrdev_region(&devno, 0, 1, NVT_SPI_NAME); @@ -2066,7 +2101,7 @@ int32_t nvt_fw_class_init(bool create) ts_class_dev = device_create(touchscreen_class, NULL, devno, -#ifdef PALM_GESTURE +#if defined (PALM_GESTURE) || defined (EDGE_SUPPRESSION) ts, NVT_PRIMARY_NAME); #else ts, NVT_SPI_NAME); @@ -2086,7 +2121,7 @@ int32_t nvt_fw_class_init(bool create) if (error) goto device_destroy; else -#ifdef PALM_GESTURE +#if defined (PALM_GESTURE) || defined (EDGE_SUPPRESSION) NVT_LOG("create /sys/class/touchscreen/%s Succeeded!\n", NVT_PRIMARY_NAME); #else NVT_LOG("create /sys/class/touchscreen/%s Succeeded!\n", NVT_SPI_NAME); @@ -2330,6 +2365,9 @@ static int32_t nvt_ts_probe(struct spi_device *client) #ifdef PALM_GESTURE ts->palm_enabled = false; #endif +#ifdef EDGE_SUPPRESSION + ts->edge_reject_state = VERTICAL; +#endif sprintf(ts->phys, "input/ts"); ts->input_dev->name = NVT_TS_NAME; diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h index 819ef1d31172..f4b4f4fb5e29 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx.h @@ -102,6 +102,12 @@ extern const uint16_t touch_key_array[TOUCH_KEY_NUM]; #define PANEL_REAL_HEIGHT 15768 #endif #endif +#define EDGE_REJECT_VERTICLE_CMD 0xBA +#define EDGE_REJECT_LEFT_UP 0xBB +#define EDGE_REJECT_RIGHT_UP 0xBC +#define VERTICAL 1 +#define LEFT_UP 2 +#define RIGHT_UP 3 /* Enable only when module have tp reset pin and connected to host */ #define NVT_TOUCH_SUPPORT_HW_RST 0 @@ -220,6 +226,9 @@ struct nvt_ts_data { #endif #ifdef PALM_GESTURE bool palm_enabled; +#endif +#ifdef EDGE_SUPPRESSION + uint32_t edge_reject_state; #endif char product_id[10]; uint8_t fw_type; @@ -329,4 +338,7 @@ extern int nvt_mcu_pen_detect_set(uint8_t pen_detect); #ifdef PALM_GESTURE extern int nvt_palm_set(bool enabled); #endif +#ifdef EDGE_SUPPRESSION +extern int32_t nvt_edge_reject_set(uint32_t status); +#endif #endif /* _LINUX_NVT_TOUCH_H */ diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_ext_proc.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_ext_proc.c index fda301bd09db..5cf9026e28c9 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_ext_proc.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_ext_proc.c @@ -681,6 +681,25 @@ int nvt_palm_set(bool enabled) { } #endif +#ifdef EDGE_SUPPRESSION +int32_t nvt_edge_reject_set(uint32_t status) { + int ret = 0; + + if(status == VERTICAL)// 0 180 + ret = nvt_cmd_store(EDGE_REJECT_VERTICLE_CMD); + else if(status == LEFT_UP) //90 + ret = nvt_cmd_store(EDGE_REJECT_LEFT_UP); + else if(status == RIGHT_UP) //270 + ret = nvt_cmd_store(EDGE_REJECT_RIGHT_UP); + else { + NVT_ERR("Invalid parameter %d!\n", status); + ret = -1; + } + + return ret; +} +#endif + static int nvt_monitor_control_show(struct seq_file *sfile, void *v) { if(monitor_control_status == 1) diff --git a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c index f870eb458fe9..3714d7b00eea 100644 --- a/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c +++ b/drivers/input/touchscreen/nova_0flash_mmi/nt36xxx_fw_update.c @@ -1040,5 +1040,8 @@ void Boot_Update_Firmware(struct work_struct *work) #ifdef PALM_GESTURE nvt_palm_set(ts->palm_enabled); #endif +#ifdef EDGE_SUPPRESSION + ts->edge_reject_state = VERTICAL; +#endif } #endif /* BOOT_UPDATE_FIRMWARE */