Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60f54592 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by David Collins
Browse files

leds: add flag to keep trigger always



Commit 0013b23d ("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: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 3df9170e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);

+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ struct led_classdev {
#define LED_DEV_CAP_FLASH	(1 << 24)
#define LED_HW_PLUGGABLE	(1 << 25)
#define LED_PANIC_INDICATOR	(1 << 26)
#define LED_KEEP_TRIGGER	(1 << 27)

	/* Set LED brightness level
	 * Must not sleep. Use brightness_set_blocking for drivers