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