From: Gareth Randall <gareth.randall@virgin.net>
To: linux-input@vger.kernel.org
Subject: [PATCH] Add support for touch screens using the General Touch ST6001S controller.
Date: Sun, 26 Sep 2021 16:38:59 +0100 [thread overview]
Message-ID: <173fac72-0e7d-05f9-ff6e-5fc846ad1840@virgin.net> (raw)
Add support for touch screens using the General Touch ST6001S
controller, as found in the GPEG model AOD22WZ-ST monitor. This
controller can output the ELO 10-byte protocol, but requires different
initialisation.
Signed-off-by: Gareth Randall <gareth@garethrandall.com>
----------------
I would like some advice from the contributors of this list:
Where my patch contains the following lines, I have set them to match a
22 inch screen (GPEG model AOD22WZ-ST) that I have been working on,
based on me moving my finger and watching the position of the mouse
pointer in X-windows. Are the maintainers satisfied with this or should
there also be an option to specify them as kernel parameters?
+ // Values taken from a GPEG model AOD22WZ-ST monitor
+ input_set_abs_params(dev, ABS_X, 1365, 5828, 0, 0);
+ // max and min inverted because screen axis is inverted
+ input_set_abs_params(dev, ABS_Y, 5013, 2260, 0, 0);
Note also that the /bin/inputattach command must be extended to support
using the newly added elo->id value (id=4). I can post my changes to
this to assist those reviewing this patch but have not here as I'm
trying to stick to the patch email format.
Thank you for your consideration.
----------------
diff --git a/drivers/input/touchscreen/elo.c
b/drivers/input/touchscreen/elo.c
index 96173232e53f..8c15e0eea6b4 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -44,6 +44,8 @@ MODULE_LICENSE("GPL");
#define ELO10_ACK_PACKET 'A'
#define ELI10_ID_PACKET 'I'
+#define ELO_GT_INIT_PACKET "\001XfE\r"
+
/*
* Per-touchscreen data.
*/
@@ -201,6 +203,7 @@ static irqreturn_t elo_interrupt(struct serio *serio,
switch (elo->id) {
case 0:
+ case 4:
elo_process_data_10(elo, data);
break;
@@ -255,6 +258,54 @@ static int elo_command_10(struct elo *elo, unsigned
char *packet)
return rc;
}
+/*
+ * Initialise the General Touch ST6001S controller.
+ */
+static int elo_command_10_gt(struct elo *elo)
+{
+ int rc = -1;
+ int i;
+ unsigned char *packet = ELO_GT_INIT_PACKET;
+
+ mutex_lock(&elo->cmd_mutex);
+
+ serio_pause_rx(elo->serio);
+ init_completion(&elo->cmd_done);
+ serio_continue_rx(elo->serio);
+
+ for (i = 0; i < (int)strlen(packet); i++) {
+ if (serio_write(elo->serio, packet[i]))
+ goto out;
+ }
+
+ wait_for_completion_timeout(&elo->cmd_done, HZ);
+ rc = 0;
+
+ out:
+ mutex_unlock(&elo->cmd_mutex);
+ return rc;
+}
+
+static int elo_setup_10_gt(struct elo *elo)
+{
+ struct input_dev *dev = elo->dev;
+
+ if (elo_command_10_gt(elo))
+ return -1;
+
+ __set_bit(INPUT_PROP_DIRECT, dev->propbit);
+
+ // Values taken from a GPEG model AOD22WZ-ST monitor
+ input_set_abs_params(dev, ABS_X, 1365, 5828, 0, 0);
+ // max and min inverted because screen axis is inverted
+ input_set_abs_params(dev, ABS_Y, 5013, 2260, 0, 0);
+
+ dev_info(&elo->serio->dev,
+ "GeneralTouch ST6001S touchscreen");
+
+ return 0;
+}
+
static int elo_setup_10(struct elo *elo)
{
static const char *elo_types[] = { "Accu", "Dura", "Intelli",
"Carroll" };
@@ -361,6 +412,13 @@ static int elo_connect(struct serio *serio, struct
serio_driver *drv)
input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
break;
+
+ case 4: /* 10-byte protocol with General Touch initialisation */
+ if (elo_setup_10_gt(elo)) {
+ err = -EIO;
+ goto fail3;
+ }
+ break;
}
err = input_register_device(elo->dev);
next reply other threads:[~2021-09-26 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 15:38 Gareth Randall [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-25 15:51 [PATCH] Add support for touch screens using the General Touch ST6001S controller Gareth Randall
2023-11-09 16:13 ` Gareth Randall
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=173fac72-0e7d-05f9-ff6e-5fc846ad1840@virgin.net \
--to=gareth.randall@virgin.net \
--cc=linux-input@vger.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