summaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/buttons.c
blob: 535d84addcdbd47ad545256b6de9d4abe07cc5ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
// SPDX-License-Identifier: GPL-2.0
#include "bcm47xx_private.h"

#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/interrupt.h>
#include <bcm47xx_board.h>
#include <bcm47xx.h>

/**************************************************
 * Database
 **************************************************/

#define BCM47XX_GPIO_KEY(_gpio, _code)					\
	{								\
		.code		= _code,				\
		.gpio		= _gpio,				\
		.active_low	= 1,					\
	}

#define BCM47XX_GPIO_KEY_H(_gpio, _code)				\
	{								\
		.code		= _code,				\
		.gpio		= _gpio,				\
	}

/* Asus */

static const struct gpio_keys_button
bcm47xx_buttons_asus_rtn12[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(1, KEY_RESTART),
	BCM47XX_GPIO_KEY(4, BTN_0), /* Router mode */
	BCM47XX_GPIO_KEY(5, BTN_1), /* Repeater mode */
	BCM47XX_GPIO_KEY(6, BTN_2), /* AP mode */
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_rtn16[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(8, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_rtn66u[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(9, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl300g[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl320ge[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl330ge[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500g[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500gd[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500gpv1[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_RESTART),
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500gpv2[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_RESTART),
	BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl500w[] __initconst = {
	BCM47XX_GPIO_KEY_H(6, KEY_RESTART),
	BCM47XX_GPIO_KEY_H(7, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl520gc[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_RESTART),
	BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl520gu[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_RESTART),
	BCM47XX_GPIO_KEY(3, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wl700ge[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_POWER), /* Hard disk power switch */
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON), /* EZSetup */
	BCM47XX_GPIO_KEY(6, KEY_COPY), /* Copy data from USB to internal disk */
	BCM47XX_GPIO_KEY(7, KEY_RESTART), /* Hard reset */
};

static const struct gpio_keys_button
bcm47xx_buttons_asus_wlhdd[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

/* Huawei */

static const struct gpio_keys_button
bcm47xx_buttons_huawei_e970[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

/* Belkin */

static const struct gpio_keys_button
bcm47xx_buttons_belkin_f7d4301[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
	BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
};

/* Buffalo */

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_whr2_a54g54[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_whr_g125[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
	BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */
};

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_whr_g54s[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY_H(4, KEY_RESTART),
	BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */
};

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_whr_hp_g54[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
	BCM47XX_GPIO_KEY(5, BTN_0), /* Router / AP mode swtich */
};

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_wzr_g300n[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_wzr_rs_g54[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_buffalo_wzr_rs_g54hp[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
};

/* Dell */

static const struct gpio_keys_button
bcm47xx_buttons_dell_tm2300[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_RESTART),
};

/* D-Link */

static const struct gpio_keys_button
bcm47xx_buttons_dlink_dir130[] __initconst = {
	BCM47XX_GPIO_KEY(3, KEY_RESTART),
	BCM47XX_GPIO_KEY(7, KEY_UNKNOWN),
};

static const struct gpio_keys_button
bcm47xx_buttons_dlink_dir330[] __initconst = {
	BCM47XX_GPIO_KEY(3, KEY_RESTART),
	BCM47XX_GPIO_KEY(7, KEY_UNKNOWN),
};

/* Linksys */

static const struct gpio_keys_button
bcm47xx_buttons_linksys_e1000v1[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_e1000v21[] __initconst = {
	BCM47XX_GPIO_KEY(9, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(10, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_e2000v1[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(8, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_e3000v1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_e3200v1[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_RESTART),
	BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_e4200v1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt150nv1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt150nv11[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt160nv1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt160nv3[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt300n_v1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt300nv11[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_UNKNOWN),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt310nv1[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
	BCM47XX_GPIO_KEY(8, KEY_UNKNOWN),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt54g3gv2[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_WIMAX),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt54g_generic[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt610nv1[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
	BCM47XX_GPIO_KEY(8, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrt610nv2[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_linksys_wrtsl54gs[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

/* Luxul */

static const struct gpio_keys_button
bcm47xx_buttons_luxul_abr_4400_v1[] = {
	BCM47XX_GPIO_KEY(14, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xap_310_v1[] = {
	BCM47XX_GPIO_KEY(20, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xap_1210_v1[] = {
	BCM47XX_GPIO_KEY(8, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xap_1230_v1[] = {
	BCM47XX_GPIO_KEY(8, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xap_1240_v1[] = {
	BCM47XX_GPIO_KEY(8, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xap_1500_v1[] = {
	BCM47XX_GPIO_KEY(14, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xbr_4400_v1[] = {
	BCM47XX_GPIO_KEY(14, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xvw_p30_v1[] = {
	BCM47XX_GPIO_KEY(20, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xwr_600_v1[] = {
	BCM47XX_GPIO_KEY(8, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_luxul_xwr_1750_v1[] = {
	BCM47XX_GPIO_KEY(14, KEY_RESTART),
};

/* Microsoft */

static const struct gpio_keys_button
bcm47xx_buttons_microsoft_nm700[] __initconst = {
	BCM47XX_GPIO_KEY(7, KEY_RESTART),
};

/* Motorola */

static const struct gpio_keys_button
bcm47xx_buttons_motorola_we800g[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_motorola_wr850gp[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_motorola_wr850gv2v3[] __initconst = {
	BCM47XX_GPIO_KEY(5, KEY_RESTART),
};

/* Netgear */

static const struct gpio_keys_button
bcm47xx_buttons_netgear_r6200_v1[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_RFKILL),
	BCM47XX_GPIO_KEY(3, KEY_RESTART),
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(8, KEY_RFKILL),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wndr3400_v3[] __initconst = {
	BCM47XX_GPIO_KEY(12, KEY_RESTART),
	BCM47XX_GPIO_KEY(23, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wndr3700v3[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_RFKILL),
	BCM47XX_GPIO_KEY(3, KEY_RESTART),
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wndr4500v1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(5, KEY_RFKILL),
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
	BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON),
	BCM47XX_GPIO_KEY(3, KEY_RESTART),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
	BCM47XX_GPIO_KEY(4, KEY_RESTART),
	BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
};

static const struct gpio_keys_button
bcm47xx_buttons_netgear_wnr834bv2[] __initconst = {
	BCM47XX_GPIO_KEY(6, KEY_RESTART),
};

/* SimpleTech */

static const struct gpio_keys_button
bcm47xx_buttons_simpletech_simpleshare[] __initconst = {
	BCM47XX_GPIO_KEY(0, KEY_RESTART),
};

/**************************************************
 * Init
 **************************************************/

static struct gpio_keys_platform_data bcm47xx_button_pdata;

static struct platform_device bcm47xx_buttons_gpio_keys = {
	.name = "gpio-keys",
	.dev = {
		.platform_data = &bcm47xx_button_pdata,
	}
};

/* Copy data from __initconst */
static int __init bcm47xx_buttons_copy(const struct gpio_keys_button *buttons,
				       size_t nbuttons)
{
	size_t size = nbuttons * sizeof(*buttons);

	bcm47xx_button_pdata.buttons = kmemdup(buttons, size, GFP_KERNEL);
	if (!bcm47xx_button_pdata.buttons)
		return -ENOMEM;
	bcm47xx_button_pdata.nbuttons = nbuttons;

	return 0;
}

#define bcm47xx_copy_bdata(dev_buttons)					\
	bcm47xx_buttons_copy(dev_buttons, ARRAY_SIZE(dev_buttons));

int __init bcm47xx_buttons_register(void)
{
	enum bcm47xx_board board = bcm47xx_board_get();
	int err;

	switch (board) {
	case BCM47XX_BOARD_ASUS_RTN12:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
		break;
	case BCM47XX_BOARD_ASUS_RTN16:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn16);
		break;
	case BCM47XX_BOARD_ASUS_RTN66U:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn66u);
		break;
	case BCM47XX_BOARD_ASUS_WL300G:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl300g);
		break;
	case BCM47XX_BOARD_ASUS_WL320GE:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl320ge);
		break;
	case BCM47XX_BOARD_ASUS_WL330GE:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl330ge);
		break;
	case BCM47XX_BOARD_ASUS_WL500G:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500g);
		break;
	case BCM47XX_BOARD_ASUS_WL500GD:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gd);
		break;
	case BCM47XX_BOARD_ASUS_WL500GPV1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv1);
		break;
	case BCM47XX_BOARD_ASUS_WL500GPV2:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500gpv2);
		break;
	case BCM47XX_BOARD_ASUS_WL500W:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl500w);
		break;
	case BCM47XX_BOARD_ASUS_WL520GC:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gc);
		break;
	case BCM47XX_BOARD_ASUS_WL520GU:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl520gu);
		break;
	case BCM47XX_BOARD_ASUS_WL700GE:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wl700ge);
		break;
	case BCM47XX_BOARD_ASUS_WLHDD:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_wlhdd);
		break;

	case BCM47XX_BOARD_BELKIN_F7D3301:
	case BCM47XX_BOARD_BELKIN_F7D3302:
	case BCM47XX_BOARD_BELKIN_F7D4301:
	case BCM47XX_BOARD_BELKIN_F7D4302:
	case BCM47XX_BOARD_BELKIN_F7D4401:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_belkin_f7d4301);
		break;

	case BCM47XX_BOARD_BUFFALO_WHR2_A54G54:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr2_a54g54);
		break;
	case BCM47XX_BOARD_BUFFALO_WHR_G125:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g125);
		break;
	case BCM47XX_BOARD_BUFFALO_WHR_G54S:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_g54s);
		break;
	case BCM47XX_BOARD_BUFFALO_WHR_HP_G54:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_whr_hp_g54);
		break;
	case BCM47XX_BOARD_BUFFALO_WZR_G300N:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_g300n);
		break;
	case BCM47XX_BOARD_BUFFALO_WZR_RS_G54:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54);
		break;
	case BCM47XX_BOARD_BUFFALO_WZR_RS_G54HP:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_buffalo_wzr_rs_g54hp);
		break;

	case BCM47XX_BOARD_DELL_TM2300:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_dell_tm2300);
		break;

	case BCM47XX_BOARD_DLINK_DIR130:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir130);
		break;
	case BCM47XX_BOARD_DLINK_DIR330:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_dlink_dir330);
		break;

	case BCM47XX_BOARD_HUAWEI_E970:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_huawei_e970);
		break;

	case BCM47XX_BOARD_LINKSYS_E1000V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v1);
		break;
	case BCM47XX_BOARD_LINKSYS_E1000V21:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e1000v21);
		break;
	case BCM47XX_BOARD_LINKSYS_E2000V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e2000v1);
		break;
	case BCM47XX_BOARD_LINKSYS_E3000V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3000v1);
		break;
	case BCM47XX_BOARD_LINKSYS_E3200V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e3200v1);
		break;
	case BCM47XX_BOARD_LINKSYS_E4200V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_e4200v1);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT150NV1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv1);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT150NV11:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt150nv11);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT160NV1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv1);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT160NV3:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300n_v1);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101:
	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467:
	case BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g_generic);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT610NV1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv1);
		break;
	case BCM47XX_BOARD_LINKSYS_WRT610NV2:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt610nv2);
		break;
	case BCM47XX_BOARD_LINKSYS_WRTSL54GS:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrtsl54gs);
		break;

	case BCM47XX_BOARD_LUXUL_ABR_4400_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_abr_4400_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XAP_310_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_310_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XAP_1210_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1210_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XAP_1230_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1230_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XAP_1240_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1240_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XAP_1500_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xap_1500_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XBR_4400_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xbr_4400_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XVW_P30_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xvw_p30_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XWR_600_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_600_v1);
		break;
	case BCM47XX_BOARD_LUXUL_XWR_1750_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_luxul_xwr_1750_v1);
		break;

	case BCM47XX_BOARD_MICROSOFT_MN700:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_microsoft_nm700);
		break;

	case BCM47XX_BOARD_MOTOROLA_WE800G:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_we800g);
		break;
	case BCM47XX_BOARD_MOTOROLA_WR850GP:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gp);
		break;
	case BCM47XX_BOARD_MOTOROLA_WR850GV2V3:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
		break;

	case BCM47XX_BOARD_NETGEAR_R6200_V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_r6200_v1);
		break;
	case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
		break;
	case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
		break;
	case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
		break;
	case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
		break;
	case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
		break;
	case BCM47XX_BOARD_NETGEAR_WNR3500L:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
		break;
	case BCM47XX_BOARD_NETGEAR_WNR834BV2:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr834bv2);
		break;

	case BCM47XX_BOARD_SIMPLETECH_SIMPLESHARE:
		err = bcm47xx_copy_bdata(bcm47xx_buttons_simpletech_simpleshare);
		break;

	default:
		pr_debug("No buttons configuration found for this device\n");
		return -ENOTSUPP;
	}

	if (err)
		return -ENOMEM;

	err = platform_device_register(&bcm47xx_buttons_gpio_keys);
	if (err) {
		pr_err("Failed to register platform device: %d\n", err);
		return err;
	}

	return 0;
}