From nobody Mon Feb 9 19:31:11 2026 Received: from wfhigh3-smtp.messagingengine.com (wfhigh3-smtp.messagingengine.com [64.147.123.154]) (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 121AF18633; Tue, 2 Apr 2024 02:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.154 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712024815; cv=none; b=YvkjyrlfqLRQ/1kpWEgXfBrQkPyIUq2bYE3y3MRF2kBveBP1XRD4KZWPEzPkj62GDHLgHERB6qnVBceSYbBwlWh8RAJvrKVhovX3iixsZCwL41mFI0d3c13fhzn+9BZxiFYgw/Q2MFuiQ6qySEweVkR+jCS3CddILCF3EAXfuxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712024815; c=relaxed/simple; bh=n99dCLRp8ISXkNDLjTLaMp+/5Ar652WbbI/D0ElRLqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z2SNIpPsfPAL32TBl9195JNnLP9bObW3Qm1b1ssu1OTFzvWVza6Q9vypIK4OW0f4ibVyjHLngXldmQ3WnsdV9F9v2y+B44xyJ3lbHaFDAdVAuLi1+e4nXzZ/M/LIfNhJ6n6XsO3cYCrhUYLcKyzmaJ7FHVOggX+MqtLqrsqRQL8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ljones.dev; spf=none smtp.mailfrom=ljones.dev; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b=a6dNI14p; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=XS+AZFRp; arc=none smtp.client-ip=64.147.123.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ljones.dev Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ljones.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b="a6dNI14p"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XS+AZFRp" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id D152218000D8; Mon, 1 Apr 2024 22:26:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 01 Apr 2024 22:26:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1712024812; x= 1712111212; bh=7QfXQgaY7xZyYxNLvLcve7hd/L3NfO6jXnYr5RR0nC0=; b=a 6dNI14piOmudojHpxfnMeKbl8gJBDouXT77cYUD+/+yBaT4LWYxDYJUj83sHJJhu XINoVBkG5OHCvIplnZyE1FCYoOaW13bJdBtrmsx1hI/2kJrOkBVKyEmK6C9Mdjvi nVxFu5xKUHRFFNVdh8rerHkhR6hB4RrRQVufyjeVKMuI4lFHPmXoQH4tlMXuK7RQ xxawiPsH3Xv1b8+nsrySeUvxIWgC2d9+2E/7lzaRp9rj5fhyFckrTjgEp3JqY5H2 c0Exaob0PHozH5aDd5Mu5eZ6s1yje6wMSdosEAnWkQExV1Ye/cpPuiaTVkX29QII QXBGP9WTL1TveOtAMM5TA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1712024812; x= 1712111212; bh=7QfXQgaY7xZyYxNLvLcve7hd/L3NfO6jXnYr5RR0nC0=; b=X S+AZFRpfs5esCT+MCC9ZbEUCith2eUbdNZ2FY4Zdvf/FA0f9lIfs3jVl+rQhgV4N //E2Ln1R38vkr8QQrCGPxSz3KNjuJkZ3GjYeL5qGG71uKojp0SLZurslebmbe87C bJd5xLOEUEg0G12NzIruExNaKjTaemp4uJ+TQLjggVPqn11rWE6er4xPAz88teyy nTIZ23bKit9dvtOGKlybRnhYppukoYOgViN5zqB/rHoJlMBliy4kIoN41RmVgCnA oiOWow5cxaFH7Iy35Lw8QaV6f5MF8IcUetzJp2gcNcJO44N3LQxGotrhVThyYNmD R162EGRD2oFUL/nF5q9Gw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefuddgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgepuden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Apr 2024 22:26:49 -0400 (EDT) From: "Luke D. Jones" To: hdegoede@redhat.com Cc: corentin.chary@gmail.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, "Luke D. Jones" Subject: [PATCH v2 8/9] platform/x86: asus-wmi: Add support for MCU powersave Date: Tue, 2 Apr 2024 15:26:06 +1300 Message-ID: <20240402022607.34625-9-luke@ljones.dev> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402022607.34625-1-luke@ljones.dev> References: <20240402022607.34625-1-luke@ljones.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for an MCU powersave WMI call. This is intended to set the MCU in to a low-power mode when sleeping. This mode can cut sleep power use by around half. Signed-off-by: Luke D. Jones --- .../ABI/testing/sysfs-platform-asus-wmi | 11 +++- drivers/platform/x86/asus-wmi.c | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentat= ion/ABI/testing/sysfs-platform-asus-wmi index 41b92e53e88a..28144371a0f1 100644 --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi @@ -202,4 +202,13 @@ Contact: "Luke Jones" Description: Set if the BIOS POST sound is played on boot. * 0 - False, - * 1 - True \ No newline at end of file + * 1 - True + +What: /sys/devices/platform//mcu_powersave +Date: Apr 2024 +KernelVersion: 6.10 +Contact: "Luke Jones" +Description: + Set if the MCU can go in to low-power mode on system sleep + * 0 - False, + * 1 - True diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.c index ddf568ef8c5e..cf872eed0986 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -1292,6 +1292,53 @@ static ssize_t nv_temp_target_show(struct device *de= v, } static DEVICE_ATTR_RW(nv_temp_target); =20 +/* Ally MCU Powersave ****************************************************= ****/ +static ssize_t mcu_powersave_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct asus_wmi *asus =3D dev_get_drvdata(dev); + int result; + + result =3D asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MCU_POWERSAV= E); + if (result < 0) + return result; + + return sysfs_emit(buf, "%d\n", result); +} + +static ssize_t mcu_powersave_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 enable; + + struct asus_wmi *asus =3D dev_get_drvdata(dev); + + result =3D kstrtou32(buf, 10, &enable); + if (result) + return result; + + if (enable > 1) + return -EINVAL; + + err =3D asus_wmi_set_devstate(ASUS_WMI_DEVID_MCU_POWERSAVE, enable, &resu= lt); + if (err) { + pr_warn("Failed to set MCU powersave: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set MCU powersave (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "mcu_powersave"); + + return count; +} +static DEVICE_ATTR_RW(mcu_powersave); + /* Battery ***************************************************************= *****/ =20 /* The battery maximum charging percentage */ @@ -4299,6 +4346,7 @@ static struct attribute *platform_attributes[] =3D { &dev_attr_ppt_platform_sppt.attr, &dev_attr_nv_dynamic_boost.attr, &dev_attr_nv_temp_target.attr, + &dev_attr_mcu_powersave.attr, &dev_attr_boot_sound.attr, &dev_attr_panel_od.attr, &dev_attr_mini_led_mode.attr, @@ -4352,6 +4400,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *= kobj, devid =3D ASUS_WMI_DEVID_NV_DYN_BOOST; else if (attr =3D=3D &dev_attr_nv_temp_target.attr) devid =3D ASUS_WMI_DEVID_NV_THERM_TARGET; + else if (attr =3D=3D &dev_attr_mcu_powersave.attr) + devid =3D ASUS_WMI_DEVID_MCU_POWERSAVE; else if (attr =3D=3D &dev_attr_boot_sound.attr) devid =3D ASUS_WMI_DEVID_BOOT_SOUND; else if (attr =3D=3D &dev_attr_panel_od.attr) --=20 2.44.0