From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-4318.protonmail.ch (mail-4318.protonmail.ch [185.70.43.18]) (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 137652D0C82; Mon, 11 May 2026 06:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778480379; cv=none; b=UG4Q6QfiBBXLQXhaEHPazZoO0S1v7ffIusc0hj4JnaT02k5dVph3Vbfya6ApY60dpGAlgrUe4LGgYoSjI8Uds99/Bq7Qy6CVn1Gi1w+TVFgg9P+pUPouOVjVAxkmBoW6YFYJW0JFcKWu8qbwft091Ge1yqUW9XYvG4NHVc6wEqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778480379; c=relaxed/simple; bh=VHI32ivS4lcoHkIngKwvFOH/SsYCT3zaxv7zHEQyAIg=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MkvT059lyU2N7AOI4SS/iZo0HOcciM/Mm2tfl7ZUDrKxSvcixvVnF9Z2uThvlNWiW6nRYZt87OqtGCn0CBwW4p1BQI2GH6XJO5kTgmgXByo9yvuaklaWbfeVdXr2z+SsqSS6kHvb+igqTaQ6yJuZ0F25lPtomV6pvb/QKZ4X1Bs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ghoul.dev; spf=pass smtp.mailfrom=ghoul.dev; dkim=pass (2048-bit key) header.d=ghoul.dev header.i=@ghoul.dev header.b=KrbA8ozc; arc=none smtp.client-ip=185.70.43.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ghoul.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghoul.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ghoul.dev header.i=@ghoul.dev header.b="KrbA8ozc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ghoul.dev; s=protonmail; t=1778480374; x=1778739574; bh=con8/ExgSJJrwRAmc8de7GekzLWWxkj4P7o+8w2/vpA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=KrbA8ozcyIcWET+GE8uqedMHhkfZ0FrznVgLb+lW1c4j0gIYWyxCKAPdqpeDXQbbM gShx50P7nDSA6+9Jp9FuKPNc9ixUcH7bP6sgv7EoVgEDBgFpi7OE3EVIR8Uq2DBKxJ 5VnBOACzHZGU8waDNtA5IEn9UmBb/VEq8Gq0FJDxv798XgkAtkAY1rprDO/s3fHip7 90x2qRNRcc/zp5Ak2OvthiVvxza15yjWRvGJOTlNTNG5cPFZPGBigi2hZHb6ge8nNt RY0AjtJsQeG7Tv2ebptRd/PEXuffJGNqeOcnhd8Mc34yFcDWfvEFWdsYiqoo/darjc /a9VI6gtc6Fgg== Date: Mon, 11 May 2026 06:19:30 +0000 To: platform-driver-x86@vger.kernel.org From: Ahmed Yaseen Cc: yaseen@ghoul.dev, corentin.chary@gmail.com, luke@ljones.dev, denis.benato@linux.dev, derekjohn.clark@gmail.com, hansg@kernel.org, ilpo.jarvinen@linux.intel.com, prasanth.ksr@dell.com, mpearson-lenovo@squebb.ca, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, asus-linux@lists.linux.dev Subject: [PATCH 1/2] platform/x86: asus-armoury: gate PPT writes behind active fan curve Message-ID: <20260511061901.907540-2-yaseen@ghoul.dev> In-Reply-To: <20260511061901.907540-1-yaseen@ghoul.dev> References: <20260511061901.907540-1-yaseen@ghoul.dev> Feedback-ID: 177610485:user:proton X-Pm-Message-ID: 18d5944a2db392747f3f6f785ccf59ca0db2aa0c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On models flagged with requires_fan_curve in the DMI power_data table (28 entries), the BIOS ACPI method SPLX only writes PPT values to the EC when the fan mode is set to Manual (FANM=3D4). FANM is set to 4 by the DEFC method when a custom fan curve is written. Without an active custom fan curve, the WMI DEVS call returns success but the firmware silently ignores the PPT value, so userspace observes no effect from its write. Gate writes to ASUS_WMI_DEVID_PPT_{PL1_SPL,PL2_SPPT,PL3_FPPT,APU_SPPT, PLAT_SPPT} on a check of asus_wmi_custom_fan_curve_is_enabled(), and return -ENODEV with a pr_warn() when no fan curve is active on an affected model. Export the helper from asus-wmi so asus-armoury can call it across module boundaries. Signed-off-by: Ahmed Yaseen --- drivers/platform/x86/asus-armoury.c | 20 ++++++++++++++++ drivers/platform/x86/asus-wmi.c | 28 ++++++++++++++++++++++ include/linux/platform_data/x86/asus-wmi.h | 5 ++++ 3 files changed, 53 insertions(+) diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asu= s-armoury.c index 5b0987ccc270..01e552573674 100644 --- a/drivers/platform/x86/asus-armoury.c +++ b/drivers/platform/x86/asus-armoury.c @@ -93,6 +93,8 @@ struct asus_armoury_priv { =20 =09u32 mini_led_dev_id; =09u32 gpu_mux_dev_id; + +=09bool requires_fan_curve; }; =20 static struct asus_armoury_priv asus_armoury =3D { @@ -216,6 +218,22 @@ static int armoury_set_devstate(struct kobj_attribute = *attr, =09u32 result; =09int err; =20 +=09/* On some models, PPT changes require an active fan curve */ +=09if (asus_armoury.requires_fan_curve) { +=09=09switch (dev_id) { +=09=09case ASUS_WMI_DEVID_PPT_PL1_SPL: +=09=09case ASUS_WMI_DEVID_PPT_PL2_SPPT: +=09=09case ASUS_WMI_DEVID_PPT_PL3_FPPT: +=09=09case ASUS_WMI_DEVID_PPT_APU_SPPT: +=09=09case ASUS_WMI_DEVID_PPT_PLAT_SPPT: +=09=09=09if (!asus_wmi_custom_fan_curve_is_enabled()) { +=09=09=09=09pr_warn("PPT change requires an active fan curve on this model= . Enable a custom fan curve first.\n"); +=09=09=09=09return -ENODEV; +=09=09=09} +=09=09=09break; +=09=09} +=09} + =09/* =09 * Prevent developers from bricking devices or issuing dangerous =09 * commands that can be difficult or impossible to recover from. @@ -1002,6 +1020,8 @@ static void init_rog_tunables(void) =09=09return; =09} =20 +=09asus_armoury.requires_fan_curve =3D power_data->requires_fan_curve; + =09/* Initialize AC power tunables */ =09ac_limits =3D power_data->ac_data; =09if (ac_limits) { diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.c index 80144c412b90..b05218d31d90 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -341,6 +341,9 @@ struct asus_wmi { /* Global to allow setting externally without requiring driver data */ static enum asus_ally_mcu_hack use_ally_mcu_hack =3D ASUS_WMI_ALLY_MCU_HAC= K_INIT; =20 +/* Global asus_wmi instance for use by exported functions */ +static struct asus_wmi *asus_wmi_instance; + #if IS_ENABLED(CONFIG_ASUS_WMI_DEPRECATED_ATTRS) static void asus_wmi_show_deprecated(void) { @@ -4001,6 +4004,28 @@ static int asus_wmi_custom_fan_curve_init(struct asu= s_wmi *asus) =09return 0; } =20 +/* + * Returns true if at least one custom fan curve is active + * + * Used by asus-armoury to check if PPT writes will be accepted by the BIO= S + * on models that require an active fan curve for TDP changes. + */ +bool asus_wmi_custom_fan_curve_is_enabled(void) +{ +=09struct asus_wmi *asus =3D asus_wmi_instance; +=09struct fan_curve_data *curves; + +=09if (!asus) +=09=09return false; + +=09curves =3D asus->custom_fan_curves; + +=09return (asus->cpu_fan_curve_available && curves[FAN_CURVE_DEV_CPU].enab= led) || +=09 (asus->gpu_fan_curve_available && curves[FAN_CURVE_DEV_GPU].enab= led) || +=09 (asus->mid_fan_curve_available && curves[FAN_CURVE_DEV_MID].enab= led); +} +EXPORT_SYMBOL_NS_GPL(asus_wmi_custom_fan_curve_is_enabled, "ASUS_WMI"); + /* Throttle thermal policy ***********************************************= *****/ static int throttle_thermal_policy_write(struct asus_wmi *asus) { @@ -5156,6 +5181,8 @@ static int asus_wmi_add(struct platform_device *pdev) =20 =09asus_wmi_debugfs_init(asus); =20 +=09asus_wmi_instance =3D asus; + =09return 0; =20 fail_wmi_handler: @@ -5199,6 +5226,7 @@ static void asus_wmi_remove(struct platform_device *d= evice) =09throttle_thermal_policy_set_default(asus); =09asus_wmi_battery_exit(asus); =20 +=09asus_wmi_instance =3D NULL; =09kfree(asus); } =20 diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/pla= tform_data/x86/asus-wmi.h index 554f41b827e1..5d57293ced6c 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -196,6 +196,7 @@ int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u= 32 arg1, u32 *retval); int asus_hid_register_listener(struct asus_hid_listener *cdev); void asus_hid_unregister_listener(struct asus_hid_listener *cdev); int asus_hid_event(enum asus_hid_event event); +bool asus_wmi_custom_fan_curve_is_enabled(void); #else static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status) { @@ -227,6 +228,10 @@ static inline int asus_hid_event(enum asus_hid_event e= vent) { =09return -ENODEV; } +static inline bool asus_wmi_custom_fan_curve_is_enabled(void) +{ +=09return false; +} #endif =20 #endif=09/* __PLATFORM_DATA_X86_ASUS_WMI_H */ --=20 2.54.0