From patchwork Tue Jun 20 02:56:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Jones X-Patchwork-Id: 110241 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3390652vqr; Mon, 19 Jun 2023 20:10:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GnnKU+Kmz67TDncmew8gq6JqT7yYM666iruNZRlpFVMC2GiaxKEJN/jltR6r1tndtJRPx X-Received: by 2002:a05:6a20:3c8e:b0:120:abf9:4f0a with SMTP id b14-20020a056a203c8e00b00120abf94f0amr9119109pzj.15.1687230638660; Mon, 19 Jun 2023 20:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687230638; cv=none; d=google.com; s=arc-20160816; b=glC6juc7DuDm7va8Lamt1lLmMjWBFHL8rmROZ32fPvHsRqHD0d9h3+Z6rtdy8BpIQm H87TbdRpxrCo7x/LNPxxfQm8f9N3gxL9Ngf5HT7wy6aWYpztxcSNSPNiTV6hc/LsmJ4o NIuvq1KiTov6PRsADbIDp1gVA06FeO9/YlXHB8/v2Y9WBFZ9zpXdLokuRME4i7ae6PTY AZ/D+iZdmEDpAwOp706pgwL8nTjA5spiiKsOFCnN+BMduk1mZ4itE/08GdErw7dOIrVX KXFKhPUya+4js5FASkXE6tBWVegBjDHMUW2A4TO1hplEH4RWAJGdBUq+UzvtnEclCwRH HCuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=320HCxo0m6kqsTndJmmY8l9xJ3+BedXN0i38xL7mNwQ=; b=gwf83P2N+PKRjj2Cc2TNx98RIiFuE61iOdAP9jTw+4W2HLgBbTyyJahko5tz8dFRSN SBMAxCOCKbtpXgUWz1EoQzSyGkAeMMPkxW+vNbwjVL2c2Y+UNVxKazjo9kEh4U/CY3Go s2SuFyQIV/nEN1Ahs2M5fB3tdGXjbAl7NqkeObIE7ELgQ6aSvwzr5D/HWvhxWeSx5pev f4ilDPs52+q+37E7VKtG8Po5iXfH8dPi8oyaBo5qSC7cKdF8z/Zd1meg7LWJPcNIns3Y WmEdLmifQKdvXaitV+EOdpTeyUzp04Zih3CT9b76lyygsRk5qu4nq9kb7Do665pA441m rJTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm3 header.b=umDcJSER; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jhhqgncB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020a639349000000b0053fee168aabsi733037pgm.742.2023.06.19.20.10.26; Mon, 19 Jun 2023 20:10:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm3 header.b=umDcJSER; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jhhqgncB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbjFTC6M (ORCPT + 99 others); Mon, 19 Jun 2023 22:58:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbjFTC6K (ORCPT ); Mon, 19 Jun 2023 22:58:10 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A28B110DE; Mon, 19 Jun 2023 19:57:42 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F28135C01F3; Mon, 19 Jun 2023 22:57:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 19 Jun 2023 22:57:33 -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:sender:subject:subject:to:to; s=fm3; t=1687229853; x= 1687316253; bh=320HCxo0m6kqsTndJmmY8l9xJ3+BedXN0i38xL7mNwQ=; b=u mDcJSERBSJI9yCIl3k70MvctiU9ltynKcSj6YwKEfJFUk+Lt5Ml496RuhVSNvuzP ipP42JeHs1a4i6M4K3o1TyhaPUD1O2phOdjGqRwC5FQrGKzL2PM59+qhhmvxhKta iVEFNfDF18lmsM/03drgET8K+Z5RTL+dPSRa4m+OFFFHm/frFbt05JFFAtpMJvYb pCaIIiwcjcfWpZImAK5mmc+j2e+kEizqVCX2AgqYmWHagvmWh6PqRLjJmXTlRrCj MCQtmDSY4y0VHrq55vjn+3wyBBTKQVrN3GH4xD0heIRtulB8w+o+pd+S+eKYfYvU HZBP0CFXAPynBQdpfMt/Q== 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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1687229853; x= 1687316253; bh=320HCxo0m6kqsTndJmmY8l9xJ3+BedXN0i38xL7mNwQ=; b=j hhqgncBCIgwU1Rv7lz1TM5RzQSJtGENImMEVZcPjd4Qet4wpXS4dlQvNqzx6YWKo m+zZl84eEi9ZKejyf2RFM6CwxAwajjFGD+NcSoRiumq0i33GSeiB9KvAKNb9ioch IfXy5zKTS8TK9D9IBjrv6qlxa/oKlwOJDi7hxqViBTz2CkegnU+cn0Tdh70GvFhU chMsDX8aa9/Biy19mrqSgwXLQD8nBAqYXM2C0bQdmw/aOoeGebLjDO6dxmcIxM7g /Q2qB2UTPjC3bHLiI8fXWF+5Tca9lc10QeipQL44f0yenrA11WgTy8QJhVdWCCKX bpLNo8h7QnQ9QA4SvjUYQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeefgedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgepvden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Jun 2023 22:57:30 -0400 (EDT) From: "Luke D. Jones" To: hdegoede@redhat.com Cc: corentin.chary@gmail.com, acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, markgross@kernel.org, jdelvare@suse.com, linux@roeck-us.net, "Luke D. Jones" Subject: [PATCH 8/8] platform/x86: asus-wmi: expose dGPU and CPU tunables for ROG Date: Tue, 20 Jun 2023 14:56:41 +1200 Message-Id: <20230620025641.53197-9-luke@ljones.dev> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230620025641.53197-1-luke@ljones.dev> References: <20230620025641.53197-1-luke@ljones.dev> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769189554295743278?= X-GMAIL-MSGID: =?utf-8?q?1769189554295743278?= Expose various CPU and dGPU tunables that are available on many ASUS ROG laptops. The tunables shown in sysfs will vary depending on the CPU and dGPU vendor. All of these variables are write only and there is no easy way to find what the defaults are. In general they seem to default to the max value the vendor sets for the CPU and dGPU package - this is not the same as the min/max writable value. Values written to these variables that are beyond the capabilities of the CPU are ignored by the laptop. Signed-off-by: Luke D. Jones --- .../ABI/testing/sysfs-platform-asus-wmi | 72 ++++ drivers/platform/x86/asus-wmi.c | 365 ++++++++++++++++++ include/linux/platform_data/x86/asus-wmi.h | 11 + 3 files changed, 448 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi index 5624bdef49cb..64c1c76d3fb8 100644 --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi @@ -126,3 +126,75 @@ Description: Change the mini-LED mode: * 0 - Single-zone, * 1 - Multi-zone + +What: /sys/devices/platform//ppt_total +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the Package Power Target total of CPU, corresponds to PL1 on Intel: + * min=5, max=250 + +What: /sys/devices/platform//ppt_sppt +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the Slow Package Power Tracking Limit of CPU, corresponds to PL2 on Intel: + * min=5, max=250 + +What: /sys/devices/platform//ppt_fppt +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the Fast Package Power Tracking Limit of CPU: + * min=5, max=250 + +What: /sys/devices/platform//ppt_edc +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the Electrical Design Current for the CPU, peak current: + * min=5, max=250 + +What: /sys/devices/platform//ppt_tdc +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the Thermal Design Current for the CPU, sustained current: + * min=5, max=250 + +What: /sys/devices/platform//ppt_limit +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the CPU PPT limit: + * min=5, max=130 + +What: /sys/devices/platform//ppt_limit_slow +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the CPU PPT slow limit: + * min=5, max=130 + +What: /sys/devices/platform//nv_gpu_boost +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the extra current boost of the Nvidia dGPU: + * min=5, max=25 + +What: /sys/devices/platform//nv_gpu_temp_target +Date: Jun 2023 +KernelVersion: 6.5 +Contact: "Luke Jones" +Description: + Set the temperature limit of the Nvidia dGPU: + * min=75, max=87 diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 1fc9e8afc2f3..62cee13f5576 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -117,6 +117,16 @@ module_param(fnlock_default, bool, 0444); /* Mask to determine if setting temperature or percentage */ #define FAN_CURVE_PWM_MASK 0x04 +/* Limits for tunables available on ASUS ROG laptops */ +#define PPT_TOTAL_MIN 5 +#define PPT_TOTAL_MAX 250 +#define PPT_CPU_MIN 5 +#define PPT_CPU_MAX 130 +#define NVIDIA_GPU_BOOST_MIN 5 +#define NVIDIA_GPU_BOOST_MAX 25 +#define NVIDIA_GPU_TEMP_MIN 75 +#define NVIDIA_GPU_TEMP_MAX 87 + static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL }; static int throttle_thermal_policy_write(struct asus_wmi *); @@ -247,6 +257,17 @@ struct asus_wmi { bool dgpu_disable_available; bool gpu_mux_mode_available; + /* Tunables provided by ASUS for gaming laptops */ + bool ppt_total_available; + bool ppt_edc_available; + bool ppt_tdc_available; + bool ppt_sppt_available; + bool ppt_limit_available; + bool ppt_limit_slow_available; + bool ppt_fppt_available; + bool nv_gpu_boost_available; + bool nv_gpu_temp_target_available; + bool kbd_rgb_mode_available; bool kbd_rgb_state_available; @@ -946,6 +967,312 @@ static const struct attribute_group *kbd_rgb_mode_groups[] = { NULL, }; +/* Tunable: PPT Total **********************************************************/ +static ssize_t ppt_total_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_TOTAL, value, &result); + if (err) { + pr_warn("Failed to set ppt_total: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_total (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_total"); + + return count; +} +static DEVICE_ATTR_WO(ppt_total); + +/* Tunable: PPT EDC **********************************************************/ +static ssize_t ppt_edc_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_EDC, value, &result); + if (err) { + pr_warn("Failed to set ppt_edc: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_edc (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_edc"); + + return count; +} +static DEVICE_ATTR_WO(ppt_edc); + +/* Tunable: PPT TDC ***********************************************************/ +static ssize_t ppt_tdc_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_TDC, value, &result); + if (err) { + pr_warn("Failed to set ppt_tdc: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_tdc (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_tdc"); + + return count; +} +static DEVICE_ATTR_WO(ppt_tdc); + +/* Tunable: PPT APU sPPT ******************************************************/ +static ssize_t ppt_sppt_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_SPPT, value, &result); + if (err) { + pr_warn("Failed to set ppt_sppt: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_sppt (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_sppt"); + + return count; +} +static DEVICE_ATTR_WO(ppt_sppt); + +/* Tunable: PPT APU fPPT ******************************************************/ +static ssize_t ppt_fppt_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_FPPT, value, &result); + if (err) { + pr_warn("Failed to set ppt_fppt: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_fppt (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_fpu_sppt"); + + return count; +} +static DEVICE_ATTR_WO(ppt_fppt); + +/* Tunable: PPT APU limit *****************************************************/ +static ssize_t ppt_limit_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_CPU_MIN || value > PPT_CPU_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_LIMIT, value, &result); + if (err) { + pr_warn("Failed to set ppt_limit: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_limit (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_limit"); + + return count; +} +static DEVICE_ATTR_WO(ppt_limit); + +/* Tunable: PPT limit slow ****************************************************/ +static ssize_t ppt_limit_slow_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < PPT_CPU_MIN || value > PPT_CPU_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_LIMIT_SLOW, value, &result); + if (err) { + pr_warn("Failed to set ppt_limit_slow: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set ppt_limit_slow (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_limit_slow"); + + return count; +} +static DEVICE_ATTR_WO(ppt_limit_slow); + +/* Tunable: NVIDIA GPU boost **************************************************/ +static ssize_t nv_gpu_boost_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < NVIDIA_GPU_BOOST_MIN || value > NVIDIA_GPU_BOOST_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_NV_GPU_BOOST, value, &result); + if (err) { + pr_warn("Failed to set nv_gpu_boost: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set nv_gpu_boost (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "nv_gpu_boost"); + + return count; +} +static DEVICE_ATTR_WO(nv_gpu_boost); + +/* Tunable: NVIDIA GPU temperature target *************************************/ +static ssize_t nv_gpu_temp_target_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int result, err; + u32 value; + + struct asus_wmi *asus = dev_get_drvdata(dev); + + result = kstrtou32(buf, 10, &value); + if (result) + return result; + + if (value < NVIDIA_GPU_TEMP_MIN || value > NVIDIA_GPU_TEMP_MAX) + return -EINVAL; + + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_NV_GPU_TEMP_TARGET, value, &result); + if (err) { + pr_warn("Failed to set nv_gpu_temp_target: %d\n", err); + return err; + } + + if (result > 1) { + pr_warn("Failed to set nv_gpu_temp_target (result): 0x%x\n", result); + return -EIO; + } + + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "nv_gpu_temp_target"); + + return count; +} +static DEVICE_ATTR_WO(nv_gpu_temp_target); + /* Battery ********************************************************************/ /* The battery maximum charging percentage */ @@ -3775,6 +4102,15 @@ static struct attribute *platform_attributes[] = { &dev_attr_als_enable.attr, &dev_attr_fan_boost_mode.attr, &dev_attr_throttle_thermal_policy.attr, + &dev_attr_ppt_total.attr, + &dev_attr_ppt_edc.attr, + &dev_attr_ppt_tdc.attr, + &dev_attr_ppt_sppt.attr, + &dev_attr_ppt_fppt.attr, + &dev_attr_ppt_limit.attr, + &dev_attr_ppt_limit_slow.attr, + &dev_attr_nv_gpu_boost.attr, + &dev_attr_nv_gpu_temp_target.attr, &dev_attr_panel_od.attr, &dev_attr_mini_led_mode.attr, NULL @@ -3812,6 +4148,24 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, ok = asus->fan_boost_mode_available; else if (attr == &dev_attr_throttle_thermal_policy.attr) ok = asus->throttle_thermal_policy_available; + else if (attr == &dev_attr_ppt_total.attr) + ok = asus->ppt_total_available; + else if (attr == &dev_attr_ppt_edc.attr) + ok = asus->ppt_edc_available; + else if (attr == &dev_attr_ppt_tdc.attr) + ok = asus->ppt_tdc_available; + else if (attr == &dev_attr_ppt_sppt.attr) + ok = asus->ppt_sppt_available; + else if (attr == &dev_attr_ppt_fppt.attr) + ok = asus->ppt_fppt_available; + else if (attr == &dev_attr_ppt_limit.attr) + ok = asus->ppt_limit_available; + else if (attr == &dev_attr_ppt_limit_slow.attr) + ok = asus->ppt_limit_slow_available; + else if (attr == &dev_attr_nv_gpu_boost.attr) + ok = asus->nv_gpu_boost_available; + else if (attr == &dev_attr_nv_gpu_temp_target.attr) + ok = asus->nv_gpu_temp_target_available; else if (attr == &dev_attr_panel_od.attr) ok = asus->panel_overdrive_available; else if (attr == &dev_attr_mini_led_mode.attr) @@ -4077,6 +4431,17 @@ static int asus_wmi_add(struct platform_device *pdev) asus->gpu_mux_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX); asus->kbd_rgb_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE); asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE); + asus->ppt_total_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_TOTAL); + asus->ppt_edc_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_EDC); + asus->ppt_tdc_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_TDC); + asus->ppt_sppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_SPPT); + asus->ppt_fppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_FPPT); + asus->ppt_limit_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_LIMIT); + asus->ppt_limit_slow_available = asus_wmi_dev_is_present(asus, + ASUS_WMI_DEVID_PPT_LIMIT_SLOW); + asus->nv_gpu_boost_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_NV_GPU_BOOST); + asus->nv_gpu_temp_target_available = asus_wmi_dev_is_present(asus, + ASUS_WMI_DEVID_NV_GPU_TEMP_TARGET); asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD); asus->mini_led_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE); diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h index ea80361ac6c7..d17ae2eb0f8d 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -86,6 +86,17 @@ #define ASUS_WMI_DEVID_GPU_FAN_CURVE 0x00110025 #define ASUS_WMI_DEVID_MID_FAN_CURVE 0x00110032 +/* Tunables for AUS ROG laptops */ +#define ASUS_WMI_DEVID_PPT_TOTAL 0x001200A0 +#define ASUS_WMI_DEVID_PPT_EDC 0x001200A1 +#define ASUS_WMI_DEVID_PPT_TDC 0x001200A2 +#define ASUS_WMI_DEVID_PPT_SPPT 0x001200A3 +#define ASUS_WMI_DEVID_PPT_LIMIT 0x001200B0 +#define ASUS_WMI_DEVID_PPT_LIMIT_SLOW 0x001200B1 +#define ASUS_WMI_DEVID_PPT_FPPT 0x001200C1 +#define ASUS_WMI_DEVID_NV_GPU_BOOST 0x001200C0 +#define ASUS_WMI_DEVID_NV_GPU_TEMP_TARGET 0x001200C2 + /* Power */ #define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012