002-sys_btn_gpio.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. This patch adds support for the GPIO connected system button on the MTX-1 boards. Default configuration is updated accordingly.
  2. Signed-off-by: Florian Fainelli <[email protected]>
  3. ---
  4. --- a/arch/mips/au1000/mtx-1/platform.c
  5. +++ b/arch/mips/au1000/mtx-1/platform.c
  6. @@ -23,9 +23,32 @@
  7. #include <linux/types.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/leds.h>
  10. +#include <linux/gpio_keys.h>
  11. +#include <linux/input.h>
  12. #include <asm/gpio.h>
  13. +static struct gpio_keys_button mtx1_gpio_button[] = {
  14. + {
  15. + .gpio = 207,
  16. + .code = BTN_0,
  17. + .desc = "System button",
  18. + }
  19. +};
  20. +
  21. +static struct gpio_keys_platform_data mtx1_buttons_data = {
  22. + .buttons = mtx1_gpio_button,
  23. + .nbuttons = ARRAY_SIZE(mtx1_gpio_button),
  24. +};
  25. +
  26. +static struct platform_device mtx1_button = {
  27. + .name = "gpio-keys",
  28. + .id = -1,
  29. + .dev = {
  30. + .platform_data = &mtx1_buttons_data,
  31. + }
  32. +};
  33. +
  34. static struct resource mtx1_wdt_res[] = {
  35. [0] = {
  36. .start = 15,
  37. @@ -62,11 +85,13 @@
  38. static struct platform_device *mtx1_devs[] = {
  39. &mtx1_gpio_leds,
  40. - &mtx1_wdt
  41. + &mtx1_wdt,
  42. + &mtx1_button
  43. };
  44. static int __init mtx1_register_devices(void)
  45. {
  46. + gpio_direction_input(207);
  47. return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
  48. }