2 arch/arm/mach-omap2/board-n8x0.c | 73 +++++++++++++++++++++++++++++++++++++++
3 1 file changed, 73 insertions(+)
5 --- a/arch/arm/mach-omap2/board-n8x0.c
6 +++ b/arch/arm/mach-omap2/board-n8x0.c
7 @@ -225,6 +225,77 @@ extern struct mipid_platform_data n8x0_m
8 extern void n8x0_mipid_init(void);
9 extern void n8x0_blizzard_init(void);
11 +struct gpio_switch_input_dev {
12 + struct input_dev *idev;
13 + unsigned int swcode;
16 +static struct gpio_switch_input_dev *slide_input;
17 +static struct gpio_switch_input_dev *kblock_input;
19 +static void n8x0_gpio_switch_input_notify(struct gpio_switch_input_dev *gdev,
23 + input_report_switch(gdev->idev, gdev->swcode, state);
24 + input_sync(gdev->idev);
28 +static void n8x0_slide_notify(void *data, int state)
30 + n8x0_gpio_switch_input_notify(slide_input, state);
33 +static void n8x0_kb_lock_notify(void *data, int state)
35 + n8x0_gpio_switch_input_notify(kblock_input, state);
38 +static struct gpio_switch_input_dev * __init gpioswitch_input_init(
40 + unsigned int swcode)
42 + struct gpio_switch_input_dev *gdev;
45 + gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
48 + gdev->swcode = swcode;
50 + gdev->idev = input_allocate_device();
54 + gdev->idev->evbit[0] = BIT_MASK(EV_SW);
55 + gdev->idev->swbit[BIT_WORD(swcode)] = BIT_MASK(swcode);
56 + gdev->idev->name = name;
58 + err = input_register_device(gdev->idev);
65 + input_free_device(gdev->idev);
72 +static int __init n8x0_gpio_switches_input_init(void)
74 + slide_input = gpioswitch_input_init("slide", SW_KEYPAD_SLIDE);
75 + kblock_input = gpioswitch_input_init("kb_lock", SW_LID);
76 + if (WARN_ON(!slide_input || !kblock_input))
80 +late_initcall(n8x0_gpio_switches_input_init);
82 static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
85 @@ -246,11 +317,13 @@ static struct omap_gpio_switch n8x0_gpio
87 .debounce_rising = 200,
88 .debounce_falling = 200,
89 + .notify = n8x0_slide_notify,
93 .debounce_rising = 200,
94 .debounce_falling = 200,
95 + .notify = n8x0_kb_lock_notify,