From patchwork Tue Nov 19 17:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 844296 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) (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 9E4131CF284; Tue, 19 Nov 2024 17:21:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036864; cv=fail; b=l2oemHPdKJzMAgkTh+VB+78Lc4he1VZWhMiAvgXxxMHTdDm43XClyyLl62qys5/wJiJPm7B++IUR3uUP6IhJ54hOSh4LOaEyyp6wENI7yr1kcCdsVISzDNPtlb6VX29pwEjShDu2tqrL4tRYzvMYBhvnOZ9pk1+L1DwaszgO1xw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036864; c=relaxed/simple; bh=u0bo1iUqU7MrdandF2NBdSaOEBYA7UUUOOIVI4k5lI0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=bwoMPl1OStOxjwNwpP4UzqZyED5Bjpnhgz5J9tJKwk1/1KLx7el6xjQoqTecRXtSv6TXDFNYEBof7I3ORzpsJ3NVy6CG3+Y0DR7wfcAgfZvwRJkgma0U15zFmx+v7dFk5MKWVDUKzFJ9Ed9eiDD8FjMQiaAmF4TMNt4wkwmXILI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=zoFgiADi; arc=fail smtp.client-ip=40.107.243.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="zoFgiADi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QUqQBsqnsWUuZb0HZQLcc9kgQq/Csk2tM0/KGMAlmnt1iqyeyMTUZTMYBjaFqTX/qsZ78L+5R+OCeIQW4CKrqwa62G4vL+ABR1zdbEQ4Obl2o7I52udJlBgBv4EJul8vPkxN9E4cA/gDRu9SKjqFtKgM+8mvdv+HIx5LR/eJvzrNLJU+0OJy7EdqAie0lXBNy/tkIGTTnfVHjBDh+hsa/hjgVEF3Nt29Y8AhuzMEQBd2vK+JPfWGNrv4jc8w0yK15NCnE6qVdvgws+OLfk4PuaGiAIGrATJGe+1OB6X5rdHi+LUfCyjEWHfijp/NIVYzO5kakkJ5obAvbXhwlR4f+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1uWW3kn3OTm0oKBEIgYyAINqQsNJvVclVIo8c/F8oqM=; b=wBFBO5mKc3Bb5jmstmGtUBKZdRorRGswFUDkiDZXiFqEPSs2bJJYF8ohY51V2Wz+ZdrtqLhPxcTi00ol8ylFetJSJJrYN8srapIKQx0I399KAydiEkOXXf34XR43dFx03HWeLJ111pLYf/4nmgFehNl4llx4exbl6qiqFxo0gZwR0rdS3ZtxE0Yn1w2IRhvSLGP1mDCVnP1sbm3NtfjTzdMHJGn446KskOHF78+j50k/UvMdSxoGj+0bMm1pTDAEISDU5WpZ1rktZaTQTyqSUBw/BuvI3Mhx7uy9a33LpN5KnGOhBmLxXcXY/VmAEyeSCZ9jKqR/gtSBgeGC7BnmYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.12) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1uWW3kn3OTm0oKBEIgYyAINqQsNJvVclVIo8c/F8oqM=; b=zoFgiADi4paK5qTXzl4nUicZrM8fOzBaDx5f3KTFtWG4op60epbz0RUdUTVRKwXPLR6QODncIq7qE9EalrORBGNfZRqjO6b5su3UmKL6sqgZHY1UMTE6kSGQpDqoKoi2Kj2I71HKspTOKdHuD0BivMVwN65LOnycPVRWTQBR+Ew= Received: from CY5PR15CA0249.namprd15.prod.outlook.com (2603:10b6:930:66::16) by PH0PR12MB7094.namprd12.prod.outlook.com (2603:10b6:510:21d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24; Tue, 19 Nov 2024 17:20:59 +0000 Received: from CY4PEPF0000EDD1.namprd03.prod.outlook.com (2603:10b6:930:66:cafe::14) by CY5PR15CA0249.outlook.office365.com (2603:10b6:930:66::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.25 via Frontend Transport; Tue, 19 Nov 2024 17:20:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.12) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.12 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.12; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.12) by CY4PEPF0000EDD1.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Tue, 19 Nov 2024 17:20:58 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 19 Nov 2024 11:20:56 -0600 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v7 00/22] Add support for binding ACPI platform profile to multiple drivers Date: Tue, 19 Nov 2024 11:17:17 -0600 Message-ID: <20241119171739.77028-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD1:EE_|PH0PR12MB7094:EE_ X-MS-Office365-Filtering-Correlation-Id: 20e403fc-b999-470b-b403-08dd08be88c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/gfaDdew+ugtg47K1amD7vmkcwT6dG1?= =?utf-8?q?79M5pdz7nHiIrbwswUOWPjx3XXYEk5tOKtsXusCsE7/SYc4JdRMyXzQJ1SLv48U3N?= =?utf-8?q?DIiic6o0YHHPyNNrdtjvq3NylnTY+zlYUDawhXN0hNJCtd8wGxhcjmoIU+7R6yOTF?= =?utf-8?q?RhGo8+kyIa4N2B1mxvPZsO/vANdBDF45XNY1nTgag0WXpLWWuPLmt6OtsV1RymSr6?= =?utf-8?q?NSH4O9bDduxZ/VoN1bynx5dEHmaDIyydg8XFGMqsNyJnYOaoIB8EN3nJZ7EiICCjP?= =?utf-8?q?aI1VH+xqoT629dYRhsBfbAgmYXBc2Khm9zNrPdfsjBsDFche7vg9qRcxziYtnqhMs?= =?utf-8?q?HewnZxXD1oEGRKDM4KsvUGz28xZth3QTfrOU2IflKzttcc+ElTIkS/OFcyHqwEpa1?= =?utf-8?q?wmjjLeBQLBB7um4IUMOovfKbl24ZsKX2gfzYfnrUKsb6zC/BvZvMJ+LjStwOIzGa7?= =?utf-8?q?/ldmTiradMr/X3/7HOiHTJeWilJFkfCyCVHbjLBGbYT9TZsOKnp08EDShZrBihnIg?= =?utf-8?q?LvFfxdyfdlM1AF+2B17mtlZzlpIvFoMOh8oEFNQtj6caJqWhR6eRAyxaVCapFZZ1n?= =?utf-8?q?d8K3nlCqjGHh6f5P53e3Wsm+mqJ5qM9yghEKp8BPgvaSstxUcSG2hp/ysABUrqrOZ?= =?utf-8?q?yL3pbnuQ2ZPIgOJoahC7uj9t5mkGNA256aZR/NJVNXGdJ1CRvv0JZ2NJFFe+cV/Gk?= =?utf-8?q?kGYY2C1PE/ddQg+eDADWwA/cF1xBSxFpfQJJOUfQg58yHJ1iH659dVRfxscylIGei?= =?utf-8?q?C/ltz6vkmmBGWY3fyknd1kmVpbI/pf1vzzEpnJpMoOWRLohnpwQAnxai5bxopaLks?= =?utf-8?q?t5b/y1pv1xN2NmR2izuJRm1OEA0kojbKDyEynajhsS0tIbbYRrrzf50S8C6JZ/sO8?= =?utf-8?q?pWgGdPVzGeHVAjdkW+mOV9e9h9Z6GIfwqvZvwSbsjmRYWQZ7gMEe/JBvS+CRiAXEG?= =?utf-8?q?XvWb2P+LmW57y7xeMjoMbNQOEywFL4ALPeUQJH/t3Sv33RQmPKy2k5xxeIsq4C3wS?= =?utf-8?q?4OIm/p/tP4c9mDtQNHexBAFhbkOM2pui5/+BlVdp1ssWkHzELzM/ZOWhpoNInWPfC?= =?utf-8?q?AWwtex1dZnoefGYMYiIfG6dA0HVAwX2Oaw4aApvP3PJCDCuQSxLVOUuyQpyc93JGG?= =?utf-8?q?Iwg3bz9frFMhj3RmMmpvESmYMt5aI2vdAc/WVXpbeTM4ZkhJS19CHkh8JwKdB6aJr?= =?utf-8?q?kCswlu8PEGV2RuSiLDgZF/kvYlQJ6MAq/ycvj4Ps1wF2HE6EVxtp/vwzCocNzJJ5X?= =?utf-8?q?a8Hz8pYTDc2HRpHGxJkmauI4ok9LBU5j/qdlIJ+GgOWfSsHk9nXcHutgruSSPNAyp?= =?utf-8?q?HFSEQPbPFLiylOicHuGC8LDCRJbgxCYejw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.12; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:atlvpn-bp.amd.com; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(1800799024)(7416014)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 17:20:58.6488 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20e403fc-b999-470b-b403-08dd08be88c9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.12]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7094 Currently there are a number of ASUS products on the market that happen to have ACPI objects for amd-pmf to bind to as well as an ACPI platform profile provided by asus-wmi. The ACPI platform profile support created by amd-pmf on these ASUS products is "Function 9" which is specifically for "BIOS or EC notification" of power slider position. This feature is actively used by some designs such as Framework 13 and Framework 16. On these ASUS designs we keep on quirking more and more of them to turn off this notification so that asus-wmi can bind. This however isn't how Windows works. "Multiple" things are notified for the power slider position. This series adjusts Linux to behave similarly. Multiple drivers can now register an ACPI platform profile and will react to set requests. To avoid chaos, only positions that are common to both drivers are accepted when the legacy /sys/firmware/acpi/platform_profile interface is used. This series also adds a new concept of a "custom" profile. This allows userspace to discover that there are multiple driver handlers that are configured differently. This series also allows dropping all of the PMF quirks from amd-pmf. --- v7: * Add tags * Rebase on pdx86/for-next * Armin's various code feedback (see individual patches) Mario Limonciello (22): ACPI: platform-profile: Add a name member to handlers platform/x86/dell: dell-pc: Create platform device ACPI: platform_profile: Add device pointer into platform profile handler ACPI: platform_profile: Add platform handler argument to platform_profile_remove() ACPI: platform_profile: Pass the profile handler into platform_profile_notify() ACPI: platform_profile: Move sanity check out of the mutex ACPI: platform_profile: Move matching string for new profile out of mutex ACPI: platform_profile: Use guard(mutex) for register/unregister ACPI: platform_profile: Use `scoped_cond_guard` ACPI: platform_profile: Create class for ACPI platform profile ACPI: platform_profile: Add name attribute to class interface ACPI: platform_profile: Add choices attribute for class interface ACPI: platform_profile: Add profile attribute for class interface ACPI: platform_profile: Notify change events on register and unregister ACPI: platform_profile: Only show profiles common for all handlers ACPI: platform_profile: Add concept of a "custom" profile ACPI: platform_profile: Make sure all profile handlers agree on profile ACPI: platform_profile: Check all profile handler to calculate next ACPI: platform_profile: Notify class device from platform_profile_notify() ACPI: platform_profile: Allow multiple handlers platform/x86/amd: pmf: Drop all quirks Documentation: Add documentation about class interface for platform profiles .../ABI/testing/sysfs-platform_profile | 5 + .../userspace-api/sysfs-platform_profile.rst | 31 ++ drivers/acpi/platform_profile.c | 525 ++++++++++++++---- .../surface/surface_platform_profile.c | 8 +- drivers/platform/x86/acer-wmi.c | 12 +- drivers/platform/x86/amd/pmf/Makefile | 2 +- drivers/platform/x86/amd/pmf/core.c | 1 - drivers/platform/x86/amd/pmf/pmf-quirks.c | 66 --- drivers/platform/x86/amd/pmf/pmf.h | 3 - drivers/platform/x86/amd/pmf/sps.c | 4 +- drivers/platform/x86/asus-wmi.c | 8 +- drivers/platform/x86/dell/alienware-wmi.c | 8 +- drivers/platform/x86/dell/dell-pc.c | 36 +- drivers/platform/x86/hp/hp-wmi.c | 8 +- drivers/platform/x86/ideapad-laptop.c | 6 +- .../platform/x86/inspur_platform_profile.c | 7 +- drivers/platform/x86/thinkpad_acpi.c | 16 +- include/linux/platform_profile.h | 9 +- 18 files changed, 542 insertions(+), 213 deletions(-) delete mode 100644 drivers/platform/x86/amd/pmf/pmf-quirks.c base-commit: c6a2b4fcec5f2d80b0183fae1117f06127584c28