This repository has been archived on 2025-06-06. You can view files and clone it, but cannot push or open issues or pull requests.
Files
android-g900/kernel-2.6.33/arch/arm/mach-pxa/g900/g900_buttons2.c
Angell Fear 0666031fb7 G900 support
2010-09-03 00:59:42 +06:00

116 lines
2.5 KiB
C
Executable File

/*
* Input driver for Toshiba G900
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details.
*/
#include <linux/input.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach-types.h>
#include <mach/hardware.h>
#include <mach/irqs.h>
#include <mach/pxa2xx-regs.h>
#include <mach/g900-gpio.h>
#include <asm/gpio.h>
#include <mach/gpio.h>
#include <linux/gpio_keys.h>
#include <linux/platform_device.h>
/***********************************************/
/*********** GPIO Key Configuration ************/
/***********************************************/
static struct gpio_keys_button g900_button_table[] = {
{
.type = EV_PWR,
.code = KEY_POWER,
.gpio = GPIO3_BTN_nPower,
.desc = "Poweron",
.wakeup = 1,
.active_low = 1,
},
{ // Maybe use SW_TABLET_MODE here or SW_KEYPAD_SLIDE
.code = 99,
.gpio = GPIO9_BTN_nKBOpen,
.active_low = 0,
.desc = "Keyboard open",
.type = EV_KEY,
.wakeup = 1
},
{
.code = KEY_PLAY,
.gpio = GPIO10_BTN_nHeadSet,
.active_low = 0,
.desc = "HeadSet button",
.type = EV_KEY,
.wakeup = 0
},
/* {
.code = SW_HEADPHONE_INSERT,
.gpio = GPIO51_BTN_nJackInsert,
.active_low = 1,
.desc = "HeadPhone insert",
.type = EV_SW,
.wakeup = 0,
.debounce_interval = 300
},
*/
};
static struct gpio_keys_platform_data g900_gpio_keys_data = {
.buttons = g900_button_table,
.nbuttons = ARRAY_SIZE(g900_button_table),
};
static struct platform_device g900_keys_gpio = {
.name = "gpio-keys",
.dev = {
.platform_data = &g900_gpio_keys_data,
}
};
static int __init g900_button_probe(struct platform_device *dev)
{
platform_device_register(&g900_keys_gpio);
return 0;
}
static struct platform_driver g900_buttons_driver = {
.driver = {
.name = "g900-button",
},
.probe = g900_button_probe,
};
static int __init g900_button_init(void)
{
if (!machine_is_g900())
return -ENODEV;
return platform_driver_register(&g900_buttons_driver);
}
static void __exit g900_button_exit(void)
{
platform_driver_unregister(&g900_buttons_driver);
}
module_init(g900_button_init);
module_exit(g900_button_exit);
MODULE_AUTHOR ("Angell Fear <angell@angellfear.ru>");
MODULE_DESCRIPTION ("Button support for Toshiba G900");
MODULE_LICENSE ("GPL");