Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1213485pxf; Fri, 9 Apr 2021 02:59:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhBgAfNkid42OtRp5PlKiIaPvDRvyxLRnc4VL6B/dceh5pRHOpjU4YuXsAdDJpf88YqPMr X-Received: by 2002:a17:903:22c7:b029:e6:faf5:eb3a with SMTP id y7-20020a17090322c7b02900e6faf5eb3amr12246734plg.23.1617962345133; Fri, 09 Apr 2021 02:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617962345; cv=none; d=google.com; s=arc-20160816; b=wOib5+UiyAJW3zuzUjVlpv1s8x3W9QgmZFml4idOjyFtl6BWqfS1kJc9e8UE47nLJH FlLG368jAr0rfIbC/ZImCvT834TkJ3jyG0YcEGLakKUrlPubPtMScaYoebHsBpPLbri+ zhLGEK2x7tWXHj0EPlzkJlgrrgbHijK2SIKsytPCYbY/2aEgeKFiipoczI9DiMie2BSb Jyoev6tSvFMmUjws+qZaDz7HKtevqBa3q3xjP4jx3oKRt7F0ANfp341TR99pi2xQ/K8g lkzHOUrT/HBKnaaNBDG6skRdf6VFBG5sjjEdGF8n/WKnlC8ZJh2CChmUjAk+ZR5vR1vE 0jww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qzn6LSpfvcZuBf7u07XhH2isAQyLzSDu+9E2Qd0Jrzo=; b=y5VOf/XoJVu7wLoTx3/379sLYxq76dnvQYDpeT2VK3IPfn3AOt1tPGy9LRXGWAs6Ca 7EC4lgZDOdlnWyZKtGwBWEowFXZK+tVqpNp3eGv+mCYKWraaVrZ4kYBUVNTuh8hP1/kT aZR7RnkrU3F3eajKX0o4rHuaWsf6dm+uBZhO3lHmghtTbqCcadEGl/f0agNJgh4G43ri xTfjdcJbbHgK9am+gT5Yk18lRVLcjrbZthMc7Q9DJBjsPElZzMMJ+WwbWxpqV1cNy/0L F3dLHMRTKYEkR+LpY0LU3sQNkwsC5RB5KjQI8vvK0OU2rw9HqyrgY+PAuO4zZvsD8HP1 k8XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fG15XFkt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kb15si2869749pjb.168.2021.04.09.02.58.53; Fri, 09 Apr 2021 02:59:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fG15XFkt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233060AbhDIJ5z (ORCPT + 99 others); Fri, 9 Apr 2021 05:57:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233364AbhDIJ4f (ORCPT ); Fri, 9 Apr 2021 05:56:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65A206115B; Fri, 9 Apr 2021 09:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617962181; bh=935/d+9Z6EF4J1nuSjo9f/QoUwF8wa+o6YFFqGQOjBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fG15XFktAPc/QacMI4IO4C8iZ5RZV5IHPrTov9ChgLW6ebRBTDFNyorodxBzIlYxo s8BIs89+aC4eoLiYheCvYGJkuI0QRKdxn7YKL5qvXFAjCwzVEdOUW/bJzU14M+Davu G9b3r1PsAk4L7tREoBkzEgvoa7zjW94/No9lljcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Esteve Varela Colominas , Hans de Goede , Sasha Levin Subject: [PATCH 4.14 06/14] platform/x86: thinkpad_acpi: Allow the FnLock LED to change state Date: Fri, 9 Apr 2021 11:53:31 +0200 Message-Id: <20210409095300.598125276@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210409095300.391558233@linuxfoundation.org> References: <20210409095300.391558233@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Esteve Varela Colominas [ Upstream commit 3d677f12ea3a2097a16ded570623567403dea959 ] 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 Link: https://lore.kernel.org/r/20210315195823.23212-1-esteve.varela@gmail.com Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- 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 ffaaccded34e..30bfd51c0e58 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3964,13 +3964,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"); + *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(); -- 2.30.2