131e502406c9a7c1c8097cb94d8311ac850fb406
[openwrt/staging/jow.git] /
1 From 2a6c3115f4142e23ca10c984d7f65ac8fb901cc2 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 8 Nov 2023 15:50:39 +0000
4 Subject: [PATCH] input: edt-ft5x06: Include I2C details in names for the
5 devices
6
7 libinput uses the input device name alone. If you have two
8 identical input devices, then there is no way to differentiate
9 between them, and in the case of touchscreens that means no
10 way to associate them with the appropriate display device.
11
12 Add the I2C bus and address to the start of the input device
13 name so that the name is always unique within the system.
14
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
16 ---
17 drivers/input/touchscreen/edt-ft5x06.c | 6 +++++-
18 1 file changed, 5 insertions(+), 1 deletion(-)
19
20 --- a/drivers/input/touchscreen/edt-ft5x06.c
21 +++ b/drivers/input/touchscreen/edt-ft5x06.c
22 @@ -67,6 +67,7 @@
23 #define TOUCH_EVENT_RESERVED 0x03
24
25 #define EDT_NAME_LEN 23
26 +#define EDT_NAME_PREFIX_LEN 8
27 #define EDT_SWITCH_MODE_RETRIES 10
28 #define EDT_SWITCH_MODE_DELAY 5 /* msec */
29 #define EDT_RAW_DATA_RETRIES 100
30 @@ -134,7 +135,7 @@ struct edt_ft5x06_ts_data {
31 int max_support_points;
32 unsigned int known_ids;
33
34 - char name[EDT_NAME_LEN];
35 + char name[EDT_NAME_PREFIX_LEN + EDT_NAME_LEN];
36 char fw_version[EDT_NAME_LEN];
37 int init_td_status;
38
39 @@ -965,6 +966,9 @@ static int edt_ft5x06_ts_identify(struct
40 char *model_name = tsdata->name;
41 char *fw_version = tsdata->fw_version;
42
43 + snprintf(model_name, EDT_NAME_PREFIX_LEN, "%s ", dev_name(&client->dev));
44 + model_name += strlen(model_name);
45 +
46 /* see what we find if we assume it is a M06 *
47 * if we get less than EDT_NAME_LEN, we don't want
48 * to have garbage in there