002-geos_platform.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. From 31bc84d45320dad2392384381ad4d818ab21087a Mon Sep 17 00:00:00 2001
  2. From: "Philip A. Prindeville" <philipp@redfish-solutions.com>
  3. Date: Wed, 18 Jan 2012 11:15:33 -0700
  4. Subject: [PATCH 1/1] geos: Platform driver for Geos and Geos2 single-board
  5. computers.
  6. Trivial platform driver for Traverse Technologies Geos and Geos2
  7. single-board computers. Uses SMBIOS to identify platform.
  8. Based on progressive revisions of the leds-net5501 driver that
  9. was rewritten by Ed Wildgoose as a platform driver.
  10. Supports GPIO-based LEDs (3) and 1 polled button which is
  11. typically used for a soft reset.
  12. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
  13. Reviewed-by: Ed Wildgoose <ed@wildgooses.com>
  14. Acked-by: Andres Salomon <dilinger@queued.net>
  15. Cc: Richard Purdie <rpurdie@rpsys.net>
  16. Cc: Andrew Morton <akpm@linux-foundation.org>
  17. ---
  18. arch/x86/Kconfig | 7 ++
  19. arch/x86/platform/geode/Makefile | 1 +
  20. arch/x86/platform/geode/geos.c | 128 ++++++++++++++++++++++++++++++++++++++
  21. 3 files changed, 136 insertions(+), 0 deletions(-)
  22. create mode 100644 arch/x86/platform/geode/geos.c
  23. --- a/arch/x86/Kconfig
  24. +++ b/arch/x86/Kconfig
  25. @@ -2133,6 +2133,13 @@ config ALIX
  26. Note: You have to set alix.force=1 for boards with Award BIOS.
  27. +config GEOS
  28. + bool "Traverse Technologies GEOS System Support (LEDS, GPIO, etc)"
  29. + select GPIOLIB
  30. + depends on DMI
  31. + ---help---
  32. + This option enables system support for the Traverse Technologies GEOS.
  33. +
  34. endif # X86_32
  35. config AMD_NB
  36. --- a/arch/x86/platform/geode/Makefile
  37. +++ b/arch/x86/platform/geode/Makefile
  38. @@ -1 +1,2 @@
  39. obj-$(CONFIG_ALIX) += alix.o
  40. +obj-$(CONFIG_GEOS) += geos.o
  41. --- /dev/null
  42. +++ b/arch/x86/platform/geode/geos.c
  43. @@ -0,0 +1,128 @@
  44. +/*
  45. + * System Specific setup for Traverse Technologies GEOS.
  46. + * At the moment this means setup of GPIO control of LEDs.
  47. + *
  48. + * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
  49. + * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
  50. + * and Philip Prindeville <philipp@redfish-solutions.com>
  51. + *
  52. + * TODO: There are large similarities with leds-net5501.c
  53. + * by Alessandro Zummo <a.zummo@towertech.it>
  54. + * In the future leds-net5501.c should be migrated over to platform
  55. + *
  56. + * This program is free software; you can redistribute it and/or modify
  57. + * it under the terms of the GNU General Public License version 2
  58. + * as published by the Free Software Foundation.
  59. + */
  60. +
  61. +#include <linux/kernel.h>
  62. +#include <linux/init.h>
  63. +#include <linux/io.h>
  64. +#include <linux/string.h>
  65. +#include <linux/module.h>
  66. +#include <linux/leds.h>
  67. +#include <linux/platform_device.h>
  68. +#include <linux/gpio.h>
  69. +#include <linux/input.h>
  70. +#include <linux/gpio_keys.h>
  71. +#include <linux/dmi.h>
  72. +
  73. +#include <asm/geode.h>
  74. +
  75. +static struct gpio_keys_button geos_gpio_buttons[] = {
  76. + {
  77. + .code = KEY_RESTART,
  78. + .gpio = 3,
  79. + .active_low = 1,
  80. + .desc = "Reset button",
  81. + .type = EV_KEY,
  82. + .wakeup = 0,
  83. + .debounce_interval = 100,
  84. + .can_disable = 0,
  85. + }
  86. +};
  87. +static struct gpio_keys_platform_data geos_buttons_data = {
  88. + .buttons = geos_gpio_buttons,
  89. + .nbuttons = ARRAY_SIZE(geos_gpio_buttons),
  90. + .poll_interval = 20,
  91. +};
  92. +
  93. +static struct platform_device geos_buttons_dev = {
  94. + .name = "gpio-keys-polled",
  95. + .id = 1,
  96. + .dev = {
  97. + .platform_data = &geos_buttons_data,
  98. + }
  99. +};
  100. +
  101. +static struct gpio_led geos_leds[] = {
  102. + {
  103. + .name = "geos:1",
  104. + .gpio = 6,
  105. + .default_trigger = "default-on",
  106. + .active_low = 1,
  107. + },
  108. + {
  109. + .name = "geos:2",
  110. + .gpio = 25,
  111. + .default_trigger = "default-off",
  112. + .active_low = 1,
  113. + },
  114. + {
  115. + .name = "geos:3",
  116. + .gpio = 27,
  117. + .default_trigger = "default-off",
  118. + .active_low = 1,
  119. + },
  120. +};
  121. +
  122. +static struct gpio_led_platform_data geos_leds_data = {
  123. + .num_leds = ARRAY_SIZE(geos_leds),
  124. + .leds = geos_leds,
  125. +};
  126. +
  127. +static struct platform_device geos_leds_dev = {
  128. + .name = "leds-gpio",
  129. + .id = -1,
  130. + .dev.platform_data = &geos_leds_data,
  131. +};
  132. +
  133. +static struct __initdata platform_device *geos_devs[] = {
  134. + &geos_buttons_dev,
  135. + &geos_leds_dev,
  136. +};
  137. +
  138. +static void __init register_geos(void)
  139. +{
  140. + /* Setup LED control through leds-gpio driver */
  141. + platform_add_devices(geos_devs, ARRAY_SIZE(geos_devs));
  142. +}
  143. +
  144. +static int __init geos_init(void)
  145. +{
  146. + const char *vendor, *product;
  147. +
  148. + if (!is_geode())
  149. + return 0;
  150. +
  151. + vendor = dmi_get_system_info(DMI_SYS_VENDOR);
  152. + if (!vendor || strcmp(vendor, "Traverse Technologies"))
  153. + return 0;
  154. +
  155. + product = dmi_get_system_info(DMI_PRODUCT_NAME);
  156. + if (!product || strcmp(product, "Geos"))
  157. + return 0;
  158. +
  159. + printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
  160. + KBUILD_MODNAME, vendor, product);
  161. +
  162. + register_geos();
  163. +
  164. + return 0;
  165. +}
  166. +
  167. +module_init(geos_init);
  168. +
  169. +MODULE_AUTHOR("Philip Prindeville <philipp@redfish-solutions.com>");
  170. +MODULE_DESCRIPTION("Traverse Technologies Geos System Setup");
  171. +MODULE_LICENSE("GPL");