Lines Matching +full:col +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-or-later
61 ((((dbms) * 1000) / ((1 << ((ptv) + 1)) * (1000000 / 32768))) - 1)
90 static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) in kbd_readl() argument
92 return __raw_readl(keypad_data->base + in kbd_readl()
93 keypad_data->reg_offset + offset); in kbd_readl()
96 static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value) in kbd_writel() argument
99 keypad_data->base + keypad_data->reg_offset + offset); in kbd_writel()
102 static int kbd_read_irqreg(struct omap4_keypad *keypad_data, u32 offset) in kbd_read_irqreg() argument
104 return __raw_readl(keypad_data->base + in kbd_read_irqreg()
105 keypad_data->irqreg_offset + offset); in kbd_read_irqreg()
109 u32 offset, u32 value) in kbd_write_irqreg() argument
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()
119 unsigned int col, row, code; in omap4_keypad_report_keys() local
126 for_each_set_bit(bit, mask, keypad_data->rows * BITS_PER_BYTE) { in omap4_keypad_report_keys()
128 col = bit % 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 guard(mutex)(&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()
177 struct device *dev = keypad_data->input->dev.parent; in omap4_keypad_irq_thread_fn()
205 struct device *dev = input->dev.parent; in omap4_keypad_open()
212 error = clk_prepare_enable(keypad_data->fck); in omap4_keypad_open()
216 disable_irq(keypad_data->irq); in omap4_keypad_open()
231 enable_irq(keypad_data->irq); in omap4_keypad_open()
242 /* Disable interrupts and wake-up events */ in omap4_keypad_stop()
255 struct device *dev = input->dev.parent; in omap4_keypad_close()
263 disable_irq(keypad_data->irq); in omap4_keypad_close()
265 enable_irq(keypad_data->irq); in omap4_keypad_close()
266 clk_disable_unprepare(keypad_data->fck); in omap4_keypad_close()
275 struct device_node *np = dev->of_node; in omap4_keypad_parse_dt()
278 err = matrix_keypad_parse_properties(dev, &keypad_data->rows, in omap4_keypad_parse_dt()
279 &keypad_data->cols); in omap4_keypad_parse_dt()
283 keypad_data->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat"); in omap4_keypad_parse_dt()
293 rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); in omap4_keypad_check_revision()
298 keypad_data->reg_offset = 0x00; in omap4_keypad_check_revision()
299 keypad_data->irqreg_offset = 0x00; in omap4_keypad_check_revision()
302 keypad_data->reg_offset = 0x10; in omap4_keypad_check_revision()
303 keypad_data->irqreg_offset = 0x0c; in omap4_keypad_check_revision()
307 return -EINVAL; in omap4_keypad_check_revision()
315 * Interrupt may not happen for key-up events. We must clear stuck
316 * key-up events after the keyboard hardware has auto-idled.
327 return -EBUSY; in omap4_keypad_runtime_suspend()
347 struct device *dev = &pdev->dev; in omap4_keypad_probe()
361 return -ENOMEM; in omap4_keypad_probe()
364 keypad_data->irq = irq; in omap4_keypad_probe()
365 keypad_data->fck = devm_clk_get(&pdev->dev, "fck"); in omap4_keypad_probe()
366 if (IS_ERR(keypad_data->fck)) in omap4_keypad_probe()
367 return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->fck), in omap4_keypad_probe()
370 mutex_init(&keypad_data->lock); in omap4_keypad_probe()
377 keypad_data->base = devm_platform_ioremap_resource(pdev, 0); in omap4_keypad_probe()
378 if (IS_ERR(keypad_data->base)) in omap4_keypad_probe()
379 return PTR_ERR(keypad_data->base); in omap4_keypad_probe()
413 keypad_data->input = input_dev = devm_input_allocate_device(dev); in omap4_keypad_probe()
415 return -ENOMEM; in omap4_keypad_probe()
417 input_dev->name = pdev->name; in omap4_keypad_probe()
418 input_dev->id.bustype = BUS_HOST; in omap4_keypad_probe()
419 input_dev->id.vendor = 0x0001; in omap4_keypad_probe()
420 input_dev->id.product = 0x0001; in omap4_keypad_probe()
421 input_dev->id.version = 0x0001; in omap4_keypad_probe()
423 input_dev->open = omap4_keypad_open; in omap4_keypad_probe()
424 input_dev->close = omap4_keypad_close; in omap4_keypad_probe()
427 if (!keypad_data->no_autorepeat) in omap4_keypad_probe()
428 __set_bit(EV_REP, input_dev->evbit); in omap4_keypad_probe()
432 keypad_data->row_shift = get_count_order(keypad_data->cols); in omap4_keypad_probe()
433 max_keys = keypad_data->rows << keypad_data->row_shift; in omap4_keypad_probe()
434 keypad_data->keymap = devm_kcalloc(dev, in omap4_keypad_probe()
436 sizeof(keypad_data->keymap[0]), in omap4_keypad_probe()
438 if (!keypad_data->keymap) { in omap4_keypad_probe()
440 return -ENOMEM; in omap4_keypad_probe()
444 keypad_data->rows, keypad_data->cols, in omap4_keypad_probe()
445 keypad_data->keymap, input_dev); in omap4_keypad_probe()
451 error = devm_request_threaded_irq(dev, keypad_data->irq, in omap4_keypad_probe()
455 "omap4-keypad", keypad_data); in omap4_keypad_probe()
461 error = input_register_device(keypad_data->input); in omap4_keypad_probe()
468 error = dev_pm_set_wake_irq(dev, keypad_data->irq); in omap4_keypad_probe()
477 dev_pm_clear_wake_irq(&pdev->dev); in omap4_keypad_remove()
481 { .compatible = "ti,omap4-keypad" },
490 .name = "omap4-keypad",
500 MODULE_ALIAS("platform:omap4-keypad");