User manual

Page | 45
Kernel Driver reference paths:
linux-3.1.0-psp04.06.00.03.sdk/sound/soc/
linux-3.1.0-psp04.06.00.03.sdk/sound/soc/davinci/davinci-evm.c
linux-3.1.0-psp04.06.00.03.sdk/sound/soc/codecs/sgtl5000.c
5.6 Driver Development
5.6.1 gpio_keys Driver
Device Definition
linux-3.1.0-psp04.06.00.03.sdk/arch/arm/mach-omap2/board-am335xevm.c
Setup GPIO 1.30 as a “menu” key, with a return value of KEY_F1”, triggered
by a low level, and GPIO 1.31 as a ”back” key, with a return value of
KEY_ESC”, triggered by a low level.
The structure template is shown below. GPIO 0.22 is used as a “home” key,
with a return value of KEY_HOME”, triggered by a low level.
static struct gpio_keys_button gpio_key_buttons[] = {
{
.code = KEY_F1,
.gpio = GPIO_TO_PIN(1, 30),
.active_low = true,
.desc = "menu",
.type = EV_KEY,
// .wakeup = 1,
},
{
.code = KEY_ESC,
.gpio = GPIO_TO_PIN(1, 31),
.active_low = true,
.desc = "back",
.type = EV_KEY,
// .wakeup = 1,
},
{
.code = KEY_HOME,
.gpio = GPIO_TO_PIN(0, 22),
.active_low = true,
.desc = "home",