Lines Matching +full:touch +full:- +full:keys

1 // SPDX-License-Identifier: GPL-2.0-only
49 /* Threshold of touch/release trigger */
52 /* Masks for touch and release triggers */
54 /* MPR121 has 12 keys */
88 struct input_dev *input = mpr121->input_dev; in mpr_touchkey_report()
89 struct i2c_client *client = mpr121->client; in mpr_touchkey_report()
96 dev_err(&client->dev, "i2c read error [%d]\n", reg); in mpr_touchkey_report()
103 dev_err(&client->dev, "i2c read error [%d]\n", reg); in mpr_touchkey_report()
109 bit_changed = reg ^ mpr121->statusbits; in mpr_touchkey_report()
110 mpr121->statusbits = reg; in mpr_touchkey_report()
111 for_each_set_bit(key_num, &bit_changed, mpr121->keycount) { in mpr_touchkey_report()
115 key_val = mpr121->keycodes[key_num]; in mpr_touchkey_report()
120 dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val, in mpr_touchkey_report()
131 mpr_touchkey_report(mpr121->input_dev); in mpr_touchkey_interrupt()
143 /* Set up touch/release threshold for ele0-ele11 */ in mpr121_phys_init()
158 ret = i2c_smbus_write_byte_data(client, reg->addr, reg->val); in mpr121_phys_init()
166 * The internal MPR121-auto-configuration can do this if it's in mpr121_phys_init()
170 usl = ((vdd - 700) * 256) / vdd; in mpr121_phys_init()
182 eleconf = mpr121->keycount | ELECTRODE_CONF_QUICK_CHARGE; in mpr121_phys_init()
188 dev_dbg(&client->dev, "set up with %x keys.\n", mpr121->keycount); in mpr121_phys_init()
193 dev_err(&client->dev, "i2c write error: %d\n", ret); in mpr121_phys_init()
199 struct device *dev = &client->dev; in mpr_touchkey_probe()
213 return -ENOMEM; in mpr_touchkey_probe()
217 return -ENOMEM; in mpr_touchkey_probe()
219 mpr121->client = client; in mpr_touchkey_probe()
220 mpr121->input_dev = input_dev; in mpr_touchkey_probe()
221 mpr121->keycount = device_property_count_u32(dev, "linux,keycodes"); in mpr_touchkey_probe()
222 if (mpr121->keycount > MPR121_MAX_KEY_COUNT) { in mpr_touchkey_probe()
223 dev_err(dev, "too many keys defined (%d)\n", mpr121->keycount); in mpr_touchkey_probe()
224 return -EINVAL; in mpr_touchkey_probe()
228 mpr121->keycodes, in mpr_touchkey_probe()
229 mpr121->keycount); in mpr_touchkey_probe()
236 input_dev->name = "Freescale MPR121 Touchkey"; in mpr_touchkey_probe()
237 input_dev->id.bustype = BUS_I2C; in mpr_touchkey_probe()
238 input_dev->dev.parent = dev; in mpr_touchkey_probe()
240 __set_bit(EV_REP, input_dev->evbit); in mpr_touchkey_probe()
244 input_dev->keycode = mpr121->keycodes; in mpr_touchkey_probe()
245 input_dev->keycodesize = sizeof(mpr121->keycodes[0]); in mpr_touchkey_probe()
246 input_dev->keycodemax = mpr121->keycount; in mpr_touchkey_probe()
248 for (i = 0; i < mpr121->keycount; i++) in mpr_touchkey_probe()
249 input_set_capability(input_dev, EV_KEY, mpr121->keycodes[i]); in mpr_touchkey_probe()
257 device_property_read_u32(dev, "poll-interval", &poll_interval); in mpr_touchkey_probe()
259 if (client->irq) { in mpr_touchkey_probe()
260 error = devm_request_threaded_irq(dev, client->irq, NULL, in mpr_touchkey_probe()
264 dev->driver->name, mpr121); in mpr_touchkey_probe()
271 return -EINVAL; in mpr_touchkey_probe()
274 return -EINVAL; in mpr_touchkey_probe()
290 return -EINVAL; in mpr_touchkey_probe()
299 device_property_read_bool(dev, "wakeup-source")); in mpr_touchkey_probe()
308 if (device_may_wakeup(&client->dev)) in mpr_suspend()
309 enable_irq_wake(client->irq); in mpr_suspend()
321 if (device_may_wakeup(&client->dev)) in mpr_resume()
322 disable_irq_wake(client->irq); in mpr_resume()
325 mpr121->keycount); in mpr_resume()
340 { .compatible = "fsl,mpr121-touchkey" },
360 MODULE_DESCRIPTION("Touch Key driver for Freescale MPR121 Chip");