Dell XPS 13 battery charge treshold on Linux


Updated: 2023-04-28

Just like with any battery powered device (a Tesla, or your smartphone), it's the last stretch to a 100% full charge that taxes the battery the most. You might have noticed charging on modern smartphones and laptops goes pretty fast, until you start hitting the upper percentiles (80%, 90%) - then charging will turn into a trickle. The simple reason is charging Li-Ion batteries to 100% diminishes their longevity.

Unfortunately, there's no unified interface for managing charging tresholds on Linux. Vendors tend to use their own implementations, often with a Windows GUI that can manipulate the related BIOS settings. TLP e.g. can manage battery charge treshold settings for IBM/Lenovo ThinkPads, but not for other devices. The Linux kernel itself seems to have support for some Asus and Huawei devices as well through natacpi, but TLP does not support those (yet). So, like with a lot of other things, support can be hit and miss. If the vendor doesn't provide any Linux implementations or binaries, you're down to staring at your battery level indicator.

Dell, however, fortunately does offer a "Command | Configure" suite to manipulate battery settings on your XPS laptop, along with a slew of other stuff exposed in their UEFI shell (presently at 4.x), along with a configuration guide. Grab the tarball, unpack it and install both packages:

$ wget https://dl.dell.com/FOLDER09420006M/1/command-configure_4.10.0-595.ubuntu18_amd64.tar.gz
$ sudo dpkg -i srvadmin-hapi_9.5.0_amd64.deb command-configure_4.10.0-595.ubuntu18_amd64.deb

The packages will install to /opt. To see your present battery configuration, you can call the command as follows:

$ sudo /opt/dell/dcc/cctk --PrimaryBattChargeCfg

For me, on my XPS 13 9350, it showed 'auto'. To limit battery charging to 80%, issue the following command:

$ sudo /opt/dell/dcc/cctk --PrimaryBattChargeCfg=Custom:50-80

Note the first number indicates the start range, and it cannot be lower than 50. Check Table 349 --PrimaryBattChargeCfg in the manual for more information. The Dell Command | Configure utility does not seem to work on other Dell models (Inspiron e.g.), from what I could find online.