summaryrefslogtreecommitdiff
path: root/Documentation/gpu/intel-display/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorDerek J. Clark <derekjohn.clark@gmail.com>2026-05-20 06:07:37 +0000
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2026-05-28 14:17:44 +0300
commit9ca8fc065b88b327acbfdc33454efea391639716 (patch)
treea3ba29c196ea206f389588750bdb009dc54c4374 /Documentation/gpu/intel-display/git@git.tavy.me:linux.git
parent891d43749445fed6725acf9ee1c37e052dba8288 (diff)
platform/x86: lenovo-wmi-other: Add WMI battery charge limiting
Add charge_behaviour and charge_types attributes through a power supply extension for devices that support WMI based charge enable & disable. Lenovo Legion devices that implement WMI function and capdata ID 0x03010001 in their BIOS are able to enable or disable charging at 80% through the lenovo-wmi-other interface. Add a charge_types attribute for BATX devices to expose this capability with Standard and Long_Life types enabled. Additionally, devices that support WMI function and capdata ID 0x03020000 are able to force discharge of the battery. Expose this capability with a charge_behaviour attribute in the power supply extension, with the auto and force-discharge behaviors enabled. The GET method for this attribute is bugged. After analyzing the DSDT, and some testing, it appears the method grabs bit(3) instead of bit(4) from the EC register that stores the current status, and will only report if charging has been inhibited or not. To work around this, store and report the last setting written to the attribute. As some devices only expose one attribute or the other, a bitmask is added with a lookup table and some helper macros to select the correct configuration for the hardware at runtime. The ideapad_laptop driver provides the charge_types attribute to provide similar functionality. When the WMI method is set this can corrupt the ACPI method return and cause hardware and driver errors. To avoid conflicts between the drivers, we get the acpi_handle and do the same check that ideapad_laptop does when it enables the feature. If the feature is supported in ideapad_laptop, abort adding the extension from lenovo-wmi-other. The ACPI method is more reliable when both are present from my testing, so we can prefer that implementation and do not need to worry about de-conflicting from inside that driver. Reviewed-by: Rong Zhang <i@rong.moe> Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com> Link: https://patch.msgid.link/20260520060740.119554-5-derekjohn.clark@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'Documentation/gpu/intel-display/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions