While getting trying to get the keyboard driver to accept my
keyboard layout I found and fixed a few bugs.
- Fixed the driver to respect the matrix size and .rep
fields from "struct omap_kp_platform_data"
- Fixed misc. configuration problems.
- Fixed some problems with the interrupt/polling code by
implementing 100% event driven scan handling (there
was a race between the timer and interrupt initiated
calls to twl_4030_kp_scan()).
- Too many interrupts was delivered -> enable "PENDING_DISABLE".
- The controller would hang with keys stuck on -> program
KEYP_TIMEOUT so sensible timeout.
Other enhancements:
- Simple ghost key suppression.
- Support for non-matrix switches. That is switches connected
between GND and a row.
To configure the driver for the non-matrix switches you add the
key as you normally would, but the col-index will have to be the
same value as the col-size.
For example with .cols = 2 and you will use the value "2" for
COL for the two non-matrix switches:
static int rocket_control_keymap[] = {
/* COL ROW */
KEY(0, 0, KEY_3),
KEY(0, 1, KEY_2),
KEY(1, 0, KEY_1),
KEY(1, 1, KEY_LAUNCH),
KEY(2, 0, KEY_ABORT),
KEY(2, 1, KEY_SD),
0
}
Cleanup:
I might have gone too far when fixing the twl4030-keypad.h file,
but I was loosing breath and attention spelling my way through
these 32+ letter identifiers with names like:
BIT_KEYP_CTRL_REG_TOLE_EN_MASK
which is a bit in the register:
REG_KEYP_CTRL_REG
leading to statements like:
twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD,
BIT_KEYP_CTRL_REG_TOLE_EN_MASK, REG_KEYP_CTRL_REG);
What I did was to take out all the redundant stuff like BIT, REG
and MASK, making reading a little easier:
twl4030_kpwrite_u8(TWL4030_MODULE_KEYPAD,
KEYP_CTRL_TOLE_EN, KEYP_CTRL);
There was a lot of configuration stuff in header file that wasn't
really needed. I think I even found a joke:
.h had this line:
#define BIT_PTV_REG_PTV4 (0x4)
.c had this:
/* Set Pre Scalar Field PTV to 4 */
reg = BIT_LK_PTV_REG_PTV_MASK & (BIT_PTV_REG_PTV4 << BIT_LK_PTV_REG_PTV);
Signed-off-by: Klaus Pedersen <klaus.k.pedersen@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>