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