On Sun, Aug 29, 2021 at 07:19:18PM +1000, Alistair Francis wrote: > When we query the device let's also read the descriptor from the device. > This tells us useful information, including the version, which we use to > determine a generation. > > This is based on the driver from Wacom. > > Signed-off-by: Alistair Francis <alistair@xxxxxxxxxxxxx> > --- > drivers/input/touchscreen/wacom_i2c.c | 64 +++++++++++++++++++++++++++ > 1 file changed, 64 insertions(+) > > diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c > index 28255c77d426..72ba4a36459b 100644 > --- a/drivers/input/touchscreen/wacom_i2c.c > +++ b/drivers/input/touchscreen/wacom_i2c.c > @@ -16,6 +16,7 @@ > #include <linux/of.h> > #include <asm/unaligned.h> > > +#define WACOM_DESC_REG 0x01 > #define WACOM_CMD_QUERY0 0x04 > #define WACOM_CMD_QUERY1 0x00 > #define WACOM_CMD_QUERY2 0x33 > @@ -24,11 +25,46 @@ > #define WACOM_CMD_THROW1 0x00 > #define WACOM_QUERY_SIZE 19 > > +#define WACOM_MAX_DATA_SIZE_BG9 10 > +#define WACOM_MAX_DATA_SIZE_G12 15 > +#define WACOM_MAX_DATA_SIZE_AG14 17 > +#define WACOM_MAX_DATA_SIZE 22 > + > +/* Generation selction */ > +/* Before and at G9 generation */ > +#define WACOM_BG9 0 > +/* G12 generation the IC supports "height"*/ > +#define WACOM_G12 1 > +/* After and at G14 generation the IC supports "height" and > + * it is defined as "Z" axis > + */ > +#define WACOM_AG14 2 > + > +struct wacom_desc { > + u16 descLen; > + u16 version; > + u16 reportLen; > + u16 reportReg; > + u16 inputReg; > + u16 maxInputLen; > + u16 outputReg; > + u16 maxOutputLen; > + u16 commReg; > + u16 dataReg; > + u16 vendorID; > + u16 productID; > + u16 fwVersion; > + u16 misc_high; > + u16 misc_low; > +}; This looks like I2C HID descriptor. Is the device actually I2C HID compatible? If so we should use that and abandon this driver. Ping, Tatsunosuke, please advise. Thanks. -- Dmitry