auto-cpufreq icon indicating copy to clipboard operation
auto-cpufreq copied to clipboard

Battery Charging Thresholds Not Applied by auto-cpufreq

Open rakshitx1 opened this issue 8 months ago • 8 comments

Battery Charging Thresholds Not Applied by auto-cpufreq

Have you tried?

  • ✅ Searched through existing/closed issues.
  • ✅ Verified installation via auto-cpufreq --install and auto-cpufreq --remove.
  • ✅ Checked GNOME Power Profiles Daemon status.
  • ✅ Reviewed auto-cpufreq --debug output.

Error output:

No explicit error message, but battery charging thresholds do not seem to be enforced.

Image

System Information:

Linux distro: Ubuntu 22.04 Jammy Jellyfish  
Kernel: 6.8.0-57-generic  
CPU: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz  
Architecture: x86_64  
Driver: acpi-cpufreq
auto-cpufreq version: 2.5.0  

Issue Description:

Despite setting charging thresholds in /etc/auto-cpufreq.conf:

enable_thresholds = true
start_threshold = 60
stop_threshold = 80

Auto-cpufreq does not enforce these limits. The battery is charging beyond the stop threshold with no rules detected in auto-cpufreq --stats.

Steps Taken:

  • Installed and removed auto-cpufreq to reset settings.
  • Verified GNOME Power Profiles Daemon interference.
  • Ensured /etc/auto-cpufreq.conf is properly configured.
  • Observed battery stats showing no charging thresholds applied.

Expected Behavior:

Battery charging should stop at 80% and resume at 60%, but this is not happening.

Would appreciate any guidance on troubleshooting or confirming whether this is a known bug.

rakshitx1 avatar Apr 02 '25 19:04 rakshitx1

@PurpleWazard 👆

AdnanHodzic avatar Apr 02 '25 19:04 AdnanHodzic

Hey @rakshitx1 what is your laptop? Vendor and model. Depending on your vendor it may or may not support battery charge thresholds

PurpleWazard avatar Apr 02 '25 19:04 PurpleWazard

@PurpleWazard

My laptop is the MSI GF63 11UC (i7-11800H).

I checked /sys/class/power_supply/BAT1/, and I see the following charge control files:

charge_control_end_threshold
charge_control_start_threshold

Let me know if you need any other details!

rakshitx1 avatar Apr 02 '25 20:04 rakshitx1

@rakshitx1 alright thanks what is the output of lsmod

i need to see what kernel modules you're using.

PurpleWazard avatar Apr 03 '25 17:04 PurpleWazard

@rakshitx1 ^

lets get this fixed soon.

PurpleWazard avatar Apr 10 '25 17:04 PurpleWazard

This is output of lsmod

$ lsmod
Module                  Size  Used by
btrfs                2031616  0
blake2b_generic        24576  0
xor                    20480  1 btrfs
raid6_pq              126976  1 btrfs
ufs                   126976  0
qnx4                   12288  0
hfsplus               139264  0
hfs                    77824  0
minix                  49152  0
ntfs                  139264  0
msdos                  16384  0
jfs                   303104  0
nls_ucs2_utils          8192  1 jfs
xfs                  2367488  0
nvidia_uvm           2088960  0
rfcomm                102400  4
xt_set                 20480  0
ip_set                 61440  1 xt_set
xt_addrtype            12288  4
xfrm_user              61440  1
xfrm_algo              16384  1 xfrm_user
ccm                    20480  6
xt_CHECKSUM            12288  1
xt_MASQUERADE          16384  5
xt_conntrack           12288  3
ipt_REJECT             12288  2
nf_reject_ipv4         12288  1 ipt_REJECT
xt_tcpudp              16384  9
nft_compat             20480  24
nft_chain_nat          12288  6
nf_nat                 61440  2 nft_chain_nat,xt_MASQUERADE
nf_conntrack          196608  3 xt_conntrack,nf_nat,xt_MASQUERADE
nf_defrag_ipv6         24576  1 nf_conntrack
nf_defrag_ipv4         12288  1 nf_conntrack
nf_tables             372736  248 nft_compat,nft_chain_nat
libcrc32c              12288  5 nf_conntrack,nf_nat,btrfs,nf_tables,xfs
nfnetlink              20480  4 nft_compat,nf_tables,ip_set
bridge                421888  0
stp                    12288  1 bridge
llc                    16384  2 bridge,stp
cmac                   12288  2
algif_hash             12288  1
algif_skcipher         16384  1
af_alg                 32768  6 algif_hash,algif_skcipher
overlay               212992  0
bnep                   32768  2
binfmt_misc            24576  1
snd_ctl_led            24576  0
ledtrig_audio          12288  1 snd_ctl_led
snd_soc_skl_hda_dsp    24576  6
snd_soc_hdac_hdmi      45056  1 snd_soc_skl_hda_dsp
snd_sof_probes         20480  0
snd_soc_intel_hda_dsp_common    16384  1 snd_soc_skl_hda_dsp
snd_hda_codec_hdmi     94208  1
snd_hda_codec_realtek   200704  1
snd_soc_dmic           12288  1
xe                   2719744  0
snd_hda_codec_generic   122880  1 snd_hda_codec_realtek
intel_rapl_msr         20480  0
intel_rapl_common      40960  1 intel_rapl_msr
nvidia_drm            131072  2
intel_uncore_frequency    16384  0
snd_sof_pci_intel_tgl    12288  0
intel_uncore_frequency_common    16384  1 intel_uncore_frequency
nvidia_modeset       1548288  2 nvidia_drm
snd_sof_intel_hda_common   217088  1 snd_sof_pci_intel_tgl
soundwire_intel        73728  1 snd_sof_intel_hda_common
snd_sof_intel_hda_mlink    45056  2 soundwire_intel,snd_sof_intel_hda_common
soundwire_cadence      45056  1 soundwire_intel
snd_sof_intel_hda      24576  1 snd_sof_intel_hda_common
snd_sof_pci            24576  2 snd_sof_intel_hda_common,snd_sof_pci_intel_tgl
drm_gpuvm              45056  1 xe
snd_sof_xtensa_dsp     12288  1 snd_sof_intel_hda_common
drm_exec               12288  2 drm_gpuvm,xe
gpu_sched              61440  1 xe
snd_sof               380928  4 snd_sof_pci,snd_sof_intel_hda_common,snd_sof_probes,snd_sof_intel_hda
drm_suballoc_helper    20480  1 xe
x86_pkg_temp_thermal    20480  0
snd_sof_utils          16384  1 snd_sof
drm_ttm_helper         12288  1 xe
intel_powerclamp       24576  0
snd_soc_hdac_hda       24576  1 snd_sof_intel_hda_common
nvidia              89858048  30 nvidia_uvm,nvidia_modeset
coretemp               24576  0
snd_hda_ext_core       32768  5 snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_intel_hda_mlink,snd_sof_intel_hda
snd_soc_acpi_intel_match    98304  2 snd_sof_intel_hda_common,snd_sof_pci_intel_tgl
snd_soc_acpi           16384  2 snd_soc_acpi_intel_match,snd_sof_intel_hda_common
soundwire_generic_allocation    12288  1 soundwire_intel
soundwire_bus         110592  3 soundwire_intel,soundwire_generic_allocation,soundwire_cadence
snd_soc_core          438272  8 soundwire_intel,snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_probes,snd_soc_dmic,snd_soc_skl_hda_dsp
snd_compress           28672  2 snd_soc_core,snd_sof_probes
ac97_bus               12288  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_hda_intel          61440  0
iwlmvm                872448  0
kvm_intel             487424  0
snd_intel_dspcfg       36864  3 snd_hda_intel,snd_sof,snd_sof_intel_hda_common
snd_intel_sdw_acpi     16384  2 snd_sof_intel_hda_common,snd_intel_dspcfg
i915                 4292608  22
kvm                  1409024  1 kvm_intel
snd_hda_codec         204800  8 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek,snd_soc_intel_hda_dsp_common,snd_soc_hdac_hda,snd_sof_intel_hda,snd_soc_skl_hda_dsp
mac80211             1724416  1 iwlmvm
snd_hda_core          139264  11 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_hda_codec_realtek,snd_soc_intel_hda_dsp_common,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_intel_hda
irqbypass              12288  1 kvm
snd_hwdep              20480  1 snd_hda_codec
crct10dif_pclmul       12288  1
polyval_clmulni        12288  0
snd_pcm               192512  12 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,soundwire_intel,snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_compress,snd_soc_core,snd_sof_utils,snd_hda_core,snd_pcm_dmaengine
polyval_generic        12288  1 polyval_clmulni
ghash_clmulni_intel    16384  0
snd_seq_midi           24576  0
btusb                  77824  0
sha256_ssse3           32768  0
snd_seq_midi_event     16384  1 snd_seq_midi
btrtl                  32768  1 btusb
libarc4                12288  1 mac80211
drm_buddy              20480  2 xe,i915
sha1_ssse3             32768  0
snd_rawmidi            57344  1 snd_seq_midi
btintel                57344  1 btusb
nls_iso8859_1          12288  1
ttm                   110592  3 drm_ttm_helper,xe,i915
aesni_intel           356352  7
btbcm                  24576  1 btusb
snd_seq               118784  2 snd_seq_midi,snd_seq_midi_event
btmtk                  12288  1 btusb
drm_display_helper    237568  2 xe,i915
crypto_simd            16384  1 aesni_intel
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
iwlwifi               602112  1 iwlmvm
cryptd                 24576  3 crypto_simd,ghash_clmulni_intel
cmdlinepart            12288  0
snd_timer              49152  2 snd_seq,snd_pcm
mei_hdcp               28672  0
cec                    94208  3 drm_display_helper,xe,i915
bluetooth            1028096  34 btrtl,btmtk,btintel,btbcm,bnep,btusb,rfcomm
mei_pxp                16384  0
rapl                   20480  0
spi_nor               163840  0
gpio_keys              20480  0
intel_pmc_core        118784  0
msi_ec                 12288  0
cfg80211             1331200  3 iwlmvm,iwlwifi,mac80211
snd                   143360  28 snd_ctl_led,snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_sof,snd_timer,snd_soc_hdac_hdmi,snd_compress,snd_soc_core,snd_pcm,snd_rawmidi
joydev                 32768  0
ecdh_generic           16384  1 bluetooth
rc_core                73728  1 cec
input_leds             12288  0
msi_wmi                16384  0
mtd                    98304  3 spi_nor,cmdlinepart
mei_me                 53248  2
intel_cstate           24576  0
pmt_telemetry          16384  1 intel_pmc_core
hid_multitouch         36864  0
ecc                    45056  1 ecdh_generic
wmi_bmof               12288  0
serio_raw              20480  0
sparse_keymap          12288  1 msi_wmi
i2c_algo_bit           16384  2 xe,i915
ee1004                 16384  0
mei                   167936  5 mei_hdcp,mei_pxp,mei_me
soundcore              16384  2 snd_ctl_led,snd
intel_vsec             20480  1 intel_pmc_core
mac_hid                12288  0
pmt_class              12288  1 pmt_telemetry
soc_button_array       20480  0
acpi_pad              184320  0
acpi_tad               20480  0
sch_fq_codel           24576  3
msr                    12288  0
parport_pc             53248  0
ppdev                  24576  0
lp                     28672  0
parport                73728  3 parport_pc,lp,ppdev
efi_pstore             12288  0
ip_tables              32768  0
x_tables               65536  9 xt_conntrack,nft_compat,xt_tcpudp,xt_addrtype,xt_CHECKSUM,xt_set,ipt_REJECT,ip_tables,xt_MASQUERADE
autofs4                57344  2
hid_generic            12288  0
nvme                   61440  3
i2c_hid_acpi           12288  0
intel_lpss_pci         28672  0
spi_intel_pci          12288  0
i2c_i801               36864  0
r8169                 118784  0
ahci                   49152  0
intel_lpss             12288  1 intel_lpss_pci
xhci_pci               24576  0
nvme_core             212992  4 nvme
i2c_hid                40960  1 i2c_hid_acpi
crc32_pclmul           12288  0
video                  77824  4 msi_wmi,xe,i915,nvidia_modeset
psmouse               217088  0
spi_intel              32768  1 spi_intel_pci
i2c_smbus              16384  1 i2c_i801
realtek                36864  1
libahci                53248  1 ahci
idma64                 20480  0
xhci_pci_renesas       20480  1 xhci_pci
nvme_auth              28672  1 nvme_core
hid                   180224  3 i2c_hid,hid_multitouch,hid_generic
wmi                    28672  3 video,wmi_bmof,msi_wmi
pinctrl_tigerlake      28672  3

In the meantime, I’ve created a systemd service to set battery charge thresholds:

# /etc/systemd/system/battery-threshold.service
[Unit]
Description=Set Battery Charge Start and Stop Threshold
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo 60 > /sys/class/power_supply/BAT1/charge_control_start_threshold && echo 80 > /sys/class/power_supply/BAT1/charge_control_end_threshold'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Let me know if anything from the lsmod output stands out or if you'd like me to test anything else.

rakshitx1 avatar Apr 14 '25 22:04 rakshitx1

I have the same issue on a Lenovo T14s Gen 1

neut avatar Jun 06 '25 10:06 neut

@nuet I dont know of any solution per se, but the custom service has been working fine

rakshitx1 avatar Jun 08 '25 12:06 rakshitx1

Also noticing the same issue on a Dell Precision 5480. The custom service (tweaking BAT1 -> BAT0) seems to work when I manually verify by cating /sys/class/... files,, but auto-cpufreq --stats still reports None for the thresholds.

fiskhest avatar Jul 26 '25 19:07 fiskhest