From patchwork Sat Nov 9 04:41:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13869203 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) (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 5A4363BBF2; Sat, 9 Nov 2024 04:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731127346; cv=fail; b=pIfDga7EfDJd2IWPIQBOWhGsEYaDUJmEmMR4jyam+qDHko9WmzcawnhXg8bTf6keAD0/Qnm++xOTeMu4JkK1vJR+AR+K+BeWNkaMd5ENp9UsWENg2z1Snu8CgGL9a7i8tg6UzKnNoCX5lasdJROwnfxu7QkIRWM9FcdgkPHgZd8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731127346; c=relaxed/simple; bh=NIVfQJDudamk4kAdjZ1pFWmr6mnKOKQnOf7asbqfHts=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MbW7+UbLBn4lZWkr3P5MIXNHcgudpWAVQz0YDgb1O0U5/6HZCvBn67CROLenwgSx8eJ5gAZIe6fqy/NpjtMvmWM0xIMKuRicpzpd+btYfono7+l4VLq544MY6xAoSYRt1Kpf8w02ahMDHCe9yjdDqnKT1uIVXQ84IF0ctEwSAvw= 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=YYy1+n6J; arc=fail smtp.client-ip=40.107.220.64 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="YYy1+n6J" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o5Y6Dqxc6AXJ5N3c1HtIylJ22+BrbdehOD0sXFfrnPRCaTadrG3MfAy8VpVMoRb2mg14dtpY8POxpQwCF9PQYmzlCKYpjmCz1cElZvSRGv51XyutNDgQCU8BdeFzDQS3jx1SZ72LNrE2IptNwOpyvvdso/+zISavzEEPAnHF5R9gF0RsPUBFfG0rbiZ85z4+ElPKQS4X8UAfTrRKYH/khv3UIPZanOfMfcVHxrhMg0KJdh2zNiSuD8ZEyY8Sv3xqFqozWutpw4OHCFHigOS2Cy/ygxH/rtgOo/6tvfo0k0wri6pdmshHDnAzP1tBSOCh4x6m9UTQtPAuT2ZBQ89o9A== 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=PTlb+nhgKaUeVff1RjkbqoKhPCcz+Ro2cOyIq8tRrUk=; b=FhlwbqbRJcUNEs30CPNM/BAho8FK8M545a6fIenShf7+NbSkYjmCm7gnU8vrw3XucCt5B++vPTcXJ5RQCAm/yVixJqMh2qUpId3bgO9DnARXJlH9HpCJWHgSuTPjB+5trSBsfmcO1Ez55mzZLbPakgrOjKStqjfhmpOpy6U6GKtgnOMMUJ7GOmTC/V7ZfT7CZqeWRdmSdjtMoB4lWhg1SJgiGouFhgoFyjXrLlHnuCtUx3AZkZ40rx3egkQzTgi2M2okYbhGJIGUm+FPOAgOnwECOM8QlC3daSIwqiQqPwZJCEyxJ/ThPQB/OFcTb5KijjUq+suSFj/zEeHpq/wDzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) 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=PTlb+nhgKaUeVff1RjkbqoKhPCcz+Ro2cOyIq8tRrUk=; b=YYy1+n6JPhc/OBvEsDxrsTMLD50R3k8xahT8JV+iS5P9sE0pK4wZEnMhynbE2O7SwTN+7Br928Ho9aETRzS65FHfusvXU2s4uFOfHH9wGUsOT55/aNoF2zEasaduWQZPkOxq+2k8YDbTBuQgR9m1GnRtR63I9z8D4K3J3l/gin8= Received: from SN6PR04CA0080.namprd04.prod.outlook.com (2603:10b6:805:f2::21) by BY5PR12MB4321.namprd12.prod.outlook.com (2603:10b6:a03:204::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21; Sat, 9 Nov 2024 04:42:18 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:805:f2:cafe::54) by SN6PR04CA0080.outlook.office365.com (2603:10b6:805:f2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21 via Frontend Transport; Sat, 9 Nov 2024 04:42:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) 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.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Sat, 9 Nov 2024 04:42:18 +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; Fri, 8 Nov 2024 22:42:06 -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 v6 00/22] Add support for binding ACPI platform profile to multiple drivers Date: Fri, 8 Nov 2024 22:41:29 -0600 Message-ID: <20241109044151.29804-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: platform-driver-x86@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: SN1PEPF0002636B:EE_|BY5PR12MB4321:EE_ X-MS-Office365-Filtering-Correlation-Id: 3739ea1b-c6bb-444b-5387-08dd0078e444 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?iPlJALesYELtLdCzv5dIBXL5KXkGHDJ?= =?utf-8?q?4zt5K7Lg1lwh+aAESiKptXTQiGYZGpnE3+k0ueMa5V6hU2ew0181qr4oApT7ofyGH?= =?utf-8?q?sh8TBkh39TY4XckTSdYXqUai0cXE6A4ceZkoheY0NyWBDB7lZDr/hK3Y774TfbJhC?= =?utf-8?q?lge+RaSvzyqxHBoy1KbSK8FsuUTYWKLKN5tpQXF8bSy7laMRs6aLzI0Do6WvF7DKA?= =?utf-8?q?JiOrseHV2pz8j77aqRysbgvtH3p0etZ6p3VaAPGSEiRhhZxsvLiC+MEuL+Lj1oPxO?= =?utf-8?q?W9si6GX72pZnyEDO633JjzcUGQzG8CiFK8Ak5RJK2fKYin46bsA5fyuxK9fym6uxp?= =?utf-8?q?q9wpYZXPllFKNRCQE5LzsK79FNPy3uPsWtYjJlawuzS4SVuazr4zI+XzxBH29iM0T?= =?utf-8?q?IBg91+eiCRWOBzx3dq+q0ln0KgZ6SdpI+I50f4BRMUl8n+zdq0nZf8OevVXBS57EY?= =?utf-8?q?OAVs8vA+iS55lyfJDOs6w8t/2yn/y3vbRLb8JbnhwDYvuQbp/o2G8YDth/H8dWowh?= =?utf-8?q?5hGrn7TNMQ7hY6odMsLKsZn1WBsbWDAPS/B9+lIJiXLg1Ob1ZB1nypqB8HSP7AqL8?= =?utf-8?q?yGI3999lajPo7wHP2iU9cXCcscALZnJfAXVu1XDrOPcRIpJNH1BtcyFCJKLrAH9zb?= =?utf-8?q?ZsoSMKzF4c0P6Uuwzz63wV9X3EtuJTCW4rM3ZzIE7EInWpitYQZf1hklzhpve9kYb?= =?utf-8?q?p8ddsHZ2Nt2vHrgm+xUayX4+aogDifoYGfh6UfNO9U2cUI/UB4wPOIzQTNYFFNIPe?= =?utf-8?q?E77GuOMnNRemFq7AEzN4G8iRiBPCnW0xt9geSZMrcUBo7cHz6lb3nHmXWy12Per/e?= =?utf-8?q?6c6odP1mwPy/OFhSZRi4NlPVDYUzwb0IqsA6rM0OW0xoIt6poA4Nx3Uixezp8yfmK?= =?utf-8?q?j81Mcf2sIv+HWINtAx9bykytzA2k6mPMFSICFYlZlN2g4+p+NaE4rUEwPE8F7B1Ms?= =?utf-8?q?rMDp0ja7GUh5Cz2IcMFz0mqspAImkOmCR7ULUDzJfThE5Ep8iKS39/+0eH67Ania/?= =?utf-8?q?o/+cOYuEScJq9XGzu6xv9GzSZsiSS3PLGeTQxp855gSLWK2O5fzalCPC7RDKW261f?= =?utf-8?q?QJum9Or/NfcgprTzYRpSmJrzJ3Ghzs/Wh0oodq0L52rguQfkFAt35CIZpFkrYOIqm?= =?utf-8?q?6/m4fwMa+w5mLxVKRuLZ9iV+VA6xsk4mrhAbHvs1fXkxTlGYqh55CSdr9ngRAndcg?= =?utf-8?q?njMI9J/q06Icz0DjAw2/a71R5vD+eAQWzex835r8XnGkRU6uwUsC3o+btkws7bqs7?= =?utf-8?q?L9lUaP9hspd6HCYxd830uTw2R4P3l6HTgUn3ohgQjgIHPyeTo9Va4fHEWajxhu9DH?= =?utf-8?q?+23cy5NZtZGAyfFUK1Y9DO3eXIXQ0xN/PA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2024 04:42:18.1455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3739ea1b-c6bb-444b-5387-08dd0078e444 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.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4321 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. --- v6: * Add patch dev patch but don't make mandatory * See other patches changelogs for individualized changes 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 | 28 + drivers/acpi/platform_profile.c | 537 ++++++++++++++---- .../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 | 10 +- 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, 553 insertions(+), 213 deletions(-) delete mode 100644 drivers/platform/x86/amd/pmf/pmf-quirks.c base-commit: d68cb6023356af3bd3193983ad4ec03954a0b3e2