From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792882587; b=IhjAGz9PEV7UNgJ3Ansaw20EDdk4vweHt+BSCcQULyB82qwooiuMZUvCRjChW6stDzpZ aCNUKCTO1X0UNvBJDlvOm/RIklvXh3Ck9QJ37fh+Vb2OCT7oz4mDikSMUqbY3LEwK6K9q Xn26QzBk5OXM871tp8cGT7nxQni075n8zHtseqgLm3WDgImReD0GXb9EaheISqBUmnaLc 8Og5nw0gZdtB7J7cCqE4olh9dgdkzfe6MrAihhe/8N+zHCFEGnm9cX231uvqxHciXFWa4 dmJvZxltNHoW3jd6lNrOZmKZ1QYFcPAqbvEajwyLrMEJHvLXhJjzyxVYOZ9z8nmQtXA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792882587; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Proofpoint-GUID: X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis: X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=8fvxyNQZ5b4bLD4RC7y6CYqh2r/ByifqUJni81S43tk=; b=FEQx+jj+ooZUOGWwEczj4lzK4NBRZBgtNLQ0E31tWW+BU8dMoKFMpi7tP623JLl0bptG iJrhBrx5g9ZfEhC3MfzqCHpqAbCW6e6gR0MbDVB7CNYKpczaeHpFje1qKmrOyqlx9DzzH sEDUr/PORiqTWTZhoDPBgrfMkErzOIeAG6jHNu1caxsHZCSWljYsKr6l579sM1l5b8dyN O798bsJt2D1YwsFa4X+J6iZd/iT4tXHWu6Zfc1wNTHmrn3jLEYmKjWVEJtYowud6lrpAq M8/gup3YlYBfad266RvxMCKq8vlq1qub3iZUViBZFhTmeOp+iAB3yBfLO19ScRnk9RQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=jEwLjJxc; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=D6cJ82w0; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F9DE606A31E for ; Sat, 24 Oct 2026 22:56:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2F9DE606A31E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=jEwLjJxc; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=D6cJ82w0 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69OLbOC71795138 for ; Sat, 24 Oct 2026 22:56:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=8fvxyNQZ5b4 bLD4RC7y6CYqh2r/ByifqUJni81S43tk=; b=jEwLjJxcdtlV02+oQg+kPxFjrHQ Y0Cr6i9yYap1AzhLgTW8O+54JotFeSHa5zXYz4sRiI2sCIA8uDrj0B1A0J5s3ME5 2AdgbRqgQgVHt5T/WxMfVAHcopDiN7DMXrKZIZMluRFEqsbExdtbpkTaAbDOMSff dsB4bIt4eOv/bYbdvlGy/zn/dRIi1QgFOhiAufpJg9Yk6nQmalYoOWhHPMDrgx/p rlR0SFUK2gtrR742/LSuu4Rp+8uiH4RjWBdkHhV1fkEJNb3E5oddLJwKxB+m/+N3 teNPonjz5yHIQ7RpAnr3csbUMncZ2flBkMXzM4Qu4AavdJ5wJkcohZvrH1A== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4hgny9stss-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 24 Oct 2026 22:56:26 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-93f1f2fafeaso266249385a.2 for ; Sat, 24 Oct 2026 15:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1792882585; x=1793487385; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8fvxyNQZ5b4bLD4RC7y6CYqh2r/ByifqUJni81S43tk=; b=D6cJ82w0LxHM3BBAsXr7TOzjq0dnbkJ+8qUNEx1M6ME+yR6D8aIlmgfOag1nPqpst6 7aHm/ir5bIe43np3f8wDNlARdLndNBy/xasmYGHfMTr8WBw39CQRy7i8LxzzW4/TnRhq D+Lpg1yDiArT+9BsDVA3g7Dz7uCDiSDNgN6FZYCwKAbSp/cMt0ZLsKnL23TFBnuTqn52 1sxyukZi6nRPXBadUAxhDWzcdS6BfAF0ZF4q0Ixcbyq48YEFB+StqBjdFWoMWFPxt7py nK++7uPGopWhorZeuMbwYI79J/cBm7L/haTQNXx0K7pJCGT5TgODytyvjS5NcxZJcD4E nXRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792882585; x=1793487385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=8fvxyNQZ5b4bLD4RC7y6CYqh2r/ByifqUJni81S43tk=; b=Bkxxg6hIEpH9f0OufqGthIB37CHb/xGooC3y/ux3UEHWikJMH7lzQyCdF2m9I70/ij wH+oC6TblyEmfGg0l7QD/g5D6osiX+K9R1SkQi6KWeOyFFrl6izdR40fH6VDSKPA8/G9 BerwxNF91Pn5PKYdOSY0si6Fi3eqoPfAUWD9dOhNJAXwZpUYyJWZYrpNMR1m9Gv7jlGK fkppvxwkiozIW6ewLKokIq8YQWayBPfH8JCRHwYcBUt6kPcxuszL37c5lFqHEzIEGoLF lXruoAkhY0By5TEA+e0KXf9wMgyAXl083+syAVGnyEEjMT9IA/vmhR+1P8XkV1LF+ym8 c6Jg== X-Forwarded-Encrypted: i=1; AKwUvByBGakrGTK3wPG1V+3WiDXIcKMZqopEtdCjehRHQxcPUY1hYWIPI6coLoZOtJMKyt6LAA94gJx9Lg==@vger.kernel.org X-Gm-Message-State: AFq9FYIF9/C2Q9dc3Uc+Z5P9wYakCqW8kxrIMH3Uwvqx9Ks8fEBUaYJA GqrxvoYVhEC14F3sp/pgY3Xlqnok9G9bWxXf9w/OslL4QfoDTCDVepeuKaPzeniHPjSv0N/ofWQ Fw71n6zhMOrOPN/NyILf1YrUgdFz0FFlolxZ01maeRpFtsku/6ukr2jQAlnvfoQ== X-Gm-Gg: AYBFou1JTpQoBVjapXqTgv8074F+1i+TtDyjvULWUHYhpw9fYhtcHW3fZLWZ0c4amOj a1L3Yd+7fkVOerZ7hYK4gBpjwc6OEUAG14zXCJKDinA8Z5ump29kF/SaMl3ODW+nofzpgrA+e04 AcVgZU5lVzuak1wJ/q0ZJBhHsrU8HHSkqsmOTMBvwU0MX2VGE4Erk0KsoMmhOFarWsTKrJBhd69 YxBGzCj52SkEcyxSZil7okUcfUyO8T0lWLAFaP7weOZkyuXaOCs1sKy3s/meUinRN+tNM+nEqav 34PYGsAlWOUU1W3NuYQIhbd9r+zeaISVYovF27CtFl3dD6bTCpqczL7ebvFvwFAEgWuWk/iFgav pcUxc0xp7/0CALhujFMzpDOgFEwU= X-Received: by 2002:a05:620a:3910:b0:93f:3bb5:545d with SMTP id af79cd13be357-940ef914f1cmr445004585a.27.1792882585035; Sat, 24 Oct 2026 15:56:25 -0700 (PDT) X-Received: by 2002:a05:620a:3910:b0:93f:3bb5:545d with SMTP id af79cd13be357-940ef914f1cmr445001085a.27.1792882584462; Sat, 24 Oct 2026 15:56:24 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:7d20:e20f:a77f:4ef7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a359ff2189sm98564145e9.1.2026.10.24.15.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Oct 2026 15:56:23 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org Cc: Len Brown , Jonathan Corbet , Shuah Khan , Randy Dunlap , Viresh Kumar , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Maximilian Luz , Shyam Sundar S K , Mark Pearson , "Derek J. Clark" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Armin Wolf , Jai Luthra , Greg Kroah-Hartman , Jack Wu , "Mario Limonciello (AMD)" , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-pm@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v3 1/4] platform profile: Extract the core from ACPI Date: Sun, 25 Oct 2026 00:34:26 +0200 Message-ID: <20261024223501.1420953-2-daniel.lezcano@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261024223501.1420953-1-daniel.lezcano@oss.qualcomm.com> References: <20261024223501.1420953-1-daniel.lezcano@oss.qualcomm.com> X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: DXTyhXnR-NA09NCkL3GrV3K8GJpt3txW X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDI0MDA5MSBTYWx0ZWRfX/9ohULkbKT7O c0VQyWpGp+O4nXxyJa5YuZl+x6YcooZ2SVORX+FJzRfS4jDfe1KrOJnzlTckAR+QIk/36J2NrqB Dl+3qtgWlkj/7R4ZxbFrsNYTPln9o4aeQIptMHT8f8FGdDpsaf+squi3JkktKyENddCClzXzSSU FnH1jw9KOHIKLtcrlVOdVMMjbNzToGBECxz+7xjk0ETPvM9hyC0Xma3Al+/mYJD08WlJ3jvxvk7 NuoDBrGtKhcwHTSASFdUGcESg9j7BTMtkWdo0ysLwUDAsgKq519ISMS8jCS6+LhanBNMFskdOAP KuConNkr3nBoTRIBLJWiCFvcE+rEHK4PwFU40Lb76YiMfxLA0PBZAEVVbMadW/2bjYEb35Fh6/C f0L6QTAn5QdPNQvzicWH6xDLSjC0bpc3bNnRW95epk1yhd/aSleolQoaDNzLRc4228qobccAMzr 6M/Y3MPX+Z+5ng/cRcg== X-Authority-Analysis: v=2.4 cv=PqcG/AM3 c=1 sm=1 tr=0 ts=6add379a cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=8k6WQxmsAAAA:8 a=H7UWxkn5qGMa_TAHyjEA:9 a=-Z-CRQebJS9Ciu3_:21 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-ORIG-GUID: DXTyhXnR-NA09NCkL3GrV3K8GJpt3txW X-Proofpoint-Spam-Info: AW1haW4tMjYxMDI0MDA5MSBTYWx0ZWRfX8W1x7n5K8aCO QVrW4vswChPXb3TdM2Zp7/PvfHB5p6rc087KHE/e0OA/imNf7iPbmAnvB28xFYzEz/oIeDNuPKT 6FhGOG9W+ZGyPGxj139WIqJftSkI8PI= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-10-24_04,2026-10-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 spamscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 phishscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610190000 definitions=main-2610240091 Platform profile providers already use device-based callbacks and do not need ACPI types. The core is nevertheless confined to the ACPI build and refuses to initialize when ACPI is disabled. Move the implementation to drivers/platform/profile and introduce the firmware-independent PLATFORM_PROFILE symbol. Update all provider selectors. Keep provider-specific ACPI dependencies and the platform_profile module name. Isolate access to the legacy ACPI kobject in an optional compatibility object linked into the same module. Retain the legacy ABI on active ACPI systems, and initialize the class even when ACPI is absent or disabled. Use subsys_initcall_sync so the class is ready before built-in thermal and CPUFreq providers, but after ACPI has initialized its compatibility kobject. Signed-off-by: Daniel Lezcano --- drivers/acpi/Kconfig | 3 - drivers/acpi/Makefile | 1 - drivers/cpufreq/Kconfig.x86 | 2 +- drivers/platform/Kconfig | 16 +++++ drivers/platform/Makefile | 2 + drivers/platform/profile/Makefile | 5 ++ drivers/platform/profile/acpi.c | 15 +++++ .../profile/core.c} | 64 +++++++++++++------ drivers/platform/profile/profile.h | 17 +++++ drivers/platform/surface/Kconfig | 6 +- drivers/platform/x86/Kconfig | 10 +-- drivers/platform/x86/amd/pmf/Kconfig | 2 +- drivers/platform/x86/dell/Kconfig | 4 +- drivers/platform/x86/hp/Kconfig | 2 +- drivers/platform/x86/lenovo/Kconfig | 6 +- drivers/thermal/intel/int340x_thermal/Kconfig | 2 +- 16 files changed, 118 insertions(+), 39 deletions(-) create mode 100644 drivers/platform/profile/Makefile create mode 100644 drivers/platform/profile/acpi.c rename drivers/{acpi/platform_profile.c => platform/profile/core.c} (94%) create mode 100644 drivers/platform/profile/profile.h diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f165d14cf61a..dd00312217de 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -351,9 +351,6 @@ config ACPI_THERMAL To compile this driver as a module, choose M here: the module will be called thermal. -config ACPI_PLATFORM_PROFILE - tristate - config ACPI_CUSTOM_DSDT_FILE string "Custom DSDT Table file to include" default "" diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d1b0affb844f..f8af27341805 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -91,7 +91,6 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI) += container.o obj-$(CONFIG_ACPI_THERMAL_LIB) += thermal_lib.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o -obj-$(CONFIG_ACPI_PLATFORM_PROFILE) += platform_profile.o obj-$(CONFIG_ACPI_NFIT) += nfit/ obj-$(CONFIG_ACPI_NHLT) += nhlt.o obj-$(CONFIG_ACPI_NUMA) += numa/ diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86 index d6190b8dde4b..9e1e3391a084 100644 --- a/drivers/cpufreq/Kconfig.x86 +++ b/drivers/cpufreq/Kconfig.x86 @@ -39,7 +39,7 @@ config X86_AMD_PSTATE select ACPI_PROCESSOR select ACPI_CPPC_LIB if X86_64 select CPU_FREQ_GOV_SCHEDUTIL if SMP - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select POWER_SUPPLY help This driver adds a CPUFreq driver which utilizes a fine grain diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig index 312788f249c9..395b75f2edf0 100644 --- a/drivers/platform/Kconfig +++ b/drivers/platform/Kconfig @@ -1,4 +1,20 @@ # SPDX-License-Identifier: GPL-2.0-only +config PLATFORM_PROFILE + tristate "Platform profile support" + help + Provide a common sysfs interface for selecting platform power, + performance and cooling profiles. Platform-specific provider drivers + map their operating modes onto standard profile names, independently + of the firmware interface they use. + + The core exposes per-provider controls under /sys/class/platform-profile/. + A provider driver must register before profile attributes become + available. ACPI is not required; on ACPI systems the legacy system-wide + interface under /sys/firmware/acpi/ is also provided. + + To compile this as a module, choose M here: the module will be called + platform_profile. + source "drivers/platform/mips/Kconfig" source "drivers/platform/loongarch/Kconfig" diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile index fa322e7f8716..b6732f2f3c85 100644 --- a/drivers/platform/Makefile +++ b/drivers/platform/Makefile @@ -3,6 +3,8 @@ # Makefile for linux/drivers/platform # +obj-$(CONFIG_PLATFORM_PROFILE) += profile/ + obj-$(CONFIG_X86) += x86/ obj-$(CONFIG_LOONGARCH) += loongarch/ obj-$(CONFIG_MELLANOX_PLATFORM) += mellanox/ diff --git a/drivers/platform/profile/Makefile b/drivers/platform/profile/Makefile new file mode 100644 index 000000000000..ae95ba09383c --- /dev/null +++ b/drivers/platform/profile/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PLATFORM_PROFILE) += platform_profile.o + +platform_profile-y := core.o +platform_profile-$(CONFIG_ACPI) += acpi.o diff --git a/drivers/platform/profile/acpi.c b/drivers/platform/profile/acpi.c new file mode 100644 index 000000000000..ff925dedacaf --- /dev/null +++ b/drivers/platform/profile/acpi.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Compatibility with the original ACPI platform profile sysfs ABI. */ + +#include +#include + +#include "profile.h" + +struct kobject *platform_profile_compat_kobj(void) +{ + if (acpi_disabled) + return NULL; + + return kobject_get(acpi_kobj); +} diff --git a/drivers/acpi/platform_profile.c b/drivers/platform/profile/core.c similarity index 94% rename from drivers/acpi/platform_profile.c rename to drivers/platform/profile/core.c index b4c91d57f3d4..57c3dad2732b 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/platform/profile/core.c @@ -4,15 +4,21 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include +#include #include #include #include +#include +#include #include +#include #include #include +#include #include +#include "profile.h" + #define to_pprof_handler(d) (container_of(d, struct platform_profile_handler, dev)) /* @@ -24,6 +30,15 @@ static DEFINE_MUTEX(profile_lock); /* Serialize registration and sysfs updates without blocking sysfs callbacks. */ static DEFINE_MUTEX(profile_registration_lock); static LIST_HEAD(profile_handlers); +static struct kobject *compat_kobj; + +static void profile_notify(void) +{ + if (compat_kobj) + sysfs_notify(compat_kobj, NULL, "platform_profile"); +} + +static int profile_update(void); struct platform_profile_handler { struct list_head node; @@ -243,7 +258,7 @@ static ssize_t profile_store(struct device *dev, return ret; } - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + profile_notify(); return count; } @@ -458,7 +473,7 @@ static ssize_t platform_profile_store(struct kobject *kobj, return ret; } - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + profile_notify(); return count; } @@ -484,6 +499,14 @@ static const struct attribute_group platform_profile_group = { .is_visible = profile_class_is_visible, }; +static int profile_update(void) +{ + if (compat_kobj) + return sysfs_update_group(compat_kobj, &platform_profile_group); + + return 0; +} + /** * platform_profile_notify - Notify class device and legacy sysfs interface * @dev: The class device @@ -493,7 +516,7 @@ void platform_profile_notify(struct device *dev) scoped_cond_guard(mutex_intr, return, &profile_lock) { _notify_class_profile(dev, NULL); } - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + profile_notify(); } EXPORT_SYMBOL_GPL(platform_profile_notify); @@ -540,7 +563,7 @@ int platform_profile_cycle(void) return err; } - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + profile_notify(); return 0; } @@ -615,9 +638,9 @@ struct device *platform_profile_register(struct device *dev, const char *name, scoped_guard(mutex, &profile_lock) list_add_tail(&to_pprof_handler(ppdev)->node, &profile_handlers); - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + profile_notify(); - err = sysfs_update_group(acpi_kobj, &platform_profile_group); + err = profile_update(); if (err) goto cleanup_cur; @@ -657,8 +680,8 @@ void platform_profile_remove(struct device *dev) ida_free(&platform_profile_ida, pprof->minor); device_unregister(&pprof->dev); - sysfs_notify(acpi_kobj, NULL, "platform_profile"); - sysfs_update_group(acpi_kobj, &platform_profile_group); + profile_notify(); + profile_update(); } EXPORT_SYMBOL_GPL(platform_profile_remove); @@ -706,28 +729,33 @@ static int __init platform_profile_init(void) { int err; - if (acpi_disabled) - return -EOPNOTSUPP; - err = class_register(&platform_profile_class); if (err) return err; - err = sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) - class_unregister(&platform_profile_class); + compat_kobj = platform_profile_compat_kobj(); + if (compat_kobj) { + err = sysfs_create_group(compat_kobj, &platform_profile_group); + if (err) { + kobject_put(compat_kobj); + class_unregister(&platform_profile_class); + } + } return err; } static void __exit platform_profile_exit(void) { - sysfs_remove_group(acpi_kobj, &platform_profile_group); + if (compat_kobj) { + sysfs_remove_group(compat_kobj, &platform_profile_group); + kobject_put(compat_kobj); + } class_unregister(&platform_profile_class); } -module_init(platform_profile_init); +subsys_initcall_sync(platform_profile_init); module_exit(platform_profile_exit); MODULE_AUTHOR("Mark Pearson "); -MODULE_DESCRIPTION("ACPI platform profile sysfs interface"); +MODULE_DESCRIPTION("Platform profile sysfs interface"); MODULE_LICENSE("GPL"); diff --git a/drivers/platform/profile/profile.h b/drivers/platform/profile/profile.h new file mode 100644 index 000000000000..910c9f7da6a0 --- /dev/null +++ b/drivers/platform/profile/profile.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef _PLATFORM_PROFILE_INTERNAL_H +#define _PLATFORM_PROFILE_INTERNAL_H + +#include +#include + +#ifdef CONFIG_ACPI +struct kobject *platform_profile_compat_kobj(void); +#else +static inline struct kobject *platform_profile_compat_kobj(void) +{ + return NULL; +} +#endif + +#endif diff --git a/drivers/platform/surface/Kconfig b/drivers/platform/surface/Kconfig index f775c6ca1ec1..08f15f72f8ed 100644 --- a/drivers/platform/surface/Kconfig +++ b/drivers/platform/surface/Kconfig @@ -203,12 +203,12 @@ config SURFACE_PLATFORM_PROFILE tristate "Surface Platform Profile Driver" depends on ACPI depends on SURFACE_AGGREGATOR_REGISTRY - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help - Provides support for the ACPI platform profile on 5th- and later + Provides support for platform profiles on 5th- and later generation Microsoft Surface devices. - More specifically, this driver provides ACPI platform profile support + More specifically, this driver provides platform profile support on Microsoft Surface devices with a Surface System Aggregator Module (SSAM) connected via the Surface Serial Hub (SSH / SAM-over-SSH). In other words, this driver provides platform profile support on the diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 4851bf45157d..b560982d2378 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -120,7 +120,7 @@ config BITLAND_MIFS_WMI depends on INPUT depends on LEDS_CLASS depends on POWER_SUPPLY - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select INPUT_SPARSEKMAP help This is a driver for Bitland MiInterface based laptops. @@ -180,7 +180,7 @@ config ACER_WMI select INPUT_SPARSEKMAP select LEDS_CLASS select NEW_LEDS - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help This is a driver for newer Acer (and Wistron) laptops. It adds wireless radio and bluetooth control, and on some laptops, @@ -279,7 +279,7 @@ config ASUS_WMI select INPUT_SPARSEKMAP select LEDS_CLASS select NEW_LEDS - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help Say Y here if you have a WMI aware Asus laptop (like Eee PCs or new Asus Notebooks). @@ -646,7 +646,7 @@ config SAMSUNG_GALAXYBOOK depends on INPUT depends on LEDS_CLASS depends on SERIO_I8042 - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select FW_ATTR_CLASS help This is a driver for Samsung Galaxy Book series notebooks. It adds @@ -905,7 +905,7 @@ config TOUCHSCREEN_DMI config INSPUR_PLATFORM_PROFILE tristate "Inspur WMI platform profile driver" depends on ACPI_WMI - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help This will allow users to determine and control the platform modes between low-power, balanced and performance modes. diff --git a/drivers/platform/x86/amd/pmf/Kconfig b/drivers/platform/x86/amd/pmf/Kconfig index ad4faf18de47..31e13d6d7e75 100644 --- a/drivers/platform/x86/amd/pmf/Kconfig +++ b/drivers/platform/x86/amd/pmf/Kconfig @@ -8,7 +8,7 @@ config AMD_PMF depends on ACPI && PCI depends on POWER_SUPPLY depends on AMD_NODE - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE depends on TEE && AMDTEE depends on AMD_SFH_HID depends on HAS_IOMEM diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig index 9f0016056d7e..f6acf1cc2a2f 100644 --- a/drivers/platform/x86/dell/Kconfig +++ b/drivers/platform/x86/dell/Kconfig @@ -44,7 +44,7 @@ config ALIENWARE_WMI_WMAX bool "Alienware WMAX WMI device driver" default y depends on ALIENWARE_WMI - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help Alienware WMI driver with AlienFX LED, HDMI, amplifier, deep sleep and AWCC thermal control capabilities. @@ -120,7 +120,7 @@ config DELL_PC depends on ACPI depends on DMI depends on DELL_SMBIOS - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE help This driver adds support for controlling the fan modes via platform_profile on supported Dell systems regardless of formfactor. diff --git a/drivers/platform/x86/hp/Kconfig b/drivers/platform/x86/hp/Kconfig index dd51491b9bcd..81a52194ff42 100644 --- a/drivers/platform/x86/hp/Kconfig +++ b/drivers/platform/x86/hp/Kconfig @@ -43,7 +43,7 @@ config HP_WMI depends on RFKILL || RFKILL = n select POWER_SUPPLY select INPUT_SPARSEKMAP - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select HWMON help Say Y here if you want to support WMI-based hotkeys on HP laptops and diff --git a/drivers/platform/x86/lenovo/Kconfig b/drivers/platform/x86/lenovo/Kconfig index 516594993073..2291e1d48d13 100644 --- a/drivers/platform/x86/lenovo/Kconfig +++ b/drivers/platform/x86/lenovo/Kconfig @@ -12,7 +12,7 @@ config IDEAPAD_LAPTOP depends on BACKLIGHT_CLASS_DEVICE depends on ACPI_VIDEO || ACPI_VIDEO = n depends on ACPI_WMI || ACPI_WMI = n - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select INPUT_SPARSEKMAP select NEW_LEDS select LEDS_CLASS @@ -77,7 +77,7 @@ config THINKPAD_ACPI depends on BACKLIGHT_CLASS_DEVICE depends on I2C depends on DRM - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select DRM_PRIVACY_SCREEN select HWMON select NVRAM @@ -264,7 +264,7 @@ config LENOVO_WMI_GAMEZONE tristate "Lenovo GameZone WMI Driver" depends on ACPI_WMI depends on DMI - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select LENOVO_WMI_EVENTS select LENOVO_WMI_HELPERS help diff --git a/drivers/thermal/intel/int340x_thermal/Kconfig b/drivers/thermal/intel/int340x_thermal/Kconfig index 4ced7bdcd62c..3026a0a8d073 100644 --- a/drivers/thermal/intel/int340x_thermal/Kconfig +++ b/drivers/thermal/intel/int340x_thermal/Kconfig @@ -12,7 +12,7 @@ config INT340X_THERMAL select ACPI_THERMAL_LIB select INTEL_SOC_DTS_IOSF_CORE select INTEL_TCC - select ACPI_PLATFORM_PROFILE + select PLATFORM_PROFILE select PROC_THERMAL_MMIO_RAPL if POWERCAP help Newer laptops and tablets that use ACPI may have thermal sensors and -- 2.43.0