6bbe2208f4c238fa554b529fea975238102abc2c
[openwrt/staging/ansuel.git] /
1 From a420bbde05f8a6691b0c3e0830092e443365aaa7 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 8 Nov 2023 16:20:27 +0000
4 Subject: [PATCH] input: goodix: Include I2C details in names for the devices
5
6 libinput uses the input device name alone. If you have two
7 identical input devices, then there is no way to differentiate
8 between them, and in the case of touchscreens that means no
9 way to associate them with the appropriate display device.
10
11 Add the I2C bus and address to the start of the input device
12 name so that the name is always unique within the system.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 ---
16 drivers/input/touchscreen/goodix.c | 5 ++++-
17 drivers/input/touchscreen/goodix.h | 3 +++
18 2 files changed, 7 insertions(+), 1 deletion(-)
19
20 --- a/drivers/input/touchscreen/goodix.c
21 +++ b/drivers/input/touchscreen/goodix.c
22 @@ -1212,7 +1212,10 @@ static int goodix_configure_dev(struct g
23 return -ENOMEM;
24 }
25
26 - ts->input_dev->name = "Goodix Capacitive TouchScreen";
27 + snprintf(ts->name, GOODIX_NAME_MAX_LEN, "%s Goodix Capacitive TouchScreen",
28 + dev_name(&ts->client->dev));
29 +
30 + ts->input_dev->name = ts->name;
31 ts->input_dev->phys = "input/ts";
32 ts->input_dev->id.bustype = BUS_I2C;
33 ts->input_dev->id.vendor = 0x0416;
34 --- a/drivers/input/touchscreen/goodix.h
35 +++ b/drivers/input/touchscreen/goodix.h
36 @@ -57,6 +57,8 @@
37 #define GOODIX_CONFIG_MAX_LENGTH 240
38 #define GOODIX_MAX_KEYS 7
39
40 +#define GOODIX_NAME_MAX_LEN 38
41 +
42 enum goodix_irq_pin_access_method {
43 IRQ_PIN_ACCESS_NONE,
44 IRQ_PIN_ACCESS_GPIO,
45 @@ -91,6 +93,7 @@ struct goodix_ts_data {
46 enum gpiod_flags gpiod_rst_flags;
47 char id[GOODIX_ID_MAX_LEN + 1];
48 char cfg_name[64];
49 + char name[GOODIX_NAME_MAX_LEN];
50 u16 version;
51 bool reset_controller_at_probe;
52 bool load_cfg_from_disk;