1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Goodix Berlin Touchscreen Driver
5 * Copyright (C) 2020 - 2021 Goodix, Inc.
6 * Copyright (C) 2023 Linaro Ltd.
8 * Based on goodix_ts_berlin driver.
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>
16 #include "goodix_berlin.h"
18 #define I2C_MAX_TRANSFER_SIZE 256
20 static const struct regmap_config goodix_berlin_i2c_regmap_conf
= {
23 .max_raw_read
= I2C_MAX_TRANSFER_SIZE
,
24 .max_raw_write
= I2C_MAX_TRANSFER_SIZE
,
27 /* vendor & product left unassigned here, should probably be updated from fw info */
28 static const struct input_id goodix_berlin_i2c_input_id
= {
32 static int goodix_berlin_i2c_probe(struct i2c_client
*client
)
34 struct regmap
*regmap
;
37 regmap
= devm_regmap_init_i2c(client
, &goodix_berlin_i2c_regmap_conf
);
39 return PTR_ERR(regmap
);
41 error
= goodix_berlin_probe(&client
->dev
, client
->irq
,
42 &goodix_berlin_i2c_input_id
, regmap
);
49 static const struct i2c_device_id goodix_berlin_i2c_id
[] = {
54 MODULE_DEVICE_TABLE(i2c
, goodix_berlin_i2c_id
);
56 static const struct of_device_id goodix_berlin_i2c_of_match
[] = {
57 { .compatible
= "goodix,gt9916", },
60 MODULE_DEVICE_TABLE(of
, goodix_berlin_i2c_of_match
);
62 static struct i2c_driver goodix_berlin_i2c_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 .dev_groups
= goodix_berlin_groups
,
69 .probe
= goodix_berlin_i2c_probe
,
70 .id_table
= goodix_berlin_i2c_id
,
72 module_i2c_driver(goodix_berlin_i2c_driver
);
74 MODULE_LICENSE("GPL");
75 MODULE_DESCRIPTION("Goodix Berlin I2C Touchscreen driver");
76 MODULE_AUTHOR("Neil Armstrong <neil.armstrong@linaro.org>");