Re: [PATCH 0/2] power: supply: qcom_battmgr: improve charge control threshold handling

Fenglin Wu
2025-11-17T05:12:20Z

On 10/13/2025 7:32 AM, Val Packett wrote:
> Currently, upowerd is unable to turn off the battery preservation mode[1]
> on Qualcomm laptops, because it does that by setting the start threshold to
> zero and the driver returns an error:
>
> pmic_glink.power-supply.0: charge control start threshold exceed range: [50 - 95]
>
> Kernel documentation says the end threshold must be clamped[2] but does
> not say anything about the start threshold.
>
> In this proposal I've special-cased start==0 to actually disable the
> functionality via the enable bit, and otherwise made both start and
> end thresholds be clamped to the acceptable range. Hopefully that's
> fine?
It is fine to clamping the threshold to the acceptable range. Thank you
for making the changes.
> Or should the [1 - 49] range for start actually be rejected?
The minimum charging start threshold was set to 50 to improve user
experience. If the threshold is too low and the system keeps drawing
power from the battery frequently due to a large system load and a weak
charger, the laptop will only begin charging when the battery level
falls below that threshold. If the user disconnects the charger at that
time, then the device would be only having a battery below 50%. Setting
the threshold at 50 ensures the battery always stays above 50%.
> [1]: https://gitlab.freedesktop.org/upower/upower/-/issues/327
> [2]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power
>
> Thanks,
> ~val
>
> Val Packett (2):
> power: supply: qcom_battmgr: clamp charge control thresholds
> power: supply: qcom_battmgr: support disabling charge control
>
> drivers/power/supply/qcom_battmgr.c | 26 ++++++++++----------------
> 1 file changed, 10 insertions(+), 16 deletions(-)
>