leds: led-class: Retain the latest user brightness request
Retain the latest user brightness request. This ensures that when a max brightness limit is altered, the last brightness request is taken into account, when restoring the current brightness. Change-Id: I6461e06f64abe336cabc27a3992d734f1fb745c6 Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
This commit is contained in:
parent
0ba12a1e95
commit
29cca490d4
2 changed files with 3 additions and 1 deletions
|
@ -57,6 +57,7 @@ static ssize_t brightness_store(struct device *dev,
|
|||
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;
|
||||
|
||||
ret = size;
|
||||
unlock:
|
||||
|
@ -85,7 +86,7 @@ static ssize_t max_brightness_store(struct device *dev,
|
|||
return ret;
|
||||
|
||||
led_cdev->max_brightness = state;
|
||||
led_set_brightness(led_cdev, led_cdev->brightness);
|
||||
led_set_brightness(led_cdev, led_cdev->usr_brightness_req);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ struct led_classdev {
|
|||
const char *name;
|
||||
enum led_brightness brightness;
|
||||
enum led_brightness max_brightness;
|
||||
enum led_brightness usr_brightness_req;
|
||||
int flags;
|
||||
|
||||
/* Lower 16 bits reflect status */
|
||||
|
|
Loading…
Reference in a new issue