Lines Matching +full:multi +full:- +full:touch
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Atmel Atmegaxx Capacitive Touch Button Driver
10 * on Atmega88PA part and uses QtouchADC parts for sensing touch.
19 * to poke at /dev/i2c-N devices.
86 struct i2c_client *client = capdev->client; in atmel_read()
87 struct device *dev = &client->dev; in atmel_read()
91 if (len > sizeof(capdev->xfer_buf) - 2) in atmel_read()
92 return -EINVAL; in atmel_read()
94 capdev->xfer_buf[0] = reg; in atmel_read()
95 capdev->xfer_buf[1] = len; in atmel_read()
97 msg[0].addr = client->addr; in atmel_read()
99 msg[0].buf = capdev->xfer_buf; in atmel_read()
102 msg[1].addr = client->addr; in atmel_read()
104 msg[1].buf = capdev->xfer_buf; in atmel_read()
107 err = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); in atmel_read()
109 return err < 0 ? err : -EIO; in atmel_read()
111 if (capdev->xfer_buf[0] != reg) { in atmel_read()
114 capdev->xfer_buf[0], reg); in atmel_read()
115 return -ECOMM; in atmel_read()
118 memcpy(data, &capdev->xfer_buf[2], len); in atmel_read()
125 * Multi-touch can be supported; however, it really depends on whether
126 * the device can multi-touch.
131 struct device *dev = &capdev->client->dev; in atmel_captouch_isr()
145 changed_btn = new_btn ^ capdev->prev_btn; in atmel_captouch_isr()
146 capdev->prev_btn = new_btn; in atmel_captouch_isr()
148 for (i = 0; i < capdev->num_btn; i++) { in atmel_captouch_isr()
150 input_report_key(capdev->input, in atmel_captouch_isr()
151 capdev->keycodes[i], in atmel_captouch_isr()
155 input_sync(capdev->input); in atmel_captouch_isr()
167 struct device *dev = &client->dev; in atmel_captouch_probe()
172 if (!i2c_check_functionality(client->adapter, in atmel_captouch_probe()
177 return -EINVAL; in atmel_captouch_probe()
182 return -ENOMEM; in atmel_captouch_probe()
184 capdev->client = client; in atmel_captouch_probe()
187 &capdev->prev_btn, sizeof(capdev->prev_btn)); in atmel_captouch_probe()
193 capdev->input = devm_input_allocate_device(dev); in atmel_captouch_probe()
194 if (!capdev->input) { in atmel_captouch_probe()
196 return -ENOMEM; in atmel_captouch_probe()
199 capdev->input->id.bustype = BUS_I2C; in atmel_captouch_probe()
200 capdev->input->id.product = 0x880A; in atmel_captouch_probe()
201 capdev->input->id.version = 0; in atmel_captouch_probe()
202 capdev->input->name = "ATMegaXX Capacitive Button Controller"; in atmel_captouch_probe()
203 __set_bit(EV_KEY, capdev->input->evbit); in atmel_captouch_probe()
205 node = dev->of_node; in atmel_captouch_probe()
208 return -EINVAL; in atmel_captouch_probe()
212 __set_bit(EV_REP, capdev->input->evbit); in atmel_captouch_probe()
214 capdev->num_btn = of_property_count_u32_elems(node, "linux,keymap"); in atmel_captouch_probe()
215 if (capdev->num_btn > MAX_NUM_OF_BUTTONS) in atmel_captouch_probe()
216 capdev->num_btn = MAX_NUM_OF_BUTTONS; in atmel_captouch_probe()
219 capdev->keycodes, in atmel_captouch_probe()
220 capdev->num_btn); in atmel_captouch_probe()
227 for (i = 0; i < capdev->num_btn; i++) in atmel_captouch_probe()
228 __set_bit(capdev->keycodes[i], capdev->input->keybit); in atmel_captouch_probe()
230 capdev->input->keycode = capdev->keycodes; in atmel_captouch_probe()
231 capdev->input->keycodesize = sizeof(capdev->keycodes[0]); in atmel_captouch_probe()
232 capdev->input->keycodemax = capdev->num_btn; in atmel_captouch_probe()
234 err = input_register_device(capdev->input); in atmel_captouch_probe()
238 err = devm_request_threaded_irq(dev, client->irq, in atmel_captouch_probe()
244 client->irq, err); in atmel_captouch_probe()
276 MODULE_AUTHOR("Hung-yu Wu <hywu@google.com>");
277 MODULE_DESCRIPTION("Atmel ATmegaXX Capacitance Touch Sensor I2C Driver");