Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 309a29b5965a0b2f36b3e245213eb43300a89ac2 84 lines 2.2 kB view raw
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 20static 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 */ 28static const struct input_id goodix_berlin_i2c_input_id = { 29 .bustype = BUS_I2C, 30}; 31 32static int goodix_berlin_i2c_probe(struct i2c_client *client) 33{ 34 const struct goodix_berlin_ic_data *ic_data = 35 i2c_get_match_data(client); 36 struct regmap *regmap; 37 int error; 38 39 regmap = devm_regmap_init_i2c(client, &goodix_berlin_i2c_regmap_conf); 40 if (IS_ERR(regmap)) 41 return PTR_ERR(regmap); 42 43 error = goodix_berlin_probe(&client->dev, client->irq, 44 &goodix_berlin_i2c_input_id, regmap, 45 ic_data); 46 if (error) 47 return error; 48 49 return 0; 50} 51 52static const struct goodix_berlin_ic_data gt9916_data = { 53 .fw_version_info_addr = GOODIX_BERLIN_FW_VERSION_INFO_ADDR_D, 54 .ic_info_addr = GOODIX_BERLIN_IC_INFO_ADDR_D, 55}; 56 57static const struct i2c_device_id goodix_berlin_i2c_id[] = { 58 { .name = "gt9916", .driver_data = (long)&gt9916_data }, 59 { } 60}; 61 62MODULE_DEVICE_TABLE(i2c, goodix_berlin_i2c_id); 63 64static const struct of_device_id goodix_berlin_i2c_of_match[] = { 65 { .compatible = "goodix,gt9916", .data = &gt9916_data }, 66 { } 67}; 68MODULE_DEVICE_TABLE(of, goodix_berlin_i2c_of_match); 69 70static struct i2c_driver goodix_berlin_i2c_driver = { 71 .driver = { 72 .name = "goodix-berlin-i2c", 73 .of_match_table = goodix_berlin_i2c_of_match, 74 .pm = pm_sleep_ptr(&goodix_berlin_pm_ops), 75 .dev_groups = goodix_berlin_groups, 76 }, 77 .probe = goodix_berlin_i2c_probe, 78 .id_table = goodix_berlin_i2c_id, 79}; 80module_i2c_driver(goodix_berlin_i2c_driver); 81 82MODULE_LICENSE("GPL"); 83MODULE_DESCRIPTION("Goodix Berlin I2C Touchscreen driver"); 84MODULE_AUTHOR("Neil Armstrong <neil.armstrong@linaro.org>");