18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------- 38c2ecf20Sopenharmony_ci * Copyright (C) 2014-2015, Intel Corporation 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Derived from: 68c2ecf20Sopenharmony_ci * gslX68X.c 78c2ecf20Sopenharmony_ci * Copyright (C) 2010-2015, Shanghai Sileadinc Co.Ltd 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * ------------------------------------------------------------------------- 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/i2c.h> 138c2ecf20Sopenharmony_ci#include <linux/module.h> 148c2ecf20Sopenharmony_ci#include <linux/acpi.h> 158c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 168c2ecf20Sopenharmony_ci#include <linux/gpio/consumer.h> 178c2ecf20Sopenharmony_ci#include <linux/delay.h> 188c2ecf20Sopenharmony_ci#include <linux/firmware.h> 198c2ecf20Sopenharmony_ci#include <linux/input.h> 208c2ecf20Sopenharmony_ci#include <linux/input/mt.h> 218c2ecf20Sopenharmony_ci#include <linux/input/touchscreen.h> 228c2ecf20Sopenharmony_ci#include <linux/pm.h> 238c2ecf20Sopenharmony_ci#include <linux/pm_runtime.h> 248c2ecf20Sopenharmony_ci#include <linux/irq.h> 258c2ecf20Sopenharmony_ci#include <linux/regulator/consumer.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <asm/unaligned.h> 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define SILEAD_TS_NAME "silead_ts" 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define SILEAD_REG_RESET 0xE0 328c2ecf20Sopenharmony_ci#define SILEAD_REG_DATA 0x80 338c2ecf20Sopenharmony_ci#define SILEAD_REG_TOUCH_NR 0x80 348c2ecf20Sopenharmony_ci#define SILEAD_REG_POWER 0xBC 358c2ecf20Sopenharmony_ci#define SILEAD_REG_CLOCK 0xE4 368c2ecf20Sopenharmony_ci#define SILEAD_REG_STATUS 0xB0 378c2ecf20Sopenharmony_ci#define SILEAD_REG_ID 0xFC 388c2ecf20Sopenharmony_ci#define SILEAD_REG_MEM_CHECK 0xB0 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define SILEAD_STATUS_OK 0x5A5A5A5A 418c2ecf20Sopenharmony_ci#define SILEAD_TS_DATA_LEN 44 428c2ecf20Sopenharmony_ci#define SILEAD_CLOCK 0x04 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define SILEAD_CMD_RESET 0x88 458c2ecf20Sopenharmony_ci#define SILEAD_CMD_START 0x00 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define SILEAD_POINT_DATA_LEN 0x04 488c2ecf20Sopenharmony_ci#define SILEAD_POINT_Y_OFF 0x00 498c2ecf20Sopenharmony_ci#define SILEAD_POINT_Y_MSB_OFF 0x01 508c2ecf20Sopenharmony_ci#define SILEAD_POINT_X_OFF 0x02 518c2ecf20Sopenharmony_ci#define SILEAD_POINT_X_MSB_OFF 0x03 528c2ecf20Sopenharmony_ci#define SILEAD_EXTRA_DATA_MASK 0xF0 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define SILEAD_CMD_SLEEP_MIN 10000 558c2ecf20Sopenharmony_ci#define SILEAD_CMD_SLEEP_MAX 20000 568c2ecf20Sopenharmony_ci#define SILEAD_POWER_SLEEP 20 578c2ecf20Sopenharmony_ci#define SILEAD_STARTUP_SLEEP 30 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define SILEAD_MAX_FINGERS 10 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cienum silead_ts_power { 628c2ecf20Sopenharmony_ci SILEAD_POWER_ON = 1, 638c2ecf20Sopenharmony_ci SILEAD_POWER_OFF = 0 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cistruct silead_ts_data { 678c2ecf20Sopenharmony_ci struct i2c_client *client; 688c2ecf20Sopenharmony_ci struct gpio_desc *gpio_power; 698c2ecf20Sopenharmony_ci struct input_dev *input; 708c2ecf20Sopenharmony_ci struct regulator_bulk_data regulators[2]; 718c2ecf20Sopenharmony_ci char fw_name[64]; 728c2ecf20Sopenharmony_ci struct touchscreen_properties prop; 738c2ecf20Sopenharmony_ci u32 max_fingers; 748c2ecf20Sopenharmony_ci u32 chip_id; 758c2ecf20Sopenharmony_ci struct input_mt_pos pos[SILEAD_MAX_FINGERS]; 768c2ecf20Sopenharmony_ci int slots[SILEAD_MAX_FINGERS]; 778c2ecf20Sopenharmony_ci int id[SILEAD_MAX_FINGERS]; 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cistruct silead_fw_data { 818c2ecf20Sopenharmony_ci u32 offset; 828c2ecf20Sopenharmony_ci u32 val; 838c2ecf20Sopenharmony_ci}; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_cistatic int silead_ts_request_input_dev(struct silead_ts_data *data) 868c2ecf20Sopenharmony_ci{ 878c2ecf20Sopenharmony_ci struct device *dev = &data->client->dev; 888c2ecf20Sopenharmony_ci int error; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci data->input = devm_input_allocate_device(dev); 918c2ecf20Sopenharmony_ci if (!data->input) { 928c2ecf20Sopenharmony_ci dev_err(dev, 938c2ecf20Sopenharmony_ci "Failed to allocate input device\n"); 948c2ecf20Sopenharmony_ci return -ENOMEM; 958c2ecf20Sopenharmony_ci } 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci input_set_abs_params(data->input, ABS_MT_POSITION_X, 0, 4095, 0, 0); 988c2ecf20Sopenharmony_ci input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0); 998c2ecf20Sopenharmony_ci touchscreen_parse_properties(data->input, true, &data->prop); 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci input_mt_init_slots(data->input, data->max_fingers, 1028c2ecf20Sopenharmony_ci INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED | 1038c2ecf20Sopenharmony_ci INPUT_MT_TRACK); 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci if (device_property_read_bool(dev, "silead,home-button")) 1068c2ecf20Sopenharmony_ci input_set_capability(data->input, EV_KEY, KEY_LEFTMETA); 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci data->input->name = SILEAD_TS_NAME; 1098c2ecf20Sopenharmony_ci data->input->phys = "input/ts"; 1108c2ecf20Sopenharmony_ci data->input->id.bustype = BUS_I2C; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci error = input_register_device(data->input); 1138c2ecf20Sopenharmony_ci if (error) { 1148c2ecf20Sopenharmony_ci dev_err(dev, "Failed to register input device: %d\n", error); 1158c2ecf20Sopenharmony_ci return error; 1168c2ecf20Sopenharmony_ci } 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci return 0; 1198c2ecf20Sopenharmony_ci} 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_cistatic void silead_ts_set_power(struct i2c_client *client, 1228c2ecf20Sopenharmony_ci enum silead_ts_power state) 1238c2ecf20Sopenharmony_ci{ 1248c2ecf20Sopenharmony_ci struct silead_ts_data *data = i2c_get_clientdata(client); 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci if (data->gpio_power) { 1278c2ecf20Sopenharmony_ci gpiod_set_value_cansleep(data->gpio_power, state); 1288c2ecf20Sopenharmony_ci msleep(SILEAD_POWER_SLEEP); 1298c2ecf20Sopenharmony_ci } 1308c2ecf20Sopenharmony_ci} 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_cistatic void silead_ts_read_data(struct i2c_client *client) 1338c2ecf20Sopenharmony_ci{ 1348c2ecf20Sopenharmony_ci struct silead_ts_data *data = i2c_get_clientdata(client); 1358c2ecf20Sopenharmony_ci struct input_dev *input = data->input; 1368c2ecf20Sopenharmony_ci struct device *dev = &client->dev; 1378c2ecf20Sopenharmony_ci u8 *bufp, buf[SILEAD_TS_DATA_LEN]; 1388c2ecf20Sopenharmony_ci int touch_nr, softbutton, error, i; 1398c2ecf20Sopenharmony_ci bool softbutton_pressed = false; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_DATA, 1428c2ecf20Sopenharmony_ci SILEAD_TS_DATA_LEN, buf); 1438c2ecf20Sopenharmony_ci if (error < 0) { 1448c2ecf20Sopenharmony_ci dev_err(dev, "Data read error %d\n", error); 1458c2ecf20Sopenharmony_ci return; 1468c2ecf20Sopenharmony_ci } 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci if (buf[0] > data->max_fingers) { 1498c2ecf20Sopenharmony_ci dev_warn(dev, "More touches reported then supported %d > %d\n", 1508c2ecf20Sopenharmony_ci buf[0], data->max_fingers); 1518c2ecf20Sopenharmony_ci buf[0] = data->max_fingers; 1528c2ecf20Sopenharmony_ci } 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci touch_nr = 0; 1558c2ecf20Sopenharmony_ci bufp = buf + SILEAD_POINT_DATA_LEN; 1568c2ecf20Sopenharmony_ci for (i = 0; i < buf[0]; i++, bufp += SILEAD_POINT_DATA_LEN) { 1578c2ecf20Sopenharmony_ci softbutton = (bufp[SILEAD_POINT_Y_MSB_OFF] & 1588c2ecf20Sopenharmony_ci SILEAD_EXTRA_DATA_MASK) >> 4; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci if (softbutton) { 1618c2ecf20Sopenharmony_ci /* 1628c2ecf20Sopenharmony_ci * For now only respond to softbutton == 0x01, some 1638c2ecf20Sopenharmony_ci * tablets *without* a capacative button send 0x04 1648c2ecf20Sopenharmony_ci * when crossing the edges of the screen. 1658c2ecf20Sopenharmony_ci */ 1668c2ecf20Sopenharmony_ci if (softbutton == 0x01) 1678c2ecf20Sopenharmony_ci softbutton_pressed = true; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci continue; 1708c2ecf20Sopenharmony_ci } 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci /* 1738c2ecf20Sopenharmony_ci * Bits 4-7 are the touch id, note not all models have 1748c2ecf20Sopenharmony_ci * hardware touch ids so atm we don't use these. 1758c2ecf20Sopenharmony_ci */ 1768c2ecf20Sopenharmony_ci data->id[touch_nr] = (bufp[SILEAD_POINT_X_MSB_OFF] & 1778c2ecf20Sopenharmony_ci SILEAD_EXTRA_DATA_MASK) >> 4; 1788c2ecf20Sopenharmony_ci touchscreen_set_mt_pos(&data->pos[touch_nr], &data->prop, 1798c2ecf20Sopenharmony_ci get_unaligned_le16(&bufp[SILEAD_POINT_X_OFF]) & 0xfff, 1808c2ecf20Sopenharmony_ci get_unaligned_le16(&bufp[SILEAD_POINT_Y_OFF]) & 0xfff); 1818c2ecf20Sopenharmony_ci touch_nr++; 1828c2ecf20Sopenharmony_ci } 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci input_mt_assign_slots(input, data->slots, data->pos, touch_nr, 0); 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci for (i = 0; i < touch_nr; i++) { 1878c2ecf20Sopenharmony_ci input_mt_slot(input, data->slots[i]); 1888c2ecf20Sopenharmony_ci input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 1898c2ecf20Sopenharmony_ci input_report_abs(input, ABS_MT_POSITION_X, data->pos[i].x); 1908c2ecf20Sopenharmony_ci input_report_abs(input, ABS_MT_POSITION_Y, data->pos[i].y); 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci dev_dbg(dev, "x=%d y=%d hw_id=%d sw_id=%d\n", data->pos[i].x, 1938c2ecf20Sopenharmony_ci data->pos[i].y, data->id[i], data->slots[i]); 1948c2ecf20Sopenharmony_ci } 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci input_mt_sync_frame(input); 1978c2ecf20Sopenharmony_ci input_report_key(input, KEY_LEFTMETA, softbutton_pressed); 1988c2ecf20Sopenharmony_ci input_sync(input); 1998c2ecf20Sopenharmony_ci} 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistatic int silead_ts_init(struct i2c_client *client) 2028c2ecf20Sopenharmony_ci{ 2038c2ecf20Sopenharmony_ci struct silead_ts_data *data = i2c_get_clientdata(client); 2048c2ecf20Sopenharmony_ci int error; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 2078c2ecf20Sopenharmony_ci SILEAD_CMD_RESET); 2088c2ecf20Sopenharmony_ci if (error) 2098c2ecf20Sopenharmony_ci goto i2c_write_err; 2108c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_TOUCH_NR, 2138c2ecf20Sopenharmony_ci data->max_fingers); 2148c2ecf20Sopenharmony_ci if (error) 2158c2ecf20Sopenharmony_ci goto i2c_write_err; 2168c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK, 2198c2ecf20Sopenharmony_ci SILEAD_CLOCK); 2208c2ecf20Sopenharmony_ci if (error) 2218c2ecf20Sopenharmony_ci goto i2c_write_err; 2228c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 2258c2ecf20Sopenharmony_ci SILEAD_CMD_START); 2268c2ecf20Sopenharmony_ci if (error) 2278c2ecf20Sopenharmony_ci goto i2c_write_err; 2288c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci return 0; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cii2c_write_err: 2338c2ecf20Sopenharmony_ci dev_err(&client->dev, "Registers clear error %d\n", error); 2348c2ecf20Sopenharmony_ci return error; 2358c2ecf20Sopenharmony_ci} 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_cistatic int silead_ts_reset(struct i2c_client *client) 2388c2ecf20Sopenharmony_ci{ 2398c2ecf20Sopenharmony_ci int error; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 2428c2ecf20Sopenharmony_ci SILEAD_CMD_RESET); 2438c2ecf20Sopenharmony_ci if (error) 2448c2ecf20Sopenharmony_ci goto i2c_write_err; 2458c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_CLOCK, 2488c2ecf20Sopenharmony_ci SILEAD_CLOCK); 2498c2ecf20Sopenharmony_ci if (error) 2508c2ecf20Sopenharmony_ci goto i2c_write_err; 2518c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_POWER, 2548c2ecf20Sopenharmony_ci SILEAD_CMD_START); 2558c2ecf20Sopenharmony_ci if (error) 2568c2ecf20Sopenharmony_ci goto i2c_write_err; 2578c2ecf20Sopenharmony_ci usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci return 0; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_cii2c_write_err: 2628c2ecf20Sopenharmony_ci dev_err(&client->dev, "Chip reset error %d\n", error); 2638c2ecf20Sopenharmony_ci return error; 2648c2ecf20Sopenharmony_ci} 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_cistatic int silead_ts_startup(struct i2c_client *client) 2678c2ecf20Sopenharmony_ci{ 2688c2ecf20Sopenharmony_ci int error; 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, 0x00); 2718c2ecf20Sopenharmony_ci if (error) { 2728c2ecf20Sopenharmony_ci dev_err(&client->dev, "Startup error %d\n", error); 2738c2ecf20Sopenharmony_ci return error; 2748c2ecf20Sopenharmony_ci } 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci msleep(SILEAD_STARTUP_SLEEP); 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci return 0; 2798c2ecf20Sopenharmony_ci} 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_cistatic int silead_ts_load_fw(struct i2c_client *client) 2828c2ecf20Sopenharmony_ci{ 2838c2ecf20Sopenharmony_ci struct device *dev = &client->dev; 2848c2ecf20Sopenharmony_ci struct silead_ts_data *data = i2c_get_clientdata(client); 2858c2ecf20Sopenharmony_ci unsigned int fw_size, i; 2868c2ecf20Sopenharmony_ci const struct firmware *fw; 2878c2ecf20Sopenharmony_ci struct silead_fw_data *fw_data; 2888c2ecf20Sopenharmony_ci int error; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci dev_dbg(dev, "Firmware file name: %s", data->fw_name); 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci error = firmware_request_platform(&fw, data->fw_name, dev); 2938c2ecf20Sopenharmony_ci if (error) { 2948c2ecf20Sopenharmony_ci dev_err(dev, "Firmware request error %d\n", error); 2958c2ecf20Sopenharmony_ci return error; 2968c2ecf20Sopenharmony_ci } 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci fw_size = fw->size / sizeof(*fw_data); 2998c2ecf20Sopenharmony_ci fw_data = (struct silead_fw_data *)fw->data; 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci for (i = 0; i < fw_size; i++) { 3028c2ecf20Sopenharmony_ci error = i2c_smbus_write_i2c_block_data(client, 3038c2ecf20Sopenharmony_ci fw_data[i].offset, 3048c2ecf20Sopenharmony_ci 4, 3058c2ecf20Sopenharmony_ci (u8 *)&fw_data[i].val); 3068c2ecf20Sopenharmony_ci if (error) { 3078c2ecf20Sopenharmony_ci dev_err(dev, "Firmware load error %d\n", error); 3088c2ecf20Sopenharmony_ci break; 3098c2ecf20Sopenharmony_ci } 3108c2ecf20Sopenharmony_ci } 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci release_firmware(fw); 3138c2ecf20Sopenharmony_ci return error ?: 0; 3148c2ecf20Sopenharmony_ci} 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_cistatic u32 silead_ts_get_status(struct i2c_client *client) 3178c2ecf20Sopenharmony_ci{ 3188c2ecf20Sopenharmony_ci int error; 3198c2ecf20Sopenharmony_ci __le32 status; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_STATUS, 3228c2ecf20Sopenharmony_ci sizeof(status), (u8 *)&status); 3238c2ecf20Sopenharmony_ci if (error < 0) { 3248c2ecf20Sopenharmony_ci dev_err(&client->dev, "Status read error %d\n", error); 3258c2ecf20Sopenharmony_ci return error; 3268c2ecf20Sopenharmony_ci } 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci return le32_to_cpu(status); 3298c2ecf20Sopenharmony_ci} 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic int silead_ts_get_id(struct i2c_client *client) 3328c2ecf20Sopenharmony_ci{ 3338c2ecf20Sopenharmony_ci struct silead_ts_data *data = i2c_get_clientdata(client); 3348c2ecf20Sopenharmony_ci __le32 chip_id; 3358c2ecf20Sopenharmony_ci int error; 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_ID, 3388c2ecf20Sopenharmony_ci sizeof(chip_id), (u8 *)&chip_id); 3398c2ecf20Sopenharmony_ci if (error < 0) 3408c2ecf20Sopenharmony_ci return error; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci data->chip_id = le32_to_cpu(chip_id); 3438c2ecf20Sopenharmony_ci dev_info(&client->dev, "Silead chip ID: 0x%8X", data->chip_id); 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci return 0; 3468c2ecf20Sopenharmony_ci} 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistatic int silead_ts_setup(struct i2c_client *client) 3498c2ecf20Sopenharmony_ci{ 3508c2ecf20Sopenharmony_ci int error; 3518c2ecf20Sopenharmony_ci u32 status; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci /* 3548c2ecf20Sopenharmony_ci * Some buggy BIOS-es bring up the chip in a stuck state where it 3558c2ecf20Sopenharmony_ci * blocks the I2C bus. The following steps are necessary to 3568c2ecf20Sopenharmony_ci * unstuck the chip / bus: 3578c2ecf20Sopenharmony_ci * 1. Turn off the Silead chip. 3588c2ecf20Sopenharmony_ci * 2. Try to do an I2C transfer with the chip, this will fail in 3598c2ecf20Sopenharmony_ci * response to which the I2C-bus-driver will call: 3608c2ecf20Sopenharmony_ci * i2c_recover_bus() which will unstuck the I2C-bus. Note the 3618c2ecf20Sopenharmony_ci * unstuck-ing of the I2C bus only works if we first drop the 3628c2ecf20Sopenharmony_ci * chip off the bus by turning it off. 3638c2ecf20Sopenharmony_ci * 3. Turn the chip back on. 3648c2ecf20Sopenharmony_ci * 3658c2ecf20Sopenharmony_ci * On the x86/ACPI systems were this problem is seen, step 1. and 3668c2ecf20Sopenharmony_ci * 3. require making ACPI calls and dealing with ACPI Power 3678c2ecf20Sopenharmony_ci * Resources. The workaround below runtime-suspends the chip to 3688c2ecf20Sopenharmony_ci * turn it off, leaving it up to the ACPI subsystem to deal with 3698c2ecf20Sopenharmony_ci * this. 3708c2ecf20Sopenharmony_ci */ 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci if (device_property_read_bool(&client->dev, 3738c2ecf20Sopenharmony_ci "silead,stuck-controller-bug")) { 3748c2ecf20Sopenharmony_ci pm_runtime_set_active(&client->dev); 3758c2ecf20Sopenharmony_ci pm_runtime_enable(&client->dev); 3768c2ecf20Sopenharmony_ci pm_runtime_allow(&client->dev); 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci pm_runtime_suspend(&client->dev); 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci dev_warn(&client->dev, FW_BUG "Stuck I2C bus: please ignore the next 'controller timed out' error\n"); 3818c2ecf20Sopenharmony_ci silead_ts_get_id(client); 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci /* The forbid will also resume the device */ 3848c2ecf20Sopenharmony_ci pm_runtime_forbid(&client->dev); 3858c2ecf20Sopenharmony_ci pm_runtime_disable(&client->dev); 3868c2ecf20Sopenharmony_ci } 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci silead_ts_set_power(client, SILEAD_POWER_OFF); 3898c2ecf20Sopenharmony_ci silead_ts_set_power(client, SILEAD_POWER_ON); 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci error = silead_ts_get_id(client); 3928c2ecf20Sopenharmony_ci if (error) { 3938c2ecf20Sopenharmony_ci dev_err(&client->dev, "Chip ID read error %d\n", error); 3948c2ecf20Sopenharmony_ci return error; 3958c2ecf20Sopenharmony_ci } 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci error = silead_ts_init(client); 3988c2ecf20Sopenharmony_ci if (error) 3998c2ecf20Sopenharmony_ci return error; 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci error = silead_ts_reset(client); 4028c2ecf20Sopenharmony_ci if (error) 4038c2ecf20Sopenharmony_ci return error; 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci error = silead_ts_load_fw(client); 4068c2ecf20Sopenharmony_ci if (error) 4078c2ecf20Sopenharmony_ci return error; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci error = silead_ts_startup(client); 4108c2ecf20Sopenharmony_ci if (error) 4118c2ecf20Sopenharmony_ci return error; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci status = silead_ts_get_status(client); 4148c2ecf20Sopenharmony_ci if (status != SILEAD_STATUS_OK) { 4158c2ecf20Sopenharmony_ci dev_err(&client->dev, 4168c2ecf20Sopenharmony_ci "Initialization error, status: 0x%X\n", status); 4178c2ecf20Sopenharmony_ci return -ENODEV; 4188c2ecf20Sopenharmony_ci } 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci return 0; 4218c2ecf20Sopenharmony_ci} 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_cistatic irqreturn_t silead_ts_threaded_irq_handler(int irq, void *id) 4248c2ecf20Sopenharmony_ci{ 4258c2ecf20Sopenharmony_ci struct silead_ts_data *data = id; 4268c2ecf20Sopenharmony_ci struct i2c_client *client = data->client; 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_ci silead_ts_read_data(client); 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci return IRQ_HANDLED; 4318c2ecf20Sopenharmony_ci} 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_cistatic void silead_ts_read_props(struct i2c_client *client) 4348c2ecf20Sopenharmony_ci{ 4358c2ecf20Sopenharmony_ci struct silead_ts_data *data = i2c_get_clientdata(client); 4368c2ecf20Sopenharmony_ci struct device *dev = &client->dev; 4378c2ecf20Sopenharmony_ci const char *str; 4388c2ecf20Sopenharmony_ci int error; 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci error = device_property_read_u32(dev, "silead,max-fingers", 4418c2ecf20Sopenharmony_ci &data->max_fingers); 4428c2ecf20Sopenharmony_ci if (error) { 4438c2ecf20Sopenharmony_ci dev_dbg(dev, "Max fingers read error %d\n", error); 4448c2ecf20Sopenharmony_ci data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ 4458c2ecf20Sopenharmony_ci } 4468c2ecf20Sopenharmony_ci 4478c2ecf20Sopenharmony_ci error = device_property_read_string(dev, "firmware-name", &str); 4488c2ecf20Sopenharmony_ci if (!error) 4498c2ecf20Sopenharmony_ci snprintf(data->fw_name, sizeof(data->fw_name), 4508c2ecf20Sopenharmony_ci "silead/%s", str); 4518c2ecf20Sopenharmony_ci else 4528c2ecf20Sopenharmony_ci dev_dbg(dev, "Firmware file name read error. Using default."); 4538c2ecf20Sopenharmony_ci} 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci#ifdef CONFIG_ACPI 4568c2ecf20Sopenharmony_cistatic int silead_ts_set_default_fw_name(struct silead_ts_data *data, 4578c2ecf20Sopenharmony_ci const struct i2c_device_id *id) 4588c2ecf20Sopenharmony_ci{ 4598c2ecf20Sopenharmony_ci const struct acpi_device_id *acpi_id; 4608c2ecf20Sopenharmony_ci struct device *dev = &data->client->dev; 4618c2ecf20Sopenharmony_ci int i; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci if (ACPI_HANDLE(dev)) { 4648c2ecf20Sopenharmony_ci acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); 4658c2ecf20Sopenharmony_ci if (!acpi_id) 4668c2ecf20Sopenharmony_ci return -ENODEV; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci snprintf(data->fw_name, sizeof(data->fw_name), 4698c2ecf20Sopenharmony_ci "silead/%s.fw", acpi_id->id); 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci for (i = 0; i < strlen(data->fw_name); i++) 4728c2ecf20Sopenharmony_ci data->fw_name[i] = tolower(data->fw_name[i]); 4738c2ecf20Sopenharmony_ci } else { 4748c2ecf20Sopenharmony_ci snprintf(data->fw_name, sizeof(data->fw_name), 4758c2ecf20Sopenharmony_ci "silead/%s.fw", id->name); 4768c2ecf20Sopenharmony_ci } 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci return 0; 4798c2ecf20Sopenharmony_ci} 4808c2ecf20Sopenharmony_ci#else 4818c2ecf20Sopenharmony_cistatic int silead_ts_set_default_fw_name(struct silead_ts_data *data, 4828c2ecf20Sopenharmony_ci const struct i2c_device_id *id) 4838c2ecf20Sopenharmony_ci{ 4848c2ecf20Sopenharmony_ci snprintf(data->fw_name, sizeof(data->fw_name), 4858c2ecf20Sopenharmony_ci "silead/%s.fw", id->name); 4868c2ecf20Sopenharmony_ci return 0; 4878c2ecf20Sopenharmony_ci} 4888c2ecf20Sopenharmony_ci#endif 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_cistatic void silead_disable_regulator(void *arg) 4918c2ecf20Sopenharmony_ci{ 4928c2ecf20Sopenharmony_ci struct silead_ts_data *data = arg; 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators); 4958c2ecf20Sopenharmony_ci} 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_cistatic int silead_ts_probe(struct i2c_client *client, 4988c2ecf20Sopenharmony_ci const struct i2c_device_id *id) 4998c2ecf20Sopenharmony_ci{ 5008c2ecf20Sopenharmony_ci struct silead_ts_data *data; 5018c2ecf20Sopenharmony_ci struct device *dev = &client->dev; 5028c2ecf20Sopenharmony_ci int error; 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci if (!i2c_check_functionality(client->adapter, 5058c2ecf20Sopenharmony_ci I2C_FUNC_I2C | 5068c2ecf20Sopenharmony_ci I2C_FUNC_SMBUS_READ_I2C_BLOCK | 5078c2ecf20Sopenharmony_ci I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { 5088c2ecf20Sopenharmony_ci dev_err(dev, "I2C functionality check failed\n"); 5098c2ecf20Sopenharmony_ci return -ENXIO; 5108c2ecf20Sopenharmony_ci } 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 5138c2ecf20Sopenharmony_ci if (!data) 5148c2ecf20Sopenharmony_ci return -ENOMEM; 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_ci i2c_set_clientdata(client, data); 5178c2ecf20Sopenharmony_ci data->client = client; 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci error = silead_ts_set_default_fw_name(data, id); 5208c2ecf20Sopenharmony_ci if (error) 5218c2ecf20Sopenharmony_ci return error; 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci silead_ts_read_props(client); 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_ci /* We must have the IRQ provided by DT or ACPI subsytem */ 5268c2ecf20Sopenharmony_ci if (client->irq <= 0) 5278c2ecf20Sopenharmony_ci return -ENODEV; 5288c2ecf20Sopenharmony_ci 5298c2ecf20Sopenharmony_ci data->regulators[0].supply = "vddio"; 5308c2ecf20Sopenharmony_ci data->regulators[1].supply = "avdd"; 5318c2ecf20Sopenharmony_ci error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators), 5328c2ecf20Sopenharmony_ci data->regulators); 5338c2ecf20Sopenharmony_ci if (error) 5348c2ecf20Sopenharmony_ci return error; 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci /* 5378c2ecf20Sopenharmony_ci * Enable regulators at probe and disable them at remove, we need 5388c2ecf20Sopenharmony_ci * to keep the chip powered otherwise it forgets its firmware. 5398c2ecf20Sopenharmony_ci */ 5408c2ecf20Sopenharmony_ci error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), 5418c2ecf20Sopenharmony_ci data->regulators); 5428c2ecf20Sopenharmony_ci if (error) 5438c2ecf20Sopenharmony_ci return error; 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci error = devm_add_action_or_reset(dev, silead_disable_regulator, data); 5468c2ecf20Sopenharmony_ci if (error) 5478c2ecf20Sopenharmony_ci return error; 5488c2ecf20Sopenharmony_ci 5498c2ecf20Sopenharmony_ci /* Power GPIO pin */ 5508c2ecf20Sopenharmony_ci data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); 5518c2ecf20Sopenharmony_ci if (IS_ERR(data->gpio_power)) { 5528c2ecf20Sopenharmony_ci if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) 5538c2ecf20Sopenharmony_ci dev_err(dev, "Shutdown GPIO request failed\n"); 5548c2ecf20Sopenharmony_ci return PTR_ERR(data->gpio_power); 5558c2ecf20Sopenharmony_ci } 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci error = silead_ts_setup(client); 5588c2ecf20Sopenharmony_ci if (error) 5598c2ecf20Sopenharmony_ci return error; 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci error = silead_ts_request_input_dev(data); 5628c2ecf20Sopenharmony_ci if (error) 5638c2ecf20Sopenharmony_ci return error; 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_ci error = devm_request_threaded_irq(dev, client->irq, 5668c2ecf20Sopenharmony_ci NULL, silead_ts_threaded_irq_handler, 5678c2ecf20Sopenharmony_ci IRQF_ONESHOT, client->name, data); 5688c2ecf20Sopenharmony_ci if (error) { 5698c2ecf20Sopenharmony_ci if (error != -EPROBE_DEFER) 5708c2ecf20Sopenharmony_ci dev_err(dev, "IRQ request failed %d\n", error); 5718c2ecf20Sopenharmony_ci return error; 5728c2ecf20Sopenharmony_ci } 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci return 0; 5758c2ecf20Sopenharmony_ci} 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_cistatic int __maybe_unused silead_ts_suspend(struct device *dev) 5788c2ecf20Sopenharmony_ci{ 5798c2ecf20Sopenharmony_ci struct i2c_client *client = to_i2c_client(dev); 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci disable_irq(client->irq); 5828c2ecf20Sopenharmony_ci silead_ts_set_power(client, SILEAD_POWER_OFF); 5838c2ecf20Sopenharmony_ci return 0; 5848c2ecf20Sopenharmony_ci} 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_cistatic int __maybe_unused silead_ts_resume(struct device *dev) 5878c2ecf20Sopenharmony_ci{ 5888c2ecf20Sopenharmony_ci struct i2c_client *client = to_i2c_client(dev); 5898c2ecf20Sopenharmony_ci bool second_try = false; 5908c2ecf20Sopenharmony_ci int error, status; 5918c2ecf20Sopenharmony_ci 5928c2ecf20Sopenharmony_ci silead_ts_set_power(client, SILEAD_POWER_ON); 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci retry: 5958c2ecf20Sopenharmony_ci error = silead_ts_reset(client); 5968c2ecf20Sopenharmony_ci if (error) 5978c2ecf20Sopenharmony_ci return error; 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_ci if (second_try) { 6008c2ecf20Sopenharmony_ci error = silead_ts_load_fw(client); 6018c2ecf20Sopenharmony_ci if (error) 6028c2ecf20Sopenharmony_ci return error; 6038c2ecf20Sopenharmony_ci } 6048c2ecf20Sopenharmony_ci 6058c2ecf20Sopenharmony_ci error = silead_ts_startup(client); 6068c2ecf20Sopenharmony_ci if (error) 6078c2ecf20Sopenharmony_ci return error; 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ci status = silead_ts_get_status(client); 6108c2ecf20Sopenharmony_ci if (status != SILEAD_STATUS_OK) { 6118c2ecf20Sopenharmony_ci if (!second_try) { 6128c2ecf20Sopenharmony_ci second_try = true; 6138c2ecf20Sopenharmony_ci dev_dbg(dev, "Reloading firmware after unsuccessful resume\n"); 6148c2ecf20Sopenharmony_ci goto retry; 6158c2ecf20Sopenharmony_ci } 6168c2ecf20Sopenharmony_ci dev_err(dev, "Resume error, status: 0x%02x\n", status); 6178c2ecf20Sopenharmony_ci return -ENODEV; 6188c2ecf20Sopenharmony_ci } 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci enable_irq(client->irq); 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci return 0; 6238c2ecf20Sopenharmony_ci} 6248c2ecf20Sopenharmony_ci 6258c2ecf20Sopenharmony_cistatic SIMPLE_DEV_PM_OPS(silead_ts_pm, silead_ts_suspend, silead_ts_resume); 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_cistatic const struct i2c_device_id silead_ts_id[] = { 6288c2ecf20Sopenharmony_ci { "gsl1680", 0 }, 6298c2ecf20Sopenharmony_ci { "gsl1688", 0 }, 6308c2ecf20Sopenharmony_ci { "gsl3670", 0 }, 6318c2ecf20Sopenharmony_ci { "gsl3675", 0 }, 6328c2ecf20Sopenharmony_ci { "gsl3692", 0 }, 6338c2ecf20Sopenharmony_ci { "mssl1680", 0 }, 6348c2ecf20Sopenharmony_ci { } 6358c2ecf20Sopenharmony_ci}; 6368c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(i2c, silead_ts_id); 6378c2ecf20Sopenharmony_ci 6388c2ecf20Sopenharmony_ci#ifdef CONFIG_ACPI 6398c2ecf20Sopenharmony_cistatic const struct acpi_device_id silead_ts_acpi_match[] = { 6408c2ecf20Sopenharmony_ci { "GSL1680", 0 }, 6418c2ecf20Sopenharmony_ci { "GSL1688", 0 }, 6428c2ecf20Sopenharmony_ci { "GSL3670", 0 }, 6438c2ecf20Sopenharmony_ci { "GSL3675", 0 }, 6448c2ecf20Sopenharmony_ci { "GSL3692", 0 }, 6458c2ecf20Sopenharmony_ci { "MSSL1680", 0 }, 6468c2ecf20Sopenharmony_ci { "MSSL0001", 0 }, 6478c2ecf20Sopenharmony_ci { "MSSL0002", 0 }, 6488c2ecf20Sopenharmony_ci { "MSSL0017", 0 }, 6498c2ecf20Sopenharmony_ci { } 6508c2ecf20Sopenharmony_ci}; 6518c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match); 6528c2ecf20Sopenharmony_ci#endif 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_ci#ifdef CONFIG_OF 6558c2ecf20Sopenharmony_cistatic const struct of_device_id silead_ts_of_match[] = { 6568c2ecf20Sopenharmony_ci { .compatible = "silead,gsl1680" }, 6578c2ecf20Sopenharmony_ci { .compatible = "silead,gsl1688" }, 6588c2ecf20Sopenharmony_ci { .compatible = "silead,gsl3670" }, 6598c2ecf20Sopenharmony_ci { .compatible = "silead,gsl3675" }, 6608c2ecf20Sopenharmony_ci { .compatible = "silead,gsl3692" }, 6618c2ecf20Sopenharmony_ci { }, 6628c2ecf20Sopenharmony_ci}; 6638c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, silead_ts_of_match); 6648c2ecf20Sopenharmony_ci#endif 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_cistatic struct i2c_driver silead_ts_driver = { 6678c2ecf20Sopenharmony_ci .probe = silead_ts_probe, 6688c2ecf20Sopenharmony_ci .id_table = silead_ts_id, 6698c2ecf20Sopenharmony_ci .driver = { 6708c2ecf20Sopenharmony_ci .name = SILEAD_TS_NAME, 6718c2ecf20Sopenharmony_ci .acpi_match_table = ACPI_PTR(silead_ts_acpi_match), 6728c2ecf20Sopenharmony_ci .of_match_table = of_match_ptr(silead_ts_of_match), 6738c2ecf20Sopenharmony_ci .pm = &silead_ts_pm, 6748c2ecf20Sopenharmony_ci }, 6758c2ecf20Sopenharmony_ci}; 6768c2ecf20Sopenharmony_cimodule_i2c_driver(silead_ts_driver); 6778c2ecf20Sopenharmony_ci 6788c2ecf20Sopenharmony_ciMODULE_AUTHOR("Robert Dolca <robert.dolca@intel.com>"); 6798c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Silead I2C touchscreen driver"); 6808c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 681