[PATCH 2/2] Input: ektf2127 - add ektf2232 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The chip is similar, but has status bits at different positions,
so use the correct bits.

Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
---
 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





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux