2 arch/arm/mach-omap2/board-n8x0.c | 73 +++++++++++++++++++++++++++++++++++++++
3 1 file changed, 73 insertions(+)
5 Index: linux-2.6.37/arch/arm/mach-omap2/board-n8x0.c
6 ===================================================================
7 --- linux-2.6.37.orig/arch/arm/mach-omap2/board-n8x0.c 2011-01-27 14:17:29.132000007 +0100
8 +++ linux-2.6.37/arch/arm/mach-omap2/board-n8x0.c 2011-01-27 14:17:32.763000006 +0100
11 extern void n8x0_usb_init(void);
13 +struct gpio_switch_input_dev {
14 + struct input_dev *idev;
15 + unsigned int swcode;
18 +static struct gpio_switch_input_dev *slide_input;
19 +static struct gpio_switch_input_dev *kblock_input;
21 +static void n8x0_gpio_switch_input_notify(struct gpio_switch_input_dev *gdev,
25 + input_report_switch(gdev->idev, gdev->swcode, state);
26 + input_sync(gdev->idev);
30 +static void n8x0_slide_notify(void *data, int state)
32 + n8x0_gpio_switch_input_notify(slide_input, state);
35 +static void n8x0_kb_lock_notify(void *data, int state)
37 + n8x0_gpio_switch_input_notify(kblock_input, state);
40 +static struct gpio_switch_input_dev * __init gpioswitch_input_init(
42 + unsigned int swcode)
44 + struct gpio_switch_input_dev *gdev;
47 + gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
50 + gdev->swcode = swcode;
52 + gdev->idev = input_allocate_device();
56 + gdev->idev->evbit[0] = BIT_MASK(EV_SW);
57 + gdev->idev->swbit[BIT_WORD(swcode)] = BIT_MASK(swcode);
58 + gdev->idev->name = name;
60 + err = input_register_device(gdev->idev);
67 + input_free_device(gdev->idev);
74 +static int __init n8x0_gpio_switches_input_init(void)
76 + slide_input = gpioswitch_input_init("slide", SW_KEYPAD_SLIDE);
77 + kblock_input = gpioswitch_input_init("kb_lock", SW_LID);
78 + if (WARN_ON(!slide_input || !kblock_input))
82 +late_initcall(n8x0_gpio_switches_input_init);
84 static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
89 .debounce_rising = 200,
90 .debounce_falling = 200,
91 + .notify = n8x0_slide_notify,
95 .debounce_rising = 200,
96 .debounce_falling = 200,
97 + .notify = n8x0_kb_lock_notify,