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