Hi Gareth, On Sun, Oct 03, 2021 at 10:54:21PM +0100, Gareth Randall wrote: > 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@xxxxxxxxxxxxxxxxx> > --- > drivers/input/touchscreen/elo.c | 58 +++++++++++++++++++++++++++++++++ > 1 file changed, 58 insertions(+) > > 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; return -EIO; > + > + __set_bit(INPUT_PROP_DIRECT, dev->propbit); Please make this a separate patch that would set this property for all variants of ELO touchscreens (i.e. move it into elo_connect()). > + > + // Values taken from a GPEG model AOD22WZ-ST monitor > + input_set_abs_params(dev, ABS_X, 1365, 5828, 0, 0); I believe the datasheet says that the touch resolution is 4096 x 4096: http://www.boardcon.com/download/LCD_datasheet/15inch_SAW_LCD/Serial%20Controller%20ST6001S%20SPEC.pdf > + // max and min inverted because screen axis is inverted > + input_set_abs_params(dev, ABS_Y, 5013, 2260, 0, 0); I dont think this changes anything for reported coordinates by the driver. > + > + 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); > -- > 2.27.0 Thanks. -- Dmitry