From patchwork Thu Mar 30 10:35:08 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: 9653699 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 EAD4260113 for ; Thu, 30 Mar 2017 10:37:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4DB328358 for ; Thu, 30 Mar 2017 10:37:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9D2C28535; Thu, 30 Mar 2017 10:37:29 +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 7AE7F28358 for ; Thu, 30 Mar 2017 10:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933110AbdC3KhP (ORCPT ); Thu, 30 Mar 2017 06:37:15 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:33350 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933666AbdC3KfY (ORCPT ); Thu, 30 Mar 2017 06:35:24 -0400 Received: by mail-lf0-f65.google.com with SMTP id r36so4188396lfi.0 for ; Thu, 30 Mar 2017 03:35:23 -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=27b4SX4nnYJBi4Kz19MYd+Cc6OTHH5ivQgJLgrI1i0A=; b=hetrN2P0Si8Iqjccu3CeDMPwQMlUieWK53iw+PJJ3FFpFv3jIpii9tL4jUfratdix4 NrfZYyPa1+umk2m6hZeNt2bdLb7m/Eix/NLZy0hvO/h1e5m7ItQdZQaGWbu5BpbhyhNq 4/acI2KGkA0gsb1CfPSQoaW9EbdnoWHXWXwUs= 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=27b4SX4nnYJBi4Kz19MYd+Cc6OTHH5ivQgJLgrI1i0A=; b=SJgU4IcR+NqTQA6bL5u7IxvdXCrvP0UmvoGbC/uM9DkI43qRguX/sGzywaR9W2flyk o+kneOej6ptuspwN+xU6WuqZtp/nm0w1vN8IBSeO9CCDbMY/YQfmmck/oMG/08bCoJlk iUQybkT4UiZk+NVjwImfOJ4eAb93CRFQ3n6qI7YP5A6uqP6pZR9/WX2yGjRORIw4HyNH GAFr/fQrV7NXJpzFBzLyqMwbqXh3SGWxfB2juoJkFynyT2TuhrolEfHA78b6R6DMrvuY 85vwdV8OLvsDpUZJ+32Ri4ozU2gnmGks8MXtHo15gDPAOvUsIRAvvaFBglF3BgqnnlIy 7DtA== X-Gm-Message-State: AFeK/H27gPiiQgD7pvQwy4vAtct0iw6UtqBT9ntlGIMsPfUto4b7FzjlejWYWenILpxV6g== X-Received: by 10.25.190.88 with SMTP id o85mr1460605lff.151.1490870122213; Thu, 30 Mar 2017 03:35:22 -0700 (PDT) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id x1sm296975lfb.54.2017.03.30.03.35.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 03:35: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 10/11] platform/x86: fujitsu-laptop: account for backlight power when determining brightness Date: Thu, 30 Mar 2017 12:35:08 +0200 Message-Id: <20170330103509.32509-11-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.1 In-Reply-To: <20170330103509.32509-1-kernel@kempniu.pl> References: <20170330103509.32509-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 78a39b143200..99befc1bc4f6 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -437,7 +437,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)