Commit 417a77ed authored by Russell King's avatar Russell King

[ARM] Add system device for LEDs.

This allows us to make the suspend/resume handling local to the LEDs
code itself, rather than being scattered in several files.
parent 7efbbc65
......@@ -15,7 +15,6 @@
#include <linux/errno.h>
#include <linux/sched.h>
#include <asm/leds.h>
#include <asm/system.h>
/*
......@@ -42,15 +41,11 @@ int suspend(void)
goto resume_legacy;
local_irq_disable();
leds_event(led_stop);
sysdev_suspend(3);
ret = pm_do_suspend();
sysdev_resume();
leds_event(led_start);
local_irq_enable();
device_resume();
......
......@@ -117,12 +117,10 @@ __setup("reboot=", reboot_setup);
void machine_halt(void)
{
leds_event(led_halted);
}
void machine_power_off(void)
{
leds_event(led_halted);
if (pm_power_off)
pm_power_off();
}
......
......@@ -26,6 +26,7 @@
#include <linux/timex.h>
#include <linux/errno.h>
#include <linux/profile.h>
#include <linux/sysdev.h>
#include <asm/hardware.h>
#include <asm/io.h>
......@@ -72,8 +73,6 @@ unsigned long (*gettimeoffset)(void) = dummy_gettimeoffset;
*/
unsigned long long sched_clock(void)
{
unsigned long long this_offset;
return (unsigned long long)jiffies * (1000000000 / HZ);
}
......@@ -137,6 +136,47 @@ static void dummy_leds_event(led_event_t evt)
void (*leds_event)(led_event_t) = dummy_leds_event;
static int leds_suspend(struct sys_device *dev, u32 state)
{
leds_event(led_stop);
return 0;
}
static int leds_resume(struct sys_device *dev)
{
leds_event(led_start);
return 0;
}
static int leds_shutdown(struct sys_device *dev)
{
leds_event(led_halted);
return 0;
}
static struct sysdev_class leds_sysclass = {
set_kset_name("leds"),
.shutdown = leds_shutdown,
.suspend = leds_suspend,
.resume = leds_resume,
};
static struct sys_device leds_device = {
.id = 0,
.cls = &leds_sysclass,
};
static int __init leds_init(void)
{
int ret;
ret = sysdev_class_register(&leds_sysclass);
if (ret == 0)
ret = sys_device_register(&leds_device);
return ret;
}
device_initcall(leds_init);
EXPORT_SYMBOL(leds_event);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment