Skip to content

Commit

Permalink
fujitsu-laptop: Rework brightness of eco led
Browse files Browse the repository at this point in the history
For the sake of internal consistency, unset maximum brightness of eco
led and make it activatable only on values >= LED_FULL.

Signed-off-by: Matej Groma <matejgroma@gmail.com>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
  • Loading branch information
Matej Groma authored and Darren Hart committed Jul 6, 2016
1 parent 56a37a7 commit 6967893
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/platform/x86/fujitsu-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ static void eco_led_set(struct led_classdev *cdev,

static struct led_classdev eco_led = {
.name = "fujitsu::eco_led",
.max_brightness = 1,
.brightness_get = eco_led_get,
.brightness_set = eco_led_set
};
Expand Down Expand Up @@ -306,7 +305,7 @@ static void eco_led_set(struct led_classdev *cdev,
int curr;

curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0);
if (brightness)
if (brightness >= LED_FULL)
call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
else
call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
Expand Down Expand Up @@ -352,7 +351,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
enum led_brightness brightness = LED_OFF;

if (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
brightness = cdev->max_brightness;
brightness = LED_FULL;

return brightness;
}
Expand Down

0 comments on commit 6967893

Please sign in to comment.