xref: /openbmc/linux/arch/mips/bcm47xx/buttons.c (revision 61f4d204)
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_e2500v3[] __initconst = {
227 	BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON),
228 	BCM47XX_GPIO_KEY(10, KEY_RESTART),
229 };
230 
231 static const struct gpio_keys_button
232 bcm47xx_buttons_linksys_e3000v1[] __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_e3200v1[] __initconst = {
239 	BCM47XX_GPIO_KEY(5, KEY_RESTART),
240 	BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
241 };
242 
243 static const struct gpio_keys_button
244 bcm47xx_buttons_linksys_e4200v1[] __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_wrt150nv1[] __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_wrt150nv11[] __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_wrt160nv1[] __initconst = {
263 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
264 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
265 };
266 
267 static const struct gpio_keys_button
268 bcm47xx_buttons_linksys_wrt160nv3[] __initconst = {
269 	BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
270 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
271 };
272 
273 static const struct gpio_keys_button
274 bcm47xx_buttons_linksys_wrt300n_v1[] __initconst = {
275 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
276 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
277 };
278 
279 static const struct gpio_keys_button
280 bcm47xx_buttons_linksys_wrt300nv11[] __initconst = {
281 	BCM47XX_GPIO_KEY(4, KEY_UNKNOWN),
282 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
283 };
284 
285 static const struct gpio_keys_button
286 bcm47xx_buttons_linksys_wrt310nv1[] __initconst = {
287 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
288 	BCM47XX_GPIO_KEY(8, KEY_UNKNOWN),
289 };
290 
291 static const struct gpio_keys_button
292 bcm47xx_buttons_linksys_wrt310n_v2[] __initconst = {
293 	BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
294 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
295 };
296 
297 static const struct gpio_keys_button
298 bcm47xx_buttons_linksys_wrt320n_v1[] __initconst = {
299 	BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
300 	BCM47XX_GPIO_KEY(8, KEY_RESTART),
301 };
302 
303 static const struct gpio_keys_button
304 bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = {
305 	BCM47XX_GPIO_KEY(5, KEY_WIMAX),
306 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
307 };
308 
309 static const struct gpio_keys_button
310 bcm47xx_buttons_linksys_wrt54g_generic[] __initconst = {
311 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
312 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
313 };
314 
315 static const struct gpio_keys_button
316 bcm47xx_buttons_linksys_wrt610nv1[] __initconst = {
317 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
318 	BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
319 };
320 
321 static const struct gpio_keys_button
322 bcm47xx_buttons_linksys_wrt610nv2[] __initconst = {
323 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
324 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
325 };
326 
327 static const struct gpio_keys_button
328 bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
329 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
330 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
331 };
332 
333 /* Luxul */
334 
335 static const struct gpio_keys_button
336 bcm47xx_buttons_luxul_abr_4400_v1[] = {
337 	BCM47XX_GPIO_KEY(14, KEY_RESTART),
338 };
339 
340 static const struct gpio_keys_button
341 bcm47xx_buttons_luxul_xap_310_v1[] = {
342 	BCM47XX_GPIO_KEY(20, KEY_RESTART),
343 };
344 
345 static const struct gpio_keys_button
346 bcm47xx_buttons_luxul_xap_1210_v1[] = {
347 	BCM47XX_GPIO_KEY(8, KEY_RESTART),
348 };
349 
350 static const struct gpio_keys_button
351 bcm47xx_buttons_luxul_xap_1230_v1[] = {
352 	BCM47XX_GPIO_KEY(8, KEY_RESTART),
353 };
354 
355 static const struct gpio_keys_button
356 bcm47xx_buttons_luxul_xap_1240_v1[] = {
357 	BCM47XX_GPIO_KEY(8, KEY_RESTART),
358 };
359 
360 static const struct gpio_keys_button
361 bcm47xx_buttons_luxul_xap_1500_v1[] = {
362 	BCM47XX_GPIO_KEY(14, KEY_RESTART),
363 };
364 
365 static const struct gpio_keys_button
366 bcm47xx_buttons_luxul_xbr_4400_v1[] = {
367 	BCM47XX_GPIO_KEY(14, KEY_RESTART),
368 };
369 
370 static const struct gpio_keys_button
371 bcm47xx_buttons_luxul_xvw_p30_v1[] = {
372 	BCM47XX_GPIO_KEY(20, KEY_RESTART),
373 };
374 
375 static const struct gpio_keys_button
376 bcm47xx_buttons_luxul_xwr_600_v1[] = {
377 	BCM47XX_GPIO_KEY(8, KEY_RESTART),
378 };
379 
380 static const struct gpio_keys_button
381 bcm47xx_buttons_luxul_xwr_1750_v1[] = {
382 	BCM47XX_GPIO_KEY(14, KEY_RESTART),
383 };
384 
385 /* Microsoft */
386 
387 static const struct gpio_keys_button
388 bcm47xx_buttons_microsoft_nm700[] __initconst = {
389 	BCM47XX_GPIO_KEY(7, KEY_RESTART),
390 };
391 
392 /* Motorola */
393 
394 static const struct gpio_keys_button
395 bcm47xx_buttons_motorola_we800g[] __initconst = {
396 	BCM47XX_GPIO_KEY(0, KEY_RESTART),
397 };
398 
399 static const struct gpio_keys_button
400 bcm47xx_buttons_motorola_wr850gp[] __initconst = {
401 	BCM47XX_GPIO_KEY(5, KEY_RESTART),
402 };
403 
404 static const struct gpio_keys_button
405 bcm47xx_buttons_motorola_wr850gv2v3[] __initconst = {
406 	BCM47XX_GPIO_KEY(5, KEY_RESTART),
407 };
408 
409 /* Netgear */
410 
411 static const struct gpio_keys_button
412 bcm47xx_buttons_netgear_r6200_v1[] __initconst = {
413 	BCM47XX_GPIO_KEY(2, KEY_RFKILL),
414 	BCM47XX_GPIO_KEY(3, KEY_RESTART),
415 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
416 };
417 
418 static const struct gpio_keys_button
419 bcm47xx_buttons_netgear_r6300_v1[] __initconst = {
420 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
421 };
422 
423 static const struct gpio_keys_button
424 bcm47xx_buttons_netgear_wn2500rp_v1[] __initconst = {
425 	BCM47XX_GPIO_KEY(12, KEY_RESTART),
426 	BCM47XX_GPIO_KEY(31, KEY_WPS_BUTTON),
427 };
428 
429 static const struct gpio_keys_button
430 bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
431 	BCM47XX_GPIO_KEY(4, KEY_RESTART),
432 	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
433 	BCM47XX_GPIO_KEY(8, KEY_RFKILL),
434 };
435 
436 static const struct gpio_keys_button
437 bcm47xx_buttons_netgear_wndr3400_v3[] __initconst = {
438 	BCM47XX_GPIO_KEY(12, KEY_RESTART),
439 	BCM47XX_GPIO_KEY(23, KEY_WPS_BUTTON),
440 };
441 
442 static const struct gpio_keys_button
443 bcm47xx_buttons_netgear_wndr3700v3[] __initconst = {
444 	BCM47XX_GPIO_KEY(2, KEY_RFKILL),
445 	BCM47XX_GPIO_KEY(3, KEY_RESTART),
446 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
447 };
448 
449 static const struct gpio_keys_button
450 bcm47xx_buttons_netgear_wndr4500v1[] __initconst = {
451 	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
452 	BCM47XX_GPIO_KEY(5, KEY_RFKILL),
453 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
454 };
455 
456 static const struct gpio_keys_button
457 bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
458 	BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON),
459 	BCM47XX_GPIO_KEY(3, KEY_RESTART),
460 };
461 
462 static const struct gpio_keys_button
463 bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
464 	BCM47XX_GPIO_KEY(4, KEY_RESTART),
465 	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
466 };
467 
468 static const struct gpio_keys_button
469 bcm47xx_buttons_netgear_wnr3500lv2[] __initconst = {
470 	BCM47XX_GPIO_KEY(4, KEY_RESTART),
471 	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
472 	BCM47XX_GPIO_KEY(8, KEY_RFKILL),
473 };
474 
475 static const struct gpio_keys_button
476 bcm47xx_buttons_netgear_wnr834bv2[] __initconst = {
477 	BCM47XX_GPIO_KEY(6, KEY_RESTART),
478 };
479 
480 /* SimpleTech */
481 
482 static const struct gpio_keys_button
483 bcm47xx_buttons_simpletech_simpleshare[] __initconst = {
484 	BCM47XX_GPIO_KEY(0, KEY_RESTART),
485 };
486 
487 /**************************************************
488  * Init
489  **************************************************/
490 
491 static struct gpio_keys_platform_data bcm47xx_button_pdata;
492 
493 static struct platform_device bcm47xx_buttons_gpio_keys = {
494 	.name = "gpio-keys",
495 	.dev = {
496 		.platform_data = &bcm47xx_button_pdata,
497 	}
498 };
499 
500 /* Copy data from __initconst */
501 static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
502 				       size_t nbuttons)
503 {
504 	size_t size = nbuttons * sizeof(*buttons);
505 
506 	bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
507 	if (!bcm47xx_button_pdata.buttons)
508 		return -ENOMEM;
509 	bcm47xx_button_pdata.nbuttons = nbuttons;
510 
511 	return 0;
512 }
513 
514 #define bcm47xx_copy_bdata(dev_buttons)					\
515 	bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons));
516 
517 int __init bcm47xx_buttons_register(void)
518 {
519 	enum bcm47xx_board board = bcm47xx_board_get();
520 	int err;
521 
522 	switch (board) {
523 	case BCM47XX_BOARD_ASUS_RTN10U:
524 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn10u);
525 		break;
526 	case BCM47XX_BOARD_ASUS_RTN12:
527 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
528 		break;
529 	case BCM47XX_BOARD_ASUS_RTN16:
530 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16);
531 		break;
532 	case BCM47XX_BOARD_ASUS_RTN66U:
533 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u);
534 		break;
535 	case BCM47XX_BOARD_ASUS_WL300G:
536 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g);
537 		break;
538 	case BCM47XX_BOARD_ASUS_WL320GE:
539 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge);
540 		break;
541 	case BCM47XX_BOARD_ASUS_WL330GE:
542 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
543 		break;
544 	case BCM47XX_BOARD_ASUS_WL500G:
545 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
546 		break;
547 	case BCM47XX_BOARD_ASUS_WL500GD:
548 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
549 		break;
550 	case BCM47XX_BOARD_ASUS_WL500GPV1:
551 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1);
552 		break;
553 	case BCM47XX_BOARD_ASUS_WL500GPV2:
554 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2);
555 		break;
556 	case BCM47XX_BOARD_ASUS_WL500W:
557 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w);
558 		break;
559 	case BCM47XX_BOARD_ASUS_WL520GC:
560 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc);
561 		break;
562 	case BCM47XX_BOARD_ASUS_WL520GU:
563 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu);
564 		break;
565 	case BCM47XX_BOARD_ASUS_WL700GE:
566 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge);
567 		break;
568 	case BCM47XX_BOARD_ASUS_WLHDD:
569 		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd);
570 		break;
571 
572 	case BCM47XX_BOARD_BELKIN_F7D3301:
573 	case BCM47XX_BOARD_BELKIN_F7D3302:
574 	case BCM47XX_BOARD_BELKIN_F7D4301:
575 	case BCM47XX_BOARD_BELKIN_F7D4302:
576 	case BCM47XX_BOARD_BELKIN_F7D4401:
577 		err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301);
578 		break;
579 
580 	case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
581 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54);
582 		break;
583 	case BCM47XX_BOARD_BUFFALO_WHR_G125:
584 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125);
585 		break;
586 	case BCM47XX_BOARD_BUFFALO_WHR_G54S:
587 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s);
588 		break;
589 	case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
590 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54);
591 		break;
592 	case BCM47XX_BOARD_BUFFALO_WZR_G300N:
593 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n);
594 		break;
595 	case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
596 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54);
597 		break;
598 	case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
599 		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp);
600 		break;
601 
602 	case BCM47XX_BOARD_DELL_TM2300:
603 		err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300);
604 		break;
605 
606 	case BCM47XX_BOARD_DLINK_DIR130:
607 		err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130);
608 		break;
609 	case BCM47XX_BOARD_DLINK_DIR330:
610 		err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330);
611 		break;
612 
613 	case BCM47XX_BOARD_HUAWEI_E970:
614 		err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970);
615 		break;
616 
617 	case BCM47XX_BOARD_LINKSYS_E1000V1:
618 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1);
619 		break;
620 	case BCM47XX_BOARD_LINKSYS_E1000V21:
621 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21);
622 		break;
623 	case BCM47XX_BOARD_LINKSYS_E2000V1:
624 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1);
625 		break;
626 	case BCM47XX_BOARD_LINKSYS_E2500V3:
627 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2500v3);
628 		break;
629 	case BCM47XX_BOARD_LINKSYS_E3000V1:
630 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1);
631 		break;
632 	case BCM47XX_BOARD_LINKSYS_E3200V1:
633 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1);
634 		break;
635 	case BCM47XX_BOARD_LINKSYS_E4200V1:
636 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1);
637 		break;
638 	case BCM47XX_BOARD_LINKSYS_WRT150NV1:
639 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1);
640 		break;
641 	case BCM47XX_BOARD_LINKSYS_WRT150NV11:
642 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11);
643 		break;
644 	case BCM47XX_BOARD_LINKSYS_WRT160NV1:
645 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1);
646 		break;
647 	case BCM47XX_BOARD_LINKSYS_WRT160NV3:
648 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3);
649 		break;
650 	case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
651 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300n_v1);
652 		break;
653 	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
654 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11);
655 		break;
656 	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
657 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
658 		break;
659 	case BCM47XX_BOARD_LINKSYS_WRT310NV2:
660 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310n_v2);
661 		break;
662 	case BCM47XX_BOARD_LINKSYS_WRT320N_V1:
663 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt320n_v1);
664 		break;
665 	case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
666 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
667 		break;
668 	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
669 	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
670 	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
671 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g_generic);
672 		break;
673 	case BCM47XX_BOARD_LINKSYS_WRT610NV1:
674 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1);
675 		break;
676 	case BCM47XX_BOARD_LINKSYS_WRT610NV2:
677 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2);
678 		break;
679 	case BCM47XX_BOARD_LINKSYS_WRTSL54GS:
680 		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
681 		break;
682 
683 	case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
684 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
685 		break;
686 	case BCM47XX_BOARD_LUXUL_XAP_310_V1:
687 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1);
688 		break;
689 	case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
690 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
691 		break;
692 	case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
693 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
694 		break;
695 	case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
696 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
697 		break;
698 	case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
699 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
700 		break;
701 	case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
702 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
703 		break;
704 	case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
705 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
706 		break;
707 	case BCM47XX_BOARD_LUXUL_XWR_600_V1:
708 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
709 		break;
710 	case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
711 		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
712 		break;
713 
714 	case BCM47XX_BOARD_MICROSOFT_MN700:
715 		err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
716 		break;
717 
718 	case BCM47XX_BOARD_MOTOROLA_WE800G:
719 		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
720 		break;
721 	case BCM47XX_BOARD_MOTOROLA_WR850GP:
722 		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp);
723 		break;
724 	case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
725 		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
726 		break;
727 
728 	case BCM47XX_BOARD_NETGEAR_R6200_V1:
729 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6200_v1);
730 		break;
731 	case BCM47XX_BOARD_NETGEAR_R6300_V1:
732 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6300_v1);
733 		break;
734 	case BCM47XX_BOARD_NETGEAR_WN2500RP_V1:
735 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wn2500rp_v1);
736 		break;
737 	case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
738 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
739 		break;
740 	case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
741 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
742 		break;
743 	case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
744 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
745 		break;
746 	case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
747 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
748 		break;
749 	case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
750 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
751 		break;
752 	case BCM47XX_BOARD_NETGEAR_WNR3500L:
753 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
754 		break;
755 	case BCM47XX_BOARD_NETGEAR_WNR3500L_V2:
756 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv2);
757 		break;
758 	case BCM47XX_BOARD_NETGEAR_WNR834BV2:
759 		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2);
760 		break;
761 
762 	case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
763 		err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare);
764 		break;
765 
766 	default:
767 		pr_debug("No buttons configuration found for this device\n");
768 		return -ENOTSUPP;
769 	}
770 
771 	if (err)
772 		return -ENOMEM;
773 
774 	err = platform_device_register(&bcm47xx_buttons_gpio_keys);
775 	if (err) {
776 		pr_err("Failed to register platform device: %d\n", err);
777 		return err;
778 	}
779 
780 	return 0;
781 }
782