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