^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2016, Jelle van der Waa <jelle@vdwaa.nl>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/input/mt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/input/touchscreen.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/regulator/consumer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/unaligned.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define ZET6223_MAX_FINGERS 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define ZET6223_MAX_PKT_SIZE (3 + 4 * ZET6223_MAX_FINGERS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define ZET6223_CMD_INFO 0xB2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define ZET6223_CMD_INFO_LENGTH 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define ZET6223_VALID_PACKET 0x3c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define ZET6223_POWER_ON_DELAY_MSEC 30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct zet6223_ts {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct i2c_client *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct regulator *vcc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct regulator *vio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct touchscreen_properties prop;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct regulator_bulk_data supplies[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u16 max_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) u16 max_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) u8 fingernum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static int zet6223_start(struct input_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct zet6223_ts *ts = input_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) enable_irq(ts->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static void zet6223_stop(struct input_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct zet6223_ts *ts = input_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) disable_irq(ts->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) static irqreturn_t zet6223_irq(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct zet6223_ts *ts = dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) u16 finger_bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * First 3 bytes are an identifier, two bytes of finger data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * X, Y data per finger is 4 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) u8 bufsize = 3 + 4 * ts->fingernum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) u8 buf[ZET6223_MAX_PKT_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ret = i2c_master_recv(ts->client, buf, bufsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) if (ret != bufsize) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) error = ret < 0 ? ret : -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) dev_err_ratelimited(&ts->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) "Error reading input data: %d\n", error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) if (buf[0] != ZET6223_VALID_PACKET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) finger_bits = get_unaligned_be16(buf + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) for (i = 0; i < ts->fingernum; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) if (!(finger_bits & BIT(15 - i)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) input_event(ts->input, EV_ABS, ABS_MT_POSITION_X,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) ((buf[i + 3] >> 4) << 8) + buf[i + 4]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) input_event(ts->input, EV_ABS, ABS_MT_POSITION_Y,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ((buf[i + 3] & 0xF) << 8) + buf[i + 5]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) input_mt_sync_frame(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) static void zet6223_power_off(void *_ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct zet6223_ts *ts = _ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) regulator_bulk_disable(ARRAY_SIZE(ts->supplies), ts->supplies);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static int zet6223_power_on(struct zet6223_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct device *dev = &ts->client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) ts->supplies[0].supply = "vio";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ts->supplies[1].supply = "vcc";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->supplies),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) ts->supplies);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) error = regulator_bulk_enable(ARRAY_SIZE(ts->supplies), ts->supplies);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) msleep(ZET6223_POWER_ON_DELAY_MSEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) error = devm_add_action_or_reset(dev, zet6223_power_off, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) dev_err(dev, "failed to install poweroff action: %d\n", error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) static int zet6223_query_device(struct zet6223_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) u8 buf[ZET6223_CMD_INFO_LENGTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) u8 cmd = ZET6223_CMD_INFO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) ret = i2c_master_send(ts->client, &cmd, sizeof(cmd));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) if (ret != sizeof(cmd)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) error = ret < 0 ? ret : -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) dev_err(&ts->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) "touchpanel info cmd failed: %d\n", error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) ret = i2c_master_recv(ts->client, buf, sizeof(buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) if (ret != sizeof(buf)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) error = ret < 0 ? ret : -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) dev_err(&ts->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) "failed to retrieve touchpanel info: %d\n", error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) ts->fingernum = buf[15] & 0x7F;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) if (ts->fingernum > ZET6223_MAX_FINGERS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) dev_warn(&ts->client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) "touchpanel reports %d fingers, limiting to %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) ts->fingernum, ZET6223_MAX_FINGERS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) ts->fingernum = ZET6223_MAX_FINGERS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) ts->max_x = get_unaligned_le16(&buf[8]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ts->max_y = get_unaligned_le16(&buf[10]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static int zet6223_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct device *dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) struct zet6223_ts *ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) if (!client->irq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) dev_err(dev, "no irq specified\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (!ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) ts->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) error = zet6223_power_on(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) error = zet6223_query_device(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) ts->input = input = devm_input_allocate_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) if (!input)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) input_set_drvdata(input, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) input->name = client->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) input->id.bustype = BUS_I2C;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) input->open = zet6223_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) input->close = zet6223_stop;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) input_set_abs_params(input, ABS_MT_POSITION_X, 0, ts->max_x, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) touchscreen_parse_properties(input, true, &ts->prop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) error = input_mt_init_slots(input, ts->fingernum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) error = devm_request_threaded_irq(dev, client->irq, NULL, zet6223_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) IRQF_ONESHOT, client->name, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) dev_err(dev, "failed to request irq %d: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) client->irq, error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) zet6223_stop(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) error = input_register_device(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) static const struct of_device_id zet6223_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) { .compatible = "zeitec,zet6223" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) MODULE_DEVICE_TABLE(of, zet6223_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static const struct i2c_device_id zet6223_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) { "zet6223", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) MODULE_DEVICE_TABLE(i2c, zet6223_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) static struct i2c_driver zet6223_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .name = "zet6223",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .of_match_table = zet6223_of_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .probe = zet6223_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .id_table = zet6223_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) module_i2c_driver(zet6223_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) MODULE_AUTHOR("Jelle van der Waa <jelle@vdwaa.nl>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) MODULE_DESCRIPTION("ZEITEC zet622x I2C touchscreen driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) MODULE_LICENSE("GPL");