Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: lenovo-wmi-capdata: Add support for Capability Data 00

Add support for LENOVO_CAPABILITY_DATA_00 WMI data block that comes on
"Other Mode" enabled hardware. Provides an interface for querying if a
given attribute is supported by the hardware, as well as its default
value.

capdata00 always presents on devices with capdata01. lenovo-wmi-other
now binds to both (no functional change intended).

Signed-off-by: Rong Zhang <i@rong.moe>
Reviewed-by: Derek J. Clark <derekjohn.clark@gmail.com>
Tested-by: Derek J. Clark <derekjohn.clark@gmail.com>
Link: https://patch.msgid.link/20260120182104.163424-5-i@rong.moe
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Rong Zhang and committed by
Ilpo Järvinen
c05f67e6 4ff1a029

+45 -3
+12 -3
Documentation/wmi/devices/lenovo-wmi-other.rst
··· 31 31 32 32 /sys/class/firmware-attributes/lenovo-wmi-other/attributes/<attribute>/ 33 33 34 + LENOVO_CAPABILITY_DATA_00 35 + ------------------------- 36 + 37 + WMI GUID ``362A3AFE-3D96-4665-8530-96DAD5BB300E`` 38 + 39 + The LENOVO_CAPABILITY_DATA_00 interface provides various information that 40 + does not rely on the gamezone thermal mode. 41 + 34 42 LENOVO_CAPABILITY_DATA_01 35 43 ------------------------- 36 44 37 45 WMI GUID ``7A8F5407-CB67-4D6E-B547-39B3BE018154`` 38 46 39 - The LENOVO_CAPABILITY_DATA_01 interface provides information on various 40 - power limits of integrated CPU and GPU components. 47 + The LENOVO_CAPABILITY_DATA_01 interface provides various information that 48 + relies on the gamezone thermal mode, including power limits of integrated 49 + CPU and GPU components. 41 50 42 51 Each attribute has the following properties: 43 52 - current_value ··· 57 48 - scalar_increment 58 49 - type 59 50 60 - The following attributes are implemented: 51 + The following firmware-attributes are implemented: 61 52 - ppt_pl1_spl: Platform Profile Tracking Sustained Power Limit 62 53 - ppt_pl2_sppt: Platform Profile Tracking Slow Package Power Tracking 63 54 - ppt_pl3_fppt: Platform Profile Tracking Fast Package Power Tracking
+25
drivers/platform/x86/lenovo/wmi-capdata.c
··· 5 5 * Lenovo Capability Data provides information on tunable attributes used by 6 6 * the "Other Mode" WMI interface. 7 7 * 8 + * Capability Data 00 includes if the attribute is supported by the hardware, 9 + * and the default_value. All attributes are independent of thermal modes. 10 + * 8 11 * Capability Data 01 includes if the attribute is supported by the hardware, 9 12 * and the default_value, max_value, min_value, and step increment. Each 10 13 * attribute has multiple pages, one for each of the thermal modes managed by ··· 43 40 44 41 #include "wmi-capdata.h" 45 42 43 + #define LENOVO_CAPABILITY_DATA_00_GUID "362A3AFE-3D96-4665-8530-96DAD5BB300E" 46 44 #define LENOVO_CAPABILITY_DATA_01_GUID "7A8F5407-CB67-4D6E-B547-39B3BE018154" 47 45 48 46 #define ACPI_AC_CLASS "ac_adapter" 49 47 #define ACPI_AC_NOTIFY_STATUS 0x80 50 48 51 49 enum lwmi_cd_type { 50 + LENOVO_CAPABILITY_DATA_00, 52 51 LENOVO_CAPABILITY_DATA_01, 53 52 }; 54 53 ··· 64 59 const char *name; 65 60 enum lwmi_cd_type type; 66 61 } lwmi_cd_table[] = { 62 + LWMI_CD_TABLE_ITEM(LENOVO_CAPABILITY_DATA_00), 67 63 LWMI_CD_TABLE_ITEM(LENOVO_CAPABILITY_DATA_01), 68 64 }; 69 65 ··· 80 74 u8 count; 81 75 82 76 union { 77 + DECLARE_FLEX_ARRAY(struct capdata00, cd00); 83 78 DECLARE_FLEX_ARRAY(struct capdata01, cd01); 84 79 }; 85 80 }; ··· 148 141 struct lwmi_cd_binder *binder = data; 149 142 150 143 switch (priv->list->type) { 144 + case LENOVO_CAPABILITY_DATA_00: 145 + binder->cd00_list = priv->list; 146 + break; 151 147 case LENOVO_CAPABILITY_DATA_01: 152 148 binder->cd01_list = priv->list; 153 149 break; ··· 194 184 return -EINVAL; \ 195 185 } 196 186 187 + DEF_LWMI_CDXX_GET_DATA(cd00, LENOVO_CAPABILITY_DATA_00, struct capdata00); 188 + EXPORT_SYMBOL_NS_GPL(lwmi_cd00_get_data, "LENOVO_WMI_CAPDATA"); 189 + 197 190 DEF_LWMI_CDXX_GET_DATA(cd01, LENOVO_CAPABILITY_DATA_01, struct capdata01); 198 191 EXPORT_SYMBOL_NS_GPL(lwmi_cd01_get_data, "LENOVO_WMI_CAPDATA"); 199 192 ··· 215 202 void *p; 216 203 217 204 switch (priv->list->type) { 205 + case LENOVO_CAPABILITY_DATA_00: 206 + p = &priv->list->cd00[0]; 207 + size = sizeof(priv->list->cd00[0]); 208 + break; 218 209 case LENOVO_CAPABILITY_DATA_01: 219 210 p = &priv->list->cd01[0]; 220 211 size = sizeof(priv->list->cd01[0]); ··· 264 247 count = wmidev_instance_count(priv->wdev); 265 248 266 249 switch (type) { 250 + case LENOVO_CAPABILITY_DATA_00: 251 + list_size = struct_size(list, cd00, count); 252 + break; 267 253 case LENOVO_CAPABILITY_DATA_01: 268 254 list_size = struct_size(list, cd01, count); 269 255 break; ··· 379 359 goto out; 380 360 381 361 switch (info->type) { 362 + case LENOVO_CAPABILITY_DATA_00: 363 + ret = component_add(&wdev->dev, &lwmi_cd_component_ops); 364 + goto out; 382 365 case LENOVO_CAPABILITY_DATA_01: 383 366 priv->acpi_nb.notifier_call = lwmi_cd01_notifier_call; 384 367 ··· 415 392 struct lwmi_cd_priv *priv = dev_get_drvdata(&wdev->dev); 416 393 417 394 switch (priv->list->type) { 395 + case LENOVO_CAPABILITY_DATA_00: 418 396 case LENOVO_CAPABILITY_DATA_01: 419 397 component_del(&wdev->dev, &lwmi_cd_component_ops); 420 398 break; ··· 429 405 .context = &lwmi_cd_table[_type], 430 406 431 407 static const struct wmi_device_id lwmi_cd_id_table[] = { 408 + { LWMI_CD_WDEV_ID(LENOVO_CAPABILITY_DATA_00) }, 432 409 { LWMI_CD_WDEV_ID(LENOVO_CAPABILITY_DATA_01) }, 433 410 {} 434 411 };
+8
drivers/platform/x86/lenovo/wmi-capdata.h
··· 11 11 struct device; 12 12 struct cd_list; 13 13 14 + struct capdata00 { 15 + u32 id; 16 + u32 supported; 17 + u32 default_value; 18 + }; 19 + 14 20 struct capdata01 { 15 21 u32 id; 16 22 u32 supported; ··· 27 21 }; 28 22 29 23 struct lwmi_cd_binder { 24 + struct cd_list *cd00_list; 30 25 struct cd_list *cd01_list; 31 26 }; 32 27 33 28 void lwmi_cd_match_add_all(struct device *master, struct component_match **matchptr); 29 + int lwmi_cd00_get_data(struct cd_list *list, u32 attribute_id, struct capdata00 *output); 34 30 int lwmi_cd01_get_data(struct cd_list *list, u32 attribute_id, struct capdata01 *output); 35 31 36 32 #endif /* !_LENOVO_WMI_CAPDATA_H_ */