This fixes some issues I had when getting the CYTTSP
(also known as CY8CTMA340) to work with a modern device
tree and userspace.
The device stands out as there are no in-kernel users of
either platform data nor device tree.
I am going to submit a device tree client, if you have
other concerns, then step forward now.
With these patches the touchscreen works fine with
PostmarketOS on the Ux500 HREF using Wayland and Phosh
as UI.
This work is really being done to get a baseline for
refurbishing the PL022 SPI driver but sometimes you
have to fix a bunch of stuff.
Linus Walleij (7):
Input: cyttsp - Probe from compatibles
Input: cyttsp - Obtain regulators
Input: cyttsp - Error message on boot mode exit error
Input: cyttsp - Reduce reset pulse timings
Input: cyttsp - Drop the phys path
Input: cyttsp - Set abs params for ABS_MT_TOUCH_MAJOR
Input: cyttsp - Flag the device properly
drivers/input/touchscreen/cyttsp_core.c | 52 +++++++++++++++++++++----
drivers/input/touchscreen/cyttsp_core.h | 3 +-
drivers/input/touchscreen/cyttsp_i2c.c | 7 ++++
drivers/input/touchscreen/cyttsp_spi.c | 7 ++++
4 files changed, 60 insertions(+), 9 deletions(-)
--
2.29.2
The CYTTSP TMA340 chips have two supplies: VCPIN and
VDD for analog and digital voltage respectively.
Add some minimal code to obtain and enable these
regulators if need be.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_core.c | 30 +++++++++++++++++++++++--
drivers/input/touchscreen/cyttsp_core.h | 2 ++
2 files changed, 30 insertions(+), 2 deletions(-)
@@ -23,6 +23,7 @@#include<linux/types.h>#include<linux/device.h>#include<linux/input/cyttsp.h>+#include<linux/regulator/consumer.h>#define CY_NUM_RETRY 16 /* max number of retries for read ops */
The driver (both SPI and I2C interface) should probe from
the compatible strings, cypress,cy8ctma340 etc when using
device tree, not as now, where it is probing implicitly from
the I2C/SPI node name "cypress,cyttsp-i2c" etc.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_i2c.c | 7 +++++++
drivers/input/touchscreen/cyttsp_spi.c | 7 +++++++
2 files changed, 14 insertions(+)
The data sheet for CY8CTMA340 specifies that the reset pulse
shall be at least 1 ms. Specify 1-2 ms with usleep_range()
to cut some slack for the scheduler.
Curiously the datasheet does not specify how long we have to
wait after a hard reset until the chip is up, but I have found
a vendor tree (Samsung GT-S7710) that has code for this touch
screen and there this is set to 5 ms so I use this with
the same 1 ms fuzz.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_core.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
When I test to use the CY8CTMA340 with PostmarketOS I don't
have any problem whatsoever in dropping this phys path,
it finds and uses the touchscreen just as well. I suppose
it is because userspace is using modern input libraries.
I challenge the maintainers to point out a valid and still
used userspace that actually need this. I say we drop it.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_core.c | 2 --
drivers/input/touchscreen/cyttsp_core.h | 1 -
2 files changed, 3 deletions(-)
This device is certainly a very simple touchscreen so
we set INPUT_MT_DIRECT.
The sibling driver for CY8CTMA140 also sets
INPUT_MT_DROP_UNUSED and experimenting with this driver
it clearly does not hurt: the touchscreen is working just
fine so let's set it for this one as well.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Provide a proper error message when attempting to exit
boot loader mode and failing, which is something that
happened to me.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
The driver is certainly reporting pressure in
cyttsp_report_tchdata() with
input_report_abs(input, ABS_MT_TOUCH_MAJOR, tch->z);
so we should also advertise this capability.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_core.c | 3 +++
1 file changed, 3 insertions(+)
@@ -667,6 +667,9 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,input_set_capability(input_dev,EV_ABS,ABS_MT_POSITION_X);input_set_capability(input_dev,EV_ABS,ABS_MT_POSITION_Y);+/* One byte for width 0..255 so this is the limit */+input_set_abs_params(input_dev,ABS_MT_TOUCH_MAJOR,0,255,0,0);+touchscreen_parse_properties(input_dev,true,NULL);error=input_mt_init_slots(input_dev,CY_MAX_ID,0);
From: Javier Martinez Canillas <javier@dowhile0.org> Date: 2021-03-30 10:52:12
Hello Linus,
On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
quoted hunk
The driver (both SPI and I2C interface) should probe from
the compatible strings, cypress,cy8ctma340 etc when using
device tree, not as now, where it is probing implicitly from
the I2C/SPI node name "cypress,cyttsp-i2c" etc.
Signed-off-by: Linus Walleij <redacted>
---
drivers/input/touchscreen/cyttsp_i2c.c | 7 +++++++
drivers/input/touchscreen/cyttsp_spi.c | 7 +++++++
2 files changed, 14 insertions(+)
Wonder if it is worth adding a constant macro for the 2.
Patch looks good to me:
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
Best regards,
Javier
From: Javier Martinez Canillas <javier@dowhile0.org> Date: 2021-03-30 10:57:34
On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
Provide a proper error message when attempting to exit
boot loader mode and failing, which is something that
happened to me.
Signed-off-by: Linus Walleij <redacted>
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
From: Javier Martinez Canillas <javier@dowhile0.org> Date: 2021-03-30 10:59:15
On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
The data sheet for CY8CTMA340 specifies that the reset pulse
shall be at least 1 ms. Specify 1-2 ms with usleep_range()
to cut some slack for the scheduler.
Curiously the datasheet does not specify how long we have to
wait after a hard reset until the chip is up, but I have found
a vendor tree (Samsung GT-S7710) that has code for this touch
screen and there this is set to 5 ms so I use this with
the same 1 ms fuzz.
Signed-off-by: Linus Walleij <redacted>
---
Makes sense.
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
From: Javier Martinez Canillas <javier@dowhile0.org> Date: 2021-03-30 11:00:51
On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
When I test to use the CY8CTMA340 with PostmarketOS I don't
have any problem whatsoever in dropping this phys path,
it finds and uses the touchscreen just as well. I suppose
it is because userspace is using modern input libraries.
I challenge the maintainers to point out a valid and still
used userspace that actually need this. I say we drop it.
Signed-off-by: Linus Walleij <redacted>
---
Agreed. Let's just drop it and if someone needs this then can bring it
back from the git history.
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
From: Javier Martinez Canillas <javier@dowhile0.org> Date: 2021-03-30 11:01:57
On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
The driver is certainly reporting pressure in
cyttsp_report_tchdata() with
input_report_abs(input, ABS_MT_TOUCH_MAJOR, tch->z);
so we should also advertise this capability.
Signed-off-by: Linus Walleij <redacted>
---
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
From: Javier Martinez Canillas <javier@dowhile0.org> Date: 2021-03-30 11:02:31
On Tue, Mar 30, 2021 at 10:54 AM Linus Walleij [off-list ref] wrote:
This device is certainly a very simple touchscreen so
we set INPUT_MT_DIRECT.
The sibling driver for CY8CTMA140 also sets
INPUT_MT_DROP_UNUSED and experimenting with this driver
it clearly does not hurt: the touchscreen is working just
fine so let's set it for this one as well.
Signed-off-by: Linus Walleij <redacted>
---
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>