diff options
Diffstat (limited to 'arch/arm/kernel/leds.c')
-rw-r--r-- | arch/arm/kernel/leds.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c index 0f107dcb034..136e8376a3e 100644 --- a/arch/arm/kernel/leds.c +++ b/arch/arm/kernel/leds.c | |||
@@ -9,6 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/notifier.h> | ||
13 | #include <linux/cpu.h> | ||
12 | #include <linux/sysdev.h> | 14 | #include <linux/sysdev.h> |
13 | #include <linux/syscore_ops.h> | 15 | #include <linux/syscore_ops.h> |
14 | 16 | ||
@@ -101,6 +103,25 @@ static struct syscore_ops leds_syscore_ops = { | |||
101 | .resume = leds_resume, | 103 | .resume = leds_resume, |
102 | }; | 104 | }; |
103 | 105 | ||
106 | static int leds_idle_notifier(struct notifier_block *nb, unsigned long val, | ||
107 | void *data) | ||
108 | { | ||
109 | switch (val) { | ||
110 | case IDLE_START: | ||
111 | leds_event(led_idle_start); | ||
112 | break; | ||
113 | case IDLE_END: | ||
114 | leds_event(led_idle_end); | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static struct notifier_block leds_idle_nb = { | ||
122 | .notifier_call = leds_idle_notifier, | ||
123 | }; | ||
124 | |||
104 | static int __init leds_init(void) | 125 | static int __init leds_init(void) |
105 | { | 126 | { |
106 | int ret; | 127 | int ret; |
@@ -109,8 +130,12 @@ static int __init leds_init(void) | |||
109 | ret = sysdev_register(&leds_device); | 130 | ret = sysdev_register(&leds_device); |
110 | if (ret == 0) | 131 | if (ret == 0) |
111 | ret = sysdev_create_file(&leds_device, &attr_event); | 132 | ret = sysdev_create_file(&leds_device, &attr_event); |
112 | if (ret == 0) | 133 | |
134 | if (ret == 0) { | ||
113 | register_syscore_ops(&leds_syscore_ops); | 135 | register_syscore_ops(&leds_syscore_ops); |
136 | idle_notifier_register(&leds_idle_nb); | ||
137 | } | ||
138 | |||
114 | return ret; | 139 | return ret; |
115 | } | 140 | } |
116 | 141 | ||