aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/Kconfig14
-rw-r--r--drivers/leds/Makefile4
-rw-r--r--drivers/leds/leds-corgi.c121
-rw-r--r--drivers/leds/leds-spitz.c125
4 files changed, 264 insertions, 0 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index fda44df5921f..f7846b40c842 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -22,6 +22,20 @@ config LEDS_TRIGGERS
22 These triggers allow kernel events to drive the LEDs and can 22 These triggers allow kernel events to drive the LEDs and can
23 be configured via sysfs. If unsure, say Y. 23 be configured via sysfs. If unsure, say Y.
24 24
25config LEDS_CORGI
26 tristate "LED Support for the Sharp SL-C7x0 series"
27 depends LEDS_CLASS && PXA_SHARP_C7xx
28 help
29 This option enables support for the LEDs on Sharp Zaurus
30 SL-C7x0 series (C700, C750, C760, C860).
31
32config LEDS_SPITZ
33 tristate "LED Support for the Sharp SL-Cxx00 series"
34 depends LEDS_CLASS && PXA_SHARP_Cxx00
35 help
36 This option enables support for the LEDs on Sharp Zaurus
37 SL-Cxx00 series (C1000, C3000, C3100).
38
25config LEDS_TRIGGER_TIMER 39config LEDS_TRIGGER_TIMER
26 tristate "LED Timer Trigger" 40 tristate "LED Timer Trigger"
27 depends LEDS_TRIGGERS 41 depends LEDS_TRIGGERS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 81e4abb9dcb0..cb5d0ada6a8c 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -4,5 +4,9 @@ obj-$(CONFIG_NEW_LEDS) += led-core.o
4obj-$(CONFIG_LEDS_CLASS) += led-class.o 4obj-$(CONFIG_LEDS_CLASS) += led-class.o
5obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o 5obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
6 6
7# LED Platform Drivers
8obj-$(CONFIG_LEDS_CORGI) += leds-corgi.o
9obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o
10
7# LED Triggers 11# LED Triggers
8obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o 12obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
diff --git a/drivers/leds/leds-corgi.c b/drivers/leds/leds-corgi.c
new file mode 100644
index 000000000000..bb7d84df0121
--- /dev/null
+++ b/drivers/leds/leds-corgi.c
@@ -0,0 +1,121 @@
1/*
2 * LED Triggers Core
3 *
4 * Copyright 2005-2006 Openedhand Ltd.
5 *
6 * Author: Richard Purdie <rpurdie@openedhand.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/config.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/leds.h>
19#include <asm/mach-types.h>
20#include <asm/arch/corgi.h>
21#include <asm/arch/hardware.h>
22#include <asm/arch/pxa-regs.h>
23#include <asm/hardware/scoop.h>
24
25static void corgiled_amber_set(struct led_classdev *led_cdev, enum led_brightness value)
26{
27 if (value)
28 GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
29 else
30 GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
31}
32
33static void corgiled_green_set(struct led_classdev *led_cdev, enum led_brightness value)
34{
35 if (value)
36 set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
37 else
38 reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN);
39}
40
41static struct led_classdev corgi_amber_led = {
42 .name = "corgi:amber",
43 .default_trigger = "sharpsl-charge",
44 .brightness_set = corgiled_amber_set,
45};
46
47static struct led_classdev corgi_green_led = {
48 .name = "corgi:green",
49 .default_trigger = "nand-disk",
50 .brightness_set = corgiled_green_set,
51};
52
53#ifdef CONFIG_PM
54static int corgiled_suspend(struct platform_device *dev, pm_message_t state)
55{
56#ifdef CONFIG_LEDS_TRIGGERS
57 if (corgi_amber_led.trigger && strcmp(corgi_amber_led.trigger->name, "sharpsl-charge"))
58#endif
59 led_classdev_suspend(&corgi_amber_led);
60 led_classdev_suspend(&corgi_green_led);
61 return 0;
62}
63
64static int corgiled_resume(struct platform_device *dev)
65{
66 led_classdev_resume(&corgi_amber_led);
67 led_classdev_resume(&corgi_green_led);
68 return 0;
69}
70#endif
71
72static int corgiled_probe(struct platform_device *pdev)
73{
74 int ret;
75
76 ret = led_classdev_register(&pdev->dev, &corgi_amber_led);
77 if (ret < 0)
78 return ret;
79
80 ret = led_classdev_register(&pdev->dev, &corgi_green_led);
81 if (ret < 0)
82 led_classdev_unregister(&corgi_amber_led);
83
84 return ret;
85}
86
87static int corgiled_remove(struct platform_device *pdev)
88{
89 led_classdev_unregister(&corgi_amber_led);
90 led_classdev_unregister(&corgi_green_led);
91 return 0;
92}
93
94static struct platform_driver corgiled_driver = {
95 .probe = corgiled_probe,
96 .remove = corgiled_remove,
97#ifdef CONFIG_PM
98 .suspend = corgiled_suspend,
99 .resume = corgiled_resume,
100#endif
101 .driver = {
102 .name = "corgi-led",
103 },
104};
105
106static int __init corgiled_init(void)
107{
108 return platform_driver_register(&corgiled_driver);
109}
110
111static void __exit corgiled_exit(void)
112{
113 platform_driver_unregister(&corgiled_driver);
114}
115
116module_init(corgiled_init);
117module_exit(corgiled_exit);
118
119MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
120MODULE_DESCRIPTION("Corgi LED driver");
121MODULE_LICENSE("GPL");
diff --git a/drivers/leds/leds-spitz.c b/drivers/leds/leds-spitz.c
new file mode 100644
index 000000000000..65bbef4a5e09
--- /dev/null
+++ b/drivers/leds/leds-spitz.c
@@ -0,0 +1,125 @@
1/*
2 * LED Triggers Core
3 *
4 * Copyright 2005-2006 Openedhand Ltd.
5 *
6 * Author: Richard Purdie <rpurdie@openedhand.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/config.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/leds.h>
19#include <asm/hardware/scoop.h>
20#include <asm/mach-types.h>
21#include <asm/arch/hardware.h>
22#include <asm/arch/pxa-regs.h>
23#include <asm/arch/spitz.h>
24
25static void spitzled_amber_set(struct led_classdev *led_cdev, enum led_brightness value)
26{
27 if (value)
28 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
29 else
30 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
31}
32
33static void spitzled_green_set(struct led_classdev *led_cdev, enum led_brightness value)
34{
35 if (value)
36 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
37 else
38 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
39}
40
41static struct led_classdev spitz_amber_led = {
42 .name = "spitz:amber",
43 .default_trigger = "sharpsl-charge",
44 .brightness_set = spitzled_amber_set,
45};
46
47static struct led_classdev spitz_green_led = {
48 .name = "spitz:green",
49 .default_trigger = "ide-disk",
50 .brightness_set = spitzled_green_set,
51};
52
53#ifdef CONFIG_PM
54static int spitzled_suspend(struct platform_device *dev, pm_message_t state)
55{
56#ifdef CONFIG_LEDS_TRIGGERS
57 if (spitz_amber_led.trigger && strcmp(spitz_amber_led.trigger->name, "sharpsl-charge"))
58#endif
59 led_classdev_suspend(&spitz_amber_led);
60 led_classdev_suspend(&spitz_green_led);
61 return 0;
62}
63
64static int spitzled_resume(struct platform_device *dev)
65{
66 led_classdev_resume(&spitz_amber_led);
67 led_classdev_resume(&spitz_green_led);
68 return 0;
69}
70#endif
71
72static int spitzled_probe(struct platform_device *pdev)
73{
74 int ret;
75
76 if (machine_is_akita())
77 spitz_green_led.default_trigger = "nand-disk";
78
79 ret = led_classdev_register(&pdev->dev, &spitz_amber_led);
80 if (ret < 0)
81 return ret;
82
83 ret = led_classdev_register(&pdev->dev, &spitz_green_led);
84 if (ret < 0)
85 led_classdev_unregister(&spitz_amber_led);
86
87 return ret;
88}
89
90static int spitzled_remove(struct platform_device *pdev)
91{
92 led_classdev_unregister(&spitz_amber_led);
93 led_classdev_unregister(&spitz_green_led);
94
95 return 0;
96}
97
98static struct platform_driver spitzled_driver = {
99 .probe = spitzled_probe,
100 .remove = spitzled_remove,
101#ifdef CONFIG_PM
102 .suspend = spitzled_suspend,
103 .resume = spitzled_resume,
104#endif
105 .driver = {
106 .name = "spitz-led",
107 },
108};
109
110static int __init spitzled_init(void)
111{
112 return platform_driver_register(&spitzled_driver);
113}
114
115static void __exit spitzled_exit(void)
116{
117 platform_driver_unregister(&spitzled_driver);
118}
119
120module_init(spitzled_init);
121module_exit(spitzled_exit);
122
123MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
124MODULE_DESCRIPTION("Spitz LED driver");
125MODULE_LICENSE("GPL");