leds: add flag to keep trigger always
Commit 0013b23d66
("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>
This commit is contained in:
parent
8bb66a7e41
commit
1b6c41d1a0
2 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue