build/patch/kernel/archive/sunxi-6.1/patches.megous/input-cyttsp4-De-obfuscate-platform-data-for-keys.patch

86 lines
2.6 KiB
Diff

From da464587dbc563f39a5d957394e8c6419df8b5f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 28 Sep 2019 14:46:11 +0200
Subject: [PATCH 060/389] input: cyttsp4: De-obfuscate platform data for keys
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/input/touchscreen/cyttsp4_core.c | 22 +++-------------------
include/linux/platform_data/cyttsp4.h | 12 ++++++------
2 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index dccbcb942fe5..a14300494c8f 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -541,8 +541,6 @@ static int cyttsp4_si_get_btn_data(struct cyttsp4 *cd)
{
struct cyttsp4_sysinfo *si = &cd->sysinfo;
int btn;
- int num_defined_keys;
- u16 *key_table;
void *p;
int rc = 0;
@@ -559,24 +557,10 @@ static int cyttsp4_si_get_btn_data(struct cyttsp4 *cd)
}
si->btn = p;
- if (cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS] == NULL)
- num_defined_keys = 0;
- else if (cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS]->data == NULL)
- num_defined_keys = 0;
- else
- num_defined_keys = cd->cpdata->sett
- [CY_IC_GRPNUM_BTN_KEYS]->size;
-
- for (btn = 0; btn < si->si_ofs.num_btns &&
- btn < num_defined_keys; btn++) {
- key_table = (u16 *)cd->cpdata->sett
- [CY_IC_GRPNUM_BTN_KEYS]->data;
- si->btn[btn].key_code = key_table[btn];
- si->btn[btn].state = CY_BTN_RELEASED;
- si->btn[btn].enabled = true;
- }
- for (; btn < si->si_ofs.num_btns; btn++) {
+ for (btn = 0; btn < si->si_ofs.num_btns; btn++) {
si->btn[btn].key_code = KEY_RESERVED;
+ if (btn < cd->cpdata->n_keys)
+ si->btn[btn].key_code = cd->cpdata->keys[btn].code;
si->btn[btn].state = CY_BTN_RELEASED;
si->btn[btn].enabled = true;
}
diff --git a/include/linux/platform_data/cyttsp4.h b/include/linux/platform_data/cyttsp4.h
index 5dc9d2be384b..c54160c17b0b 100644
--- a/include/linux/platform_data/cyttsp4.h
+++ b/include/linux/platform_data/cyttsp4.h
@@ -33,11 +33,9 @@ struct cyttsp4_mt_platform_data {
char const *inp_dev_name;
};
-struct touch_settings {
- const uint8_t *data;
- uint32_t size;
- uint8_t tag;
-} __packed;
+struct cyttsp4_virtual_key {
+ int code;
+};
struct cyttsp4_core_platform_data {
int irq_gpio;
@@ -51,7 +49,9 @@ struct cyttsp4_core_platform_data {
int on, struct device *dev, atomic_t *ignore_irq);
int (*irq_stat)(struct cyttsp4_core_platform_data *pdata,
struct device *dev);
- struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX];
+
+ int n_keys;
+ struct cyttsp4_virtual_key* keys;
};
struct cyttsp4_platform_data {
--
2.35.3