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