[PATCH 2/2] platform/x86: thinkpad_acpi: Only check charge_start against a known charge_stop
From: Tom Hu
Date: Tue Nov 24 2026 - 05:40:24 EST
From: huxiaoying <huxiaoying@xxxxxxxxxx>
When the EC does not provide GET_STOP, stop_support stays clear and the
cached charge_stop is never probed, so it remains 0. charge_start is
still validated against that value, which rejects every level above 0
even though the start threshold is supported.
Only apply the cross check when the stop threshold is supported.
Signed-off-by: huxiaoying <huxiaoying@xxxxxxxxxx>
---
drivers/platform/x86/lenovo/thinkpad_acpi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c
index 8fc5569131f6..842045272ffa 100644
--- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
+++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
@@ -9832,7 +9832,8 @@ static ssize_t tpacpi_battery_store(int what,
/* valid values are [0, 99] */
if (value > 99)
return -EINVAL;
- if (value > battery_info.batteries[battery].charge_stop)
+ if (battery_info.batteries[battery].stop_support &&
+ value > battery_info.batteries[battery].charge_stop)
return -EINVAL;
if (tpacpi_battery_set(THRESHOLD_START, battery, value))
return -ENODEV;
--
2.34.1