diff options
author | Mike Rapoport <mike@compulab.co.il> | 2007-09-23 10:59:26 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-10-15 13:53:57 -0400 |
commit | 3696a8a426f8caebd97463e9b5cf9f06c1c36759 (patch) | |
tree | 217d5ef3219b335f72360cfa7f0f1731443b09bb /drivers/leds | |
parent | 3e0cc7ee045fb53e8215fed7442455c0cee0ee93 (diff) |
[ARM] 4576/1: CM-X270 machine support
This patch provides core support for CM-X270 platform.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/Kconfig | 6 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-cm-x270.c | 122 |
3 files changed, 129 insertions, 0 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 3cb23210b912..257b44094e4c 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -108,6 +108,12 @@ config LEDS_GPIO | |||
108 | outputs. To be useful the particular board must have LEDs | 108 | outputs. To be useful the particular board must have LEDs |
109 | and they must be connected to the GPIO lines. | 109 | and they must be connected to the GPIO lines. |
110 | 110 | ||
111 | config LEDS_CM_X270 | ||
112 | tristate "LED Support for the CM-X270 LEDs" | ||
113 | depends on LEDS_CLASS && MACH_ARMCORE | ||
114 | help | ||
115 | This option enables support for the CM-X270 LEDs. | ||
116 | |||
111 | comment "LED Triggers" | 117 | comment "LED Triggers" |
112 | 118 | ||
113 | config LEDS_TRIGGERS | 119 | config LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index d2ca1abbc3d2..a60de1b46c2c 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -18,6 +18,7 @@ obj-$(CONFIG_LEDS_H1940) += leds-h1940.o | |||
18 | obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o | 18 | obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o |
19 | obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o | 19 | obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o |
20 | obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o | 20 | obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o |
21 | obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o | ||
21 | 22 | ||
22 | # LED Triggers | 23 | # LED Triggers |
23 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 24 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o |
diff --git a/drivers/leds/leds-cm-x270.c b/drivers/leds/leds-cm-x270.c new file mode 100644 index 000000000000..9aebef02a974 --- /dev/null +++ b/drivers/leds/leds-cm-x270.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * drivers/leds/leds-cm-x270.c | ||
3 | * | ||
4 | * Copyright 2007 CompuLab Ltd. | ||
5 | * Author: Mike Rapoport <mike@compulab.co.il> | ||
6 | * | ||
7 | * Based on leds-corgi.c | ||
8 | * Author: Richard Purdie <rpurdie@openedhand.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/leds.h> | ||
20 | |||
21 | #include <asm/arch/hardware.h> | ||
22 | #include <asm/arch/pxa-regs.h> | ||
23 | |||
24 | #define GPIO_RED_LED (93) | ||
25 | #define GPIO_GREEN_LED (94) | ||
26 | |||
27 | static void cmx270_red_set(struct led_classdev *led_cdev, | ||
28 | enum led_brightness value) | ||
29 | { | ||
30 | if (value) | ||
31 | GPCR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED); | ||
32 | else | ||
33 | GPSR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED); | ||
34 | } | ||
35 | |||
36 | static void cmx270_green_set(struct led_classdev *led_cdev, | ||
37 | enum led_brightness value) | ||
38 | { | ||
39 | if (value) | ||
40 | GPCR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED); | ||
41 | else | ||
42 | GPSR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED); | ||
43 | } | ||
44 | |||
45 | static struct led_classdev cmx270_red_led = { | ||
46 | .name = "cm-x270:red", | ||
47 | .default_trigger = "nand-disk", | ||
48 | .brightness_set = cmx270_red_set, | ||
49 | }; | ||
50 | |||
51 | static struct led_classdev cmx270_green_led = { | ||
52 | .name = "cm-x270:green", | ||
53 | .default_trigger = "heartbeat", | ||
54 | .brightness_set = cmx270_green_set, | ||
55 | }; | ||
56 | |||
57 | #ifdef CONFIG_PM | ||
58 | static int cmx270led_suspend(struct platform_device *dev, pm_message_t state) | ||
59 | { | ||
60 | led_classdev_suspend(&cmx270_red_led); | ||
61 | led_classdev_suspend(&cmx270_green_led); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static int cmx270led_resume(struct platform_device *dev) | ||
66 | { | ||
67 | led_classdev_resume(&cmx270_red_led); | ||
68 | led_classdev_resume(&cmx270_green_led); | ||
69 | return 0; | ||
70 | } | ||
71 | #endif | ||
72 | |||
73 | static int cmx270led_probe(struct platform_device *pdev) | ||
74 | { | ||
75 | int ret; | ||
76 | |||
77 | ret = led_classdev_register(&pdev->dev, &cmx270_red_led); | ||
78 | if (ret < 0) | ||
79 | return ret; | ||
80 | |||
81 | ret = led_classdev_register(&pdev->dev, &cmx270_green_led); | ||
82 | if (ret < 0) | ||
83 | led_classdev_unregister(&cmx270_red_led); | ||
84 | |||
85 | return ret; | ||
86 | } | ||
87 | |||
88 | static int cmx270led_remove(struct platform_device *pdev) | ||
89 | { | ||
90 | led_classdev_unregister(&cmx270_red_led); | ||
91 | led_classdev_unregister(&cmx270_green_led); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static struct platform_driver cmx270led_driver = { | ||
96 | .probe = cmx270led_probe, | ||
97 | .remove = cmx270led_remove, | ||
98 | #ifdef CONFIG_PM | ||
99 | .suspend = cmx270led_suspend, | ||
100 | .resume = cmx270led_resume, | ||
101 | #endif | ||
102 | .driver = { | ||
103 | .name = "cm-x270-led", | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | static int __init cmx270led_init(void) | ||
108 | { | ||
109 | return platform_driver_register(&cmx270led_driver); | ||
110 | } | ||
111 | |||
112 | static void __exit cmx270led_exit(void) | ||
113 | { | ||
114 | platform_driver_unregister(&cmx270led_driver); | ||
115 | } | ||
116 | |||
117 | module_init(cmx270led_init); | ||
118 | module_exit(cmx270led_exit); | ||
119 | |||
120 | MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); | ||
121 | MODULE_DESCRIPTION("CM-x270 LED driver"); | ||
122 | MODULE_LICENSE("GPL"); | ||