[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240502185819.788716-3-andreas@kemnade.info>
Date: Thu, 2 May 2024 20:58:19 +0200
From: Andreas Kemnade <andreas@...nade.info>
To: dmitry.torokhov@...il.com,
robh@...nel.org,
krzk+dt@...nel.org,
conor+dt@...nel.org,
andreas@...nade.info,
hdegoede@...hat.com,
andy.shevchenko@...il.com,
u.kleine-koenig@...gutronix.de,
siebren.vroegindeweij@...mail.com,
linux-input@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] Input: ektf2127 - add ektf2232 support
The chip is similar, but has status bits at different positions,
so use the correct bits.
Signed-off-by: Andreas Kemnade <andreas@...nade.info>
---
drivers/input/touchscreen/ektf2127.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
index cc3103b9cbfba..5c2a6bfc63d84 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -46,6 +46,7 @@ struct ektf2127_ts {
struct input_dev *input;
struct gpio_desc *power_gpios;
struct touchscreen_properties prop;
+ bool shifted_status;
};
static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count,
@@ -112,8 +113,13 @@ static void ektf2127_report2_contact(struct ektf2127_ts *ts, int slot,
static void ektf2127_report2_event(struct ektf2127_ts *ts, const u8 *buf)
{
- ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2));
- ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4));
+ if (ts->shifted_status) {
+ ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 1));
+ ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 2));
+ } else {
+ ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2));
+ ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4));
+ }
input_mt_sync_frame(ts->input);
input_sync(ts->input);
@@ -303,6 +309,10 @@ static int ektf2127_probe(struct i2c_client *client)
return error;
ts->input = input;
+ if (dev->of_node &&
+ of_device_is_compatible(dev->of_node, "elan,ektf2232"))
+ ts->shifted_status = true;
+
input_set_drvdata(input, ts);
error = devm_request_threaded_irq(dev, client->irq,
@@ -329,6 +339,7 @@ static int ektf2127_probe(struct i2c_client *client)
static const struct of_device_id ektf2127_of_match[] = {
{ .compatible = "elan,ektf2127" },
{ .compatible = "elan,ektf2132" },
+ { .compatible = "elan,ektf2232" },
{}
};
MODULE_DEVICE_TABLE(of, ektf2127_of_match);
--
2.39.2
Powered by blists - more mailing lists