diff options
-rw-r--r-- | arch/arm/mach-omap1/Makefile | 8 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h2.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h3.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-osk.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-omap1/leds-h2p2-debug.c | 166 | ||||
-rw-r--r-- | arch/arm/mach-omap1/leds-innovator.c | 98 | ||||
-rw-r--r-- | arch/arm/mach-omap1/leds-osk.c | 113 | ||||
-rw-r--r-- | arch/arm/mach-omap1/leds.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-omap1/leds.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap1/time.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap1/timer32k.c | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/plat-omap/debug-leds.c | 293 |
13 files changed, 165 insertions, 687 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index 398e9e53e189..cd169c386161 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile | |||
@@ -61,14 +61,6 @@ obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o | |||
61 | obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o | 61 | obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o |
62 | obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o | 62 | obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o |
63 | 63 | ||
64 | # LEDs support | ||
65 | led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o | ||
66 | led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o | ||
67 | led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o | ||
68 | led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o | ||
69 | led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o | ||
70 | obj-$(CONFIG_LEDS) += $(led-y) | ||
71 | |||
72 | ifneq ($(CONFIG_FB_OMAP),) | 64 | ifneq ($(CONFIG_FB_OMAP),) |
73 | obj-y += lcd_dma.o | 65 | obj-y += lcd_dma.o |
74 | endif | 66 | endif |
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index a28e989a63f4..bf88046ad73f 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/i2c/tps65010.h> | 31 | #include <linux/i2c/tps65010.h> |
32 | #include <linux/smc91x.h> | 32 | #include <linux/smc91x.h> |
33 | #include <linux/omapfb.h> | 33 | #include <linux/omapfb.h> |
34 | #include <linux/leds.h> | ||
34 | 35 | ||
35 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
36 | #include <asm/mach/arch.h> | 37 | #include <asm/mach/arch.h> |
@@ -306,12 +307,39 @@ static struct platform_device h2_irda_device = { | |||
306 | .resource = h2_irda_resources, | 307 | .resource = h2_irda_resources, |
307 | }; | 308 | }; |
308 | 309 | ||
310 | static struct gpio_led h2_gpio_led_pins[] = { | ||
311 | { | ||
312 | .name = "h2:red", | ||
313 | .default_trigger = "heartbeat", | ||
314 | .gpio = 3, | ||
315 | }, | ||
316 | { | ||
317 | .name = "h2:green", | ||
318 | .default_trigger = "cpu0", | ||
319 | .gpio = OMAP_MPUIO(4), | ||
320 | }, | ||
321 | }; | ||
322 | |||
323 | static struct gpio_led_platform_data h2_gpio_led_data = { | ||
324 | .leds = h2_gpio_led_pins, | ||
325 | .num_leds = ARRAY_SIZE(h2_gpio_led_pins), | ||
326 | }; | ||
327 | |||
328 | static struct platform_device h2_gpio_leds = { | ||
329 | .name = "leds-gpio", | ||
330 | .id = -1, | ||
331 | .dev = { | ||
332 | .platform_data = &h2_gpio_led_data, | ||
333 | }, | ||
334 | }; | ||
335 | |||
309 | static struct platform_device *h2_devices[] __initdata = { | 336 | static struct platform_device *h2_devices[] __initdata = { |
310 | &h2_nor_device, | 337 | &h2_nor_device, |
311 | &h2_nand_device, | 338 | &h2_nand_device, |
312 | &h2_smc91x_device, | 339 | &h2_smc91x_device, |
313 | &h2_irda_device, | 340 | &h2_irda_device, |
314 | &h2_kp_device, | 341 | &h2_kp_device, |
342 | &h2_gpio_leds, | ||
315 | }; | 343 | }; |
316 | 344 | ||
317 | static void __init h2_init_smc91x(void) | 345 | static void __init h2_init_smc91x(void) |
@@ -406,6 +434,10 @@ static void __init h2_init(void) | |||
406 | omap_cfg_reg(E19_1610_KBR4); | 434 | omap_cfg_reg(E19_1610_KBR4); |
407 | omap_cfg_reg(N19_1610_KBR5); | 435 | omap_cfg_reg(N19_1610_KBR5); |
408 | 436 | ||
437 | /* GPIO based LEDs */ | ||
438 | omap_cfg_reg(P18_1610_GPIO3); | ||
439 | omap_cfg_reg(MPUIO4); | ||
440 | |||
409 | h2_smc91x_resources[1].start = gpio_to_irq(0); | 441 | h2_smc91x_resources[1].start = gpio_to_irq(0); |
410 | h2_smc91x_resources[1].end = gpio_to_irq(0); | 442 | h2_smc91x_resources[1].end = gpio_to_irq(0); |
411 | platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); | 443 | platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); |
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index 108a8640fc6f..c6ec9b42ca29 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/i2c/tps65010.h> | 31 | #include <linux/i2c/tps65010.h> |
32 | #include <linux/smc91x.h> | 32 | #include <linux/smc91x.h> |
33 | #include <linux/omapfb.h> | 33 | #include <linux/omapfb.h> |
34 | #include <linux/leds.h> | ||
34 | 35 | ||
35 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
36 | #include <asm/page.h> | 37 | #include <asm/page.h> |
@@ -324,6 +325,32 @@ static struct spi_board_info h3_spi_board_info[] __initdata = { | |||
324 | }, | 325 | }, |
325 | }; | 326 | }; |
326 | 327 | ||
328 | static struct gpio_led h3_gpio_led_pins[] = { | ||
329 | { | ||
330 | .name = "h3:red", | ||
331 | .default_trigger = "heartbeat", | ||
332 | .gpio = 3, | ||
333 | }, | ||
334 | { | ||
335 | .name = "h3:green", | ||
336 | .default_trigger = "cpu0", | ||
337 | .gpio = OMAP_MPUIO(4), | ||
338 | }, | ||
339 | }; | ||
340 | |||
341 | static struct gpio_led_platform_data h3_gpio_led_data = { | ||
342 | .leds = h3_gpio_led_pins, | ||
343 | .num_leds = ARRAY_SIZE(h3_gpio_led_pins), | ||
344 | }; | ||
345 | |||
346 | static struct platform_device h3_gpio_leds = { | ||
347 | .name = "leds-gpio", | ||
348 | .id = -1, | ||
349 | .dev = { | ||
350 | .platform_data = &h3_gpio_led_data, | ||
351 | }, | ||
352 | }; | ||
353 | |||
327 | static struct platform_device *devices[] __initdata = { | 354 | static struct platform_device *devices[] __initdata = { |
328 | &nor_device, | 355 | &nor_device, |
329 | &nand_device, | 356 | &nand_device, |
@@ -331,6 +358,7 @@ static struct platform_device *devices[] __initdata = { | |||
331 | &intlat_device, | 358 | &intlat_device, |
332 | &h3_kp_device, | 359 | &h3_kp_device, |
333 | &h3_lcd_device, | 360 | &h3_lcd_device, |
361 | &h3_gpio_leds, | ||
334 | }; | 362 | }; |
335 | 363 | ||
336 | static struct omap_usb_config h3_usb_config __initdata = { | 364 | static struct omap_usb_config h3_usb_config __initdata = { |
@@ -398,6 +426,10 @@ static void __init h3_init(void) | |||
398 | omap_cfg_reg(E19_1610_KBR4); | 426 | omap_cfg_reg(E19_1610_KBR4); |
399 | omap_cfg_reg(N19_1610_KBR5); | 427 | omap_cfg_reg(N19_1610_KBR5); |
400 | 428 | ||
429 | /* GPIO based LEDs */ | ||
430 | omap_cfg_reg(P18_1610_GPIO3); | ||
431 | omap_cfg_reg(MPUIO4); | ||
432 | |||
401 | smc91x_resources[1].start = gpio_to_irq(40); | 433 | smc91x_resources[1].start = gpio_to_irq(40); |
402 | smc91x_resources[1].end = gpio_to_irq(40); | 434 | smc91x_resources[1].end = gpio_to_irq(40); |
403 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 435 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index da8d872d3d1c..043412c6ce0e 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -380,10 +380,37 @@ static struct platform_device osk5912_lcd_device = { | |||
380 | .id = -1, | 380 | .id = -1, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static struct gpio_led mistral_gpio_led_pins[] = { | ||
384 | { | ||
385 | .name = "mistral:red", | ||
386 | .default_trigger = "heartbeat", | ||
387 | .gpio = 3, | ||
388 | }, | ||
389 | { | ||
390 | .name = "mistral:green", | ||
391 | .default_trigger = "cpu0", | ||
392 | .gpio = OMAP_MPUIO(4), | ||
393 | }, | ||
394 | }; | ||
395 | |||
396 | static struct gpio_led_platform_data mistral_gpio_led_data = { | ||
397 | .leds = mistral_gpio_led_pins, | ||
398 | .num_leds = ARRAY_SIZE(mistral_gpio_led_pins), | ||
399 | }; | ||
400 | |||
401 | static struct platform_device mistral_gpio_leds = { | ||
402 | .name = "leds-gpio", | ||
403 | .id = -1, | ||
404 | .dev = { | ||
405 | .platform_data = &mistral_gpio_led_data, | ||
406 | }, | ||
407 | }; | ||
408 | |||
383 | static struct platform_device *mistral_devices[] __initdata = { | 409 | static struct platform_device *mistral_devices[] __initdata = { |
384 | &osk5912_kp_device, | 410 | &osk5912_kp_device, |
385 | &mistral_bl_device, | 411 | &mistral_bl_device, |
386 | &osk5912_lcd_device, | 412 | &osk5912_lcd_device, |
413 | &mistral_gpio_leds, | ||
387 | }; | 414 | }; |
388 | 415 | ||
389 | static int mistral_get_pendown_state(void) | 416 | static int mistral_get_pendown_state(void) |
@@ -508,6 +535,12 @@ static void __init osk_mistral_init(void) | |||
508 | if (gpio_request(2, "lcd_pwr") == 0) | 535 | if (gpio_request(2, "lcd_pwr") == 0) |
509 | gpio_direction_output(2, 1); | 536 | gpio_direction_output(2, 1); |
510 | 537 | ||
538 | /* | ||
539 | * GPIO based LEDs | ||
540 | */ | ||
541 | omap_cfg_reg(P18_1610_GPIO3); | ||
542 | omap_cfg_reg(MPUIO4); | ||
543 | |||
511 | i2c_register_board_info(1, mistral_i2c_board_info, | 544 | i2c_register_board_info(1, mistral_i2c_board_info, |
512 | ARRAY_SIZE(mistral_i2c_board_info)); | 545 | ARRAY_SIZE(mistral_i2c_board_info)); |
513 | 546 | ||
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c deleted file mode 100644 index f6b14a14a957..000000000000 --- a/arch/arm/mach-omap1/leds-h2p2-debug.c +++ /dev/null | |||
@@ -1,166 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-h2p2-debug.c | ||
3 | * | ||
4 | * Copyright 2003 by Texas Instruments Incorporated | ||
5 | * | ||
6 | * There are 16 LEDs on the debug board (all green); four may be used | ||
7 | * for logical 'green', 'amber', 'red', and 'blue' (after "claiming"). | ||
8 | * | ||
9 | * The "surfer" expansion board and H2 sample board also have two-color | ||
10 | * green+red LEDs (in parallel), used here for timer and idle indicators. | ||
11 | */ | ||
12 | #include <linux/gpio.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/kernel_stat.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include <mach/hardware.h> | ||
19 | #include <asm/leds.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | |||
22 | #include <plat/fpga.h> | ||
23 | |||
24 | #include "leds.h" | ||
25 | |||
26 | |||
27 | #define GPIO_LED_RED 3 | ||
28 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
29 | |||
30 | |||
31 | #define LED_STATE_ENABLED 0x01 | ||
32 | #define LED_STATE_CLAIMED 0x02 | ||
33 | #define LED_TIMER_ON 0x04 | ||
34 | |||
35 | #define GPIO_IDLE GPIO_LED_GREEN | ||
36 | #define GPIO_TIMER GPIO_LED_RED | ||
37 | |||
38 | |||
39 | void h2p2_dbg_leds_event(led_event_t evt) | ||
40 | { | ||
41 | unsigned long flags; | ||
42 | |||
43 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
44 | static u16 led_state, hw_led_state; | ||
45 | |||
46 | local_irq_save(flags); | ||
47 | |||
48 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
49 | goto done; | ||
50 | |||
51 | switch (evt) { | ||
52 | case led_start: | ||
53 | if (!fpga) | ||
54 | fpga = ioremap(H2P2_DBG_FPGA_START, | ||
55 | H2P2_DBG_FPGA_SIZE); | ||
56 | if (fpga) { | ||
57 | led_state |= LED_STATE_ENABLED; | ||
58 | __raw_writew(~0, &fpga->leds); | ||
59 | } | ||
60 | break; | ||
61 | |||
62 | case led_stop: | ||
63 | case led_halted: | ||
64 | /* all leds off during suspend or shutdown */ | ||
65 | |||
66 | if (! machine_is_omap_perseus2()) { | ||
67 | gpio_set_value(GPIO_TIMER, 0); | ||
68 | gpio_set_value(GPIO_IDLE, 0); | ||
69 | } | ||
70 | |||
71 | __raw_writew(~0, &fpga->leds); | ||
72 | led_state &= ~LED_STATE_ENABLED; | ||
73 | if (evt == led_halted) { | ||
74 | iounmap(fpga); | ||
75 | fpga = NULL; | ||
76 | } | ||
77 | |||
78 | goto done; | ||
79 | |||
80 | case led_claim: | ||
81 | led_state |= LED_STATE_CLAIMED; | ||
82 | hw_led_state = 0; | ||
83 | break; | ||
84 | |||
85 | case led_release: | ||
86 | led_state &= ~LED_STATE_CLAIMED; | ||
87 | break; | ||
88 | |||
89 | #ifdef CONFIG_LEDS_TIMER | ||
90 | case led_timer: | ||
91 | led_state ^= LED_TIMER_ON; | ||
92 | |||
93 | if (machine_is_omap_perseus2()) | ||
94 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
95 | else { | ||
96 | gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON); | ||
97 | goto done; | ||
98 | } | ||
99 | |||
100 | break; | ||
101 | #endif | ||
102 | |||
103 | #ifdef CONFIG_LEDS_CPU | ||
104 | case led_idle_start: | ||
105 | if (machine_is_omap_perseus2()) | ||
106 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
107 | else { | ||
108 | gpio_set_value(GPIO_IDLE, 1); | ||
109 | goto done; | ||
110 | } | ||
111 | |||
112 | break; | ||
113 | |||
114 | case led_idle_end: | ||
115 | if (machine_is_omap_perseus2()) | ||
116 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
117 | else { | ||
118 | gpio_set_value(GPIO_IDLE, 0); | ||
119 | goto done; | ||
120 | } | ||
121 | |||
122 | break; | ||
123 | #endif | ||
124 | |||
125 | case led_green_on: | ||
126 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
127 | break; | ||
128 | case led_green_off: | ||
129 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
130 | break; | ||
131 | |||
132 | case led_amber_on: | ||
133 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
134 | break; | ||
135 | case led_amber_off: | ||
136 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
137 | break; | ||
138 | |||
139 | case led_red_on: | ||
140 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
141 | break; | ||
142 | case led_red_off: | ||
143 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
144 | break; | ||
145 | |||
146 | case led_blue_on: | ||
147 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
148 | break; | ||
149 | case led_blue_off: | ||
150 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
151 | break; | ||
152 | |||
153 | default: | ||
154 | break; | ||
155 | } | ||
156 | |||
157 | |||
158 | /* | ||
159 | * Actually burn the LEDs | ||
160 | */ | ||
161 | if (led_state & LED_STATE_ENABLED) | ||
162 | __raw_writew(~hw_led_state, &fpga->leds); | ||
163 | |||
164 | done: | ||
165 | local_irq_restore(flags); | ||
166 | } | ||
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c deleted file mode 100644 index 3a066ee8d02c..000000000000 --- a/arch/arm/mach-omap1/leds-innovator.c +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-innovator.c | ||
3 | */ | ||
4 | #include <linux/init.h> | ||
5 | |||
6 | #include <mach/hardware.h> | ||
7 | #include <asm/leds.h> | ||
8 | |||
9 | #include "leds.h" | ||
10 | |||
11 | |||
12 | #define LED_STATE_ENABLED 1 | ||
13 | #define LED_STATE_CLAIMED 2 | ||
14 | |||
15 | static unsigned int led_state; | ||
16 | static unsigned int hw_led_state; | ||
17 | |||
18 | void innovator_leds_event(led_event_t evt) | ||
19 | { | ||
20 | unsigned long flags; | ||
21 | |||
22 | local_irq_save(flags); | ||
23 | |||
24 | switch (evt) { | ||
25 | case led_start: | ||
26 | hw_led_state = 0; | ||
27 | led_state = LED_STATE_ENABLED; | ||
28 | break; | ||
29 | |||
30 | case led_stop: | ||
31 | led_state &= ~LED_STATE_ENABLED; | ||
32 | hw_led_state = 0; | ||
33 | break; | ||
34 | |||
35 | case led_claim: | ||
36 | led_state |= LED_STATE_CLAIMED; | ||
37 | hw_led_state = 0; | ||
38 | break; | ||
39 | |||
40 | case led_release: | ||
41 | led_state &= ~LED_STATE_CLAIMED; | ||
42 | hw_led_state = 0; | ||
43 | break; | ||
44 | |||
45 | #ifdef CONFIG_LEDS_TIMER | ||
46 | case led_timer: | ||
47 | if (!(led_state & LED_STATE_CLAIMED)) | ||
48 | hw_led_state ^= 0; | ||
49 | break; | ||
50 | #endif | ||
51 | |||
52 | #ifdef CONFIG_LEDS_CPU | ||
53 | case led_idle_start: | ||
54 | if (!(led_state & LED_STATE_CLAIMED)) | ||
55 | hw_led_state |= 0; | ||
56 | break; | ||
57 | |||
58 | case led_idle_end: | ||
59 | if (!(led_state & LED_STATE_CLAIMED)) | ||
60 | hw_led_state &= ~0; | ||
61 | break; | ||
62 | #endif | ||
63 | |||
64 | case led_halted: | ||
65 | break; | ||
66 | |||
67 | case led_green_on: | ||
68 | if (led_state & LED_STATE_CLAIMED) | ||
69 | hw_led_state &= ~0; | ||
70 | break; | ||
71 | |||
72 | case led_green_off: | ||
73 | if (led_state & LED_STATE_CLAIMED) | ||
74 | hw_led_state |= 0; | ||
75 | break; | ||
76 | |||
77 | case led_amber_on: | ||
78 | break; | ||
79 | |||
80 | case led_amber_off: | ||
81 | break; | ||
82 | |||
83 | case led_red_on: | ||
84 | if (led_state & LED_STATE_CLAIMED) | ||
85 | hw_led_state &= ~0; | ||
86 | break; | ||
87 | |||
88 | case led_red_off: | ||
89 | if (led_state & LED_STATE_CLAIMED) | ||
90 | hw_led_state |= 0; | ||
91 | break; | ||
92 | |||
93 | default: | ||
94 | break; | ||
95 | } | ||
96 | |||
97 | local_irq_restore(flags); | ||
98 | } | ||
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c deleted file mode 100644 index 936ed426b84f..000000000000 --- a/arch/arm/mach-omap1/leds-osk.c +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-osk.c | ||
3 | * | ||
4 | * LED driver for OSK with optional Mistral QVGA board | ||
5 | */ | ||
6 | #include <linux/gpio.h> | ||
7 | #include <linux/init.h> | ||
8 | |||
9 | #include <mach/hardware.h> | ||
10 | #include <asm/leds.h> | ||
11 | |||
12 | #include "leds.h" | ||
13 | |||
14 | |||
15 | #define LED_STATE_ENABLED (1 << 0) | ||
16 | #define LED_STATE_CLAIMED (1 << 1) | ||
17 | static u8 led_state; | ||
18 | |||
19 | #define TIMER_LED (1 << 3) /* Mistral board */ | ||
20 | #define IDLE_LED (1 << 4) /* Mistral board */ | ||
21 | static u8 hw_led_state; | ||
22 | |||
23 | |||
24 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
25 | |||
26 | /* For now, all system indicators require the Mistral board, since that | ||
27 | * LED can be manipulated without a task context. This LED is either red, | ||
28 | * or green, but not both; it can't give the full "disco led" effect. | ||
29 | */ | ||
30 | |||
31 | #define GPIO_LED_RED 3 | ||
32 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
33 | |||
34 | static void mistral_setled(void) | ||
35 | { | ||
36 | int red = 0; | ||
37 | int green = 0; | ||
38 | |||
39 | if (hw_led_state & TIMER_LED) | ||
40 | red = 1; | ||
41 | else if (hw_led_state & IDLE_LED) | ||
42 | green = 1; | ||
43 | /* else both sides are disabled */ | ||
44 | |||
45 | gpio_set_value(GPIO_LED_GREEN, green); | ||
46 | gpio_set_value(GPIO_LED_RED, red); | ||
47 | } | ||
48 | |||
49 | #endif | ||
50 | |||
51 | void osk_leds_event(led_event_t evt) | ||
52 | { | ||
53 | unsigned long flags; | ||
54 | u16 leds; | ||
55 | |||
56 | local_irq_save(flags); | ||
57 | |||
58 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
59 | goto done; | ||
60 | |||
61 | leds = hw_led_state; | ||
62 | switch (evt) { | ||
63 | case led_start: | ||
64 | led_state |= LED_STATE_ENABLED; | ||
65 | hw_led_state = 0; | ||
66 | leds = ~0; | ||
67 | break; | ||
68 | |||
69 | case led_halted: | ||
70 | case led_stop: | ||
71 | led_state &= ~LED_STATE_ENABLED; | ||
72 | hw_led_state = 0; | ||
73 | break; | ||
74 | |||
75 | case led_claim: | ||
76 | led_state |= LED_STATE_CLAIMED; | ||
77 | hw_led_state = 0; | ||
78 | leds = ~0; | ||
79 | break; | ||
80 | |||
81 | case led_release: | ||
82 | led_state &= ~LED_STATE_CLAIMED; | ||
83 | hw_led_state = 0; | ||
84 | break; | ||
85 | |||
86 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
87 | |||
88 | case led_timer: | ||
89 | hw_led_state ^= TIMER_LED; | ||
90 | mistral_setled(); | ||
91 | break; | ||
92 | |||
93 | case led_idle_start: /* idle == off */ | ||
94 | hw_led_state &= ~IDLE_LED; | ||
95 | mistral_setled(); | ||
96 | break; | ||
97 | |||
98 | case led_idle_end: | ||
99 | hw_led_state |= IDLE_LED; | ||
100 | mistral_setled(); | ||
101 | break; | ||
102 | |||
103 | #endif /* CONFIG_OMAP_OSK_MISTRAL */ | ||
104 | |||
105 | default: | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | leds ^= hw_led_state; | ||
110 | |||
111 | done: | ||
112 | local_irq_restore(flags); | ||
113 | } | ||
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c deleted file mode 100644 index ae6dd93b8ddc..000000000000 --- a/arch/arm/mach-omap1/leds.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds.c | ||
3 | * | ||
4 | * OMAP LEDs dispatcher | ||
5 | */ | ||
6 | #include <linux/gpio.h> | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/init.h> | ||
9 | |||
10 | #include <asm/leds.h> | ||
11 | #include <asm/mach-types.h> | ||
12 | |||
13 | #include <plat/mux.h> | ||
14 | |||
15 | #include "leds.h" | ||
16 | |||
17 | static int __init | ||
18 | omap_leds_init(void) | ||
19 | { | ||
20 | if (!cpu_class_is_omap1()) | ||
21 | return -ENODEV; | ||
22 | |||
23 | if (machine_is_omap_innovator()) | ||
24 | leds_event = innovator_leds_event; | ||
25 | |||
26 | else if (machine_is_omap_h2() | ||
27 | || machine_is_omap_h3() | ||
28 | || machine_is_omap_perseus2()) | ||
29 | leds_event = h2p2_dbg_leds_event; | ||
30 | |||
31 | else if (machine_is_omap_osk()) | ||
32 | leds_event = osk_leds_event; | ||
33 | |||
34 | else | ||
35 | return -1; | ||
36 | |||
37 | if (machine_is_omap_h2() | ||
38 | || machine_is_omap_h3() | ||
39 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
40 | || machine_is_omap_osk() | ||
41 | #endif | ||
42 | ) { | ||
43 | |||
44 | /* LED1/LED2 pins can be used as GPIO (as done here), or by | ||
45 | * the LPG (works even in deep sleep!), to drive a bicolor | ||
46 | * LED on the H2 sample board, and another on the H2/P2 | ||
47 | * "surfer" expansion board. | ||
48 | * | ||
49 | * The same pins drive a LED on the OSK Mistral board, but | ||
50 | * that's a different kind of LED (just one color at a time). | ||
51 | */ | ||
52 | omap_cfg_reg(P18_1610_GPIO3); | ||
53 | if (gpio_request(3, "LED red") == 0) | ||
54 | gpio_direction_output(3, 1); | ||
55 | else | ||
56 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); | ||
57 | |||
58 | omap_cfg_reg(MPUIO4); | ||
59 | if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) | ||
60 | gpio_direction_output(OMAP_MPUIO(4), 1); | ||
61 | else | ||
62 | printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); | ||
63 | } | ||
64 | |||
65 | leds_event(led_start); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | __initcall(omap_leds_init); | ||
diff --git a/arch/arm/mach-omap1/leds.h b/arch/arm/mach-omap1/leds.h deleted file mode 100644 index a1e9fedc376c..000000000000 --- a/arch/arm/mach-omap1/leds.h +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | extern void innovator_leds_event(led_event_t evt); | ||
2 | extern void h2p2_dbg_leds_event(led_event_t evt); | ||
3 | extern void osk_leds_event(led_event_t evt); | ||
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index 4062480bfec7..4d4816fd6fc9 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/clockchips.h> | 44 | #include <linux/clockchips.h> |
45 | #include <linux/io.h> | 45 | #include <linux/io.h> |
46 | 46 | ||
47 | #include <asm/leds.h> | ||
48 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
49 | #include <asm/sched_clock.h> | 48 | #include <asm/sched_clock.h> |
50 | 49 | ||
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index eae49c3980c9..74529549130c 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/clockchips.h> | 46 | #include <linux/clockchips.h> |
47 | #include <linux/io.h> | 47 | #include <linux/io.h> |
48 | 48 | ||
49 | #include <asm/leds.h> | ||
50 | #include <asm/irq.h> | 49 | #include <asm/irq.h> |
51 | #include <asm/mach/irq.h> | 50 | #include <asm/mach/irq.h> |
52 | #include <asm/mach/time.h> | 51 | #include <asm/mach/time.h> |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index ad95c7a5d009..aa8e66857edd 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -41,9 +41,8 @@ config OMAP_DEBUG_DEVICES | |||
41 | For debug cards on TI reference boards. | 41 | For debug cards on TI reference boards. |
42 | 42 | ||
43 | config OMAP_DEBUG_LEDS | 43 | config OMAP_DEBUG_LEDS |
44 | bool | 44 | def_bool y if NEW_LEDS |
45 | depends on OMAP_DEBUG_DEVICES | 45 | depends on OMAP_DEBUG_DEVICES |
46 | default y if LEDS_CLASS | ||
47 | 46 | ||
48 | config OMAP_SMARTREFLEX | 47 | config OMAP_SMARTREFLEX |
49 | bool "SmartReflex support" | 48 | bool "SmartReflex support" |
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c index 39407cbe34c6..24e23f3dd6a8 100644 --- a/arch/arm/plat-omap/debug-leds.c +++ b/arch/arm/plat-omap/debug-leds.c | |||
@@ -1,279 +1,118 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/plat-omap/debug-leds.c | 2 | * linux/arch/arm/plat-omap/debug-leds.c |
3 | * | 3 | * |
4 | * Copyright 2011 by Bryan Wu <bryan.wu@canonical.com> | ||
4 | * Copyright 2003 by Texas Instruments Incorporated | 5 | * Copyright 2003 by Texas Instruments Incorporated |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
9 | */ | 10 | */ |
10 | #include <linux/gpio.h> | 11 | |
12 | #include <linux/kernel.h> | ||
11 | #include <linux/init.h> | 13 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
13 | #include <linux/leds.h> | 15 | #include <linux/leds.h> |
14 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/slab.h> | ||
15 | 18 | ||
16 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
17 | #include <asm/leds.h> | ||
18 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
19 | 21 | ||
20 | #include <plat/fpga.h> | 22 | #include <plat/fpga.h> |
21 | 23 | ||
22 | |||
23 | /* Many OMAP development platforms reuse the same "debug board"; these | 24 | /* Many OMAP development platforms reuse the same "debug board"; these |
24 | * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the | 25 | * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the |
25 | * debug board (all green), accessed through FPGA registers. | 26 | * debug board (all green), accessed through FPGA registers. |
26 | * | ||
27 | * The "surfer" expansion board and H2 sample board also have two-color | ||
28 | * green+red LEDs (in parallel), used here for timer and idle indicators | ||
29 | * in preference to the ones on the debug board, for a "Disco LED" effect. | ||
30 | * | ||
31 | * This driver exports either the original ARM LED API, the new generic | ||
32 | * one, or both. | ||
33 | */ | ||
34 | |||
35 | static spinlock_t lock; | ||
36 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
37 | static u16 led_state, hw_led_state; | ||
38 | |||
39 | |||
40 | #ifdef CONFIG_OMAP_DEBUG_LEDS | ||
41 | #define new_led_api() 1 | ||
42 | #else | ||
43 | #define new_led_api() 0 | ||
44 | #endif | ||
45 | |||
46 | |||
47 | /*-------------------------------------------------------------------------*/ | ||
48 | |||
49 | /* original ARM debug LED API: | ||
50 | * - timer and idle leds (some boards use non-FPGA leds here); | ||
51 | * - up to 4 generic leds, easily accessed in-kernel (any context) | ||
52 | */ | 27 | */ |
53 | 28 | ||
54 | #define GPIO_LED_RED 3 | 29 | static struct h2p2_dbg_fpga __iomem *fpga; |
55 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
56 | |||
57 | #define LED_STATE_ENABLED 0x01 | ||
58 | #define LED_STATE_CLAIMED 0x02 | ||
59 | #define LED_TIMER_ON 0x04 | ||
60 | |||
61 | #define GPIO_IDLE GPIO_LED_GREEN | ||
62 | #define GPIO_TIMER GPIO_LED_RED | ||
63 | |||
64 | static void h2p2_dbg_leds_event(led_event_t evt) | ||
65 | { | ||
66 | unsigned long flags; | ||
67 | |||
68 | spin_lock_irqsave(&lock, flags); | ||
69 | |||
70 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
71 | goto done; | ||
72 | |||
73 | switch (evt) { | ||
74 | case led_start: | ||
75 | if (fpga) | ||
76 | led_state |= LED_STATE_ENABLED; | ||
77 | break; | ||
78 | |||
79 | case led_stop: | ||
80 | case led_halted: | ||
81 | /* all leds off during suspend or shutdown */ | ||
82 | |||
83 | if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { | ||
84 | gpio_set_value(GPIO_TIMER, 0); | ||
85 | gpio_set_value(GPIO_IDLE, 0); | ||
86 | } | ||
87 | |||
88 | __raw_writew(~0, &fpga->leds); | ||
89 | led_state &= ~LED_STATE_ENABLED; | ||
90 | goto done; | ||
91 | |||
92 | case led_claim: | ||
93 | led_state |= LED_STATE_CLAIMED; | ||
94 | hw_led_state = 0; | ||
95 | break; | ||
96 | |||
97 | case led_release: | ||
98 | led_state &= ~LED_STATE_CLAIMED; | ||
99 | break; | ||
100 | |||
101 | #ifdef CONFIG_LEDS_TIMER | ||
102 | case led_timer: | ||
103 | led_state ^= LED_TIMER_ON; | ||
104 | |||
105 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
106 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
107 | else { | ||
108 | gpio_set_value(GPIO_TIMER, | ||
109 | led_state & LED_TIMER_ON); | ||
110 | goto done; | ||
111 | } | ||
112 | |||
113 | break; | ||
114 | #endif | ||
115 | |||
116 | #ifdef CONFIG_LEDS_CPU | ||
117 | /* LED lit iff busy */ | ||
118 | case led_idle_start: | ||
119 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
120 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
121 | else { | ||
122 | gpio_set_value(GPIO_IDLE, 1); | ||
123 | goto done; | ||
124 | } | ||
125 | |||
126 | break; | ||
127 | 30 | ||
128 | case led_idle_end: | 31 | static u16 fpga_led_state; |
129 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
130 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
131 | else { | ||
132 | gpio_set_value(GPIO_IDLE, 0); | ||
133 | goto done; | ||
134 | } | ||
135 | |||
136 | break; | ||
137 | #endif | ||
138 | |||
139 | case led_green_on: | ||
140 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
141 | break; | ||
142 | case led_green_off: | ||
143 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
144 | break; | ||
145 | |||
146 | case led_amber_on: | ||
147 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
148 | break; | ||
149 | case led_amber_off: | ||
150 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
151 | break; | ||
152 | |||
153 | case led_red_on: | ||
154 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
155 | break; | ||
156 | case led_red_off: | ||
157 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
158 | break; | ||
159 | |||
160 | case led_blue_on: | ||
161 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
162 | break; | ||
163 | case led_blue_off: | ||
164 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
165 | break; | ||
166 | |||
167 | default: | ||
168 | break; | ||
169 | } | ||
170 | |||
171 | |||
172 | /* | ||
173 | * Actually burn the LEDs | ||
174 | */ | ||
175 | if (led_state & LED_STATE_ENABLED) | ||
176 | __raw_writew(~hw_led_state, &fpga->leds); | ||
177 | |||
178 | done: | ||
179 | spin_unlock_irqrestore(&lock, flags); | ||
180 | } | ||
181 | |||
182 | /*-------------------------------------------------------------------------*/ | ||
183 | |||
184 | /* "new" LED API | ||
185 | * - with syfs access and generic triggering | ||
186 | * - not readily accessible to in-kernel drivers | ||
187 | */ | ||
188 | 32 | ||
189 | struct dbg_led { | 33 | struct dbg_led { |
190 | struct led_classdev cdev; | 34 | struct led_classdev cdev; |
191 | u16 mask; | 35 | u16 mask; |
192 | }; | 36 | }; |
193 | 37 | ||
194 | static struct dbg_led dbg_leds[] = { | 38 | static const struct { |
195 | /* REVISIT at least H2 uses different timer & cpu leds... */ | 39 | const char *name; |
196 | #ifndef CONFIG_LEDS_TIMER | 40 | const char *trigger; |
197 | { .mask = 1 << 0, .cdev.name = "d4:green", | 41 | } dbg_leds[] = { |
198 | .cdev.default_trigger = "heartbeat", }, | 42 | { "dbg:d4", "heartbeat", }, |
199 | #endif | 43 | { "dbg:d5", "cpu0", }, |
200 | #ifndef CONFIG_LEDS_CPU | 44 | { "dbg:d6", "default-on", }, |
201 | { .mask = 1 << 1, .cdev.name = "d5:green", }, /* !idle */ | 45 | { "dbg:d7", }, |
202 | #endif | 46 | { "dbg:d8", }, |
203 | { .mask = 1 << 2, .cdev.name = "d6:green", }, | 47 | { "dbg:d9", }, |
204 | { .mask = 1 << 3, .cdev.name = "d7:green", }, | 48 | { "dbg:d10", }, |
205 | 49 | { "dbg:d11", }, | |
206 | { .mask = 1 << 4, .cdev.name = "d8:green", }, | 50 | { "dbg:d12", }, |
207 | { .mask = 1 << 5, .cdev.name = "d9:green", }, | 51 | { "dbg:d13", }, |
208 | { .mask = 1 << 6, .cdev.name = "d10:green", }, | 52 | { "dbg:d14", }, |
209 | { .mask = 1 << 7, .cdev.name = "d11:green", }, | 53 | { "dbg:d15", }, |
210 | 54 | { "dbg:d16", }, | |
211 | { .mask = 1 << 8, .cdev.name = "d12:green", }, | 55 | { "dbg:d17", }, |
212 | { .mask = 1 << 9, .cdev.name = "d13:green", }, | 56 | { "dbg:d18", }, |
213 | { .mask = 1 << 10, .cdev.name = "d14:green", }, | 57 | { "dbg:d19", }, |
214 | { .mask = 1 << 11, .cdev.name = "d15:green", }, | ||
215 | |||
216 | #ifndef CONFIG_LEDS | ||
217 | { .mask = 1 << 12, .cdev.name = "d16:green", }, | ||
218 | { .mask = 1 << 13, .cdev.name = "d17:green", }, | ||
219 | { .mask = 1 << 14, .cdev.name = "d18:green", }, | ||
220 | { .mask = 1 << 15, .cdev.name = "d19:green", }, | ||
221 | #endif | ||
222 | }; | 58 | }; |
223 | 59 | ||
224 | static void | 60 | /* |
225 | fpga_led_set(struct led_classdev *cdev, enum led_brightness value) | 61 | * The triggers lines up below will only be used if the |
62 | * LED triggers are compiled in. | ||
63 | */ | ||
64 | static void dbg_led_set(struct led_classdev *cdev, | ||
65 | enum led_brightness b) | ||
226 | { | 66 | { |
227 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); | 67 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); |
228 | unsigned long flags; | 68 | u16 reg; |
229 | 69 | ||
230 | spin_lock_irqsave(&lock, flags); | 70 | reg = __raw_readw(&fpga->leds); |
231 | if (value == LED_OFF) | 71 | if (b != LED_OFF) |
232 | hw_led_state &= ~led->mask; | 72 | reg |= led->mask; |
233 | else | 73 | else |
234 | hw_led_state |= led->mask; | 74 | reg &= ~led->mask; |
235 | __raw_writew(~hw_led_state, &fpga->leds); | 75 | __raw_writew(reg, &fpga->leds); |
236 | spin_unlock_irqrestore(&lock, flags); | ||
237 | } | 76 | } |
238 | 77 | ||
239 | static void __init newled_init(struct device *dev) | 78 | static enum led_brightness dbg_led_get(struct led_classdev *cdev) |
240 | { | 79 | { |
241 | unsigned i; | 80 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); |
242 | struct dbg_led *led; | 81 | u16 reg; |
243 | int status; | ||
244 | 82 | ||
245 | for (i = 0, led = dbg_leds; i < ARRAY_SIZE(dbg_leds); i++, led++) { | 83 | reg = __raw_readw(&fpga->leds); |
246 | led->cdev.brightness_set = fpga_led_set; | 84 | return (reg & led->mask) ? LED_FULL : LED_OFF; |
247 | status = led_classdev_register(dev, &led->cdev); | ||
248 | if (status < 0) | ||
249 | break; | ||
250 | } | ||
251 | return; | ||
252 | } | 85 | } |
253 | 86 | ||
254 | 87 | static int fpga_probe(struct platform_device *pdev) | |
255 | /*-------------------------------------------------------------------------*/ | ||
256 | |||
257 | static int /* __init */ fpga_probe(struct platform_device *pdev) | ||
258 | { | 88 | { |
259 | struct resource *iomem; | 89 | struct resource *iomem; |
260 | 90 | int i; | |
261 | spin_lock_init(&lock); | ||
262 | 91 | ||
263 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 92 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
264 | if (!iomem) | 93 | if (!iomem) |
265 | return -ENODEV; | 94 | return -ENODEV; |
266 | 95 | ||
267 | fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); | 96 | fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); |
268 | __raw_writew(~0, &fpga->leds); | 97 | __raw_writew(0xff, &fpga->leds); |
98 | |||
99 | for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) { | ||
100 | struct dbg_led *led; | ||
101 | |||
102 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
103 | if (!led) | ||
104 | break; | ||
269 | 105 | ||
270 | #ifdef CONFIG_LEDS | 106 | led->cdev.name = dbg_leds[i].name; |
271 | leds_event = h2p2_dbg_leds_event; | 107 | led->cdev.brightness_set = dbg_led_set; |
272 | leds_event(led_start); | 108 | led->cdev.brightness_get = dbg_led_get; |
273 | #endif | 109 | led->cdev.default_trigger = dbg_leds[i].trigger; |
110 | led->mask = BIT(i); | ||
274 | 111 | ||
275 | if (new_led_api()) { | 112 | if (led_classdev_register(NULL, &led->cdev) < 0) { |
276 | newled_init(&pdev->dev); | 113 | kfree(led); |
114 | break; | ||
115 | } | ||
277 | } | 116 | } |
278 | 117 | ||
279 | return 0; | 118 | return 0; |
@@ -281,13 +120,15 @@ static int /* __init */ fpga_probe(struct platform_device *pdev) | |||
281 | 120 | ||
282 | static int fpga_suspend_noirq(struct device *dev) | 121 | static int fpga_suspend_noirq(struct device *dev) |
283 | { | 122 | { |
284 | __raw_writew(~0, &fpga->leds); | 123 | fpga_led_state = __raw_readw(&fpga->leds); |
124 | __raw_writew(0xff, &fpga->leds); | ||
125 | |||
285 | return 0; | 126 | return 0; |
286 | } | 127 | } |
287 | 128 | ||
288 | static int fpga_resume_noirq(struct device *dev) | 129 | static int fpga_resume_noirq(struct device *dev) |
289 | { | 130 | { |
290 | __raw_writew(~hw_led_state, &fpga->leds); | 131 | __raw_writew(~fpga_led_state, &fpga->leds); |
291 | return 0; | 132 | return 0; |
292 | } | 133 | } |
293 | 134 | ||