From patchwork Wed Apr 5 06:49:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9663045 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E3C760353 for ; Wed, 5 Apr 2017 06:50:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E638284FE for ; Wed, 5 Apr 2017 06:50:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 026D728507; Wed, 5 Apr 2017 06:50:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ECAA28505 for ; Wed, 5 Apr 2017 06:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752814AbdDEGt6 (ORCPT ); Wed, 5 Apr 2017 02:49:58 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34961 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754399AbdDEGtX (ORCPT ); Wed, 5 Apr 2017 02:49:23 -0400 Received: by mail-lf0-f68.google.com with SMTP id v2so355529lfi.2 for ; Tue, 04 Apr 2017 23:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pmJH37QtdGw5MHKejLQVGPGq69EMX5CPGqfh4RHEpFo=; b=AUpYpk/veyH+7SHTColld5PETuzGAO+Lza8kUuLBq/1EXK1LLMosbv6OlK5wKGrPWv g+zUdzxSQIrSisPVfPc/Uu0CwRhxd1Vl4I7emFHoJh6SAMQK+wetbyXqxVTt252410u2 h+BsC350Hc+AQ8QP6CyoqxJei5r2h2CcUH55U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pmJH37QtdGw5MHKejLQVGPGq69EMX5CPGqfh4RHEpFo=; b=msMkuwBXNp5sLgJQtPL4xityGSxNrQAsgUmdK5swBEVW4XjrnpGAhBVaFsM7MQ35tB lyJoaWlm8cbotFmytG2xwSK/aAfYD0D+BlJmFohpE+qr70qfVmfv7S/jc64v8n3y3TB+ nARkjGqyQKxCUrAMSgb9w+5T5/ByfE3mqocPFhKf5CgOQzT5FSlx1weEHkXgqpd5pcio 2yWqICH6HX1VVT8ZFbyBaM1WbGrg6NS6ItA7FCFTaF9RoSYJLyHKSfUlb6kPFg69dewU 1MzxA4GsciZT2/gPfeaLJ2XHknt8Lwg5awsAg44ORaVjUiL9oO1CdAM5cUmAaOmAoLUD aE3Q== X-Gm-Message-State: AFeK/H04KADZ79Jrbwp3Z6fbEXa9Qk+9hgmQsUdUVtU1YxzKeQECMZoUpGLoDXEgIZW3CQ== X-Received: by 10.25.196.21 with SMTP id u21mr8544229lff.81.1491374961958; Tue, 04 Apr 2017 23:49:21 -0700 (PDT) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id o91sm3619921lfg.1.2017.04.04.23.49.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 23:49:21 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/11] platform/x86: fujitsu-laptop: account for backlight power when determining brightness Date: Wed, 5 Apr 2017 08:49:09 +0200 Message-Id: <20170405064910.3162-11-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170405064910.3162-1-kernel@kempniu.pl> References: <20170405064910.3162-1-kernel@kempniu.pl> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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ń --- 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 a797e7890773..f58a33d70be3 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -438,7 +438,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)