From fc629c45a93973c79aa6b6a66a38878331dce7c8 Mon Sep 17 00:00:00 2001 From: Jackeagle Date: Mon, 22 Feb 2016 12:09:28 -0500 Subject: [PATCH] kmini3g: input: abov_touchkey- Disable Samsung Dual Detect Samsung has introduced this since Lollipop Release and due to this the Capacitive Keys had issues and stopped working repeatedly once screen is locked. It only works again after reboot and fails after screen is locked. Disabling this has fixed Capacitive Key Issue. Change-Id: Ia7ff76620cdac863289f57ea37459bd5b94ea99e Signed-off-by: Jackeagle --- arch/arm/configs/lineage_kmini3g_defconfig | 1 + drivers/input/keyboard/Kconfig | 7 +++++ drivers/input/keyboard/abov_touchkey.c | 33 +++++++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/lineage_kmini3g_defconfig b/arch/arm/configs/lineage_kmini3g_defconfig index bc7cf8bcee7..03fc774d235 100644 --- a/arch/arm/configs/lineage_kmini3g_defconfig +++ b/arch/arm/configs/lineage_kmini3g_defconfig @@ -1897,6 +1897,7 @@ CONFIG_INPUT_KEYRESET=y # CONFIG_INPUT_KEYBOARD=y CONFIG_KEYBOARD_ABOV_TOUCH=y +# CONFIG_KEYBOARD_ABOV_DUAL_DETECT is not set # CONFIG_KEYBOARD_ABOV_TOUCH_PATEK is not set CONFIG_INPUT_ENABLED=y # CONFIG_KEYBOARD_ADP5588 is not set diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 30c51687a0c..8d41844b3e0 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -631,6 +631,13 @@ config KEYBOARD_W90P910 To compile this driver as a module, choose M here: the module will be called w90p910_keypad. +config KEYBOARD_ABOV_DUAL_DETECT + bool "Abov FT16XX Touchkey Dual Detect Feature" + depends on KEYBOARD_ABOV_TOUCH + default n + help + Say Y here only for stock kernel and disable permanently + on custom rom. endif config SENSORS_HALL_DEBOUNCE diff --git a/drivers/input/keyboard/abov_touchkey.c b/drivers/input/keyboard/abov_touchkey.c index d87fc5be426..2800244b71b 100644 --- a/drivers/input/keyboard/abov_touchkey.c +++ b/drivers/input/keyboard/abov_touchkey.c @@ -54,7 +54,10 @@ #define ABOV_RAWDATA 0x0E #define ABOV_VENDORID 0x12 #define ABOV_GLOVE 0x13 + +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT #define ABOV_DUAL_DETECT 0x16 +#endif /* command */ #define CMD_LED_ON 0x10 @@ -65,7 +68,11 @@ #define CMD_STOP_MODE 0x80 #define CMD_GLOVE_ON 0x20 #define CMD_GLOVE_OFF 0x10 + +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT #define CMD_DUAL_DETECT 0x10 +#endif + #define CMD_SINGLE_DETECT 0x20 #define ABOV_BOOT_DELAY 45 @@ -80,10 +87,16 @@ struct device *sec_touchkey; #define FW_CHECKSUM_L 0xCE #define TK_FW_PATH_BIN "abov/abov_tk.fw" #define TK_FW_PATH_SDCARD "/sdcard/abov_fw.bin" + +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT #define ABOV_DUAL_DETECTION_CMD_FW_VER 0x14 -#else +#endif + #define FW_VERSION 0x06 + +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT #define ABOV_DUAL_DETECTION_CMD_FW_VER 0xFF +#endif #define FW_CHECKSUM_H 0x94 #define FW_CHECKSUM_L 0x86 #define FW_CHECKSUM_H_REV4 0xE4 @@ -153,8 +166,11 @@ static void abov_tk_late_resume(struct early_suspend *h); #ifdef CONFIG_INPUT_ENABLED static int abov_tk_input_open(struct input_dev *dev); static void abov_tk_input_close(struct input_dev *dev); + +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT static void abov_tk_dual_detection_mode(struct abov_tk_info *info, int mode); #endif +#endif static int abov_glove_mode_enable(struct i2c_client *client, u8 cmd) { @@ -333,7 +349,9 @@ static void abov_tk_reset(struct abov_tk_info *info) abov_tk_reset_for_bootmode(info); msleep(ABOV_RESET_DELAY); +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT abov_tk_dual_detection_mode(info, 1); +#endif if (info->glovemode) abov_glove_mode_enable(client, CMD_GLOVE_ON); @@ -1100,7 +1118,9 @@ static ssize_t touchkey_fw_update(struct device *dev, disable_irq(info->irq); info->enabled = false; ret = abov_flash_fw(info, false, cmd); +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT abov_tk_dual_detection_mode(info, 1); +#endif if (info->glovemode) abov_glove_mode_enable(client, CMD_GLOVE_ON); info->enabled = true; @@ -1194,6 +1214,8 @@ static ssize_t abov_glove_mode_show(struct device *dev, return sprintf(buf, "%d\n", info->glovemode); } + +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT static void abov_tk_dual_detection_mode(struct abov_tk_info *info, int mode) { u8 cmd; @@ -1240,6 +1262,7 @@ static ssize_t abov_set_dual_detection_mode(struct device *dev, return count; } +#endif static DEVICE_ATTR(touchkey_threshold, S_IRUGO, touchkey_threshold_show, NULL); static DEVICE_ATTR(brightness, S_IRUGO | S_IWUSR | S_IWGRP, NULL, @@ -1256,8 +1279,10 @@ static DEVICE_ATTR(touchkey_firm_update_status, S_IRUGO | S_IWUSR | S_IWGRP, touchkey_fw_update_status, NULL); static DEVICE_ATTR(glove_mode, S_IRUGO | S_IWUSR | S_IWGRP, abov_glove_mode_show, abov_glove_mode); +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT static DEVICE_ATTR(detection_mode, S_IRUGO | S_IWUSR | S_IWGRP, NULL, abov_set_dual_detection_mode); +#endif static struct attribute *sec_touchkey_attributes[] = { &dev_attr_touchkey_threshold.attr, &dev_attr_brightness.attr, @@ -1270,7 +1295,9 @@ static struct attribute *sec_touchkey_attributes[] = { &dev_attr_touchkey_firm_update.attr, &dev_attr_touchkey_firm_update_status.attr, &dev_attr_glove_mode.attr, +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT &dev_attr_detection_mode.attr, +#endif NULL, }; @@ -1559,7 +1586,9 @@ static int __devinit abov_tk_probe(struct i2c_client *client, "failed to firmware check (%d)\n", ret); goto err_reg_input_dev; } +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT abov_tk_dual_detection_mode(info, 1); +#endif snprintf(info->phys, sizeof(info->phys), "%s/input0", dev_name(&client->dev)); input_dev->name = "sec_touchkey"; @@ -1742,7 +1771,9 @@ static int abov_tk_resume(struct device *dev) /* touchkey on by i2c */ get_tk_fw_version(info, true); #endif +#ifdef CONFIG_KEYBOARD_ABOV_DUAL_DETECT abov_tk_dual_detection_mode(info, 1); +#endif info->enabled = true; #if defined(CONFIG_SEC_ATLANTIC_PROJECT) dev_notice(&info->client->dev, "%s: led_flag=%d\n", __func__,