mbox series

[0/4] Add support for the Cypress cyttsp5

Message ID 20211025114214.44617-1-alistair@alistair23.me
Headers show
Series Add support for the Cypress cyttsp5 | expand

Message

Alistair Francis Oct. 25, 2021, 11:42 a.m. UTC
This patch series builds on top of [1] and adds support for the cyttsp5
touchscreen controller for the reMarkable 2.

I first tried to add an I2C HID device. Although the cyttsp5 has some HID
looking aspects it is not HID compatible. Just in trying to probe the device
I found:
 - The HID descriptor has extra padding
 - The HID descriptor sets the high bytes of the descriptor length
 - The HID descriptor has extra unrecognised tags
 - The HID reset command doesn't appear to work

I don't think there is a way to use the I2C HID framework with the cyttsp5.
For anyone interested you can see the work here [2]. In that branch though I
can only obtain a HID descriptor, nothing else works without more core
changes.

So instead I rebased the series from [1]. Converted to the new yaml DTS
documentation, added regulator support and fixed a x/y miscalculation bug.

1: https://lwn.net/ml/linux-kernel/20180703094309.18514-1-mylene.josserand@bootlin.com/
2: https://github.com/alistair23/linux/commits/rM2-mainline-cyttsp5-hid

Alistair Francis (2):
  ARM: imx_v6_v7_defconfig: Enable the cyttsp5 touchscreen
  ARM: dts: imx7d: remarkable2: Enable the cyttsp5

Mylène Josserand (2):
  Input: Add driver for Cypress Generation 5 touchscreen
  Documentation: DT: bindings: input: Add documentation for cyttsp5

 .../input/touchscreen/cypress,cyttsp5.yaml    |   72 ++
 arch/arm/boot/dts/imx7d-remarkable2.dts       |   88 ++
 arch/arm/configs/imx_v6_v7_defconfig          |    1 +
 drivers/input/touchscreen/Kconfig             |   14 +
 drivers/input/touchscreen/Makefile            |    1 +
 drivers/input/touchscreen/cyttsp5.c           | 1129 +++++++++++++++++
 6 files changed, 1305 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.yaml
 create mode 100644 drivers/input/touchscreen/cyttsp5.c

Comments

Rob Herring Oct. 25, 2021, 6:16 p.m. UTC | #1
On Mon, 25 Oct 2021 21:42:12 +1000, Alistair Francis wrote:
> From: Mylène Josserand <mylene.josserand@free-electrons.com>
> 
> Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
> documentation. It can use I2C or SPI bus.
> This touchscreen can handle some defined zone that are designed and
> sent as button. To be able to customize the keycode sent, the
> "linux,code" property in a "button" sub-node can be used.
> 
> Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> Message-Id: <20170529144538.29187-3-mylene.josserand@free-electrons.com>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> ---
>  .../input/touchscreen/cypress,cyttsp5.yaml    | 72 +++++++++++++++++++
>  1 file changed, 72 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.example.dts:29.35-36 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:385: Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1441: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1545697

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Randy Dunlap Oct. 25, 2021, 8:10 p.m. UTC | #2
On 10/25/21 4:42 AM, Alistair Francis wrote:
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index d4e74738c5a8..231cb0c1750b 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -284,6 +284,20 @@ config TOUCHSCREEN_CYTTSP4_SPI
>   	  To compile this driver as a module, choose M here: the
>   	  module will be called cyttsp4_spi.
>   
> +config TOUCHSCREEN_CYTTSP5
> +	tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
> +	depends on OF
> +	select REGMAP_I2C
> +	select CRC_ITU_T
> +	help
> +	  Driver for Parade TrueTouch Standard Product
> +	  Generation 5 touchscreen controllers.
> +	  I2C bus interface support only.
> +	  Say Y here if you have a Cypress Gen5 touchscreen.
> +	  If unsure, say N.
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called cyttsp5.

Hi,
Why is there no line:
	depends on I2C
here?

thanks.
Linus Walleij Oct. 25, 2021, 11:18 p.m. UTC | #3
Hi Alistair,

On Mon, Oct 25, 2021 at 1:42 PM Alistair Francis <alistair@alistair23.me> wrote:

> From: Mylène Josserand <mylene.josserand@free-electrons.com>
>
> Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
> documentation. It can use I2C or SPI bus.
> This touchscreen can handle some defined zone that are designed and
> sent as button. To be able to customize the keycode sent, the
> "linux,code" property in a "button" sub-node can be used.
>
> Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> Message-Id: <20170529144538.29187-3-mylene.josserand@free-electrons.com>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>

> +title: Cypress cyttsp touchscreen controller, generation 5
(...)
> +  compatible:
> +    const: cypress,cyttsp5

Is this the real product name? When I rewrote the bindings for
the original "CYTTSP", actually "Cypress TrueTouch Standard Product"
it came out that the actual product names were CY8CTMA340
and CY8CTMA341. "CYTTSP" was a marketing name for the
whole family.

See
Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml

If the actual products have some product names such as
CY8* then use these as compatibles instead and just write in the
decription that it is Cypress TrueTouch Standard Product series 5.

Yours,
Linus Walleij
Andreas Kemnade Oct. 26, 2021, 7:16 a.m. UTC | #4
On Tue, 26 Oct 2021 01:18:24 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> Hi Alistair,
> 
> On Mon, Oct 25, 2021 at 1:42 PM Alistair Francis <alistair@alistair23.me> wrote:
> 
> > From: Mylène Josserand <mylene.josserand@free-electrons.com>
> >
> > Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
> > documentation. It can use I2C or SPI bus.
> > This touchscreen can handle some defined zone that are designed and
> > sent as button. To be able to customize the keycode sent, the
> > "linux,code" property in a "button" sub-node can be used.
> >
> > Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> > Message-Id: <20170529144538.29187-3-mylene.josserand@free-electrons.com>
> > Signed-off-by: Alistair Francis <alistair@alistair23.me>  
> 
> > +title: Cypress cyttsp touchscreen controller, generation 5  
> (...)
> > +  compatible:
> > +    const: cypress,cyttsp5  
> 
> Is this the real product name? When I rewrote the bindings for
> the original "CYTTSP", actually "Cypress TrueTouch Standard Product"
> it came out that the actual product names were CY8CTMA340
> and CY8CTMA341. "CYTTSP" was a marketing name for the
> whole family.
> 
> See
> Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml
> 
> If the actual products have some product names such as
> CY8* then use these as compatibles instead and just write in the
> decription that it is Cypress TrueTouch Standard Product series 5.
> 
Since I have uptreamed 4 devicetrees containing that touchscreen (and
marked that as todo). I tried to look it up:
https://fccid.io/NOIKBN249/Internal-Photos/Internal-Photos-3802584.pdf

Page 4 might be interesting. Something below that 3d code (zbarimg does
not recognize it) Peeling up the label reveals:
TT21000
-44LQI
1802 TWN
6491U0 (two illegible characters)

You find it in the net: 
https://www.digipart.com/part/TT21000-48LQI36T

Regards,
Andreas
Alistair Francis Oct. 27, 2021, 12:28 p.m. UTC | #5
On Tue, Oct 26, 2021 at 5:16 PM Andreas Kemnade <andreas@kemnade.info> wrote:
>
> On Tue, 26 Oct 2021 01:18:24 +0200
> Linus Walleij <linus.walleij@linaro.org> wrote:
>
> > Hi Alistair,
> >
> > On Mon, Oct 25, 2021 at 1:42 PM Alistair Francis <alistair@alistair23.me> wrote:
> >
> > > From: Mylène Josserand <mylene.josserand@free-electrons.com>
> > >
> > > Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
> > > documentation. It can use I2C or SPI bus.
> > > This touchscreen can handle some defined zone that are designed and
> > > sent as button. To be able to customize the keycode sent, the
> > > "linux,code" property in a "button" sub-node can be used.
> > >
> > > Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> > > Message-Id: <20170529144538.29187-3-mylene.josserand@free-electrons.com>
> > > Signed-off-by: Alistair Francis <alistair@alistair23.me>
> >
> > > +title: Cypress cyttsp touchscreen controller, generation 5
> > (...)
> > > +  compatible:
> > > +    const: cypress,cyttsp5
> >
> > Is this the real product name? When I rewrote the bindings for
> > the original "CYTTSP", actually "Cypress TrueTouch Standard Product"
> > it came out that the actual product names were CY8CTMA340
> > and CY8CTMA341. "CYTTSP" was a marketing name for the
> > whole family.
> >
> > See
> > Documentation/devicetree/bindings/input/touchscreen/cypress,cy8ctma340.yaml
> >
> > If the actual products have some product names such as
> > CY8* then use these as compatibles instead and just write in the
> > decription that it is Cypress TrueTouch Standard Product series 5.
> >
> Since I have uptreamed 4 devicetrees containing that touchscreen (and
> marked that as todo). I tried to look it up:
> https://fccid.io/NOIKBN249/Internal-Photos/Internal-Photos-3802584.pdf
>
> Page 4 might be interesting. Something below that 3d code (zbarimg does
> not recognize it) Peeling up the label reveals:
> TT21000
> -44LQI
> 1802 TWN
> 6491U0 (two illegible characters)
>
> You find it in the net:
> https://www.digipart.com/part/TT21000-48LQI36T

Thanks!

So I'll change the name to cypress,tt21000

Alistair

>
> Regards,
> Andreas
>
Andreas Kemnade Oct. 31, 2021, 4:49 p.m. UTC | #6
Hi,

On Mon, 25 Oct 2021 21:42:12 +1000
Alistair Francis <alistair@alistair23.me> wrote:

> From: Mylène Josserand <mylene.josserand@free-electrons.com>
> 
> Add the Cypress TrueTouch Generation 5 touchscreen device tree bindings
> documentation. It can use I2C or SPI bus.
> This touchscreen can handle some defined zone that are designed and
> sent as button. To be able to customize the keycode sent, the
> "linux,code" property in a "button" sub-node can be used.
> 
> Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> Message-Id: <20170529144538.29187-3-mylene.josserand@free-electrons.com>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> ---
>  .../input/touchscreen/cypress,cyttsp5.yaml    | 72 +++++++++++++++++++
>  1 file changed, 72 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.yaml
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.yaml b/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.yaml
> new file mode 100644
> index 000000000000..0bddbd76a0c3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/cypress,cyttsp5.yaml
> @@ -0,0 +1,72 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/touchscreen/cypress,cyttsp5.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Cypress cyttsp touchscreen controller, generation 5
> +
> +maintainers:
> +  - Alistair Francis <alistair@alistair23.me>
> +
> +allOf:
> +  - $ref: touchscreen.yaml#
> +
> +properties:
> +  compatible:
> +    const: cypress,cyttsp5
> +

you use buttons later, so it should be specified somewhere here.

> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  vdd-supply:
> +    description: Regulator for voltage.
> +
> +  reset-gpios:
> +    maxItems: 1
> +
> +  linux,code:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: EV_ABS specific event code generated by the axis.
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - vdd-supply
> +
> +additionalProperties: false
If you want to allow things from touchscreen.yaml, you should use
unevaluatedProperties: false.
> +
> +examples:
> +  - |

some includes are missing for the constants below here.
> +    i2c {

Regards,
Andreas