Skip to content

Commit

Permalink
input: goodix: Include I2C details in names for the devices
Browse files Browse the repository at this point in the history
libinput uses the input device name alone. If you have two
identical input devices, then there is no way to differentiate
between them, and in the case of touchscreens that means no
way to associate them with the appropriate display device.

Add the I2C bus and address to the start of the input device
name so that the name is always unique within the system.

Signed-off-by: Dave Stevenson <[email protected]>
  • Loading branch information
6by9 committed Nov 8, 2023
1 parent 1eda97f commit f2efc75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/input/touchscreen/goodix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,10 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
return -ENOMEM;
}

ts->input_dev->name = "Goodix Capacitive TouchScreen";
snprintf(ts->name, GOODIX_NAME_MAX_LEN, "%s Goodix Capacitive TouchScreen",
dev_name(&ts->client->dev));

ts->input_dev->name = ts->name;
ts->input_dev->phys = "input/ts";
ts->input_dev->id.bustype = BUS_I2C;
ts->input_dev->id.vendor = 0x0416;
Expand Down
3 changes: 3 additions & 0 deletions drivers/input/touchscreen/goodix.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#define GOODIX_CONFIG_MAX_LENGTH 240
#define GOODIX_MAX_KEYS 7

#define GOODIX_NAME_MAX_LEN 38

enum goodix_irq_pin_access_method {
IRQ_PIN_ACCESS_NONE,
IRQ_PIN_ACCESS_GPIO,
Expand Down Expand Up @@ -91,6 +93,7 @@ struct goodix_ts_data {
enum gpiod_flags gpiod_rst_flags;
char id[GOODIX_ID_MAX_LEN + 1];
char cfg_name[64];
char name[GOODIX_NAME_MAX_LEN];
u16 version;
bool reset_controller_at_probe;
bool load_cfg_from_disk;
Expand Down

0 comments on commit f2efc75

Please sign in to comment.