OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | --- a/arch/mips/ath25/ar2315.c |
2 | +++ b/arch/mips/ath25/ar2315.c |
||
3 | @@ -23,6 +23,7 @@ |
||
4 | #include <linux/reboot.h> |
||
5 | #include <linux/delay.h> |
||
6 | #include <linux/gpio.h> |
||
7 | +#include <linux/leds.h> |
||
8 | #include <asm/bootinfo.h> |
||
9 | #include <asm/reboot.h> |
||
10 | #include <asm/time.h> |
||
11 | @@ -260,6 +261,50 @@ static struct platform_device ar2315_spi |
||
12 | .num_resources = ARRAY_SIZE(ar2315_spiflash_res) |
||
13 | }; |
||
14 | |||
15 | +#ifdef CONFIG_LEDS_GPIO |
||
16 | +static struct gpio_led ar2315_leds[6]; |
||
17 | +static struct gpio_led_platform_data ar2315_led_data = { |
||
18 | + .leds = (void *)ar2315_leds, |
||
19 | +}; |
||
20 | + |
||
21 | +static struct platform_device ar2315_gpio_leds = { |
||
22 | + .name = "leds-gpio", |
||
23 | + .id = -1, |
||
24 | + .dev = { |
||
25 | + .platform_data = (void *)&ar2315_led_data, |
||
26 | + } |
||
27 | +}; |
||
28 | + |
||
29 | +static void __init ar2315_init_gpio_leds(void) |
||
30 | +{ |
||
31 | + static char led_names[6][6]; |
||
32 | + int i, led = 0; |
||
33 | + |
||
34 | + ar2315_led_data.num_leds = 0; |
||
35 | + for (i = 1; i < 8; i++) { |
||
36 | + if ((i == AR2315_RESET_GPIO) || |
||
37 | + (i == ath25_board.config->reset_config_gpio)) |
||
38 | + continue; |
||
39 | + |
||
40 | + if (i == ath25_board.config->sys_led_gpio) |
||
41 | + strcpy(led_names[led], "wlan"); |
||
42 | + else |
||
43 | + sprintf(led_names[led], "gpio%d", i); |
||
44 | + |
||
45 | + ar2315_leds[led].name = led_names[led]; |
||
46 | + ar2315_leds[led].gpio = i; |
||
47 | + ar2315_leds[led].active_low = 0; |
||
48 | + led++; |
||
49 | + } |
||
50 | + ar2315_led_data.num_leds = led; |
||
51 | + platform_device_register(&ar2315_gpio_leds); |
||
52 | +} |
||
53 | +#else |
||
54 | +static inline void ar2315_init_gpio_leds(void) |
||
55 | +{ |
||
56 | +} |
||
57 | +#endif |
||
58 | + |
||
59 | void __init ar2315_init_devices(void) |
||
60 | { |
||
61 | /* Find board configuration */ |
||
62 | @@ -270,6 +315,8 @@ void __init ar2315_init_devices(void) |
||
63 | ar2315_gpio_res[1].end = ar2315_gpio_res[1].start; |
||
64 | platform_device_register(&ar2315_gpio); |
||
65 | |||
66 | + ar2315_init_gpio_leds(); |
||
67 | + |
||
68 | ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain, |
||
69 | AR2315_MISC_IRQ_WATCHDOG); |
||
70 | ar2315_wdt_res[1].end = ar2315_wdt_res[1].start; |
||
71 | --- a/arch/mips/ath25/ar5312.c |
||
72 | +++ b/arch/mips/ath25/ar5312.c |
||
73 | @@ -23,6 +23,7 @@ |
||
74 | #include <linux/mtd/physmap.h> |
||
75 | #include <linux/reboot.h> |
||
76 | #include <linux/gpio.h> |
||
77 | +#include <linux/leds.h> |
||
78 | #include <asm/bootinfo.h> |
||
79 | #include <asm/reboot.h> |
||
80 | #include <asm/time.h> |
||
81 | @@ -231,6 +232,23 @@ static struct platform_device ar5312_gpi |
||
82 | .num_resources = ARRAY_SIZE(ar5312_gpio_res), |
||
83 | }; |
||
84 | |||
85 | +#ifdef CONFIG_LEDS_GPIO |
||
86 | +static struct gpio_led ar5312_leds[] = { |
||
87 | + { .name = "wlan", .gpio = 0, .active_low = 1, }, |
||
88 | +}; |
||
89 | + |
||
90 | +static const struct gpio_led_platform_data ar5312_led_data = { |
||
91 | + .num_leds = ARRAY_SIZE(ar5312_leds), |
||
92 | + .leds = (void *)ar5312_leds, |
||
93 | +}; |
||
94 | + |
||
95 | +static struct platform_device ar5312_gpio_leds = { |
||
96 | + .name = "leds-gpio", |
||
97 | + .id = -1, |
||
98 | + .dev.platform_data = (void *)&ar5312_led_data, |
||
99 | +}; |
||
100 | +#endif |
||
101 | + |
||
102 | static void __init ar5312_flash_init(void) |
||
103 | { |
||
104 | void __iomem *flashctl_base; |
||
105 | @@ -301,6 +319,11 @@ void __init ar5312_init_devices(void) |
||
106 | |||
107 | platform_device_register(&ar5312_gpio); |
||
108 | |||
109 | +#ifdef CONFIG_LEDS_GPIO |
||
110 | + ar5312_leds[0].gpio = config->sys_led_gpio; |
||
111 | + platform_device_register(&ar5312_gpio_leds); |
||
112 | +#endif |
||
113 | + |
||
114 | /* Fix up MAC addresses if necessary */ |
||
115 | if (is_broadcast_ether_addr(config->enet0_mac)) |
||
116 | ether_addr_copy(config->enet0_mac, config->enet1_mac); |