diff options
| author | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2017-01-04 18:46:48 -0800 |
|---|---|---|
| committer | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2017-01-04 19:12:04 -0800 |
| commit | 1b6c41d1a0a793097ecebe8e13675ec42f501bb6 (patch) | |
| tree | ee64a6df60b19c4f072c8f42074da6c72a92b560 | |
| parent | 8bb66a7e413624884e697d295b7e136f96209cd9 (diff) | |
leds: add flag to keep trigger always
Commit 0013b23d66a2768f5babbb0ea9f03ab067a990d8 ("leds: disable
triggers on brightness set") removes the trigger on a LED class
device when brightness is set to 0. However, there are some LED
class devices which needs the trigger not to be removed. In an
use case like camera flash, camera flash driver passes in a
trigger device to LED class driver. If the trigger is removed
when the brightness is set to 0, this will affect the clients
using those triggers. Hence add a flag to always keep the trigger
even when brightness is set to 0.
Change-Id: Icec1380b297bc87058ea5024ef690ee3c1bed9e3
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
| -rw-r--r-- | drivers/leds/led-class.c | 2 | ||||
| -rw-r--r-- | include/linux/leds.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index d3f65fa67ebd..ba20b8e42fbd 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -53,7 +53,7 @@ static ssize_t brightness_store(struct device *dev, if (ret) goto unlock; - if (state == LED_OFF) + if (state == LED_OFF && !(led_cdev->flags & LED_KEEP_TRIGGER)) led_trigger_remove(led_cdev); led_set_brightness(led_cdev, state); led_cdev->usr_brightness_req = state; diff --git a/include/linux/leds.h b/include/linux/leds.h index bba189a62dfd..197b61500ab7 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -49,6 +49,7 @@ struct led_classdev { #define SET_BRIGHTNESS_ASYNC (1 << 21) #define SET_BRIGHTNESS_SYNC (1 << 22) #define LED_DEV_CAP_FLASH (1 << 23) +#define LED_KEEP_TRIGGER (1 << 24) /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ |
