Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1818861rdb; Sat, 20 Jan 2024 15:30:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkYIVLEmk1CMIW2aeictxpylGAddsYSx9tsijBK6CccklrFySyGXVSZQ4inbBVtCWWuHV3 X-Received: by 2002:a05:6512:1386:b0:50e:8e8f:9a48 with SMTP id fc6-20020a056512138600b0050e8e8f9a48mr943581lfb.127.1705793411959; Sat, 20 Jan 2024 15:30:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705793411; cv=pass; d=google.com; s=arc-20160816; b=T9614zk2FGfWrmQHDHbfWL4NfMPn7+V8EIFeM/0vWDvCOlcywql8+6UEYJjke1/cxq H2ZskKU7SvuvsygkuJyvMRYTcQnKsZnOudULp4gz4QUlCzxfvD/6qSioVARNG1T59H4U Mct7S8MxiTVVlOthAFQQb8kID75v9v+GmcH3U1u622kDI9J5FFSva0DDzuibmux4MxWi QMv/6nRLVbKd5CqcPeh6v1bg3f9T+4KhKoiPDiO20EQEsvnR1CjCQ3jrKHQu/wn7fgEd tOmYo4fM07Ls0kzuiInNywozeLXrnLbo+YTQcE3uQp6HCM9cpBUbTgMEYQ9FpR1vUGHV z5XQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=WGvMaEsDltLoKXJgl9GSQOJtstKvutWc7SjgzovOw38=; fh=45lGonNTq/TKX3qHEi5fFASz44H5VQ9cHm/hamBmFxE=; b=RQZsIsOx65+BD/PATR3QiZy0/lHyaig5rrcwpL6hPW973eVCvDFCJ7QcVaCo2bXDm0 9GMebVHXKHBIQrdZHs0LfXsHGILmdyhoJPgs//L2OKGhZFiVJMzVxstcNr9SJikreR5/ WVySxWjbkrRDIMwdw5yDCOzxj/K3kyWpSthQEuf3nEqNZsdfeTfenJZw8e3/cvPz2eqq gC4RCdrygl+rwszvqT/J2YlL7b55Ao3RqevUFy9m5lVmeQVz3mB2r8y0FjCnui/Ile7K HQHOxjagrWV4pnVH0VCi0zyt8odY2ntOv230aemN0zdE5qS2Prc5aP7sF4LPJcdswN0v qzvg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm1 header.b=cf2HrC8m; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LZjagTr0; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-31938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31938-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c10-20020a170906d18a00b00a27a32e70d3si9179911ejz.904.2024.01.20.15.30.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 15:30:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm1 header.b=cf2HrC8m; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=LZjagTr0; arc=pass (i=1 spf=pass spfdomain=squebb.ca dkim=pass dkdomain=squebb.ca dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-31938-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31938-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 608841F2253C for ; Sat, 20 Jan 2024 23:30:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B54F014ABD; Sat, 20 Jan 2024 23:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="cf2HrC8m"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="LZjagTr0" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A860314A98; Sat, 20 Jan 2024 23:29:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705793399; cv=none; b=XMoJPyYRQAm184jHhIctI1Y3LDMfbaeZ8HXDD8zWp+o9Szbe164hPhl/aknS1l/1HrUlkyPykcQWBGFKR0ywIJrR328Ihw8X7csW6xx+mL7mnLpkrOBimT/4qHrfg6AH/wkO+EBNb61dqXbJdv2Gc4OLE0z6y/Joxl8XASJXSKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705793399; c=relaxed/simple; bh=gYxQpuVqxVWQkJvr3V8GaYIGnpPdH4JHwRwYm+3Culs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HLhmJwNGRqW4XDU/12pQBjiCgrik17dEdeKUcR4rLXT2+ydgBRSdiFnAQMLuIK6G4eiUUA4cqvcrjHtPrWEEXGzGFTB3IrkoUNzvdKFNMLwKytmkiUWrrK9l6ZpuxJKIR/HiA6E6lTBE0ZtllsoSguf0l9OoA2E4Rwpn3EdSiww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=cf2HrC8m; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=LZjagTr0; arc=none smtp.client-ip=64.147.123.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 0DF373200A40; Sat, 20 Jan 2024 18:29:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sat, 20 Jan 2024 18:29:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1705793394; x= 1705879794; bh=WGvMaEsDltLoKXJgl9GSQOJtstKvutWc7SjgzovOw38=; b=c f2HrC8mjhLbVIlK7oWYepvY5TStNV+Vh73y2tN6QkizI8WvEprMpH+pc8mGMpPlB Dcvh0pV2AtyO6bRGf9EA4qXmfSJxHT+s0mkhgqJLe/0zX1l2qtEBRIj+UvLYQR8Y qtRV4vjtO7rySI6IZkM75W0mGJvOgwbx/oyyI77OALx9GQHAx8fAYv6ScH4r+114 B1mAbgzpLPCRm0hfk+YoQ80j3EQhJh34QkCq29xTRLcRCJEOZjK79UIsUupI3ul7 YF3B1a/yvLPA07fXz+cHNXEpHkI408bf7gwg3enE9R8F5WP0b7l5G1AHr7zz2FAZ u7ZFU1M+XSu9R3e+xpRnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1705793394; x= 1705879794; bh=WGvMaEsDltLoKXJgl9GSQOJtstKvutWc7SjgzovOw38=; b=L ZjagTr0ocJCNOojS+rhJfy8k9ExRIJ33lirPciH4g64kQ4XrdB2DwR5huqTMQD0a pSc9XZfKSBHdcFv27Wkvj8WkSDwXZ+n0imOillo/FfwtnDLKyVXO8/XF8XzWsypt 4V1qZkx/fjf9roAZ/SEeA0z97dKOsKccynGL/uLo+ug7MMDGcnK1kb/Cn8IeYFK6 QS8PwJeJUqQ11lgTW3+M5VfwdKdy4cQYieK8i7CjgleBqxRYZ1yGKzLmJKADWl+N feW1LbIGLZQHU5xvHpYG4L/Zur9ojlLu7H4cnzpIM27ibL+c+8mv+lGIw9hO92RX RFVuW7BQGE9SwDnMGPauA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdekfedgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoteeftdduqddtudculdduhedmnecujfgurhephf fvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrrhhkucfrvggrrhhs ohhnuceomhhpvggrrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrgeqnecuggftrf grthhtvghrnhepfedtvdejfeelffevhffgjeejheduteetieeguefgkefhhfegjeduueet hefgvdffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epmhhpvggrrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrg X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 20 Jan 2024 18:29:53 -0500 (EST) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: corbet@lwn.net, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: Support for mode FN key Date: Sat, 20 Jan 2024 18:29:34 -0500 Message-ID: <20240120232949.317337-1-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit New Thinkpads have added a 'Mode' Function key that on Windows allows you to choose the active profile (low-power, balanced, performance) Added suppoort for this hotkey (F8), and have it cycle through the options available. Tested on X1 Carbon G12. Signed-off-by: Mark Pearson --- .../admin-guide/laptops/thinkpad-acpi.rst | 7 ++++++- drivers/platform/x86/thinkpad_acpi.c | 20 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/laptops/thinkpad-acpi.rst b/Documentation/admin-guide/laptops/thinkpad-acpi.rst index 98d304010170..7f674a6cfa8a 100644 --- a/Documentation/admin-guide/laptops/thinkpad-acpi.rst +++ b/Documentation/admin-guide/laptops/thinkpad-acpi.rst @@ -444,7 +444,9 @@ event code Key Notes 0x1008 0x07 FN+F8 IBM: toggle screen expand Lenovo: configure UltraNav, - or toggle screen expand + or toggle screen expand. + On newer platforms (2024+) + replaced by 0x131f (see below) 0x1009 0x08 FN+F9 - @@ -504,6 +506,9 @@ event code Key Notes 0x1019 0x18 unknown +0x131f ... FN+F8 Platform Mode change. + Implemented in driver. + ... ... ... 0x1020 0x1F unknown diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c4895e9bc714..ceb22f8d8442 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -166,6 +166,7 @@ enum tpacpi_hkey_event_t { TP_HKEY_EV_VOL_MUTE = 0x1017, /* Mixer output mute */ TP_HKEY_EV_PRIVACYGUARD_TOGGLE = 0x130f, /* Toggle priv.guard on/off */ TP_HKEY_EV_AMT_TOGGLE = 0x131a, /* Toggle AMT on/off */ + TP_HKEY_EV_PROFILE_TOGGLE = 0x131f, /* Toggle platform profile */ /* Reasons for waking up from S3/S4 */ TP_HKEY_EV_WKUP_S3_UNDOCK = 0x2304, /* undock requested, S3 */ @@ -3731,6 +3732,7 @@ static bool hotkey_notify_extended_hotkey(const u32 hkey) switch (hkey) { case TP_HKEY_EV_PRIVACYGUARD_TOGGLE: case TP_HKEY_EV_AMT_TOGGLE: + case TP_HKEY_EV_PROFILE_TOGGLE: tpacpi_driver_event(hkey); return true; } @@ -11118,7 +11120,23 @@ static void tpacpi_driver_event(const unsigned int hkey_event) else dytc_control_amt(!dytc_amt_active); } - + if (hkey_event == TP_HKEY_EV_PROFILE_TOGGLE) { + switch (dytc_current_profile) { + case PLATFORM_PROFILE_LOW_POWER: + dytc_profile_set(NULL, PLATFORM_PROFILE_BALANCED); + break; + case PLATFORM_PROFILE_BALANCED: + dytc_profile_set(NULL, PLATFORM_PROFILE_PERFORMANCE); + break; + case PLATFORM_PROFILE_PERFORMANCE: + dytc_profile_set(NULL, PLATFORM_PROFILE_LOW_POWER); + break; + default: + pr_warn("Profile HKEY unexpected profile %d", dytc_current_profile); + } + /* Notify user space the profile changed */ + platform_profile_notify(); + } } static void hotkey_driver_event(const unsigned int scancode) -- 2.43.0