[Replicant] [PATCH 3/4] input: cypress touchkey: cleanups: remove unused TEST_JIG_MODE
Denis 'GNUtoo' Carikli
GNUtoo at cyberdimension.org
Thu Apr 18 13:02:57 UTC 2019
TEST_JIG_MODE is not defined anywhere, so we can safely remove
that code.
The define name suggest that it was probably used during
manufacturing tests.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
.../input/keyboard/cypress/cypress-touchkey.c | 129 ----------------
.../keyboard/cypressbln/cypress-touchkey.c | 144 +-----------------
2 files changed, 1 insertion(+), 272 deletions(-)
diff --git a/drivers/input/keyboard/cypress/cypress-touchkey.c b/drivers/input/keyboard/cypress/cypress-touchkey.c
index bec49e8bab51..648238559ac8 100644
--- a/drivers/input/keyboard/cypress/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypress/cypress-touchkey.c
@@ -525,7 +525,6 @@ static ssize_t touchkey_threshold_show(struct device *dev,
}
#endif
-#ifndef TEST_JIG_MODE
static irqreturn_t touchkey_interrupt(int irq, void *dev_id)
{
struct touchkey_i2c *tkey_i2c = dev_id;
@@ -595,121 +594,6 @@ static irqreturn_t touchkey_interrupt(int irq, void *dev_id)
set_touchkey_debug('A');
return IRQ_HANDLED;
}
-#else
-static irqreturn_t touchkey_interrupt(int irq, void *dev_id)
-{
- struct touchkey_i2c *tkey_i2c = dev_id;
- u8 data[18];
- int ret;
- int retry = 10;
- int keycode_type = 0;
- int pressed;
-
-#if 0
- if (gpio_get_value(_3_GPIO_TOUCH_INT)) {
- printk(KERN_DEBUG "[TouchKey] Unknown state.\n", __func__);
- return IRQ_HANDLED;
- }
-#endif
-
- set_touchkey_debug('a');
-
-#ifdef CONFIG_CPU_FREQ
- /* set_dvfs_target_level(LEV_800MHZ); */
-#endif
-
- retry = 3;
- while (retry--) {
-#if defined(CONFIG_TARGET_LOCALE_NA) || defined(CONFIG_MACH_Q1_BD)\
- || defined(CONFIG_MACH_C1)
- ret = i2c_touchkey_read(tkey_i2c->client,
- KEYCODE_REG, data, 18);
-#else
- ret = i2c_touchkey_read(tkey_i2c->client,
- KEYCODE_REG, data, 10);
-#endif
- if (!ret)
- break;
- else {
- printk(KERN_DEBUG
- "[TouchKey] i2c read failed, ret:%d, retry: %d\n",
- ret, retry);
- continue;
- }
- }
- if (ret < 0)
- return IRQ_HANDLED;
-
-#if defined(CONFIG_TARGET_LOCALE_NA)
-#if defined(CONFIG_MACH_C1_NA_SPR_EPIC2_REV00)
- menu_sensitivity = data[11];
- home_sensitivity = data[13];
- search_sensitivity = data[15];
- back_sensitivity = data[17];
-#else
- if (tkey_i2c->module_ver >= 8) {
- menu_sensitivity = data[17];
- home_sensitivity = data[15];
- search_sensitivity = data[11];
- back_sensitivity = data[13];
- } else {
- menu_sensitivity = data[6];
- home_sensitivity = data[7];
- search_sensitivity = data[8];
- back_sensitivity = data[9];
- }
-#endif
-#elif defined(CONFIG_MACH_Q1_BD) || defined(CONFIG_MACH_C1)
- menu_sensitivity = data[13];
- back_sensitivity = data[11];
-#else
- menu_sensitivity = data[7];
- back_sensitivity = data[9];
-#endif /* CONFIG_TARGET_LOCALE_NA */
-
- set_touchkey_debug(data[0]);
-
- keycode_type = (data[0] & TK_BIT_KEYCODE);
- pressed = !(data[0] & TK_BIT_PRESS_EV);
-
- if (keycode_type <= 0 || keycode_type >= touchkey_count) {
- printk(KERN_DEBUG "[Touchkey] keycode_type err\n");
- return IRQ_HANDLED;
- }
-
- if (pressed)
- set_touchkey_debug('P');
-
- if (get_tsp_status() && pressed)
- printk(KERN_DEBUG "[TouchKey] touchkey pressed"
- " but don't send event because touch is pressed.\n");
- else {
- input_report_key(touchkey_driver->input_dev,
- touchkey_keycode[keycode_type], pressed);
- input_sync(touchkey_driver->input_dev);
- /* printk(KERN_DEBUG "[TouchKey] keycode:%d pressed:%d\n",
- touchkey_keycode[keycode_index], pressed); */
- }
-
- if (keycode_type == 1)
- printk(KERN_DEBUG "search key sensitivity = %d\n",
- search_sensitivity);
- if (keycode_type == 2)
- printk(KERN_DEBUG "back key sensitivity = %d\n",
- back_sensitivity);
-#ifdef CONFIG_TARGET_LOCALE_NA
- if (keycode_type == 3)
- printk(KERN_DEBUG "home key sensitivity = %d\n",
- home_sensitivity);
- if (keycode_type == 4)
- printk(KERN_DEBUG "menu key sensitivity = %d\n",
- menu_sensitivity);
-#endif
-
- set_touchkey_debug('A');
- return IRQ_HANDLED;
-}
-#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
static int sec_touchkey_early_suspend(struct early_suspend *h)
@@ -750,9 +634,6 @@ static int sec_touchkey_late_resume(struct early_suspend *h)
{
struct touchkey_i2c *tkey_i2c =
container_of(h, struct touchkey_i2c, early_suspend);
-#ifdef TEST_JIG_MODE
- unsigned char get_touch = 0x40;
-#endif
set_touchkey_debug('R');
printk(KERN_DEBUG "[TouchKey] sec_touchkey_late_resume\n");
@@ -780,9 +661,6 @@ static int sec_touchkey_late_resume(struct early_suspend *h)
(u8 *) &touchkey_led_status, 1);
printk(KERN_DEBUG "[Touchkey] LED returned on\n");
}
-#ifdef TEST_JIG_MODE
- i2c_touchkey_write(tkey_i2c->client, &get_touch, 1);
-#endif
enable_irq(tkey_i2c->irq);
@@ -1437,10 +1315,6 @@ static int __init touchkey_init(void)
}
#endif
-#ifdef TEST_JIG_MODE
- unsigned char get_touch = 0x40;
-#endif
-
ret = i2c_add_driver(&touchkey_i2c_driver);
if (ret) {
@@ -1448,9 +1322,6 @@ static int __init touchkey_init(void)
"[TouchKey] registration failed, module not inserted.ret= %d\n",
ret);
}
-#ifdef TEST_JIG_MODE
- i2c_touchkey_write(tkey_i2c->client, &get_touch, 1);
-#endif
return ret;
}
diff --git a/drivers/input/keyboard/cypressbln/cypress-touchkey.c b/drivers/input/keyboard/cypressbln/cypress-touchkey.c
index f06eca5ef1b1..ef31ebc46e62 100644
--- a/drivers/input/keyboard/cypressbln/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypressbln/cypress-touchkey.c
@@ -780,7 +780,6 @@ void touchkey_firmware_update(void)
}
#endif
-#ifndef TEST_JIG_MODE
void touchkey_work_func(struct work_struct *p)
{
u8 data[3];
@@ -846,127 +845,6 @@ void touchkey_work_func(struct work_struct *p)
set_touchkey_debug('A');
enable_irq(IRQ_TOUCH_INT);
}
-#else
-void touchkey_work_func(struct work_struct *p)
-{
- u8 data[18];
- int ret;
- int retry = 10;
- int keycode_type = 0;
- int pressed;
-
-#if 0
- if (gpio_get_value(_3_GPIO_TOUCH_INT)) {
- printk(KERN_DEBUG "[TouchKey] Unknown state.\n", __func__);
- enable_irq(IRQ_TOUCH_INT);
- return;
- }
-#endif
-
- set_touchkey_debug('a');
-
-#ifdef CONFIG_CPU_FREQ
- /* set_dvfs_target_level(LEV_800MHZ); */
-#endif
-
- retry = 3;
- while (retry--) {
-#if defined(CONFIG_TARGET_LOCALE_NA) || defined(CONFIG_MACH_Q1_BD)
- ret = i2c_touchkey_read(KEYCODE_REG, data, 18);
-#else
- ret = i2c_touchkey_read(KEYCODE_REG, data, 10);
-#endif
- if (!ret)
- break;
- else {
- printk(KERN_DEBUG
- "[TouchKey] i2c read failed, ret:%d, retry: %d\n",
- ret, retry);
- continue;
- }
- }
- if (ret < 0) {
- enable_irq(IRQ_TOUCH_INT);
- return;
- }
-#if defined(CONFIG_TARGET_LOCALE_NA)
-#if defined(CONFIG_MACH_C1_NA_SPR_EPIC2_REV00)
- menu_sensitivity = data[11];
- home_sensitivity = data[13];
- search_sensitivity = data[15];
- back_sensitivity = data[17];
-#else
- if (store_module_version >= 8) {
- menu_sensitivity = data[17];
- home_sensitivity = data[15];
- search_sensitivity = data[11];
- back_sensitivity = data[13];
- } else {
- menu_sensitivity = data[6];
- home_sensitivity = data[7];
- search_sensitivity = data[8];
- back_sensitivity = data[9];
- }
-#endif
-#elif defined(CONFIG_MACH_Q1_BD)
- menu_sensitivity = data[13];
- back_sensitivity = data[11];
-#else
- menu_sensitivity = data[7];
- back_sensitivity = data[9];
-#endif /* CONFIG_TARGET_LOCALE_NA */
-
- set_touchkey_debug(data[0]);
-
- keycode_type = (data[0] & KEYCODE_BIT);
- pressed = !(data[0] & UPDOWN_EVENT_BIT);
-
- if (keycode_type <= 0 || keycode_type >= touchkey_count) {
- printk(KERN_DEBUG "[Touchkey] keycode_type err\n");
- enable_irq(IRQ_TOUCH_INT);
- return;
- }
-
- if (pressed)
- set_touchkey_debug('P');
-
- if (get_tsp_status() && pressed)
- printk(KERN_DEBUG "[TouchKey] touchkey pressed"
- " but don't send event because touch is pressed.\n");
- else {
- input_report_key(touchkey_driver->input_dev,
- touchkey_keycode[keycode_type], pressed);
- input_sync(touchkey_driver->input_dev);
- /* printk(KERN_DEBUG "[TouchKey] keycode:%d pressed:%d\n",
- touchkey_keycode[keycode_index], pressed); */
- }
-
- if (keycode_type == 1)
- printk(KERN_DEBUG "search key sensitivity = %d\n",
- search_sensitivity);
- if (keycode_type == 2)
- printk(KERN_DEBUG "back key sensitivity = %d\n",
- back_sensitivity);
-#ifdef CONFIG_TARGET_LOCALE_NA
- if (keycode_type == 3)
- printk(KERN_DEBUG "home key sensitivity = %d\n",
- home_sensitivity);
- if (keycode_type == 4)
- printk(KERN_DEBUG "menu key sensitivity = %d\n",
- menu_sensitivity);
-#endif
-
-#ifdef WHY_DO_WE_NEED_THIS
- /* clear interrupt */
- if (readl(gpio_pend_mask_mem) & (0x1 << 1)) {
- writel(readl(gpio_pend_mask_mem) | (0x1 << 1),
- gpio_pend_mask_mem);
- }
-#endif
- set_touchkey_debug('A');
- enable_irq(IRQ_TOUCH_INT);
-}
-#endif
static irqreturn_t touchkey_interrupt(int irq, void *dummy)
{
@@ -1028,9 +906,6 @@ static int sec_touchkey_early_suspend(struct early_suspend *h)
static int sec_touchkey_late_resume(struct early_suspend *h)
{
-#ifdef TEST_JIG_MODE
- unsigned char get_touch = 0x40;
-#endif
int status;
set_touchkey_debug('R');
@@ -1104,9 +979,6 @@ static int sec_touchkey_late_resume(struct early_suspend *h)
i2c_touchkey_write((u8 *) &touchkey_led_status, 1);
printk(KERN_DEBUG "LED returned on\n");
}
-#ifdef TEST_JIG_MODE
- i2c_touchkey_write(&get_touch, 1);
-#endif
/* restart the timer if needed */
if (led_timeout > 0) {
@@ -2116,10 +1988,6 @@ static ssize_t set_touchkey_update_show(struct device *dev,
int retry = 3;
touchkey_update_status = 1;
-#ifdef TEST_JIG_MODE
- unsigned char get_touch = 0x40;
-#endif
-
while (retry--) {
if (ISSP_main() == 0) {
printk(KERN_ERR
@@ -2142,10 +2010,6 @@ static ssize_t set_touchkey_update_show(struct device *dev,
init_hw(); /* after update, re initalize. */
-#ifdef TEST_JIG_MODE
- i2c_touchkey_write(&get_touch, 1);
-#endif
-
return count;
}
@@ -2248,10 +2112,6 @@ static int __init touchkey_init(void)
{
int ret = 0;
-#ifdef TEST_JIG_MODE
- unsigned char get_touch = 0x40;
-#endif
-
sec_touchkey = device_create(sec_class, NULL, 0, NULL, "sec_touchkey");
if (IS_ERR(sec_touchkey))
@@ -2427,9 +2287,7 @@ static int __init touchkey_init(void)
"[TouchKey] registration failed, module not inserted.ret= %d\n",
ret);
}
-#ifdef TEST_JIG_MODE
- i2c_touchkey_write(&get_touch, 1);
-#endif
+
return ret;
}
--
2.21.0
More information about the Replicant
mailing list