diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-03-31 05:31:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:57 -0500 |
commit | 181bf8aa68a1d062d7f98abb0f1cb8871910320c (patch) | |
tree | 939966fe822d7aa20ed801e26a052444f12c94ca /arch | |
parent | 6655c6fe575b720eb8cb6c143ae10995a7aa1916 (diff) |
[PATCH] LED: add sharp charger status LED trigger
Add an LED trigger for the charger status as found on the Sharp Zaurus series
of devices.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Pavel Machek <pavel@suse.cz>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/common/sharpsl_pm.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c index 978d32e82d39..3cd8c9ee4510 100644 --- a/arch/arm/common/sharpsl_pm.c +++ b/arch/arm/common/sharpsl_pm.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/leds.h> | ||
25 | 26 | ||
26 | #include <asm/hardware.h> | 27 | #include <asm/hardware.h> |
27 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
@@ -75,6 +76,7 @@ static void sharpsl_battery_thread(void *private_); | |||
75 | struct sharpsl_pm_status sharpsl_pm; | 76 | struct sharpsl_pm_status sharpsl_pm; |
76 | DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL); | 77 | DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL); |
77 | DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL); | 78 | DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL); |
79 | DEFINE_LED_TRIGGER(sharpsl_charge_led_trigger); | ||
78 | 80 | ||
79 | 81 | ||
80 | static int get_percentage(int voltage) | 82 | static int get_percentage(int voltage) |
@@ -190,10 +192,10 @@ void sharpsl_pm_led(int val) | |||
190 | dev_err(sharpsl_pm.dev, "Charging Error!\n"); | 192 | dev_err(sharpsl_pm.dev, "Charging Error!\n"); |
191 | } else if (val == SHARPSL_LED_ON) { | 193 | } else if (val == SHARPSL_LED_ON) { |
192 | dev_dbg(sharpsl_pm.dev, "Charge LED On\n"); | 194 | dev_dbg(sharpsl_pm.dev, "Charge LED On\n"); |
193 | 195 | led_trigger_event(sharpsl_charge_led_trigger, LED_FULL); | |
194 | } else { | 196 | } else { |
195 | dev_dbg(sharpsl_pm.dev, "Charge LED Off\n"); | 197 | dev_dbg(sharpsl_pm.dev, "Charge LED Off\n"); |
196 | 198 | led_trigger_event(sharpsl_charge_led_trigger, LED_OFF); | |
197 | } | 199 | } |
198 | } | 200 | } |
199 | 201 | ||
@@ -786,6 +788,8 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev) | |||
786 | init_timer(&sharpsl_pm.chrg_full_timer); | 788 | init_timer(&sharpsl_pm.chrg_full_timer); |
787 | sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer; | 789 | sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer; |
788 | 790 | ||
791 | led_trigger_register_simple("sharpsl-charge", &sharpsl_charge_led_trigger); | ||
792 | |||
789 | sharpsl_pm.machinfo->init(); | 793 | sharpsl_pm.machinfo->init(); |
790 | 794 | ||
791 | device_create_file(&pdev->dev, &dev_attr_battery_percentage); | 795 | device_create_file(&pdev->dev, &dev_attr_battery_percentage); |
@@ -807,6 +811,8 @@ static int sharpsl_pm_remove(struct platform_device *pdev) | |||
807 | device_remove_file(&pdev->dev, &dev_attr_battery_percentage); | 811 | device_remove_file(&pdev->dev, &dev_attr_battery_percentage); |
808 | device_remove_file(&pdev->dev, &dev_attr_battery_voltage); | 812 | device_remove_file(&pdev->dev, &dev_attr_battery_voltage); |
809 | 813 | ||
814 | led_trigger_unregister_simple(sharpsl_charge_led_trigger); | ||
815 | |||
810 | sharpsl_pm.machinfo->exit(); | 816 | sharpsl_pm.machinfo->exit(); |
811 | 817 | ||
812 | del_timer_sync(&sharpsl_pm.chrg_full_timer); | 818 | del_timer_sync(&sharpsl_pm.chrg_full_timer); |