Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 1 | #include "bcm47xx_private.h" |
| 2 | |
| 3 | #include <linux/input.h> |
| 4 | #include <linux/gpio_keys.h> |
| 5 | #include <linux/interrupt.h> |
| 6 | #include <linux/ssb/ssb_embedded.h> |
| 7 | #include <bcm47xx_board.h> |
| 8 | #include <bcm47xx.h> |
| 9 | |
| 10 | /************************************************** |
| 11 | * Database |
| 12 | **************************************************/ |
| 13 | |
Rafał Miłecki | 3be9725 | 2014-01-02 13:37:56 +0100 | [diff] [blame] | 14 | #define BCM47XX_GPIO_KEY(_gpio, _code) \ |
| 15 | { \ |
| 16 | .code = _code, \ |
| 17 | .gpio = _gpio, \ |
| 18 | .active_low = 1, \ |
| 19 | } |
| 20 | |
| 21 | /* Asus */ |
| 22 | |
| 23 | static const struct gpio_keys_button |
| 24 | bcm47xx_buttons_asus_rtn12[] __initconst = { |
| 25 | BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), |
| 26 | BCM47XX_GPIO_KEY(1, KEY_RESTART), |
| 27 | BCM47XX_GPIO_KEY(4, BTN_0), /* Router mode */ |
| 28 | BCM47XX_GPIO_KEY(5, BTN_1), /* Repeater mode */ |
| 29 | BCM47XX_GPIO_KEY(6, BTN_2), /* AP mode */ |
| 30 | }; |
| 31 | |
| 32 | static const struct gpio_keys_button |
| 33 | bcm47xx_buttons_asus_rtn16[] __initconst = { |
| 34 | BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), |
| 35 | BCM47XX_GPIO_KEY(8, KEY_RESTART), |
| 36 | }; |
| 37 | |
| 38 | static const struct gpio_keys_button |
| 39 | bcm47xx_buttons_asus_rtn66u[] __initconst = { |
| 40 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 41 | BCM47XX_GPIO_KEY(9, KEY_RESTART), |
| 42 | }; |
| 43 | |
| 44 | static const struct gpio_keys_button |
| 45 | bcm47xx_buttons_asus_wl300g[] __initconst = { |
| 46 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 47 | }; |
| 48 | |
| 49 | static const struct gpio_keys_button |
| 50 | bcm47xx_buttons_asus_wl320ge[] __initconst = { |
| 51 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 52 | }; |
| 53 | |
| 54 | static const struct gpio_keys_button |
| 55 | bcm47xx_buttons_asus_wl330ge[] __initconst = { |
| 56 | BCM47XX_GPIO_KEY(2, KEY_RESTART), |
| 57 | }; |
| 58 | |
| 59 | static const struct gpio_keys_button |
| 60 | bcm47xx_buttons_asus_wl500gd[] __initconst = { |
| 61 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 62 | }; |
| 63 | |
| 64 | static const struct gpio_keys_button |
| 65 | bcm47xx_buttons_asus_wl500gpv1[] __initconst = { |
| 66 | BCM47XX_GPIO_KEY(0, KEY_RESTART), |
| 67 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 68 | }; |
| 69 | |
| 70 | static const struct gpio_keys_button |
| 71 | bcm47xx_buttons_asus_wl500gpv2[] __initconst = { |
| 72 | BCM47XX_GPIO_KEY(2, KEY_RESTART), |
| 73 | BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON), |
| 74 | }; |
| 75 | |
| 76 | static const struct gpio_keys_button |
| 77 | bcm47xx_buttons_asus_wl500w[] __initconst = { |
| 78 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 79 | BCM47XX_GPIO_KEY(7, KEY_WPS_BUTTON), |
| 80 | }; |
| 81 | |
| 82 | static const struct gpio_keys_button |
| 83 | bcm47xx_buttons_asus_wl520gc[] __initconst = { |
| 84 | BCM47XX_GPIO_KEY(2, KEY_RESTART), |
| 85 | BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON), |
| 86 | }; |
| 87 | |
| 88 | static const struct gpio_keys_button |
| 89 | bcm47xx_buttons_asus_wl520gu[] __initconst = { |
| 90 | BCM47XX_GPIO_KEY(2, KEY_RESTART), |
| 91 | BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON), |
| 92 | }; |
| 93 | |
| 94 | static const struct gpio_keys_button |
| 95 | bcm47xx_buttons_asus_wl700ge[] __initconst = { |
| 96 | BCM47XX_GPIO_KEY(0, KEY_POWER), /* Hard disk power switch */ |
| 97 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), /* EZSetup */ |
| 98 | BCM47XX_GPIO_KEY(6, KEY_COPY), /* Copy data from USB to internal disk */ |
| 99 | BCM47XX_GPIO_KEY(7, KEY_RESTART), /* Hard reset */ |
| 100 | }; |
| 101 | |
| 102 | static const struct gpio_keys_button |
| 103 | bcm47xx_buttons_asus_wlhdd[] __initconst = { |
| 104 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 105 | }; |
| 106 | |
| 107 | /* Huawei */ |
| 108 | |
| 109 | static const struct gpio_keys_button |
| 110 | bcm47xx_buttons_huawei_e970[] __initconst = { |
| 111 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 112 | }; |
| 113 | |
| 114 | /* Belkin */ |
| 115 | |
| 116 | static const struct gpio_keys_button |
| 117 | bcm47xx_buttons_belkin_f7d4301[] __initconst = { |
| 118 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 119 | BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON), |
| 120 | }; |
| 121 | |
| 122 | /* Buffalo */ |
| 123 | |
| 124 | static const struct gpio_keys_button |
| 125 | bcm47xx_buttons_buffalo_whr2_a54g54[] __initconst = { |
| 126 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 127 | }; |
| 128 | |
| 129 | static const struct gpio_keys_button |
| 130 | bcm47xx_buttons_buffalo_whr_g125[] __initconst = { |
| 131 | BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), |
| 132 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 133 | BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */ |
| 134 | }; |
| 135 | |
| 136 | static const struct gpio_keys_button |
| 137 | bcm47xx_buttons_buffalo_whr_g54s[] __initconst = { |
| 138 | BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), |
| 139 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 140 | BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */ |
| 141 | }; |
| 142 | |
| 143 | static const struct gpio_keys_button |
| 144 | bcm47xx_buttons_buffalo_whr_hp_g54[] __initconst = { |
| 145 | BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), |
| 146 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 147 | BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */ |
| 148 | }; |
| 149 | |
| 150 | static const struct gpio_keys_button |
| 151 | bcm47xx_buttons_buffalo_wzr_g300n[] __initconst = { |
| 152 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 153 | }; |
| 154 | |
| 155 | static const struct gpio_keys_button |
| 156 | bcm47xx_buttons_buffalo_wzr_rs_g54[] __initconst = { |
| 157 | BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), |
| 158 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 159 | }; |
| 160 | |
| 161 | static const struct gpio_keys_button |
| 162 | bcm47xx_buttons_buffalo_wzr_rs_g54hp[] __initconst = { |
| 163 | BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON), |
| 164 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 165 | }; |
| 166 | |
| 167 | /* Dell */ |
| 168 | |
| 169 | static const struct gpio_keys_button |
| 170 | bcm47xx_buttons_dell_tm2300[] __initconst = { |
| 171 | BCM47XX_GPIO_KEY(0, KEY_RESTART), |
| 172 | }; |
| 173 | |
| 174 | /* D-Link */ |
| 175 | |
| 176 | static const struct gpio_keys_button |
| 177 | bcm47xx_buttons_dlink_dir130[] __initconst = { |
| 178 | BCM47XX_GPIO_KEY(3, KEY_RESTART), |
| 179 | BCM47XX_GPIO_KEY(7, KEY_UNKNOWN), |
| 180 | }; |
| 181 | |
| 182 | static const struct gpio_keys_button |
| 183 | bcm47xx_buttons_dlink_dir330[] __initconst = { |
| 184 | BCM47XX_GPIO_KEY(3, KEY_RESTART), |
| 185 | BCM47XX_GPIO_KEY(7, KEY_UNKNOWN), |
| 186 | }; |
| 187 | |
| 188 | /* Linksys */ |
| 189 | |
| 190 | static const struct gpio_keys_button |
| 191 | bcm47xx_buttons_linksys_e1000v1[] __initconst = { |
| 192 | BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), |
| 193 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 194 | }; |
| 195 | |
| 196 | static const struct gpio_keys_button |
| 197 | bcm47xx_buttons_linksys_e1000v21[] __initconst = { |
| 198 | BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON), |
| 199 | BCM47XX_GPIO_KEY(10, KEY_RESTART), |
| 200 | }; |
| 201 | |
| 202 | static const struct gpio_keys_button |
| 203 | bcm47xx_buttons_linksys_e2000v1[] __initconst = { |
| 204 | BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), |
| 205 | BCM47XX_GPIO_KEY(8, KEY_RESTART), |
| 206 | }; |
| 207 | |
| 208 | static const struct gpio_keys_button |
| 209 | bcm47xx_buttons_linksys_e3000v1[] __initconst = { |
| 210 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 211 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 212 | }; |
| 213 | |
| 214 | static const struct gpio_keys_button |
| 215 | bcm47xx_buttons_linksys_e3200v1[] __initconst = { |
| 216 | BCM47XX_GPIO_KEY(5, KEY_RESTART), |
| 217 | BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON), |
| 218 | }; |
| 219 | |
| 220 | static const struct gpio_keys_button |
| 221 | bcm47xx_buttons_linksys_e4200v1[] __initconst = { |
| 222 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 223 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 224 | }; |
| 225 | |
| 226 | static const struct gpio_keys_button |
| 227 | bcm47xx_buttons_linksys_wrt150nv1[] __initconst = { |
| 228 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 229 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 230 | }; |
| 231 | |
| 232 | static const struct gpio_keys_button |
| 233 | bcm47xx_buttons_linksys_wrt150nv11[] __initconst = { |
| 234 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 235 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 236 | }; |
| 237 | |
| 238 | static const struct gpio_keys_button |
| 239 | bcm47xx_buttons_linksys_wrt160nv1[] __initconst = { |
| 240 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 241 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 242 | }; |
| 243 | |
| 244 | static const struct gpio_keys_button |
| 245 | bcm47xx_buttons_linksys_wrt160nv3[] __initconst = { |
| 246 | BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON), |
| 247 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 248 | }; |
| 249 | |
| 250 | static const struct gpio_keys_button |
| 251 | bcm47xx_buttons_linksys_wrt300nv11[] __initconst = { |
| 252 | BCM47XX_GPIO_KEY(4, KEY_UNKNOWN), |
| 253 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 254 | }; |
| 255 | |
| 256 | static const struct gpio_keys_button |
| 257 | bcm47xx_buttons_linksys_wrt310nv1[] __initconst = { |
| 258 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 259 | BCM47XX_GPIO_KEY(8, KEY_UNKNOWN), |
| 260 | }; |
| 261 | |
| 262 | static const struct gpio_keys_button |
| 263 | bcm47xx_buttons_linksys_wrt610nv1[] __initconst = { |
| 264 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 265 | BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON), |
| 266 | }; |
| 267 | |
| 268 | static const struct gpio_keys_button |
| 269 | bcm47xx_buttons_linksys_wrt610nv2[] __initconst = { |
| 270 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 271 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 272 | }; |
| 273 | |
| 274 | /* Motorola */ |
| 275 | |
| 276 | static const struct gpio_keys_button |
| 277 | bcm47xx_buttons_motorola_we800g[] __initconst = { |
| 278 | BCM47XX_GPIO_KEY(0, KEY_RESTART), |
| 279 | }; |
| 280 | |
| 281 | static const struct gpio_keys_button |
| 282 | bcm47xx_buttons_motorola_wr850gp[] __initconst = { |
| 283 | BCM47XX_GPIO_KEY(5, KEY_RESTART), |
| 284 | }; |
| 285 | |
| 286 | static const struct gpio_keys_button |
| 287 | bcm47xx_buttons_motorola_wr850gv2v3[] __initconst = { |
| 288 | BCM47XX_GPIO_KEY(5, KEY_RESTART), |
| 289 | }; |
| 290 | |
| 291 | /* Netgear */ |
| 292 | |
| 293 | static const struct gpio_keys_button |
| 294 | bcm47xx_buttons_netgear_wndr3400v1[] __initconst = { |
| 295 | BCM47XX_GPIO_KEY(4, KEY_RESTART), |
| 296 | BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON), |
| 297 | BCM47XX_GPIO_KEY(8, KEY_RFKILL), |
| 298 | }; |
| 299 | |
| 300 | static const struct gpio_keys_button |
| 301 | bcm47xx_buttons_netgear_wndr3700v3[] __initconst = { |
| 302 | BCM47XX_GPIO_KEY(2, KEY_RFKILL), |
| 303 | BCM47XX_GPIO_KEY(3, KEY_RESTART), |
| 304 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 305 | }; |
| 306 | |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 307 | static const struct gpio_keys_button |
Rafał Miłecki | e7277e1 | 2014-01-03 09:37:42 +0100 | [diff] [blame^] | 308 | bcm47xx_buttons_netgear_wndr4500v1[] __initconst = { |
| 309 | BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), |
| 310 | BCM47XX_GPIO_KEY(5, KEY_RFKILL), |
| 311 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 312 | }; |
| 313 | |
Rafał Miłecki | 3be9725 | 2014-01-02 13:37:56 +0100 | [diff] [blame] | 314 | static const struct gpio_keys_button |
| 315 | bcm47xx_buttons_netgear_wnr834bv2[] __initconst = { |
| 316 | BCM47XX_GPIO_KEY(6, KEY_RESTART), |
| 317 | }; |
| 318 | |
| 319 | /* SimpleTech */ |
| 320 | |
| 321 | static const struct gpio_keys_button |
| 322 | bcm47xx_buttons_simpletech_simpleshare[] __initconst = { |
| 323 | BCM47XX_GPIO_KEY(0, KEY_RESTART), |
| 324 | }; |
| 325 | |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 326 | /************************************************** |
| 327 | * Init |
| 328 | **************************************************/ |
| 329 | |
| 330 | static struct gpio_keys_platform_data bcm47xx_button_pdata; |
| 331 | |
| 332 | static struct platform_device bcm47xx_buttons_gpio_keys = { |
| 333 | .name = "gpio-keys", |
| 334 | .dev = { |
| 335 | .platform_data = &bcm47xx_button_pdata, |
| 336 | } |
| 337 | }; |
| 338 | |
| 339 | /* Copy data from __initconst */ |
| 340 | static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons, |
| 341 | size_t nbuttons) |
| 342 | { |
| 343 | size_t size = nbuttons * sizeof(*buttons); |
| 344 | |
| 345 | bcm47xx_button_pdata.buttons = kmalloc(size, GFP_KERNEL); |
| 346 | if (!bcm47xx_button_pdata.buttons) |
| 347 | return -ENOMEM; |
| 348 | memcpy(bcm47xx_button_pdata.buttons, buttons, size); |
| 349 | bcm47xx_button_pdata.nbuttons = nbuttons; |
| 350 | |
| 351 | return 0; |
| 352 | } |
| 353 | |
| 354 | #define bcm47xx_copy_bdata(dev_buttons) \ |
| 355 | bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons)); |
| 356 | |
| 357 | int __init bcm47xx_buttons_register(void) |
| 358 | { |
| 359 | enum bcm47xx_board board = bcm47xx_board_get(); |
| 360 | int err; |
| 361 | |
| 362 | #ifdef CONFIG_BCM47XX_SSB |
| 363 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_SSB) { |
| 364 | pr_debug("Buttons on SSB are not supported yet.\n"); |
| 365 | return -ENOTSUPP; |
| 366 | } |
| 367 | #endif |
| 368 | |
| 369 | switch (board) { |
Rafał Miłecki | 3be9725 | 2014-01-02 13:37:56 +0100 | [diff] [blame] | 370 | case BCM47XX_BOARD_ASUS_RTN12: |
| 371 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12); |
| 372 | break; |
| 373 | case BCM47XX_BOARD_ASUS_RTN16: |
| 374 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16); |
| 375 | break; |
| 376 | case BCM47XX_BOARD_ASUS_RTN66U: |
| 377 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u); |
| 378 | break; |
| 379 | case BCM47XX_BOARD_ASUS_WL300G: |
| 380 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g); |
| 381 | break; |
| 382 | case BCM47XX_BOARD_ASUS_WL320GE: |
| 383 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge); |
| 384 | break; |
| 385 | case BCM47XX_BOARD_ASUS_WL330GE: |
| 386 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge); |
| 387 | break; |
| 388 | case BCM47XX_BOARD_ASUS_WL500GD: |
| 389 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd); |
| 390 | break; |
| 391 | case BCM47XX_BOARD_ASUS_WL500GPV1: |
| 392 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1); |
| 393 | break; |
| 394 | case BCM47XX_BOARD_ASUS_WL500GPV2: |
| 395 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2); |
| 396 | break; |
| 397 | case BCM47XX_BOARD_ASUS_WL500W: |
| 398 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w); |
| 399 | break; |
| 400 | case BCM47XX_BOARD_ASUS_WL520GC: |
| 401 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc); |
| 402 | break; |
| 403 | case BCM47XX_BOARD_ASUS_WL520GU: |
| 404 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu); |
| 405 | break; |
| 406 | case BCM47XX_BOARD_ASUS_WL700GE: |
| 407 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge); |
| 408 | break; |
| 409 | case BCM47XX_BOARD_ASUS_WLHDD: |
| 410 | err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd); |
| 411 | break; |
| 412 | |
| 413 | case BCM47XX_BOARD_BELKIN_F7D4301: |
| 414 | err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301); |
| 415 | break; |
| 416 | |
| 417 | case BCM47XX_BOARD_BUFFALO_WHR2_A54G54: |
| 418 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54); |
| 419 | break; |
| 420 | case BCM47XX_BOARD_BUFFALO_WHR_G125: |
| 421 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125); |
| 422 | break; |
| 423 | case BCM47XX_BOARD_BUFFALO_WHR_G54S: |
| 424 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s); |
| 425 | break; |
| 426 | case BCM47XX_BOARD_BUFFALO_WHR_HP_G54: |
| 427 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54); |
| 428 | break; |
| 429 | case BCM47XX_BOARD_BUFFALO_WZR_G300N: |
| 430 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n); |
| 431 | break; |
| 432 | case BCM47XX_BOARD_BUFFALO_WZR_RS_G54: |
| 433 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54); |
| 434 | break; |
| 435 | case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP: |
| 436 | err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp); |
| 437 | break; |
| 438 | |
| 439 | case BCM47XX_BOARD_DELL_TM2300: |
| 440 | err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300); |
| 441 | break; |
| 442 | |
| 443 | case BCM47XX_BOARD_DLINK_DIR130: |
| 444 | err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130); |
| 445 | break; |
| 446 | case BCM47XX_BOARD_DLINK_DIR330: |
| 447 | err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330); |
| 448 | break; |
| 449 | |
| 450 | case BCM47XX_BOARD_HUAWEI_E970: |
| 451 | err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970); |
| 452 | break; |
| 453 | |
| 454 | case BCM47XX_BOARD_LINKSYS_E1000V1: |
| 455 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1); |
| 456 | break; |
| 457 | case BCM47XX_BOARD_LINKSYS_E1000V21: |
| 458 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21); |
| 459 | break; |
| 460 | case BCM47XX_BOARD_LINKSYS_E2000V1: |
| 461 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1); |
| 462 | break; |
| 463 | case BCM47XX_BOARD_LINKSYS_E3000V1: |
| 464 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1); |
| 465 | break; |
| 466 | case BCM47XX_BOARD_LINKSYS_E3200V1: |
| 467 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1); |
| 468 | break; |
| 469 | case BCM47XX_BOARD_LINKSYS_E4200V1: |
| 470 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1); |
| 471 | break; |
| 472 | case BCM47XX_BOARD_LINKSYS_WRT150NV1: |
| 473 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1); |
| 474 | break; |
| 475 | case BCM47XX_BOARD_LINKSYS_WRT150NV11: |
| 476 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11); |
| 477 | break; |
| 478 | case BCM47XX_BOARD_LINKSYS_WRT160NV1: |
| 479 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1); |
| 480 | break; |
| 481 | case BCM47XX_BOARD_LINKSYS_WRT160NV3: |
| 482 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3); |
| 483 | break; |
| 484 | case BCM47XX_BOARD_LINKSYS_WRT300NV11: |
| 485 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11); |
| 486 | break; |
| 487 | case BCM47XX_BOARD_LINKSYS_WRT310NV1: |
| 488 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1); |
| 489 | break; |
| 490 | case BCM47XX_BOARD_LINKSYS_WRT610NV1: |
| 491 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1); |
| 492 | break; |
| 493 | case BCM47XX_BOARD_LINKSYS_WRT610NV2: |
| 494 | err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2); |
| 495 | break; |
| 496 | |
| 497 | case BCM47XX_BOARD_MOTOROLA_WE800G: |
| 498 | err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g); |
| 499 | break; |
| 500 | case BCM47XX_BOARD_MOTOROLA_WR850GP: |
| 501 | err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp); |
| 502 | break; |
| 503 | case BCM47XX_BOARD_MOTOROLA_WR850GV2V3: |
| 504 | err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3); |
| 505 | break; |
| 506 | |
| 507 | case BCM47XX_BOARD_NETGEAR_WNDR3400V1: |
| 508 | err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1); |
| 509 | break; |
| 510 | case BCM47XX_BOARD_NETGEAR_WNDR3700V3: |
| 511 | err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3); |
| 512 | break; |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 513 | case BCM47XX_BOARD_NETGEAR_WNDR4500V1: |
Rafał Miłecki | e7277e1 | 2014-01-03 09:37:42 +0100 | [diff] [blame^] | 514 | err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1); |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 515 | break; |
Rafał Miłecki | 3be9725 | 2014-01-02 13:37:56 +0100 | [diff] [blame] | 516 | case BCM47XX_BOARD_NETGEAR_WNR834BV2: |
| 517 | err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2); |
| 518 | break; |
| 519 | |
| 520 | case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE: |
| 521 | err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare); |
| 522 | break; |
| 523 | |
Rafał Miłecki | ef1e3e7 | 2014-01-14 12:36:29 +0100 | [diff] [blame] | 524 | default: |
| 525 | pr_debug("No buttons configuration found for this device\n"); |
| 526 | return -ENOTSUPP; |
| 527 | } |
| 528 | |
| 529 | if (err) |
| 530 | return -ENOMEM; |
| 531 | |
| 532 | err = platform_device_register(&bcm47xx_buttons_gpio_keys); |
| 533 | if (err) { |
| 534 | pr_err("Failed to register platform device: %d\n", err); |
| 535 | return err; |
| 536 | } |
| 537 | |
| 538 | return 0; |
| 539 | } |