all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 9ccef92ad7edf95141861bdb0a5b8c682508690a 3331 bytes (raw)
name: gnu/packages/patches/linux-libre-arm64-pinenote-touchscreen-2.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
 
From d6bb8a6b5a5210fea70bc590350bfca3a9e3a7a2 Mon Sep 17 00:00:00 2001
From: Peter Geis <pgwipeout@gmail.com>
Date: Sat, 15 Jan 2022 21:50:45 -0500
Subject: [PATCH] Input: cyttsp5: support touchscreen device tree overrides

It is possible for the cyttsp5 chip to not have a configuration burned
to it.
This leads to a sitatuion where all calibration values return zero,
leading to a broken touchscreen configuration.

The current driver does not support utilizing overrides from the device
tree.
Extend the driver to support this, and permit it to do some basic sanity
checking of the values for the touchscreen and abort if they are
invalid.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 drivers/input/touchscreen/cyttsp5.c | 62 ++++++++++++++++++++++++++---
 1 file changed, 57 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
index 3ac45108090c..e837985d199a 100644
--- a/drivers/input/touchscreen/cyttsp5.c
+++ b/drivers/input/touchscreen/cyttsp5.c
@@ -507,15 +507,66 @@ static int cyttsp5_get_sysinfo_regs(struct cyttsp5 *ts)
 	struct cyttsp5_sensing_conf_data_dev *scd_dev =
 		(struct cyttsp5_sensing_conf_data_dev *)
 		&ts->response_buf[HID_SYSINFO_SENSING_OFFSET];
+	u32 tmp;
 
 	cyttsp5_si_get_btn_data(ts);
 
 	scd->max_tch = scd_dev->max_num_of_tch_per_refresh_cycle;
-	scd->res_x = get_unaligned_le16(&scd_dev->res_x);
-	scd->res_y = get_unaligned_le16(&scd_dev->res_y);
-	scd->max_z = get_unaligned_le16(&scd_dev->max_z);
-	scd->len_x = get_unaligned_le16(&scd_dev->len_x);
-	scd->len_y = get_unaligned_le16(&scd_dev->len_y);
+
+	if (scd->max_tch == 0) {
+		dev_dbg(ts->dev, "Max touch points cannot be zero\n");
+		scd->max_tch = 2;
+	}
+
+	if(device_property_read_u32(ts->dev, "touchscreen-size-x", &tmp))
+		scd->res_x = get_unaligned_le16(&scd_dev->res_x);
+	else
+		scd->res_x = tmp;
+
+	if (scd->res_x == 0) {
+		dev_err(ts->dev, "ABS_X cannot be zero\n");
+		return -ENODATA;
+	}
+
+	if(device_property_read_u32(ts->dev, "touchscreen-size-y", &tmp))
+		scd->res_y = get_unaligned_le16(&scd_dev->res_y);
+	else
+		scd->res_y = tmp;
+
+	if (scd->res_y == 0) {
+		dev_err(ts->dev, "ABS_Y cannot be zero\n");
+		return -ENODATA;
+	}
+
+	if(device_property_read_u32(ts->dev, "touchscreen-max-pressure", &tmp))
+		scd->max_z = get_unaligned_le16(&scd_dev->max_z);
+	else
+		scd->max_z = tmp;
+
+	if (scd->max_z == 0) {
+		dev_err(ts->dev, "ABS_PRESSURE cannot be zero\n");
+		return -ENODATA;
+	}
+
+	if(device_property_read_u32(ts->dev, "touchscreen-x-mm", &tmp))
+		scd->len_x = get_unaligned_le16(&scd_dev->len_x);
+	else
+		scd->len_x = tmp;
+
+	if (scd->len_x == 0) {
+		dev_dbg(ts->dev, "Touchscreen size x cannot be zero\n");
+		scd->len_x = scd->res_x + 1;
+	}
+
+	if(device_property_read_u32(ts->dev, "touchscreen-y-mm", &tmp))
+		scd->len_y = get_unaligned_le16(&scd_dev->len_y);
+	else
+		scd->len_y = tmp;
+
+	if (scd->len_y == 0) {
+		dev_dbg(ts->dev, "Touchscreen size y cannot be zero\n");
+		scd->len_y = scd->res_y + 1;
+	}
 
 	return 0;
 }
@@ -877,6 +928,7 @@ static int cyttsp5_i2c_probe(struct i2c_client *client,
 
 static const struct of_device_id cyttsp5_of_match[] = {
 	{ .compatible = "cypress,tt21000", },
+	{ .compatible = "cypress,tma448", },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, cyttsp5_of_match);
-- 
GitLab


debug log:

solving 9ccef92ad7 ...
found 9ccef92ad7 in https://yhetil.org/guix/OIYFBlSAc3AtEGSihoRRRjvGJ5cVaAohjF03EWQFDIiKgUINx3vm2xY-8IXvkFs-ZOPh6Yvohd7WoaKiRCREFIf3c_BkPJ11GiJBjhtAOQQ=@protonmail.com/ ||
	https://yhetil.org/guix/MXYIbrOGPKv1gj_NgM0E0qrQaFByQZqAQP57nzG-jeBaqBYVmXEVGOlzafIk0niSTn9jL0Tv9qg5Pkd08nfqejaWrskSAFqpzMKiU68pALQ=@protonmail.com/

applying [1/1] https://yhetil.org/guix/OIYFBlSAc3AtEGSihoRRRjvGJ5cVaAohjF03EWQFDIiKgUINx3vm2xY-8IXvkFs-ZOPh6Yvohd7WoaKiRCREFIf3c_BkPJ11GiJBjhtAOQQ=@protonmail.com/
diff --git a/gnu/packages/patches/linux-libre-arm64-pinenote-touchscreen-2.patch b/gnu/packages/patches/linux-libre-arm64-pinenote-touchscreen-2.patch
new file mode 100644
index 0000000000..9ccef92ad7

1:33: space before tab in indent.
 	struct cyttsp5_sensing_conf_data_dev *scd_dev =
1:34: space before tab in indent.
 		(struct cyttsp5_sensing_conf_data_dev *)
1:35: space before tab in indent.
 		&ts->response_buf[HID_SYSINFO_SENSING_OFFSET];
1:37: trailing whitespace.
 
1:38: space before tab in indent.
 	cyttsp5_si_get_btn_data(ts);
Checking patch gnu/packages/patches/linux-libre-arm64-pinenote-touchscreen-2.patch...
Applied patch gnu/packages/patches/linux-libre-arm64-pinenote-touchscreen-2.patch cleanly.
warning: squelched 9 whitespace errors
warning: 14 lines add whitespace errors.

skipping https://yhetil.org/guix/MXYIbrOGPKv1gj_NgM0E0qrQaFByQZqAQP57nzG-jeBaqBYVmXEVGOlzafIk0niSTn9jL0Tv9qg5Pkd08nfqejaWrskSAFqpzMKiU68pALQ=@protonmail.com/ for 9ccef92ad7
index at:
100644 9ccef92ad7edf95141861bdb0a5b8c682508690a	gnu/packages/patches/linux-libre-arm64-pinenote-touchscreen-2.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.