Lines Matching +full:linux +full:- +full:keycodes
1 // SPDX-License-Identifier: GPL-2.0-or-later
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/i2c.h>
16 #include <linux/input.h>
17 #include <linux/slab.h>
18 #include <linux/irq.h>
19 #include <linux/interrupt.h>
20 #include <linux/jiffies.h>
21 #include <linux/delay.h>
52 unsigned short keycodes[ARRAY_SIZE(qt1070_key2code)]; member
62 dev_err(&client->dev, in qt1070_read()
74 dev_err(&client->dev, in qt1070_write()
87 dev_err(&client->dev, "ID %d not supported\n", id); in qt1070_identify()
94 dev_err(&client->dev, "could not read the firmware version\n"); in qt1070_identify()
98 dev_info(&client->dev, "AT42QT1070 firmware version %x\n", ver); in qt1070_identify()
106 struct i2c_client *client = data->client; in qt1070_interrupt()
107 struct input_dev *input = data->input; in qt1070_interrupt()
119 if ((data->last_keys & mask) != keyval) in qt1070_interrupt()
120 input_report_key(input, data->keycodes[i], keyval); in qt1070_interrupt()
125 data->last_keys = new_keys; in qt1070_interrupt()
136 err = i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE); in qt1070_probe()
138 dev_err(&client->dev, "%s adapter not supported\n", in qt1070_probe()
139 dev_driver_string(&client->adapter->dev)); in qt1070_probe()
140 return -ENODEV; in qt1070_probe()
143 if (!client->irq) { in qt1070_probe()
144 dev_err(&client->dev, "please assign the irq to this device\n"); in qt1070_probe()
145 return -EINVAL; in qt1070_probe()
150 return -ENODEV; in qt1070_probe()
152 data = devm_kzalloc(&client->dev, sizeof(struct qt1070_data), in qt1070_probe()
155 return -ENOMEM; in qt1070_probe()
157 input = devm_input_allocate_device(&client->dev); in qt1070_probe()
159 return -ENOMEM; in qt1070_probe()
161 data->client = client; in qt1070_probe()
162 data->input = input; in qt1070_probe()
163 data->irq = client->irq; in qt1070_probe()
165 input->name = "AT42QT1070 QTouch Sensor"; in qt1070_probe()
166 input->id.bustype = BUS_I2C; in qt1070_probe()
169 input->keycode = data->keycodes; in qt1070_probe()
170 input->keycodesize = sizeof(data->keycodes[0]); in qt1070_probe()
171 input->keycodemax = ARRAY_SIZE(qt1070_key2code); in qt1070_probe()
173 __set_bit(EV_KEY, input->evbit); in qt1070_probe()
176 data->keycodes[i] = qt1070_key2code[i]; in qt1070_probe()
177 __set_bit(qt1070_key2code[i], input->keybit); in qt1070_probe()
188 err = devm_request_threaded_irq(&client->dev, client->irq, in qt1070_probe()
191 client->dev.driver->name, data); in qt1070_probe()
193 dev_err(&client->dev, "fail to request irq\n"); in qt1070_probe()
198 err = input_register_device(data->input); in qt1070_probe()
200 dev_err(&client->dev, "Failed to register input device\n"); in qt1070_probe()
218 enable_irq_wake(data->irq); in qt1070_suspend()
229 disable_irq_wake(data->irq); in qt1070_resume()