From patchwork Mon Oct 22 10:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 10651893 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24D7613A4 for ; Mon, 22 Oct 2018 10:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BBC2288DC for ; Mon, 22 Oct 2018 10:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3FF9288E0; Mon, 22 Oct 2018 10:00:14 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 4C974288DC for ; Mon, 22 Oct 2018 10:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbeJVSSC (ORCPT ); Mon, 22 Oct 2018 14:18:02 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33827 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728062AbeJVSSB (ORCPT ); Mon, 22 Oct 2018 14:18:01 -0400 Received: by mail-pf1-f195.google.com with SMTP id f78-v6so13882435pfe.1 for ; Mon, 22 Oct 2018 03:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=iPMhtvR/nJVdVA1wz020oq6CricGN1ystVnYtHZL2Lo=; b=ID2kM4Pw7N6Yq16s141i+NpYo7cUAM/QgL/eCYVs6n1+zbaQxW+8ritcyfpm+nUNtS xqqy780tV4KYMY5Niq1g4j1ELJotg1tZvpyQrPVsklH+5nwJYG8vusi6uzbQFpDOBFGb b7Cm743zMqXB2U7ieAE/7zhDHowQ/VaKc8rmHTBuAW18plOGJIeFaJtZHqo9kYxiG/FD S2J0gyVeM5s9DpVdnh/M8pQ9I6JMMWjNrMBmG7qauyFRztTem3Hb2lfkev+Q2E4+RJ8j u+aDChBcH7dCzLl25xLIMXJKY1xzFcD/hL6wr0kUy0gVSPxTTNmwCUnzDqSyn14PSous NRoQ== 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; bh=iPMhtvR/nJVdVA1wz020oq6CricGN1ystVnYtHZL2Lo=; b=OFtFtE5Fk/z4C/s6NaX5VPaQP6UbcdmTjUp+Mk4i+EDKLQ6dIv9g44mGwpmX4ZXbwQ TaYl0RBTzbKoryOLzxvp9DNLeAsRW03o+PQhbrQtx193hbRyQwkzvCpDzuBkAaXu7XfW G4wT2XgjB494aj8IcgM4/KkXwrkGDFCzuD7t5FVNrVUkzZhP/1ejexU3GbU7+hXY+KDF L11oCV4ozyCuVKIwac4pjASI5yRbBA7XyEobKf9Hqzp7tFr3QTrcG5zii6MBJ6XqCksN F84RKOmjKJS0Xf4lKWKbXgSMZTo4d0LSujVwo3a+dmidgls8RP2V2AVoDJTgd5JkBVbW +NlA== X-Gm-Message-State: ABuFfog1TL8FeyJBVWMd8U4P6HUEDOAeJbO8CJY+afWdnzdcDrtYn+Iq O0fyMBBORWxcrKgCUZp+FeDgaQ== X-Google-Smtp-Source: ACcGV613dY0rQRZGMQvE6Scali+zC241B/P0ZawAYj/NSufQqkaFYB9Sr6wxCwLQiObtuuBqBRMmLw== X-Received: by 2002:a62:42d4:: with SMTP id h81-v6mr46172916pfd.0.1540202410770; Mon, 22 Oct 2018 03:00:10 -0700 (PDT) Received: from limbo.local (125-227-158-176.HINET-IP.hinet.net. [125.227.158.176]) by smtp.gmail.com with ESMTPSA id a16-v6sm6666053pgb.6.2018.10.22.03.00.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 03:00:10 -0700 (PDT) From: Daniel Drake To: corentin.chary@gmail.com, dvhart@infradead.org, andy@infradead.org Cc: acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux@endlessm.com, Jian-Hong Pan Subject: [PATCH] platform/x86: asus-wmi: Only notify kbd LED hw_change by fn-key pressed Date: Mon, 22 Oct 2018 18:00:04 +0800 Message-Id: <20181022100004.19999-1-drake@endlessm.com> X-Mailer: git-send-email 2.17.1 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 From: Jian-Hong Pan Since commit dbb3d78f61ba ("platform/x86: asus-wmi: Call led hw_changed API on kbd brightness change"), asus-wmi directly changes the keyboard LED brightness when the keyboard brightness keys are pressed, raising the appropriate notification. However, this notification was unintentionally also being raised during boot and resume from suspend. This was resulting in userspace showing the keyboard LED OSD on resume for no good reason. Move the keyboard LED brightness changed notification from kbd_led_update to the new kbd_led_set_by_kbd function which is only called from the keyboard brightness function keys codepath. Signed-off-by: Jian-Hong Pan Signed-off-by: Daniel Drake --- drivers/platform/x86/asus-wmi.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 9441cce636e6..a805227b31e1 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -467,7 +467,6 @@ static void kbd_led_update(struct asus_wmi *asus) ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); - led_classdev_notify_brightness_hw_changed(&asus->kbd_led, asus->kbd_led_wk); } static int kbd_led_read(struct asus_wmi *asus, int *level, int *env) @@ -521,6 +520,14 @@ static void kbd_led_set(struct led_classdev *led_cdev, do_kbd_led_set(led_cdev, value); } +static void kbd_led_set_by_kbd(struct asus_wmi *asus, enum led_brightness value) +{ + struct led_classdev *led_cdev = &asus->kbd_led; + + do_kbd_led_set(led_cdev, value); + led_classdev_notify_brightness_hw_changed(led_cdev, asus->kbd_led_wk); +} + static enum led_brightness kbd_led_get(struct led_classdev *led_cdev) { struct asus_wmi *asus; @@ -1759,18 +1766,18 @@ static void asus_wmi_notify(u32 value, void *context) } if (code == NOTIFY_KBD_BRTUP) { - do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1); + kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1); goto exit; } if (code == NOTIFY_KBD_BRTDWN) { - do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk - 1); + kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1); goto exit; } if (code == NOTIFY_KBD_BRTTOGGLE) { if (asus->kbd_led_wk == asus->kbd_led.max_brightness) - do_kbd_led_set(&asus->kbd_led, 0); + kbd_led_set_by_kbd(asus, 0); else - do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1); + kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1); goto exit; }