Lines Matching +full:debounce +full:- +full:rep
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * linux/drivers/input/keyboard/omap-keypad.c
8 * Written by Timo Teräs <ext-timo.teras@nokia.com>
24 #include <linux/platform_data/gpio-omap.h>
25 #include <linux/platform_data/keypad-omap.h>
26 #include <linux/soc/ti/omap1-io.h>
36 static int kp_cur_group = -1;
45 unsigned int debounce; member
75 for (col = 0; col < omap_kp->cols; col++) { in omap_kp_scan_keypad()
79 udelay(omap_kp->delay); in omap_kp_scan_keypad()
91 unsigned short *keycodes = omap_kp_data->input->keycode; in omap_kp_tasklet()
92 unsigned int row_shift = get_count_order(omap_kp_data->cols); in omap_kp_tasklet()
100 for (col = 0; col < omap_kp_data->cols; col++) { in omap_kp_tasklet()
106 for (row = 0; row < omap_kp_data->rows; row++) { in omap_kp_tasklet()
111 printk(KERN_INFO "omap-keypad: key %d-%d %s\n", col, in omap_kp_tasklet()
118 kp_cur_group == -1)) in omap_kp_tasklet()
122 input_report_key(omap_kp_data->input, key & ~GROUP_MASK, in omap_kp_tasklet()
127 input_sync(omap_kp_data->input); in omap_kp_tasklet()
131 /* some key is pressed - keep irq disabled and use timer in omap_kp_tasklet()
133 mod_timer(&omap_kp_data->timer, jiffies + HZ / 20); in omap_kp_tasklet()
137 kp_cur_group = -1; in omap_kp_tasklet()
154 return -EINVAL; in omap_kp_enable_store()
157 return -EINVAL; in omap_kp_enable_store()
162 enable_irq(omap_kp->irq); in omap_kp_enable_store()
164 disable_irq(omap_kp->irq); in omap_kp_enable_store()
184 struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev); in omap_kp_probe()
188 if (!pdata->rows || !pdata->cols || !pdata->keymap_data) { in omap_kp_probe()
190 return -EINVAL; in omap_kp_probe()
193 row_shift = get_count_order(pdata->cols); in omap_kp_probe()
194 keycodemax = pdata->rows << row_shift; in omap_kp_probe()
201 return -ENOMEM; in omap_kp_probe()
206 omap_kp->input = input_dev; in omap_kp_probe()
211 if (pdata->delay) in omap_kp_probe()
212 omap_kp->delay = pdata->delay; in omap_kp_probe()
214 omap_kp->rows = pdata->rows; in omap_kp_probe()
215 omap_kp->cols = pdata->cols; in omap_kp_probe()
217 timer_setup(&omap_kp->timer, omap_kp_timer, 0); in omap_kp_probe()
224 input_dev->name = "omap-keypad"; in omap_kp_probe()
225 input_dev->phys = "omap-keypad/input0"; in omap_kp_probe()
226 input_dev->dev.parent = &pdev->dev; in omap_kp_probe()
228 input_dev->id.bustype = BUS_HOST; in omap_kp_probe()
229 input_dev->id.vendor = 0x0001; in omap_kp_probe()
230 input_dev->id.product = 0x0001; in omap_kp_probe()
231 input_dev->id.version = 0x0100; in omap_kp_probe()
233 if (pdata->rep) in omap_kp_probe()
234 __set_bit(EV_REP, input_dev->evbit); in omap_kp_probe()
236 ret = matrix_keypad_build_keymap(pdata->keymap_data, NULL, in omap_kp_probe()
237 pdata->rows, pdata->cols, in omap_kp_probe()
238 omap_kp->keymap, input_dev); in omap_kp_probe()
242 ret = input_register_device(omap_kp->input); in omap_kp_probe()
244 printk(KERN_ERR "Unable to register omap-keypad input device\n"); in omap_kp_probe()
248 if (pdata->dbounce) in omap_kp_probe()
253 omap_kp->irq = platform_get_irq(pdev, 0); in omap_kp_probe()
254 if (omap_kp->irq >= 0) { in omap_kp_probe()
255 if (request_irq(omap_kp->irq, omap_kp_interrupt, 0, in omap_kp_probe()
256 "omap-keypad", omap_kp) < 0) in omap_kp_probe()
264 input_unregister_device(omap_kp->input); in omap_kp_probe()
270 return -EINVAL; in omap_kp_probe()
280 free_irq(omap_kp->irq, omap_kp); in omap_kp_remove()
282 timer_shutdown_sync(&omap_kp->timer); in omap_kp_remove()
286 input_unregister_device(omap_kp->input); in omap_kp_remove()
295 .name = "omap-keypad",
304 MODULE_ALIAS("platform:omap-keypad");