diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-03-31 05:31:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:56 -0500 |
commit | c72a1d608dd0eb3d553a08bfdf1c0041bebaa8a0 (patch) | |
tree | 56715f0e0af8a9c33725f3db2f14cf7f870ad46d /include/linux | |
parent | 75c1d31d9ea71025b73430c696b727e8aa15872d (diff) |
[PATCH] LED: add LED class
Add the foundations of a new LEDs subsystem. This patch adds a class which
presents LED devices within sysfs and allows their brightness to be
controlled.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/leds.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h new file mode 100644 index 000000000000..6812640b39cc --- /dev/null +++ b/include/linux/leds.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Driver model for leds and led triggers | ||
3 | * | ||
4 | * Copyright (C) 2005 John Lenz <lenz@cs.wisc.edu> | ||
5 | * Copyright (C) 2005 Richard Purdie <rpurdie@openedhand.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | #ifndef __LINUX_LEDS_H_INCLUDED | ||
13 | #define __LINUX_LEDS_H_INCLUDED | ||
14 | |||
15 | struct device; | ||
16 | struct class_device; | ||
17 | /* | ||
18 | * LED Core | ||
19 | */ | ||
20 | |||
21 | enum led_brightness { | ||
22 | LED_OFF = 0, | ||
23 | LED_HALF = 127, | ||
24 | LED_FULL = 255, | ||
25 | }; | ||
26 | |||
27 | struct led_classdev { | ||
28 | const char *name; | ||
29 | int brightness; | ||
30 | int flags; | ||
31 | #define LED_SUSPENDED (1 << 0) | ||
32 | |||
33 | /* A function to set the brightness of the led */ | ||
34 | void (*brightness_set)(struct led_classdev *led_cdev, | ||
35 | enum led_brightness brightness); | ||
36 | |||
37 | struct class_device *class_dev; | ||
38 | /* LED Device linked list */ | ||
39 | struct list_head node; | ||
40 | |||
41 | /* Trigger data */ | ||
42 | char *default_trigger; | ||
43 | }; | ||
44 | |||
45 | extern int led_classdev_register(struct device *parent, | ||
46 | struct led_classdev *led_cdev); | ||
47 | extern void led_classdev_unregister(struct led_classdev *led_cdev); | ||
48 | extern void led_classdev_suspend(struct led_classdev *led_cdev); | ||
49 | extern void led_classdev_resume(struct led_classdev *led_cdev); | ||
50 | |||
51 | #endif /* __LINUX_LEDS_H_INCLUDED */ | ||