Driver Development; Driver For The Gpio_Keys - Embest SBC8600B Quick Start Manual

Hide thumbs Also See for SBC8600B:
Table of Contents

Advertisement

6.5 Driver Development

6.5.1 Driver for the gpio_keys

1. Device definition
Linux-3.2.0-psp04.06.00.08.sdk/arch/arm/mach-omap2/board-am335xev
m.c
Setup GPIO 0.2 as a "menu" key, return value as "KEY_F1", triggered on low
level; set GPIO 2.1 as a "back"key, return value as "KEY_ESC", triggered on
low level, the structure template is shown below.
static struct gpio_keys_button gpio_key_buttons[] = {
{
.code
.gpio
.active_low
.desc
.type
//
.wakeup
},
{
.code
.gpio
.active_low
.desc
.type
//
.wakeup
},
};
static struct gpio_keys_platform_data gpio_key_info = {
.buttons
.nbuttons
};
static struct platform_device gpio_keys = {
.name
= "gpio-keys",
.id
= -1,
.dev
= {
.platform_data = &gpio_key_info,
},
};
= KEY_F1,
= GPIO_TO_PIN(0, 20),
= true,
= "menu",
= EV_KEY,
= 1,
= KEY_ESC,
= GPIO_TO_PIN(2, 1),
= true,
= "back",
= EV_KEY,
= 1,
= gpio_key_buttons,
= ARRAY_SIZE(gpio_key_buttons),
Page | 42

Advertisement

Table of Contents
loading

Table of Contents