最近需要做个唤醒功能,当按键的时候android系统唤醒并点亮屏,在长按键中,系统不能在进入睡眠。
驱动方面:
1:在平台设备文件中添加 一个按键,定义为唤醒源
\arch\arm\mach-s5pv210
static struct gpio_keys_button gpio_buttons[] = {
{
.gpio = S5PV210_GPH1(3),
.code = KEY_F22, //对应 192
.desc = "F22",
.active_low = 1,
.wakeup = 1,
.debounce_interval =100, //去抖动
},
}
static struct gpio_keys_platform_data gpio_button_data = {
.buttons = gpio_buttons,
.nbuttons = ARRAY_SIZE(gpio_buttons),
};
static struct platform_device s3c_device_gpio_button = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &gpio_button_data,
}
};
platform_add_devices(smdkc110_devices, ARRAY_SIZE(smdkc110_devices));
2:添加驱动\kernel-v.20120620\drivers\input\keyboard\s3c-gpio-keys.c
struct s3c_gpio_key{
int pin;
int eint;
int eintcfg;
int inputcfg;
};
struct s3c_gpio_key s3c_gpio_keys[]=
{
///*
{
.pin = S5PV210_GPH1(3), //at base wake up
.eintcfg = 0X0f<<12,
.inputcfg = 0<<12,
.eint = IRQ_EINT11,
},
// */
};