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 31 static const struct gpio_led 32 bcm47xx_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 37 static const struct gpio_led 38 bcm47xx_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 46 static const struct gpio_led 47 bcm47xx_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 52 static const struct gpio_led 53 bcm47xx_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 58 static const struct gpio_led 59 bcm47xx_leds_asus_wl300g[] __initconst = { 60 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 61 }; 62 63 static const struct gpio_led 64 bcm47xx_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 70 static const struct gpio_led 71 bcm47xx_leds_asus_wl330ge[] __initconst = { 72 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 73 }; 74 75 static const struct gpio_led 76 bcm47xx_leds_asus_wl500g[] __initconst = { 77 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 78 }; 79 80 static const struct gpio_led 81 bcm47xx_leds_asus_wl500gd[] __initconst = { 82 BCM47XX_GPIO_LED(0, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 83 }; 84 85 static const struct gpio_led 86 bcm47xx_leds_asus_wl500gpv1[] __initconst = { 87 BCM47XX_GPIO_LED(1, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 88 }; 89 90 static const struct gpio_led 91 bcm47xx_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 96 static const struct gpio_led 97 bcm47xx_leds_asus_wl500w[] __initconst = { 98 BCM47XX_GPIO_LED(5, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 99 }; 100 101 static const struct gpio_led 102 bcm47xx_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 107 static const struct gpio_led 108 bcm47xx_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 113 static const struct gpio_led 114 bcm47xx_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 118 static const struct gpio_led 119 bcm47xx_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 126 static const struct gpio_led 127 bcm47xx_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 138 static const struct gpio_led 139 bcm47xx_leds_buffalo_whr2_a54g54[] __initconst = { 140 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF), 141 }; 142 143 static const struct gpio_led 144 bcm47xx_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 152 static const struct gpio_led 153 bcm47xx_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 161 static const struct gpio_led 162 bcm47xx_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 170 static const struct gpio_led 171 bcm47xx_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 177 static const struct gpio_led 178 bcm47xx_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 184 static const struct gpio_led 185 bcm47xx_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 193 static const struct gpio_led 194 bcm47xx_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 201 static const struct gpio_led 202 bcm47xx_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 207 static const struct gpio_led 208 bcm47xx_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 216 static const struct gpio_led 217 bcm47xx_leds_huawei_e970[] __initconst = { 218 BCM47XX_GPIO_LED(0, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 219 }; 220 221 /* Linksys */ 222 223 static const struct gpio_led 224 bcm47xx_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 231 static const struct gpio_led 232 bcm47xx_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 239 static const struct gpio_led 240 bcm47xx_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 247 static const struct gpio_led 248 bcm47xx_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 256 static const struct gpio_led 257 bcm47xx_leds_linksys_e3200v1[] __initconst = { 258 BCM47XX_GPIO_LED(3, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON), 259 }; 260 261 static const struct gpio_led 262 bcm47xx_leds_linksys_e4200v1[] __initconst = { 263 BCM47XX_GPIO_LED(5, "white", "power", 1, LEDS_GPIO_DEFSTATE_ON), 264 }; 265 266 static const struct gpio_led 267 bcm47xx_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 273 static const struct gpio_led 274 bcm47xx_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 280 static const struct gpio_led 281 bcm47xx_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 287 static const struct gpio_led 288 bcm47xx_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 294 static const struct gpio_led 295 bcm47xx_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 301 static const struct gpio_led 302 bcm47xx_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 308 static const struct gpio_led 309 bcm47xx_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 315 static const struct gpio_led 316 bcm47xx_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 323 static const struct gpio_led 324 bcm47xx_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 */ 331 static const struct gpio_led 332 bcm47xx_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 */ 339 static const struct gpio_led 340 bcm47xx_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 348 static const struct gpio_led 349 bcm47xx_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 356 static const struct gpio_led 357 bcm47xx_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 365 static const struct gpio_led 366 bcm47xx_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 375 static const struct gpio_led 376 bcm47xx_leds_luxul_abr_4400_v1[] __initconst = { 377 BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), 378 BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), 379 }; 380 381 static const struct gpio_led 382 bcm47xx_leds_luxul_xap_310_v1[] __initconst = { 383 BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), 384 }; 385 386 static const struct gpio_led 387 bcm47xx_leds_luxul_xap_1210_v1[] __initconst = { 388 BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), 389 }; 390 391 static const struct gpio_led 392 bcm47xx_leds_luxul_xap_1230_v1[] __initconst = { 393 BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), 394 BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF), 395 BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), 396 }; 397 398 static const struct gpio_led 399 bcm47xx_leds_luxul_xap_1240_v1[] __initconst = { 400 BCM47XX_GPIO_LED(3, "blue", "2ghz", 0, LEDS_GPIO_DEFSTATE_OFF), 401 BCM47XX_GPIO_LED(4, "green", "bridge", 0, LEDS_GPIO_DEFSTATE_OFF), 402 BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), 403 }; 404 405 static const struct gpio_led 406 bcm47xx_leds_luxul_xap_1500_v1[] __initconst = { 407 BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 1, "timer"), 408 }; 409 410 static const struct gpio_led 411 bcm47xx_leds_luxul_xbr_4400_v1[] __initconst = { 412 BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), 413 BCM47XX_GPIO_LED_TRIGGER(15, "green", "status", 0, "timer"), 414 }; 415 416 static const struct gpio_led 417 bcm47xx_leds_luxul_xvw_p30_v1[] __initconst = { 418 BCM47XX_GPIO_LED_TRIGGER(0, "blue", "status", 1, "timer"), 419 BCM47XX_GPIO_LED(1, "green", "link", 1, LEDS_GPIO_DEFSTATE_OFF), 420 }; 421 422 static const struct gpio_led 423 bcm47xx_leds_luxul_xwr_600_v1[] __initconst = { 424 BCM47XX_GPIO_LED(3, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), 425 BCM47XX_GPIO_LED_TRIGGER(6, "green", "status", 1, "timer"), 426 BCM47XX_GPIO_LED(9, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), 427 }; 428 429 static const struct gpio_led 430 bcm47xx_leds_luxul_xwr_1750_v1[] __initconst = { 431 BCM47XX_GPIO_LED(5, "green", "5ghz", 0, LEDS_GPIO_DEFSTATE_OFF), 432 BCM47XX_GPIO_LED(12, "green", "usb", 0, LEDS_GPIO_DEFSTATE_OFF), 433 BCM47XX_GPIO_LED_TRIGGER(13, "green", "status", 0, "timer"), 434 BCM47XX_GPIO_LED(15, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF), 435 }; 436 437 /* Microsoft */ 438 439 static const struct gpio_led 440 bcm47xx_leds_microsoft_nm700[] __initconst = { 441 BCM47XX_GPIO_LED(6, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), 442 }; 443 444 /* Motorola */ 445 446 static const struct gpio_led 447 bcm47xx_leds_motorola_we800g[] __initconst = { 448 BCM47XX_GPIO_LED(1, "amber", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 449 BCM47XX_GPIO_LED(2, "unk", "unk", 1, LEDS_GPIO_DEFSTATE_OFF), /* There are only 3 LEDs: Power, Wireless and Device (ethernet) */ 450 BCM47XX_GPIO_LED(4, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON), 451 }; 452 453 static const struct gpio_led 454 bcm47xx_leds_motorola_wr850gp[] __initconst = { 455 BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), 456 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), 457 BCM47XX_GPIO_LED(6, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), 458 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF), 459 }; 460 461 static const struct gpio_led 462 bcm47xx_leds_motorola_wr850gv2v3[] __initconst = { 463 BCM47XX_GPIO_LED(0, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), 464 BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON), 465 BCM47XX_GPIO_LED(7, "unk", "diag", 1, LEDS_GPIO_DEFSTATE_OFF), 466 }; 467 468 /* Netgear */ 469 470 static const struct gpio_led 471 bcm47xx_leds_netgear_wndr3400v1[] __initconst = { 472 BCM47XX_GPIO_LED(2, "green", "usb", 1, LEDS_GPIO_DEFSTATE_OFF), 473 BCM47XX_GPIO_LED(3, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON), 474 BCM47XX_GPIO_LED(7, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF), 475 }; 476 477 static const struct gpio_led 478 bcm47xx_leds_netgear_wndr4500v1[] __initconst = { 479 BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 480 BCM47XX_GPIO_LED(2, "green", "power", 1, LEDS_GPIO_DEFSTATE_ON), 481 BCM47XX_GPIO_LED(3, "amber", "power", 1, LEDS_GPIO_DEFSTATE_OFF), 482 BCM47XX_GPIO_LED(8, "green", "usb1", 1, LEDS_GPIO_DEFSTATE_OFF), 483 BCM47XX_GPIO_LED(9, "green", "2ghz", 1, LEDS_GPIO_DEFSTATE_OFF), 484 BCM47XX_GPIO_LED(11, "blue", "5ghz", 1, LEDS_GPIO_DEFSTATE_OFF), 485 BCM47XX_GPIO_LED(14, "green", "usb2", 1, LEDS_GPIO_DEFSTATE_OFF), 486 }; 487 488 static const struct gpio_led 489 bcm47xx_leds_netgear_wnr3500lv1[] __initconst = { 490 BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), 491 BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF), 492 BCM47XX_GPIO_LED(2, "green", "wan", 1, LEDS_GPIO_DEFSTATE_OFF), 493 BCM47XX_GPIO_LED(3, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON), 494 BCM47XX_GPIO_LED(7, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF), 495 }; 496 497 static const struct gpio_led 498 bcm47xx_leds_netgear_wnr834bv2[] __initconst = { 499 BCM47XX_GPIO_LED(2, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON), 500 BCM47XX_GPIO_LED(3, "amber", "power", 0, LEDS_GPIO_DEFSTATE_OFF), 501 BCM47XX_GPIO_LED(7, "unk", "connected", 0, LEDS_GPIO_DEFSTATE_OFF), 502 }; 503 504 /* Siemens */ 505 static const struct gpio_led 506 bcm47xx_leds_siemens_se505v2[] __initconst = { 507 BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF), 508 BCM47XX_GPIO_LED(3, "unk", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF), 509 BCM47XX_GPIO_LED(5, "unk", "power", 1, LEDS_GPIO_DEFSTATE_ON), 510 }; 511 512 /* SimpleTech */ 513 514 static const struct gpio_led 515 bcm47xx_leds_simpletech_simpleshare[] __initconst = { 516 BCM47XX_GPIO_LED(1, "unk", "status", 1, LEDS_GPIO_DEFSTATE_OFF), /* "Ready" LED */ 517 }; 518 519 /************************************************** 520 * Init 521 **************************************************/ 522 523 static struct gpio_led_platform_data bcm47xx_leds_pdata; 524 525 #define bcm47xx_set_pdata(dev_leds) do { \ 526 bcm47xx_leds_pdata.leds = dev_leds; \ 527 bcm47xx_leds_pdata.num_leds = ARRAY_SIZE(dev_leds); \ 528 } while (0) 529 530 void __init bcm47xx_leds_register(void) 531 { 532 enum bcm47xx_board board = bcm47xx_board_get(); 533 534 switch (board) { 535 case BCM47XX_BOARD_ASUS_RTN12: 536 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12); 537 break; 538 case BCM47XX_BOARD_ASUS_RTN15U: 539 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn15u); 540 break; 541 case BCM47XX_BOARD_ASUS_RTN16: 542 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn16); 543 break; 544 case BCM47XX_BOARD_ASUS_RTN66U: 545 bcm47xx_set_pdata(bcm47xx_leds_asus_rtn66u); 546 break; 547 case BCM47XX_BOARD_ASUS_WL300G: 548 bcm47xx_set_pdata(bcm47xx_leds_asus_wl300g); 549 break; 550 case BCM47XX_BOARD_ASUS_WL320GE: 551 bcm47xx_set_pdata(bcm47xx_leds_asus_wl320ge); 552 break; 553 case BCM47XX_BOARD_ASUS_WL330GE: 554 bcm47xx_set_pdata(bcm47xx_leds_asus_wl330ge); 555 break; 556 case BCM47XX_BOARD_ASUS_WL500G: 557 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500g); 558 break; 559 case BCM47XX_BOARD_ASUS_WL500GD: 560 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gd); 561 break; 562 case BCM47XX_BOARD_ASUS_WL500GPV1: 563 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gpv1); 564 break; 565 case BCM47XX_BOARD_ASUS_WL500GPV2: 566 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500gpv2); 567 break; 568 case BCM47XX_BOARD_ASUS_WL500W: 569 bcm47xx_set_pdata(bcm47xx_leds_asus_wl500w); 570 break; 571 case BCM47XX_BOARD_ASUS_WL520GC: 572 bcm47xx_set_pdata(bcm47xx_leds_asus_wl520gc); 573 break; 574 case BCM47XX_BOARD_ASUS_WL520GU: 575 bcm47xx_set_pdata(bcm47xx_leds_asus_wl520gu); 576 break; 577 case BCM47XX_BOARD_ASUS_WL700GE: 578 bcm47xx_set_pdata(bcm47xx_leds_asus_wl700ge); 579 break; 580 case BCM47XX_BOARD_ASUS_WLHDD: 581 bcm47xx_set_pdata(bcm47xx_leds_asus_wlhdd); 582 break; 583 584 case BCM47XX_BOARD_BELKIN_F7D3301: 585 case BCM47XX_BOARD_BELKIN_F7D3302: 586 case BCM47XX_BOARD_BELKIN_F7D4301: 587 case BCM47XX_BOARD_BELKIN_F7D4302: 588 case BCM47XX_BOARD_BELKIN_F7D4401: 589 bcm47xx_set_pdata(bcm47xx_leds_belkin_f7d4301); 590 break; 591 592 case BCM47XX_BOARD_BUFFALO_WHR2_A54G54: 593 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr2_a54g54); 594 break; 595 case BCM47XX_BOARD_BUFFALO_WHR_G125: 596 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_g125); 597 break; 598 case BCM47XX_BOARD_BUFFALO_WHR_G54S: 599 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_g54s); 600 break; 601 case BCM47XX_BOARD_BUFFALO_WHR_HP_G54: 602 bcm47xx_set_pdata(bcm47xx_leds_buffalo_whr_hp_g54); 603 break; 604 case BCM47XX_BOARD_BUFFALO_WZR_G300N: 605 bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_g300n); 606 break; 607 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54: 608 bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_rs_g54); 609 break; 610 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP: 611 bcm47xx_set_pdata(bcm47xx_leds_buffalo_wzr_rs_g54hp); 612 break; 613 614 case BCM47XX_BOARD_DELL_TM2300: 615 bcm47xx_set_pdata(bcm47xx_leds_dell_tm2300); 616 break; 617 618 case BCM47XX_BOARD_DLINK_DIR130: 619 bcm47xx_set_pdata(bcm47xx_leds_dlink_dir130); 620 break; 621 case BCM47XX_BOARD_DLINK_DIR330: 622 bcm47xx_set_pdata(bcm47xx_leds_dlink_dir330); 623 break; 624 625 case BCM47XX_BOARD_HUAWEI_E970: 626 bcm47xx_set_pdata(bcm47xx_leds_huawei_e970); 627 break; 628 629 case BCM47XX_BOARD_LINKSYS_E1000V1: 630 bcm47xx_set_pdata(bcm47xx_leds_linksys_e1000v1); 631 break; 632 case BCM47XX_BOARD_LINKSYS_E1000V21: 633 bcm47xx_set_pdata(bcm47xx_leds_linksys_e1000v21); 634 break; 635 case BCM47XX_BOARD_LINKSYS_E2000V1: 636 bcm47xx_set_pdata(bcm47xx_leds_linksys_e2000v1); 637 break; 638 case BCM47XX_BOARD_LINKSYS_E3000V1: 639 bcm47xx_set_pdata(bcm47xx_leds_linksys_e3000v1); 640 break; 641 case BCM47XX_BOARD_LINKSYS_E3200V1: 642 bcm47xx_set_pdata(bcm47xx_leds_linksys_e3200v1); 643 break; 644 case BCM47XX_BOARD_LINKSYS_E4200V1: 645 bcm47xx_set_pdata(bcm47xx_leds_linksys_e4200v1); 646 break; 647 case BCM47XX_BOARD_LINKSYS_WRT150NV1: 648 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt150nv1); 649 break; 650 case BCM47XX_BOARD_LINKSYS_WRT150NV11: 651 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt150nv11); 652 break; 653 case BCM47XX_BOARD_LINKSYS_WRT160NV1: 654 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv1); 655 break; 656 case BCM47XX_BOARD_LINKSYS_WRT160NV3: 657 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv3); 658 break; 659 case BCM47XX_BOARD_LINKSYS_WRT300N_V1: 660 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300n_v1); 661 break; 662 case BCM47XX_BOARD_LINKSYS_WRT300NV11: 663 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300nv11); 664 break; 665 case BCM47XX_BOARD_LINKSYS_WRT310NV1: 666 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1); 667 break; 668 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: 669 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g3gv2); 670 break; 671 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101: 672 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_type_0101); 673 break; 674 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467: 675 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_type_0467); 676 break; 677 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708: 678 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt54g_generic); 679 break; 680 case BCM47XX_BOARD_LINKSYS_WRT610NV1: 681 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv1); 682 break; 683 case BCM47XX_BOARD_LINKSYS_WRT610NV2: 684 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt610nv2); 685 break; 686 case BCM47XX_BOARD_LINKSYS_WRTSL54GS: 687 bcm47xx_set_pdata(bcm47xx_leds_linksys_wrtsl54gs); 688 break; 689 690 case BCM47XX_BOARD_LUXUL_ABR_4400_V1: 691 bcm47xx_set_pdata(bcm47xx_leds_luxul_abr_4400_v1); 692 break; 693 case BCM47XX_BOARD_LUXUL_XAP_310_V1: 694 bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_310_v1); 695 break; 696 case BCM47XX_BOARD_LUXUL_XAP_1210_V1: 697 bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1210_v1); 698 break; 699 case BCM47XX_BOARD_LUXUL_XAP_1230_V1: 700 bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1230_v1); 701 break; 702 case BCM47XX_BOARD_LUXUL_XAP_1240_V1: 703 bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1240_v1); 704 break; 705 case BCM47XX_BOARD_LUXUL_XAP_1500_V1: 706 bcm47xx_set_pdata(bcm47xx_leds_luxul_xap_1500_v1); 707 break; 708 case BCM47XX_BOARD_LUXUL_XBR_4400_V1: 709 bcm47xx_set_pdata(bcm47xx_leds_luxul_xbr_4400_v1); 710 break; 711 case BCM47XX_BOARD_LUXUL_XVW_P30_V1: 712 bcm47xx_set_pdata(bcm47xx_leds_luxul_xvw_p30_v1); 713 break; 714 case BCM47XX_BOARD_LUXUL_XWR_600_V1: 715 bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_600_v1); 716 break; 717 case BCM47XX_BOARD_LUXUL_XWR_1750_V1: 718 bcm47xx_set_pdata(bcm47xx_leds_luxul_xwr_1750_v1); 719 break; 720 721 case BCM47XX_BOARD_MICROSOFT_MN700: 722 bcm47xx_set_pdata(bcm47xx_leds_microsoft_nm700); 723 break; 724 725 case BCM47XX_BOARD_MOTOROLA_WE800G: 726 bcm47xx_set_pdata(bcm47xx_leds_motorola_we800g); 727 break; 728 case BCM47XX_BOARD_MOTOROLA_WR850GP: 729 bcm47xx_set_pdata(bcm47xx_leds_motorola_wr850gp); 730 break; 731 case BCM47XX_BOARD_MOTOROLA_WR850GV2V3: 732 bcm47xx_set_pdata(bcm47xx_leds_motorola_wr850gv2v3); 733 break; 734 735 case BCM47XX_BOARD_NETGEAR_WNDR3400V1: 736 bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr3400v1); 737 break; 738 case BCM47XX_BOARD_NETGEAR_WNDR4500V1: 739 bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1); 740 break; 741 case BCM47XX_BOARD_NETGEAR_WNR3500L: 742 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1); 743 break; 744 case BCM47XX_BOARD_NETGEAR_WNR834BV2: 745 bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr834bv2); 746 break; 747 748 case BCM47XX_BOARD_SIEMENS_SE505V2: 749 bcm47xx_set_pdata(bcm47xx_leds_siemens_se505v2); 750 break; 751 752 case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE: 753 bcm47xx_set_pdata(bcm47xx_leds_simpletech_simpleshare); 754 break; 755 756 default: 757 pr_debug("No LEDs configuration found for this device\n"); 758 return; 759 } 760 761 gpio_led_register_device(-1, &bcm47xx_leds_pdata); 762 } 763