From: Lucas Stach <l.stach@pengutronix.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
patchwork-lst@pengutronix.de, kernel@pengutronix.de,
Chris Healy <cphealy@gmail.com>
Subject: [PATCH 2/4] Input: egalax_ts - use touchscreen helpers
Date: Thu, 20 Sep 2018 16:22:54 +0200 [thread overview]
Message-ID: <20180920142256.2788-2-l.stach@pengutronix.de> (raw)
In-Reply-To: <20180920142256.2788-1-l.stach@pengutronix.de>
Using those helpers the driver will support all the common OF
touchscreen properties like rotation and axis swap.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/input/touchscreen/egalax_ts.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index 5e7a60089c3d..4c751f8f806d 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -25,6 +25,7 @@
#include <linux/bitops.h>
#include <linux/input/mt.h>
#include <linux/of_gpio.h>
+#include <linux/input/touchscreen.h>
/*
* Mouse Mode: some panel may configure the controller to mouse mode,
@@ -52,13 +53,12 @@
#define MAX_I2C_DATA_LEN 10
-#define EGALAX_MAX_X 32760
-#define EGALAX_MAX_Y 32760
#define EGALAX_MAX_TRIES 100
struct egalax_ts {
struct i2c_client *client;
struct input_dev *input_dev;
+ struct touchscreen_properties props;
};
static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
@@ -105,8 +105,7 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
down ? "down" : "up", id, x, y, z);
if (down) {
- input_report_abs(input_dev, ABS_MT_POSITION_X, x);
- input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
+ touchscreen_report_pos(input_dev, &ts->props, x, y, true);
input_report_abs(input_dev, ABS_MT_PRESSURE, z);
}
@@ -199,10 +198,14 @@ static int egalax_ts_probe(struct i2c_client *client,
input_dev->name = "EETI eGalax Touch Screen";
input_dev->id.bustype = BUS_I2C;
- input_set_abs_params(input_dev,
- ABS_MT_POSITION_X, 0, EGALAX_MAX_X, 0, 0);
- input_set_abs_params(input_dev,
- ABS_MT_POSITION_Y, 0, EGALAX_MAX_Y, 0, 0);
+ touchscreen_parse_properties(ts->input_dev, true, &ts->props);
+ if (!ts->props.max_x && !ts->props.max_y)
+ ts->props.max_x = ts->props.max_y = 32760;
+
+ input_set_abs_params(input_dev, ABS_MT_POSITION_X,
+ 0, ts->props.max_x, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
+ 0, ts->props.max_y, 0, 0);
input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
--
2.19.0
next prev parent reply other threads:[~2018-09-20 14:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 14:22 [PATCH 1/4] Input: egalax_ts - clean up capability initialization Lucas Stach
2018-09-20 14:22 ` Lucas Stach [this message]
2018-09-20 14:22 ` [PATCH 3/4] Input: egalax_ts - add property for protocol version Lucas Stach
2018-09-24 22:28 ` Rob Herring
2018-09-20 14:22 ` [PATCH 4/4] Input: egalax_ts - add support for new " Lucas Stach
2018-11-05 17:19 ` [PATCH 1/4] Input: egalax_ts - clean up capability initialization Lucas Stach
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=20180920142256.2788-2-l.stach@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=cphealy@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-input@vger.kernel.org \
--cc=patchwork-lst@pengutronix.de \
--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 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).