Skip to content

brokentoaster/freebsd-system76-charge-thresholds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

freebsd-system76-charge-thresholds

Simple rc script to setup the charge thresholds on the 2020 Lemur Pro (LEMP9) laptop on FreeBSD 13.0

Default settings will stop charging the battery at 80% charge and begin to charge again when the battery level dips below 50%. This behaviour will maximize the long term battery lifespan at the cost of day to day battery life.

Plenty of discussion around this can be found here

To install copy to /usr/local/etc/rc.d/ and set s76_charge_thresholds_enable=YES in your rc.conf

you can also tweak the following values in your rc.conf:

  • s76_charge_thresholds_stop_at (0-100) percentage to stop charging at, default is 80.
  • s76_charge_thresholds_start_at (0-100) percentage to start charging at, default is 50.
  • s76_charge_thresholds_quiet (YES,NO) yes for less verbose output in the dmesg at startup, default is no.

This requires the sysutils/acpi_call package/port to be installed.

# pkg install sysutils/acpi_call
# kldload acpi_call.ko

The exact ACPI calls were reverse engineered through reading issue to add run time setting facility to the embedded Controller firmware and acpidump -dt which gives

---8<--- snip  ---8<---

        Field (ERAM, ByteAcc, Lock, Preserve)
        {
            Offset (0xBC),
            BTL0,   8,
            BTH0,   8
        }

        Method (GBCT, 1, NotSerialized)
        {
            If ((Arg0 == Zero))
            {
                Return (BTL0) /* \_SB_.PCI0.LPCB.EC0_.BTL0 */
            }

            If ((Arg0 == One))
            {
                Return (BTH0) /* \_SB_.PCI0.LPCB.EC0_.BTH0 */
            }

            Return (0xFF)
        }

        Method (SBCT, 2, NotSerialized)
        {
            If ((Arg1 <= 0x64))
            {
                If ((Arg0 == Zero))
                {
                    BTL0 = Arg1
                }

                If ((Arg0 == One))
                {
                    BTH0 = Arg1
                }
            }
        }
---8<--- snip  ---8<---

I could have also inspected the changes to the original ASL file here

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages