leds.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. #include "bcm47xx_private.h"
  2. #include <linux/leds.h>
  3. #include <bcm47xx_board.h>
  4. /**************************************************
  5. * Database
  6. **************************************************/
  7. #define BCM47XX_GPIO_LED(_gpio, _color, _function, _active_low, \
  8. _default_state) \
  9. { \
  10. .name = "bcm47xx:" _color ":" _function, \
  11. .gpio = _gpio, \
  12. .active_low = _active_low, \
  13. .default_state = _default_state, \
  14. }
  15. #define BCM47XX_GPIO_LED_TRIGGER(_gpio, _color, _function, _active_low, \
  16. _default_trigger) \
  17. { \
  18. .name = "bcm47xx:" _color ":" _function, \
  19. .gpio = _gpio, \
  20. .active_low = _active_low, \
  21. .default_state = LEDS_GPIO_DEFSTATE_OFF, \
  22. .default_trigger = _default_trigger, \
  23. }
  24. /* Asus */
  25. static const struct gpio_led
  26. bcm47xx_leds_asus_rtn12[] __initconst = {
  27. BCM47XX_GPIO_LED(2, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  28. BCM47XX_GPIO_LED(7, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  29. };
  30. static const struct gpio_led
  31. bcm47xx_leds_asus_rtn15u[] __initconst = {
  32. /* TODO: Add "wlan" LED */
  33. BCM47XX_GPIO_LED(3, "blue", "wan", 1, LEDS_GPIO_DEFSTATE_OFF),
  34. BCM47XX_GPIO_LED(4, "blue", "lan", 1, LEDS_GPIO_DEFSTATE_OFF),
  35. BCM47XX_GPIO_LED(6, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  36. BCM47XX_GPIO_LED(9, "blue", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
  37. };
  38. static const struct gpio_led
  39. bcm47xx_leds_asus_rtn16[] __initconst = {
  40. BCM47XX_GPIO_LED(1, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  41. BCM47XX_GPIO_LED(7, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  42. };
  43. static const struct gpio_led
  44. bcm47xx_leds_asus_rtn66u[] __initconst = {
  45. BCM47XX_GPIO_LED(12, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  46. BCM47XX_GPIO_LED(15, "blue", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
  47. };
  48. static const struct gpio_led
  49. bcm47xx_leds_asus_wl300g[] __initconst = {
  50. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  51. };
  52. static const struct gpio_led
  53. bcm47xx_leds_asus_wl320ge[] __initconst = {
  54. BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  55. BCM47XX_GPIO_LED(2, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  56. BCM47XX_GPIO_LED(11, "unk", "link", 1, LEDS_GPIO_DEFSTATE_OFF),
  57. };
  58. static const struct gpio_led
  59. bcm47xx_leds_asus_wl330ge[] __initconst = {
  60. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  61. };
  62. static const struct gpio_led
  63. bcm47xx_leds_asus_wl500g[] __initconst = {
  64. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  65. };
  66. static const struct gpio_led
  67. bcm47xx_leds_asus_wl500gd[] __initconst = {
  68. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  69. };
  70. static const struct gpio_led
  71. bcm47xx_leds_asus_wl500gpv1[] __initconst = {
  72. BCM47XX_GPIO_LED(1, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  73. };
  74. static const struct gpio_led
  75. bcm47xx_leds_asus_wl500gpv2[] __initconst = {
  76. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  77. BCM47XX_GPIO_LED(1, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  78. };
  79. static const struct gpio_led
  80. bcm47xx_leds_asus_wl500w[] __initconst = {
  81. BCM47XX_GPIO_LED(5, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  82. };
  83. static const struct gpio_led
  84. bcm47xx_leds_asus_wl520gc[] __initconst = {
  85. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  86. BCM47XX_GPIO_LED(1, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  87. };
  88. static const struct gpio_led
  89. bcm47xx_leds_asus_wl520gu[] __initconst = {
  90. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  91. BCM47XX_GPIO_LED(1, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  92. };
  93. static const struct gpio_led
  94. bcm47xx_leds_asus_wl700ge[] __initconst = {
  95. BCM47XX_GPIO_LED(1, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), /* Labeled "READY" (there is no "power" LED). Originally ON, flashing on USB activity. */
  96. };
  97. static const struct gpio_led
  98. bcm47xx_leds_asus_wlhdd[] __initconst = {
  99. BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  100. BCM47XX_GPIO_LED(2, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
  101. };
  102. /* Belkin */
  103. static const struct gpio_led
  104. bcm47xx_leds_belkin_f7d4301[] __initconst = {
  105. BCM47XX_GPIO_LED(10, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  106. BCM47XX_GPIO_LED(11, "amber", "power", 1, LEDS_GPIO_DEFSTATE_OFF),
  107. BCM47XX_GPIO_LED(12, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  108. BCM47XX_GPIO_LED(13, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  109. BCM47XX_GPIO_LED(14, "unk", "usb0", 1, LEDS_GPIO_DEFSTATE_OFF),
  110. BCM47XX_GPIO_LED(15, "unk", "usb1", 1, LEDS_GPIO_DEFSTATE_OFF),
  111. };
  112. /* Buffalo */
  113. static const struct gpio_led
  114. bcm47xx_leds_buffalo_whr2_a54g54[] __initconst = {
  115. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  116. };
  117. static const struct gpio_led
  118. bcm47xx_leds_buffalo_whr_g125[] __initconst = {
  119. BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
  120. BCM47XX_GPIO_LED(2, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  121. BCM47XX_GPIO_LED(3, "unk", "internal", 1, LEDS_GPIO_DEFSTATE_OFF),
  122. BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  123. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  124. };
  125. static const struct gpio_led
  126. bcm47xx_leds_buffalo_whr_g54s[] __initconst = {
  127. BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
  128. BCM47XX_GPIO_LED(2, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  129. BCM47XX_GPIO_LED(3, "unk", "internal", 1, LEDS_GPIO_DEFSTATE_OFF),
  130. BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  131. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  132. };
  133. static const struct gpio_led
  134. bcm47xx_leds_buffalo_whr_hp_g54[] __initconst = {
  135. BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
  136. BCM47XX_GPIO_LED(2, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  137. BCM47XX_GPIO_LED(3, "unk", "internal", 1, LEDS_GPIO_DEFSTATE_OFF),
  138. BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  139. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  140. };
  141. static const struct gpio_led
  142. bcm47xx_leds_buffalo_wzr_g300n[] __initconst = {
  143. BCM47XX_GPIO_LED(1, "unk", "bridge", 1, LEDS_GPIO_DEFSTATE_OFF),
  144. BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  145. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  146. };
  147. static const struct gpio_led
  148. bcm47xx_leds_buffalo_wzr_rs_g54[] __initconst = {
  149. BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  150. BCM47XX_GPIO_LED(1, "unk", "vpn", 1, LEDS_GPIO_DEFSTATE_OFF),
  151. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  152. };
  153. static const struct gpio_led
  154. bcm47xx_leds_buffalo_wzr_rs_g54hp[] __initconst = {
  155. BCM47XX_GPIO_LED(6, "unk", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  156. BCM47XX_GPIO_LED(1, "unk", "vpn", 1, LEDS_GPIO_DEFSTATE_OFF),
  157. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  158. };
  159. /* Dell */
  160. static const struct gpio_led
  161. bcm47xx_leds_dell_tm2300[] __initconst = {
  162. BCM47XX_GPIO_LED(6, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  163. BCM47XX_GPIO_LED(7, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  164. };
  165. /* D-Link */
  166. static const struct gpio_led
  167. bcm47xx_leds_dlink_dir130[] __initconst = {
  168. BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */
  169. BCM47XX_GPIO_LED(6, "blue", "unk", 1, LEDS_GPIO_DEFSTATE_OFF),
  170. };
  171. static const struct gpio_led
  172. bcm47xx_leds_dlink_dir330[] __initconst = {
  173. BCM47XX_GPIO_LED_TRIGGER(0, "green", "status", 1, "timer"), /* Originally blinking when device is ready, separated from "power" LED */
  174. BCM47XX_GPIO_LED(4, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
  175. BCM47XX_GPIO_LED(6, "blue", "unk", 1, LEDS_GPIO_DEFSTATE_OFF),
  176. };
  177. /* Huawei */
  178. static const struct gpio_led
  179. bcm47xx_leds_huawei_e970[] __initconst = {
  180. BCM47XX_GPIO_LED(0, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  181. };
  182. /* Linksys */
  183. static const struct gpio_led
  184. bcm47xx_leds_linksys_e1000v1[] __initconst = {
  185. BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  186. BCM47XX_GPIO_LED(1, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  187. BCM47XX_GPIO_LED(2, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  188. BCM47XX_GPIO_LED(4, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  189. };
  190. static const struct gpio_led
  191. bcm47xx_leds_linksys_e1000v21[] __initconst = {
  192. BCM47XX_GPIO_LED(5, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  193. BCM47XX_GPIO_LED(6, "blue", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  194. BCM47XX_GPIO_LED(7, "amber", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
  195. BCM47XX_GPIO_LED(8, "blue", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
  196. };
  197. static const struct gpio_led
  198. bcm47xx_leds_linksys_e2000v1[] __initconst = {
  199. BCM47XX_GPIO_LED(1, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  200. BCM47XX_GPIO_LED(2, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  201. BCM47XX_GPIO_LED(3, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  202. BCM47XX_GPIO_LED(4, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  203. };
  204. static const struct gpio_led
  205. bcm47xx_leds_linksys_e3000v1[] __initconst = {
  206. BCM47XX_GPIO_LED(0, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  207. BCM47XX_GPIO_LED(1, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  208. BCM47XX_GPIO_LED(3, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  209. BCM47XX_GPIO_LED(5, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  210. BCM47XX_GPIO_LED(7, "unk", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
  211. };
  212. static const struct gpio_led
  213. bcm47xx_leds_linksys_e3200v1[] __initconst = {
  214. BCM47XX_GPIO_LED(3, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  215. };
  216. static const struct gpio_led
  217. bcm47xx_leds_linksys_e4200v1[] __initconst = {
  218. BCM47XX_GPIO_LED(5, "white", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  219. };
  220. static const struct gpio_led
  221. bcm47xx_leds_linksys_wrt150nv1[] __initconst = {
  222. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  223. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  224. BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  225. };
  226. static const struct gpio_led
  227. bcm47xx_leds_linksys_wrt150nv11[] __initconst = {
  228. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  229. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  230. BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  231. };
  232. static const struct gpio_led
  233. bcm47xx_leds_linksys_wrt160nv1[] __initconst = {
  234. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  235. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  236. BCM47XX_GPIO_LED(5, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  237. };
  238. static const struct gpio_led
  239. bcm47xx_leds_linksys_wrt160nv3[] __initconst = {
  240. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  241. BCM47XX_GPIO_LED(2, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  242. BCM47XX_GPIO_LED(4, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  243. };
  244. static const struct gpio_led
  245. bcm47xx_leds_linksys_wrt300n_v1[] __initconst = {
  246. BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  247. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  248. BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  249. };
  250. static const struct gpio_led
  251. bcm47xx_leds_linksys_wrt300nv11[] __initconst = {
  252. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  253. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  254. BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  255. };
  256. static const struct gpio_led
  257. bcm47xx_leds_linksys_wrt310nv1[] __initconst = {
  258. BCM47XX_GPIO_LED(1, "blue", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  259. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  260. BCM47XX_GPIO_LED(9, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  261. };
  262. static const struct gpio_led
  263. bcm47xx_leds_linksys_wrt54g_generic[] __initconst = {
  264. BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
  265. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  266. BCM47XX_GPIO_LED(5, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  267. BCM47XX_GPIO_LED(7, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  268. };
  269. static const struct gpio_led
  270. bcm47xx_leds_linksys_wrt54g3gv2[] __initconst = {
  271. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  272. BCM47XX_GPIO_LED(2, "green", "3g", 0, LEDS_GPIO_DEFSTATE_OFF),
  273. BCM47XX_GPIO_LED(3, "blue", "3g", 0, LEDS_GPIO_DEFSTATE_OFF),
  274. };
  275. /* Verified on: WRT54GS V1.0 */
  276. static const struct gpio_led
  277. bcm47xx_leds_linksys_wrt54g_type_0101[] __initconst = {
  278. BCM47XX_GPIO_LED(0, "green", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  279. BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  280. BCM47XX_GPIO_LED(7, "green", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
  281. };
  282. /* Verified on: WRT54GL V1.1 */
  283. static const struct gpio_led
  284. bcm47xx_leds_linksys_wrt54g_type_0467[] __initconst = {
  285. BCM47XX_GPIO_LED(0, "green", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  286. BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  287. BCM47XX_GPIO_LED(2, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  288. BCM47XX_GPIO_LED(3, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  289. BCM47XX_GPIO_LED(7, "green", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
  290. };
  291. static const struct gpio_led
  292. bcm47xx_leds_linksys_wrt610nv1[] __initconst = {
  293. BCM47XX_GPIO_LED(0, "unk", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
  294. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
  295. BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  296. BCM47XX_GPIO_LED(9, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  297. };
  298. static const struct gpio_led
  299. bcm47xx_leds_linksys_wrt610nv2[] __initconst = {
  300. BCM47XX_GPIO_LED(0, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  301. BCM47XX_GPIO_LED(1, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  302. BCM47XX_GPIO_LED(3, "blue", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  303. BCM47XX_GPIO_LED(5, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  304. BCM47XX_GPIO_LED(7, "unk", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
  305. };
  306. static const struct gpio_led
  307. bcm47xx_leds_linksys_wrtsl54gs[] __initconst = {
  308. BCM47XX_GPIO_LED(0, "green", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
  309. BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  310. BCM47XX_GPIO_LED(5, "white", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  311. BCM47XX_GPIO_LED(7, "orange", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  312. };
  313. /* Luxul */
  314. static const struct gpio_led
  315. bcm47xx_leds_luxul_xwr_1750_v1[] __initconst = {
  316. BCM47XX_GPIO_LED(5, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF),
  317. BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF),
  318. BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 0, "timer"),
  319. BCM47XX_GPIO_LED(15, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
  320. };
  321. /* Microsoft */
  322. static const struct gpio_led
  323. bcm47xx_leds_microsoft_nm700[] __initconst = {
  324. BCM47XX_GPIO_LED(6, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  325. };
  326. /* Motorola */
  327. static const struct gpio_led
  328. bcm47xx_leds_motorola_we800g[] __initconst = {
  329. BCM47XX_GPIO_LED(1, "amber", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
  330. BCM47XX_GPIO_LED(2, "unk", "unk", 1, LEDS_GPIO_DEFSTATE_OFF), /* There are only 3 LEDs: Power, Wireless and Device (ethernet) */
  331. BCM47XX_GPIO_LED(4, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  332. };
  333. static const struct gpio_led
  334. bcm47xx_leds_motorola_wr850gp[] __initconst = {
  335. BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  336. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  337. BCM47XX_GPIO_LED(6, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
  338. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  339. };
  340. static const struct gpio_led
  341. bcm47xx_leds_motorola_wr850gv2v3[] __initconst = {
  342. BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  343. BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  344. BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF),
  345. };
  346. /* Netgear */
  347. static const struct gpio_led
  348. bcm47xx_leds_netgear_wndr3400v1[] __initconst = {
  349. BCM47XX_GPIO_LED(2, "green", "usb", 1, LEDS_GPIO_DEFSTATE_OFF),
  350. BCM47XX_GPIO_LED(3, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  351. BCM47XX_GPIO_LED(7, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
  352. };
  353. static const struct gpio_led
  354. bcm47xx_leds_netgear_wndr4500v1[] __initconst = {
  355. BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  356. BCM47XX_GPIO_LED(2, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  357. BCM47XX_GPIO_LED(3, "amber", "power", 1, LEDS_GPIO_DEFSTATE_OFF),
  358. BCM47XX_GPIO_LED(8, "green", "usb1", 1, LEDS_GPIO_DEFSTATE_OFF),
  359. BCM47XX_GPIO_LED(9, "green", "2ghz", 1, LEDS_GPIO_DEFSTATE_OFF),
  360. BCM47XX_GPIO_LED(11, "blue", "5ghz", 1, LEDS_GPIO_DEFSTATE_OFF),
  361. BCM47XX_GPIO_LED(14, "green", "usb2", 1, LEDS_GPIO_DEFSTATE_OFF),
  362. };
  363. static const struct gpio_led
  364. bcm47xx_leds_netgear_wnr3500lv1[] __initconst = {
  365. BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  366. BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
  367. BCM47XX_GPIO_LED(2, "green", "wan", 1, LEDS_GPIO_DEFSTATE_OFF),
  368. BCM47XX_GPIO_LED(3, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  369. BCM47XX_GPIO_LED(7, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
  370. };
  371. static const struct gpio_led
  372. bcm47xx_leds_netgear_wnr834bv2[] __initconst = {
  373. BCM47XX_GPIO_LED(2, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
  374. BCM47XX_GPIO_LED(3, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF),
  375. BCM47XX_GPIO_LED(7, "unk", "connected", 0, LEDS_GPIO_DEFSTATE_OFF),
  376. };
  377. /* Siemens */
  378. static const struct gpio_led
  379. bcm47xx_leds_siemens_se505v2[] __initconst = {
  380. BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
  381. BCM47XX_GPIO_LED(3, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
  382. BCM47XX_GPIO_LED(5, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON),
  383. };
  384. /* SimpleTech */
  385. static const struct gpio_led
  386. bcm47xx_leds_simpletech_simpleshare[] __initconst = {
  387. BCM47XX_GPIO_LED(1, "unk", "status", 1, LEDS_GPIO_DEFSTATE_OFF), /* "Ready" LED */
  388. };
  389. /**************************************************
  390. * Init
  391. **************************************************/
  392. static struct gpio_led_platform_data bcm47xx_leds_pdata;
  393. #define bcm47xx_set_pdata(dev_leds) do { \
  394. bcm47xx_leds_pdata.leds = dev_leds; \
  395. bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \
  396. } while (0)
  397. void __init bcm47xx_leds_register(void)
  398. {
  399. enum bcm47xx_board board = bcm47xx_board_get();
  400. switch (board) {
  401. case BCM47XX_BOARD_ASUS_RTN12:
  402. bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
  403. break;
  404. case BCM47XX_BOARD_ASUS_RTN15U:
  405. bcm47xx_set_pdata(bcm47xx_leds_asus_rtn15u);
  406. break;
  407. case BCM47XX_BOARD_ASUS_RTN16:
  408. bcm47xx_set_pdata(bcm47xx_leds_asus_rtn16);
  409. break;
  410. case BCM47XX_BOARD_ASUS_RTN66U:
  411. bcm47xx_set_pdata(bcm47xx_leds_asus_rtn66u);
  412. break;
  413. case BCM47XX_BOARD_ASUS_WL300G:
  414. bcm47xx_set_pdata(bcm47xx_leds_asus_wl300g);
  415. break;
  416. case BCM47XX_BOARD_ASUS_WL320GE:
  417. bcm47xx_set_pdata(bcm47xx_leds_asus_wl320ge);
  418. break;
  419. case BCM47XX_BOARD_ASUS_WL330GE:
  420. bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge);
  421. break;
  422. case BCM47XX_BOARD_ASUS_WL500G:
  423. bcm47xx_set_pdata(bcm47xx_leds_asus_wl500g);
  424. break;
  425. case BCM47XX_BOARD_ASUS_WL500GD:
  426. bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd);
  427. break;
  428. case BCM47XX_BOARD_ASUS_WL500GPV1:
  429. bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gpv1);
  430. break;
  431. case BCM47XX_BOARD_ASUS_WL500GPV2:
  432. bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gpv2);
  433. break;
  434. case BCM47XX_BOARD_ASUS_WL500W:
  435. bcm47xx_set_pdata(bcm47xx_leds_asus_wl500w);
  436. break;
  437. case BCM47XX_BOARD_ASUS_WL520GC:
  438. bcm47xx_set_pdata(bcm47xx_leds_asus_wl520gc);
  439. break;
  440. case BCM47XX_BOARD_ASUS_WL520GU:
  441. bcm47xx_set_pdata(bcm47xx_leds_asus_wl520gu);
  442. break;
  443. case BCM47XX_BOARD_ASUS_WL700GE:
  444. bcm47xx_set_pdata(bcm47xx_leds_asus_wl700ge);
  445. break;
  446. case BCM47XX_BOARD_ASUS_WLHDD:
  447. bcm47xx_set_pdata(bcm47xx_leds_asus_wlhdd);
  448. break;
  449. case BCM47XX_BOARD_BELKIN_F7D3301:
  450. case BCM47XX_BOARD_BELKIN_F7D3302:
  451. case BCM47XX_BOARD_BELKIN_F7D4301:
  452. case BCM47XX_BOARD_BELKIN_F7D4302:
  453. case BCM47XX_BOARD_BELKIN_F7D4401:
  454. bcm47xx_set_pdata(bcm47xx_leds_belkin_f7d4301);
  455. break;
  456. case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
  457. bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr2_a54g54);
  458. break;
  459. case BCM47XX_BOARD_BUFFALO_WHR_G125:
  460. bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_g125);
  461. break;
  462. case BCM47XX_BOARD_BUFFALO_WHR_G54S:
  463. bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_g54s);
  464. break;
  465. case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
  466. bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_hp_g54);
  467. break;
  468. case BCM47XX_BOARD_BUFFALO_WZR_G300N:
  469. bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_g300n);
  470. break;
  471. case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
  472. bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_rs_g54);
  473. break;
  474. case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
  475. bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_rs_g54hp);
  476. break;
  477. case BCM47XX_BOARD_DELL_TM2300:
  478. bcm47xx_set_pdata(bcm47xx_leds_dell_tm2300);
  479. break;
  480. case BCM47XX_BOARD_DLINK_DIR130:
  481. bcm47xx_set_pdata(bcm47xx_leds_dlink_dir130);
  482. break;
  483. case BCM47XX_BOARD_DLINK_DIR330:
  484. bcm47xx_set_pdata(bcm47xx_leds_dlink_dir330);
  485. break;
  486. case BCM47XX_BOARD_HUAWEI_E970:
  487. bcm47xx_set_pdata(bcm47xx_leds_huawei_e970);
  488. break;
  489. case BCM47XX_BOARD_LINKSYS_E1000V1:
  490. bcm47xx_set_pdata(bcm47xx_leds_linksys_e1000v1);
  491. break;
  492. case BCM47XX_BOARD_LINKSYS_E1000V21:
  493. bcm47xx_set_pdata(bcm47xx_leds_linksys_e1000v21);
  494. break;
  495. case BCM47XX_BOARD_LINKSYS_E2000V1:
  496. bcm47xx_set_pdata(bcm47xx_leds_linksys_e2000v1);
  497. break;
  498. case BCM47XX_BOARD_LINKSYS_E3000V1:
  499. bcm47xx_set_pdata(bcm47xx_leds_linksys_e3000v1);
  500. break;
  501. case BCM47XX_BOARD_LINKSYS_E3200V1:
  502. bcm47xx_set_pdata(bcm47xx_leds_linksys_e3200v1);
  503. break;
  504. case BCM47XX_BOARD_LINKSYS_E4200V1:
  505. bcm47xx_set_pdata(bcm47xx_leds_linksys_e4200v1);
  506. break;
  507. case BCM47XX_BOARD_LINKSYS_WRT150NV1:
  508. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt150nv1);
  509. break;
  510. case BCM47XX_BOARD_LINKSYS_WRT150NV11:
  511. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt150nv11);
  512. break;
  513. case BCM47XX_BOARD_LINKSYS_WRT160NV1:
  514. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv1);
  515. break;
  516. case BCM47XX_BOARD_LINKSYS_WRT160NV3:
  517. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv3);
  518. break;
  519. case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
  520. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300n_v1);
  521. break;
  522. case BCM47XX_BOARD_LINKSYS_WRT300NV11:
  523. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300nv11);
  524. break;
  525. case BCM47XX_BOARD_LINKSYS_WRT310NV1:
  526. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
  527. break;
  528. case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
  529. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g3gv2);
  530. break;
  531. case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
  532. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_type_0101);
  533. break;
  534. case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
  535. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_type_0467);
  536. break;
  537. case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
  538. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_generic);
  539. break;
  540. case BCM47XX_BOARD_LINKSYS_WRT610NV1:
  541. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv1);
  542. break;
  543. case BCM47XX_BOARD_LINKSYS_WRT610NV2:
  544. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv2);
  545. break;
  546. case BCM47XX_BOARD_LINKSYS_WRTSL54GS:
  547. bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs);
  548. break;
  549. case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
  550. bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1);
  551. break;
  552. case BCM47XX_BOARD_MICROSOFT_MN700:
  553. bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700);
  554. break;
  555. case BCM47XX_BOARD_MOTOROLA_WE800G:
  556. bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g);
  557. break;
  558. case BCM47XX_BOARD_MOTOROLA_WR850GP:
  559. bcm47xx_set_pdata(bcm47xx_leds_motorola_wr850gp);
  560. break;
  561. case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
  562. bcm47xx_set_pdata(bcm47xx_leds_motorola_wr850gv2v3);
  563. break;
  564. case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
  565. bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr3400v1);
  566. break;
  567. case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
  568. bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1);
  569. break;
  570. case BCM47XX_BOARD_NETGEAR_WNR3500L:
  571. bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1);
  572. break;
  573. case BCM47XX_BOARD_NETGEAR_WNR834BV2:
  574. bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr834bv2);
  575. break;
  576. case BCM47XX_BOARD_SIEMENS_SE505V2:
  577. bcm47xx_set_pdata(bcm47xx_leds_siemens_se505v2);
  578. break;
  579. case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
  580. bcm47xx_set_pdata(bcm47xx_leds_simpletech_simpleshare);
  581. break;
  582. default:
  583. pr_debug("No LEDs configuration found for this device\n");
  584. return;
  585. }
  586. gpio_led_register_device(-1, &bcm47xx_leds_pdata);
  587. }