Lines Matching +full:debounce +full:- +full:release +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0-or-later
54 * Errata i689: If a key is released for a time shorter than debounce time,
55 * the keyboard will idle and never detect the key release. The workaround
56 * is to use at least a 12ms debounce time. See omap5432 TRM chapter
61 ((((dbms) * 1000) / ((1 << ((ptv) + 1)) * (1000000 / 32768))) - 1)
92 return __raw_readl(keypad_data->base + in kbd_readl()
93 keypad_data->reg_offset + offset); in kbd_readl()
99 keypad_data->base + keypad_data->reg_offset + offset); in kbd_writel()
104 return __raw_readl(keypad_data->base + in kbd_read_irqreg()
105 keypad_data->irqreg_offset + offset); in kbd_read_irqreg()
112 keypad_data->base + keypad_data->irqreg_offset + offset); in kbd_write_irqreg()
118 struct input_dev *input_dev = keypad_data->input; in omap4_keypad_report_keys()
126 for_each_set_bit(bit, mask, keypad_data->rows * BITS_PER_BYTE) { in omap4_keypad_report_keys()
129 code = MATRIX_SCAN_CODE(row, col, keypad_data->row_shift); in omap4_keypad_report_keys()
132 input_report_key(input_dev, keypad_data->keymap[code], down); in omap4_keypad_report_keys()
147 mutex_lock(&keypad_data->lock); in omap4_keypad_scan_keys()
149 changed = keys ^ keypad_data->keys; in omap4_keypad_scan_keys()
153 * lost key-up interrupt and just now catching up. in omap4_keypad_scan_keys()
160 keypad_data->keys = keys; in omap4_keypad_scan_keys()
162 mutex_unlock(&keypad_data->lock); in omap4_keypad_scan_keys()
179 struct device *dev = keypad_data->input->dev.parent; in omap4_keypad_irq_thread_fn()
207 struct device *dev = input->dev.parent; in omap4_keypad_open()
214 error = clk_prepare_enable(keypad_data->fck); in omap4_keypad_open()
218 disable_irq(keypad_data->irq); in omap4_keypad_open()
233 enable_irq(keypad_data->irq); in omap4_keypad_open()
244 /* Disable interrupts and wake-up events */ in omap4_keypad_stop()
257 struct device *dev = input->dev.parent; in omap4_keypad_close()
265 disable_irq(keypad_data->irq); in omap4_keypad_close()
267 enable_irq(keypad_data->irq); in omap4_keypad_close()
268 clk_disable_unprepare(keypad_data->fck); in omap4_keypad_close()
277 struct device_node *np = dev->of_node; in omap4_keypad_parse_dt()
280 err = matrix_keypad_parse_properties(dev, &keypad_data->rows, in omap4_keypad_parse_dt()
281 &keypad_data->cols); in omap4_keypad_parse_dt()
285 keypad_data->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat"); in omap4_keypad_parse_dt()
295 rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); in omap4_keypad_check_revision()
300 keypad_data->reg_offset = 0x00; in omap4_keypad_check_revision()
301 keypad_data->irqreg_offset = 0x00; in omap4_keypad_check_revision()
304 keypad_data->reg_offset = 0x10; in omap4_keypad_check_revision()
305 keypad_data->irqreg_offset = 0x0c; in omap4_keypad_check_revision()
309 return -EINVAL; in omap4_keypad_check_revision()
317 * Interrupt may not happen for key-up events. We must clear stuck
318 * key-up events after the keyboard hardware has auto-idled.
329 return -EBUSY; in omap4_keypad_runtime_suspend()
349 struct device *dev = &pdev->dev; in omap4_keypad_probe()
363 return -ENOMEM; in omap4_keypad_probe()
366 keypad_data->irq = irq; in omap4_keypad_probe()
367 keypad_data->fck = devm_clk_get(&pdev->dev, "fck"); in omap4_keypad_probe()
368 if (IS_ERR(keypad_data->fck)) in omap4_keypad_probe()
369 return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->fck), in omap4_keypad_probe()
372 mutex_init(&keypad_data->lock); in omap4_keypad_probe()
379 keypad_data->base = devm_platform_ioremap_resource(pdev, 0); in omap4_keypad_probe()
380 if (IS_ERR(keypad_data->base)) in omap4_keypad_probe()
381 return PTR_ERR(keypad_data->base); in omap4_keypad_probe()
415 keypad_data->input = input_dev = devm_input_allocate_device(dev); in omap4_keypad_probe()
417 return -ENOMEM; in omap4_keypad_probe()
419 input_dev->name = pdev->name; in omap4_keypad_probe()
420 input_dev->id.bustype = BUS_HOST; in omap4_keypad_probe()
421 input_dev->id.vendor = 0x0001; in omap4_keypad_probe()
422 input_dev->id.product = 0x0001; in omap4_keypad_probe()
423 input_dev->id.version = 0x0001; in omap4_keypad_probe()
425 input_dev->open = omap4_keypad_open; in omap4_keypad_probe()
426 input_dev->close = omap4_keypad_close; in omap4_keypad_probe()
429 if (!keypad_data->no_autorepeat) in omap4_keypad_probe()
430 __set_bit(EV_REP, input_dev->evbit); in omap4_keypad_probe()
434 keypad_data->row_shift = get_count_order(keypad_data->cols); in omap4_keypad_probe()
435 max_keys = keypad_data->rows << keypad_data->row_shift; in omap4_keypad_probe()
436 keypad_data->keymap = devm_kcalloc(dev, in omap4_keypad_probe()
438 sizeof(keypad_data->keymap[0]), in omap4_keypad_probe()
440 if (!keypad_data->keymap) { in omap4_keypad_probe()
442 return -ENOMEM; in omap4_keypad_probe()
446 keypad_data->rows, keypad_data->cols, in omap4_keypad_probe()
447 keypad_data->keymap, input_dev); in omap4_keypad_probe()
453 error = devm_request_threaded_irq(dev, keypad_data->irq, in omap4_keypad_probe()
457 "omap4-keypad", keypad_data); in omap4_keypad_probe()
463 error = input_register_device(keypad_data->input); in omap4_keypad_probe()
470 error = dev_pm_set_wake_irq(dev, keypad_data->irq); in omap4_keypad_probe()
479 dev_pm_clear_wake_irq(&pdev->dev); in omap4_keypad_remove()
483 { .compatible = "ti,omap4-keypad" },
492 .name = "omap4-keypad",
502 MODULE_ALIAS("platform:omap4-keypad");