summaryrefslogtreecommitdiff
path: root/include/linux/leds.h
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2015-10-07 11:10:43 +0200
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-01-04 09:57:31 +0100
commit13ae79bbe4c214047f51623304d83b46eb02897d (patch)
tree8dcbaf1fef57d97dfe78a35f07a84a8b85180122 /include/linux/leds.h
parent1afcadfcd184c3b52e38bae15c247a5fa4a0e054 (diff)
leds: core: Drivers shouldn't enforce SYNC/ASYNC brightness setting
This patch removes SET_BRIGHTNESS_ASYNC and SET_BRIGHTNESS_SYNC flags. led_set_brightness() now calls led_set_brightness_nosleep() instead of choosing between sync and async op basing on the flags defined by the driver. From now on, if a user wants to make sure that brightness will be set synchronously, they have to use led_set_brightness_sync() API. It is now being made publicly available since it has become apparent that it is a caller who should decide whether brightness is to be set in a synchronous or an asynchronous way. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Diffstat (limited to 'include/linux/leds.h')
-rw-r--r--include/linux/leds.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b35e0f5b8d6c..088f1da02bed 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -47,9 +47,7 @@ struct led_classdev {
#define LED_BLINK_BRIGHTNESS_CHANGE (1 << 20)
#define LED_BLINK_DISABLE (1 << 21)
#define LED_SYSFS_DISABLE (1 << 22)
-#define SET_BRIGHTNESS_ASYNC (1 << 23)
-#define SET_BRIGHTNESS_SYNC (1 << 24)
-#define LED_DEV_CAP_FLASH (1 << 25)
+#define LED_DEV_CAP_FLASH (1 << 23)
/* Set LED brightness level */
/* Must not sleep, use a workqueue if needed */
@@ -162,6 +160,21 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,
*/
extern void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness);
+
+/**
+ * led_set_brightness_sync - set LED brightness synchronously
+ * @led_cdev: the LED to set
+ * @brightness: the brightness to set it to
+ *
+ * Set an LED's brightness immediately. This function will block
+ * the caller for the time required for accessing device registers,
+ * and it can sleep.
+ *
+ * Returns: 0 on success or negative error value on failure
+ */
+extern int led_set_brightness_sync(struct led_classdev *led_cdev,
+ enum led_brightness value);
+
/**
* led_update_brightness - update LED brightness
* @led_cdev: the LED to query