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 */
124 struct input_dev *input = mpr121->input_dev; in mpr_touchkey_report()
125 struct i2c_client *client = mpr121->client; in mpr_touchkey_report()
132 dev_err(&client->dev, "i2c read error [%d]\n", reg); in mpr_touchkey_report()
139 dev_err(&client->dev, "i2c read error [%d]\n", reg); in mpr_touchkey_report()
145 bit_changed = reg ^ mpr121->statusbits; in mpr_touchkey_report()
146 mpr121->statusbits = reg; in mpr_touchkey_report()
147 for_each_set_bit(key_num, &bit_changed, mpr121->keycount) { in mpr_touchkey_report()
151 key_val = mpr121->keycodes[key_num]; in mpr_touchkey_report()
156 dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val, in mpr_touchkey_report()
167 mpr_touchkey_report(mpr121->input_dev); in mpr_touchkey_interrupt()
179 /* Set up touch/release threshold for ele0-ele11 */ in mpr121_phys_init()
194 ret = i2c_smbus_write_byte_data(client, reg->addr, reg->val); in mpr121_phys_init()
202 * The internal MPR121-auto-configuration can do this if it's in mpr121_phys_init()
206 usl = ((vdd - 700) * 256) / vdd; in mpr121_phys_init()
218 eleconf = mpr121->keycount | ELECTRODE_CONF_QUICK_CHARGE; in mpr121_phys_init()
224 dev_dbg(&client->dev, "set up with %x keys.\n", mpr121->keycount); in mpr121_phys_init()
229 dev_err(&client->dev, "i2c write error: %d\n", ret); in mpr121_phys_init()
235 struct device *dev = &client->dev; in mpr_touchkey_probe()
252 return -ENOMEM; in mpr_touchkey_probe()
256 return -ENOMEM; in mpr_touchkey_probe()
258 mpr121->client = client; in mpr_touchkey_probe()
259 mpr121->input_dev = input_dev; in mpr_touchkey_probe()
260 mpr121->keycount = device_property_count_u32(dev, "linux,keycodes"); in mpr_touchkey_probe()
261 if (mpr121->keycount > MPR121_MAX_KEY_COUNT) { in mpr_touchkey_probe()
262 dev_err(dev, "too many keys defined (%d)\n", mpr121->keycount); in mpr_touchkey_probe()
263 return -EINVAL; in mpr_touchkey_probe()
267 mpr121->keycodes, in mpr_touchkey_probe()
268 mpr121->keycount); in mpr_touchkey_probe()
275 input_dev->name = "Freescale MPR121 Touchkey"; in mpr_touchkey_probe()
276 input_dev->id.bustype = BUS_I2C; in mpr_touchkey_probe()
277 input_dev->dev.parent = dev; in mpr_touchkey_probe()
279 __set_bit(EV_REP, input_dev->evbit); in mpr_touchkey_probe()
283 input_dev->keycode = mpr121->keycodes; in mpr_touchkey_probe()
284 input_dev->keycodesize = sizeof(mpr121->keycodes[0]); in mpr_touchkey_probe()
285 input_dev->keycodemax = mpr121->keycount; in mpr_touchkey_probe()
287 for (i = 0; i < mpr121->keycount; i++) in mpr_touchkey_probe()
288 input_set_capability(input_dev, EV_KEY, mpr121->keycodes[i]); in mpr_touchkey_probe()
296 device_property_read_u32(dev, "poll-interval", &poll_interval); in mpr_touchkey_probe()
298 if (client->irq) { in mpr_touchkey_probe()
299 error = devm_request_threaded_irq(dev, client->irq, NULL, in mpr_touchkey_probe()
303 dev->driver->name, mpr121); in mpr_touchkey_probe()
310 return -EINVAL; in mpr_touchkey_probe()
313 return -EINVAL; in mpr_touchkey_probe()
329 return -EINVAL; in mpr_touchkey_probe()
338 device_property_read_bool(dev, "wakeup-source")); in mpr_touchkey_probe()
347 if (device_may_wakeup(&client->dev)) in mpr_suspend()
348 enable_irq_wake(client->irq); in mpr_suspend()
360 if (device_may_wakeup(&client->dev)) in mpr_resume()
361 disable_irq_wake(client->irq); in mpr_resume()
364 mpr121->keycount); in mpr_resume()
379 { .compatible = "fsl,mpr121-touchkey" },
399 MODULE_DESCRIPTION("Touch Key driver for Freescale MPR121 Chip");