xref: /openbmc/linux/arch/mips/bcm47xx/buttons.c (revision 278d3ba6)
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_wnr3500lv2[] __initconst = {
464 	BCM47XX_GPIO_KEY(4, KEY_RESTART),
465 	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
466 	BCM47XX_GPIO_KEY(8, KEY_RFKILL),
467 };
468 
469 static const struct gpio_keys_button
470 bcm47xx_buttons_netgear_wnr834bv2[] __initconst = {
471 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
472 };
473 
474 /* SimpleTech */
475 
476 static const struct gpio_keys_button
477 bcm47xx_buttons_simpletech_simpleshare[] __initconst = {
478 	BCM47XX_GPIO_KEY(0, KEY_RESTART),
479 };
480 
481 /**************************************************
482  * Init
483  **************************************************/
484 
485 static struct gpio_keys_platform_data bcm47xx_button_pdata;
486 
487 static struct platform_device bcm47xx_buttons_gpio_keys = {
488 	.name = "gpio-keys",
489 	.dev = {
490 		.platform_data = &bcm47xx_button_pdata,
491 	}
492 };
493 
494 /* Copy data from __initconst */
495 static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
496 				       size_t nbuttons)
497 {
498 	size_t size = nbuttons * sizeof(*buttons);
499 
500 	bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
501 	if (!bcm47xx_button_pdata.buttons)
502 		return -ENOMEM;
503 	bcm47xx_button_pdata.nbuttons = nbuttons;
504 
505 	return 0;
506 }
507 
508 #define bcm47xx_copy_bdata(dev_buttons)					\
509 	bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons));
510 
511 int __init bcm47xx_buttons_register(void)
512 {
513 	enum bcm47xx_board board = bcm47xx_board_get();
514 	int err;
515 
516 	switch (board) {
517 	case BCM47XX_BOARD_ASUS_RTN10U:
518 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn10u);
519 		break;
520 	case BCM47XX_BOARD_ASUS_RTN12:
521 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
522 		break;
523 	case BCM47XX_BOARD_ASUS_RTN16:
524 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16);
525 		break;
526 	case BCM47XX_BOARD_ASUS_RTN66U:
527 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u);
528 		break;
529 	case BCM47XX_BOARD_ASUS_WL300G:
530 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g);
531 		break;
532 	case BCM47XX_BOARD_ASUS_WL320GE:
533 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge);
534 		break;
535 	case BCM47XX_BOARD_ASUS_WL330GE:
536 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
537 		break;
538 	case BCM47XX_BOARD_ASUS_WL500G:
539 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
540 		break;
541 	case BCM47XX_BOARD_ASUS_WL500GD:
542 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
543 		break;
544 	case BCM47XX_BOARD_ASUS_WL500GPV1:
545 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1);
546 		break;
547 	case BCM47XX_BOARD_ASUS_WL500GPV2:
548 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2);
549 		break;
550 	case BCM47XX_BOARD_ASUS_WL500W:
551 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w);
552 		break;
553 	case BCM47XX_BOARD_ASUS_WL520GC:
554 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc);
555 		break;
556 	case BCM47XX_BOARD_ASUS_WL520GU:
557 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu);
558 		break;
559 	case BCM47XX_BOARD_ASUS_WL700GE:
560 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge);
561 		break;
562 	case BCM47XX_BOARD_ASUS_WLHDD:
563 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd);
564 		break;
565 
566 	case BCM47XX_BOARD_BELKIN_F7D3301:
567 	case BCM47XX_BOARD_BELKIN_F7D3302:
568 	case BCM47XX_BOARD_BELKIN_F7D4301:
569 	case BCM47XX_BOARD_BELKIN_F7D4302:
570 	case BCM47XX_BOARD_BELKIN_F7D4401:
571 		err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301);
572 		break;
573 
574 	case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
575 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54);
576 		break;
577 	case BCM47XX_BOARD_BUFFALO_WHR_G125:
578 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125);
579 		break;
580 	case BCM47XX_BOARD_BUFFALO_WHR_G54S:
581 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s);
582 		break;
583 	case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
584 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54);
585 		break;
586 	case BCM47XX_BOARD_BUFFALO_WZR_G300N:
587 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n);
588 		break;
589 	case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
590 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54);
591 		break;
592 	case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
593 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp);
594 		break;
595 
596 	case BCM47XX_BOARD_DELL_TM2300:
597 		err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300);
598 		break;
599 
600 	case BCM47XX_BOARD_DLINK_DIR130:
601 		err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130);
602 		break;
603 	case BCM47XX_BOARD_DLINK_DIR330:
604 		err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330);
605 		break;
606 
607 	case BCM47XX_BOARD_HUAWEI_E970:
608 		err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970);
609 		break;
610 
611 	case BCM47XX_BOARD_LINKSYS_E1000V1:
612 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1);
613 		break;
614 	case BCM47XX_BOARD_LINKSYS_E1000V21:
615 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21);
616 		break;
617 	case BCM47XX_BOARD_LINKSYS_E2000V1:
618 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1);
619 		break;
620 	case BCM47XX_BOARD_LINKSYS_E3000V1:
621 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1);
622 		break;
623 	case BCM47XX_BOARD_LINKSYS_E3200V1:
624 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1);
625 		break;
626 	case BCM47XX_BOARD_LINKSYS_E4200V1:
627 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1);
628 		break;
629 	case BCM47XX_BOARD_LINKSYS_WRT150NV1:
630 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1);
631 		break;
632 	case BCM47XX_BOARD_LINKSYS_WRT150NV11:
633 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11);
634 		break;
635 	case BCM47XX_BOARD_LINKSYS_WRT160NV1:
636 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1);
637 		break;
638 	case BCM47XX_BOARD_LINKSYS_WRT160NV3:
639 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3);
640 		break;
641 	case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
642 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300n_v1);
643 		break;
644 	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
645 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11);
646 		break;
647 	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
648 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
649 		break;
650 	case BCM47XX_BOARD_LINKSYS_WRT310NV2:
651 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310n_v2);
652 		break;
653 	case BCM47XX_BOARD_LINKSYS_WRT320N_V1:
654 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt320n_v1);
655 		break;
656 	case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
657 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
658 		break;
659 	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
660 	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
661 	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
662 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g_generic);
663 		break;
664 	case BCM47XX_BOARD_LINKSYS_WRT610NV1:
665 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1);
666 		break;
667 	case BCM47XX_BOARD_LINKSYS_WRT610NV2:
668 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2);
669 		break;
670 	case BCM47XX_BOARD_LINKSYS_WRTSL54GS:
671 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
672 		break;
673 
674 	case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
675 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
676 		break;
677 	case BCM47XX_BOARD_LUXUL_XAP_310_V1:
678 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1);
679 		break;
680 	case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
681 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
682 		break;
683 	case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
684 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
685 		break;
686 	case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
687 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
688 		break;
689 	case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
690 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
691 		break;
692 	case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
693 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
694 		break;
695 	case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
696 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
697 		break;
698 	case BCM47XX_BOARD_LUXUL_XWR_600_V1:
699 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
700 		break;
701 	case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
702 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
703 		break;
704 
705 	case BCM47XX_BOARD_MICROSOFT_MN700:
706 		err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
707 		break;
708 
709 	case BCM47XX_BOARD_MOTOROLA_WE800G:
710 		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
711 		break;
712 	case BCM47XX_BOARD_MOTOROLA_WR850GP:
713 		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp);
714 		break;
715 	case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
716 		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
717 		break;
718 
719 	case BCM47XX_BOARD_NETGEAR_R6200_V1:
720 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6200_v1);
721 		break;
722 	case BCM47XX_BOARD_NETGEAR_R6300_V1:
723 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6300_v1);
724 		break;
725 	case BCM47XX_BOARD_NETGEAR_WN2500RP_V1:
726 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wn2500rp_v1);
727 		break;
728 	case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
729 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
730 		break;
731 	case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
732 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
733 		break;
734 	case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
735 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
736 		break;
737 	case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
738 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
739 		break;
740 	case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
741 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
742 		break;
743 	case BCM47XX_BOARD_NETGEAR_WNR3500L:
744 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
745 		break;
746 	case BCM47XX_BOARD_NETGEAR_WNR3500L_V2:
747 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv2);
748 		break;
749 	case BCM47XX_BOARD_NETGEAR_WNR834BV2:
750 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2);
751 		break;
752 
753 	case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
754 		err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare);
755 		break;
756 
757 	default:
758 		pr_debug("No buttons configuration found for this device\n");
759 		return -ENOTSUPP;
760 	}
761 
762 	if (err)
763 		return -ENOMEM;
764 
765 	err = platform_device_register(&bcm47xx_buttons_gpio_keys);
766 	if (err) {
767 		pr_err("Failed to register platform device: %d\n", err);
768 		return err;
769 	}
770 
771 	return 0;
772 }
773