diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/leds/Kconfig | 7 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-tosa.c | 131 |
3 files changed, 139 insertions, 0 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index d9e2f9853b9d..64dcdd3185c0 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -52,6 +52,13 @@ config LEDS_IXP4XX | |||
52 | particular board must have LEDs and they must be connected | 52 | particular board must have LEDs and they must be connected |
53 | to the GPIO lines. If unsure, say Y. | 53 | to the GPIO lines. If unsure, say Y. |
54 | 54 | ||
55 | config LEDS_TOSA | ||
56 | tristate "LED Support for the Sharp SL-6000 series" | ||
57 | depends LEDS_CLASS && PXA_SHARPSL | ||
58 | help | ||
59 | This option enables support for the LEDs on Sharp Zaurus | ||
60 | SL-6000 series. | ||
61 | |||
55 | config LEDS_TRIGGER_TIMER | 62 | config LEDS_TRIGGER_TIMER |
56 | tristate "LED Timer Trigger" | 63 | tristate "LED Timer Trigger" |
57 | depends LEDS_TRIGGERS | 64 | depends LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index b1187c0b36ce..9d2930f89d03 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -9,6 +9,7 @@ obj-$(CONFIG_LEDS_CORGI) += leds-corgi.o | |||
9 | obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o | 9 | obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o |
10 | obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o | 10 | obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o |
11 | obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o | 11 | obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o |
12 | obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o | ||
12 | 13 | ||
13 | # LED Triggers | 14 | # LED Triggers |
14 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 15 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o |
diff --git a/drivers/leds/leds-tosa.c b/drivers/leds/leds-tosa.c new file mode 100644 index 000000000000..c9e8cc1ec481 --- /dev/null +++ b/drivers/leds/leds-tosa.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * LED Triggers Core | ||
3 | * | ||
4 | * Copyright 2005 Dirk Opfer | ||
5 | * | ||
6 | * Author: Dirk Opfer <Dirk@Opfer-Online.de> | ||
7 | * based on spitz.c | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/leds.h> | ||
20 | #include <asm/hardware/scoop.h> | ||
21 | #include <asm/mach-types.h> | ||
22 | #include <asm/arch/hardware.h> | ||
23 | #include <asm/arch/pxa-regs.h> | ||
24 | #include <asm/arch/tosa.h> | ||
25 | |||
26 | static void tosaled_amber_set(struct led_classdev *led_cdev, | ||
27 | enum led_brightness value) | ||
28 | { | ||
29 | if (value) | ||
30 | set_scoop_gpio(&tosascoop_jc_device.dev, | ||
31 | TOSA_SCOOP_JC_CHRG_ERR_LED); | ||
32 | else | ||
33 | reset_scoop_gpio(&tosascoop_jc_device.dev, | ||
34 | TOSA_SCOOP_JC_CHRG_ERR_LED); | ||
35 | } | ||
36 | |||
37 | static void tosaled_green_set(struct led_classdev *led_cdev, | ||
38 | enum led_brightness value) | ||
39 | { | ||
40 | if (value) | ||
41 | set_scoop_gpio(&tosascoop_jc_device.dev, | ||
42 | TOSA_SCOOP_JC_NOTE_LED); | ||
43 | else | ||
44 | reset_scoop_gpio(&tosascoop_jc_device.dev, | ||
45 | TOSA_SCOOP_JC_NOTE_LED); | ||
46 | } | ||
47 | |||
48 | static struct led_classdev tosa_amber_led = { | ||
49 | .name = "tosa:amber", | ||
50 | .default_trigger = "sharpsl-charge", | ||
51 | .brightness_set = tosaled_amber_set, | ||
52 | }; | ||
53 | |||
54 | static struct led_classdev tosa_green_led = { | ||
55 | .name = "tosa:green", | ||
56 | .default_trigger = "nand-disk", | ||
57 | .brightness_set = tosaled_green_set, | ||
58 | }; | ||
59 | |||
60 | #ifdef CONFIG_PM | ||
61 | static int tosaled_suspend(struct platform_device *dev, pm_message_t state) | ||
62 | { | ||
63 | #ifdef CONFIG_LEDS_TRIGGERS | ||
64 | if (tosa_amber_led.trigger && strcmp(tosa_amber_led.trigger->name, | ||
65 | "sharpsl-charge")) | ||
66 | #endif | ||
67 | led_classdev_suspend(&tosa_amber_led); | ||
68 | led_classdev_suspend(&tosa_green_led); | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static int tosaled_resume(struct platform_device *dev) | ||
73 | { | ||
74 | led_classdev_resume(&tosa_amber_led); | ||
75 | led_classdev_resume(&tosa_green_led); | ||
76 | return 0; | ||
77 | } | ||
78 | #else | ||
79 | #define tosaled_suspend NULL | ||
80 | #define tosaled_resume NULL | ||
81 | #endif | ||
82 | |||
83 | static int tosaled_probe(struct platform_device *pdev) | ||
84 | { | ||
85 | int ret; | ||
86 | |||
87 | ret = led_classdev_register(&pdev->dev, &tosa_amber_led); | ||
88 | if (ret < 0) | ||
89 | return ret; | ||
90 | |||
91 | ret = led_classdev_register(&pdev->dev, &tosa_green_led); | ||
92 | if (ret < 0) | ||
93 | led_classdev_unregister(&tosa_amber_led); | ||
94 | |||
95 | return ret; | ||
96 | } | ||
97 | |||
98 | static int tosaled_remove(struct platform_device *pdev) | ||
99 | { | ||
100 | led_classdev_unregister(&tosa_amber_led); | ||
101 | led_classdev_unregister(&tosa_green_led); | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static struct platform_driver tosaled_driver = { | ||
107 | .probe = tosaled_probe, | ||
108 | .remove = tosaled_remove, | ||
109 | .suspend = tosaled_suspend, | ||
110 | .resume = tosaled_resume, | ||
111 | .driver = { | ||
112 | .name = "tosa-led", | ||
113 | }, | ||
114 | }; | ||
115 | |||
116 | static int __init tosaled_init(void) | ||
117 | { | ||
118 | return platform_driver_register(&tosaled_driver); | ||
119 | } | ||
120 | |||
121 | static void __exit tosaled_exit(void) | ||
122 | { | ||
123 | platform_driver_unregister(&tosaled_driver); | ||
124 | } | ||
125 | |||
126 | module_init(tosaled_init); | ||
127 | module_exit(tosaled_exit); | ||
128 | |||
129 | MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>"); | ||
130 | MODULE_DESCRIPTION("Tosa LED driver"); | ||
131 | MODULE_LICENSE("GPL"); | ||