Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236840 > unrolled thread

[PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support

Started byKarsten Merker <merker@debian.org>
First post2015-10-01 00:40 +0200
Last post2015-10-01 03:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support Karsten Merker <merker@debian.org> - 2015-10-01 00:40 +0200
    [PATCH 2/2] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Karsten Merker <merker@debian.org> - 2015-10-01 00:40 +0200
    Re: [PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion  support Bastien Nocera <hadess@hadess.net> - 2015-10-01 03:00 +0200

#1236840 — [PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support

FromKarsten Merker <merker@debian.org>
Date2015-10-01 00:40 +0200
Subject[PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support
Message-ID<qeycy-1Kc-17@gated-at.bofh.it>
Hello,

the goodix touchscreen driver has gained device-tree support in kernel
4.1, but doesn't currently support the touchscreen-swapped-x-y,
touchscreen-inverted-x and touchscreen-inverted-y properties.

On systems which combine a portrait-mode display with a landscape-mode
touchscreen, such as e.g. the MSI Primo 81 tablet, support for these
features is necessary to have the touchscreen and the display use the
same coordinate system.

With support for axis inversion, the "rotated_screen" flag in the
driver can also be removed, as "rotated_screen" is just a special case
of x/y axis inversion.

This patchset sits on top of the "[PATCH v6 0/9] Goodix touchscreen
enhancements" series by Irina Tirdea:
http://www.spinics.net/lists/linux-input/msg40992.html

I have successfully tested the axis swapping on an (arm-based) MSI
Primo 81 tablet, but I lack appropriate hardware to do a real-world
test of the "rotated_screen" code path, so I would apprechiate very
much if somebody with appropriate hardware could give it a try.

This is my first go at modifying an input driver; any kind of
feedback and hints is welcome.

Regards,
Karsten

Karsten Merker (2):
  Input: goodix - add dt axis swapping and axis inversion support
  Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"

 drivers/input/touchscreen/goodix.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1236841 — [PATCH 2/2] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"

FromKarsten Merker <merker@debian.org>
Date2015-10-01 00:40 +0200
Subject[PATCH 2/2] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
Message-ID<qeycy-1Kc-23@gated-at.bofh.it>
In reply to#1236840
The goodix touchscreen driver uses a "rotated_screen" flag for
systems on which the touchscreen is mounted rotated by 180
degrees with respect to the display.  With the addition of
support for the dt properties "touchscreen-inverted-x" and
"touchscreen-inverted-y", a separate "rotated_screen" flag
is not necessary any more. This patch replaces it by setting
the inverted-x and inverted-x flags instead.

Signed-off-by: Karsten Merker <merker@debian.org>
---
 drivers/input/touchscreen/goodix.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index f2b1590..6ce909c 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -39,7 +39,6 @@ struct goodix_ts_data {
 	int abs_y_max;
 	unsigned int max_touch_num;
 	unsigned int int_trigger_type;
-	bool rotated_screen;
 	int cfg_len;
 	struct gpio_desc *gpiod_int;
 	struct gpio_desc *gpiod_rst;
@@ -261,11 +260,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
 	int input_y = get_unaligned_le16(&coor_data[3]);
 	int input_w = get_unaligned_le16(&coor_data[5]);
 
-	if (ts->rotated_screen) {
-		input_x = ts->abs_x_max - input_x;
-		input_y = ts->abs_y_max - input_y;
-	}
-
 	/* Inversions have to happen before axis swapping */
 	if (ts->inverted_x)
 		input_x = ts->abs_x_max - input_x;
@@ -705,10 +699,12 @@ static void goodix_read_config(struct goodix_ts_data *ts)
 		ts->max_touch_num = GOODIX_MAX_CONTACTS;
 	}
 
-	ts->rotated_screen = dmi_check_system(rotated_screen);
-	if (ts->rotated_screen)
+	if (dmi_check_system(rotated_screen)) {
+		ts->inverted_x = true;
+		ts->inverted_y = true;
 		dev_dbg(&ts->client->dev,
 			 "Applying '180 degrees rotated screen' quirk\n");
+	}
 }
 
 /**
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1236887 — Re: [PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support

FromBastien Nocera <hadess@hadess.net>
Date2015-10-01 03:00 +0200
SubjectRe: [PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support
Message-ID<qeAo1-4MR-9@gated-at.bofh.it>
In reply to#1236840
On Thu, 2015-10-01 at 00:29 +0200, Karsten Merker wrote:
> Hello,
> 
> the goodix touchscreen driver has gained device-tree support in
> kernel
> 4.1, but doesn't currently support the touchscreen-swapped-x-y,
> touchscreen-inverted-x and touchscreen-inverted-y properties.

Can't test for now, but:

Reviewed-by: Bastien Nocera <hadess@hadess.net>

We'll have to wait until Irina's patchset lands though, and we'll test
at that point.

Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web