Message ID | 20231021-topic-goodix-berlin-upstream-initial-v9-3-13fb4e887156@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Input: add initial support for Goodix Berlin touchscreen IC | expand |
Hi Neil,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 2030579113a1b1b5bfd7ff24c0852847836d8fd1]
url: https://github.com/intel-lab-lkp/linux/commits/Neil-Armstrong/dt-bindings-input-document-Goodix-Berlin-Touchscreen-IC/20231021-191942
base: 2030579113a1b1b5bfd7ff24c0852847836d8fd1
patch link: https://lore.kernel.org/r/20231021-topic-goodix-berlin-upstream-initial-v9-3-13fb4e887156%40linaro.org
patch subject: [PATCH v9 3/4] Input: goodix-berlin - add I2C support for Goodix Berlin Touchscreen IC
config: sh-allyesconfig (https://download.01.org/0day-ci/archive/20231023/202310231123.eHyxswnW-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231023/202310231123.eHyxswnW-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310231123.eHyxswnW-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/input/touchscreen/goodix_berlin_core.c: In function 'goodix_berlin_get_ic_info':
>> drivers/input/touchscreen/goodix_berlin_core.c:285:1: warning: the frame size of 1148 bytes is larger than 1024 bytes [-Wframe-larger-than=]
285 | }
| ^
vim +285 drivers/input/touchscreen/goodix_berlin_core.c
7aae63b22cf7e9 Neil Armstrong 2023-10-21 235
7aae63b22cf7e9 Neil Armstrong 2023-10-21 236 static int goodix_berlin_get_ic_info(struct goodix_berlin_core *cd)
7aae63b22cf7e9 Neil Armstrong 2023-10-21 237 {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 238 u8 afe_data[GOODIX_BERLIN_IC_INFO_MAX_LEN];
7aae63b22cf7e9 Neil Armstrong 2023-10-21 239 __le16 length_raw;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 240 u16 length;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 241 int error;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 242
7aae63b22cf7e9 Neil Armstrong 2023-10-21 243 error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR,
7aae63b22cf7e9 Neil Armstrong 2023-10-21 244 &length_raw, sizeof(length_raw));
7aae63b22cf7e9 Neil Armstrong 2023-10-21 245 if (error) {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 246 dev_info(cd->dev, "failed get ic info length, %d\n", error);
7aae63b22cf7e9 Neil Armstrong 2023-10-21 247 return error;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 248 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 249
7aae63b22cf7e9 Neil Armstrong 2023-10-21 250 length = le16_to_cpu(length_raw);
7aae63b22cf7e9 Neil Armstrong 2023-10-21 251 if (length >= GOODIX_BERLIN_IC_INFO_MAX_LEN) {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 252 dev_info(cd->dev, "invalid ic info length %d\n", length);
7aae63b22cf7e9 Neil Armstrong 2023-10-21 253 return -EINVAL;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 254 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 255
7aae63b22cf7e9 Neil Armstrong 2023-10-21 256 error = regmap_raw_read(cd->regmap, GOODIX_BERLIN_IC_INFO_ADDR,
7aae63b22cf7e9 Neil Armstrong 2023-10-21 257 afe_data, length);
7aae63b22cf7e9 Neil Armstrong 2023-10-21 258 if (error) {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 259 dev_info(cd->dev, "failed get ic info data, %d\n", error);
7aae63b22cf7e9 Neil Armstrong 2023-10-21 260 return error;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 261 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 262
7aae63b22cf7e9 Neil Armstrong 2023-10-21 263 /* check whether the data is valid (ex. bus default values) */
7aae63b22cf7e9 Neil Armstrong 2023-10-21 264 if (goodix_berlin_is_dummy_data(cd, (const uint8_t *)afe_data, length)) {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 265 dev_err(cd->dev, "fw info data invalid\n");
7aae63b22cf7e9 Neil Armstrong 2023-10-21 266 return -EINVAL;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 267 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 268
7aae63b22cf7e9 Neil Armstrong 2023-10-21 269 if (!goodix_berlin_checksum_valid((const uint8_t *)afe_data, length)) {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 270 dev_info(cd->dev, "fw info checksum error\n");
7aae63b22cf7e9 Neil Armstrong 2023-10-21 271 return -EINVAL;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 272 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 273
7aae63b22cf7e9 Neil Armstrong 2023-10-21 274 error = goodix_berlin_convert_ic_info(cd, afe_data, length);
7aae63b22cf7e9 Neil Armstrong 2023-10-21 275 if (error)
7aae63b22cf7e9 Neil Armstrong 2023-10-21 276 return error;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 277
7aae63b22cf7e9 Neil Armstrong 2023-10-21 278 /* check some key info */
7aae63b22cf7e9 Neil Armstrong 2023-10-21 279 if (!cd->touch_data_addr) {
7aae63b22cf7e9 Neil Armstrong 2023-10-21 280 dev_err(cd->dev, "touch_data_addr is null\n");
7aae63b22cf7e9 Neil Armstrong 2023-10-21 281 return -EINVAL;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 282 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 283
7aae63b22cf7e9 Neil Armstrong 2023-10-21 284 return 0;
7aae63b22cf7e9 Neil Armstrong 2023-10-21 @285 }
7aae63b22cf7e9 Neil Armstrong 2023-10-21 286
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 950da599ae1a..cc7b88118158 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -419,6 +419,20 @@ config TOUCHSCREEN_GOODIX config TOUCHSCREEN_GOODIX_BERLIN_CORE tristate +config TOUCHSCREEN_GOODIX_BERLIN_I2C + tristate "Goodix Berlin I2C touchscreen" + depends on I2C + select REGMAP_I2C + select TOUCHSCREEN_GOODIX_BERLIN_CORE + help + Say Y here if you have a Goodix Berlin IC connected to + your system via I2C. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called goodix_berlin_i2c. + config TOUCHSCREEN_HIDEEP tristate "HiDeep Touch IC" depends on I2C diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 2e2f3e70cd2c..7ef677cf7a10 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_TOUCHSCREEN_EXC3000) += exc3000.o obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix_ts.o obj-$(CONFIG_TOUCHSCREEN_GOODIX_BERLIN_CORE) += goodix_berlin_core.o +obj-$(CONFIG_TOUCHSCREEN_GOODIX_BERLIN_I2C) += goodix_berlin_i2c.o obj-$(CONFIG_TOUCHSCREEN_HIDEEP) += hideep.o obj-$(CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX) += hynitron_cstxxx.o obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o diff --git a/drivers/input/touchscreen/goodix_berlin_i2c.c b/drivers/input/touchscreen/goodix_berlin_i2c.c new file mode 100644 index 000000000000..6407b2258eb1 --- /dev/null +++ b/drivers/input/touchscreen/goodix_berlin_i2c.c @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Goodix Berlin Touchscreen Driver + * + * Copyright (C) 2020 - 2021 Goodix, Inc. + * Copyright (C) 2023 Linaro Ltd. + * + * Based on goodix_ts_berlin driver. + */ +#include <linux/i2c.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/regmap.h> + +#include "goodix_berlin.h" + +#define I2C_MAX_TRANSFER_SIZE 256 + +static const struct regmap_config goodix_berlin_i2c_regmap_conf = { + .reg_bits = 32, + .val_bits = 8, + .max_raw_read = I2C_MAX_TRANSFER_SIZE, + .max_raw_write = I2C_MAX_TRANSFER_SIZE, +}; + +/* vendor & product left unassigned here, should probably be updated from fw info */ +static const struct input_id goodix_berlin_i2c_input_id = { + .bustype = BUS_I2C, +}; + +static int goodix_berlin_i2c_probe(struct i2c_client *client) +{ + struct regmap *regmap; + + regmap = devm_regmap_init_i2c(client, &goodix_berlin_i2c_regmap_conf); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + return goodix_berlin_probe(&client->dev, client->irq, + &goodix_berlin_i2c_input_id, regmap); +} + +static const struct i2c_device_id goodix_berlin_i2c_id[] = { + { "gt9916", 0 }, + { } +}; + +MODULE_DEVICE_TABLE(i2c, goodix_berlin_i2c_id); + +static const struct of_device_id goodix_berlin_i2c_of_match[] = { + { .compatible = "goodix,gt9916", }, + { } +}; +MODULE_DEVICE_TABLE(of, goodix_berlin_i2c_of_match); + +static struct i2c_driver goodix_berlin_i2c_driver = { + .driver = { + .name = "goodix-berlin-i2c", + .of_match_table = goodix_berlin_i2c_of_match, + .pm = pm_sleep_ptr(&goodix_berlin_pm_ops), + }, + .probe = goodix_berlin_i2c_probe, + .id_table = goodix_berlin_i2c_id, +}; +module_i2c_driver(goodix_berlin_i2c_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Goodix Berlin I2C Touchscreen driver"); +MODULE_AUTHOR("Neil Armstrong <neil.armstrong@linaro.org>");