From 5959ddd02be4e435da866ee065187f5c8bccea28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 5 Apr 2017 08:49:09 +0200 Subject: [PATCH] platform/x86: fujitsu-laptop: account for backlight power when determining brightness MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The comment for the get_brightness backlight device callback in include/linux/backlight.h states that it should "return the current backlight brightness (accounting for power, fb_blank etc.)". fujitsu-laptop violates that premise by simply returning the value to which ACPI function GBLL evaluates to. Make sure 0 is returned when backlight power is turned off. Signed-off-by: Michał Kępień Reviewed-by: Jonathan Woithe Signed-off-by: Darren Hart (VMware) --- drivers/platform/x86/fujitsu-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index af36b15515ed..b88172134063 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -423,7 +423,7 @@ static int get_max_brightness(void) static int bl_get_brightness(struct backlight_device *b) { - return get_lcd_level(); + return b->props.power == FB_BLANK_POWERDOWN ? 0 : get_lcd_level(); } static int bl_update_status(struct backlight_device *b) -- 2.20.1