Skip to content

Conversation

@dingbat32
Copy link

Uses the new charge_types instead of the conservation_mode setting on kernel version 6.17 onwards. This resolves issue #831. Should still be backwards compatible, and uses the suggestion of setting _natacpi to 1 if using the older system.

Since this setting is now per battery, I have also changed how tlp-stat -b outputs to have this info per battery. However, I haven't reformatted it so this might need more work. Also, it still shows the value as being 0 or 1 in tlp-stat despite the underlying info being different, and I'm not sure that's most transparent for the user.

+++ Battery Status: BAT0
/sys/class/power_supply/BAT0/manufacturer                   = COSMX
/sys/class/power_supply/BAT0/model_name                     = L24X4PC0
/sys/class/power_supply/BAT0/cycle_count                    =      6
/sys/class/power_supply/BAT0/energy_full_design             =  80000 [mWh]
/sys/class/power_supply/BAT0/energy_full                    =  83890 [mWh]
/sys/class/power_supply/BAT0/energy_now                     =  67120 [mWh]
/sys/class/power_supply/BAT0/power_now                      =      0 [mW]
/sys/class/power_supply/BAT0/status                         = Not charging

Parameter value range:
* STOP_CHARGE_THRESH_BAT0: 0(off), 1(on) -- battery long life mode

/sys/class/power_supply/BAT0/charge_types                   = 1 (on)

Charge                                                      =   80.0 [%]
Capacity                                                    =  104.9 [%]

charge_types is used if the api is available (Kernel >=6.17 required)

Signed-off-by: Sven Willett <sven.willett@gmail.com>
Signed-off-by: Sven Willett <sven.willett@gmail.com>
@linrunner
Copy link
Owner

Also, it still shows the value as being 0 or 1 in tlp-stat despite the underlying info being different, and I'm not sure that's most transparent for the user.

You're right. More user friendly would be to show the actual content of charge_types. However, for backward compatibility, we must leave 0/1 in the configuration parameter.

Moreover, I now believe that the case differentiation makes the plugin too clumsy and complicated. It would probably be better to duplicate/split it into lenovo and lenovo-legacy to keep the logic simpler.

I'll make a draft myself. Stay tuned for testing.

@dingbat32
Copy link
Author

dingbat32 commented Jan 1, 2026

Honestly that was the first approach I was thinking of taking. I have a branch with a separate driver in my fork. However, I thought that a separate charge_type or charge_mode setting would be more generalised, since some hardware also has a fast charge mode or possibly other modes, and it does seem a bit strange to shoehorn it into STOP_CHARGE_THRESHOLD at that stage when you may want a different option. Maybe once (or if) more drivers support the charge_types sysfs file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants