From nobody Tue Feb 10 19:01:06 2026 Received: from wfhigh8-smtp.messagingengine.com (wfhigh8-smtp.messagingengine.com [64.147.123.159]) (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 781BB1B800; Thu, 4 Apr 2024 00:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712189860; cv=none; b=TlcD+OFmdwKRfGZaNu4zh/eNY8F5MS42pKVG+UU31EK7lC6Nf9yt/fA+3kW3QJfYH6aD5EBaUANrr81h6x4OV+4fiDtTB8RSgMRuHYdO5xgJoQLALLGcwQYOy4sGanNDqwknVuELwVI8eAKsk/FYe3kv3uWJry+OphgEutQ9Czg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712189860; c=relaxed/simple; bh=RigxiSjgWoFftuq3+PU0L2MA0yigmESUDun1HkWLGKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SorWKfrbqPu/2ZEFGSh5lmFVsZP8wIEuHi2MSFATHOVTAlBgCOiWpcRv2M7t35EIalvE3Z5yjVd0yti19rjsQMVDSbStMKQpCit3RNVZH9kyGDhlV+fAziD2KtdeHE9bP9oS1+PnsKcIXlKcaKRRJNNukp4gvgnWaKwzmHqxJsg= 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=Tq/5Wc95; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=SNWUhbXI; arc=none smtp.client-ip=64.147.123.159 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="Tq/5Wc95"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="SNWUhbXI" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 2E0BD18000FB; Wed, 3 Apr 2024 20:17:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 03 Apr 2024 20:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-transfer-encoding:content-type: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=1712189857; x=1712276257; bh=7Az00aewtRWp5Y61/pH0rVHkKLXtEg51elHeqTyC75w=; b= Tq/5Wc95MFpvgByIlowrxezmgZ8xzqgxUyvGzRfBDOn6PwhyLOsoTzfCTRR1Z537 xEU3Oij3S73L6a4R1h7GfElwNkfkY02tb6kE9NSs352IwCMPzXaS3MPg4mKJDbNR bB6UrfOETP1A8k2sQf+IFJEL1x1nZspQsPTgd03Oa9J7OsV6Aniia+R8I529BpLC O7+ebci/LfBMXx/TTfvFVmYv+R2hPlqNxuaSAAXsRVYYEpcUm/hMlVmR61IYY34P eA3cBjOBlwit4SpAZUZjeSXITf2Pr4WKrzGAqWHwHNK0fQnI1t3bfzKO6wuuzHad 2lF7CUMAlXD0j8rrEQhLTQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type: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=1712189857; x= 1712276257; bh=7Az00aewtRWp5Y61/pH0rVHkKLXtEg51elHeqTyC75w=; b=S NWUhbXIYF66PiJMfzUa6HbmSwjR9GFZRk74fL79TCxCGsYjNfe5bfL4/oihBf+ye OaE4r8uQjzCREeXSagHGX/Y13rNhZMg9YG/1paD1jfbk3iaTNkRCXJvETKW7SBT3 ELtXceV9dEh9JG8gt1WrBgilGUe/g4KHNje7FMLGjnWcCyvC4vzMNmcfTN6UNc0X won02uik0FORX+nrWPEJvaj7AaPlb5IULXDGyCND6C2fLoq43FCI2pNhaJPf3mYm JRScBwm4txHmaO0T6nUAdXqX27zC2k2NYdyiWdDIgL9ufils94wh//SskAftgN9G 3RK1FJxi0c0ma60Udw1og== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefjedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepfdfnuhhkvgcuffdrucflohhnvghsfdcuoehluhhkvges lhhjohhnvghsrdguvghvqeenucggtffrrghtthgvrhhnpeduudetudehiedvvdevveelhf egkeefffdvfeetuefgveefgffgffeiffeitdelieenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehluhhkvgeslhhjohhnvghsrdguvghv X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Apr 2024 20:17:34 -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 v4 8/9] platform/x86: asus-wmi: Add support for MCU powersave Date: Thu, 4 Apr 2024 13:16:51 +1300 Message-ID: <20240404001652.86207-9-luke@ljones.dev> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404001652.86207-1-luke@ljones.dev> References: <20240404001652.86207-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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. Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Luke D. Jones --- .../ABI/testing/sysfs-platform-asus-wmi | 9 ++++ drivers/platform/x86/asus-wmi.c | 50 +++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentat= ion/ABI/testing/sysfs-platform-asus-wmi index 72933527d2e4..28144371a0f1 100644 --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi @@ -203,3 +203,12 @@ Description: Set if the BIOS POST sound is played on boot. * 0 - False, * 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 ab98f91e573c..d06d9e0c498c 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -1303,6 +1303,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 */ @@ -4317,6 +4364,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, @@ -4370,6 +4418,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