Skip to content

Commit fba09e8

Browse files
superna9999dtor
authored andcommitted
Input: goodix-berlin - add I2C support for Goodix Berlin Touchscreen IC
Add initial support for the new Goodix "Berlin" touchscreen ICs over the I2C interface. This initial driver is derived from the Goodix goodix_ts_berlin available at [1] and [2] and only supports the GT9916 IC present on the Qualcomm SM8550 MTP & QRD touch panel. The current implementation only supports BerlinD, aka GT9916. [1] https://github.com/goodix/goodix_ts_berlin [2] https://git.codelinaro.org/clo/la/platform/vendor/opensource/touch-drivers Reviewed-by: Jeff LaBundy <jeff@labundy.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20240129-topic-goodix-berlin-upstream-initial-v15-3-6f7d096c0a0a@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 4436227 commit fba09e8

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

drivers/input/touchscreen/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,20 @@ config TOUCHSCREEN_GOODIX
419419
config TOUCHSCREEN_GOODIX_BERLIN_CORE
420420
tristate
421421

422+
config TOUCHSCREEN_GOODIX_BERLIN_I2C
423+
tristate "Goodix Berlin I2C touchscreen"
424+
depends on I2C
425+
select REGMAP_I2C
426+
select TOUCHSCREEN_GOODIX_BERLIN_CORE
427+
help
428+
Say Y here if you have a Goodix Berlin IC connected to
429+
your system via I2C.
430+
431+
If unsure, say N.
432+
433+
To compile this driver as a module, choose M here: the
434+
module will be called goodix_berlin_i2c.
435+
422436
config TOUCHSCREEN_HIDEEP
423437
tristate "HiDeep Touch IC"
424438
depends on I2C

drivers/input/touchscreen/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ obj-$(CONFIG_TOUCHSCREEN_EXC3000) += exc3000.o
4848
obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o
4949
obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix_ts.o
5050
obj-$(CONFIG_TOUCHSCREEN_GOODIX_BERLIN_CORE) += goodix_berlin_core.o
51+
obj-$(CONFIG_TOUCHSCREEN_GOODIX_BERLIN_I2C) += goodix_berlin_i2c.o
5152
obj-$(CONFIG_TOUCHSCREEN_HIDEEP) += hideep.o
5253
obj-$(CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX) += hynitron_cstxxx.o
5354
obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Goodix Berlin Touchscreen Driver
4+
*
5+
* Copyright (C) 2020 - 2021 Goodix, Inc.
6+
* Copyright (C) 2023 Linaro Ltd.
7+
*
8+
* Based on goodix_ts_berlin driver.
9+
*/
10+
#include <linux/i2c.h>
11+
#include <linux/kernel.h>
12+
#include <linux/module.h>
13+
#include <linux/regmap.h>
14+
#include <linux/input.h>
15+
16+
#include "goodix_berlin.h"
17+
18+
#define I2C_MAX_TRANSFER_SIZE 256
19+
20+
static const struct regmap_config goodix_berlin_i2c_regmap_conf = {
21+
.reg_bits = 32,
22+
.val_bits = 8,
23+
.max_raw_read = I2C_MAX_TRANSFER_SIZE,
24+
.max_raw_write = I2C_MAX_TRANSFER_SIZE,
25+
};
26+
27+
/* vendor & product left unassigned here, should probably be updated from fw info */
28+
static const struct input_id goodix_berlin_i2c_input_id = {
29+
.bustype = BUS_I2C,
30+
};
31+
32+
static int goodix_berlin_i2c_probe(struct i2c_client *client)
33+
{
34+
struct regmap *regmap;
35+
int error;
36+
37+
regmap = devm_regmap_init_i2c(client, &goodix_berlin_i2c_regmap_conf);
38+
if (IS_ERR(regmap))
39+
return PTR_ERR(regmap);
40+
41+
error = goodix_berlin_probe(&client->dev, client->irq,
42+
&goodix_berlin_i2c_input_id, regmap);
43+
if (error)
44+
return error;
45+
46+
return 0;
47+
}
48+
49+
static const struct i2c_device_id goodix_berlin_i2c_id[] = {
50+
{ "gt9916", 0 },
51+
{ }
52+
};
53+
54+
MODULE_DEVICE_TABLE(i2c, goodix_berlin_i2c_id);
55+
56+
static const struct of_device_id goodix_berlin_i2c_of_match[] = {
57+
{ .compatible = "goodix,gt9916", },
58+
{ }
59+
};
60+
MODULE_DEVICE_TABLE(of, goodix_berlin_i2c_of_match);
61+
62+
static struct i2c_driver goodix_berlin_i2c_driver = {
63+
.driver = {
64+
.name = "goodix-berlin-i2c",
65+
.of_match_table = goodix_berlin_i2c_of_match,
66+
.pm = pm_sleep_ptr(&goodix_berlin_pm_ops),
67+
},
68+
.probe = goodix_berlin_i2c_probe,
69+
.id_table = goodix_berlin_i2c_id,
70+
};
71+
module_i2c_driver(goodix_berlin_i2c_driver);
72+
73+
MODULE_LICENSE("GPL");
74+
MODULE_DESCRIPTION("Goodix Berlin I2C Touchscreen driver");
75+
MODULE_AUTHOR("Neil Armstrong <neil.armstrong@linaro.org>");

0 commit comments

Comments
 (0)