Lines Matching full:keypad

86 static void enable_row_irqs(struct matrix_keypad *keypad)  in enable_row_irqs()  argument
88 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in enable_row_irqs()
99 static void disable_row_irqs(struct matrix_keypad *keypad) in disable_row_irqs() argument
101 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in disable_row_irqs()
117 struct matrix_keypad *keypad = in matrix_keypad_scan() local
119 struct input_dev *input_dev = keypad->input_dev; in matrix_keypad_scan()
121 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_scan()
148 bits_changed = keypad->last_key_state[col] ^ new_state[col]; in matrix_keypad_scan()
156 code = MATRIX_SCAN_CODE(row, col, keypad->row_shift); in matrix_keypad_scan()
165 memcpy(keypad->last_key_state, new_state, sizeof(new_state)); in matrix_keypad_scan()
170 spin_lock_irq(&keypad->lock); in matrix_keypad_scan()
171 keypad->scan_pending = false; in matrix_keypad_scan()
172 enable_row_irqs(keypad); in matrix_keypad_scan()
173 spin_unlock_irq(&keypad->lock); in matrix_keypad_scan()
178 struct matrix_keypad *keypad = id; in matrix_keypad_interrupt() local
181 spin_lock_irqsave(&keypad->lock, flags); in matrix_keypad_interrupt()
188 if (unlikely(keypad->scan_pending || keypad->stopped)) in matrix_keypad_interrupt()
191 disable_row_irqs(keypad); in matrix_keypad_interrupt()
192 keypad->scan_pending = true; in matrix_keypad_interrupt()
193 schedule_delayed_work(&keypad->work, in matrix_keypad_interrupt()
194 msecs_to_jiffies(keypad->pdata->debounce_ms)); in matrix_keypad_interrupt()
197 spin_unlock_irqrestore(&keypad->lock, flags); in matrix_keypad_interrupt()
203 struct matrix_keypad *keypad = input_get_drvdata(dev); in matrix_keypad_start() local
205 keypad->stopped = false; in matrix_keypad_start()
212 schedule_delayed_work(&keypad->work, 0); in matrix_keypad_start()
219 struct matrix_keypad *keypad = input_get_drvdata(dev); in matrix_keypad_stop() local
221 spin_lock_irq(&keypad->lock); in matrix_keypad_stop()
222 keypad->stopped = true; in matrix_keypad_stop()
223 spin_unlock_irq(&keypad->lock); in matrix_keypad_stop()
225 flush_delayed_work(&keypad->work); in matrix_keypad_stop()
230 disable_row_irqs(keypad); in matrix_keypad_stop()
233 static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad) in matrix_keypad_enable_wakeup() argument
235 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_enable_wakeup()
241 keypad->gpio_all_disabled = true; in matrix_keypad_enable_wakeup()
245 if (!test_bit(i, keypad->disabled_gpios)) { in matrix_keypad_enable_wakeup()
249 __set_bit(i, keypad->disabled_gpios); in matrix_keypad_enable_wakeup()
255 static void matrix_keypad_disable_wakeup(struct matrix_keypad *keypad) in matrix_keypad_disable_wakeup() argument
257 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_disable_wakeup()
262 if (keypad->gpio_all_disabled) { in matrix_keypad_disable_wakeup()
264 keypad->gpio_all_disabled = false; in matrix_keypad_disable_wakeup()
268 if (test_and_clear_bit(i, keypad->disabled_gpios)) { in matrix_keypad_disable_wakeup()
279 struct matrix_keypad *keypad = platform_get_drvdata(pdev); in matrix_keypad_suspend() local
281 matrix_keypad_stop(keypad->input_dev); in matrix_keypad_suspend()
284 matrix_keypad_enable_wakeup(keypad); in matrix_keypad_suspend()
292 struct matrix_keypad *keypad = platform_get_drvdata(pdev); in matrix_keypad_resume() local
295 matrix_keypad_disable_wakeup(keypad); in matrix_keypad_resume()
297 matrix_keypad_start(keypad->input_dev); in matrix_keypad_resume()
306 struct matrix_keypad *keypad) in matrix_keypad_init_gpio() argument
308 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_init_gpio()
340 "matrix-keypad", keypad); in matrix_keypad_init_gpio()
353 "matrix-keypad", keypad); in matrix_keypad_init_gpio()
364 disable_row_irqs(keypad); in matrix_keypad_init_gpio()
369 free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); in matrix_keypad_init_gpio()
382 static void matrix_keypad_free_gpio(struct matrix_keypad *keypad) in matrix_keypad_free_gpio() argument
384 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_free_gpio()
388 free_irq(pdata->clustered_irq, keypad); in matrix_keypad_free_gpio()
391 free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); in matrix_keypad_free_gpio()
424 dev_err(dev, "number of keypad rows/columns not specified\n"); in matrix_keypad_parse_dt()
483 struct matrix_keypad *keypad; in matrix_keypad_probe() local
497 keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); in matrix_keypad_probe()
499 if (!keypad || !input_dev) { in matrix_keypad_probe()
504 keypad->input_dev = input_dev; in matrix_keypad_probe()
505 keypad->pdata = pdata; in matrix_keypad_probe()
506 keypad->row_shift = get_count_order(pdata->num_col_gpios); in matrix_keypad_probe()
507 keypad->stopped = true; in matrix_keypad_probe()
508 INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); in matrix_keypad_probe()
509 spin_lock_init(&keypad->lock); in matrix_keypad_probe()
529 input_set_drvdata(input_dev, keypad); in matrix_keypad_probe()
531 err = matrix_keypad_init_gpio(pdev, keypad); in matrix_keypad_probe()
535 err = input_register_device(keypad->input_dev); in matrix_keypad_probe()
540 platform_set_drvdata(pdev, keypad); in matrix_keypad_probe()
545 matrix_keypad_free_gpio(keypad); in matrix_keypad_probe()
548 kfree(keypad); in matrix_keypad_probe()
554 struct matrix_keypad *keypad = platform_get_drvdata(pdev); in matrix_keypad_remove() local
556 matrix_keypad_free_gpio(keypad); in matrix_keypad_remove()
557 input_unregister_device(keypad->input_dev); in matrix_keypad_remove()
558 kfree(keypad); in matrix_keypad_remove()
565 { .compatible = "gpio-matrix-keypad" },
575 .name = "matrix-keypad",
583 MODULE_DESCRIPTION("GPIO Driven Matrix Keypad Driver");
585 MODULE_ALIAS("platform:matrix-keypad");