[ar71xx] register GPIO buttons on the AP83 board
[openwrt.git] / package / broadcom-diag / src / diag.c
1 /*
2 * diag.c - GPIO interface driver for Broadcom boards
3 *
4 * Copyright (C) 2006 Mike Baker <mbm@openwrt.org>,
5 * Copyright (C) 2006-2007 Felix Fietkau <nbd@openwrt.org>
6 * Copyright (C) 2008 Andy Boyett <agb@openwrt.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 * $Id$
23 */
24 #include <linux/module.h>
25 #include <linux/pci.h>
26 #include <linux/kmod.h>
27 #include <linux/proc_fs.h>
28 #include <linux/timer.h>
29 #include <linux/version.h>
30 #include <asm/uaccess.h>
31
32 #ifndef LINUX_2_4
33 #include <linux/workqueue.h>
34 #include <linux/skbuff.h>
35 #include <linux/netlink.h>
36 #include <net/sock.h>
37 extern struct sock *uevent_sock;
38 extern u64 uevent_next_seqnum(void);
39 #else
40 #include <linux/tqueue.h>
41 #define INIT_WORK INIT_TQUEUE
42 #define schedule_work schedule_task
43 #define work_struct tq_struct
44 #endif
45
46 #include "gpio.h"
47 #include "diag.h"
48 #define getvar(str) (nvram_get(str)?:"")
49
50 static inline int startswith (char *source, char *cmp) { return !strncmp(source,cmp,strlen(cmp)); }
51 static int fill_event(struct event_t *);
52 static unsigned int gpiomask = 0;
53 module_param(gpiomask, int, 0644);
54
55 enum {
56 /* Linksys */
57 WAP54GV1,
58 WAP54GV3,
59 WRT54GV1,
60 WRT54G,
61 WRTSL54GS,
62 WRT54G3G,
63 WRT350N,
64 WRT600N,
65 WRT600NV11,
66
67 /* ASUS */
68 WLHDD,
69 WL300G,
70 WL320GE,
71 WL500G,
72 WL500GD,
73 WL500GP,
74 WL500GPV2,
75 WL500W,
76 WL520GC,
77 WL520GU,
78 ASUS_4702,
79 WL700GE,
80
81 /* Buffalo */
82 WBR2_G54,
83 WHR_G54S,
84 WHR_HP_G54,
85 WHR_G125,
86 WHR2_A54G54,
87 WLA2_G54L,
88 WZR_G300N,
89 WZR_RS_G54,
90 WZR_RS_G54HP,
91 BUFFALO_UNKNOWN,
92 BUFFALO_UNKNOWN_4710,
93
94 /* Siemens */
95 SE505V1,
96 SE505V2,
97
98 /* US Robotics */
99 USR5461,
100
101 /* Dell */
102 TM2300,
103 TM2300V2,
104
105 /* Motorola */
106 WE800G,
107 WR850GV1,
108 WR850GV2V3,
109 WR850GP,
110
111 /* Belkin */
112 BELKIN_UNKNOWN,
113
114 /* Netgear */
115 WGT634U,
116
117 /* Trendware */
118 TEW411BRPP,
119
120 /* SimpleTech */
121 STI_NAS,
122
123 /* D-Link */
124 DIR130,
125 DIR330,
126 DWL3150,
127
128 /* Sitecom */
129 WL105B,
130 };
131
132 static void __init bcm4780_init(void) {
133 int pin = 1 << 3;
134
135 /* Enables GPIO 3 that controls HDD and led power on ASUS WL-700gE */
136 printk(MODULE_NAME ": Spinning up HDD and enabling leds\n");
137 gpio_outen(pin, pin);
138 gpio_control(pin, 0);
139 gpio_out(pin, pin);
140
141 /* Wait 5s, so the HDD can spin up */
142 set_current_state(TASK_INTERRUPTIBLE);
143 schedule_timeout(HZ * 5);
144 }
145
146 static void __init bcm57xx_init(void) {
147 int pin = 1 << 2;
148
149 #ifndef LINUX_2_4
150 /* FIXME: switch comes up, but port mappings/vlans not right */
151 gpio_outen(pin, pin);
152 gpio_control(pin, 0);
153 gpio_out(pin, pin);
154 #endif
155 }
156
157 static struct platform_t __initdata platforms[] = {
158 /* Linksys */
159 [WAP54GV1] = {
160 .name = "Linksys WAP54G V1",
161 .buttons = {
162 { .name = "reset", .gpio = 1 << 0 },
163 },
164 .leds = {
165 { .name = "diag", .gpio = 1 << 3 },
166 { .name = "wlan", .gpio = 1 << 4 },
167 },
168 },
169 [WAP54GV3] = {
170 .name = "Linksys WAP54G V3",
171 .buttons = {
172 /* FIXME: verify this */
173 { .name = "reset", .gpio = 1 << 7 },
174 { .name = "ses", .gpio = 1 << 0 },
175 },
176 .leds = {
177 /* FIXME: diag? */
178 { .name = "ses", .gpio = 1 << 1 },
179 },
180 },
181 [WRT54GV1] = {
182 .name = "Linksys WRT54G V1.x",
183 .buttons = {
184 { .name = "reset", .gpio = 1 << 6 },
185 },
186 .leds = {
187 { .name = "diag", .gpio = 0x13 | GPIO_TYPE_EXTIF, .polarity = NORMAL },
188 { .name = "dmz", .gpio = 0x12 | GPIO_TYPE_EXTIF, .polarity = NORMAL },
189 },
190 },
191 [WRT54G] = {
192 .name = "Linksys WRT54G/GS/GL",
193 .buttons = {
194 { .name = "reset", .gpio = 1 << 6 },
195 { .name = "ses", .gpio = 1 << 4 },
196 },
197 .leds = {
198 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
199 { .name = "dmz", .gpio = 1 << 7, .polarity = REVERSE },
200 { .name = "ses_white", .gpio = 1 << 2, .polarity = REVERSE },
201 { .name = "ses_orange", .gpio = 1 << 3, .polarity = REVERSE },
202 { .name = "wlan", .gpio = 1 << 0, .polarity = REVERSE },
203 },
204 },
205 [WRTSL54GS] = {
206 .name = "Linksys WRTSL54GS",
207 .buttons = {
208 { .name = "reset", .gpio = 1 << 6 },
209 { .name = "ses", .gpio = 1 << 4 },
210 },
211 .leds = {
212 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
213 { .name = "dmz", .gpio = 1 << 0, .polarity = REVERSE },
214 { .name = "ses_white", .gpio = 1 << 5, .polarity = REVERSE },
215 { .name = "ses_orange", .gpio = 1 << 7, .polarity = REVERSE },
216 },
217 },
218 [WRT54G3G] = {
219 .name = "Linksys WRT54G3G",
220 .buttons = {
221 { .name = "reset", .gpio = 1 << 6 },
222 { .name = "3g", .gpio = 1 << 4 },
223 },
224 .leds = {
225 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
226 { .name = "dmz", .gpio = 1 << 7, .polarity = REVERSE },
227 { .name = "3g_green", .gpio = 1 << 2, .polarity = NORMAL },
228 { .name = "3g_blue", .gpio = 1 << 3, .polarity = NORMAL },
229 { .name = "3g_blink", .gpio = 1 << 5, .polarity = NORMAL },
230 },
231 },
232 [WRT350N] = {
233 .name = "Linksys WRT350N",
234 .buttons = {
235 { .name = "reset", .gpio = 1 << 6 },
236 { .name = "ses", .gpio = 1 << 8 },
237 },
238 .leds = {
239 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
240 { .name = "ses_amber", .gpio = 1 << 3, .polarity = REVERSE },
241 { .name = "ses_green", .gpio = 1 << 9, .polarity = REVERSE },
242 { .name = "usb_blink", .gpio = 1 << 10, .polarity = REVERSE },
243 { .name = "usb", .gpio = 1 << 11, .polarity = REVERSE },
244 },
245 .platform_init = bcm57xx_init,
246 },
247 [WRT600N] = {
248 .name = "Linksys WRT600N",
249 .buttons = {
250 { .name = "reset", .gpio = 1 << 6 },
251 { .name = "ses", .gpio = 1 << 7 },
252 },
253 .leds = {
254 { .name = "power", .gpio = 1 << 2, .polarity = REVERSE }, // Power LED
255 { .name = "usb", .gpio = 1 << 3, .polarity = REVERSE }, // USB LED
256 { .name = "wl0_ses_amber", .gpio = 1 << 8, .polarity = REVERSE }, // 2.4Ghz LED Amber
257 { .name = "wl0_ses_green", .gpio = 1 << 9, .polarity = REVERSE }, // 2.4Ghz LED Green
258 { .name = "wl1_ses_amber", .gpio = 1 << 10, .polarity = REVERSE }, // 5.6Ghz LED Amber
259 { .name = "wl1_ses_green", .gpio = 1 << 11, .polarity = REVERSE }, // 5.6Ghz LED Green
260 },
261 .platform_init = bcm57xx_init,
262 },
263 [WRT600NV11] = {
264 .name = "Linksys WRT600N V1.1",
265 .buttons = {
266 { .name = "reset", .gpio = 1 << 6 },
267 { .name = "ses", .gpio = 1 << 7 },
268 },
269 .leds = {
270 { .name = "power", .gpio = 1 << 2, .polarity = REVERSE }, // Power LED
271 { .name = "usb", .gpio = 1 << 3, .polarity = REVERSE }, // USB LED
272 { .name = "wl0_ses_amber", .gpio = 1 << 8, .polarity = REVERSE }, // 2.4Ghz LED Amber
273 { .name = "wl0_ses_green", .gpio = 1 << 9, .polarity = REVERSE }, // 2.4Ghz LED Green
274 { .name = "wl1_ses_amber", .gpio = 1 << 10, .polarity = REVERSE }, // 5.6Ghz LED Amber
275 { .name = "wl1_ses_green", .gpio = 1 << 11, .polarity = REVERSE }, // 5.6Ghz LED Green
276 },
277 .platform_init = bcm57xx_init,
278 },
279 /* Asus */
280 [WLHDD] = {
281 .name = "ASUS WL-HDD",
282 .buttons = {
283 { .name = "reset", .gpio = 1 << 6 },
284 },
285 .leds = {
286 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
287 { .name = "usb", .gpio = 1 << 2, .polarity = NORMAL },
288 },
289 },
290 [WL300G] = {
291 .name = "ASUS WL-300g",
292 .buttons = {
293 { .name = "reset", .gpio = 1 << 6 },
294 },
295 .leds = {
296 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
297 },
298 },
299 [WL320GE] = {
300 .name = "ASUS WL-320gE/WL-320gP",
301 .buttons = {
302 { .name = "reset", .gpio = 1 << 6 },
303 },
304 .leds = {
305 { .name = "wlan", .gpio = 1 << 0, .polarity = REVERSE },
306 { .name = "power", .gpio = 1 << 2, .polarity = REVERSE },
307 { .name = "link", .gpio = 1 << 11, .polarity = REVERSE },
308 },
309 },
310 [WL500G] = {
311 .name = "ASUS WL-500g",
312 .buttons = {
313 { .name = "reset", .gpio = 1 << 6 },
314 },
315 .leds = {
316 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
317 },
318 },
319 [WL500GD] = {
320 .name = "ASUS WL-500g Deluxe",
321 .buttons = {
322 { .name = "reset", .gpio = 1 << 6 },
323 },
324 .leds = {
325 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
326 },
327 },
328 [WL500GP] = {
329 .name = "ASUS WL-500g Premium",
330 .buttons = {
331 { .name = "reset", .gpio = 1 << 0 },
332 { .name = "ses", .gpio = 1 << 4 },
333 },
334 .leds = {
335 { .name = "power", .gpio = 1 << 1, .polarity = REVERSE },
336 },
337 },
338 [WL500GPV2] = {
339 .name = "ASUS WL-500g Premium V2",
340 .buttons = {
341 { .name = "reset", .gpio = 1 << 2 },
342 { .name = "ses", .gpio = 1 << 3 },
343 },
344 .leds = {
345 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
346 { .name = "wlan", .gpio = 1 << 1, .polarity = REVERSE },
347 },
348 },
349 [WL500W] = {
350 .name = "ASUS WL-500W",
351 .buttons = {
352 { .name = "reset", .gpio = 1 << 6 },
353 { .name = "ses", .gpio = 1 << 7 },
354 },
355 .leds = {
356 { .name = "power", .gpio = 1 << 5, .polarity = REVERSE },
357 },
358 },
359 [WL520GC] = {
360 .name = "ASUS WL-520GC",
361 .buttons = {
362 { .name = "reset", .gpio = 1 << 2 },
363 { .name = "ses", .gpio = 1 << 3 },
364 },
365 .leds = {
366 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
367 { .name = "wlan", .gpio = 1 << 1, .polarity = REVERSE },
368 },
369 },
370 [WL520GU] = {
371 .name = "ASUS WL-520gU",
372 .buttons = {
373 { .name = "reset", .gpio = 1 << 2 },
374 { .name = "ses", .gpio = 1 << 3 },
375 },
376 .leds = {
377 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
378 { .name = "wlan", .gpio = 1 << 1, .polarity = REVERSE },
379 },
380 },
381 [ASUS_4702] = {
382 .name = "ASUS (unknown, BCM4702)",
383 .buttons = {
384 { .name = "reset", .gpio = 1 << 6 },
385 },
386 .leds = {
387 { .name = "power", .gpio = 1 << 0, .polarity = REVERSE },
388 },
389 },
390 [WL700GE] = {
391 .name = "ASUS WL-700gE",
392 .buttons = {
393 { .name = "reset", .gpio = 1 << 7 }, // on back, hardwired, always resets device regardless OS state
394 { .name = "ses", .gpio = 1 << 4 }, // on back, actual name ezsetup
395 { .name = "power", .gpio = 1 << 0 }, // on front
396 { .name = "copy", .gpio = 1 << 6 }, // on front
397 },
398 .leds = {
399 #if 0
400 // GPIO that controls power led also enables/disables some essential functions
401 // - power to HDD
402 // - switch leds
403 { .name = "power", .gpio = 1 << 3, .polarity = NORMAL }, // actual name power
404 #endif
405 { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE }, // actual name ready
406 },
407 .platform_init = bcm4780_init,
408 },
409 /* Buffalo */
410 [WHR_G54S] = {
411 .name = "Buffalo WHR-G54S",
412 .buttons = {
413 { .name = "reset", .gpio = 1 << 4 },
414 { .name = "bridge", .gpio = 1 << 5 },
415 { .name = "ses", .gpio = 1 << 0 },
416 },
417 .leds = {
418 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
419 { .name = "internal", .gpio = 1 << 3, .polarity = REVERSE },
420 { .name = "ses", .gpio = 1 << 6, .polarity = REVERSE },
421 { .name = "bridge", .gpio = 1 << 1, .polarity = REVERSE },
422 { .name = "wlan", .gpio = 1 << 2, .polarity = REVERSE },
423 },
424 },
425 [WBR2_G54] = {
426 .name = "Buffalo WBR2-G54",
427 /* FIXME: verify */
428 .buttons = {
429 { .name = "reset", .gpio = 1 << 7 },
430 },
431 .leds = {
432 { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE },
433 },
434 },
435 [WHR_HP_G54] = {
436 .name = "Buffalo WHR-HP-G54",
437 .buttons = {
438 { .name = "reset", .gpio = 1 << 4 },
439 { .name = "bridge", .gpio = 1 << 5 },
440 { .name = "ses", .gpio = 1 << 0 },
441 },
442 .leds = {
443 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
444 { .name = "internal", .gpio = 1 << 3, .polarity = REVERSE },
445 { .name = "bridge", .gpio = 1 << 1, .polarity = REVERSE },
446 { .name = "ses", .gpio = 1 << 6, .polarity = REVERSE },
447 { .name = "wlan", .gpio = 1 << 2, .polarity = REVERSE },
448 },
449 },
450 [WHR_G125] = {
451 .name = "Buffalo WHR-G125",
452 .buttons = {
453 { .name = "reset", .gpio = 1 << 4 },
454 { .name = "bridge", .gpio = 1 << 5 },
455 { .name = "ses", .gpio = 1 << 0 },
456 },
457 .leds = {
458 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
459 { .name = "internal", .gpio = 1 << 3, .polarity = REVERSE },
460 { .name = "bridge", .gpio = 1 << 1, .polarity = REVERSE },
461 { .name = "ses", .gpio = 1 << 6, .polarity = REVERSE },
462 { .name = "wlan", .gpio = 1 << 2, .polarity = REVERSE },
463 },
464 },
465 [WHR2_A54G54] = {
466 .name = "Buffalo WHR2-A54G54",
467 .buttons = {
468 { .name = "reset", .gpio = 1 << 4 },
469 },
470 .leds = {
471 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
472 },
473 },
474 [WLA2_G54L] = {
475 .name = "Buffalo WLA2-G54L",
476 /* FIXME: verify */
477 .buttons = {
478 { .name = "reset", .gpio = 1 << 7 },
479 },
480 .leds = {
481 { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE },
482 },
483 },
484 [WZR_G300N] = {
485 .name = "Buffalo WZR-G300N",
486 .buttons = {
487 { .name = "reset", .gpio = 1 << 4 },
488 },
489 .leds = {
490 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
491 { .name = "bridge", .gpio = 1 << 1, .polarity = REVERSE },
492 { .name = "ses", .gpio = 1 << 6, .polarity = REVERSE },
493 },
494 },
495 [WZR_RS_G54] = {
496 .name = "Buffalo WZR-RS-G54",
497 .buttons = {
498 { .name = "ses", .gpio = 1 << 0 },
499 { .name = "reset", .gpio = 1 << 4 },
500 },
501 .leds = {
502 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
503 { .name = "ses", .gpio = 1 << 6, .polarity = REVERSE },
504 { .name = "vpn", .gpio = 1 << 1, .polarity = REVERSE },
505 },
506 },
507 [WZR_RS_G54HP] = {
508 .name = "Buffalo WZR-RS-G54HP",
509 .buttons = {
510 { .name = "ses", .gpio = 1 << 0 },
511 { .name = "reset", .gpio = 1 << 4 },
512 },
513 .leds = {
514 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
515 { .name = "ses", .gpio = 1 << 6, .polarity = REVERSE },
516 { .name = "vpn", .gpio = 1 << 1, .polarity = REVERSE },
517 },
518 },
519 [BUFFALO_UNKNOWN] = {
520 .name = "Buffalo (unknown)",
521 .buttons = {
522 { .name = "reset", .gpio = 1 << 7 },
523 },
524 .leds = {
525 { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE },
526 },
527 },
528 [BUFFALO_UNKNOWN_4710] = {
529 .name = "Buffalo (unknown, BCM4710)",
530 .buttons = {
531 { .name = "reset", .gpio = 1 << 4 },
532 },
533 .leds = {
534 { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE },
535 },
536 },
537 /* Siemens */
538 [SE505V1] = {
539 .name = "Siemens SE505 V1",
540 .buttons = {
541 /* No usable buttons */
542 },
543 .leds = {
544 // { .name = "power", .gpio = 1 << 0 .polarity = REVERSE }, // Usable when retrofitting D26 (?)
545 { .name = "dmz", .gpio = 1 << 4, .polarity = REVERSE }, // actual name WWW
546 { .name = "wlan", .gpio = 1 << 3, .polarity = REVERSE },
547 },
548 },
549 [SE505V2] = {
550 .name = "Siemens SE505 V2",
551 .buttons = {
552 /* No usable buttons */
553 },
554 .leds = {
555 { .name = "power", .gpio = 1 << 5, .polarity = REVERSE },
556 { .name = "dmz", .gpio = 1 << 0, .polarity = REVERSE }, // actual name WWW
557 { .name = "wlan", .gpio = 1 << 3, .polarity = REVERSE },
558 },
559 },
560 /* US Robotics */
561 [USR5461] = {
562 .name = "U.S. Robotics USR5461",
563 .buttons = {
564 /* No usable buttons */
565 },
566 .leds = {
567 { .name = "wlan", .gpio = 1 << 0, .polarity = REVERSE },
568 { .name = "printer", .gpio = 1 << 1, .polarity = REVERSE },
569 },
570 },
571 /* Dell */
572 [TM2300] = {
573 .name = "Dell TrueMobile 2300",
574 .buttons = {
575 { .name = "reset", .gpio = 1 << 0 },
576 },
577 .leds = {
578 { .name = "wlan", .gpio = 1 << 6, .polarity = REVERSE },
579 { .name = "power", .gpio = 1 << 7, .polarity = REVERSE },
580 },
581 },
582 [TM2300V2] = {
583 .name = "Dell TrueMobile 2300 v2",
584 .buttons = {
585 { .name = "reset", .gpio = 1 << 0 },
586 },
587 .leds = {
588 { .name = "wlan", .gpio = 1 << 6, .polarity = REVERSE },
589 { .name = "power", .gpio = 1 << 7, .polarity = REVERSE },
590 },
591 },
592 /* Motorola */
593 [WE800G] = {
594 .name = "Motorola WE800G",
595 .buttons = {
596 { .name = "reset", .gpio = 1 << 0 },
597 },
598 .leds = {
599 { .name = "power", .gpio = 1 << 4, .polarity = NORMAL },
600 { .name = "diag", .gpio = 1 << 2, .polarity = REVERSE },
601 { .name = "wlan_amber", .gpio = 1 << 1, .polarity = NORMAL },
602 },
603 },
604 [WR850GV1] = {
605 .name = "Motorola WR850G V1",
606 .buttons = {
607 { .name = "reset", .gpio = 1 << 0 },
608 },
609 .leds = {
610 { .name = "power", .gpio = 1 << 4, .polarity = NORMAL },
611 { .name = "diag", .gpio = 1 << 3, .polarity = REVERSE },
612 { .name = "dmz", .gpio = 1 << 6, .polarity = NORMAL },
613 { .name = "wlan_red", .gpio = 1 << 5, .polarity = REVERSE },
614 { .name = "wlan_green", .gpio = 1 << 7, .polarity = REVERSE },
615 },
616 },
617 [WR850GV2V3] = {
618 .name = "Motorola WR850G V2/V3",
619 .buttons = {
620 { .name = "reset", .gpio = 1 << 5 },
621 },
622 .leds = {
623 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
624 { .name = "wlan", .gpio = 1 << 0, .polarity = REVERSE },
625 { .name = "wan", .gpio = 1 << 6, .polarity = INPUT },
626 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
627 },
628 },
629 [WR850GP] = {
630 .name = "Motorola WR850GP",
631 .buttons = {
632 { .name = "reset", .gpio = 1 << 5 },
633 },
634 .leds = {
635 { .name = "power", .gpio = 1 << 1, .polarity = NORMAL },
636 { .name = "wlan", .gpio = 1 << 0, .polarity = REVERSE },
637 { .name = "dmz", .gpio = 1 << 6, .polarity = REVERSE },
638 { .name = "diag", .gpio = 1 << 7, .polarity = REVERSE },
639 },
640 },
641
642 /* Belkin */
643 [BELKIN_UNKNOWN] = {
644 .name = "Belkin (unknown)",
645 /* FIXME: verify & add detection */
646 .buttons = {
647 { .name = "reset", .gpio = 1 << 7 },
648 },
649 .leds = {
650 { .name = "power", .gpio = 1 << 5, .polarity = NORMAL },
651 { .name = "wlan", .gpio = 1 << 3, .polarity = NORMAL },
652 { .name = "connected", .gpio = 1 << 0, .polarity = NORMAL },
653 },
654 },
655 /* Netgear */
656 [WGT634U] = {
657 .name = "Netgear WGT634U",
658 .buttons = {
659 { .name = "reset", .gpio = 1 << 2 },
660 },
661 .leds = {
662 { .name = "power", .gpio = 1 << 3, .polarity = NORMAL },
663 },
664 },
665 /* Trendware */
666 [TEW411BRPP] = {
667 .name = "Trendware TEW411BRP+",
668 .buttons = {
669 { /* No usable buttons */ },
670 },
671 .leds = {
672 { .name = "power", .gpio = 1 << 7, .polarity = NORMAL },
673 { .name = "wlan", .gpio = 1 << 1, .polarity = NORMAL },
674 { .name = "bridge", .gpio = 1 << 6, .polarity = NORMAL },
675 },
676 },
677 /* SimpleTech */
678 [STI_NAS] = {
679 .name = "SimpleTech SimpleShare NAS",
680 .buttons = {
681 { .name = "reset", .gpio = 1 << 7 }, // on back, hardwired, always resets device regardless OS state
682 { .name = "power", .gpio = 1 << 0 }, // on back
683 },
684 .leds = {
685 { .name = "diag", .gpio = 1 << 1, .polarity = REVERSE }, // actual name ready
686 },
687 .platform_init = bcm4780_init,
688 },
689 /* D-Link */
690 [DIR130] = {
691 .name = "D-Link DIR-130",
692 .buttons = {
693 { .name = "reset", .gpio = 1 << 3},
694 { .name = "reserved", .gpio = 1 << 7},
695 },
696 .leds = {
697 { .name = "diag", .gpio = 1 << 0},
698 { .name = "blue", .gpio = 1 << 6},
699 },
700 },
701 [DIR330] = {
702 .name = "D-Link DIR-330",
703 .buttons = {
704 { .name = "reset", .gpio = 1 << 3},
705 { .name = "reserved", .gpio = 1 << 7},
706 },
707 .leds = {
708 { .name = "diag", .gpio = 1 << 0},
709 { .name = "usb", .gpio = 1 << 4},
710 { .name = "blue", .gpio = 1 << 6},
711 },
712 },
713 [DWL3150] = {
714 .name = "D-Link DWL-3150",
715 .buttons = {
716 { .name = "reset", .gpio = 1 << 7},
717 },
718 .leds = {
719 { .name = "diag", .gpio = 1 << 2},
720 { .name = "status", .gpio = 1 << 1},
721 },
722 },
723 /* Double check */
724 [WL105B] = {
725 .name = "Sitecom WL-105b",
726 .buttons = {
727 { .name = "reset", .gpio = 1 << 10},
728 },
729 .leds = {
730 { .name = "wlan", .gpio = 1 << 4},
731 { .name = "power", .gpio = 1 << 3},
732 },
733 },
734 };
735
736 static struct platform_t __init *platform_detect(void)
737 {
738 char *boardnum, *boardtype, *buf;
739
740 if (strcmp(getvar("nvram_type"), "cfe") == 0)
741 return &platforms[WGT634U];
742
743 /* Look for a model identifier */
744
745 /* Based on "model_name" */
746 if ((buf = nvram_get("model_name"))) {
747 if (!strcmp(buf, "DIR-130"))
748 return &platforms[DIR130];
749 if (!strcmp(buf, "DIR-330"))
750 return &platforms[DIR330];
751 }
752
753 /* Based on "model_no" */
754 if ((buf = nvram_get("model_no"))) {
755 if (startswith(buf,"WL700")) /* WL700* */
756 return &platforms[WL700GE];
757 }
758
759 /* Based on "hardware_version" */
760 if ((buf = nvram_get("hardware_version"))) {
761 if (startswith(buf,"WL500GPV2-")) /* WL500GPV2-* */
762 return &platforms[WL500GPV2];
763 if (startswith(buf,"WL520GC-")) /* WL520GU-* */
764 return &platforms[WL520GC];
765 if (startswith(buf,"WL520GU-")) /* WL520GU-* */
766 return &platforms[WL520GU];
767 }
768
769 /* Based on "ModelId" */
770 if ((buf = nvram_get("ModelId"))) {
771 if (!strcmp(buf, "WR850GP"))
772 return &platforms[WR850GP];
773 if (!strcmp(buf, "WX-5565") && !strcmp(getvar("boardtype"),"bcm94710ap"))
774 return &platforms[TM2300]; /* Dell TrueMobile 2300 */
775 if (startswith(buf,"WE800G")) /* WE800G* */
776 return &platforms[WE800G];
777 }
778
779 /* Buffalo */
780 if ((buf = (nvram_get("melco_id") ?: nvram_get("buffalo_id")))) {
781 /* Buffalo hardware, check id for specific hardware matches */
782 if (!strcmp(buf, "29bb0332"))
783 return &platforms[WBR2_G54];
784 if (!strcmp(buf, "29129"))
785 return &platforms[WLA2_G54L];
786 if (!strcmp(buf, "30189"))
787 return &platforms[WHR_HP_G54];
788 if (!strcmp(buf, "32093"))
789 return &platforms[WHR_G125];
790 if (!strcmp(buf, "30182"))
791 return &platforms[WHR_G54S];
792 if (!strcmp(buf, "290441dd"))
793 return &platforms[WHR2_A54G54];
794 if (!strcmp(buf, "31120"))
795 return &platforms[WZR_G300N];
796 if (!strcmp(buf, "30083"))
797 return &platforms[WZR_RS_G54];
798 if (!strcmp(buf, "30103"))
799 return &platforms[WZR_RS_G54HP];
800 }
801
802 /* no easy model number, attempt to guess */
803 boardnum = getvar("boardnum");
804 boardtype = getvar("boardtype");
805
806 if (!strcmp(boardnum, "20070615")) { /* Linksys WRT600N v1/V1.1 */
807 if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), "0") && !strcmp(getvar("switch_type"),"BCM5395"))
808 return &platforms[WRT600NV11];
809
810 if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), "0"))
811 return &platforms[WRT600N];
812 }
813
814 if (startswith(getvar("pmon_ver"), "CFE")) {
815 /* CFE based - newer hardware */
816 if (!strcmp(boardnum, "42")) { /* Linksys */
817 if (!strcmp(boardtype, "0x478") && !strcmp(getvar("cardbus"), "1"))
818 return &platforms[WRT350N];
819
820 if (!strcmp(boardtype, "0x0101") && !strcmp(getvar("boot_ver"), "v3.6"))
821 return &platforms[WRT54G3G];
822
823 if (!strcmp(getvar("et1phyaddr"),"5") && !strcmp(getvar("et1mdcport"), "1"))
824 return &platforms[WRTSL54GS];
825
826 /* default to WRT54G */
827 return &platforms[WRT54G];
828 }
829
830 if (!strcmp(boardnum, "44") || !strcmp(boardnum, "44\r")) {
831 if (!strcmp(boardtype,"0x0101") || !strcmp(boardtype, "0x0101\r"))
832 return &platforms[TM2300V2]; /* Dell TrueMobile 2300 v2 */
833 }
834
835 if (!strcmp(boardnum, "45")) { /* ASUS */
836 if (!strcmp(boardtype,"0x042f"))
837 return &platforms[WL500GP];
838 else if (!strcmp(boardtype,"0x0472"))
839 return &platforms[WL500W];
840 else if (!strcmp(boardtype,"0x467"))
841 return &platforms[WL320GE];
842 else
843 return &platforms[WL500GD];
844 }
845
846 if (!strcmp(boardnum, "10496"))
847 return &platforms[USR5461];
848
849 if (!strcmp(getvar("boardtype"), "0x0101") && !strcmp(getvar("boardrev"), "0x10")) /* SE505V2 With Modified CFE */
850 return &platforms[SE505V2];
851
852 } else { /* PMON based - old stuff */
853 if ((simple_strtoul(getvar("GemtekPmonVer"), NULL, 0) == 9) &&
854 (simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 30)) {
855 return &platforms[WR850GV1];
856 }
857 if (startswith(boardtype, "bcm94710dev")) {
858 if (!strcmp(boardnum, "42"))
859 return &platforms[WRT54GV1];
860 if (simple_strtoul(boardnum, NULL, 0) == 2)
861 return &platforms[WAP54GV1];
862 }
863 if (startswith(getvar("hardware_version"), "WL500-"))
864 return &platforms[WL500G];
865 if (startswith(getvar("hardware_version"), "WL300-")) {
866 /* Either WL-300g or WL-HDD, do more extensive checks */
867 if ((simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 0) &&
868 (simple_strtoul(getvar("et1phyaddr"), NULL, 0) == 1))
869 return &platforms[WLHDD];
870 if ((simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 0) &&
871 (simple_strtoul(getvar("et1phyaddr"), NULL, 0) == 10))
872 return &platforms[WL300G];
873 }
874 /* Sitecom WL-105b */
875 if (startswith(boardnum, "2") && simple_strtoul(getvar("GemtekPmonVer"), NULL, 0) == 1)
876 return &platforms[WL105B];
877
878 /* unknown asus stuff, probably bcm4702 */
879 if (startswith(boardnum, "asusX"))
880 return &platforms[ASUS_4702];
881 }
882
883 if (buf || !strcmp(boardnum, "00")) {/* probably buffalo */
884 if (startswith(boardtype, "bcm94710ap"))
885 return &platforms[BUFFALO_UNKNOWN_4710];
886 else
887 return &platforms[BUFFALO_UNKNOWN];
888 }
889
890 if (startswith(getvar("CFEver"), "MotoWRv2") ||
891 startswith(getvar("CFEver"), "MotoWRv3") ||
892 !strcmp(getvar("MOTO_BOARD_TYPE"), "WR_FEM1")) {
893
894 return &platforms[WR850GV2V3];
895 }
896
897 if (!strcmp(boardnum, "44") && !strcmp(getvar("boardflags"),"0x0388")) { /* Trendware TEW-411BRP+ */
898 return &platforms[TEW411BRPP];
899 }
900
901 if (startswith(boardnum, "04FN52")) /* SimpleTech SimpleShare */
902 return &platforms[STI_NAS];
903
904 if (!strcmp(getvar("boardnum"), "10") && !strcmp(getvar("boardrev"), "0x13")) /* D-Link DWL-3150 */
905 return &platforms[DWL3150];
906
907 /* not found */
908 return NULL;
909 }
910
911 static void register_buttons(struct button_t *b)
912 {
913 for (; b->name; b++)
914 platform.button_mask |= b->gpio;
915
916 platform.button_mask &= ~gpiomask;
917
918 gpio_outen(platform.button_mask, 0);
919 gpio_control(platform.button_mask, 0);
920 platform.button_polarity = gpio_in() & platform.button_mask;
921 gpio_intpolarity(platform.button_mask, platform.button_polarity);
922 gpio_intmask(platform.button_mask, platform.button_mask);
923
924 gpio_set_irqenable(1, button_handler);
925 }
926
927 static void unregister_buttons(struct button_t *b)
928 {
929 gpio_intmask(platform.button_mask, 0);
930
931 gpio_set_irqenable(0, button_handler);
932 }
933
934
935 #ifndef LINUX_2_4
936 static void add_msg(struct event_t *event, char *msg, int argv)
937 {
938 char *s;
939
940 if (argv)
941 return;
942
943 s = skb_put(event->skb, strlen(msg) + 1);
944 strcpy(s, msg);
945 }
946
947 static void hotplug_button(struct work_struct *work)
948 {
949 struct event_t *event = container_of(work, struct event_t, wq);
950 char *s;
951
952 if (!uevent_sock)
953 return;
954
955 event->skb = alloc_skb(2048, GFP_KERNEL);
956
957 s = skb_put(event->skb, strlen(event->action) + 2);
958 sprintf(s, "%s@", event->action);
959 fill_event(event);
960
961 NETLINK_CB(event->skb).dst_group = 1;
962 netlink_broadcast(uevent_sock, event->skb, 0, 1, GFP_KERNEL);
963
964 kfree(event);
965 }
966
967 #else /* !LINUX_2_4 */
968 static inline char *kzalloc(unsigned int size, unsigned int gfp)
969 {
970 char *p;
971
972 p = kmalloc(size, gfp);
973 if (p == NULL)
974 return NULL;
975
976 memset(p, 0, size);
977
978 return p;
979 }
980
981 static void add_msg(struct event_t *event, char *msg, int argv)
982 {
983 if (argv)
984 event->argv[event->anr++] = event->scratch;
985 else
986 event->envp[event->enr++] = event->scratch;
987
988 event->scratch += sprintf(event->scratch, "%s", msg) + 1;
989 }
990
991 static void hotplug_button(struct event_t *event)
992 {
993 char *scratch = kzalloc(256, GFP_KERNEL);
994 event->scratch = scratch;
995
996 add_msg(event, hotplug_path, 1);
997 add_msg(event, "button", 1);
998 fill_event(event);
999 call_usermodehelper (event->argv[0], event->argv, event->envp);
1000 kfree(scratch);
1001 kfree(event);
1002 }
1003 #endif /* !LINUX_2_4 */
1004
1005 static int fill_event (struct event_t *event)
1006 {
1007 static char buf[128];
1008
1009 add_msg(event, "HOME=/", 0);
1010 add_msg(event, "PATH=/sbin:/bin:/usr/sbin:/usr/bin", 0);
1011 add_msg(event, "SUBSYSTEM=button", 0);
1012 snprintf(buf, 128, "ACTION=%s", event->action);
1013 add_msg(event, buf, 0);
1014 snprintf(buf, 128, "BUTTON=%s", event->name);
1015 add_msg(event, buf, 0);
1016 snprintf(buf, 128, "SEEN=%ld", event->seen);
1017 add_msg(event, buf, 0);
1018 #ifndef LINUX_2_4
1019 snprintf(buf, 128, "SEQNUM=%llu", uevent_next_seqnum());
1020 add_msg(event, buf, 0);
1021 #endif
1022
1023 return 0;
1024 }
1025
1026
1027 #ifndef LINUX_2_4
1028 static irqreturn_t button_handler(int irq, void *dev_id)
1029 #else
1030 static irqreturn_t button_handler(int irq, void *dev_id, struct pt_regs *regs)
1031 #endif
1032 {
1033 struct button_t *b;
1034 u32 in, changed;
1035
1036 in = gpio_in() & platform.button_mask;
1037 gpio_intpolarity(platform.button_mask, in);
1038 changed = platform.button_polarity ^ in;
1039 platform.button_polarity = in;
1040
1041 changed &= ~gpio_outen(0, 0);
1042
1043 for (b = platform.buttons; b->name; b++) {
1044 struct event_t *event;
1045
1046 if (!(b->gpio & changed)) continue;
1047
1048 b->pressed ^= 1;
1049
1050 if ((event = (struct event_t *)kzalloc (sizeof(struct event_t), GFP_ATOMIC))) {
1051 event->seen = (jiffies - b->seen)/HZ;
1052 event->name = b->name;
1053 event->action = b->pressed ? "pressed" : "released";
1054 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1055 INIT_WORK(&event->wq, (void *)(void *)hotplug_button);
1056 #else
1057 INIT_WORK(&event->wq, (void *)(void *)hotplug_button, (void *)event);
1058 #endif
1059 schedule_work(&event->wq);
1060 }
1061
1062 b->seen = jiffies;
1063 }
1064 return IRQ_HANDLED;
1065 }
1066
1067 static void register_leds(struct led_t *l)
1068 {
1069 struct proc_dir_entry *p;
1070 u32 mask = 0;
1071 u32 oe_mask = 0;
1072 u32 val = 0;
1073
1074 leds = proc_mkdir("led", diag);
1075 if (!leds)
1076 return;
1077
1078 for(; l->name; l++) {
1079 if (l->gpio & gpiomask)
1080 continue;
1081
1082 if (l->gpio & GPIO_TYPE_EXTIF) {
1083 l->state = 0;
1084 set_led_extif(l);
1085 } else {
1086 if (l->polarity != INPUT) oe_mask |= l->gpio;
1087 mask |= l->gpio;
1088 val |= (l->polarity == NORMAL)?0:l->gpio;
1089 }
1090
1091 if (l->polarity == INPUT) continue;
1092
1093 if ((p = create_proc_entry(l->name, S_IRUSR, leds))) {
1094 l->proc.type = PROC_LED;
1095 l->proc.ptr = l;
1096 p->data = (void *) &l->proc;
1097 p->proc_fops = &diag_proc_fops;
1098 }
1099 }
1100
1101 gpio_outen(mask, oe_mask);
1102 gpio_control(mask, 0);
1103 gpio_out(mask, val);
1104 gpio_intmask(mask, 0);
1105 }
1106
1107 static void unregister_leds(struct led_t *l)
1108 {
1109 for(; l->name; l++)
1110 remove_proc_entry(l->name, leds);
1111
1112 remove_proc_entry("led", diag);
1113 }
1114
1115 static void set_led_extif(struct led_t *led)
1116 {
1117 gpio_set_extif(led->gpio, led->state);
1118 }
1119
1120 static void led_flash(unsigned long dummy) {
1121 struct led_t *l;
1122 u32 mask = 0;
1123 u8 extif_blink = 0;
1124
1125 for (l = platform.leds; l->name; l++) {
1126 if (l->flash) {
1127 if (l->gpio & GPIO_TYPE_EXTIF) {
1128 extif_blink = 1;
1129 l->state = !l->state;
1130 set_led_extif(l);
1131 } else {
1132 mask |= l->gpio;
1133 }
1134 }
1135 }
1136
1137 mask &= ~gpiomask;
1138 if (mask) {
1139 u32 val = ~gpio_in();
1140
1141 gpio_outen(mask, mask);
1142 gpio_control(mask, 0);
1143 gpio_out(mask, val);
1144 }
1145 if (mask || extif_blink) {
1146 mod_timer(&led_timer, jiffies + FLASH_TIME);
1147 }
1148 }
1149
1150 static ssize_t diag_proc_read(struct file *file, char *buf, size_t count, loff_t *ppos)
1151 {
1152 #ifdef LINUX_2_4
1153 struct inode *inode = file->f_dentry->d_inode;
1154 struct proc_dir_entry *dent = inode->u.generic_ip;
1155 #else
1156 struct proc_dir_entry *dent = PDE(file->f_dentry->d_inode);
1157 #endif
1158 char *page;
1159 int len = 0;
1160
1161 if ((page = kmalloc(1024, GFP_KERNEL)) == NULL)
1162 return -ENOBUFS;
1163
1164 if (dent->data != NULL) {
1165 struct prochandler_t *handler = (struct prochandler_t *) dent->data;
1166 switch (handler->type) {
1167 case PROC_LED: {
1168 struct led_t * led = (struct led_t *) handler->ptr;
1169 if (led->flash) {
1170 len = sprintf(page, "f\n");
1171 } else {
1172 if (led->gpio & GPIO_TYPE_EXTIF) {
1173 len = sprintf(page, "%d\n", led->state);
1174 } else {
1175 u32 in = (gpio_in() & led->gpio ? 1 : 0);
1176 u8 p = (led->polarity == NORMAL ? 0 : 1);
1177 len = sprintf(page, "%d\n", ((in ^ p) ? 1 : 0));
1178 }
1179 }
1180 break;
1181 }
1182 case PROC_MODEL:
1183 len = sprintf(page, "%s\n", platform.name);
1184 break;
1185 case PROC_GPIOMASK:
1186 len = sprintf(page, "0x%04x\n", gpiomask);
1187 break;
1188 }
1189 }
1190 len += 1;
1191
1192 if (*ppos < len) {
1193 len = min_t(int, len - *ppos, count);
1194 if (copy_to_user(buf, (page + *ppos), len)) {
1195 kfree(page);
1196 return -EFAULT;
1197 }
1198 *ppos += len;
1199 } else {
1200 len = 0;
1201 }
1202
1203 kfree(page);
1204 return len;
1205 }
1206
1207
1208 static ssize_t diag_proc_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
1209 {
1210 #ifdef LINUX_2_4
1211 struct inode *inode = file->f_dentry->d_inode;
1212 struct proc_dir_entry *dent = inode->u.generic_ip;
1213 #else
1214 struct proc_dir_entry *dent = PDE(file->f_dentry->d_inode);
1215 #endif
1216 char *page;
1217 int ret = -EINVAL;
1218
1219 if ((page = kmalloc(count + 1, GFP_KERNEL)) == NULL)
1220 return -ENOBUFS;
1221
1222 if (copy_from_user(page, buf, count)) {
1223 kfree(page);
1224 return -EINVAL;
1225 }
1226 page[count] = 0;
1227
1228 if (dent->data != NULL) {
1229 struct prochandler_t *handler = (struct prochandler_t *) dent->data;
1230 switch (handler->type) {
1231 case PROC_LED: {
1232 struct led_t *led = (struct led_t *) handler->ptr;
1233 int p = (led->polarity == NORMAL ? 0 : 1);
1234
1235 if (page[0] == 'f') {
1236 led->flash = 1;
1237 led_flash(0);
1238 } else {
1239 led->flash = 0;
1240 if (led->gpio & GPIO_TYPE_EXTIF) {
1241 led->state = p ^ ((page[0] == '1') ? 1 : 0);
1242 set_led_extif(led);
1243 } else {
1244 gpio_outen(led->gpio, led->gpio);
1245 gpio_control(led->gpio, 0);
1246 gpio_out(led->gpio, ((p ^ (page[0] == '1')) ? led->gpio : 0));
1247 }
1248 }
1249 break;
1250 }
1251 case PROC_GPIOMASK:
1252 gpiomask = simple_strtoul(page, NULL, 0);
1253
1254 if (platform.buttons) {
1255 unregister_buttons(platform.buttons);
1256 register_buttons(platform.buttons);
1257 }
1258
1259 if (platform.leds) {
1260 unregister_leds(platform.leds);
1261 register_leds(platform.leds);
1262 }
1263 break;
1264 }
1265 ret = count;
1266 }
1267
1268 kfree(page);
1269 return ret;
1270 }
1271
1272 static int __init diag_init(void)
1273 {
1274 static struct proc_dir_entry *p;
1275 static struct platform_t *detected;
1276
1277 detected = platform_detect();
1278 if (!detected) {
1279 printk(MODULE_NAME ": Router model not detected.\n");
1280 return -ENODEV;
1281 }
1282 memcpy(&platform, detected, sizeof(struct platform_t));
1283
1284 printk(MODULE_NAME ": Detected '%s'\n", platform.name);
1285 if (platform.platform_init != NULL) {
1286 platform.platform_init();
1287 }
1288
1289 if (!(diag = proc_mkdir("diag", NULL))) {
1290 printk(MODULE_NAME ": proc_mkdir on /proc/diag failed\n");
1291 return -EINVAL;
1292 }
1293
1294 if ((p = create_proc_entry("model", S_IRUSR, diag))) {
1295 p->data = (void *) &proc_model;
1296 p->proc_fops = &diag_proc_fops;
1297 }
1298
1299 if ((p = create_proc_entry("gpiomask", S_IRUSR | S_IWUSR, diag))) {
1300 p->data = (void *) &proc_gpiomask;
1301 p->proc_fops = &diag_proc_fops;
1302 }
1303
1304 if (platform.buttons)
1305 register_buttons(platform.buttons);
1306
1307 if (platform.leds)
1308 register_leds(platform.leds);
1309
1310 return 0;
1311 }
1312
1313 static void __exit diag_exit(void)
1314 {
1315 del_timer(&led_timer);
1316
1317 if (platform.buttons)
1318 unregister_buttons(platform.buttons);
1319
1320 if (platform.leds)
1321 unregister_leds(platform.leds);
1322
1323 remove_proc_entry("model", diag);
1324 remove_proc_entry("gpiomask", diag);
1325 remove_proc_entry("diag", NULL);
1326 }
1327
1328 module_init(diag_init);
1329 module_exit(diag_exit);
1330
1331 MODULE_AUTHOR("Mike Baker, Felix Fietkau / OpenWrt.org");
1332 MODULE_LICENSE("GPL");
This page took 0.111783 seconds and 5 git commands to generate.