csb701.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include <linux/kernel.h>
  2. #include <linux/module.h>
  3. #include <linux/platform_device.h>
  4. #include <linux/gpio_keys.h>
  5. #include <linux/input.h>
  6. #include <linux/leds.h>
  7. #include <asm/mach-types.h>
  8. static struct gpio_keys_button csb701_buttons[] = {
  9. {
  10. .code = 0x7,
  11. .gpio = 1,
  12. .active_low = 1,
  13. .desc = "SW2",
  14. .type = EV_SW,
  15. .wakeup = 1,
  16. },
  17. };
  18. static struct gpio_keys_platform_data csb701_gpio_keys_data = {
  19. .buttons = csb701_buttons,
  20. .nbuttons = ARRAY_SIZE(csb701_buttons),
  21. };
  22. static struct gpio_led csb701_leds[] = {
  23. {
  24. .name = "csb701:yellow:heartbeat",
  25. .default_trigger = "heartbeat",
  26. .gpio = 11,
  27. .active_low = 1,
  28. },
  29. };
  30. static struct platform_device csb701_gpio_keys = {
  31. .name = "gpio-keys",
  32. .id = -1,
  33. .dev.platform_data = &csb701_gpio_keys_data,
  34. };
  35. static struct gpio_led_platform_data csb701_leds_gpio_data = {
  36. .leds = csb701_leds,
  37. .num_leds = ARRAY_SIZE(csb701_leds),
  38. };
  39. static struct platform_device csb701_leds_gpio = {
  40. .name = "leds-gpio",
  41. .id = -1,
  42. .dev.platform_data = &csb701_leds_gpio_data,
  43. };
  44. static struct platform_device *devices[] __initdata = {
  45. &csb701_gpio_keys,
  46. &csb701_leds_gpio,
  47. };
  48. static int __init csb701_init(void)
  49. {
  50. if (!machine_is_csb726())
  51. return -ENODEV;
  52. return platform_add_devices(devices, ARRAY_SIZE(devices));
  53. }
  54. module_init(csb701_init);