1 // SPDX-License-Identifier: GPL-2.0 2 #include "bcm47xx_private.h" 3 4 #include <linux/input.h> 5 #include <linux/gpio_keys.h> 6 #include <linux/interrupt.h> 7 #include <bcm47xx_board.h> 8 #include <bcm47xx.h> 9 10 /************************************************** 11 * Database 12 **************************************************/ 13 14 #define BCM47XX_GPIO_KEY(_gpio, _code) \ 15 { \ 16 .code = _code, \ 17 .gpio = _gpio, \ 18 .active_low = 1, \ 19 } 20 21 #define BCM47XX_GPIO_KEY_H(_gpio, _code) \ 22 { \ 23 .code = _code, \ 24 .gpio = _gpio, \ 25 } 26 27 /* Asus */ 28 29 static const struct gpio_keys_button 30 bcm47xx_buttons_asus_rtn10u[] __initconst = { 31 BCM47XX_GPIO_KEY(20, KEY_WPS_BUTTON), 32 BCM47XX_GPIO_KEY(21, KEY_RESTART), 33 }; 34 35 static const struct gpio_keys_button 36 bcm47xx_buttons_asus_rtn12[] __initconst = { 37 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 38 BCM47XX_GPIO_KEY(1, KEY_RESTART), 39 BCM47XX_GPIO_KEY(4, BTN_0), /* Router mode */ 40 BCM47XX_GPIO_KEY(5, BTN_1), /* Repeater mode */ 41 BCM47XX_GPIO_KEY(6, BTN_2), /* AP mode */ 42 }; 43 44 static const struct gpio_keys_button 45 bcm47xx_buttons_asus_rtn16[] __initconst = { 46 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), 47 BCM47XX_GPIO_KEY(8, KEY_RESTART), 48 }; 49 50 static const struct gpio_keys_button 51 bcm47xx_buttons_asus_rtn66u[] __initconst = { 52 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 53 BCM47XX_GPIO_KEY(9, KEY_RESTART), 54 }; 55 56 static const struct gpio_keys_button 57 bcm47xx_buttons_asus_wl300g[] __initconst = { 58 BCM47XX_GPIO_KEY(6, KEY_RESTART), 59 }; 60 61 static const struct gpio_keys_button 62 bcm47xx_buttons_asus_wl320ge[] __initconst = { 63 BCM47XX_GPIO_KEY(6, KEY_RESTART), 64 }; 65 66 static const struct gpio_keys_button 67 bcm47xx_buttons_asus_wl330ge[] __initconst = { 68 BCM47XX_GPIO_KEY(2, KEY_RESTART), 69 }; 70 71 static const struct gpio_keys_button 72 bcm47xx_buttons_asus_wl500g[] __initconst = { 73 BCM47XX_GPIO_KEY(6, KEY_RESTART), 74 }; 75 76 static const struct gpio_keys_button 77 bcm47xx_buttons_asus_wl500gd[] __initconst = { 78 BCM47XX_GPIO_KEY(6, KEY_RESTART), 79 }; 80 81 static const struct gpio_keys_button 82 bcm47xx_buttons_asus_wl500gpv1[] __initconst = { 83 BCM47XX_GPIO_KEY(0, KEY_RESTART), 84 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 85 }; 86 87 static const struct gpio_keys_button 88 bcm47xx_buttons_asus_wl500gpv2[] __initconst = { 89 BCM47XX_GPIO_KEY(2, KEY_RESTART), 90 BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON), 91 }; 92 93 static const struct gpio_keys_button 94 bcm47xx_buttons_asus_wl500w[] __initconst = { 95 BCM47XX_GPIO_KEY_H(6, KEY_RESTART), 96 BCM47XX_GPIO_KEY_H(7, KEY_WPS_BUTTON), 97 }; 98 99 static const struct gpio_keys_button 100 bcm47xx_buttons_asus_wl520gc[] __initconst = { 101 BCM47XX_GPIO_KEY(2, KEY_RESTART), 102 BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON), 103 }; 104 105 static const struct gpio_keys_button 106 bcm47xx_buttons_asus_wl520gu[] __initconst = { 107 BCM47XX_GPIO_KEY(2, KEY_RESTART), 108 BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON), 109 }; 110 111 static const struct gpio_keys_button 112 bcm47xx_buttons_asus_wl700ge[] __initconst = { 113 BCM47XX_GPIO_KEY(0, KEY_POWER), /* Hard disk power switch */ 114 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), /* EZSetup */ 115 BCM47XX_GPIO_KEY(6, KEY_COPY), /* Copy data from USB to internal disk */ 116 BCM47XX_GPIO_KEY(7, KEY_RESTART), /* Hard reset */ 117 }; 118 119 static const struct gpio_keys_button 120 bcm47xx_buttons_asus_wlhdd[] __initconst = { 121 BCM47XX_GPIO_KEY(6, KEY_RESTART), 122 }; 123 124 /* Huawei */ 125 126 static const struct gpio_keys_button 127 bcm47xx_buttons_huawei_e970[] __initconst = { 128 BCM47XX_GPIO_KEY(6, KEY_RESTART), 129 }; 130 131 /* Belkin */ 132 133 static const struct gpio_keys_button 134 bcm47xx_buttons_belkin_f7d4301[] __initconst = { 135 BCM47XX_GPIO_KEY(6, KEY_RESTART), 136 BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON), 137 }; 138 139 /* Buffalo */ 140 141 static const struct gpio_keys_button 142 bcm47xx_buttons_buffalo_whr2_a54g54[] __initconst = { 143 BCM47XX_GPIO_KEY(4, KEY_RESTART), 144 }; 145 146 static const struct gpio_keys_button 147 bcm47xx_buttons_buffalo_whr_g125[] __initconst = { 148 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 149 BCM47XX_GPIO_KEY(4, KEY_RESTART), 150 BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */ 151 }; 152 153 static const struct gpio_keys_button 154 bcm47xx_buttons_buffalo_whr_g54s[] __initconst = { 155 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 156 BCM47XX_GPIO_KEY_H(4, KEY_RESTART), 157 BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */ 158 }; 159 160 static const struct gpio_keys_button 161 bcm47xx_buttons_buffalo_whr_hp_g54[] __initconst = { 162 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 163 BCM47XX_GPIO_KEY(4, KEY_RESTART), 164 BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */ 165 }; 166 167 static const struct gpio_keys_button 168 bcm47xx_buttons_buffalo_wzr_g300n[] __initconst = { 169 BCM47XX_GPIO_KEY(4, KEY_RESTART), 170 }; 171 172 static const struct gpio_keys_button 173 bcm47xx_buttons_buffalo_wzr_rs_g54[] __initconst = { 174 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 175 BCM47XX_GPIO_KEY(4, KEY_RESTART), 176 }; 177 178 static const struct gpio_keys_button 179 bcm47xx_buttons_buffalo_wzr_rs_g54hp[] __initconst = { 180 BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), 181 BCM47XX_GPIO_KEY(4, KEY_RESTART), 182 }; 183 184 /* Dell */ 185 186 static const struct gpio_keys_button 187 bcm47xx_buttons_dell_tm2300[] __initconst = { 188 BCM47XX_GPIO_KEY(0, KEY_RESTART), 189 }; 190 191 /* D-Link */ 192 193 static const struct gpio_keys_button 194 bcm47xx_buttons_dlink_dir130[] __initconst = { 195 BCM47XX_GPIO_KEY(3, KEY_RESTART), 196 BCM47XX_GPIO_KEY(7, KEY_UNKNOWN), 197 }; 198 199 static const struct gpio_keys_button 200 bcm47xx_buttons_dlink_dir330[] __initconst = { 201 BCM47XX_GPIO_KEY(3, KEY_RESTART), 202 BCM47XX_GPIO_KEY(7, KEY_UNKNOWN), 203 }; 204 205 /* Linksys */ 206 207 static const struct gpio_keys_button 208 bcm47xx_buttons_linksys_e1000v1[] __initconst = { 209 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 210 BCM47XX_GPIO_KEY(6, KEY_RESTART), 211 }; 212 213 static const struct gpio_keys_button 214 bcm47xx_buttons_linksys_e1000v21[] __initconst = { 215 BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON), 216 BCM47XX_GPIO_KEY(10, KEY_RESTART), 217 }; 218 219 static const struct gpio_keys_button 220 bcm47xx_buttons_linksys_e2000v1[] __initconst = { 221 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 222 BCM47XX_GPIO_KEY(8, KEY_RESTART), 223 }; 224 225 static const struct gpio_keys_button 226 bcm47xx_buttons_linksys_e3000v1[] __initconst = { 227 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 228 BCM47XX_GPIO_KEY(6, KEY_RESTART), 229 }; 230 231 static const struct gpio_keys_button 232 bcm47xx_buttons_linksys_e3200v1[] __initconst = { 233 BCM47XX_GPIO_KEY(5, KEY_RESTART), 234 BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON), 235 }; 236 237 static const struct gpio_keys_button 238 bcm47xx_buttons_linksys_e4200v1[] __initconst = { 239 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 240 BCM47XX_GPIO_KEY(6, KEY_RESTART), 241 }; 242 243 static const struct gpio_keys_button 244 bcm47xx_buttons_linksys_wrt150nv1[] __initconst = { 245 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 246 BCM47XX_GPIO_KEY(6, KEY_RESTART), 247 }; 248 249 static const struct gpio_keys_button 250 bcm47xx_buttons_linksys_wrt150nv11[] __initconst = { 251 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 252 BCM47XX_GPIO_KEY(6, KEY_RESTART), 253 }; 254 255 static const struct gpio_keys_button 256 bcm47xx_buttons_linksys_wrt160nv1[] __initconst = { 257 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 258 BCM47XX_GPIO_KEY(6, KEY_RESTART), 259 }; 260 261 static const struct gpio_keys_button 262 bcm47xx_buttons_linksys_wrt160nv3[] __initconst = { 263 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 264 BCM47XX_GPIO_KEY(6, KEY_RESTART), 265 }; 266 267 static const struct gpio_keys_button 268 bcm47xx_buttons_linksys_wrt300n_v1[] __initconst = { 269 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 270 BCM47XX_GPIO_KEY(6, KEY_RESTART), 271 }; 272 273 static const struct gpio_keys_button 274 bcm47xx_buttons_linksys_wrt300nv11[] __initconst = { 275 BCM47XX_GPIO_KEY(4, KEY_UNKNOWN), 276 BCM47XX_GPIO_KEY(6, KEY_RESTART), 277 }; 278 279 static const struct gpio_keys_button 280 bcm47xx_buttons_linksys_wrt310nv1[] __initconst = { 281 BCM47XX_GPIO_KEY(6, KEY_RESTART), 282 BCM47XX_GPIO_KEY(8, KEY_UNKNOWN), 283 }; 284 285 static const struct gpio_keys_button 286 bcm47xx_buttons_linksys_wrt310n_v2[] __initconst = { 287 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 288 BCM47XX_GPIO_KEY(6, KEY_RESTART), 289 }; 290 291 static const struct gpio_keys_button 292 bcm47xx_buttons_linksys_wrt320n_v1[] __initconst = { 293 BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), 294 BCM47XX_GPIO_KEY(8, KEY_RESTART), 295 }; 296 297 static const struct gpio_keys_button 298 bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = { 299 BCM47XX_GPIO_KEY(5, KEY_WIMAX), 300 BCM47XX_GPIO_KEY(6, KEY_RESTART), 301 }; 302 303 static const struct gpio_keys_button 304 bcm47xx_buttons_linksys_wrt54g_generic[] __initconst = { 305 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 306 BCM47XX_GPIO_KEY(6, KEY_RESTART), 307 }; 308 309 static const struct gpio_keys_button 310 bcm47xx_buttons_linksys_wrt610nv1[] __initconst = { 311 BCM47XX_GPIO_KEY(6, KEY_RESTART), 312 BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON), 313 }; 314 315 static const struct gpio_keys_button 316 bcm47xx_buttons_linksys_wrt610nv2[] __initconst = { 317 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 318 BCM47XX_GPIO_KEY(6, KEY_RESTART), 319 }; 320 321 static const struct gpio_keys_button 322 bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = { 323 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 324 BCM47XX_GPIO_KEY(6, KEY_RESTART), 325 }; 326 327 /* Luxul */ 328 329 static const struct gpio_keys_button 330 bcm47xx_buttons_luxul_abr_4400_v1[] = { 331 BCM47XX_GPIO_KEY(14, KEY_RESTART), 332 }; 333 334 static const struct gpio_keys_button 335 bcm47xx_buttons_luxul_xap_310_v1[] = { 336 BCM47XX_GPIO_KEY(20, KEY_RESTART), 337 }; 338 339 static const struct gpio_keys_button 340 bcm47xx_buttons_luxul_xap_1210_v1[] = { 341 BCM47XX_GPIO_KEY(8, KEY_RESTART), 342 }; 343 344 static const struct gpio_keys_button 345 bcm47xx_buttons_luxul_xap_1230_v1[] = { 346 BCM47XX_GPIO_KEY(8, KEY_RESTART), 347 }; 348 349 static const struct gpio_keys_button 350 bcm47xx_buttons_luxul_xap_1240_v1[] = { 351 BCM47XX_GPIO_KEY(8, KEY_RESTART), 352 }; 353 354 static const struct gpio_keys_button 355 bcm47xx_buttons_luxul_xap_1500_v1[] = { 356 BCM47XX_GPIO_KEY(14, KEY_RESTART), 357 }; 358 359 static const struct gpio_keys_button 360 bcm47xx_buttons_luxul_xbr_4400_v1[] = { 361 BCM47XX_GPIO_KEY(14, KEY_RESTART), 362 }; 363 364 static const struct gpio_keys_button 365 bcm47xx_buttons_luxul_xvw_p30_v1[] = { 366 BCM47XX_GPIO_KEY(20, KEY_RESTART), 367 }; 368 369 static const struct gpio_keys_button 370 bcm47xx_buttons_luxul_xwr_600_v1[] = { 371 BCM47XX_GPIO_KEY(8, KEY_RESTART), 372 }; 373 374 static const struct gpio_keys_button 375 bcm47xx_buttons_luxul_xwr_1750_v1[] = { 376 BCM47XX_GPIO_KEY(14, KEY_RESTART), 377 }; 378 379 /* Microsoft */ 380 381 static const struct gpio_keys_button 382 bcm47xx_buttons_microsoft_nm700[] __initconst = { 383 BCM47XX_GPIO_KEY(7, KEY_RESTART), 384 }; 385 386 /* Motorola */ 387 388 static const struct gpio_keys_button 389 bcm47xx_buttons_motorola_we800g[] __initconst = { 390 BCM47XX_GPIO_KEY(0, KEY_RESTART), 391 }; 392 393 static const struct gpio_keys_button 394 bcm47xx_buttons_motorola_wr850gp[] __initconst = { 395 BCM47XX_GPIO_KEY(5, KEY_RESTART), 396 }; 397 398 static const struct gpio_keys_button 399 bcm47xx_buttons_motorola_wr850gv2v3[] __initconst = { 400 BCM47XX_GPIO_KEY(5, KEY_RESTART), 401 }; 402 403 /* Netgear */ 404 405 static const struct gpio_keys_button 406 bcm47xx_buttons_netgear_r6200_v1[] __initconst = { 407 BCM47XX_GPIO_KEY(2, KEY_RFKILL), 408 BCM47XX_GPIO_KEY(3, KEY_RESTART), 409 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 410 }; 411 412 static const struct gpio_keys_button 413 bcm47xx_buttons_netgear_r6300_v1[] __initconst = { 414 BCM47XX_GPIO_KEY(6, KEY_RESTART), 415 }; 416 417 static const struct gpio_keys_button 418 bcm47xx_buttons_netgear_wn2500rp_v1[] __initconst = { 419 BCM47XX_GPIO_KEY(12, KEY_RESTART), 420 BCM47XX_GPIO_KEY(31, KEY_WPS_BUTTON), 421 }; 422 423 static const struct gpio_keys_button 424 bcm47xx_buttons_netgear_wndr3400v1[] __initconst = { 425 BCM47XX_GPIO_KEY(4, KEY_RESTART), 426 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), 427 BCM47XX_GPIO_KEY(8, KEY_RFKILL), 428 }; 429 430 static const struct gpio_keys_button 431 bcm47xx_buttons_netgear_wndr3400_v3[] __initconst = { 432 BCM47XX_GPIO_KEY(12, KEY_RESTART), 433 BCM47XX_GPIO_KEY(23, KEY_WPS_BUTTON), 434 }; 435 436 static const struct gpio_keys_button 437 bcm47xx_buttons_netgear_wndr3700v3[] __initconst = { 438 BCM47XX_GPIO_KEY(2, KEY_RFKILL), 439 BCM47XX_GPIO_KEY(3, KEY_RESTART), 440 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 441 }; 442 443 static const struct gpio_keys_button 444 bcm47xx_buttons_netgear_wndr4500v1[] __initconst = { 445 BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), 446 BCM47XX_GPIO_KEY(5, KEY_RFKILL), 447 BCM47XX_GPIO_KEY(6, KEY_RESTART), 448 }; 449 450 static const struct gpio_keys_button 451 bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = { 452 BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON), 453 BCM47XX_GPIO_KEY(3, KEY_RESTART), 454 }; 455 456 static const struct gpio_keys_button 457 bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = { 458 BCM47XX_GPIO_KEY(4, KEY_RESTART), 459 BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), 460 }; 461 462 static const struct gpio_keys_button 463 bcm47xx_buttons_netgear_wnr834bv2[] __initconst = { 464 BCM47XX_GPIO_KEY(6, KEY_RESTART), 465 }; 466 467 /* SimpleTech */ 468 469 static const struct gpio_keys_button 470 bcm47xx_buttons_simpletech_simpleshare[] __initconst = { 471 BCM47XX_GPIO_KEY(0, KEY_RESTART), 472 }; 473 474 /************************************************** 475 * Init 476 **************************************************/ 477 478 static struct gpio_keys_platform_data bcm47xx_button_pdata; 479 480 static struct platform_device bcm47xx_buttons_gpio_keys = { 481 .name = "gpio-keys", 482 .dev = { 483 .platform_data = &bcm47xx_button_pdata, 484 } 485 }; 486 487 /* Copy data from __initconst */ 488 static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons, 489 size_t nbuttons) 490 { 491 size_t size = nbuttons * sizeof(*buttons); 492 493 bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL); 494 if (!bcm47xx_button_pdata.buttons) 495 return -ENOMEM; 496 bcm47xx_button_pdata.nbuttons = nbuttons; 497 498 return 0; 499 } 500 501 #define bcm47xx_copy_bdata(dev_buttons) \ 502 bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons)); 503 504 int __init bcm47xx_buttons_register(void) 505 { 506 enum bcm47xx_board board = bcm47xx_board_get(); 507 int err; 508 509 switch (board) { 510 case BCM47XX_BOARD_ASUS_RTN10U: 511 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn10u); 512 break; 513 case BCM47XX_BOARD_ASUS_RTN12: 514 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12); 515 break; 516 case BCM47XX_BOARD_ASUS_RTN16: 517 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16); 518 break; 519 case BCM47XX_BOARD_ASUS_RTN66U: 520 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u); 521 break; 522 case BCM47XX_BOARD_ASUS_WL300G: 523 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g); 524 break; 525 case BCM47XX_BOARD_ASUS_WL320GE: 526 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge); 527 break; 528 case BCM47XX_BOARD_ASUS_WL330GE: 529 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge); 530 break; 531 case BCM47XX_BOARD_ASUS_WL500G: 532 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g); 533 break; 534 case BCM47XX_BOARD_ASUS_WL500GD: 535 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd); 536 break; 537 case BCM47XX_BOARD_ASUS_WL500GPV1: 538 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1); 539 break; 540 case BCM47XX_BOARD_ASUS_WL500GPV2: 541 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2); 542 break; 543 case BCM47XX_BOARD_ASUS_WL500W: 544 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w); 545 break; 546 case BCM47XX_BOARD_ASUS_WL520GC: 547 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc); 548 break; 549 case BCM47XX_BOARD_ASUS_WL520GU: 550 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu); 551 break; 552 case BCM47XX_BOARD_ASUS_WL700GE: 553 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge); 554 break; 555 case BCM47XX_BOARD_ASUS_WLHDD: 556 err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd); 557 break; 558 559 case BCM47XX_BOARD_BELKIN_F7D3301: 560 case BCM47XX_BOARD_BELKIN_F7D3302: 561 case BCM47XX_BOARD_BELKIN_F7D4301: 562 case BCM47XX_BOARD_BELKIN_F7D4302: 563 case BCM47XX_BOARD_BELKIN_F7D4401: 564 err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301); 565 break; 566 567 case BCM47XX_BOARD_BUFFALO_WHR2_A54G54: 568 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54); 569 break; 570 case BCM47XX_BOARD_BUFFALO_WHR_G125: 571 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125); 572 break; 573 case BCM47XX_BOARD_BUFFALO_WHR_G54S: 574 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s); 575 break; 576 case BCM47XX_BOARD_BUFFALO_WHR_HP_G54: 577 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54); 578 break; 579 case BCM47XX_BOARD_BUFFALO_WZR_G300N: 580 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n); 581 break; 582 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54: 583 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54); 584 break; 585 case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP: 586 err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp); 587 break; 588 589 case BCM47XX_BOARD_DELL_TM2300: 590 err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300); 591 break; 592 593 case BCM47XX_BOARD_DLINK_DIR130: 594 err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130); 595 break; 596 case BCM47XX_BOARD_DLINK_DIR330: 597 err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330); 598 break; 599 600 case BCM47XX_BOARD_HUAWEI_E970: 601 err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970); 602 break; 603 604 case BCM47XX_BOARD_LINKSYS_E1000V1: 605 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1); 606 break; 607 case BCM47XX_BOARD_LINKSYS_E1000V21: 608 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21); 609 break; 610 case BCM47XX_BOARD_LINKSYS_E2000V1: 611 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1); 612 break; 613 case BCM47XX_BOARD_LINKSYS_E3000V1: 614 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1); 615 break; 616 case BCM47XX_BOARD_LINKSYS_E3200V1: 617 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1); 618 break; 619 case BCM47XX_BOARD_LINKSYS_E4200V1: 620 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1); 621 break; 622 case BCM47XX_BOARD_LINKSYS_WRT150NV1: 623 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1); 624 break; 625 case BCM47XX_BOARD_LINKSYS_WRT150NV11: 626 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11); 627 break; 628 case BCM47XX_BOARD_LINKSYS_WRT160NV1: 629 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1); 630 break; 631 case BCM47XX_BOARD_LINKSYS_WRT160NV3: 632 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3); 633 break; 634 case BCM47XX_BOARD_LINKSYS_WRT300N_V1: 635 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300n_v1); 636 break; 637 case BCM47XX_BOARD_LINKSYS_WRT300NV11: 638 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11); 639 break; 640 case BCM47XX_BOARD_LINKSYS_WRT310NV1: 641 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); 642 break; 643 case BCM47XX_BOARD_LINKSYS_WRT310NV2: 644 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310n_v2); 645 break; 646 case BCM47XX_BOARD_LINKSYS_WRT320N_V1: 647 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt320n_v1); 648 break; 649 case BCM47XX_BOARD_LINKSYS_WRT54G3GV2: 650 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2); 651 break; 652 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101: 653 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467: 654 case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708: 655 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g_generic); 656 break; 657 case BCM47XX_BOARD_LINKSYS_WRT610NV1: 658 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1); 659 break; 660 case BCM47XX_BOARD_LINKSYS_WRT610NV2: 661 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2); 662 break; 663 case BCM47XX_BOARD_LINKSYS_WRTSL54GS: 664 err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs); 665 break; 666 667 case BCM47XX_BOARD_LUXUL_ABR_4400_V1: 668 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1); 669 break; 670 case BCM47XX_BOARD_LUXUL_XAP_310_V1: 671 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1); 672 break; 673 case BCM47XX_BOARD_LUXUL_XAP_1210_V1: 674 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1); 675 break; 676 case BCM47XX_BOARD_LUXUL_XAP_1230_V1: 677 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1); 678 break; 679 case BCM47XX_BOARD_LUXUL_XAP_1240_V1: 680 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1); 681 break; 682 case BCM47XX_BOARD_LUXUL_XAP_1500_V1: 683 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1); 684 break; 685 case BCM47XX_BOARD_LUXUL_XBR_4400_V1: 686 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1); 687 break; 688 case BCM47XX_BOARD_LUXUL_XVW_P30_V1: 689 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1); 690 break; 691 case BCM47XX_BOARD_LUXUL_XWR_600_V1: 692 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1); 693 break; 694 case BCM47XX_BOARD_LUXUL_XWR_1750_V1: 695 err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1); 696 break; 697 698 case BCM47XX_BOARD_MICROSOFT_MN700: 699 err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700); 700 break; 701 702 case BCM47XX_BOARD_MOTOROLA_WE800G: 703 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g); 704 break; 705 case BCM47XX_BOARD_MOTOROLA_WR850GP: 706 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp); 707 break; 708 case BCM47XX_BOARD_MOTOROLA_WR850GV2V3: 709 err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3); 710 break; 711 712 case BCM47XX_BOARD_NETGEAR_R6200_V1: 713 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6200_v1); 714 break; 715 case BCM47XX_BOARD_NETGEAR_R6300_V1: 716 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6300_v1); 717 break; 718 case BCM47XX_BOARD_NETGEAR_WN2500RP_V1: 719 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wn2500rp_v1); 720 break; 721 case BCM47XX_BOARD_NETGEAR_WNDR3400V1: 722 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1); 723 break; 724 case BCM47XX_BOARD_NETGEAR_WNDR3400_V3: 725 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3); 726 break; 727 case BCM47XX_BOARD_NETGEAR_WNDR3700V3: 728 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3); 729 break; 730 case BCM47XX_BOARD_NETGEAR_WNDR4500V1: 731 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); 732 break; 733 case BCM47XX_BOARD_NETGEAR_WNR1000_V3: 734 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3); 735 break; 736 case BCM47XX_BOARD_NETGEAR_WNR3500L: 737 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1); 738 break; 739 case BCM47XX_BOARD_NETGEAR_WNR834BV2: 740 err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2); 741 break; 742 743 case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE: 744 err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare); 745 break; 746 747 default: 748 pr_debug("No buttons configuration found for this device\n"); 749 return -ENOTSUPP; 750 } 751 752 if (err) 753 return -ENOMEM; 754 755 err = platform_device_register(&bcm47xx_buttons_gpio_keys); 756 if (err) { 757 pr_err("Failed to register platform device: %d\n", err); 758 return err; 759 } 760 761 return 0; 762 } 763