blob: c3a3abae98f073251c7134504365d0f2ae17d7b2 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
Russell Kinga09e64f2008-08-05 16:14:15 +01002 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
Sachin Kamatb38b4b42013-12-27 17:13:45 -08008#ifndef __KEYPAD_OMAP_H
9#define __KEYPAD_OMAP_H
Russell Kinga09e64f2008-08-05 16:14:15 +010010
Janusz Krzysztofikda1f0262010-12-20 21:09:22 +000011#ifndef CONFIG_ARCH_OMAP1
12#warning Please update the board to use matrix-keypad driver
Tony Lindgrenacea7c72012-02-24 10:34:36 -080013#define omap_readw(reg) 0
14#define omap_writew(val, reg) do {} while (0)
Janusz Krzysztofikda1f0262010-12-20 21:09:22 +000015#endif
16#include <linux/input/matrix_keypad.h>
Tony Lindgren4f543332009-09-24 16:23:16 -070017
Russell Kinga09e64f2008-08-05 16:14:15 +010018struct omap_kp_platform_data {
19 int rows;
20 int cols;
Janusz Krzysztofikda1f0262010-12-20 21:09:22 +000021 const struct matrix_keymap_data *keymap_data;
22 bool rep;
Russell Kinga09e64f2008-08-05 16:14:15 +010023 unsigned long delay;
Janusz Krzysztofikda1f0262010-12-20 21:09:22 +000024 bool dbounce;
Russell Kinga09e64f2008-08-05 16:14:15 +010025 /* specific to OMAP242x*/
26 unsigned int *row_gpios;
27 unsigned int *col_gpios;
28};
29
30/* Group (0..3) -- when multiple keys are pressed, only the
31 * keys pressed in the same group are considered as pressed. This is
32 * in order to workaround certain crappy HW designs that produce ghost
Janusz Krzysztofikda1f0262010-12-20 21:09:22 +000033 * keypresses. Two free bits, not used by neither row/col nor keynum,
34 * must be available for use as group bits. The below GROUP_SHIFT
35 * macro definition is based on some prior knowledge of the
36 * matrix_keypad defined KEY() macro internals.
37 */
38#define GROUP_SHIFT 14
39#define GROUP_0 (0 << GROUP_SHIFT)
40#define GROUP_1 (1 << GROUP_SHIFT)
41#define GROUP_2 (2 << GROUP_SHIFT)
42#define GROUP_3 (3 << GROUP_SHIFT)
Russell Kinga09e64f2008-08-05 16:14:15 +010043#define GROUP_MASK GROUP_3
Janusz Krzysztofikda1f0262010-12-20 21:09:22 +000044#if KEY_MAX & GROUP_MASK
45#error Group bits in conflict with keynum bits
46#endif
Russell Kinga09e64f2008-08-05 16:14:15 +010047
Russell Kinga09e64f2008-08-05 16:14:15 +010048
49#endif
50