Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41DFEC433E0 for ; Thu, 18 Mar 2021 16:50:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 121AF64F11 for ; Thu, 18 Mar 2021 16:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232081AbhCRQuC (ORCPT ); Thu, 18 Mar 2021 12:50:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28279 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232249AbhCRQtl (ORCPT ); Thu, 18 Mar 2021 12:49:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616086180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wzsQDTfLmkd5z0eYq6awhMmQInxj7Uo9v/R/bstTn4w=; b=OX1C8RYlDZfdjKtE0jDXuectWbB6tpjBA67J0jp7ZChptwV3sZS8aruAFxKPoaC3nbJj5Z YycQG2ohJIRu1f7+F+ETZI7cGBjnj0sKmI/gIIkgyV3BwAsTcVngZkc9rNRnwjrbnGjlKM sOOAXSXfcNsXFHh1n1Cq9uPuHo9cHQc= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-471-EC_Rs4C4OhiRKpRUCiuLSw-1; Thu, 18 Mar 2021 12:49:37 -0400 X-MC-Unique: EC_Rs4C4OhiRKpRUCiuLSw-1 Received: by mail-ed1-f70.google.com with SMTP id o15so21572659edv.7 for ; Thu, 18 Mar 2021 09:49:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wzsQDTfLmkd5z0eYq6awhMmQInxj7Uo9v/R/bstTn4w=; b=bZLnG15F5UUcYHeuTmf9fOLBd2RrNRxAfCrmQ0U3VerRiq01P8yI2L+BiHcmEQQiTd K5rvoN4tDbCSr5HIxqkRP4cv9N0qGhYSk5+yWUr7EFRW7zzL95rNJw0Pxyx+Itg1GOp0 /XcfSs4yMIootzhmcVHL6ynfjJGwsKhXOue/8hh9i3SMHtgib8fROYNoJAdhS4JfWVGa os/k8mJBrFtEuP8Kp2O5Q4/sDk80G5kKrNoTavPJVe62xRuZn0/F4OPqAJ+8vMWCorgQ AIddQmIbsr1pSqtSOneqbOPbxF8tFRyvFQSUCb+RZZjGTj5fSF7pzxUllbj3B6bcY1u4 xkNw== X-Gm-Message-State: AOAM5330aWoq1uA65PJQjwJXOveXFxOCTkOtEo3XYCCM6zuGIMKw41xA l13npqIexPs8Gn5MBLRZCj+Yp1ICT0VwzEFx+NR1P4DTXSVZifSAA3AwxlPPk1HCiYCrbfugJe+ T3FmaWAmKgw74xQ9wzPJ5DfEYcZHvWVgnW/iIAj9JNyAJDwjidX/KBXJziMpUzA9eFns9vK9rhA zMmggqAz9gJw== X-Received: by 2002:aa7:c9c8:: with SMTP id i8mr4699922edt.193.1616086175799; Thu, 18 Mar 2021 09:49:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQZ55YzGVHSSb+cDybjqUyhc1oaE05JU0l2nazm4APJLc8tfBToBOXFqWm5+Fq26MabcfyyA== X-Received: by 2002:aa7:c9c8:: with SMTP id i8mr4699905edt.193.1616086175614; Thu, 18 Mar 2021 09:49:35 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id a17sm2255827ejf.20.2021.03.18.09.49.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 09:49:35 -0700 (PDT) Subject: Re: [PATCH] thinkpad_acpi: Allow the FnLock LED to change state To: Esteve Varela Colominas , Henrique de Moraes Holschuh , Mark Pearson Cc: ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org References: <20210315195823.23212-1-esteve.varela@gmail.com> From: Hans de Goede Message-ID: <7fcaeb12-35b1-242a-dfd0-02324643c34b@redhat.com> Date: Thu, 18 Mar 2021 17:49:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210315195823.23212-1-esteve.varela@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Hi, On 3/15/21 8:58 PM, Esteve Varela Colominas wrote: > On many recent ThinkPad laptops, there's a new LED next to the ESC key, > that indicates the FnLock status. > When the Fn+ESC combo is pressed, FnLock is toggled, which causes the > Media Key functionality to change, making it so that the media keys > either perform their media key function, or function as an F-key by > default. The Fn key can be used the access the alternate function at any > time. > > With the current linux kernel, the LED doens't change state if you press > the Fn+ESC key combo. However, the media key functionality *does* > change. This is annoying, since the LED will stay on if it was on during > bootup, and it makes it hard to keep track what the current state of the > FnLock is. > > This patch calls an ACPI function, that gets the current media key > state, when the Fn+ESC key combo is pressed. Through testing it was > discovered that this function causes the LED to update correctly to > reflect the current state when this function is called. > > The relevant ACPI calls are the following: > \_SB_.PCI0.LPC0.EC0_.HKEY.GMKS: Get media key state, returns 0x603 if the FnLock mode is enabled, and 0x602 if it's disabled. > \_SB_.PCI0.LPC0.EC0_.HKEY.SMKS: Set media key state, sending a 1 will enable FnLock mode, and a 0 will disable it. > > Relevant discussion: > https://bugzilla.kernel.org/show_bug.cgi?id=207841 > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881015 > > Signed-off-by: Esteve Varela Colominas > --- > drivers/platform/x86/thinkpad_acpi.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c > index c40470637..09362dd74 100644 > --- a/drivers/platform/x86/thinkpad_acpi.c > +++ b/drivers/platform/x86/thinkpad_acpi.c > @@ -4079,13 +4079,19 @@ static bool hotkey_notify_6xxx(const u32 hkey, > > case TP_HKEY_EV_KEY_NUMLOCK: > case TP_HKEY_EV_KEY_FN: > - case TP_HKEY_EV_KEY_FN_ESC: > /* key press events, we just ignore them as long as the EC > * is still reporting them in the normal keyboard stream */ > *send_acpi_ev = false; > *ignore_acpi_ev = true; > return true; > > + case TP_HKEY_EV_KEY_FN_ESC: > + /* Get the media key status to foce the status LED to update */ > + acpi_evalf(hkey_handle, NULL, "GMKS", "v"); Sicne this is a getter function I guess that calling it is mostly harmless and if it works around what seems to be a firmware bug on some of the E?95 ThinkPad models then I guess that this is fine by me. Mark, do you have any comments on this ? Regards, Hans > + *send_acpi_ev = false; > + *ignore_acpi_ev = true; > + return true; > + > case TP_HKEY_EV_TABLET_CHANGED: > tpacpi_input_send_tabletsw(); > hotkey_tablet_mode_notify_change(); >