From: Daniel Mack <daniel@zonque.org>
To: dmitry.torokhov@gmail.com, robh+dt@kernel.org
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
Daniel Mack <daniel@zonque.org>
Subject: [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen
Date: Sun, 17 Jun 2018 13:46:57 +0200 [thread overview]
Message-ID: <20180617114659.367-3-daniel@zonque.org> (raw)
In-Reply-To: <20180617114659.367-1-daniel@zonque.org>
Use touchscreen_parse_properties() to automatically set some of the common
touchscreen properties. Also make flip_x and flip_y members of the private
device context and allow setting them through both the module parameters and
devicetree properties.
Signed-off-by: Daniel Mack <daniel@zonque.org>
---
drivers/input/touchscreen/eeti_ts.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index cc4fd33f9d6d..e7fade1a895c 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -28,6 +28,7 @@
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/input.h>
+#include <linux/input/touchscreen.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/timer.h>
@@ -48,6 +49,7 @@ struct eeti_ts {
struct i2c_client *client;
struct input_dev *input;
struct gpio_desc *attn_gpio;
+ bool flip_x, flip_y;
bool running;
};
@@ -74,10 +76,10 @@ static void eeti_ts_report_event(struct eeti_ts *eeti, u8 *buf)
x >>= res - EETI_TS_BITDEPTH;
y >>= res - EETI_TS_BITDEPTH;
- if (flip_x)
+ if (eeti->flip_x)
x = EETI_MAXVAL - x;
- if (flip_y)
+ if (eeti->flip_y)
y = EETI_MAXVAL - y;
if (buf[0] & REPORT_BIT_HAS_PRESSURE)
@@ -149,6 +151,7 @@ static void eeti_ts_close(struct input_dev *dev)
static int eeti_ts_probe(struct i2c_client *client,
const struct i2c_device_id *idp)
{
+ struct touchscreen_properties props;
struct device *dev = &client->dev;
struct eeti_ts *eeti;
struct input_dev *input;
@@ -179,6 +182,8 @@ static int eeti_ts_probe(struct i2c_client *client,
input_set_abs_params(input, ABS_Y, 0, EETI_MAXVAL, 0, 0);
input_set_abs_params(input, ABS_PRESSURE, 0, 0xff, 0, 0);
+ touchscreen_parse_properties(input, false, &props);
+
input->name = client->name;
input->id.bustype = BUS_I2C;
input->open = eeti_ts_open;
@@ -187,6 +192,9 @@ static int eeti_ts_probe(struct i2c_client *client,
eeti->client = client;
eeti->input = input;
+ eeti->flip_x = flip_x || props.invert_x;
+ eeti->flip_y = flip_y || props.invert_y;
+
eeti->attn_gpio = devm_gpiod_get_optional(dev, "attn", GPIOD_IN);
if (IS_ERR(eeti->attn_gpio))
return PTR_ERR(eeti->attn_gpio);
--
2.17.1
next prev parent reply other threads:[~2018-06-17 11:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-17 11:46 [PATCH 1/5] dt-bindings: input: touchscreen: add bindings for eeti touchscreen controller Daniel Mack
2018-06-17 11:46 ` [PATCH 2/5] input: touchscreen: eeti: add device tree matching table Daniel Mack
2018-06-17 11:46 ` Daniel Mack [this message]
2018-06-22 18:59 ` [PATCH 3/5] input: touchscreen: eeti: add support for DT properties to flip screen Dmitry Torokhov
2018-06-23 15:41 ` Daniel Mack
2018-06-17 11:46 ` [PATCH 4/5] input: touchscreen: eeti: fix link to documentation in header Daniel Mack
2018-06-17 11:46 ` [PATCH 5/5] input: touchscreen: eeti: update email address Daniel Mack
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=20180617114659.367-3-daniel@zonque.org \
--to=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--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).