4 * Copyright 2005 Dirk Opfer
6 * Author: Dirk Opfer <Dirk@Opfer-Online.de>
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.
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>
26 static void tosaled_amber_set(struct led_classdev *led_cdev,
27 enum led_brightness value)
30 set_scoop_gpio(&tosascoop_jc_device.dev,
31 TOSA_SCOOP_JC_CHRG_ERR_LED);
33 reset_scoop_gpio(&tosascoop_jc_device.dev,
34 TOSA_SCOOP_JC_CHRG_ERR_LED);
37 static void tosaled_green_set(struct led_classdev *led_cdev,
38 enum led_brightness value)
41 set_scoop_gpio(&tosascoop_jc_device.dev,
42 TOSA_SCOOP_JC_NOTE_LED);
44 reset_scoop_gpio(&tosascoop_jc_device.dev,
45 TOSA_SCOOP_JC_NOTE_LED);
48 static struct led_classdev tosa_amber_led = {
50 .default_trigger = "sharpsl-charge",
51 .brightness_set = tosaled_amber_set,
54 static struct led_classdev tosa_green_led = {
56 .default_trigger = "nand-disk",
57 .brightness_set = tosaled_green_set,
61 static int tosaled_suspend(struct platform_device *dev, pm_message_t state)
63 #ifdef CONFIG_LEDS_TRIGGERS
64 if (tosa_amber_led.trigger && strcmp(tosa_amber_led.trigger->name,
67 led_classdev_suspend(&tosa_amber_led);
68 led_classdev_suspend(&tosa_green_led);
72 static int tosaled_resume(struct platform_device *dev)
74 led_classdev_resume(&tosa_amber_led);
75 led_classdev_resume(&tosa_green_led);
79 #define tosaled_suspend NULL
80 #define tosaled_resume NULL
83 static int tosaled_probe(struct platform_device *pdev)
87 ret = led_classdev_register(&pdev->dev, &tosa_amber_led);
91 ret = led_classdev_register(&pdev->dev, &tosa_green_led);
93 led_classdev_unregister(&tosa_amber_led);
98 static int tosaled_remove(struct platform_device *pdev)
100 led_classdev_unregister(&tosa_amber_led);
101 led_classdev_unregister(&tosa_green_led);
106 static struct platform_driver tosaled_driver = {
107 .probe = tosaled_probe,
108 .remove = tosaled_remove,
109 .suspend = tosaled_suspend,
110 .resume = tosaled_resume,
116 static int __init tosaled_init(void)
118 return platform_driver_register(&tosaled_driver);
121 static void __exit tosaled_exit(void)
123 platform_driver_unregister(&tosaled_driver);
126 module_init(tosaled_init);
127 module_exit(tosaled_exit);
129 MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>");
130 MODULE_DESCRIPTION("Tosa LED driver");
131 MODULE_LICENSE("GPL");