From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08F381DE3BC; Wed, 12 Mar 2025 05:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756326; cv=none; b=P4ynXaeUTh/Nk8CjNgj2P8EYYA/ImssP+1WWS34e77hffoO126dexDoUzFVuF7l9uUI05J+qegGWkgGluGU5AewGf/3beA5xaz4vwGCsf3fnJEiJIkf3UbHQyV593HtdqpKAhc1mhMEiImHR5ickx0rQgDMvd5b6tDN1t4fzwB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756326; c=relaxed/simple; bh=W3245L2StKIvemIozL1BX/WJzgLB3uNjsg77Bwf+aQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MFSa96OljaUWlj6ycEF25fzChjlQCdBHsxKKDMXSEqokqNSVGq25ZqpJaRVeLFA1ck+BfY+XxAFcjeY6p4+U+Gz3fdY7HVDJjMEpbczr27rxgUKkTTf8phcOHaKckWkJi2CIJ/4ixD4GQpKisJJdhsZUAYS6HLVAggYZhAfk9E4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Uy2GdMqM; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uy2GdMqM" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-6fd8be1e534so59513687b3.3; Tue, 11 Mar 2025 22:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756323; x=1742361123; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3Iwv9GoGUQi5x68b8OratsnyLt/cCmcP1mUBYKH22PI=; b=Uy2GdMqMDyc8lKwTkzlqpgq2OH4rLkES+YtpNJz4meX4oqnUPVHwRQ4sbiUah+0k91 azREs/YJpbPxMM5xKsjTV41dVHOOCsZwbooXrQhUZ+5EUlaXls8kZFk5NKFQl5760HAb EedAdUtprxZL9jsBDLuNsXBkG+CfgHIHP2tiAKKn2KgK/JEdF22tkEaxZk5bFfJso+D+ 0Iv8QFOTa+kQVhrRvn94hgb4ovnb18ImpJ9t73AJzCXkUq6XqZUSHY65mJtkbE4nlsaj LLRmQrhlsmjEVhP1td8s5aL/V7N/OhHQ5xi5CJDy21uGTkNSknpwQBYw5rCi0rwUgqLZ AXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756323; x=1742361123; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3Iwv9GoGUQi5x68b8OratsnyLt/cCmcP1mUBYKH22PI=; b=Fa0k8hPHu1wm2SYlKtrGd6UjuXqRhWk8Jxm+6X/mlIlHzpNhyHhBYQGM+5ubt8DsUu /tQm3LZQofPslUxe4De3r9WmSLAyYCEVo4/pVsCbaaO9Y3nT219sDjkVN2y/Tudehr36 oLcKIbAo+J4xRxTakudnpfNGPHDjtBblMkcDiZxuJvvhmARpktTftFCKv1b4Was588OC E1ekmV1Uj9VI1rikxBD6D2uFEKwuNXCqwHSIBR3jkplLZgcY6sp5L+tbeiCojv5EhQEN 4GqZwd3KUA1MTfiGttq8sSx/ypeBBUowScwiR4UK84BxdMAiUw1nBne/KISQrzHIaMbT 1c0g== X-Forwarded-Encrypted: i=1; AJvYcCU9h2aNKWR0FuDOoXsutquADtUg+971PPDnmrLY/UNiNRBhuDHYHJL78UWDqVWQoacGV0SQpYVVRBO13D6K6EZddZYCVg==@vger.kernel.org, AJvYcCW2LtB5+40rnCJhr2i+GWVU8qmkDPH3HwB5SfKd+PWK9Oe6FVSWb9J/v9W/VbbqoMW2yG59IoLGvJRfpwA=@vger.kernel.org X-Gm-Message-State: AOJu0YypH40o3e7fX8LbnbxMTpEMBq+R/k4Js8ru67nCehnC4TrPpfV2 RCXiuiPzQU+1gNTIS63kDmOQv05HKBBUjUuTcG7gfcSoueiHxZSiCdShqF1q X-Gm-Gg: ASbGncspcBHZtyNNnF5ShSVW5MqGgcARb45Cr4fiBn9kyhrgqHsLzmtUTHDkMugxy+I uF7r2/z7lkq105LyOGPvYe57zeMPMieU9NaH+eiiSCHFn2n4z3QEuTyp1f6jWyXWEami5ungP6W 8CX6y7oHqEr7ZbPg6WrpyMubM9kGbh+xFrVQBJP0OC+aarTb5ZoQb46FjpUY9UB2K8TS3d2lMW0 XqYY2XUi/ncIuN7tTJ+zP6fqvR8YXlX03pTk/RdT4Q1VEtGkfuqrZZYQYYu9M+faIGZdgAReAfF Gs4tO0dKJ5+7KQXQEUcUyhP008HkrGhnL9gLbSUowrnLFQ== X-Google-Smtp-Source: AGHT+IGcKYSMvPEnkV+H4cSFV7qZJ/l7bsDkT9xJqLQM1mj1gZm/xF2CCmyiJyjMxAA3P+qU80Pp2A== X-Received: by 2002:a05:690c:48c2:b0:6fd:47a7:3fb2 with SMTP id 00721157ae682-6febf39bfecmr283042657b3.24.1741756322646; Tue, 11 Mar 2025 22:12:02 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:01 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:14 -0500 Subject: [PATCH v5 01/12] platform/x86: alienware-wmi-wmax: Rename thermal related symbols 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 Message-Id: <20250312-hwm-v5-1-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 The "thermal" features of the WMAX WMI device are only present on the host device if the ACPI _UID is "AWCC". Replace WMAX prefixes with "AWCC" to reflect this relationship. Thermal profiles with WMAX_PROFILE_BASIC prefix are also renamed to WMAX_PROFILE_LEGACY because they are only supported in older versions of this WMI device. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 173 +++++++++++++--------= ---- 1 file changed, 87 insertions(+), 86 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index 3d3014b5adf046c94c1ebf39a0e28a92622b40d6..ed70e12d73d7fe5d89f3364c536= 7820bf47e3c1e 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -24,16 +24,17 @@ #define WMAX_METHOD_DEEP_SLEEP_STATUS 0x0C #define WMAX_METHOD_BRIGHTNESS 0x3 #define WMAX_METHOD_ZONE_CONTROL 0x4 -#define WMAX_METHOD_THERMAL_INFORMATION 0x14 -#define WMAX_METHOD_THERMAL_CONTROL 0x15 -#define WMAX_METHOD_GAME_SHIFT_STATUS 0x25 =20 -#define WMAX_THERMAL_MODE_GMODE 0xAB +#define AWCC_METHOD_THERMAL_INFORMATION 0x14 +#define AWCC_METHOD_THERMAL_CONTROL 0x15 +#define AWCC_METHOD_GAME_SHIFT_STATUS 0x25 =20 -#define WMAX_FAILURE_CODE 0xFFFFFFFF -#define WMAX_THERMAL_TABLE_MASK GENMASK(7, 4) -#define WMAX_THERMAL_MODE_MASK GENMASK(3, 0) -#define WMAX_SENSOR_ID_MASK BIT(8) +#define AWCC_THERMAL_MODE_GMODE 0xAB + +#define AWCC_FAILURE_CODE 0xFFFFFFFF +#define AWCC_THERMAL_TABLE_MASK GENMASK(7, 4) +#define AWCC_THERMAL_MODE_MASK GENMASK(3, 0) +#define AWCC_SENSOR_ID_MASK BIT(8) =20 static bool force_platform_profile; module_param_unsafe(force_platform_profile, bool, 0); @@ -151,38 +152,38 @@ static const struct dmi_system_id awcc_dmi_table[] __= initconst =3D { }, }; =20 -enum WMAX_THERMAL_INFORMATION_OPERATIONS { - WMAX_OPERATION_SYS_DESCRIPTION =3D 0x02, - WMAX_OPERATION_LIST_IDS =3D 0x03, - WMAX_OPERATION_CURRENT_PROFILE =3D 0x0B, +enum AWCC_THERMAL_INFORMATION_OPERATIONS { + AWCC_OP_GET_SYSTEM_DESCRIPTION =3D 0x02, + AWCC_OP_GET_RESOURCE_ID =3D 0x03, + AWCC_OP_GET_CURRENT_PROFILE =3D 0x0B, }; =20 -enum WMAX_THERMAL_CONTROL_OPERATIONS { - WMAX_OPERATION_ACTIVATE_PROFILE =3D 0x01, +enum AWCC_THERMAL_CONTROL_OPERATIONS { + AWCC_OP_ACTIVATE_PROFILE =3D 0x01, }; =20 -enum WMAX_GAME_SHIFT_STATUS_OPERATIONS { - WMAX_OPERATION_TOGGLE_GAME_SHIFT =3D 0x01, - WMAX_OPERATION_GET_GAME_SHIFT_STATUS =3D 0x02, +enum AWCC_GAME_SHIFT_STATUS_OPERATIONS { + AWCC_OP_TOGGLE_GAME_SHIFT =3D 0x01, + AWCC_OP_GET_GAME_SHIFT_STATUS =3D 0x02, }; =20 -enum WMAX_THERMAL_TABLES { - WMAX_THERMAL_TABLE_BASIC =3D 0x90, - WMAX_THERMAL_TABLE_USTT =3D 0xA0, +enum AWCC_THERMAL_TABLES { + AWCC_THERMAL_TABLE_LEGACY =3D 0x90, + AWCC_THERMAL_TABLE_USTT =3D 0xA0, }; =20 -enum wmax_thermal_mode { - THERMAL_MODE_USTT_BALANCED, - THERMAL_MODE_USTT_BALANCED_PERFORMANCE, - THERMAL_MODE_USTT_COOL, - THERMAL_MODE_USTT_QUIET, - THERMAL_MODE_USTT_PERFORMANCE, - THERMAL_MODE_USTT_LOW_POWER, - THERMAL_MODE_BASIC_QUIET, - THERMAL_MODE_BASIC_BALANCED, - THERMAL_MODE_BASIC_BALANCED_PERFORMANCE, - THERMAL_MODE_BASIC_PERFORMANCE, - THERMAL_MODE_LAST, +enum awcc_thermal_profile { + AWCC_PROFILE_USTT_BALANCED, + AWCC_PROFILE_USTT_BALANCED_PERFORMANCE, + AWCC_PROFILE_USTT_COOL, + AWCC_PROFILE_USTT_QUIET, + AWCC_PROFILE_USTT_PERFORMANCE, + AWCC_PROFILE_USTT_LOW_POWER, + AWCC_PROFILE_LEGACY_QUIET, + AWCC_PROFILE_LEGACY_BALANCED, + AWCC_PROFILE_LEGACY_BALANCED_PERFORMANCE, + AWCC_PROFILE_LEGACY_PERFORMANCE, + AWCC_PROFILE_LAST, }; =20 struct wmax_led_args { @@ -210,20 +211,20 @@ struct wmax_u32_args { struct awcc_priv { struct wmi_device *wdev; struct device *ppdev; - enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; + enum awcc_thermal_profile supported_thermal_profiles[PLATFORM_PROFILE_LAS= T]; }; =20 -static const enum platform_profile_option wmax_mode_to_platform_profile[TH= ERMAL_MODE_LAST] =3D { - [THERMAL_MODE_USTT_BALANCED] =3D PLATFORM_PROFILE_BALANCED, - [THERMAL_MODE_USTT_BALANCED_PERFORMANCE] =3D PLATFORM_PROFILE_BALANCED_PE= RFORMANCE, - [THERMAL_MODE_USTT_COOL] =3D PLATFORM_PROFILE_COOL, - [THERMAL_MODE_USTT_QUIET] =3D PLATFORM_PROFILE_QUIET, - [THERMAL_MODE_USTT_PERFORMANCE] =3D PLATFORM_PROFILE_PERFORMANCE, - [THERMAL_MODE_USTT_LOW_POWER] =3D PLATFORM_PROFILE_LOW_POWER, - [THERMAL_MODE_BASIC_QUIET] =3D PLATFORM_PROFILE_QUIET, - [THERMAL_MODE_BASIC_BALANCED] =3D PLATFORM_PROFILE_BALANCED, - [THERMAL_MODE_BASIC_BALANCED_PERFORMANCE] =3D PLATFORM_PROFILE_BALANCED_P= ERFORMANCE, - [THERMAL_MODE_BASIC_PERFORMANCE] =3D PLATFORM_PROFILE_PERFORMANCE, +static const enum platform_profile_option awcc_mode_to_platform_profile[AW= CC_PROFILE_LAST] =3D { + [AWCC_PROFILE_USTT_BALANCED] =3D PLATFORM_PROFILE_BALANCED, + [AWCC_PROFILE_USTT_BALANCED_PERFORMANCE] =3D PLATFORM_PROFILE_BALANCED_PE= RFORMANCE, + [AWCC_PROFILE_USTT_COOL] =3D PLATFORM_PROFILE_COOL, + [AWCC_PROFILE_USTT_QUIET] =3D PLATFORM_PROFILE_QUIET, + [AWCC_PROFILE_USTT_PERFORMANCE] =3D PLATFORM_PROFILE_PERFORMANCE, + [AWCC_PROFILE_USTT_LOW_POWER] =3D PLATFORM_PROFILE_LOW_POWER, + [AWCC_PROFILE_LEGACY_QUIET] =3D PLATFORM_PROFILE_QUIET, + [AWCC_PROFILE_LEGACY_BALANCED] =3D PLATFORM_PROFILE_BALANCED, + [AWCC_PROFILE_LEGACY_BALANCED_PERFORMANCE] =3D PLATFORM_PROFILE_BALANCED_= PERFORMANCE, + [AWCC_PROFILE_LEGACY_PERFORMANCE] =3D PLATFORM_PROFILE_PERFORMANCE, }; =20 static struct awcc_quirks *awcc; @@ -444,26 +445,26 @@ const struct attribute_group wmax_deepsleep_attribute= _group =3D { * Thermal Profile control * - Provides thermal profile control through the Platform Profile API */ -static bool is_wmax_thermal_code(u32 code) +static bool is_awcc_thermal_mode(u32 code) { - if (code & WMAX_SENSOR_ID_MASK) + if (code & AWCC_SENSOR_ID_MASK) return false; =20 - if ((code & WMAX_THERMAL_MODE_MASK) >=3D THERMAL_MODE_LAST) + if ((code & AWCC_THERMAL_MODE_MASK) >=3D AWCC_PROFILE_LAST) return false; =20 - if ((code & WMAX_THERMAL_TABLE_MASK) =3D=3D WMAX_THERMAL_TABLE_BASIC && - (code & WMAX_THERMAL_MODE_MASK) >=3D THERMAL_MODE_BASIC_QUIET) + if ((code & AWCC_THERMAL_TABLE_MASK) =3D=3D AWCC_THERMAL_TABLE_LEGACY && + (code & AWCC_THERMAL_MODE_MASK) >=3D AWCC_PROFILE_LEGACY_QUIET) return true; =20 - if ((code & WMAX_THERMAL_TABLE_MASK) =3D=3D WMAX_THERMAL_TABLE_USTT && - (code & WMAX_THERMAL_MODE_MASK) <=3D THERMAL_MODE_USTT_LOW_POWER) + if ((code & AWCC_THERMAL_TABLE_MASK) =3D=3D AWCC_THERMAL_TABLE_USTT && + (code & AWCC_THERMAL_MODE_MASK) <=3D AWCC_PROFILE_USTT_LOW_POWER) return true; =20 return false; } =20 -static int wmax_thermal_information(struct wmi_device *wdev, u8 operation, +static int awcc_thermal_information(struct wmi_device *wdev, u8 operation, u8 arg, u32 *out_data) { struct wmax_u32_args in_args =3D { @@ -474,21 +475,21 @@ static int wmax_thermal_information(struct wmi_device= *wdev, u8 operation, }; int ret; =20 - ret =3D alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_INFORMATION, + ret =3D alienware_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &in_args, sizeof(in_args), out_data); if (ret < 0) return ret; =20 - if (*out_data =3D=3D WMAX_FAILURE_CODE) + if (*out_data =3D=3D AWCC_FAILURE_CODE) return -EBADRQC; =20 return 0; } =20 -static int wmax_thermal_control(struct wmi_device *wdev, u8 profile) +static int awcc_thermal_control(struct wmi_device *wdev, u8 profile) { struct wmax_u32_args in_args =3D { - .operation =3D WMAX_OPERATION_ACTIVATE_PROFILE, + .operation =3D AWCC_OP_ACTIVATE_PROFILE, .arg1 =3D profile, .arg2 =3D 0, .arg3 =3D 0, @@ -496,18 +497,18 @@ static int wmax_thermal_control(struct wmi_device *wd= ev, u8 profile) u32 out_data; int ret; =20 - ret =3D alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_CONTROL, + ret =3D alienware_wmi_command(wdev, AWCC_METHOD_THERMAL_CONTROL, &in_args, sizeof(in_args), &out_data); if (ret) return ret; =20 - if (out_data =3D=3D WMAX_FAILURE_CODE) + if (out_data =3D=3D AWCC_FAILURE_CODE) return -EBADRQC; =20 return 0; } =20 -static int wmax_game_shift_status(struct wmi_device *wdev, u8 operation, +static int awcc_game_shift_status(struct wmi_device *wdev, u8 operation, u32 *out_data) { struct wmax_u32_args in_args =3D { @@ -518,46 +519,46 @@ static int wmax_game_shift_status(struct wmi_device *= wdev, u8 operation, }; int ret; =20 - ret =3D alienware_wmi_command(wdev, WMAX_METHOD_GAME_SHIFT_STATUS, + ret =3D alienware_wmi_command(wdev, AWCC_METHOD_GAME_SHIFT_STATUS, &in_args, sizeof(in_args), out_data); if (ret < 0) return ret; =20 - if (*out_data =3D=3D WMAX_FAILURE_CODE) + if (*out_data =3D=3D AWCC_FAILURE_CODE) return -EOPNOTSUPP; =20 return 0; } =20 -static int thermal_profile_get(struct device *dev, - enum platform_profile_option *profile) +static int awcc_platform_profile_get(struct device *dev, + enum platform_profile_option *profile) { struct awcc_priv *priv =3D dev_get_drvdata(dev); u32 out_data; int ret; =20 - ret =3D wmax_thermal_information(priv->wdev, WMAX_OPERATION_CURRENT_PROFI= LE, + ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_CURRENT_PROFILE, 0, &out_data); =20 if (ret < 0) return ret; =20 - if (out_data =3D=3D WMAX_THERMAL_MODE_GMODE) { + if (out_data =3D=3D AWCC_THERMAL_MODE_GMODE) { *profile =3D PLATFORM_PROFILE_PERFORMANCE; return 0; } =20 - if (!is_wmax_thermal_code(out_data)) + if (!is_awcc_thermal_mode(out_data)) return -ENODATA; =20 - out_data &=3D WMAX_THERMAL_MODE_MASK; - *profile =3D wmax_mode_to_platform_profile[out_data]; + out_data &=3D AWCC_THERMAL_MODE_MASK; + *profile =3D awcc_mode_to_platform_profile[out_data]; =20 return 0; } =20 -static int thermal_profile_set(struct device *dev, - enum platform_profile_option profile) +static int awcc_platform_profile_set(struct device *dev, + enum platform_profile_option profile) { struct awcc_priv *priv =3D dev_get_drvdata(dev); =20 @@ -565,8 +566,8 @@ static int thermal_profile_set(struct device *dev, u32 gmode_status; int ret; =20 - ret =3D wmax_game_shift_status(priv->wdev, - WMAX_OPERATION_GET_GAME_SHIFT_STATUS, + ret =3D awcc_game_shift_status(priv->wdev, + AWCC_OP_GET_GAME_SHIFT_STATUS, &gmode_status); =20 if (ret < 0) @@ -574,8 +575,8 @@ static int thermal_profile_set(struct device *dev, =20 if ((profile =3D=3D PLATFORM_PROFILE_PERFORMANCE && !gmode_status) || (profile !=3D PLATFORM_PROFILE_PERFORMANCE && gmode_status)) { - ret =3D wmax_game_shift_status(priv->wdev, - WMAX_OPERATION_TOGGLE_GAME_SHIFT, + ret =3D awcc_game_shift_status(priv->wdev, + AWCC_OP_TOGGLE_GAME_SHIFT, &gmode_status); =20 if (ret < 0) @@ -583,21 +584,21 @@ static int thermal_profile_set(struct device *dev, } } =20 - return wmax_thermal_control(priv->wdev, + return awcc_thermal_control(priv->wdev, priv->supported_thermal_profiles[profile]); } =20 -static int thermal_profile_probe(void *drvdata, unsigned long *choices) +static int awcc_platform_profile_probe(void *drvdata, unsigned long *choic= es) { enum platform_profile_option profile; struct awcc_priv *priv =3D drvdata; - enum wmax_thermal_mode mode; + enum awcc_thermal_profile mode; u8 sys_desc[4]; u32 first_mode; u32 out_data; int ret; =20 - ret =3D wmax_thermal_information(priv->wdev, WMAX_OPERATION_SYS_DESCRIPTI= ON, + ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_SYSTEM_DESCRIPTI= ON, 0, (u32 *) &sys_desc); if (ret < 0) return ret; @@ -605,7 +606,7 @@ static int thermal_profile_probe(void *drvdata, unsigne= d long *choices) first_mode =3D sys_desc[0] + sys_desc[1]; =20 for (u32 i =3D 0; i < sys_desc[3]; i++) { - ret =3D wmax_thermal_information(priv->wdev, WMAX_OPERATION_LIST_IDS, + ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_RESOURCE_ID, i + first_mode, &out_data); =20 if (ret =3D=3D -EIO) @@ -614,11 +615,11 @@ static int thermal_profile_probe(void *drvdata, unsig= ned long *choices) if (ret =3D=3D -EBADRQC) break; =20 - if (!is_wmax_thermal_code(out_data)) + if (!is_awcc_thermal_mode(out_data)) continue; =20 - mode =3D out_data & WMAX_THERMAL_MODE_MASK; - profile =3D wmax_mode_to_platform_profile[mode]; + mode =3D out_data & AWCC_THERMAL_MODE_MASK; + profile =3D awcc_mode_to_platform_profile[mode]; priv->supported_thermal_profiles[profile] =3D out_data; =20 set_bit(profile, choices); @@ -629,7 +630,7 @@ static int thermal_profile_probe(void *drvdata, unsigne= d long *choices) =20 if (awcc->gmode) { priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] =3D - WMAX_THERMAL_MODE_GMODE; + AWCC_THERMAL_MODE_GMODE; =20 set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); } @@ -638,9 +639,9 @@ static int thermal_profile_probe(void *drvdata, unsigne= d long *choices) } =20 static const struct platform_profile_ops awcc_platform_profile_ops =3D { - .probe =3D thermal_profile_probe, - .profile_get =3D thermal_profile_get, - .profile_set =3D thermal_profile_set, + .probe =3D awcc_platform_profile_probe, + .profile_get =3D awcc_platform_profile_get, + .profile_set =3D awcc_platform_profile_set, }; =20 static int awcc_platform_profile_init(struct wmi_device *wdev) --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37C171DED56; Wed, 12 Mar 2025 05:12:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756327; cv=none; b=E3ARHnSyY8sp7Cz7pN2WQaypyOiFfQRk5kEWbVdDRhw5Y7f9oDLThHO12pNKva21cQTuaJAtc+Jjq6Vt6h+DwKmdpI1Ku76W5BJDUEeYMcjH0o/+1pcwyl0wZ/OVMw8XkSxeb7bDBat93REQiDezXp2QTaX228Ou2Ctv5mt7mlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756327; c=relaxed/simple; bh=b6I4LW2lXRr4zSKyCgVo5hQkgsNPWVdZQx2aOlTduKg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fv9O/wn5NZdThK8NuwrF3ZdIcX94WhO3Z1uNCjIJfRgVtNh68DgEAsQc3PosSiLnmdANDoh3oANXkhdar0gEK2a44/Q9LlxxkYr8s1P7zsCdfCbF87DpNb5fe7voJG6yywCGbFH2B2pYtZXo/ZT614LhPew5DajTu307rwrgztE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A1BdrBAQ; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A1BdrBAQ" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-6fda22908d9so47232317b3.1; Tue, 11 Mar 2025 22:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756324; x=1742361124; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ki8JJlqvtQ1DWozBXa70s7Vleuhvzvt2Tgc/aHkAO4s=; b=A1BdrBAQgIZ6QpY0Rd+nFMmIIqUn9DYVDnR45FxDC3Lp9daTafcWktjl21Kz0QmDo7 yk6KHQvGc4XlAPwf6xLGCpObotiieeYnw4Gk/wq/r/A4TT4h0J1U/sbKssOPHSrFLXYm Hm735Az9UXT39fcmPaBnd8f+IIld4w8fGDNBFFO+cIQl1IGgyDHVbMT/UkNS864Qmkcd wFaXNpQjLAUKSDB2qurBrethqc4g/jjhKItaHKYy8pVRh5lRP8uMOjxrjmAMBdDBmLcD JbEHd4kbmXjMV3ispHIgyKhM0Q7newvNA/zk/Sk4UO8HqwzOaoeaO4Nc+B5+15RdDXtF SZJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756324; x=1742361124; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ki8JJlqvtQ1DWozBXa70s7Vleuhvzvt2Tgc/aHkAO4s=; b=n88O2ECTlxKWukwu5QePkXwcjmxSOO97kAFYVe96x8B2pmdFngylBo9CZEINedy4T+ LV88wdbNNgBmXlluhiq224orxO/1fOjz8FyTqeZQAowcrJ4f4mIjnT9UeJE35oWSQcrr FPE3CdMXNekm2PoGWl52JWcCR1pYFb9vH4chmBNlZKEJIgamb8V6x35gu0xjRnuFzs2Z aAmSh4Vhp6bBltqnHaBrf6nx6EQcMf9drMGDHsmO/ZktHe38GWumByl8lEDzSJxtt48K Vyq8/PeGduoK/oJQguBelzo0ZWavc/llQcHysK+uUQ6tvin5RrFm2WXzNJenzwAskwAY 30jQ== X-Forwarded-Encrypted: i=1; AJvYcCWsZ1aMYvjHydBngktMQ2hxopRYMo5E1JxYNtySx2qpF1gwC2okMK0WSYOm4j6ly1l6IehStf6CPRD9kS4=@vger.kernel.org, AJvYcCXKFAzlMZd1rXqRRYGQR4rshG6mk+R1yICMeLt5WaHYSaKNUARq3DoFFNameklr9YQlBEh+AiuPHRFxeaDmo0yyMOhrzw==@vger.kernel.org X-Gm-Message-State: AOJu0YzbXI/f5KkBJNDPg7bSP0eGK210dUpdWjK1vDOI0iWkDdZC/XGP 2RYrr2gHbzvrH8Jy4PKCxpV4J3lWtdQinn6LwjFtGLmQPfkjZLascMjV5KGe X-Gm-Gg: ASbGnctvuRDCHdpq+fVgMX2QzQRDIjs7JR7eksvsFfxuFLMfY2zoBpE2advUaTR6ucA qPJK2+8kyeMwA8c84elGcxud4DyBPi2UstT2ubb0/p6h1sQr6IMSSJdif3pVrLZHC48jjYQRL+4 HRtRVCCT5w/QsXl33c7YhwtC+RYHB6wj3vFsWqP7RlokR3WjEQrGVu44YsGFGL2ZAcjtVfj5W7z jl/HMJGND2pfQRvgdOEDcibUVjYZaLurhrWmybSyzCGOXt+UlMWNDTagiPQJG6/pRCgJiyCSk8S wRvCpIIp3QBx8WfB2EbSciEL8yexDRtzPvvE46SQTIAhPg== X-Google-Smtp-Source: AGHT+IFgYfileD4GR5Pw70b8L8MNE/qxLqxjGU/YaNhXoncddJtkguB6Xq98DKE8z6IwX6zLEIIMWg== X-Received: by 2002:a05:690c:48c2:b0:6f7:409c:f659 with SMTP id 00721157ae682-6febf292e17mr256428367b3.8.1741756324551; Tue, 11 Mar 2025 22:12:04 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:04 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:15 -0500 Subject: [PATCH v5 02/12] platform/x86: alienware-wmi-wmax: Refactor is_awcc_thermal_mode() 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 Message-Id: <20250312-hwm-v5-2-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Refactor is_awcc_thermal_mode() to use FIELD_GET() instead of bitwise operations. Drop the check for BIT(8) sensor flag and rename it to is_awcc_thermal_profile_id(). Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 33 +++++++++++++---------= ---- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index ed70e12d73d7fe5d89f3364c5367820bf47e3c1e..80aefba5b22d6b4ac18aeb2ca35= 6f8c911150abd 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -34,7 +34,8 @@ #define AWCC_FAILURE_CODE 0xFFFFFFFF #define AWCC_THERMAL_TABLE_MASK GENMASK(7, 4) #define AWCC_THERMAL_MODE_MASK GENMASK(3, 0) -#define AWCC_SENSOR_ID_MASK BIT(8) +/* Some IDs have a BIT(8) flag that we ignore */ +#define AWCC_RESOURCE_ID_MASK GENMASK(7, 0) =20 static bool force_platform_profile; module_param_unsafe(force_platform_profile, bool, 0); @@ -168,8 +169,8 @@ enum AWCC_GAME_SHIFT_STATUS_OPERATIONS { }; =20 enum AWCC_THERMAL_TABLES { - AWCC_THERMAL_TABLE_LEGACY =3D 0x90, - AWCC_THERMAL_TABLE_USTT =3D 0xA0, + AWCC_THERMAL_TABLE_LEGACY =3D 0x9, + AWCC_THERMAL_TABLE_USTT =3D 0xA, }; =20 enum awcc_thermal_profile { @@ -445,20 +446,18 @@ const struct attribute_group wmax_deepsleep_attribute= _group =3D { * Thermal Profile control * - Provides thermal profile control through the Platform Profile API */ -static bool is_awcc_thermal_mode(u32 code) +static bool is_awcc_thermal_profile_id(u8 code) { - if (code & AWCC_SENSOR_ID_MASK) + u8 table =3D FIELD_GET(AWCC_THERMAL_TABLE_MASK, code); + u8 mode =3D FIELD_GET(AWCC_THERMAL_MODE_MASK, code); + + if (mode >=3D AWCC_PROFILE_LAST) return false; =20 - if ((code & AWCC_THERMAL_MODE_MASK) >=3D AWCC_PROFILE_LAST) - return false; - - if ((code & AWCC_THERMAL_TABLE_MASK) =3D=3D AWCC_THERMAL_TABLE_LEGACY && - (code & AWCC_THERMAL_MODE_MASK) >=3D AWCC_PROFILE_LEGACY_QUIET) + if (table =3D=3D AWCC_THERMAL_TABLE_LEGACY && mode >=3D AWCC_PROFILE_LEGA= CY_QUIET) return true; =20 - if ((code & AWCC_THERMAL_TABLE_MASK) =3D=3D AWCC_THERMAL_TABLE_USTT && - (code & AWCC_THERMAL_MODE_MASK) <=3D AWCC_PROFILE_USTT_LOW_POWER) + if (table =3D=3D AWCC_THERMAL_TABLE_USTT && mode <=3D AWCC_PROFILE_USTT_L= OW_POWER) return true; =20 return false; @@ -548,7 +547,7 @@ static int awcc_platform_profile_get(struct device *dev, return 0; } =20 - if (!is_awcc_thermal_mode(out_data)) + if (!is_awcc_thermal_profile_id(out_data)) return -ENODATA; =20 out_data &=3D AWCC_THERMAL_MODE_MASK; @@ -597,6 +596,7 @@ static int awcc_platform_profile_probe(void *drvdata, u= nsigned long *choices) u32 first_mode; u32 out_data; int ret; + u8 id; =20 ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_SYSTEM_DESCRIPTI= ON, 0, (u32 *) &sys_desc); @@ -615,12 +615,13 @@ static int awcc_platform_profile_probe(void *drvdata,= unsigned long *choices) if (ret =3D=3D -EBADRQC) break; =20 - if (!is_awcc_thermal_mode(out_data)) + id =3D FIELD_GET(AWCC_RESOURCE_ID_MASK, out_data); + if (!is_awcc_thermal_profile_id(id)) continue; =20 - mode =3D out_data & AWCC_THERMAL_MODE_MASK; + mode =3D FIELD_GET(AWCC_THERMAL_MODE_MASK, id); profile =3D awcc_mode_to_platform_profile[mode]; - priv->supported_thermal_profiles[profile] =3D out_data; + priv->supported_thermal_profiles[profile] =3D id; =20 set_bit(profile, choices); } --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D46181DF73B; Wed, 12 Mar 2025 05:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756329; cv=none; b=EQwIEZtX54gAz0TYH+FzrCICkgHQbywUN8E3FAXdgQ2YV6xEMa0HM88HE5Us0/GCJSyAa5P5DxYuHDrHU2qrPJf81Qa1MK/MLZXetDjagJyvYpvXlKrnao5I+lbuTiDZVee9766zP4RLeXVDuWvaHTKJ0fRFA+NU8xCDIR78xT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756329; c=relaxed/simple; bh=kh4XOux5fLnMpuGqL85jz0yoPfb6XXn59lqRIp0pM/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TAHqOWh6QUmwikagUEoPC4yUpNUu4ZNKOsPliVnNnepaBArPkBDs7OFjcSOLpk2h/fGcRcWZU8f0PPB4CkmZylwMZNJ95FdylX/HkDXjliYL7AA5XzG5efa579dE9eWf03nFxt0yupC606jt8Ekx3+DjbXN4M9Kxxa6KC/V6T4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P1ibsmXV; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P1ibsmXV" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-6f768e9be1aso5304097b3.0; Tue, 11 Mar 2025 22:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756326; x=1742361126; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xOGDcRRC34nNPALoyT1dHPnr4hN67cRU6zIR5rs0fSA=; b=P1ibsmXV7DcuMxt8XNhH+8CTx3hYKX1TwGO2s1Io1EsxunltYOti3yE4A471bWIMiJ PC2wodhEL7VSgD9uSz3eu1FsLxaudp7V6ufSGwzhRtwZK/wC1CeOZ+4ZvsqlC/x/GmNS XCKkC4gyu0quPhrrUg8CXk1VrC8AvGpnOczD4CJBHqsK6wTNfWlYppqZynCMNumzo0II JpER1bYDQ/ogvlAVw88nvzrWHOeYiWuWl0cTUjnocijvYTQO5faFgzpBx87mvDlITUK6 6uVs7xjdG6dk0erFyRDkMQoGVutFV4SFrF+4Oy+SQxrYowK40ttpm5/WoRVVG8c04ojq K4oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756326; x=1742361126; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xOGDcRRC34nNPALoyT1dHPnr4hN67cRU6zIR5rs0fSA=; b=Kzu27Z0x+JGacoyk/UBJEY8wexXtjAXGa0abEB7E+ZjZV050IXmDs1O32685VFntEc VAwjgkFvnmTwjK52gbLvEZ5FRn58SQvHKghlhlhgRVwp73FP51xMk2XKwIKtBonAwDmY sIt41Z5wJMTL5XMJexJxapdPvmYJ90TIgbHXwqb/73gWcFbPAxs3R6jGu1AGvjzx+5B6 BG9kI1F5F8a5OowNwPxGCbCjpPAA50cc7iw4Swr96FFRrLSSe61+iMAT3jwWPwCI+S4n JsGFeXmb6fkY9inaM58BoKJTG95omSkEC0SUi7La/IJ0+PAyWGiy3qT6tDCaVAfTD/qo nS7A== X-Forwarded-Encrypted: i=1; AJvYcCViR+kfkqKmjgRjCKfU5Qjv4IkKYHgSCzQHchIsT2Frlp1CavruWbc8Q7+aKaRFVvZUNEAp7JxnqA/LhMXyOMoTUFzmww==@vger.kernel.org, AJvYcCXknxdmzlDTR2sDigVOFA0sJGslA9naQnlDSNrvbRDgghg5bYfqpYbQCkh6Pu6M1/w4xiQ57wNKRN3pCf8=@vger.kernel.org X-Gm-Message-State: AOJu0YwHqO+/7TeiVdaLDyiHeOUFR4udg8bEPFFKDrxkaG4NyQ0KqTmE NiNqbiG1rWCp85KbPW62iAN58vdPrxiIO2EKDuhnwoY7q+6r7RcLuzSjh2p9 X-Gm-Gg: ASbGnctQdT1vgXLWTCrE82JGFCE2NxD6x4SuDS5HcKrd/6DKXESCJQRqLYBmtkmhqGK fRpnW6FX9jdqdkJLQ+dIHyI7bj2RlqjLmIMN3voZysNDzcMD42fyxULVNefaMUbYuc4BD8Hh5HZ /w10olhugTET5D2ZoS4f5+NiH2IZn/2gpuz8eevbrAZl+Yo917qaXVQsE6uT/LsNBIiPXCaftXT 40tFkR3HpdH/i4gD5Nm+6TtmoZsI+BQbIak82Y4/ebMLNYJIKOm7lHuOXRFtiuusxvPAU675YK5 FGKr/0oe1cFZMUmcMpGx0/HAQkTTZWY9ICY8XmANEkt0nQ== X-Google-Smtp-Source: AGHT+IFvl7g0TncjtZHVHax1//KyFcxJEkACBceMcBPa+nO1L94YpF3zhirWTx/SlHRm4I3meveghw== X-Received: by 2002:a05:690c:2e0a:b0:6fe:8fe:f5c2 with SMTP id 00721157ae682-6ff0a2ab572mr64328837b3.8.1741756326436; Tue, 11 Mar 2025 22:12:06 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:06 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:16 -0500 Subject: [PATCH v5 03/12] platform/x86: alienware-wmi-wmax: Improve internal AWCC API 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 Message-Id: <20250312-hwm-v5-3-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Inline all AWCC WMI helper methods and directly return the newly introduced __awcc_wmi_command() helper to simplify implementation. Drop awcc_thermal_control() in favor of awcc_op_activate_profile(). Add awcc_op_get_resource_id(), awcc_op_get_current_profile() and a new failure code. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 150 +++++++++++++++------= ---- 1 file changed, 91 insertions(+), 59 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index 80aefba5b22d6b4ac18aeb2ca356f8c911150abd..b9dbfdc8096c571722b3c7ac3e7= 3989e235e2eb9 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -32,6 +32,7 @@ #define AWCC_THERMAL_MODE_GMODE 0xAB =20 #define AWCC_FAILURE_CODE 0xFFFFFFFF +#define AWCC_FAILURE_CODE_2 0xFFFFFFFE #define AWCC_THERMAL_TABLE_MASK GENMASK(7, 4) #define AWCC_THERMAL_MODE_MASK GENMASK(3, 0) /* Some IDs have a BIT(8) flag that we ignore */ @@ -443,8 +444,7 @@ const struct attribute_group wmax_deepsleep_attribute_g= roup =3D { }; =20 /* - * Thermal Profile control - * - Provides thermal profile control through the Platform Profile API + * AWCC Helpers */ static bool is_awcc_thermal_profile_id(u8 code) { @@ -463,72 +463,107 @@ static bool is_awcc_thermal_profile_id(u8 code) return false; } =20 -static int awcc_thermal_information(struct wmi_device *wdev, u8 operation, - u8 arg, u32 *out_data) +static int __awcc_wmi_command(struct wmi_device *wdev, u32 method_id, + struct wmax_u32_args *args, u32 *out) { - struct wmax_u32_args in_args =3D { + int ret; + + ret =3D alienware_wmi_command(wdev, method_id, args, sizeof(*args), out); + if (ret) + return ret; + + if (*out =3D=3D AWCC_FAILURE_CODE || *out =3D=3D AWCC_FAILURE_CODE_2) + return -EBADRQC; + + return 0; +} + +static inline int awcc_thermal_information(struct wmi_device *wdev, u8 ope= ration, + u8 arg, u32 *out) +{ + struct wmax_u32_args args =3D { .operation =3D operation, .arg1 =3D arg, .arg2 =3D 0, .arg3 =3D 0, }; - int ret; =20 - ret =3D alienware_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, - &in_args, sizeof(in_args), out_data); - if (ret < 0) - return ret; - - if (*out_data =3D=3D AWCC_FAILURE_CODE) - return -EBADRQC; - - return 0; + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); } =20 -static int awcc_thermal_control(struct wmi_device *wdev, u8 profile) +static inline int awcc_game_shift_status(struct wmi_device *wdev, u8 opera= tion, + u32 *out) { - struct wmax_u32_args in_args =3D { - .operation =3D AWCC_OP_ACTIVATE_PROFILE, - .arg1 =3D profile, - .arg2 =3D 0, - .arg3 =3D 0, - }; - u32 out_data; - int ret; - - ret =3D alienware_wmi_command(wdev, AWCC_METHOD_THERMAL_CONTROL, - &in_args, sizeof(in_args), &out_data); - if (ret) - return ret; - - if (out_data =3D=3D AWCC_FAILURE_CODE) - return -EBADRQC; - - return 0; -} - -static int awcc_game_shift_status(struct wmi_device *wdev, u8 operation, - u32 *out_data) -{ - struct wmax_u32_args in_args =3D { + struct wmax_u32_args args =3D { .operation =3D operation, .arg1 =3D 0, .arg2 =3D 0, .arg3 =3D 0, }; - int ret; =20 - ret =3D alienware_wmi_command(wdev, AWCC_METHOD_GAME_SHIFT_STATUS, - &in_args, sizeof(in_args), out_data); - if (ret < 0) - return ret; - - if (*out_data =3D=3D AWCC_FAILURE_CODE) - return -EOPNOTSUPP; - - return 0; + return __awcc_wmi_command(wdev, AWCC_METHOD_GAME_SHIFT_STATUS, &args, out= ); } =20 +/** + * awcc_op_get_resource_id - Get the resource ID at a given index + * @wdev: AWCC WMI device + * @index: Index + * @out: Value returned by the WMI call + * + * Get the resource ID at a given index. Resource IDs are listed in the + * following order: + * + * - Fan IDs + * - Sensor IDs + * - Unknown IDs + * - Thermal Profile IDs + * + * The total number of IDs of a given type can be obtained with + * AWCC_OP_GET_SYSTEM_DESCRIPTION. + * + * Return: 0 on success, -errno on failure + */ +static inline int awcc_op_get_resource_id(struct wmi_device *wdev, u8 inde= x, u32 *out) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_GET_RESOURCE_ID, + .arg1 =3D index, + .arg2 =3D 0, + .arg3 =3D 0, + }; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); +} + +static inline int awcc_op_get_current_profile(struct wmi_device *wdev, u32= *out) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_GET_CURRENT_PROFILE, + .arg1 =3D 0, + .arg2 =3D 0, + .arg3 =3D 0, + }; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); +} + +static inline int awcc_op_activate_profile(struct wmi_device *wdev, u8 pro= file) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_ACTIVATE_PROFILE, + .arg1 =3D profile, + .arg2 =3D 0, + .arg3 =3D 0, + }; + u32 out; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_CONTROL, &args, &out); +} + +/* + * Thermal Profile control + * - Provides thermal profile control through the Platform Profile API + */ static int awcc_platform_profile_get(struct device *dev, enum platform_profile_option *profile) { @@ -536,10 +571,8 @@ static int awcc_platform_profile_get(struct device *de= v, u32 out_data; int ret; =20 - ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_CURRENT_PROFILE, - 0, &out_data); - - if (ret < 0) + ret =3D awcc_op_get_current_profile(priv->wdev, &out_data); + if (ret) return ret; =20 if (out_data =3D=3D AWCC_THERMAL_MODE_GMODE) { @@ -550,7 +583,7 @@ static int awcc_platform_profile_get(struct device *dev, if (!is_awcc_thermal_profile_id(out_data)) return -ENODATA; =20 - out_data &=3D AWCC_THERMAL_MODE_MASK; + out_data =3D FIELD_GET(AWCC_THERMAL_MODE_MASK, out_data); *profile =3D awcc_mode_to_platform_profile[out_data]; =20 return 0; @@ -583,8 +616,8 @@ static int awcc_platform_profile_set(struct device *dev, } } =20 - return awcc_thermal_control(priv->wdev, - priv->supported_thermal_profiles[profile]); + return awcc_op_activate_profile(priv->wdev, + priv->supported_thermal_profiles[profile]); } =20 static int awcc_platform_profile_probe(void *drvdata, unsigned long *choic= es) @@ -606,8 +639,7 @@ static int awcc_platform_profile_probe(void *drvdata, u= nsigned long *choices) first_mode =3D sys_desc[0] + sys_desc[1]; =20 for (u32 i =3D 0; i < sys_desc[3]; i++) { - ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_RESOURCE_ID, - i + first_mode, &out_data); + ret =3D awcc_op_get_resource_id(priv->wdev, i + first_mode, &out_data); =20 if (ret =3D=3D -EIO) return ret; --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C90B1E1A08; Wed, 12 Mar 2025 05:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756330; cv=none; b=Mr/0vz3SelkWnqPVA0Im15cv2+TxIzWKjxEU5WyG25QXF89TsrWT6NjQfy4hGbatEiEAFLJxfuvDJKcpXFPsWpGeekVRuiHw64xMC1KQBuSYH861a2elXbqD92sJjFeUzGaywLS2HtgXjdp12NSZOeG4XaytEZy+1ZpgWvVTyzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756330; c=relaxed/simple; bh=0/cs7k9NEYKOzfKSWrMqL/b8KZs7Y/LPsKkPsOmnrDQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=msSO43AsGYAA9vDKpMNbcKKfs3WHxBfVe0dfAWlOq4TIrej21+u6Z5SmkJzWAAa8VDM1xvTKn1kjZUUzdm2RDRPmkxrZHLtA2ZUgu3QBHsi6gv4cmDx74Hnb90uD4EWUtW2+Nu7ykOczjCfxkr00/p/TOlf7vc5FnPJx+nLlZnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CIZ7BVgg; arc=none smtp.client-ip=209.85.128.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CIZ7BVgg" Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-6fee50bfea5so30506947b3.1; Tue, 11 Mar 2025 22:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756328; x=1742361128; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tfPNOoHpP1FsVmbeiwOjL1eZebItbrovfjcUpFcyo94=; b=CIZ7BVggAnjryaaf1tiz2zefG2SJEi8xkcbw5Qz5kVZ+b+QSxW6h6NINkJmJVwNN7+ 7y2VwFxIlN6cL0dVo1T+FKjMicGSwMhQzQtNly1poJvo+8Fz80to64qjYiMNjKI1GMuq vqyzI5Pe+0SlQFg+LhVR72JtFVRDF6BGp2B1bvGJYnrYtDa0ttSg3TtBfaiBKKmGtrVO OtQV5lK3ZEAjdpBH5NSEgfJljWvPIU88gWXUpqj7oP2SEVsOLUSA6LmV1ds/5JVE2Vht PeS3z5SioZ56a2bSHbxva6Kx5HEmQTqS+pVKI0k3piPk5b2faLy0iyu+chJGeZ31t21N FaRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756328; x=1742361128; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tfPNOoHpP1FsVmbeiwOjL1eZebItbrovfjcUpFcyo94=; b=iGicBQ9/vuGMe17cb0yvHwOsvq0ngM4N0P20gYF94Q+k1iTzftYSM1UQ/cKmZ2M5Rb 2nl5n7WQ/Gk7Bmd+HzgpjnU0z2X7s3SumonKSbIWh/BLvZ/gxiFsvo1j6bKEo4qrTJsi lMWRd283Qkdt/OnQGAny1FVX7GGjnYrmL3+DsK71h28Hy7aE/4fKuoUTren1cKxa/tB5 ZgyWlW1SXAu75jkxHwu2cuNxGIdBGVmtZ3Ixa+wwakcc+W2M4PebPAJdNE5LDI7n5tTh DQYQ1S5V4skOdK3pJjPFIlMEr12jUdIQ9rcGdAQUdhLAM9/WiSBoN6A6U55ghbrvRsTp MTNg== X-Forwarded-Encrypted: i=1; AJvYcCWwLPHorb4qpDuWA0Qp7DJP21pxojP5k5vC8YGZLhkknb9mMzDT6LjeAUFaJ/kgzjxpcCDavfYoZv49YgU=@vger.kernel.org, AJvYcCX0VKQcB0Rlo9/6+vN2HldgTsHuzM31bdH+DZ2v4xbISJECo9WozXn5ig3klh+FT6uLJi8/h0je6ak8aqC/fAok49VYBA==@vger.kernel.org X-Gm-Message-State: AOJu0YyglCgEE0RccQ3pswFdexli/xQE9f5XQY4dOGcjuvmxL16/5oTC COsEijoT05QObcK/GBD++pz8wcvByUyCfPK4y3fJ5n+hOkItJ2irIA7117MG X-Gm-Gg: ASbGncs2HWwzjIDrx+iXFtvEs/pLxPXky4AIsBwdOtkWrsF5i3ea2geK+C+cMP3v9ma C8W/DJB38fKhfjCGmkPimUMUe2Bplayen/ao1nH776dahI4TVQR4qH2ivHYyM1NtHlU3lmAmIhi oYND8t21pal0tvnXqo+ujOT5LwDRnoiiN42tVDCXvo0K4UD2Xry7vrJzOvCTz8q10umeGyzuWwq QkFM7yh9WuWHZlNluvuhsCd2INMQ6CWBveCOCiBRmpTkU6G1nJLlum6m6IyC4eybtZsmzsDB1Wo UBfY72aBpS8/y1CXph8zo7z2JSdUFDqFSbqAzjmHJ9XYVQ== X-Google-Smtp-Source: AGHT+IFu9GDEuRPI9SHsSV4tu4487/eSk8rfb+SYTrCph1E6KcBJB/0KiTAbFi8Hah/GI08FugSHXA== X-Received: by 2002:a05:690c:3612:b0:6fb:b2c0:71da with SMTP id 00721157ae682-6febf3b37c8mr281791657b3.36.1741756327791; Tue, 11 Mar 2025 22:12:07 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:07 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:17 -0500 Subject: [PATCH v5 04/12] platform/x86: alienware-wmi-wmax: Modify supported_thermal_profiles[] 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 Message-Id: <20250312-hwm-v5-4-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Rename supported_thermal_profiles[] -> supported_profiles[] and change it's type to u8 because it stores AWCC thermal IDs. Reviewed-by: Armin Wolf Reviewed-by: Ilpo J=C3=A4rvinen Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index b9dbfdc8096c571722b3c7ac3e73989e235e2eb9..a8a13779793abbcc8d1263474ca= c6227d524a6f5 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -213,7 +213,7 @@ struct wmax_u32_args { struct awcc_priv { struct wmi_device *wdev; struct device *ppdev; - enum awcc_thermal_profile supported_thermal_profiles[PLATFORM_PROFILE_LAS= T]; + u8 supported_profiles[PLATFORM_PROFILE_LAST]; }; =20 static const enum platform_profile_option awcc_mode_to_platform_profile[AW= CC_PROFILE_LAST] =3D { @@ -616,8 +616,7 @@ static int awcc_platform_profile_set(struct device *dev, } } =20 - return awcc_op_activate_profile(priv->wdev, - priv->supported_thermal_profiles[profile]); + return awcc_op_activate_profile(priv->wdev, priv->supported_profiles[prof= ile]); } =20 static int awcc_platform_profile_probe(void *drvdata, unsigned long *choic= es) @@ -653,7 +652,7 @@ static int awcc_platform_profile_probe(void *drvdata, u= nsigned long *choices) =20 mode =3D FIELD_GET(AWCC_THERMAL_MODE_MASK, id); profile =3D awcc_mode_to_platform_profile[mode]; - priv->supported_thermal_profiles[profile] =3D id; + priv->supported_profiles[profile] =3D id; =20 set_bit(profile, choices); } @@ -662,7 +661,7 @@ static int awcc_platform_profile_probe(void *drvdata, u= nsigned long *choices) return -ENODEV; =20 if (awcc->gmode) { - priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] =3D + priv->supported_profiles[PLATFORM_PROFILE_PERFORMANCE] =3D AWCC_THERMAL_MODE_GMODE; =20 set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 605491E32D6; Wed, 12 Mar 2025 05:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756332; cv=none; b=MaUk1RJM0dxhPsmKwFZxXziynWPdAEMEzGCc//GsiF+m28lBixMFWff0y7etCD7uV5vo8KBE38Di5A707brMsc6RtKrsmNLNRHTlfwD1Jp/0nr8XgJBM0VK9R1RdpI8mluefbdCHGm6c5QeUJ6T6KJnBtybIAzQ+zMj9CUz8XeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756332; c=relaxed/simple; bh=cPKPG5Vxh6Z/Se8zjhuifeo9I8dN5wM+mN+9d222mtM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ez0FbVxfkbOcwXMradHiar9Udq+Ptfew93Ieoob6q0ocpK6wa7IKAD+0VOxLrrqf02QEntUn9aNZZ78mQcG8dhWRh+t+o8w78nOpcTgE3l5eqUlo0m3QMSeJCbH8B5Y50iL3AKeLjrlxfasRM/XS4UgQrft2Uygqz31Xj+hoXM4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UyRa2rNu; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UyRa2rNu" Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-6fed0620395so36032217b3.3; Tue, 11 Mar 2025 22:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756329; x=1742361129; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KJz42pw5OoHFXvVMA6liTx4M4GaMhFeDvsfN2Iym2Zk=; b=UyRa2rNua19OxfV/oU136ZbmAUkVhqrsjGzsZl6N3uZqfrcBMQj8e/X3dmg2RVxzBW Js7rI3aNMcCYEkzJNCfA0PK+C77eV8nNN4xfwwIl2ur4/kztvNyGpfXlOnn3YsgkJDN9 FmMTW1RQuA81W6I/0d+2wUSagCcR5b9WdU+CyP6ugy2Mp27SFHfNGDRrvHrpjhGzukd7 3Tzyg6VFuUKSf+s6ZR2/fNNxhhddJb0It66XtM9o94ksKaMMZJATkCMPtcYse+e/WwAy A1xtyoAOQj2ETSXkfEmBI3hlM7OFr74Cn6TsRDzL2jMp6MWhMWWJzOmlwWksDK6yCi+A S1tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756329; x=1742361129; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KJz42pw5OoHFXvVMA6liTx4M4GaMhFeDvsfN2Iym2Zk=; b=rtfFANv144yhnHxthpbHnNKt8aYkOLAKqoN6cAJw3ShdeRWxS9jRcSZYfq17/oP9Bg veXmisBFgjeyyHoySUnVYQX5GZpcYzUWqF9EY80ROogN1Gs5sx3nAZDvzuBn6HHQOHY2 z0J5PopuIAuqBcmzQ2AAJvssXUntYpkM4LI85kfKj6WnaIf3NFktUy/QagNsd+7427ms X251X8h6zhq8CHxa9XHKMfwhP15OCe3oJ8SBcTtEESKWAWP6G3nhoAMhRABih38JQuom 5pClFEUHvS5PLIMPAub6KgJ/O9oM3zMmKQdAR6khChfkiC4pSD+BT7KllOK22zewdRRT kk2Q== X-Forwarded-Encrypted: i=1; AJvYcCU6nW3G2LBHihibS3y3fDUUtjCe2Yuc5EaJk9x1npAiOrgycntcXnW7PH1uSutPl8Sh7ta8Gew06PvPQi8=@vger.kernel.org, AJvYcCWW2S5LWE9VroI4C15vQ8k6w5ICehggSCzH1i6q1l0oTnwv7+L+Nrjo3/GXX8YW8YQm6fxXftrN7bufjYb1VXzmIMEj+A==@vger.kernel.org X-Gm-Message-State: AOJu0Ywd6IrrZYhgPm7K4iv9FSg5ZGmHkeSRd22piJYlNnLTlklCEZED IFaBHkui/fxUc5vTABo+TGVX9WmRWEB2zjAFdYQjS43t6sWladLjaOB4+T3Z X-Gm-Gg: ASbGncu7wQyvWb7MdAQpgtfiufMjSx8lGEZS0p6qSFQmA0gqiKQgBKO7SmUcKr+x07G xS21YZtsQOgsew/dIJiwztggCCNJB1DNyVwjFAUKw2NrW5zbYYYrQ8V7u34tDFdNz9bmQwuMdTL wfV0H70svhDqdSgg+IwxGwkNgwuxeYjxDyFd49sS9n5fKq+RHqljjgEoyljNvDyfF1Ra7YStASY QcdlpEHVoZ8b0opFoN0zj5uIb1O7lwkIT7U1uPB/o7ibDDe/kvQLqWDoIowltaTx2eZH78WoLT8 dHoUCeb+bKO9MrQVFhBi+ReIalNDWuL6XVCBo8hxrxebGg== X-Google-Smtp-Source: AGHT+IGnpS2WbKHcuV8C17LluqmtpayiXX8/sBkOWpJmpKbOmUyCgknKvQUIgn7ldUz6pnhIC5WN3A== X-Received: by 2002:a05:690c:c96:b0:6fd:64ac:21f0 with SMTP id 00721157ae682-6febf2d4457mr297153417b3.10.1741756329207; Tue, 11 Mar 2025 22:12:09 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:08 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:18 -0500 Subject: [PATCH v5 05/12] platform/x86: alienware-wmi-wmax: Improve platform profile probe 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 Message-Id: <20250312-hwm-v5-5-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Get and store the AWCC system description in alienware_awcc_setup() instead of awcc_platform_profile_probe() and add a check for integer overflows to avoid misbehaviors. While at it, replace set_bit() with it's non-atomic version __set_bit() because `choices` belong to this thread only. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 61 +++++++++++++++++++---= ---- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index a8a13779793abbcc8d1263474cac6227d524a6f5..0530f25b956f73f47c0354f40da= c2910448c894e 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -38,6 +38,9 @@ /* Some IDs have a BIT(8) flag that we ignore */ #define AWCC_RESOURCE_ID_MASK GENMASK(7, 0) =20 +/* Arbitrary limit based on supported models */ +#define AWCC_MAX_RES_COUNT 16 + static bool force_platform_profile; module_param_unsafe(force_platform_profile, bool, 0); MODULE_PARM_DESC(force_platform_profile, "Forces auto-detecting thermal pr= ofiles without checking if WMI thermal backend is available"); @@ -212,6 +215,17 @@ struct wmax_u32_args { =20 struct awcc_priv { struct wmi_device *wdev; + union { + u32 system_description; + struct { + u8 fan_count; + u8 temp_count; + u8 unknown_count; + u8 profile_count; + }; + u8 res_count[4]; + }; + struct device *ppdev; u8 supported_profiles[PLATFORM_PROFILE_LAST]; }; @@ -624,37 +638,40 @@ static int awcc_platform_profile_probe(void *drvdata,= unsigned long *choices) enum platform_profile_option profile; struct awcc_priv *priv =3D drvdata; enum awcc_thermal_profile mode; - u8 sys_desc[4]; - u32 first_mode; + u8 id, offset =3D 0; u32 out_data; int ret; - u8 id; =20 - ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_SYSTEM_DESCRIPTI= ON, - 0, (u32 *) &sys_desc); - if (ret < 0) - return ret; - - first_mode =3D sys_desc[0] + sys_desc[1]; - - for (u32 i =3D 0; i < sys_desc[3]; i++) { - ret =3D awcc_op_get_resource_id(priv->wdev, i + first_mode, &out_data); + /* + * Thermal profile IDs are listed last at offset + * fan_count + temp_count + unknown_count + */ + for (unsigned int i =3D 0; i < ARRAY_SIZE(priv->res_count) - 1; i++) + offset +=3D priv->res_count[i]; =20 + for (unsigned int i =3D 0; i < priv->profile_count; i++) { + ret =3D awcc_op_get_resource_id(priv->wdev, i + offset, &out_data); if (ret =3D=3D -EIO) return ret; =20 + /* + * Some devices report an incorrect number of thermal profiles + * so the resource ID list may end prematurely + */ if (ret =3D=3D -EBADRQC) break; =20 id =3D FIELD_GET(AWCC_RESOURCE_ID_MASK, out_data); - if (!is_awcc_thermal_profile_id(id)) + if (!is_awcc_thermal_profile_id(id)) { + dev_dbg(&priv->wdev->dev, "Unmapped thermal profile ID 0x%02x\n", id); continue; + } =20 mode =3D FIELD_GET(AWCC_THERMAL_MODE_MASK, id); profile =3D awcc_mode_to_platform_profile[mode]; priv->supported_profiles[profile] =3D id; =20 - set_bit(profile, choices); + __set_bit(profile, choices); } =20 if (bitmap_empty(choices, PLATFORM_PROFILE_LAST)) @@ -664,7 +681,7 @@ static int awcc_platform_profile_probe(void *drvdata, u= nsigned long *choices) priv->supported_profiles[PLATFORM_PROFILE_PERFORMANCE] =3D AWCC_THERMAL_MODE_GMODE; =20 - set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + __set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); } =20 return 0; @@ -695,6 +712,20 @@ static int alienware_awcc_setup(struct wmi_device *wde= v) if (!priv) return -ENOMEM; =20 + ret =3D awcc_thermal_information(wdev, AWCC_OP_GET_SYSTEM_DESCRIPTION, + 0, &priv->system_description); + if (ret < 0) + return ret; + + /* Sanity check */ + for (unsigned int i =3D 0; i < ARRAY_SIZE(priv->res_count); i++) { + if (priv->res_count[i] > AWCC_MAX_RES_COUNT) { + dev_err(&wdev->dev, "Malformed system description: 0x%08x\n", + priv->system_description); + return -ENXIO; + } + } + priv->wdev =3D wdev; dev_set_drvdata(&wdev->dev, priv); =20 --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE7F51E5B7A; Wed, 12 Mar 2025 05:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756334; cv=none; b=JH9EpTE9EJteW7BO8/OLp9QMmrFElDtdVU/No3h3TlGg01qGO7gUbkNABhUPzYSOzhOKwahmfZQo3vCZd+5N4qqOgrJOHep2/fNWTg4fOehEP0M3ROnGBrUSYT/z19/r2JiQmotXfRjx139lbVVDnW86qgpo2CT3NTxsK0CRX6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756334; c=relaxed/simple; bh=/RVTDk95xTdgwIURpxctNMV56eIngqQ4/eX5yRQzsK8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tj4UpkYS/dM8trTuGhGfDcHjqYCcJ4Ct53hgXcvC3oAT6wCzfe+/ztHbfw8YanDbyzUEgz5FZbZavnpkVzOguvWUBBrdL3G0WQLcuPWa1jYD6PQxO902gm4Nrrf6YO2ez+7CdtE5JhlIh/X+u9p2RO1oOEja61j66kMhA8GLQCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NteUun+J; arc=none smtp.client-ip=209.85.219.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NteUun+J" Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e63504bedd0so4528679276.0; Tue, 11 Mar 2025 22:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756331; x=1742361131; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=H43dqBGhipBxPHVP+jwxsicROhpGVr1mHnd5dBnGOsU=; b=NteUun+JL899DrJ7NPL0noTjsfvNIW4B8jWWLsTpb8GiuGa7IPiX0jDChnHzrP6v0r X6HIuywr+i7ddiMerF6SVdIvwbwG7mbaCfO/rxwxzjdLvkfaxPbb2U3zuMIfF06nvO+E 4L/H7lhRl889jWgz5LYIC7IAjCcpv7SePK3fU3YNLmTcgkPaZLQ/OYdA2qPHSwZj188H 83cdSuoIb2r/mf1zlPzzcrkMc+fWIiGmblkxjB46OEdy6o/wGlB8rCcs41EPeZsM8VSa m3GkAK0gNFBL//8i3Uhl5BvjdB77l4YWQevOWh10YONNEjDPHDU/ScDDr3r9wi0pFH04 coHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756331; x=1742361131; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H43dqBGhipBxPHVP+jwxsicROhpGVr1mHnd5dBnGOsU=; b=PTj6HETufNOdM9Y1UWpBtQaVxsbnr5XASFGlNhCLIURcDcToHV4GmnzXJgdFVbfGN4 6s2eIa9ZZt2FQxPfUbbWPf7Y/k6+Ly4YOhbp8NgA3cOpWAsX1C5GBI22bKtNdcAVeG5V kVYsFfPgD/ohFramMajnJyjiqbjJbgBhdg1wlFDwQP5xfApgHwWkDQZWBOEnyLB+hpCl FIROz66wgTgwkeMCUmlRDPm/mRAOWHHmQ6kDjiYhHK+GSyIacXe4oglFkbqndiE1FHvo 9MXIXt7yNrtYf9KnE94BX85qdHsBFb7iPixSq6BDQ/OquMF57PL4+Yc2RkHyGfRSc3Ix JJFg== X-Forwarded-Encrypted: i=1; AJvYcCV8hA3s/9/74bjZb+7OuJEww4L9Z/mXy9LjdHPUf1V2irGQwVn1DHKFgIP1xEkkg076g3+HvP2L9p6hgY48WXdIuce+BA==@vger.kernel.org, AJvYcCWU852zeY1/wH99N1Es4NaW988RSvbmZdVXokXyuVkreQmWhQszu75jxBBR2LcHy6FoJt9hDAXRpNG44I0=@vger.kernel.org X-Gm-Message-State: AOJu0YyPKDN48IJW7LyNFZ8qiaAm/KIHd3P8lCtIValTflRlqo1vLDyH MGpq9S5Xd2b3mXGK49AnqG10tWe7TcuoqRV6TyxIFpcxbhMoIaFHGwuM/UR9 X-Gm-Gg: ASbGnctbmI6HYSexP+oO/B6m2ilCO2ZhgTUYzDkq/7/mK9kE+IavVySnVcKSn5R0DEF T15TEJQDaAXfenULBbTw9sROL1IJrfuCZteylMGYDH8A31BS3OwGkyr+1OFYLY6ysrCxDwPVp/w vjjUT50s/4YXC0JqdhGkcPceZGmAwxK8JzaAsx6NdHBzGt2GjyAlvKBwnnmFS7dXRLsSKvOApke 2icThbZSx2JCaR+DoZQMI0m8kU0bYO5PobVR3eSaJIQsRbFtZIPqa9Srkz24uWJbxUaGJ89YpCz v+3xN2RWvlitFT0nRBcoBLGApmdgnWi5L3W8YhPc9JY/aFOVCs34pacL X-Google-Smtp-Source: AGHT+IH4Vu4OGMsGsx44C/OICTmAEU8UVkdKCjnypWyMPPD+9hifuXf5H/3pPZRe0qul97sQnepWtQ== X-Received: by 2002:a05:690c:74c5:b0:6f7:5605:c62b with SMTP id 00721157ae682-6ff0925ec53mr89327537b3.27.1741756331513; Tue, 11 Mar 2025 22:12:11 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:10 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:19 -0500 Subject: [PATCH v5 06/12] platform/x86: alienware-wmi-wmax: Add support for the "custom" thermal profile 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 Message-Id: <20250312-hwm-v5-6-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 All models with the "AWCC" WMAX device support a "custom" thermal profile. In some models this profile signals user-space that the user wants to manually control the fans, which are always unlocked. In other models it actually unlocks manual fan control. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index 0530f25b956f73f47c0354f40dac2910448c894e..3b37e4456482bc284b8e867c1c5= b6255fc6c8ef2 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -29,8 +29,6 @@ #define AWCC_METHOD_THERMAL_CONTROL 0x15 #define AWCC_METHOD_GAME_SHIFT_STATUS 0x25 =20 -#define AWCC_THERMAL_MODE_GMODE 0xAB - #define AWCC_FAILURE_CODE 0xFFFFFFFF #define AWCC_FAILURE_CODE_2 0xFFFFFFFE #define AWCC_THERMAL_TABLE_MASK GENMASK(7, 4) @@ -177,6 +175,11 @@ enum AWCC_THERMAL_TABLES { AWCC_THERMAL_TABLE_USTT =3D 0xA, }; =20 +enum AWCC_SPECIAL_THERMAL_CODES { + AWCC_SPECIAL_PROFILE_CUSTOM =3D 0x00, + AWCC_SPECIAL_PROFILE_GMODE =3D 0xAB, +}; + enum awcc_thermal_profile { AWCC_PROFILE_USTT_BALANCED, AWCC_PROFILE_USTT_BALANCED_PERFORMANCE, @@ -589,9 +592,15 @@ static int awcc_platform_profile_get(struct device *de= v, if (ret) return ret; =20 - if (out_data =3D=3D AWCC_THERMAL_MODE_GMODE) { + switch (out_data) { + case AWCC_SPECIAL_PROFILE_CUSTOM: + *profile =3D PLATFORM_PROFILE_CUSTOM; + return 0; + case AWCC_SPECIAL_PROFILE_GMODE: *profile =3D PLATFORM_PROFILE_PERFORMANCE; return 0; + default: + break; } =20 if (!is_awcc_thermal_profile_id(out_data)) @@ -679,11 +688,17 @@ static int awcc_platform_profile_probe(void *drvdata,= unsigned long *choices) =20 if (awcc->gmode) { priv->supported_profiles[PLATFORM_PROFILE_PERFORMANCE] =3D - AWCC_THERMAL_MODE_GMODE; + AWCC_SPECIAL_PROFILE_GMODE; =20 __set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); } =20 + /* Every model supports the "custom" profile */ + priv->supported_profiles[PLATFORM_PROFILE_CUSTOM] =3D + AWCC_SPECIAL_PROFILE_CUSTOM; + + __set_bit(PLATFORM_PROFILE_CUSTOM, choices); + return 0; } =20 --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C66E1E98E0; Wed, 12 Mar 2025 05:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756337; cv=none; b=NhFvsVaGeqeYaknbUv0ehCxxHHa5vVCpOqAqUn9Wa2Jh6YeNRYaBevkGf8zq5F4k2YJpIOHEKugmRp1NuAAriXgZnxYulfsI7KsCsISjhiSntkgSUAX9n/U+GDr2z6REqLpIRGI/7NU7Zv2CroxYbWuuSPjcUkoh1/A70e5d2ZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756337; c=relaxed/simple; bh=xJNuBJ8Lq+cf0vQCIGGN/Evrgk1LJ5JESRbRX7CZAU0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TPnhvZQjgyCdIOAT14QSh9/OUAsAudJFD1klJS/6GkwvYCrt/ccyCU80lUmLMjcp+U5qBCMaHLaKJguuPaNYChREPvSpfSt7myQle9a61bhdVNLQbLAYV/a37OiIqHWoIlxQjOXCKMarSrQLsrPS9hLTteTb6lXb7rxD976w2zo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NRGm+Pat; arc=none smtp.client-ip=209.85.128.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NRGm+Pat" Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-6feab7c5f96so51668167b3.3; Tue, 11 Mar 2025 22:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756334; x=1742361134; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ovIBwyrFCxunHqofwj+leY0pxsU/rdE7vlF0h9oNJ9g=; b=NRGm+PatfLbd2Bdmhg7ZQ+uovjoO6nsjb/FS9ubJNr3Xtkc1/HS2UIOfxXh9lvjyjl uQnx7cLnNiG0Z5RTyk9Lcq73nhJaaWMrcG0ghc9AKdT9TocnWp8Q3BBonbDtLr+2kus/ tF2TF6p4kQTk3nBvka/ghmQLjIC+nKgKkWPr8vWTsvG6rQD+u0yZ8gQuZAI77U/Q/Vqs Vj5Y5fLX9Nlne5qD+OzjJE/93LVdp/uWKQsi1hjCKSg5D5l02l9eDJ2w2iSqbsCi7Z8q ydqe4ooamItD2uQL+WV7YmKNZMCCnbuu+PNaa7avtA72mAvVvyHzmjP/18gtbI/O7Oi+ EXdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756334; x=1742361134; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ovIBwyrFCxunHqofwj+leY0pxsU/rdE7vlF0h9oNJ9g=; b=Y42TOKXh330sYCelaI9GdT2El0LlIPqnGrybOG/BSQXwauf2N5e9+UZ0QgvnCAcy6Z dd+w7H5Xu47RkhROZwbuoiACZPeMkby8x2RBgGSlB/am/XIR8OZftjov5FchZS4Q2xVu dTrX6KXcn0lBW0QiOFV+wVkDDOo81ZBKRYU2/icVTXMY2knsHUJ8MATlIvow7J5QQ0dQ qHXKp2xkqV4wzY0wgf23MrcAqYjfeDNyDxPBDeHs+R+PdQKaV4uqSB0sVDrEEqIc+7yj iB9muJfDJrsYi21Hp4A2q2AUbgROjhnu0QwYAILT+oDzI1HkhOFXnnCj4XFN7QYg2tSM lxUg== X-Forwarded-Encrypted: i=1; AJvYcCURicsRzgH+tsnwQnGRyS/zL7Nc5++vXhYyVY6UslkRNnAcfOC4dqKIF7u7ucKKvaZwNpVFrGH7OWGx0zTl@vger.kernel.org, AJvYcCWfZ4Av9EzC+zN2Jo3A8v7ydBHkwjV8A71MMl72okrFhW1iyEdIgX2eUmCKnm6QBabZKpq3oYtgdQwRIQ==@vger.kernel.org, AJvYcCXnIcfZzi+QcVeYDgZLB10DzjpEZyyzag+DiOK47zwoxgDCTRvi3a9vFFFcH408ne4Mt0MUyHIESp4Hzhk1UFt/kW3rEQ==@vger.kernel.org X-Gm-Message-State: AOJu0YydukhKNQ6ae8x0DKFlQLBz2mA4sxZMvsv9VsZdINVGrPGiMOS+ 3hR6CT6Grtv/orbK0eCSkCJ+vtU/7vo6yf8AInTsLFmVWhD6D/ZqES2D+V5P X-Gm-Gg: ASbGncuF1ZWqHE2mH01XNwntk8MEogMM74nrXLQ7JH+VSX3rh31bGNa4S7Nr+PDIwDg yNRXi/C3x6ONFVAoovf5fwYKgcjuLww96ZB6ONNzEkwXL7INBnVrMYoLY/UH5jxm8xoeVgOjPJr WWYjVycgbSHeSmyWyV9MPxaVusE/EFev0mbmrEl7HaUzZq0MvAha43CyHJpnMwlfwt+BQJIvMBA NkSORTl1GVIO3cda1WYz54GG8wzmMrtTe3QABxBJCEyw067jXOEig3u6OjlH7td3W8naSe+CN8u KVtYALyVVLckYkvU3hQwEfHSHu/a2Db1T1VIx391F7Vtrg== X-Google-Smtp-Source: AGHT+IGcNG41cBulP/NtDN2inWgtEiMsrbbupH3PIO2/PogiK7BSFWPG312Z+3JIXVhYP407nbefwQ== X-Received: by 2002:a05:690c:6701:b0:6ef:69b2:eac with SMTP id 00721157ae682-6febf2b571dmr240132527b3.4.1741756334082; Tue, 11 Mar 2025 22:12:14 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:13 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:20 -0500 Subject: [PATCH v5 07/12] platform/x86: alienware-wmi-wmax: Add HWMON support 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 Message-Id: <20250312-hwm-v5-7-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org X-Mailer: b4 0.14.2 All models with the "AWCC" WMAX device support monitoring fan speed and temperature sensors. Expose this feature through the HWMON interface. Cc: Guenter Roeck Cc: Jean Delvare Cc: linux-hwmon@vger.kernel.org Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/Kconfig | 1 + drivers/platform/x86/dell/alienware-wmi-wmax.c | 396 +++++++++++++++++++++= ++++ 2 files changed, 397 insertions(+) diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/= Kconfig index f8a0dffcaab7c3b423472c5b9093011334a698c8..f7107b0c55f27c9be70f50b36dd= 2e7bab42a6960 100644 --- a/drivers/platform/x86/dell/Kconfig +++ b/drivers/platform/x86/dell/Kconfig @@ -22,6 +22,7 @@ config ALIENWARE_WMI depends on DMI depends on LEDS_CLASS depends on NEW_LEDS + depends on HWMON help This is a driver for controlling Alienware WMI driven features. =20 diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index 3b37e4456482bc284b8e867c1c5b6255fc6c8ef2..0c30ffb6091a15d81f4dc959dfd= 28417249d3dda 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -9,10 +9,13 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt =20 #include +#include #include #include +#include #include #include +#include #include #include "alienware-wmi.h" =20 @@ -25,6 +28,7 @@ #define WMAX_METHOD_BRIGHTNESS 0x3 #define WMAX_METHOD_ZONE_CONTROL 0x4 =20 +#define AWCC_METHOD_GET_FAN_SENSORS 0x13 #define AWCC_METHOD_THERMAL_INFORMATION 0x14 #define AWCC_METHOD_THERMAL_CONTROL 0x15 #define AWCC_METHOD_GAME_SHIFT_STATUS 0x25 @@ -38,6 +42,12 @@ =20 /* Arbitrary limit based on supported models */ #define AWCC_MAX_RES_COUNT 16 +#define AWCC_ID_BITMAP_SIZE (U8_MAX + 1) +#define AWCC_ID_BITMAP_LONGS BITS_TO_LONGS(AWCC_ID_BITMAP_SIZE) + +static bool force_hwmon; +module_param_unsafe(force_hwmon, bool, 0); +MODULE_PARM_DESC(force_hwmon, "Force probing for HWMON support without che= cking if the WMI backend is available"); =20 static bool force_platform_profile; module_param_unsafe(force_platform_profile, bool, 0); @@ -48,16 +58,19 @@ module_param_unsafe(force_gmode, bool, 0); MODULE_PARM_DESC(force_gmode, "Forces G-Mode when performance profile is s= elected"); =20 struct awcc_quirks { + bool hwmon; bool pprof; bool gmode; }; =20 static struct awcc_quirks g_series_quirks =3D { + .hwmon =3D true, .pprof =3D true, .gmode =3D true, }; =20 static struct awcc_quirks generic_quirks =3D { + .hwmon =3D true, .pprof =3D true, .gmode =3D false, }; @@ -155,9 +168,18 @@ static const struct dmi_system_id awcc_dmi_table[] __i= nitconst =3D { }, }; =20 +enum AWCC_GET_FAN_SENSORS_OPERATIONS { + AWCC_OP_GET_TOTAL_FAN_TEMPS =3D 0x01, + AWCC_OP_GET_FAN_TEMP_ID =3D 0x02, +}; + enum AWCC_THERMAL_INFORMATION_OPERATIONS { AWCC_OP_GET_SYSTEM_DESCRIPTION =3D 0x02, AWCC_OP_GET_RESOURCE_ID =3D 0x03, + AWCC_OP_GET_TEMPERATURE =3D 0x04, + AWCC_OP_GET_FAN_RPM =3D 0x05, + AWCC_OP_GET_FAN_MIN_RPM =3D 0x08, + AWCC_OP_GET_FAN_MAX_RPM =3D 0x09, AWCC_OP_GET_CURRENT_PROFILE =3D 0x0B, }; =20 @@ -180,6 +202,11 @@ enum AWCC_SPECIAL_THERMAL_CODES { AWCC_SPECIAL_PROFILE_GMODE =3D 0xAB, }; =20 +enum AWCC_TEMP_SENSOR_TYPES { + AWCC_TEMP_SENSOR_CPU =3D 0x01, + AWCC_TEMP_SENSOR_GPU =3D 0x06, +}; + enum awcc_thermal_profile { AWCC_PROFILE_USTT_BALANCED, AWCC_PROFILE_USTT_BALANCED_PERFORMANCE, @@ -216,6 +243,14 @@ struct wmax_u32_args { u8 arg3; }; =20 +struct awcc_fan_data { + unsigned long auto_channels_temp; + const char *label; + u32 min_rpm; + u32 max_rpm; + u8 id; +}; + struct awcc_priv { struct wmi_device *wdev; union { @@ -231,6 +266,10 @@ struct awcc_priv { =20 struct device *ppdev; u8 supported_profiles[PLATFORM_PROFILE_LAST]; + + struct device *hwdev; + struct awcc_fan_data **fan_data; + unsigned long temp_sensors[AWCC_ID_BITMAP_LONGS]; }; =20 static const enum platform_profile_option awcc_mode_to_platform_profile[AW= CC_PROFILE_LAST] =3D { @@ -495,6 +534,19 @@ static int __awcc_wmi_command(struct wmi_device *wdev,= u32 method_id, return 0; } =20 +static inline int awcc_get_fan_sensors(struct wmi_device *wdev, u8 operati= on, + u8 fan_id, u8 index, u32 *out) +{ + struct wmax_u32_args args =3D { + .operation =3D operation, + .arg1 =3D fan_id, + .arg2 =3D index, + .arg3 =3D 0, + }; + + return __awcc_wmi_command(wdev, AWCC_METHOD_GET_FAN_SENSORS, &args, out); +} + static inline int awcc_thermal_information(struct wmi_device *wdev, u8 ope= ration, u8 arg, u32 *out) { @@ -552,6 +604,30 @@ static inline int awcc_op_get_resource_id(struct wmi_d= evice *wdev, u8 index, u32 return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); } =20 +static inline int awcc_op_get_fan_rpm(struct wmi_device *wdev, u8 fan_id, = u32 *out) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_GET_FAN_RPM, + .arg1 =3D fan_id, + .arg2 =3D 0, + .arg3 =3D 0, + }; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); +} + +static inline int awcc_op_get_temperature(struct wmi_device *wdev, u8 temp= _id, u32 *out) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_GET_TEMPERATURE, + .arg1 =3D temp_id, + .arg2 =3D 0, + .arg3 =3D 0, + }; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); +} + static inline int awcc_op_get_current_profile(struct wmi_device *wdev, u32= *out) { struct wmax_u32_args args =3D { @@ -577,6 +653,313 @@ static inline int awcc_op_activate_profile(struct wmi= _device *wdev, u8 profile) return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_CONTROL, &args, &out); } =20 +/* + * HWMON + * - Provides temperature and fan speed monitoring as well as manual fan + * control + */ +static umode_t awcc_hwmon_is_visible(const void *drvdata, enum hwmon_senso= r_types type, + u32 attr, int channel) +{ + const struct awcc_priv *priv =3D drvdata; + unsigned int temp_count; + + switch (type) { + case hwmon_temp: + temp_count =3D bitmap_weight(priv->temp_sensors, AWCC_ID_BITMAP_SIZE); + + return channel < temp_count ? 0444 : 0; + case hwmon_fan: + return channel < priv->fan_count ? 0444 : 0; + case hwmon_pwm: + return channel < priv->fan_count ? 0444 : 0; + default: + return 0; + } +} + +static int awcc_hwmon_read(struct device *dev, enum hwmon_sensor_types typ= e, + u32 attr, int channel, long *val) +{ + struct awcc_priv *priv =3D dev_get_drvdata(dev); + const struct awcc_fan_data *fan; + u32 state; + int ret; + u8 temp; + + switch (type) { + case hwmon_temp: + temp =3D find_nth_bit(priv->temp_sensors, AWCC_ID_BITMAP_SIZE, channel); + + switch (attr) { + case hwmon_temp_input: + ret =3D awcc_op_get_temperature(priv->wdev, temp, &state); + if (ret) + return ret; + + *val =3D state * MILLIDEGREE_PER_DEGREE; + break; + default: + return -EOPNOTSUPP; + } + + break; + case hwmon_fan: + fan =3D priv->fan_data[channel]; + + switch (attr) { + case hwmon_fan_input: + ret =3D awcc_op_get_fan_rpm(priv->wdev, fan->id, &state); + if (ret) + return ret; + + *val =3D state; + break; + case hwmon_fan_min: + *val =3D fan->min_rpm; + break; + case hwmon_fan_max: + *val =3D fan->max_rpm; + break; + default: + return -EOPNOTSUPP; + } + + break; + case hwmon_pwm: + fan =3D priv->fan_data[channel]; + + switch (attr) { + case hwmon_pwm_auto_channels_temp: + *val =3D fan->auto_channels_temp; + break; + default: + return -EOPNOTSUPP; + } + + break; + default: + return -EOPNOTSUPP; + } + + return 0; +} + +static int awcc_hwmon_read_string(struct device *dev, enum hwmon_sensor_ty= pes type, + u32 attr, int channel, const char **str) +{ + struct awcc_priv *priv =3D dev_get_drvdata(dev); + u8 temp; + + switch (type) { + case hwmon_temp: + temp =3D find_nth_bit(priv->temp_sensors, AWCC_ID_BITMAP_SIZE, channel); + + switch (temp) { + case AWCC_TEMP_SENSOR_CPU: + *str =3D "CPU"; + break; + case AWCC_TEMP_SENSOR_GPU: + *str =3D "GPU"; + break; + default: + *str =3D "Unknown"; + break; + } + + break; + case hwmon_fan: + *str =3D priv->fan_data[channel]->label; + break; + default: + return -EOPNOTSUPP; + } + + return 0; +} + +static const struct hwmon_ops awcc_hwmon_ops =3D { + .is_visible =3D awcc_hwmon_is_visible, + .read =3D awcc_hwmon_read, + .read_string =3D awcc_hwmon_read_string, +}; + +static const struct hwmon_channel_info * const awcc_hwmon_info[] =3D { + HWMON_CHANNEL_INFO(temp, + HWMON_T_LABEL | HWMON_T_INPUT, + HWMON_T_LABEL | HWMON_T_INPUT, + HWMON_T_LABEL | HWMON_T_INPUT, + HWMON_T_LABEL | HWMON_T_INPUT, + HWMON_T_LABEL | HWMON_T_INPUT, + HWMON_T_LABEL | HWMON_T_INPUT + ), + HWMON_CHANNEL_INFO(fan, + HWMON_F_LABEL | HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_MAX, + HWMON_F_LABEL | HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_MAX, + HWMON_F_LABEL | HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_MAX, + HWMON_F_LABEL | HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_MAX, + HWMON_F_LABEL | HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_MAX, + HWMON_F_LABEL | HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_MAX + ), + HWMON_CHANNEL_INFO(pwm, + HWMON_PWM_AUTO_CHANNELS_TEMP, + HWMON_PWM_AUTO_CHANNELS_TEMP, + HWMON_PWM_AUTO_CHANNELS_TEMP, + HWMON_PWM_AUTO_CHANNELS_TEMP, + HWMON_PWM_AUTO_CHANNELS_TEMP, + HWMON_PWM_AUTO_CHANNELS_TEMP + ), + NULL +}; + +static const struct hwmon_chip_info awcc_hwmon_chip_info =3D { + .ops =3D &awcc_hwmon_ops, + .info =3D awcc_hwmon_info, +}; + +static int awcc_hwmon_temps_init(struct wmi_device *wdev) +{ + struct awcc_priv *priv =3D dev_get_drvdata(&wdev->dev); + unsigned int i; + int ret; + u32 id; + + for (i =3D 0; i < priv->temp_count; i++) { + /* + * Temperature sensors IDs are listed after the fan IDs at + * offset `fan_count` + */ + ret =3D awcc_op_get_resource_id(wdev, i + priv->fan_count, &id); + if (ret) + return ret; + + __set_bit(FIELD_GET(AWCC_RESOURCE_ID_MASK, id), priv->temp_sensors); + } + + return 0; +} + +static char *awcc_get_fan_label(struct device *dev, u32 temp_count, u8 tem= p_id) +{ + char *label; + + switch (temp_count) { + case 0: + label =3D "Independent Fan"; + break; + case 1: + switch (temp_id) { + case AWCC_TEMP_SENSOR_CPU: + label =3D "Processor Fan"; + break; + case AWCC_TEMP_SENSOR_GPU: + label =3D "Video Fan"; + break; + default: + label =3D "Unknown Fan"; + break; + } + + break; + default: + label =3D "Shared Fan"; + break; + } + + return label; +} + +static int awcc_hwmon_fans_init(struct wmi_device *wdev) +{ + struct awcc_priv *priv =3D dev_get_drvdata(&wdev->dev); + u32 id, min_rpm, max_rpm, temp_count, temp_id; + unsigned long fan_temps[AWCC_ID_BITMAP_LONGS]; + unsigned long gather[AWCC_ID_BITMAP_LONGS]; + struct awcc_fan_data *fan_data; + unsigned int i, j; + char *label; + int ret; + + for (i =3D 0; i < priv->fan_count; i++) { + fan_data =3D devm_kzalloc(&wdev->dev, sizeof(*fan_data), GFP_KERNEL); + if (!fan_data) + return -ENOMEM; + + /* + * Fan IDs are listed first at offset 0 + */ + ret =3D awcc_op_get_resource_id(wdev, i, &id); + if (ret) + return ret; + id =3D FIELD_GET(AWCC_RESOURCE_ID_MASK, id); + + ret =3D awcc_thermal_information(wdev, AWCC_OP_GET_FAN_MIN_RPM, id, + &min_rpm); + if (ret) + return ret; + + ret =3D awcc_thermal_information(wdev, AWCC_OP_GET_FAN_MAX_RPM, id, + &max_rpm); + if (ret) + return ret; + + ret =3D awcc_get_fan_sensors(wdev, AWCC_OP_GET_TOTAL_FAN_TEMPS, id, + 0, &temp_count); + if (ret) + return ret; + + for (j =3D 0; j < temp_count; j++) { + ret =3D awcc_get_fan_sensors(wdev, AWCC_OP_GET_FAN_TEMP_ID, + id, j, &temp_id); + if (ret) + break; + + temp_id =3D FIELD_GET(AWCC_RESOURCE_ID_MASK, temp_id); + __set_bit(temp_id, fan_temps); + } + + label =3D awcc_get_fan_label(&wdev->dev, temp_count, temp_id); + if (!label) + return -ENOMEM; + + fan_data->id =3D id; + fan_data->min_rpm =3D min_rpm; + fan_data->max_rpm =3D max_rpm; + fan_data->label =3D label; + bitmap_gather(gather, fan_temps, priv->temp_sensors, AWCC_ID_BITMAP_SIZE= ); + bitmap_copy(&fan_data->auto_channels_temp, gather, BITS_PER_LONG); + priv->fan_data[i] =3D fan_data; + + bitmap_zero(fan_temps, AWCC_ID_BITMAP_SIZE); + } + + return 0; +} + +static int awcc_hwmon_init(struct wmi_device *wdev) +{ + struct awcc_priv *priv =3D dev_get_drvdata(&wdev->dev); + int ret; + + priv->fan_data =3D devm_kcalloc(&wdev->dev, priv->fan_count, + sizeof(*priv->fan_data), GFP_KERNEL); + if (!priv->fan_data) + return -ENOMEM; + + ret =3D awcc_hwmon_temps_init(wdev); + if (ret) + return ret; + + ret =3D awcc_hwmon_fans_init(wdev); + if (ret) + return ret; + + priv->hwdev =3D devm_hwmon_device_register_with_info(&wdev->dev, "alienwa= re_wmi", priv, + &awcc_hwmon_chip_info, NULL); + + return PTR_ERR_OR_ZERO(priv->hwdev); +} + /* * Thermal Profile control * - Provides thermal profile control through the Platform Profile API @@ -744,6 +1127,12 @@ static int alienware_awcc_setup(struct wmi_device *wd= ev) priv->wdev =3D wdev; dev_set_drvdata(&wdev->dev, priv); =20 + if (awcc->hwmon) { + ret =3D awcc_hwmon_init(wdev); + if (ret) + return ret; + } + if (awcc->pprof) { ret =3D awcc_platform_profile_init(wdev); if (ret) @@ -824,6 +1213,13 @@ int __init alienware_wmax_wmi_init(void) if (id) awcc =3D id->driver_data; =20 + if (force_hwmon) { + if (!awcc) + awcc =3D &empty_quirks; + + awcc->hwmon =3D true; + } + if (force_platform_profile) { if (!awcc) awcc =3D &empty_quirks; --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35F211E5B7A; Wed, 12 Mar 2025 05:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756340; cv=none; b=WhFM3rQdQMCNPhdleVzSdyf+fVsFWzXLpBbPKB1NlA2IjJlvUbyZa6icPLq2F0SUXhIXRHJKzEDQ/yEb8oSowjMiNwrLNJtxQEWteJgpnuMcvTrLHWajCrlWIbNnCx831WgeX8TXbTaIdkj8iJqNnj0lh3cx49xkwWsFa4uX+qc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756340; c=relaxed/simple; bh=oaPXgZuxQdnVVxiKRB7aZ23bK6tGn8BzFWpnsqYDtew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SLG8H3Ww5BC2yYRoN+20z2Zh++23jOounRPdGWzTeqQkwUqFIHvowzafB681tIxH45iaD/Ya8oJNVU0XB2qB/R1c7xwT6/0t8uC/Ms9ep2eLFywsGle7nsvew3o+8feTmP66EEE2IIdotiUIdUrJ8lJHuMxT5BCgpKkR4KbSbrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FWvcxrs4; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FWvcxrs4" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6f7031ea11cso64946427b3.2; Tue, 11 Mar 2025 22:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756336; x=1742361136; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RJXdYgpnaSANjr6mjP2NezwhNSkQ+3v2rcj0Q2SIosY=; b=FWvcxrs4rMeAwG3PV55b4MlxR1o0EoCCg4vfYR2gaiPTgZX1xveEYZBK8lvnJPmM47 W2xq1qbc5m76zj2/HrxFyNNaqfGm0+6rkkuHUVvKNg5gFNG/Qtfr6N0n4u6nPpKIXuxD Kt+LO+o7tY65jFnQArWa9z/xLUSEVFVlPD7qmdeyg059c583fuV+xwcpF31DofyzGOCs +3pyyfibvVTkT8+VX1eKcA/YqQvO8FvBm/2f81H5ixAOk/MLj6iwrnTRsSTcvOBBsNF5 S/qr0ZCjx0kn+D36UvGJcJ/jjc2FQgaA7HLmcOx8jFMP7N6KsEvXK/19bsH0B78dkTyn 8tmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756336; x=1742361136; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RJXdYgpnaSANjr6mjP2NezwhNSkQ+3v2rcj0Q2SIosY=; b=qfM5/BKH0Ms6t6gGVK+Q84hBsOSPgEv3oWMWezlqjV0xeGaoN6hHCZC4d/ElzboCMZ fKzlZQWPRwDTIvMJEYKWWtF8O7GtNOoRD4hDMLPYdfYFlLNQ5ULzBL0nNju+gwdNJh3a 9nSi0X77h1uVORwh/Uy2PVqohhkqCoBj4g3horcHVXihTCRruadX8m8d5WhyTh0x1s22 yJ4xoKMdENtut5Xp/60BHWxS4B7NRduZjUpKHpfy4ijZL46Vh9RjBkt5N0Vb2AOgW6Gi LKz6WRZOpUaNc1+DkwrHTJ8ATcsPXJFCGcrt59UQXQ2d94v3dbY2X4u4kh7kNLvPQx+g KfDw== X-Forwarded-Encrypted: i=1; AJvYcCUoxg+mrJeaP+1am6/gKeAM/u+bVR/e3Tx2MigtTEOxDbjOkYUPzhWExkbCy+vjekICtDlZ0qSj88s2CKwK@vger.kernel.org, AJvYcCVtxbok/7nVphwHQAeFLU2fYAl3IpLrttBwcQ9E9zjRHUqZBTyQWZZC75gnJJYJtS99NKwV/5a7PuiNdA==@vger.kernel.org, AJvYcCWKFMQCcsWgTER8c5gsam+zrSXQVqDap6zbalJjCkQTrb3l//V4hjUaAinSxOlrEWcj4lp6i6yEeI7x6S831uRKBWS/5g==@vger.kernel.org X-Gm-Message-State: AOJu0YyOqP9Kh4AhsfIljhLNiLvMuzo1Yp9yzFG7kDtYgnZt5kSbRQDZ /8ib5MMm/nkTucUomMKM19ufQTQIZg0WHIgApjLOhcB3r3yaXa7OF/uJts+s X-Gm-Gg: ASbGncvQJGt4/jATa5Fxnv2AwiixpsT8z9uwhco3+4a+2AsC9xwCkHJ7hmFnZ0iKFE2 RyDXrI2MFh2Q95fGnBjTyPXFl8+UZCFgvp5bBOA82TI6ezNK/ryYcDuspUciWN/COFyFLglZfog Uonaj+adY0oT/vSo/nxT4Icwdd1G+bh+kDwWWm5YIkQo+kQTVK/qgqCBDJXr4aXXHCXIiZByVI6 zuTlDDVyDx7COSjyMA7UZkz0XJDtfUSjGofdb0YJHJGJxAMwAXPkWu6+9Q5u1JfshySig9Vkm7Z xkdiq+OQMfppThN/UTLu6tQrCVs8rSDV2rJRgABB3bG+yQ== X-Google-Smtp-Source: AGHT+IFxxLr6102fRp8Rlj+gTdwAAvhzpikKt4ybQE3TM6C+D+k3sIKVuQPucmu4mSpUoMY0wQU7SQ== X-Received: by 2002:a05:690c:6f84:b0:6fb:9786:5871 with SMTP id 00721157ae682-6febf292ca7mr271938667b3.7.1741756336630; Tue, 11 Mar 2025 22:12:16 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:15 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:21 -0500 Subject: [PATCH v5 08/12] platform/x86: alienware-wmi-wmax: Add support for manual fan control 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 Message-Id: <20250312-hwm-v5-8-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, Guenter Roeck , Jean Delvare , linux-hwmon@vger.kernel.org X-Mailer: b4 0.14.2 All models with the "AWCC" WMAX device support a way of manually controlling fans. The PWM duty cycle of a fan can't be controlled directly. Instead the AWCC interface let's us tune a fan `boost` value, which has the following empirically discovered, aproximate behavior over the PWM value: pwm =3D pwm_base + (fan_boost / 255) * (pwm_max - pwm_base) Where the pwm_base is the locked PWM value controlled by the FW and fan_boost is a value between 0 and 255. Expose this fan_boost knob as a custom HWMON attribute. Cc: Guenter Roeck Cc: Jean Delvare Cc: linux-hwmon@vger.kernel.org Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 174 +++++++++++++++++++++= +++- 1 file changed, 172 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index 0c30ffb6091a15d81f4dc959dfd28417249d3dda..bc15f78054f3c87148b8729d6ae= 471cdbb36a940 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -13,8 +13,12 @@ #include #include #include +#include +#include +#include #include #include +#include #include #include #include "alienware-wmi.h" @@ -181,10 +185,12 @@ enum AWCC_THERMAL_INFORMATION_OPERATIONS { AWCC_OP_GET_FAN_MIN_RPM =3D 0x08, AWCC_OP_GET_FAN_MAX_RPM =3D 0x09, AWCC_OP_GET_CURRENT_PROFILE =3D 0x0B, + AWCC_OP_GET_FAN_BOOST =3D 0x0C, }; =20 enum AWCC_THERMAL_CONTROL_OPERATIONS { AWCC_OP_ACTIVATE_PROFILE =3D 0x01, + AWCC_OP_SET_FAN_BOOST =3D 0x02, }; =20 enum AWCC_GAME_SHIFT_STATUS_OPERATIONS { @@ -248,6 +254,7 @@ struct awcc_fan_data { const char *label; u32 min_rpm; u32 max_rpm; + u8 suspend_cache; u8 id; }; =20 @@ -628,6 +635,18 @@ static inline int awcc_op_get_temperature(struct wmi_d= evice *wdev, u8 temp_id, u return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); } =20 +static inline int awcc_op_get_fan_boost(struct wmi_device *wdev, u8 fan_id= , u32 *out) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_GET_FAN_BOOST, + .arg1 =3D fan_id, + .arg2 =3D 0, + .arg3 =3D 0, + }; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_INFORMATION, &args, o= ut); +} + static inline int awcc_op_get_current_profile(struct wmi_device *wdev, u32= *out) { struct wmax_u32_args args =3D { @@ -653,6 +672,19 @@ static inline int awcc_op_activate_profile(struct wmi_= device *wdev, u8 profile) return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_CONTROL, &args, &out); } =20 +static inline int awcc_op_set_fan_boost(struct wmi_device *wdev, u8 fan_id= , u8 boost) +{ + struct wmax_u32_args args =3D { + .operation =3D AWCC_OP_SET_FAN_BOOST, + .arg1 =3D fan_id, + .arg2 =3D boost, + .arg3 =3D 0, + }; + u32 out; + + return __awcc_wmi_command(wdev, AWCC_METHOD_THERMAL_CONTROL, &args, &out); +} + /* * HWMON * - Provides temperature and fan speed monitoring as well as manual fan @@ -817,6 +849,81 @@ static const struct hwmon_chip_info awcc_hwmon_chip_in= fo =3D { .info =3D awcc_hwmon_info, }; =20 +static ssize_t fan_boost_show(struct device *dev, struct device_attribute = *attr, + char *buf) +{ + struct awcc_priv *priv =3D dev_get_drvdata(dev); + int index =3D to_sensor_dev_attr(attr)->index; + struct awcc_fan_data *fan =3D priv->fan_data[index]; + u32 boost; + int ret; + + ret =3D awcc_op_get_fan_boost(priv->wdev, fan->id, &boost); + if (ret) + return ret; + + return sysfs_emit(buf, "%u\n", boost); +} + +static ssize_t fan_boost_store(struct device *dev, struct device_attribute= *attr, + const char *buf, size_t count) +{ + struct awcc_priv *priv =3D dev_get_drvdata(dev); + int index =3D to_sensor_dev_attr(attr)->index; + struct awcc_fan_data *fan =3D priv->fan_data[index]; + unsigned long val; + int ret; + + ret =3D kstrtoul(buf, 0, &val); + if (ret) + return ret; + + ret =3D awcc_op_set_fan_boost(priv->wdev, fan->id, clamp_val(val, 0, 255)= ); + + return ret ? ret : count; +} + +static SENSOR_DEVICE_ATTR_RW(fan1_boost, fan_boost, 0); +static SENSOR_DEVICE_ATTR_RW(fan2_boost, fan_boost, 1); +static SENSOR_DEVICE_ATTR_RW(fan3_boost, fan_boost, 2); +static SENSOR_DEVICE_ATTR_RW(fan4_boost, fan_boost, 3); +static SENSOR_DEVICE_ATTR_RW(fan5_boost, fan_boost, 4); +static SENSOR_DEVICE_ATTR_RW(fan6_boost, fan_boost, 5); + +static umode_t fan_boost_attr_visible(struct kobject *kobj, struct attribu= te *attr, int n) +{ + struct awcc_priv *priv =3D dev_get_drvdata(kobj_to_dev(kobj)); + + return n < priv->fan_count ? attr->mode : 0; +} + +static bool fan_boost_group_visible(struct kobject *kobj) +{ + return true; +} + +DEFINE_SYSFS_GROUP_VISIBLE(fan_boost); + +static struct attribute *fan_boost_attrs[] =3D { + &sensor_dev_attr_fan1_boost.dev_attr.attr, + &sensor_dev_attr_fan2_boost.dev_attr.attr, + &sensor_dev_attr_fan3_boost.dev_attr.attr, + &sensor_dev_attr_fan4_boost.dev_attr.attr, + &sensor_dev_attr_fan5_boost.dev_attr.attr, + &sensor_dev_attr_fan6_boost.dev_attr.attr, + NULL +}; + +static const struct attribute_group fan_boost_group =3D { + .attrs =3D fan_boost_attrs, + .is_visible =3D SYSFS_GROUP_VISIBLE(fan_boost), +}; + +static const struct attribute_group *awcc_hwmon_groups[] =3D { + &fan_boost_group, + NULL +}; + static int awcc_hwmon_temps_init(struct wmi_device *wdev) { struct awcc_priv *priv =3D dev_get_drvdata(&wdev->dev); @@ -954,12 +1061,56 @@ static int awcc_hwmon_init(struct wmi_device *wdev) if (ret) return ret; =20 - priv->hwdev =3D devm_hwmon_device_register_with_info(&wdev->dev, "alienwa= re_wmi", priv, - &awcc_hwmon_chip_info, NULL); + priv->hwdev =3D devm_hwmon_device_register_with_info(&wdev->dev, "alienwa= re_wmi", + priv, &awcc_hwmon_chip_info, + awcc_hwmon_groups); =20 return PTR_ERR_OR_ZERO(priv->hwdev); } =20 +static void awcc_hwmon_suspend(struct device *dev) +{ + struct awcc_priv *priv =3D dev_get_drvdata(dev); + struct awcc_fan_data *fan; + unsigned int i; + u32 boost; + int ret; + + for (i =3D 0; i < priv->fan_count; i++) { + fan =3D priv->fan_data[i]; + + ret =3D awcc_thermal_information(priv->wdev, AWCC_OP_GET_FAN_BOOST, + fan->id, &boost); + if (ret) + dev_err(dev, "Failed to store Fan %u boost while suspending\n", i); + + fan->suspend_cache =3D ret ? 0 : clamp_val(boost, 0, 255); + + awcc_op_set_fan_boost(priv->wdev, fan->id, 0); + if (ret) + dev_err(dev, "Failed to set Fan %u boost to 0 while suspending\n", i); + } +} + +static void awcc_hwmon_resume(struct device *dev) +{ + struct awcc_priv *priv =3D dev_get_drvdata(dev); + struct awcc_fan_data *fan; + unsigned int i; + int ret; + + for (i =3D 0; i < priv->fan_count; i++) { + fan =3D priv->fan_data[i]; + + if (!fan->suspend_cache) + continue; + + ret =3D awcc_op_set_fan_boost(priv->wdev, fan->id, fan->suspend_cache); + if (ret) + dev_err(dev, "Failed to restore Fan %u boost while resuming\n", i); + } +} + /* * Thermal Profile control * - Provides thermal profile control through the Platform Profile API @@ -1189,6 +1340,24 @@ static int wmax_wmi_probe(struct wmi_device *wdev, c= onst void *context) return ret; } =20 +static int wmax_wmi_suspend(struct device *dev) +{ + if (awcc->hwmon) + awcc_hwmon_suspend(dev); + + return 0; +} + +static int wmax_wmi_resume(struct device *dev) +{ + if (awcc->hwmon) + awcc_hwmon_resume(dev); + + return 0; +} + +DEFINE_SIMPLE_DEV_PM_OPS(wmax_wmi_pm_ops, wmax_wmi_suspend, wmax_wmi_resum= e); + static const struct wmi_device_id alienware_wmax_device_id_table[] =3D { { WMAX_CONTROL_GUID, NULL }, { }, @@ -1199,6 +1368,7 @@ static struct wmi_driver alienware_wmax_wmi_driver = =3D { .driver =3D { .name =3D "alienware-wmi-wmax", .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, + .pm =3D pm_sleep_ptr(&wmax_wmi_pm_ops), }, .id_table =3D alienware_wmax_device_id_table, .probe =3D wmax_wmi_probe, --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5430F1E9B3D; Wed, 12 Mar 2025 05:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756342; cv=none; b=kSGzyzJQx6WVeSleB2lrG051XhzBWsFen615/IvCXZ7cRWeEbMLxZmFS66UVsL3KNW7nQEmr1p590Z5O5k3qlnLd679OMF49ESV9Q8ZtpzDTB8LwcE1h4YDplcWnQoKtE8gpHb0sPDbOipp1Bg8W6fscU6c0MgxJsNvpT7wbA3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756342; c=relaxed/simple; bh=dHuXujcVSt1ISFTA0cys14pup7MMvnU5i4aKzf2dcw8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N2sp7nbCJaGYinKyzyl0suomagNtd1gQ663OdJHDM3IPZzptGCuT9zSt6/AxDrOSwGrSsOX9SziUjYJY6TBKjpU6M4aeAGiDXrLWijWRZ7PsAiMYgbU1Xrd9gsJUs5Gt9HEabC8sBR7KSKOd17vn5zhLKI8gCXxyqyX+gA8RmGk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HMr+1mgC; arc=none smtp.client-ip=209.85.128.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HMr+1mgC" Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-6f74b78df93so60013637b3.0; Tue, 11 Mar 2025 22:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756339; x=1742361139; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qyyMMDT9jY3GwgMomKZZLoHQgXtzrxyYgo+dpoCdkj0=; b=HMr+1mgCw80c7EH7jPavLErRbUkN6qjgZT77GMwNtwd2IPZHu4d/WDFtFdHsF/zKOp 8nnbHhvMIV/LEdK3sMRXWwFizzX+lt4XhGHdlgU8kmfV4Imra1YkKwqnaic0uDGAkuNA 31TpKJ+8OTgN/zB0Tq5e7TRIiNHb9zuZcP0eR7cArSbxG2hGRXv58WLbu0mpCiMK7og7 154EpA/b89Zcw1NqJpYNd7R4qfquMdIFYIOQlI3aFqvuffK9Y2hi3n80nMI04L9rPVEx OY2eCGdRFfdf00fV5ytVi+MO4+fAd+eVVgYD8tMTDR5C6CqKh3j2RpTUGzfjTorntTf0 JBZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756339; x=1742361139; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qyyMMDT9jY3GwgMomKZZLoHQgXtzrxyYgo+dpoCdkj0=; b=eRkg+4ltVMj07MiRxOGQSfukIbr5i9oM72ndoYQSEsAuGyqnhvHgOoIIIxIlHIbHHp bIycpVHCMMA5/FXiJQHTBMfcHqOqLKyyRHdHb+7mux9VYMrckbCZhHcwMueJob7zFPLo y9xQrKAD/Bq2wg23aTBK2Hfpw0s9ne/Y7F26FqOp/uf7o+VeLZBQ16S/WCQqDC/SsEh2 wBjT95CyiNGHQawaCSq85ho2IOrAlQ7MVgBTfHKj8bZBiZ4B1weZJyU8O0bgb5/3ALPj 6xJupw3eB1KbxIEJsZNGR9x0vzUbWQv7r33V8nZIgHIZpLa9qpnBdGybaG9KK/Bk5bv4 COxw== X-Forwarded-Encrypted: i=1; AJvYcCX33qc8aQuGVr40D8AqfMsz2gxvgglCmuOeFjyrBqIEzawPwd/5Odazsq//EBVNTJ9woGHt/ff9YbiO8Pg=@vger.kernel.org, AJvYcCXsPMAdaDKGguVcZsJwWJIhyB0mPvf9YAEUcviF1bmVgGuQiDpv+FSDlECd13b4MaIenavNTD7AgDYVx17yIle/KWpYVw==@vger.kernel.org X-Gm-Message-State: AOJu0Yz8jc9qvO2Ymrz0u9w8Y0JN4hOx9TSUq4jmSOSzNfQqWaA4UeoZ slTUUTNTl4P3iTMWnVInaXu/Zkax104rT0Cc44L/BZMX2ULgFf7gDvm0JJ1S X-Gm-Gg: ASbGncvAjFDTaZiQRiYox/BFm5Tijf22hspky0juPsvVh21UBVgV9wL/3uPGcfQldO0 5CHutgb7QUa6UEgzNDE6FQTNqSKWITCVxbdUvHPSRQZzszOAkpZChQkkUpX5ZxlxKris7Yx51vw NYiHK+jMa9DYFUX902nu+w7ZbMY7o3Gq8oPP/zV4hoG+3bCZASWf8q5vQK0P2JmcJVJxaZ4In00 f7kMi66CPpEFqjDkVTyPDVOQN6o0GQvtv4CpqdgrXNBUlM8Kw/YVLGDcAU++pplgERlXuKFaUKm oSxmiqHFkfUWCM3zumwbeBRhp/Lfwhy/bPJAh/nLIfftRg== X-Google-Smtp-Source: AGHT+IG5ckgeFhRxiTcewwcfIfkwkTt9CJpTFF1HJ6yB7pNYBlYSlTaJXrmmbsE03/0Ut/06cYGaqA== X-Received: by 2002:a05:690c:23c1:b0:6fd:2feb:eb6e with SMTP id 00721157ae682-6febf387345mr269399407b3.28.1741756338962; Tue, 11 Mar 2025 22:12:18 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:18 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:22 -0500 Subject: [PATCH v5 09/12] platform/x86: alienware-wmi-wmax: Add a DebugFS interface 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 Message-Id: <20250312-hwm-v5-9-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Add a debugfs interface which exposes thermal private data. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-wmax.c | 90 ++++++++++++++++++++++= ++++ 1 file changed, 90 insertions(+) diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platf= orm/x86/dell/alienware-wmi-wmax.c index bc15f78054f3c87148b8729d6ae471cdbb36a940..e89dc1389a383fd7d20b0a46e56= b3a324c3e63d8 100644 --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include "alienware-wmi.h" @@ -1252,6 +1254,92 @@ static int awcc_platform_profile_init(struct wmi_dev= ice *wdev) return PTR_ERR_OR_ZERO(priv->ppdev); } =20 +/* + * DebugFS + */ +static int awcc_debugfs_system_description_read(struct seq_file *seq, void= *data) +{ + struct device *dev =3D seq->private; + struct awcc_priv *priv =3D dev_get_drvdata(dev); + + seq_printf(seq, "0x%08x\n", priv->system_description); + + return 0; +} + +static int awcc_debugfs_hwmon_data_read(struct seq_file *seq, void *data) +{ + struct device *dev =3D seq->private; + struct awcc_priv *priv =3D dev_get_drvdata(dev); + const struct awcc_fan_data *fan; + unsigned int bit; + + seq_printf(seq, "Number of fans: %u\n", priv->fan_count); + seq_printf(seq, "Number of temperature sensors: %u\n\n", priv->temp_count= ); + + for (u32 i =3D 0; i < priv->fan_count; i++) { + fan =3D priv->fan_data[i]; + + seq_printf(seq, "Fan %u:\n", i); + seq_printf(seq, " ID: 0x%02x\n", fan->id); + seq_printf(seq, " Related temperature sensors bitmap: %lu\n", + fan->auto_channels_temp); + } + + seq_puts(seq, "\nTemperature sensor IDs:\n"); + for_each_set_bit(bit, priv->temp_sensors, AWCC_ID_BITMAP_SIZE) + seq_printf(seq, " 0x%02x\n", bit); + + return 0; +} + +static int awcc_debugfs_pprof_data_read(struct seq_file *seq, void *data) +{ + struct device *dev =3D seq->private; + struct awcc_priv *priv =3D dev_get_drvdata(dev); + + seq_printf(seq, "Number of thermal profiles: %u\n\n", priv->profile_count= ); + + for (u32 i =3D 0; i < PLATFORM_PROFILE_LAST; i++) { + if (!priv->supported_profiles[i]) + continue; + + seq_printf(seq, "Platform profile %u:\n", i); + seq_printf(seq, " ID: 0x%02x\n", priv->supported_profiles[i]); + } + + return 0; +} + +static void awcc_debugfs_remove(void *data) +{ + struct dentry *root =3D data; + + debugfs_remove(root); +} + +static void awcc_debugfs_init(struct wmi_device *wdev) +{ + struct dentry *root; + char name[64]; + + scnprintf(name, ARRAY_SIZE(name), "%s-%s", "alienware-wmi", dev_name(&wde= v->dev)); + root =3D debugfs_create_dir(name, NULL); + + debugfs_create_devm_seqfile(&wdev->dev, "system_description", root, + awcc_debugfs_system_description_read); + + if (awcc->hwmon) + debugfs_create_devm_seqfile(&wdev->dev, "hwmon_data", root, + awcc_debugfs_hwmon_data_read); + + if (awcc->pprof) + debugfs_create_devm_seqfile(&wdev->dev, "pprof_data", root, + awcc_debugfs_pprof_data_read); + + devm_add_action_or_reset(&wdev->dev, awcc_debugfs_remove, root); +} + static int alienware_awcc_setup(struct wmi_device *wdev) { struct awcc_priv *priv; @@ -1290,6 +1378,8 @@ static int alienware_awcc_setup(struct wmi_device *wd= ev) return ret; } =20 + awcc_debugfs_init(wdev); + return 0; } =20 --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66C9A1EB192; Wed, 12 Mar 2025 05:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756344; cv=none; b=DsyE/5kS98+A9rjIN38lxm7Y/xWo/lWwUTGWWyFLFXBgmoQSW2YCxYWzeQPbMW0U+bFf6W3fbErTbUOISIyN2FtBu303bVMgSxkfN3Ymm67o61EfibbqQr/lgvBEKhrLSYr7C/ztajVH6QJzvH3aEZO/GJS/OTlWC8U6JvZk/Os= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756344; c=relaxed/simple; bh=7xu59QVIatBVpYJa1Dkam5LKCr4ecNWmwMnn1XOpgxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mq4OYsnNgORU0yTfaOt6YArR9xZZs4XnlT9DjI0RMvCCx8UpriHPClNYoecQaR4QQGZsJ9nXAXQF8iFsehw8HS13ZY34yHVmmrxYVo0cz7kipltwWTZbrLBruYdqeiYGiH6RVPoljZAooEBFzzI7Lk7nqaNVnxZ5K0zwyecpePU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A/3RMF9w; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A/3RMF9w" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6ff0c9d1761so14754907b3.1; Tue, 11 Mar 2025 22:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756341; x=1742361141; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2yxTxBzVJ1jb8Memke4DOGdfoivqF5ZiHtqL+IiDifo=; b=A/3RMF9wuVq5bnb5Z1Rxt8EzI3kzoxum/N0DTeQterLBzeMKjwoBd6U9SjgjFUhMyv 2zMyPOVufI+z828WI9V089tlyS/9xFdV74zIuYylBQVlN4xhCYHFlY4VOtYjclMuMeE4 jf2udBNJe2dwjzrgpqKYG1FJu2CrX3Vn+ykDPC0MRkG7KYjsBs3svshKPhgBp2qF/J9O aDfSY6hT+ZdBUJoxG8omCfBP4D6jVVpcnmiREuM4OsumwA4u/4DP80aG1SlfEsQVdeza NJ6ShBct7Le5/jiZK2p1NRWyR0ecSyhcKXv7jpS25Q4Q0BuRqVsApP6m8duEctVaQA0c T5JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756341; x=1742361141; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2yxTxBzVJ1jb8Memke4DOGdfoivqF5ZiHtqL+IiDifo=; b=FP2tmNY6DKZdP51XWRPlSycPIZXuYqYOXOkLZX588WznXFAZjG8P9db/LCG2Uq1G+X ssnDq1cuZOkFC0bp0fWy7mBA2FJOzcN0K2ZN+Nh/pHoxz7aCDSYAWMIq2XjCUQ/bR3e0 kaOYMChByLQI8Fty1vY1xuIPJjhernoclTYdxGYhm3jF+CCHu0o6rwbJcJiL1XcmcDRf oheriJVmTJhkwkZmfQEudmuMnagl5CwNl8mKrJ9JNhU3JzUFOKF9RnYFdTsR37hWmdiU 3Jx+HBXWCWpa2tMX0O2EHAdO3+v15SyVi3u1QbAdaQdGOK6BE+DKYr+pp2Q7jf5bw3AY nIWw== X-Forwarded-Encrypted: i=1; AJvYcCVVFmgHj2NkYFdf8NyH+xDB03xvSQMD1OtwZ26EtAPYOv0xJ3VnkBukngtPzBAdp0AQDf8qqYi8K5yK8D0oxr0PcMx8IA==@vger.kernel.org, AJvYcCXU92BSTeAyv3CsaZdb3q3JcBlAB2UKUGhkBRkji9RzTOGuYoFBYcu1zUn8lfhskcy70Jr0FyGVnPnkUlc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2Q6QZ3W3vRXw7GZ3I8sk61DO/qP36XvDxBTQnqPCMmUDCnR+G uSgXJx1K4/GeJOHiDIR70STjRl4h7gl4TAPsU1osybx6OqivgAdGNNglzdPM X-Gm-Gg: ASbGncvREIyEMzS1tc0hHzJpWcsxmcYNHypba1dad5fDExD2ZvsrQPwL1RqsfDK0MTh W1AzOAvp9qU69u70kzvktoNxWCBYWI2blVPcrhLvqTEAJwb003lPFFhM9ylXeb98gHGtX+XnL9C PiVWE3E7kpLclDXlbReZ8Rz1M9w+3XNicQz1fisC3hAfUYaZWU/rSgxnqXvqPG9ewVWBB6JqX2l xn9pdBbzeHBN1o/UUCVtQgKIMGuGUFe0062BMD+c61I02Yqg/VWdQvvaBneT8PKAVAGvUwG6BFK Z0CqCyrc4e36hEx3ABjSPNcevqNDhDUQqs83fYfwtjsTQA== X-Google-Smtp-Source: AGHT+IEqoBvmM4rtyDTKLfPpo/n2yAeR5K7oRtFtSOWu9UXDemUQxHBWDKopigZ6d22xB+y3Vu6y6A== X-Received: by 2002:a05:690c:6c02:b0:6f9:50aa:8605 with SMTP id 00721157ae682-6febf3e1a06mr270428087b3.34.1741756340969; Tue, 11 Mar 2025 22:12:20 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:20 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:23 -0500 Subject: [PATCH v5 10/12] Documentation: wmi: Improve and update alienware-wmi documentation 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 Message-Id: <20250312-hwm-v5-10-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, Bagas Sanjaya X-Mailer: b4 0.14.2 Use tables to describe method operations instead of using pseudo-code. Drop unknown method descriptions to avoid redundancy. Drop GPIO section as it is currently irrelevant to this driver. Update Thermal_Information method documentation. Add one more helpful developer to the kudos section. Reviewed-by: Armin Wolf Reviewed-by: Bagas Sanjaya Signed-off-by: Kurt Borja --- Documentation/wmi/devices/alienware-wmi.rst | 383 +++++++++---------------= ---- 1 file changed, 117 insertions(+), 266 deletions(-) diff --git a/Documentation/wmi/devices/alienware-wmi.rst b/Documentation/wm= i/devices/alienware-wmi.rst index ddc5e561960e05fc7cffe700d7d278e32ff2e7b2..79238051b18bc5de9b502325017= cd5c5fcf41748 100644 --- a/Documentation/wmi/devices/alienware-wmi.rst +++ b/Documentation/wmi/devices/alienware-wmi.rst @@ -11,7 +11,7 @@ The WMI device WMAX has been implemented for many Alienwa= re and Dell's G-Series models. Throughout these models, two implementations have been identified.= The first one, used by older systems, deals with HDMI, brightness, RGB, amplif= ier and deep sleep control. The second one used by newer systems deals primari= ly -with thermal, overclocking, and GPIO control. +with thermal control and overclocking. =20 It is suspected that the latter is used by Alienware Command Center (AWCC)= to manage manufacturer predefined thermal profiles. The alienware-wmi driver @@ -69,9 +69,6 @@ data using the `bmfdec `_= utility: [WmiMethodId(164), Implemented, read, write, Description("Tobii Camera = Power Off.")] void TobiiCameraPowerOff([out] uint32 argr); }; =20 -Some of these methods get quite intricate so we will describe them using -pseudo-code that vaguely resembles the original ASL code. - Methods not described in the following document have unknown behavior. =20 Argument Structure @@ -87,175 +84,133 @@ ID 0xA0, the argument you would pass to the method is= 0xA001. Thermal Methods =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 +WMI method GetFanSensors([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------- + ++--------------------+------------------------------------+---------------= -----+ +| Operation (Byte 0) | Description | Arguments = | ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+ +| 0x01 | Get the number of temperature | - Byte 1: Fan = ID | +| | sensors related with a fan ID | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x02 | Get the temperature sensor IDs | - Byte 1: Fan = ID | +| | related to a fan sensor ID | - Byte 2: Inde= x | ++--------------------+------------------------------------+---------------= -----+ + WMI method Thermal_Information([in] uint32 arg2, [out] uint32 argr) ------------------------------------------------------------------- =20 -:: - - if BYTE_0(arg2) =3D=3D 0x01: - argr =3D 1 - - if BYTE_0(arg2) =3D=3D 0x02: - argr =3D SYSTEM_DESCRIPTION - - if BYTE_0(arg2) =3D=3D 0x03: - if BYTE_1(arg2) =3D=3D 0x00: - argr =3D FAN_ID_0 - - if BYTE_1(arg2) =3D=3D 0x01: - argr =3D FAN_ID_1 - - if BYTE_1(arg2) =3D=3D 0x02: - argr =3D FAN_ID_2 - - if BYTE_1(arg2) =3D=3D 0x03: - argr =3D FAN_ID_3 - - if BYTE_1(arg2) =3D=3D 0x04: - argr =3D SENSOR_ID_CPU | 0x0100 - - if BYTE_1(arg2) =3D=3D 0x05: - argr =3D SENSOR_ID_GPU | 0x0100 - - if BYTE_1(arg2) =3D=3D 0x06: - argr =3D THERMAL_MODE_QUIET_ID - - if BYTE_1(arg2) =3D=3D 0x07: - argr =3D THERMAL_MODE_BALANCED_ID - - if BYTE_1(arg2) =3D=3D 0x08: - argr =3D THERMAL_MODE_BALANCED_PERFORMANCE_ID - - if BYTE_1(arg2) =3D=3D 0x09: - argr =3D THERMAL_MODE_PERFORMANCE_ID - - if BYTE_1(arg2) =3D=3D 0x0A: - argr =3D THERMAL_MODE_LOW_POWER_ID - - if BYTE_1(arg2) =3D=3D 0x0B: - argr =3D THERMAL_MODE_GMODE_ID - - else: - argr =3D 0xFFFFFFFF - - if BYTE_0(arg2) =3D=3D 0x04: - if is_valid_sensor(BYTE_1(arg2)): - argr =3D SENSOR_TEMP_C - else: - argr =3D 0xFFFFFFFF - - if BYTE_0(arg2) =3D=3D 0x05: - if is_valid_fan(BYTE_1(arg2)): - argr =3D FAN_RPM() - - if BYTE_0(arg2) =3D=3D 0x06: - skip - - if BYTE_0(arg2) =3D=3D 0x07: - argr =3D 0 - - If BYTE_0(arg2) =3D=3D 0x08: - if is_valid_fan(BYTE_1(arg2)): - argr =3D 0 - else: - argr =3D 0xFFFFFFFF - - if BYTE_0(arg2) =3D=3D 0x09: - if is_valid_fan(BYTE_1(arg2)): - argr =3D FAN_UNKNOWN_STAT_0() - - else: - argr =3D 0xFFFFFFFF - - if BYTE_0(arg2) =3D=3D 0x0A: - argr =3D THERMAL_MODE_BALANCED_ID - - if BYTE_0(arg2) =3D=3D 0x0B: - argr =3D CURRENT_THERMAL_MODE() - - if BYTE_0(arg2) =3D=3D 0x0C: - if is_valid_fan(BYTE_1(arg2)): - argr =3D FAN_UNKNOWN_STAT_1() - else: - argr =3D 0xFFFFFFFF - -Operation 0x02 returns a *system description* buffer with the following -structure: - -:: - - out[0] -> Number of fans - out[1] -> Number of sensors - out[2] -> 0x00 - out[3] -> Number of thermal modes - -Operation 0x03 list all available fan IDs, sensor IDs and thermal profile -codes in order, but different models may have different number of fans and -thermal profiles. These are the known ranges: - -* Fan IDs: from 2 up to 4 -* Sensor IDs: 2 -* Thermal profile codes: from 1 up to 7 - -In total BYTE_1(ARG2) may range from 0x5 up to 0xD depending on the model. ++--------------------+------------------------------------+---------------= -----+ +| Operation (Byte 0) | Description | Arguments = | ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+ +| 0x01 | Unknown. | - None = | ++--------------------+------------------------------------+---------------= -----+ +| 0x02 | Get system description number with | - None = | +| | the following structure: | = | +| | | = | +| | - Byte 0: Number of fans | = | +| | - Byte 1: Number of temperature | = | +| | sensors | = | +| | - Byte 2: Unknown | = | +| | - Byte 3: Number of thermal | = | +| | profiles | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x03 | List an ID or resource at a given | - Byte 1: Inde= x | +| | index. Fan IDs, temperature IDs, | = | +| | unknown IDs and thermal profile | = | +| | IDs are listed in that exact | = | +| | order. | = | +| | | = | +| | Operation 0x02 is used to know | = | +| | which indexes map to which | = | +| | resources. | = | +| | | = | +| | **Returns:** ID at a given index | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x04 | Get the current temperature for a | - Byte 1: Sens= or | +| | given temperature sensor. | ID = | ++--------------------+------------------------------------+---------------= -----+ +| 0x05 | Get the current RPM for a given | - Byte 1: Fan = ID | +| | fan. | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x06 | Get fan speed percentage. (not | - Byte 1: Fan = ID | +| | implemented in every model) | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x07 | Unknown. | - Unknown = | ++--------------------+------------------------------------+---------------= -----+ +| 0x08 | Get minimum RPM for a given FAN | - Byte 1: Fan = ID | +| | ID. | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x09 | Get maximum RPM for a given FAN | - Byte 1: Fan = ID | +| | ID. | = | ++--------------------+------------------------------------+---------------= -----+ +| 0x0A | Get balanced thermal profile ID. | - None = | ++--------------------+------------------------------------+---------------= -----+ +| 0x0B | Get current thermal profile ID. | - None = | ++--------------------+------------------------------------+---------------= -----+ +| 0x0C | Get current `boost` value for a | - Byte 1: Fan = ID | +| | given fan ID. | = | ++--------------------+------------------------------------+---------------= -----+ =20 WMI method Thermal_Control([in] uint32 arg2, [out] uint32 argr) --------------------------------------------------------------- =20 -:: - - if BYTE_0(arg2) =3D=3D 0x01: - if is_valid_thermal_profile(BYTE_1(arg2)): - SET_THERMAL_PROFILE(BYTE_1(arg2)) - argr =3D 0 - - if BYTE_0(arg2) =3D=3D 0x02: - if is_valid_fan(BYTE_1(arg2)): - SET_FAN_SPEED_MULTIPLIER(BYTE_2(arg2)) - argr =3D 0 - else: - argr =3D 0xFFFFFFFF - -.. note:: - While you can manually change the fan speed multiplier with this method, - Dell's BIOS tends to overwrite this changes anyway. ++--------------------+------------------------------------+---------------= -----+ +| Operation (Byte 0) | Description | Arguments = | ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+ +| 0x01 | Activate a given thermal profile. | - Byte 1: Ther= mal | +| | | profile ID = | ++--------------------+------------------------------------+---------------= -----+ +| 0x02 | Set a `boost` value for a given | - Byte 1: Fan = ID | +| | fan ID. | - Byte 2: Boos= t | ++--------------------+------------------------------------+---------------= -----+ =20 These are the known thermal profile codes: =20 -:: ++------------------------------+----------+------+ +| Thermal Profile | Type | ID | ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D+ +| Custom | Special | 0x00 | ++------------------------------+----------+------+ +| G-Mode | Special | 0xAB | ++------------------------------+----------+------+ +| Quiet | Legacy | 0x96 | ++------------------------------+----------+------+ +| Balanced | Legacy | 0x97 | ++------------------------------+----------+------+ +| Balanced Performance | Legacy | 0x98 | ++------------------------------+----------+------+ +| Performance | Legacy | 0x99 | ++------------------------------+----------+------+ +| Balanced | USTT | 0xA0 | ++------------------------------+----------+------+ +| Balanced Performance | USTT | 0xA1 | ++------------------------------+----------+------+ +| Cool | USTT | 0xA2 | ++------------------------------+----------+------+ +| Quiet | USTT | 0xA3 | ++------------------------------+----------+------+ +| Performance | USTT | 0xA4 | ++------------------------------+----------+------+ +| Low Power | USTT | 0xA5 | ++------------------------------+----------+------+ =20 - CUSTOM 0x00 +If a model supports the User Selectable Thermal Tables (USTT) profiles, it= will +not support the Legacy profiles and vice-versa. =20 - BALANCED_USTT 0xA0 - BALANCED_PERFORMANCE_USTT 0xA1 - COOL_USTT 0xA2 - QUIET_USTT 0xA3 - PERFORMANCE_USTT 0xA4 - LOW_POWER_USTT 0xA5 - - QUIET 0x96 - BALANCED 0x97 - BALANCED_PERFORMANCE 0x98 - PERFORMANCE 0x99 - - GMODE 0xAB - -Usually if a model doesn't support the first four profiles they will suppo= rt -the User Selectable Thermal Tables (USTT) profiles and vice-versa. - -GMODE replaces PERFORMANCE in G-Series laptops. +Every model supports the CUSTOM (0x00) thermal profile. GMODE replaces +PERFORMANCE in G-Series laptops. =20 WMI method GameShiftStatus([in] uint32 arg2, [out] uint32 argr) --------------------------------------------------------------- =20 -:: - - if BYTE_0(arg2) =3D=3D 0x1: - TOGGLE_GAME_SHIFT() - argr =3D GET_GAME_SHIFT_STATUS() - - if BYTE_0(arg2) =3D=3D 0x2: - argr =3D GET_GAME_SHIFT_STATUS() ++--------------------+------------------------------------+---------------= -----+ +| Operation (Byte 0) | Description | Arguments = | ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+ +| 0x01 | Toggle *Game Shift*. | - None = | ++--------------------+------------------------------------+---------------= -----+ +| 0x02 | Get *Game Shift* status. | - None = | ++--------------------+------------------------------------+---------------= -----+ =20 Game Shift Status does not change the fan speed profile but it could be so= me sort of CPU/GPU power profile. Benchmarks have not been done. @@ -267,131 +222,27 @@ Thermal_Information does not list it. G-key on Dell's G-Series laptops also changes Game Shift status, so both a= re directly related. =20 -WMI method GetFanSensors([in] uint32 arg2, [out] uint32 argr) -------------------------------------------------------------- - -:: - - if BYTE_0(arg2) =3D=3D 0x1: - if is_valid_fan(BYTE_1(arg2)): - argr =3D 1 - else: - argr =3D 0 - - if BYTE_0(arg2) =3D=3D 0x2: - if is_valid_fan(BYTE_1(arg2)): - if BYTE_2(arg2) =3D=3D 0: - argr =3D=3D SENSOR_ID - else - argr =3D=3D 0xFFFFFFFF - else: - argr =3D 0 - Overclocking Methods =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -.. warning:: - These methods have not been tested and are only partially reverse - engineered. - -WMI method Return_OverclockingReport([out] uint32 argr) -------------------------------------------------------- - -:: - - CSMI (0xE3, 0x99) - argr =3D 0 - -CSMI is an unknown operation. - -WMI method Set_OCUIBIOSControl([in] uint32 arg2, [out] uint32 argr) -------------------------------------------------------------------- - -:: - - CSMI (0xE3, 0x99) - argr =3D 0 - -CSMI is an unknown operation. - -WMI method Clear_OCFailSafeFlag([out] uint32 argr) --------------------------------------------------- - -:: - - CSMI (0xE3, 0x99) - argr =3D 0 - -CSMI is an unknown operation. - - WMI method MemoryOCControl([in] uint32 arg2, [out] uint32 argr) --------------------------------------------------------------- =20 AWCC supports memory overclocking, but this method is very intricate and h= as not been deciphered yet. =20 -GPIO methods -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -These methods are probably related to some kind of firmware update system, -through a GPIO device. - -.. warning:: - These methods have not been tested and are only partially reverse - engineered. - -WMI method FWUpdateGPIOtoggle([in] uint32 arg2, [out] uint32 argr) ------------------------------------------------------------------- - -:: - - if BYTE_0(arg2) =3D=3D 0: - if BYTE_1(arg2) =3D=3D 1: - SET_PIN_A_HIGH() - else: - SET_PIN_A_LOW() - - if BYTE_0(arg2) =3D=3D 1: - if BYTE_1(arg2) =3D=3D 1: - SET_PIN_B_HIGH() - - else: - SET_PIN_B_LOW() - - else: - argr =3D 1 - -WMI method ReadTotalofGPIOs([out] uint32 argr) ----------------------------------------------- - -:: - - argr =3D 0x02 - -WMI method ReadGPIOpPinStatus([in] uint32 arg2, [out] uint32 argr) ------------------------------------------------------------------- - -:: - - if BYTE_0(arg2) =3D=3D 0: - argr =3D PIN_A_STATUS - - if BYTE_0(arg2) =3D=3D 1: - argr =3D PIN_B_STATUS - Other information Methods =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =20 WMI method ReadChassisColor([out] uint32 argr) ---------------------------------------------- =20 -:: - - argr =3D CHASSIS_COLOR_ID +Returns the chassis color internal ID. =20 Acknowledgements =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -Kudos to `AlexIII `_ for documenting -and testing available thermal profile codes. +Kudos to `AlexIII `_ and +`T-Troll `_ for documenting and +testing some of this device's functionality, making it possible to general= ize +this driver. --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AB541EB9EF; Wed, 12 Mar 2025 05:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756346; cv=none; b=TSokKlMz1w4g5Uh6rUKH++qjqCQHj4usz+bvcuWzSDdXTE4slpIA+W3yoKOEflrFv1q8Q4pt34bb0IJbxfQLO6SSlisFM6ASe10Uuz2HugOQu6hJcC0Gos7614n05aIxsiaxfoS0qKEcy+iVwt74A5j39BqlvceM/8Ro3U7eEzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756346; c=relaxed/simple; bh=9bd+fFXZOGpfjf5fiMZ91f038xwI4VpLqB8yAWQipxk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ln1kKjF7LrdoHipdNkUQckZDipIYqUHAsTeGjgin4woEabha26a+LUuO8lsP3hFkmxGFPbmY7KZ4Ou1+fjY64RFncl3sG/mYCK654PZ9XzPyEOgCi25m01DnfhP1N8bKOtzjUShhdLL1bn4gn+/MWzA8aWLhflidE6Q25QBNtZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Kfq/SbbS; arc=none smtp.client-ip=209.85.128.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kfq/SbbS" Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-6f47ed1f40dso48300117b3.1; Tue, 11 Mar 2025 22:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756343; x=1742361143; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dOocp0DmQcn5u4f3g9aw3Ib1o2FEUYsoDQmnBjH/Bjw=; b=Kfq/SbbSEHK/heIa7jicmWs6MPEpCnSKQlHyJQowoqSzpRvLg9WeEJCPnFf7FYWE3A rT6cWBH6HZZ/rDI88Rwlb9HYbvlj1sR7s/bBKRNXnwwFSzj1boFwHtlZR1hjyBnPOhB5 jYbxVpaIWR1eEUB/9sX8ZDr5JGOU36MsDtLV21DAwrBcZPkB0OfW/huQSBioqVmDHFwE RaQRPP+pVDuimfqK+cA5pWm1mAqs3SPTo4vskxLxcSNDo0vF7RcmCAk9p/l05myJYXQ8 VwzdZp41x21DcikQKFjLhkM8DTtCVRULlcM9usinkIEPi5WnclQRRd5tl/90v9OatIz8 1Jyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756343; x=1742361143; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dOocp0DmQcn5u4f3g9aw3Ib1o2FEUYsoDQmnBjH/Bjw=; b=IGjV/PbYXnL27JPxRc1hF0FRV0hmvy+VhtmUjx1YfvvNCuBvUMm6Js1TZFneyxmTc/ XZvHF0rPqlf2YETKSYMZC3xdvThFTh4Lw+fgH3A4Ek6SZd24Sy5WuMxp/FKLARi7do8t QdPg3yxG8JGdBemz4dL04ORC/7wH2PonMO3KXcUA6DoJMiUmaEK5WJlHw7B6WOnCrO0Y +WY6l/FlXSqMS6GnaNcEVdmCUxU6Q2ngMPHTWEYppyXu/4We4AqFm+2nQ9aMmj7JYpqa /C8tut87nhndX8bze0ziiI0T6GpFriG9ow2Bt3+5aDtto3VSca29BWrqI5O3LeGSsuyP hF0A== X-Forwarded-Encrypted: i=1; AJvYcCWZ8SRSo0993MUJpJKPXFb06NeyIFMXII5HJ75CPm6WcbZtb7a602azgA3ecGIekmvu8IZPhqaP3bMBr7fKuzcYpPvqog==@vger.kernel.org, AJvYcCXdQtdyZgHiA/fgAlBhz+amS9jY0w7gP4qrFeSH3qHHQuCwS8tnLhCWam/DhLKTAk7a+fx1dIHbxePLWS0=@vger.kernel.org X-Gm-Message-State: AOJu0YwyLrQlCcLOnMkkTcpQ0kDq4j0kXqRLUKsazgb3sdK7cWbfg7Gv fBNfr4CuXXvCMpumeMY3JzD5Ev0kdE5M2cYTbBUSYDu64xNhzqooy/NU86l8 X-Gm-Gg: ASbGnctLmlBQ1CJumTjPF0td0blB32BG54SSbafRyamxctd5+dBo5T1eSbFGlk7CB18 h/5dSi0lMCh0X5FAeeFeGa7op8MukJ/yFk1i69ANiUlS6gk4t6xCM820UQsE8Snuze2ig11TwVQ iO7ARukZIB9fBsmgIF7bmal9qNZWJIzsyyM3CL0FEDE+bj7QBKupdMRBJwubNv7HJFn7ChrCxhu s2f9BH1uNXbLwXyAvdZdggZaiR8pYjcu+nWlWsgr1JW82FdXojgjoZeseZK9yuGkS65fhNUeb45 6pRSvTWdqeTgVQzzgnoym5ZJ8MHH/EnXPBxyQ19FcSxAjQ== X-Google-Smtp-Source: AGHT+IEpnejrMZcfMvoEVMzpvXr75wHFUipNxRInr6q7BwtatDy8+J0bYqhMlnVHTYKjAvqRS4QGbg== X-Received: by 2002:a05:690c:7207:b0:6f6:d405:7010 with SMTP id 00721157ae682-6febf39bb73mr281902847b3.29.1741756342837; Tue, 11 Mar 2025 22:12:22 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:22 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:24 -0500 Subject: [PATCH v5 11/12] Documentation: admin-guide: laptops: Add documentation for alienware-wmi 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 Message-Id: <20250312-hwm-v5-11-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Add driver admin-guide documentation for the alienware-wmi driver. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- .../admin-guide/laptops/alienware-wmi.rst | 128 +++++++++++++++++= ++++ Documentation/admin-guide/laptops/index.rst | 1 + MAINTAINERS | 1 + 3 files changed, 130 insertions(+) diff --git a/Documentation/admin-guide/laptops/alienware-wmi.rst b/Document= ation/admin-guide/laptops/alienware-wmi.rst new file mode 100644 index 0000000000000000000000000000000000000000..fe7dec73706f8ec85040dc1cbae= c38ffda70b563 --- /dev/null +++ b/Documentation/admin-guide/laptops/alienware-wmi.rst @@ -0,0 +1,128 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Alienware WMI Driver +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Kurt Borja + +This is a driver for the "WMAX" WMI device, which is found in most Dell ga= ming +laptops and controls various special features. + +Before the launch of M-Series laptops (~2018), the "WMAX" device controlled +basic RGB lighting, deep sleep mode, HDMI mode and amplifier status. + +Later, this device was completely repurpused. Now it mostly deals with the= rmal +profiles, sensor monitoring and overclocking. This interface is named "AWC= C" and +is known to be used by the AWCC OEM application to control these features. + +The alienware-wmi driver controls both interfaces. + +AWCC Interface +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +WMI device documentation: Documentation/wmi/devices/alienware-wmi.rst + +Supported devices +----------------- + +- Alienware M-Series laptops +- Alienware X-Series laptops +- Alienware Aurora Desktops +- Dell G-Series laptops + +If you believe your device supports the AWCC interface and you don't have = any of +the features described in this document, try the following alienware-wmi m= odule +parameters: + +- ``force_platform_profile=3D1``: Forces probing for platform profile supp= ort +- ``force_hwmon=3D1``: Forces probing for HWMON support + +If the module loads successfully with these parameters, consider submittin= g a +patch adding your model to the ``awcc_dmi_table`` located in +``drivers/platform/x86/dell/alienware-wmi-wmax.c`` or contacting the maint= ainer +for further guidance. + +Status +------ + +The following features are currently supported: + +- :ref:`Platform Profile `: + + - Thermal profile control + + - G-Mode toggling + +- :ref:`HWMON `: + + - Sensor monitoring + + - Manual fan control + +.. _platform-profile: + +Platform Profile +---------------- + +The AWCC interface exposes various firmware defined thermal profiles. We e= xpose +these profiles to user-space through the Platform Profile class interface. +Refer to +:ref:`sysfs-class-platform-profile ` +for more information. + +The name of the platform-profile class device exported by this driver is +"alienware-wmi" and it's path can be found with: + +:: + + grep -l "alienware-wmi" /sys/class/platform-profile/platform-profile-*/na= me | sed 's|/[^/]*$||' + +If the device supports G-Mode, it is also toggled when selecting the +``performance`` profile. + +.. note:: + You may set the ``force_gmode`` module parameter to always try to toggl= e this + feature, without checking if your model supports it. + +.. _hwmon: + +HWMON +----- + +The AWCC interface also supports sensor monitoring and manual fan control.= Both +of these features are exposed to user-space through the HWMON interface. + +The name of the hwmon class device exported by this driver is "alienware_w= mi" +and it's path can be found with: + +:: + + grep -l "alienware_wmi" /sys/class/hwmon/hwmon*/name | sed 's|/[^/]*$||' + +Sensor monitoring is done through the standard HWMON interface. Refer to +:ref:`sysfs-class-hwmon ` for more +information. + +Manual fan control on the other hand, is not exposed directly by the AWCC +interface. Instead it let's us control a fan `boost` value. This `boost` v= alue +has the following aproximate behavior over the fan pwm: + +:: + + pwm =3D pwm_base + (fan_boost / 255) * (pwm_max - pwm_base) + +Due to the above behavior, we expose the fan `boost` control to user-space +through the following, custom hwmon sysfs attribute: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D +Name Perm Description +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D +fan[1-4]_boost RW Fan boost value. + + Integer value between 0 and 255 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +.. note:: + In some devices, manual fan control only works reliably if the ``custom= `` + platform profile is selected. diff --git a/Documentation/admin-guide/laptops/index.rst b/Documentation/ad= min-guide/laptops/index.rst index e71c8984c23e43ca7cd6373b88803354dff6bc60..db842b629303c1bcf02646204d5= 1938f9bd4043e 100644 --- a/Documentation/admin-guide/laptops/index.rst +++ b/Documentation/admin-guide/laptops/index.rst @@ -7,6 +7,7 @@ Laptop Drivers .. toctree:: :maxdepth: 1 =20 + alienware-wmi asus-laptop disk-shock-protection laptop-mode diff --git a/MAINTAINERS b/MAINTAINERS index 1afd30d00aecf9a48f8c71e156affd5f329539bd..c609bc321b8dc3ab0e8d92b04e4= 2483be8cc171c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -796,6 +796,7 @@ M: Kurt Borja L: platform-driver-x86@vger.kernel.org L: Dell.Client.Kernel@dell.com S: Maintained +F: Documentation/admin-guide/laptops/alienware-wmi.rst F: Documentation/wmi/devices/alienware-wmi.rst F: drivers/platform/x86/dell/alienware-wmi* =20 --=20 2.48.1 From nobody Fri Dec 19 19:37:39 2025 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7A591EC018; Wed, 12 Mar 2025 05:12:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756347; cv=none; b=b6OPhveUPCV4XChJLIyo8BjUDRl41HCdnOwnv9vo01yz/V07hA5cNcoKUMRkZ1UrFqB5tAGFNPozB7AETrnXxqTmPBIqUoeiMSsW6MjlbQQMOSaOtdXHIqWEvROt8RPtCnWOWiUlr3h9+eiWOgDj9AmguepyFxtNA7nn+pAVphw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741756347; c=relaxed/simple; bh=+UVctgMLCQI2qtTmv9h2RN5EXbGlaQr/uLpLO/ItiII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c7lZ440eDGxmcEjwv0gpbSpIJHJxvJ56HX1V3sOjyNsYP9qwjS8DH6gXUy+RfdGi7Y25+IjVr2jSQs76PgekqmcYpNp1c+7mbk4KLqGdRzlr69QzrY6Z0tdM2zhMJLAF12sKx3uZ2aHEulXG87gl/qjRKFbpVtX2+IREcoVl/ZM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RHZQ6yHK; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RHZQ6yHK" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-6feb0742878so59700497b3.2; Tue, 11 Mar 2025 22:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741756344; x=1742361144; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=08INWI3mX8Qq+o80JMhCH1odycnPWIStSqHUAbKsMI8=; b=RHZQ6yHKSB0kQK60MemsEh9bW4KRBjV0sAa2oGlj3yq2v3XWoy1noTSI1YUDQbA5wB EHFxC99EAvUjuFDStP4/q9GAhSuiZRolKk0auNIhaCdb6aiisjs2pAj22WJ7vv7djdTS AK2YiHBAvlz8S+Gyr2R7YUWdg7giC4h0m5OcqIewDYL1ltWRh5FtaN/CGBuEZjtUoxqR PBeocIYswU37HQ28hMnnKbL4e0I23wuuM8XkIC12rcV9q0YMNdHMwPG6I3OmgO+vJ/NM mxtECSmrbE3MsfbABnXlcrfw8id26A+ZW0CHPVIh/aICTTICi20z27/1ob0PeHGhsLW3 K7/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741756344; x=1742361144; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=08INWI3mX8Qq+o80JMhCH1odycnPWIStSqHUAbKsMI8=; b=AhGaqXe51kMq5eLMZiCEQ0uGdRWu3+G3HkBIH4pC4J7n6Ru9xvDDhlrSMazocExi9u 3SWu6Q8mFLFC6yHWNUawYlOy4H3CsfbIcrNTgWIMNoR1ks8nbCTKBW0AHghQDEeq0H1+ aTjcqBw5IPTNNtS8LoBa3xcqy1/3MBh3t4lk2FH2EL6L1Mz6Y2CiqfIRlqrDRBtLZoHM ugiQXO7Lx2qqlGTFCgbkdIOXpq2HjtBs1fIfpWzr593Myns2Z5bKihEOU2Kw9L6dr6vW G7T3UhEVMlaKCSTx+CkGz6B4t/0mixbQYsH/Ot9cJmB6qlXd79KM6EqlTODXQgxUpm3M G/Yg== X-Forwarded-Encrypted: i=1; AJvYcCWzGGI2+2h4KtZS63BMJ/gbnRueEYy8Mb4jCmpvthZy8DEanUV3i1Iwj4Q4HOSCIrDG6ogcIHeABDiaoeobfLlYZt4p+Q==@vger.kernel.org, AJvYcCX9EOH3SJ0w5QEwVxkRQVky7dPWS5V0W3W2i09NkY3G+4SZVh/LTL0LdFFz1bFGqgR1dERcV71R27kp7Ac=@vger.kernel.org X-Gm-Message-State: AOJu0YylbJoKC6NpA+q9gMdoOac4qEYexHauBHF4u+4g7TMMH3RtgXkm owNi7/1guQL4TcUNWhVheUTgstWkP1VZiGbBaoMa0+FBgEh9NUHHqSw5rXvG X-Gm-Gg: ASbGncszOL/0d1TURbV6uQMAfjXVu/jsyqa+9L01evOCDbkv+LA2gJsMbjxV1uxmXSf QkE1NCbT4LWZhfHk9mRV86tIdNTmjucA+Bz2X2nkVgxY+NpZYoXze7URNZQ3yb8nWbnmtLUatCg EMQ5MWD8/6xi56X1Dc8QHrQW7Vq9jiHPPkiu8mQ+fjMmgDw/n/l+FHrFln92ZRiCYSuPiXj79kS 52o8hBo2dZHJuRxk5DwxzYc+Bhs1DGwxb4mS1/UXfvF8nuRGyJZ2jgP1Po2fEXubPkHalIrMHDf 9M1n7dAFszx7E1OoWMjKOtCX1y9iq1Chy4LccshqTfgy3w== X-Google-Smtp-Source: AGHT+IFQ4JC8nq0hoD0bARgCw1bOg9w9D4MdkvqMH7tvMGdNG3W/XyzBLq+BSedGaBrQQJv8sc3pHw== X-Received: by 2002:a05:690c:4807:b0:6fe:af14:57f6 with SMTP id 00721157ae682-6febf2a3050mr269605847b3.5.1741756344545; Tue, 11 Mar 2025 22:12:24 -0700 (PDT) Received: from [192.168.100.70] ([2800:bf0:82:3d2:9e61:1a62:1a8c:3e62]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6feb2c46defsm29811287b3.105.2025.03.11.22.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 22:12:24 -0700 (PDT) From: Kurt Borja Date: Wed, 12 Mar 2025 00:11:25 -0500 Subject: [PATCH v5 12/12] Documentation: ABI: Add sysfs platform and debugfs ABI documentation for alienware-wmi 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 Message-Id: <20250312-hwm-v5-12-deb15ff8f3c6@gmail.com> References: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> In-Reply-To: <20250312-hwm-v5-0-deb15ff8f3c6@gmail.com> To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Kurt Borja , Hans de Goede , platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 Add ABI description for the alienware-wmi driver. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- Documentation/ABI/testing/debugfs-alienware-wmi | 44 ++++++++++++++++++= ++++ .../ABI/testing/sysfs-platform-alienware-wmi | 14 +++++++ MAINTAINERS | 2 + 3 files changed, 60 insertions(+) diff --git a/Documentation/ABI/testing/debugfs-alienware-wmi b/Documentatio= n/ABI/testing/debugfs-alienware-wmi new file mode 100644 index 0000000000000000000000000000000000000000..48cfd4d0b002efd7b68d9c1d3aa= 91a3a05f49db5 --- /dev/null +++ b/Documentation/ABI/testing/debugfs-alienware-wmi @@ -0,0 +1,44 @@ +What: /sys/kernel/debug/alienware-wmi-/system_description +Date: March 2025 +KernelVersion: 6.15 +Contact: Kurt Borja +Description: + This file exposes the raw ``system_description`` number reported + by the WMAX device. + + Only present on devices with the AWCC interface. + + See Documentation/admin-guide/laptops/alienware-wmi.rst for + details. + + RO + +What: /sys/kernel/debug/alienware-wmi-/hwmon_data +Date: March 2025 +KernelVersion: 6.15 +Contact: Kurt Borja +Description: + This file exposes HWMON private data. + + Includes fan sensor count, temperature sensor count, internal + fan IDs and internal temp IDs. + + See Documentation/admin-guide/laptops/alienware-wmi.rst for + details. + + RO + +What: /sys/kernel/debug/alienware-wmi-/pprof_data +Date: March 2025 +KernelVersion: 6.15 +Contact: Kurt Borja +Description: + This file exposes Platform Profile private data. + + Includes internal mapping to platform profiles and thermal + profile IDs. + + See Documentation/admin-guide/laptops/alienware-wmi.rst for + details. + + RO diff --git a/Documentation/ABI/testing/sysfs-platform-alienware-wmi b/Docum= entation/ABI/testing/sysfs-platform-alienware-wmi new file mode 100644 index 0000000000000000000000000000000000000000..4877b3745f4e5b503376d375bf4= 8464250328ce2 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-platform-alienware-wmi @@ -0,0 +1,14 @@ +What: /sys/class/hwmon/hwmonX/fanY_boost +Date: March 2025 +KernelVersion: 6.15 +Contact: Kurt Borja +Description: + This file exposes fan boost control for Dell gaming laptops with + the AWCC WMI interface. + + See Documentation/admin-guide/laptops/alienware-wmi.rst for + details. + + Integer value in the range 0 to 255 + + RW diff --git a/MAINTAINERS b/MAINTAINERS index c609bc321b8dc3ab0e8d92b04e42483be8cc171c..faa377126bda0b9c848760495dc= 893982f3a4c3a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -796,6 +796,8 @@ M: Kurt Borja L: platform-driver-x86@vger.kernel.org L: Dell.Client.Kernel@dell.com S: Maintained +F: Documentation/ABI/testing/debugfs-alienware-wmi +F: Documentation/ABI/testing/sysfs-platform-alienware-wmi F: Documentation/admin-guide/laptops/alienware-wmi.rst F: Documentation/wmi/devices/alienware-wmi.rst F: drivers/platform/x86/dell/alienware-wmi* --=20 2.48.1