From patchwork Fri Dec 6 03:19:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13896365 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2087.outbound.protection.outlook.com [40.107.244.87]) (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 1EBEF193438; Fri, 6 Dec 2024 03:25:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733455555; cv=fail; b=lITz6vqEPZV+xZNAfHQyV8+loHF6fvjfHWLUQf66z2e+Gll4hniti4K594GUlaBEkl0Uypzrs4JLbUUmmiQ+Gl/i1GBSzdmLQNyshp+u3QXE8J8mB0yE8NRHAH3dq3zHhy2SSb17GiQw/MTl0KH8IcozU5x8d4DGM9SCyHjnKbo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733455555; c=relaxed/simple; bh=VVG53fkGNnXY44nCUBwfGzttiX1QGh+kxAq81MkR3SU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LAKAwn2TZP1G5uApROyc/9jZMiybY/YMYQuTCU+PlMdyCbSgA0UQGJLzaHX2NSU8l8qNF/PqQhzLweRhC0kWmJDdhND7UPKcB7fl1/BiL6zxI4gBzI8wXQIFEvQNVspKdwbvE5S6UbBd4htdvzggV4679uANVnHvOjZjnhkiCMg= 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=h6xEdGw3; arc=fail smtp.client-ip=40.107.244.87 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="h6xEdGw3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ipLOJjMpLarlk6hWhy9wWBQA4WXr+UUfpfTbfaqjykwciiIayGGOIdn/Xwkyd55NM4cJ3juEIEJeurwJXN4gBjIlgBv9O6ehM7inu1Iji+8mEQagT9DhcavCcZdjvBxW+Nb41vjCC20wy4HJhPrZf3j+EB0cnOpvRrms3IZCsLjzT3/C04Wez6U5vSMKscB9Ziyp3C1/xZ0Jpcsk6hJVyKBgqcxBtORK8t5Y500L28pQRbK8jf37wBTTfPvq68wvdZW3RXlP6mVelUk3xOclOZseQVxASFVH9LFuC5dhmX3Eq0a1PFYU5hseo9gRGde6kOHvyC1HVh92NGh0vQspDw== 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=uBkt/mhA55cPaDFTq1KS/KVyCxO6SdjI4cviXYntBT0=; b=Tiwt1aWsEmgbuyWgPluOgaFdTAsJKaXfyVu+DMN8s8yaiD6C1ffTlIcoG+pLaUy1LGb7jmo2SmD2UJyjETUIazU53LKzbtCFltNMIDsPDcqhiWzceJS3QW0B6BQ1Sb5P3SyJfHNMR/EWHyLHtVIsEgGEnlXS1oUzkSxufMWu6LdomI7Xfl6WZQUXg9vMR2S5aBwccQ3wSJMp+4/JgDuSQKjI+kYK9AZGuWjKC9A9CQBSZWR/paairdF39Vyv0pZf4Lf7XCdvupH0gluQipFHlmRxXuDqd+GIphhPi6mS1mMTA3J7rlYiYGn8EOlF43MSU1eyZQ1LIBHloTGV3jiYLg== 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=uBkt/mhA55cPaDFTq1KS/KVyCxO6SdjI4cviXYntBT0=; b=h6xEdGw3IgvnZTs0JhsqsLkoiuxNLxFGidNR8jpnfLkZm8rW7vh7CkTm3hlXeqmABTdEJN2i17CDC90bj/I9Si5zjjaDT9m4db5PfTPTHS7IZ+JhzecjckaHdH3p9zRiTowfL9u2srq0da6iPtB09UvXDz1g8rxPeAX5+p7rrh8= Received: from MW4PR04CA0053.namprd04.prod.outlook.com (2603:10b6:303:6a::28) by PH7PR12MB7164.namprd12.prod.outlook.com (2603:10b6:510:203::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Fri, 6 Dec 2024 03:25:50 +0000 Received: from MWH0EPF000A6734.namprd04.prod.outlook.com (2603:10b6:303:6a:cafe::5e) by MW4PR04CA0053.outlook.office365.com (2603:10b6:303:6a::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.10 via Frontend Transport; Fri, 6 Dec 2024 03:25:50 +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 MWH0EPF000A6734.mail.protection.outlook.com (10.167.249.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Fri, 6 Dec 2024 03:25:50 +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; Thu, 5 Dec 2024 21:25:46 -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 , Armin Wolf Subject: [PATCH v10 12/22] ACPI: platform_profile: Add choices attribute for class interface Date: Thu, 5 Dec 2024 21:19:08 -0600 Message-ID: <20241206031918.1537-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241206031918.1537-1-mario.limonciello@amd.com> References: <20241206031918.1537-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6734:EE_|PH7PR12MB7164:EE_ X-MS-Office365-Filtering-Correlation-Id: 81006754-bd3d-45f3-b5fc-08dd15a5aed0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9THWBWQbnYm9QOFg4zz8txs+lzuFGiD?= =?utf-8?q?7WSm+2rGTSdUhmK4TVXZ/eMmxmLB+5yXGJohF/ysagDigyyU2LLo3+4myfp8LhQ/B?= =?utf-8?q?qIF7ITeaeYfY71XN9ub9GP3ZF1P9ZqH7V+wBbvhr2IGLNGxS0hNWBIwLLWlYXCC2r?= =?utf-8?q?FjzT++ENBx/N5ET+wQb+5Q1Vmk5+8URhs59bzvyJwZVkf1mIGqSkjeimXQ5yD61Oj?= =?utf-8?q?zD/7EExFlqIm1GC839NEStImk04m2h7qPdmc5nWcTBHH56ybVLw0qXDitbaKCGucj?= =?utf-8?q?3oEPFKhjDTleA4kqHHsaEp+3RWCU1bWKnoinKP3CVD2e1GgVuvIF6+Z9oKdWyBdS7?= =?utf-8?q?hsQ7DXfvphPBWVY/o6si7KNYVh72XnDkW7OrB4Ixgpbk4JNZj0sXh+0Muv+bA+bWk?= =?utf-8?q?CafvxT6cACrVGEFwdqNwzzyJZCBC8R8EJZnjcD3HYjRwTkTSKvv88sSq69JfE9Oeb?= =?utf-8?q?Oq4g1l6WQ4lNUqtCDS+AvIFYbGOYCLzErp9keiTGXaAbBok6HHQtZFwNsF+IqbdAz?= =?utf-8?q?uDHG7Jmgst3z7cfKMjA4+cW+3UC/KyEUcXA7449+VkEYx+Az9eNd14kw5qYOV3BCs?= =?utf-8?q?1evhOU5QErgrbKp8CJZyYhKCPcal5vN9GFOC3/IjpIK8aJXQb9YsV7OmkxAODnl7e?= =?utf-8?q?p8sjdl2W3OZQI+f1ILCvfpmRk4ZZkpA7Zv/p840ueW79nk0eKku+RlpmSuca1J3hE?= =?utf-8?q?2klOfQOop58nkdGacDbrOP1ErlTNzQsVpJNrZ3LW0Z+EsaFaQ21Xd8PvGfE2Zbc4t?= =?utf-8?q?150DkDVZt+ub2NsOVvlh/f/KP0mH5mO32gg95EsliHhT6Lww1na+2cdJtiv9sm+Qd?= =?utf-8?q?DMbS4z7JqNrO/a1M0oPkJMLp2wBvLrtQKaY1yxQUdVasOObmwioHnEAWuqwmAC8Xu?= =?utf-8?q?lWdMnYjVR7FRqEjMo8Q5kcTULy5WSvj+mRErMUS6dRMrTFQvz8LlER1z1F5bRdVg5?= =?utf-8?q?ewD9DK7E9fzbbQ6/UQwL4HO6oAjRaRx9asfcJg/o2LiV810kHljCKLgSwJA76ZqG4?= =?utf-8?q?BdBsv7NGic4TlfZKPScc/OSaw0wt5BYN7XcKPbz7Ta4sgVHsYjq1K/4X3Smu9Grbd?= =?utf-8?q?2Jd4ymCibn2lepVdOj6P90KM/hTgto6X5rh1C2ijQPRmfwqGs+JzU5NKEibR5tsBi?= =?utf-8?q?vneMcjm/GPC3+yGHFCG1n0AxTbtsp/fPaAVQpYR8aZm7mDE3cws/Rsd5hfY/Bm4eh?= =?utf-8?q?PQ0wUehbXCjKMmNxj1b38inQtjEAlwJo8J8lHFfp0gQt/dw2odk1AUdureFLhOin8?= =?utf-8?q?vrtnIhI7VLlQex4CyfIzj3hwUJtjp+tYSorVaY2Zs+2aAbxDidB+gQA7tlyst5Zly?= =?utf-8?q?kzvO/eOXBW2nnhZkwD8DdzoVxBUJ3QIrXfKteNfrdZpwN4SwCIhy1ScQNycV0aGPI?= =?utf-8?q?GcDx4XfWYa0?= 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)(7416014)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2024 03:25:50.1616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81006754-bd3d-45f3-b5fc-08dd15a5aed0 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: MWH0EPF000A6734.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7164 The `choices` file will show all possible choices that a given platform profile handler can support. Tested-by: Mark Pearson Reviewed-by: Ilpo Järvinen Reviewed-by: Armin Wolf Reviewed-by: Mark Pearson Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 49a8bd6e97ece..885f41bca6c25 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -25,6 +25,28 @@ static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST); static DEFINE_IDA(platform_profile_ida); +/** + * _commmon_choices_show - Show the available profile choices + * @choices: The available profile choices + * @buf: The buffer to write to + * + * Return: The number of bytes written + */ +static ssize_t _commmon_choices_show(unsigned long *choices, char *buf) +{ + int i, len = 0; + + for_each_set_bit(i, choices, PLATFORM_PROFILE_LAST) { + if (len == 0) + len += sysfs_emit_at(buf, len, "%s", profile_names[i]); + else + len += sysfs_emit_at(buf, len, " %s", profile_names[i]); + } + len += sysfs_emit_at(buf, len, "\n"); + + return len; +} + /** * name_show - Show the name of the profile handler * @dev: The device @@ -41,8 +63,27 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr, char } static DEVICE_ATTR_RO(name); +/** + * choices_show - Show the available profile choices + * @dev: The device + * @attr: The attribute + * @buf: The buffer to write to + * + * Return: The number of bytes written + */ +static ssize_t choices_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct platform_profile_handler *handler = dev_get_drvdata(dev); + + return _commmon_choices_show(handler->choices, buf); +} +static DEVICE_ATTR_RO(choices); + static struct attribute *profile_attrs[] = { &dev_attr_name.attr, + &dev_attr_choices.attr, NULL }; ATTRIBUTE_GROUPS(profile);