From: Franklin S Cooper Jr <fcooper-l0cyMroinI0@public.gmane.org>
To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org,
octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
irina.tirdea-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
merker-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
nsekhar-l0cyMroinI0@public.gmane.org,
nm-l0cyMroinI0@public.gmane.org
Cc: Franklin S Cooper Jr <fcooper-l0cyMroinI0@public.gmane.org>
Subject: [PATCH 4/4] Input: goodix - Support interchanging x and y coordinates in hardware
Date: Thu, 20 Oct 2016 14:59:17 -0500 [thread overview]
Message-ID: <20161020195917.20051-5-fcooper@ti.com> (raw)
In-Reply-To: <20161020195917.20051-1-fcooper-l0cyMroinI0@public.gmane.org>
On systems with a fixed display/touchscreen orientation it is important to
pass in the "correct" x and y coordinates based on the orientation.
Currently, to support landscape and portrait touchscreen-swapped-x-y
simply does the following:
Assuming touchscreen is as follows:
X: 1280 Y:800 programmed in touchscreen controller and also interchange
bit cleared. Assuming ts mounted in portrait mode.
1280 (X)
------
| |
| | 800 (Y)
| |
| |
------
800 (Y)
------
| |
| | 1280 (X)
| |
| |
------
However, the above isn't really what we want especially in distros that
assumes a fixed orientation. In this case what we really want is to
interchange the x and y coordinates so the Y coordinate can return a max
value of 1280 and X can return a max value of 800.
800 (X)
------
| |
| | 1280 (Y)
| |
| |
------
Since the driver is limited to the value reported by the touchscreen
controller this issue can't be fixed purely in the driver. Therefore,
add a new DT property that supports interchanging X and Y coordinates
internally within the hardware.
Signed-off-by: Franklin S Cooper Jr <fcooper-l0cyMroinI0@public.gmane.org>
---
.../devicetree/bindings/input/touchscreen/goodix.txt | 2 ++
drivers/input/touchscreen/goodix.c | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index ebc7cb7..b8be2ab 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -25,6 +25,8 @@ Optional properties:
- touchscreen-inverted-y : Y axis is inverted (boolean)
- touchscreen-swapped-x-y : X and Y axis are swapped (boolean)
(swapping is done after inverting the axis)
+ - touchscreen-inter-x-y : X and Y maximum values programmed in the device
+ are interchanged internally in hardware. (boolean)
Example:
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index c2428e1..3f93375 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -39,6 +39,7 @@ struct goodix_ts_data {
bool swapped_x_y;
bool inverted_x;
bool inverted_y;
+ bool interchange_x_y;
unsigned int max_touch_num;
unsigned int int_trigger_type;
int cfg_len;
@@ -76,6 +77,9 @@ struct goodix_ts_data {
#define MAX_CONTACTS_LOC 5
#define TRIGGER_LOC 6
+/* Register Bits */
+#define XY_COORD_INTER 3
+
static const unsigned long goodix_irq_flags[] = {
IRQ_TYPE_EDGE_RISING,
IRQ_TYPE_EDGE_FALLING,
@@ -500,6 +504,10 @@ static void goodix_tweak_config(struct goodix_ts_data *ts)
put_unaligned_le16(ts->abs_x_max, &config[RESOLUTION_LOC]);
put_unaligned_le16(ts->abs_y_max, &config[RESOLUTION_LOC + 2]);
+ if (ts->interchange_x_y)
+ config[TRIGGER_LOC] = config[TRIGGER_LOC] |
+ (1 << XY_COORD_INTER);
+
check_sum = goodix_calculate_checksum(ts->cfg_len, config);
config[raw_cfg_len] = check_sum;
@@ -700,6 +708,11 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
}
}
+ ts->interchange_x_y = device_property_read_bool(&ts->client->dev,
+ "touchscreen-inter-x-y");
+ if (ts->interchange_x_y)
+ alter_config = true;
+
if (alter_config)
goodix_tweak_config(ts);
--
2.10.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-10-20 19:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-20 19:59 [PATCH 0/4] Input: goodix - Support dynamic reconfiguration Franklin S Cooper Jr
2016-10-20 19:59 ` [PATCH 1/4] Input: goodix - Restructure cfg checksum function Franklin S Cooper Jr
[not found] ` <20161020195917.20051-2-fcooper-l0cyMroinI0@public.gmane.org>
2016-10-27 10:32 ` Bastien Nocera
2016-10-20 19:59 ` [PATCH 2/4] Input: goodix - Allow tweaking of configuration file dynamically Franklin S Cooper Jr
2016-10-27 10:33 ` Bastien Nocera
[not found] ` <1477564424.2458.9.camel-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
2016-10-27 16:58 ` Franklin S Cooper Jr
2016-10-27 17:41 ` Bastien Nocera
2016-10-20 19:59 ` [PATCH 3/4] Input: goodix - Tweak configuration to use passed in touchscreen resolution Franklin S Cooper Jr
2016-10-26 23:10 ` Rob Herring
[not found] ` <20161020195917.20051-4-fcooper-l0cyMroinI0@public.gmane.org>
2016-10-27 10:34 ` Bastien Nocera
[not found] ` <1477564458.2458.10.camel-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org>
2016-10-27 17:03 ` Franklin S Cooper Jr
[not found] ` <20161020195917.20051-1-fcooper-l0cyMroinI0@public.gmane.org>
2016-10-20 19:59 ` Franklin S Cooper Jr [this message]
[not found] ` <20161020195917.20051-5-fcooper-l0cyMroinI0@public.gmane.org>
2016-10-26 23:18 ` [PATCH 4/4] Input: goodix - Support interchanging x and y coordinates in hardware Rob Herring
2016-10-27 10:34 ` Bastien Nocera
2016-10-27 17:42 ` Franklin S Cooper Jr
[not found] ` <317acd32-f363-3b2b-9e30-106d5b335342-l0cyMroinI0@public.gmane.org>
2016-10-28 0:08 ` Bastien Nocera
2016-10-27 17:54 ` Franklin S Cooper Jr
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=20161020195917.20051-5-fcooper@ti.com \
--to=fcooper-l0cymroini0@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=hadess-0MeiytkfxGOsTnJN9+BGXg@public.gmane.org \
--cc=irina.tirdea-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=merker-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org \
--cc=nm-l0cyMroinI0@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).