Lines Matching full:keypad
85 static void enable_row_irqs(struct matrix_keypad *keypad) in enable_row_irqs() argument
87 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in enable_row_irqs()
98 static void disable_row_irqs(struct matrix_keypad *keypad) in disable_row_irqs() argument
100 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in disable_row_irqs()
116 struct matrix_keypad *keypad = in matrix_keypad_scan() local
118 struct input_dev *input_dev = keypad->input_dev; in matrix_keypad_scan()
120 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_scan()
144 bits_changed = keypad->last_key_state[col] ^ new_state[col]; in matrix_keypad_scan()
152 code = MATRIX_SCAN_CODE(row, col, keypad->row_shift); in matrix_keypad_scan()
161 memcpy(keypad->last_key_state, new_state, sizeof(new_state)); in matrix_keypad_scan()
166 spin_lock_irq(&keypad->lock); in matrix_keypad_scan()
167 keypad->scan_pending = false; in matrix_keypad_scan()
168 enable_row_irqs(keypad); in matrix_keypad_scan()
169 spin_unlock_irq(&keypad->lock); in matrix_keypad_scan()
174 struct matrix_keypad *keypad = id; in matrix_keypad_interrupt() local
177 spin_lock_irqsave(&keypad->lock, flags); in matrix_keypad_interrupt()
184 if (unlikely(keypad->scan_pending || keypad->stopped)) in matrix_keypad_interrupt()
187 disable_row_irqs(keypad); in matrix_keypad_interrupt()
188 keypad->scan_pending = true; in matrix_keypad_interrupt()
189 schedule_delayed_work(&keypad->work, in matrix_keypad_interrupt()
190 msecs_to_jiffies(keypad->pdata->debounce_ms)); in matrix_keypad_interrupt()
193 spin_unlock_irqrestore(&keypad->lock, flags); in matrix_keypad_interrupt()
199 struct matrix_keypad *keypad = input_get_drvdata(dev); in matrix_keypad_start() local
201 keypad->stopped = false; in matrix_keypad_start()
208 schedule_delayed_work(&keypad->work, 0); in matrix_keypad_start()
215 struct matrix_keypad *keypad = input_get_drvdata(dev); in matrix_keypad_stop() local
217 spin_lock_irq(&keypad->lock); in matrix_keypad_stop()
218 keypad->stopped = true; in matrix_keypad_stop()
219 spin_unlock_irq(&keypad->lock); in matrix_keypad_stop()
221 flush_delayed_work(&keypad->work); in matrix_keypad_stop()
226 disable_row_irqs(keypad); in matrix_keypad_stop()
230 static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad) in matrix_keypad_enable_wakeup() argument
232 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_enable_wakeup()
238 keypad->gpio_all_disabled = true; in matrix_keypad_enable_wakeup()
242 if (!test_bit(i, keypad->disabled_gpios)) { in matrix_keypad_enable_wakeup()
246 __set_bit(i, keypad->disabled_gpios); in matrix_keypad_enable_wakeup()
252 static void matrix_keypad_disable_wakeup(struct matrix_keypad *keypad) in matrix_keypad_disable_wakeup() argument
254 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_disable_wakeup()
259 if (keypad->gpio_all_disabled) { in matrix_keypad_disable_wakeup()
261 keypad->gpio_all_disabled = false; in matrix_keypad_disable_wakeup()
265 if (test_and_clear_bit(i, keypad->disabled_gpios)) { in matrix_keypad_disable_wakeup()
276 struct matrix_keypad *keypad = platform_get_drvdata(pdev); in matrix_keypad_suspend() local
278 matrix_keypad_stop(keypad->input_dev); in matrix_keypad_suspend()
281 matrix_keypad_enable_wakeup(keypad); in matrix_keypad_suspend()
289 struct matrix_keypad *keypad = platform_get_drvdata(pdev); in matrix_keypad_resume() local
292 matrix_keypad_disable_wakeup(keypad); in matrix_keypad_resume()
294 matrix_keypad_start(keypad->input_dev); in matrix_keypad_resume()
304 struct matrix_keypad *keypad) in matrix_keypad_init_gpio() argument
306 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_init_gpio()
338 "matrix-keypad", keypad); in matrix_keypad_init_gpio()
351 "matrix-keypad", keypad); in matrix_keypad_init_gpio()
362 disable_row_irqs(keypad); in matrix_keypad_init_gpio()
367 free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); in matrix_keypad_init_gpio()
380 static void matrix_keypad_free_gpio(struct matrix_keypad *keypad) in matrix_keypad_free_gpio() argument
382 const struct matrix_keypad_platform_data *pdata = keypad->pdata; in matrix_keypad_free_gpio()
386 free_irq(pdata->clustered_irq, keypad); in matrix_keypad_free_gpio()
389 free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); in matrix_keypad_free_gpio()
422 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");