User`s guide

i.MX53 System Development User’s Guide, Rev. 1
Freescale Semiconductor 17-1
Chapter 17
Setting Up the Keypad Port (KPP)
The KPP is designed to interface with the keypad matrix with 2-point contact or 3-point contact keys. The
KPP is designed to simplify the software task of scanning a keypad matrix. With appropriate software
support, the KPP is capable of detecting, debouncing, and decoding one or multiple keys pressed
simultaneously on the keypad.
Because Linux already contains a driver for the i.MX53 keypad, all users must do to add and configure a
new custom keypad is to configure the keypad pins on the IOMUX registers and register the driver in the
platform file located at linux/arch/arm/mach-mx5/<your_platform>.c
Table 17-1 lists the files used in the setup process:
17.1 Configuring Keypad Pins on IOMUX
To use the keypad function, users must first set up the keypad pins on the IOMUX registers. The pad pins
can be configured on file
linux/arch/arm/mach-mx5/<platform>.c, where <platform> is replaced by the
appropriate platform file name. For example, the machine layer file used on the i.MX53 reference boards
is linux/arch/arm/mach-mx5/mx53_<reference board name>.c. This platform is used in the example
procedure in this section.
The iomux-mx53.h file contains definitions for all i.MX53 pins. Configure the keypad pins as follows:
#define MX53_PAD_KEY_COL0__GPIO_4_6IOMUX_PAD(0x34C, 0x24, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_ROW0__GPIO_4_7IOMUX_PAD(0x350, 0x28, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_COL1__GPIO_4_8IOMUX_PAD(0x354, 0x2C, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_ROW1__GPIO_4_9IOMUX_PAD(0x358, 0x30, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_COL2__GPIO_4_10IOMUX_PAD(0x35C, 0x34, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_ROW2__GPIO_4_11IOMUX_PAD(0x360, 0x38, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_COL3__GPIO_4_12IOMUX_PAD(0x364, 0x3C, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_ROW3__GPIO_4_13IOMUX_PAD(0x368, 0x40, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_COL4__GPIO_4_14IOMUX_PAD(0x36C, 0x44, 1, 0x0, 0, NO_PAD_CTRL)
#define MX53_PAD_KEY_ROW4__GPIO_4_15IOMUX_PAD(0x370, 0x48, 1, 0x0, 0, NO_PAD_CTRL)
Table 17-1. Files for Adding/Configuring a New Keypad
File Location Description
linux/drivers/input/keyboard/mxc_keyb.c Device driver file
linux/arch/arm/mach-mx5/devices.c Implements the driver registries
linux/arch/arm/mach-mx5/<platform>.c Machine Layer file
linux/include/usr/include/linux/input.h Input key codes include file
linux/arch/arm/plat-mxc/include/mach/iomux-<platform>.h IOMUX pads definitions