diff options
Diffstat (limited to 'include/linux/leds.h')
-rw-r--r-- | include/linux/leds.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h index a57611d0c94e..737f9b1051f2 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define __LINUX_LEDS_H_INCLUDED | 13 | #define __LINUX_LEDS_H_INCLUDED |
14 | 14 | ||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/mutex.h> | ||
16 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
17 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
18 | #include <linux/timer.h> | 19 | #include <linux/timer.h> |
@@ -42,6 +43,7 @@ struct led_classdev { | |||
42 | #define LED_BLINK_ONESHOT (1 << 17) | 43 | #define LED_BLINK_ONESHOT (1 << 17) |
43 | #define LED_BLINK_ONESHOT_STOP (1 << 18) | 44 | #define LED_BLINK_ONESHOT_STOP (1 << 18) |
44 | #define LED_BLINK_INVERT (1 << 19) | 45 | #define LED_BLINK_INVERT (1 << 19) |
46 | #define LED_SYSFS_DISABLE (1 << 20) | ||
45 | 47 | ||
46 | /* Set LED brightness level */ | 48 | /* Set LED brightness level */ |
47 | /* Must not sleep, use a workqueue if needed */ | 49 | /* Must not sleep, use a workqueue if needed */ |
@@ -85,6 +87,9 @@ struct led_classdev { | |||
85 | /* true if activated - deactivate routine uses it to do cleanup */ | 87 | /* true if activated - deactivate routine uses it to do cleanup */ |
86 | bool activated; | 88 | bool activated; |
87 | #endif | 89 | #endif |
90 | |||
91 | /* Ensures consistent access to the LED Flash Class device */ | ||
92 | struct mutex led_access; | ||
88 | }; | 93 | }; |
89 | 94 | ||
90 | extern int led_classdev_register(struct device *parent, | 95 | extern int led_classdev_register(struct device *parent, |
@@ -151,6 +156,33 @@ extern void led_set_brightness(struct led_classdev *led_cdev, | |||
151 | */ | 156 | */ |
152 | extern int led_update_brightness(struct led_classdev *led_cdev); | 157 | extern int led_update_brightness(struct led_classdev *led_cdev); |
153 | 158 | ||
159 | /** | ||
160 | * led_sysfs_disable - disable LED sysfs interface | ||
161 | * @led_cdev: the LED to set | ||
162 | * | ||
163 | * Disable the led_cdev's sysfs interface. | ||
164 | */ | ||
165 | extern void led_sysfs_disable(struct led_classdev *led_cdev); | ||
166 | |||
167 | /** | ||
168 | * led_sysfs_enable - enable LED sysfs interface | ||
169 | * @led_cdev: the LED to set | ||
170 | * | ||
171 | * Enable the led_cdev's sysfs interface. | ||
172 | */ | ||
173 | extern void led_sysfs_enable(struct led_classdev *led_cdev); | ||
174 | |||
175 | /** | ||
176 | * led_sysfs_is_disabled - check if LED sysfs interface is disabled | ||
177 | * @led_cdev: the LED to query | ||
178 | * | ||
179 | * Returns: true if the led_cdev's sysfs interface is disabled. | ||
180 | */ | ||
181 | static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev) | ||
182 | { | ||
183 | return led_cdev->flags & LED_SYSFS_DISABLE; | ||
184 | } | ||
185 | |||
154 | /* | 186 | /* |
155 | * LED Triggers | 187 | * LED Triggers |
156 | */ | 188 | */ |