* [PATCH] input: ilitek_ts_i2c: report key event for palm
@ 2025-07-14 9:51 Joe Hung (洪銘陽)
2025-07-23 15:57 ` Francesco Dolcini
2025-07-23 16:09 ` dmitry.torokhov
0 siblings, 2 replies; 3+ messages in thread
From: Joe Hung (洪銘陽) @ 2025-07-14 9:51 UTC (permalink / raw)
To: dmitry.torokhov@gmail.com, francesco.dolcini@toradex.com,
emanuele.ghidoli@toradex.com
Cc: linux-input, linux-kernel@vger.kernel.org,
Luca Hsu (徐嘉鍊),
Joe Hung (洪銘陽)
From ec0d80214fee6acc0b38f33ad0b6b487098963bc Mon Sep 17 00:00:00 2001
From: Joe Hong <joe_hung@ilitek.com>
Date: Mon, 14 Jul 2025 17:20:11 +0800
Subject: [PATCH] input: ilitek_ts_i2c: report key event for palm
Add support for reporting user-defined key event while getting palm event.
Signed-off-by: Joe Hong <joe_hung@ilitek.com>
---
drivers/input/touchscreen/ilitek_ts_i2c.c | 42 +++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c
index 0dd632724a00..fdcb4ab66fbb 100644
--- a/drivers/input/touchscreen/ilitek_ts_i2c.c
+++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
@@ -39,8 +39,13 @@
#define ILITEK_TP_I2C_REPORT_ID 0x48
#define REPORT_COUNT_ADDRESS 61
+#define ALGO_MODE_ADDRESS 62
#define ILITEK_SUPPORT_MAX_POINT 40
+static uint palm_key;
+module_param(palm_key, uint, 0664);
+MODULE_PARM_DESC(palm_key, "Set palm key code when palm is detected");
+
struct ilitek_protocol_info {
u16 ver;
u8 ver_major;
@@ -176,6 +181,11 @@ static int ilitek_process_and_report_v6(struct ilitek_ts_data *ts)
return -EINVAL;
}
+ if (palm_key) {
+ input_report_key(ts->input_dev, palm_key,
+ (buf[ALGO_MODE_ADDRESS] & 0x80) ? 1 : 0);
+ }
+
count = DIV_ROUND_UP(report_max_point, packet_max_point);
for (i = 1; i < count; i++) {
error = ilitek_i2c_write_and_read(ts, NULL, 0, 0,
@@ -472,6 +482,9 @@ static int ilitek_input_dev_init(struct device *dev, struct ilitek_ts_data *ts)
input->name = ILITEK_TS_NAME;
input->id.bustype = BUS_I2C;
+ if (palm_key)
+ __set_bit(palm_key, input->keybit);
+
__set_bit(INPUT_PROP_DIRECT, input->propbit);
input_set_abs_params(input, ABS_MT_POSITION_X,
@@ -537,9 +550,38 @@ static ssize_t product_id_show(struct device *dev,
}
static DEVICE_ATTR_RO(product_id);
+static ssize_t palm_key_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "palm key: [%u]\n", palm_key);
+}
+
+static ssize_t palm_key_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct ilitek_ts_data *ts = i2c_get_clientdata(client);
+
+ unsigned long tmp;
+
+ if (kstrtoul(buf, 10, &tmp) || tmp > KEY_MAX)
+ return -EINVAL;
+
+ if (palm_key)
+ __clear_bit(palm_key, ts->input_dev->keybit);
+
+ __set_bit(tmp, ts->input_dev->keybit);
+ palm_key = tmp;
+
+ return count;
+}
+
+static DEVICE_ATTR_RW(palm_key);
+
static struct attribute *ilitek_sysfs_attrs[] = {
&dev_attr_firmware_version.attr,
&dev_attr_product_id.attr,
+ &dev_attr_palm_key.attr,
NULL
};
ATTRIBUTE_GROUPS(ilitek_sysfs);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] input: ilitek_ts_i2c: report key event for palm
2025-07-14 9:51 [PATCH] input: ilitek_ts_i2c: report key event for palm Joe Hung (洪銘陽)
@ 2025-07-23 15:57 ` Francesco Dolcini
2025-07-23 16:09 ` dmitry.torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Francesco Dolcini @ 2025-07-23 15:57 UTC (permalink / raw)
To: Joe Hung (洪銘陽)
Cc: dmitry.torokhov@gmail.com, francesco.dolcini@toradex.com,
emanuele.ghidoli@toradex.com, linux-input,
linux-kernel@vger.kernel.org, Luca Hsu (徐嘉鍊)
On Mon, Jul 14, 2025 at 09:51:42AM +0000, Joe Hung (洪銘陽) wrote:
> From ec0d80214fee6acc0b38f33ad0b6b487098963bc Mon Sep 17 00:00:00 2001
> From: Joe Hong <joe_hung@ilitek.com>
> Date: Mon, 14 Jul 2025 17:20:11 +0800
> Subject: [PATCH] input: ilitek_ts_i2c: report key event for palm
something wrong on this headers, check your setup
> Add support for reporting user-defined key event while getting palm event.
>
> Signed-off-by: Joe Hong <joe_hung@ilitek.com>
> ---
> drivers/input/touchscreen/ilitek_ts_i2c.c | 42 +++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c
> index 0dd632724a00..fdcb4ab66fbb 100644
> --- a/drivers/input/touchscreen/ilitek_ts_i2c.c
> +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
> @@ -39,8 +39,13 @@
> #define ILITEK_TP_I2C_REPORT_ID 0x48
>
> #define REPORT_COUNT_ADDRESS 61
> +#define ALGO_MODE_ADDRESS 62
> #define ILITEK_SUPPORT_MAX_POINT 40
>
> +static uint palm_key;
> +module_param(palm_key, uint, 0664);
> +MODULE_PARM_DESC(palm_key, "Set palm key code when palm is detected");
I do not think that putting some kind of configuration in a kernel
module param is an option
Francesco
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] input: ilitek_ts_i2c: report key event for palm
2025-07-14 9:51 [PATCH] input: ilitek_ts_i2c: report key event for palm Joe Hung (洪銘陽)
2025-07-23 15:57 ` Francesco Dolcini
@ 2025-07-23 16:09 ` dmitry.torokhov
1 sibling, 0 replies; 3+ messages in thread
From: dmitry.torokhov @ 2025-07-23 16:09 UTC (permalink / raw)
To: Joe Hung (洪銘陽)
Cc: francesco.dolcini@toradex.com, emanuele.ghidoli@toradex.com,
linux-input, linux-kernel@vger.kernel.org,
Luca Hsu (徐嘉鍊)
Hi Joe,
On Mon, Jul 14, 2025 at 09:51:42AM +0000, Joe Hung (洪銘陽) wrote:
> From ec0d80214fee6acc0b38f33ad0b6b487098963bc Mon Sep 17 00:00:00 2001
> From: Joe Hong <joe_hung@ilitek.com>
> Date: Mon, 14 Jul 2025 17:20:11 +0800
> Subject: [PATCH] input: ilitek_ts_i2c: report key event for palm
>
> Add support for reporting user-defined key event while getting palm event.
Palm contacts should be reported via MT_TOOL_PALM contact type and not a
fake key event.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-23 16:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 9:51 [PATCH] input: ilitek_ts_i2c: report key event for palm Joe Hung (洪銘陽)
2025-07-23 15:57 ` Francesco Dolcini
2025-07-23 16:09 ` dmitry.torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).