From patchwork Thu Mar 30 10:35:03 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: 9653713 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 86C6660113 for ; Thu, 30 Mar 2017 10:38:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7176C2857B for ; Thu, 30 Mar 2017 10:38:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6630828581; Thu, 30 Mar 2017 10:38:13 +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 051692857B for ; Thu, 30 Mar 2017 10:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933664AbdC3KfX (ORCPT ); Thu, 30 Mar 2017 06:35:23 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35953 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932989AbdC3KfU (ORCPT ); Thu, 30 Mar 2017 06:35:20 -0400 Received: by mail-lf0-f67.google.com with SMTP id n78so4163188lfi.3 for ; Thu, 30 Mar 2017 03:35:18 -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=+TR/MDTE/eifYrcMJMXaXpML0A2Kn1sLVsg2Hcz2oTY=; b=tZYgCI2rrbQjK7U6ZACHkZ738c/zs2HDNMpdfgUMUFINSsW52udVD/lgHihuSa/XvP bbo0fGb9OltFYi6YbQDz8x4Kz1hElSeGxr+e//iETdMU0BmPioP7LdDj34KaFTVlTlCz +IitI9GUxicTbIxKABwXIEjGBBf9FcbjYvKW8= 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=+TR/MDTE/eifYrcMJMXaXpML0A2Kn1sLVsg2Hcz2oTY=; b=lb9Kug45PesU/p4BeGv3JxkhcSCnZpiRrTLebvsbCrc4x9MWaIX17BwJuMBOnwzzMq IHvmkKnidSoqNkgBOqJMyzkISZ4s/v1WLRt+yH5fO8JoJ4EF7nzRMXJll1UPRzjteTEy 9Wk6mXa+ec9QurPbYVdbVKwkUAl8n9VTQmdE7KeuMVE6IjLjUjZS7que3r3mEK8COCCl 77BvppLaNi30B8wv/q9MTBBMRoE1vbH7LInO0FeeTul9f5V304rMWwbQrqxCSUlJmAdo dMAjDxrFR/77ytq4YXzTLY3QZ4kzVmJI3veGSDoVF5MaaYT4LUL4gZ5iFIXN0mze8J6t eU5Q== X-Gm-Message-State: AFeK/H2vbN0ZTuJDHpZWhbh+xl0kdhQs447RiNsKcbuXImKiTDxafet6Zror/iBqrzLVhA== X-Received: by 10.46.71.16 with SMTP id u16mr2060692lja.106.1490870117862; Thu, 30 Mar 2017 03:35:17 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 03:35:17 -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 05/11] platform/x86: fujitsu-laptop: sync brightness in set_lcd_level() Date: Thu, 30 Mar 2017 12:35:03 +0200 Message-Id: <20170330103509.32509-6-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 When using brightness keys and backlight device's sysfs interface alternately, an incorrect input event might be generated for a brightness key press. Consider the following sequence of events: 1. Set backlight brightness to 6 using brightness keys. 2. Write 4 to /sys/class/backlight/fujitsu-laptop/brightness. 3. Press the "brightness up" key. The input event generated in this scenario would be KEY_BRIGHTNESSDOWN, because before step 3 brightness_level would still be at 6. As the new brightness level is established using GBLL, it would evaluate to 5 (SBLL/SBL2 sets it to 4 in step 2 and pressing the "brightness up" key increases it by 1). This in turn would cause acpi_fujitsu_bl_notify() to observe a 6 -> 5 change, i.e. a decrease in brightness, while screen brightness would in fact be increased. Fix this by updating brightness_level in set_lcd_level. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index b888ba190fb2..9981988f82d2 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -383,6 +383,8 @@ static int set_lcd_level(int level) return -ENODEV; } + fujitsu_bl->brightness_level = level; + return 0; }