All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Leitner <richard.leitner@skidata.com>
To: <dmitry.torokhov@gmail.com>, <robh+dt@kernel.org>,
	<mark.rutland@arm.com>
Cc: <linux-input@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Richard Leitner <richard.leitner@skidata.com>
Subject: [PATCH v2 7/8] Input: sx8654 - use common of_touchscreen functions
Date: Wed, 17 Oct 2018 14:51:15 +0200	[thread overview]
Message-ID: <20181017125116.20077-8-richard.leitner@skidata.com> (raw)
In-Reply-To: <20181017125116.20077-1-richard.leitner@skidata.com>

of_touchscreen.c provides a common interface for a axis invertion and
swapping of touchscreens. Therefore use it in the sx8654 driver.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 drivers/input/touchscreen/sx8654.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index 4939863efbef..b7b263ed52af 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -35,6 +35,7 @@
 #include <linux/irq.h>
 #include <linux/gpio/consumer.h>
 #include <linux/delay.h>
+#include <linux/input/touchscreen.h>
 
 /* register addresses */
 #define I2C_REG_TOUCH0			0x00
@@ -101,6 +102,7 @@ struct sx8654 {
 
 	spinlock_t		lock; /* for input reporting from irq/timer */
 	struct timer_list	timer;
+	struct touchscreen_properties props;
 
 	const struct sx865x_data *data;
 };
@@ -178,8 +180,7 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
 				 chdata);
 	}
 
-	input_report_abs(ts->input, ABS_X, x);
-	input_report_abs(ts->input, ABS_Y, y);
+	touchscreen_report_pos(ts->input, &ts->props, x, y, false);
 	input_report_key(ts->input, BTN_TOUCH, 1);
 	input_sync(ts->input);
 	dev_dbg(dev, "point(%4d,%4d)\n", x, y);
@@ -226,8 +227,8 @@ static irqreturn_t sx8654_irq(int irq, void *handle)
 		x = ((data[0] & 0xf) << 8) | (data[1]);
 		y = ((data[2] & 0xf) << 8) | (data[3]);
 
-		input_report_abs(sx8654->input, ABS_X, x);
-		input_report_abs(sx8654->input, ABS_Y, y);
+		touchscreen_report_pos(sx8654->input, &sx8654->props, x, y,
+				       false);
 		input_report_key(sx8654->input, BTN_TOUCH, 1);
 		input_sync(sx8654->input);
 
@@ -377,6 +378,8 @@ static int sx8654_probe(struct i2c_client *client,
 	input_set_abs_params(input, ABS_X, 0, MAX_12BIT, 0, 0);
 	input_set_abs_params(input, ABS_Y, 0, MAX_12BIT, 0, 0);
 
+	touchscreen_parse_properties(input, false, &sx8654->props);
+
 	sx8654->client = client;
 	sx8654->input = input;
 
-- 
2.11.0


WARNING: multiple messages have this Message-ID (diff)
From: Richard Leitner <richard.leitner@skidata.com>
To: dmitry.torokhov@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Richard Leitner <richard.leitner@skidata.com>
Subject: [PATCH v2 7/8] Input: sx8654 - use common of_touchscreen functions
Date: Wed, 17 Oct 2018 14:51:15 +0200	[thread overview]
Message-ID: <20181017125116.20077-8-richard.leitner@skidata.com> (raw)
In-Reply-To: <20181017125116.20077-1-richard.leitner@skidata.com>

of_touchscreen.c provides a common interface for a axis invertion and
swapping of touchscreens. Therefore use it in the sx8654 driver.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
---
 drivers/input/touchscreen/sx8654.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index 4939863efbef..b7b263ed52af 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -35,6 +35,7 @@
 #include <linux/irq.h>
 #include <linux/gpio/consumer.h>
 #include <linux/delay.h>
+#include <linux/input/touchscreen.h>
 
 /* register addresses */
 #define I2C_REG_TOUCH0			0x00
@@ -101,6 +102,7 @@ struct sx8654 {
 
 	spinlock_t		lock; /* for input reporting from irq/timer */
 	struct timer_list	timer;
+	struct touchscreen_properties props;
 
 	const struct sx865x_data *data;
 };
@@ -178,8 +180,7 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
 				 chdata);
 	}
 
-	input_report_abs(ts->input, ABS_X, x);
-	input_report_abs(ts->input, ABS_Y, y);
+	touchscreen_report_pos(ts->input, &ts->props, x, y, false);
 	input_report_key(ts->input, BTN_TOUCH, 1);
 	input_sync(ts->input);
 	dev_dbg(dev, "point(%4d,%4d)\n", x, y);
@@ -226,8 +227,8 @@ static irqreturn_t sx8654_irq(int irq, void *handle)
 		x = ((data[0] & 0xf) << 8) | (data[1]);
 		y = ((data[2] & 0xf) << 8) | (data[3]);
 
-		input_report_abs(sx8654->input, ABS_X, x);
-		input_report_abs(sx8654->input, ABS_Y, y);
+		touchscreen_report_pos(sx8654->input, &sx8654->props, x, y,
+				       false);
 		input_report_key(sx8654->input, BTN_TOUCH, 1);
 		input_sync(sx8654->input);
 
@@ -377,6 +378,8 @@ static int sx8654_probe(struct i2c_client *client,
 	input_set_abs_params(input, ABS_X, 0, MAX_12BIT, 0, 0);
 	input_set_abs_params(input, ABS_Y, 0, MAX_12BIT, 0, 0);
 
+	touchscreen_parse_properties(input, false, &sx8654->props);
+
 	sx8654->client = client;
 	sx8654->input = input;
 
-- 
2.11.0

  parent reply	other threads:[~2018-10-17 16:04 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 12:51 [PATCH v2 0/7] Input: sx8654 - reset-gpio, sx865[056] support, etc Richard Leitner
2018-10-17 12:51 ` Richard Leitner
2018-10-17 12:51 ` [PATCH v2 1/8] dt-bindings: input: touchscreen: sx8654: add reset-gpio property Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-10-18 20:34   ` Rob Herring
2018-10-18 20:34     ` Rob Herring
2018-10-17 12:51 ` [PATCH v2 2/8] Input: sx8654 - add reset-gpio support Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-10-17 12:51 ` [PATCH v2 3/8] dt-bindings: input: touchscreen: sx8654: add compatible models Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-10-18 20:35   ` Rob Herring
2018-10-18 20:35     ` Rob Herring
2018-10-17 12:51 ` [PATCH v2 4/8] Input: sx8654 - add sx8655 and sx8656 to compatibles Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-10-17 12:51 ` [PATCH v2 5/8] dt-bindings: input: touchscreen: sx8654: add sx8650 to comatibles Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-10-18 20:35   ` Rob Herring
2018-10-18 20:35     ` Rob Herring
2018-10-17 12:51 ` [PATCH v2 6/8] Input: sx8654 - add sx8650 support Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-10-17 12:51 ` Richard Leitner [this message]
2018-10-17 12:51   ` [PATCH v2 7/8] Input: sx8654 - use common of_touchscreen functions Richard Leitner
2018-10-17 12:51 ` [PATCH v2 8/8] Input: sx8654 - convert #defined flags to BIT(x) Richard Leitner
2018-10-17 12:51   ` Richard Leitner
2018-11-04 21:38 ` [PATCH v2 0/7] Input: sx8654 - reset-gpio, sx865[056] support, etc Richard Leitner
2018-11-04 21:38   ` Richard Leitner
2018-12-03  8:25 ` Richard Leitner
2018-12-03  8:25   ` Richard Leitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181017125116.20077-8-richard.leitner@skidata.com \
    --to=richard.leitner@skidata.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.