12 #include <linux/module.h>
13 #include <linux/kernel.h>
15 #include <linux/list.h>
17 #include <linux/device.h>
20 #include <linux/ctype.h>
24 static struct class *leds_class;
26 static void led_update_brightness(
struct led_classdev *led_cdev)
38 led_update_brightness(led_cdev);
50 ret = kstrtoul(buf, 10, &state);
56 __led_set_brightness(led_cdev, state);
71 __ATTR(max_brightness, 0444, led_max_brightness_show,
NULL),
72 #ifdef CONFIG_LEDS_TRIGGERS
78 static void led_timer_function(
unsigned long data)
85 __led_set_brightness(led_cdev,
LED_OFF);
94 brightness = led_get_brightness(led_cdev);
108 __led_set_brightness(led_cdev, brightness);
169 static int led_resume(
struct device *dev)
187 "%s", led_cdev->
name);
188 if (IS_ERR(led_cdev->
dev))
189 return PTR_ERR(led_cdev->
dev);
191 #ifdef CONFIG_LEDS_TRIGGERS
202 led_update_brightness(led_cdev);
207 led_cdev->
blink_timer.function = led_timer_function;
210 #ifdef CONFIG_LEDS_TRIGGERS
229 #ifdef CONFIG_LEDS_TRIGGERS
231 if (led_cdev->trigger)
250 static int __init leds_init(
void)
253 if (IS_ERR(leds_class))
254 return PTR_ERR(leds_class);
255 leds_class->
suspend = led_suspend;
256 leds_class->
resume = led_resume;
261 static void __exit leds_exit(
void)