29.04.2015 Views

DevKit8500D/A User Manual - DMCS Pages for Students

DevKit8500D/A User Manual - DMCS Pages for Students

DevKit8500D/A User Manual - DMCS Pages for Students

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

#endif<br />

}<br />

};<br />

static int __init gpio_keys_init(void)<br />

{<br />

return plat<strong>for</strong>m_driver_register(&gpio_keys_device_driver);<br />

}<br />

static void __exit gpio_keys_exit(void)<br />

{<br />

plat<strong>for</strong>m_driver_unregister(&gpio_keys_device_driver);<br />

}<br />

module_init(gpio_keys_init);<br />

module_exit(gpio_keys_exit);<br />

MODULE_LICENSE("GPL");<br />

MODULE_AUTHOR("Phil Blundell ");<br />

MODULE_DESCRIPTION("Keyboard driver <strong>for</strong> CPU GPIOs");<br />

MODULE_ALIAS("plat<strong>for</strong>m:gpio-keys");<br />

b) Structure <strong>for</strong> input_register_device to register input driver.<br />

static int __devinit gpio_keys_probe(struct plat<strong>for</strong>m_device *pdev)<br />

{<br />

…<br />

input = input_allocate_device();<br />

…<br />

<strong>for</strong> (i = 0; i < pdata->nbuttons; i++) {<br />

struct gpio_keys_button *button = &pdata->buttons[i];<br />

struct gpio_button_data *bdata = &ddata->data[i];<br />

unsigned int type = button->type ?: EV_KEY;<br />

47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!