72 lines
2.4 KiB
Markdown
72 lines
2.4 KiB
Markdown
|
|
# Power Management
|
||
|
|
|
||
|
|
veilor-os ships a 3-mode power profile system backed by `tuned`.
|
||
|
|
|
||
|
|
## Profiles
|
||
|
|
|
||
|
|
| Profile | Governor | EPP | Boost | ASUS TTP | Use |
|
||
|
|
|---------|----------|-----|-------|----------|-----|
|
||
|
|
| `veilor-powersave` | powersave | power | off | 2 (silent) | max battery |
|
||
|
|
| `veilor-balanced` | powersave | balance_performance | on | 1 (mid) | on the go |
|
||
|
|
| `veilor-performance` | performance | performance | on | 0 (full) | plugged in |
|
||
|
|
|
||
|
|
`ASUS TTP` (throttle_thermal_policy) only applies to ASUS laptops with
|
||
|
|
`asus-nb-wmi`. On other hardware those writes are silently skipped.
|
||
|
|
|
||
|
|
## Switching
|
||
|
|
|
||
|
|
```bash
|
||
|
|
veilor-power save # max battery (aliases: powersave, s)
|
||
|
|
veilor-power mid # balanced (aliases: balanced, b)
|
||
|
|
veilor-power perf # performance (aliases: performance, p)
|
||
|
|
veilor-power # status: profile, governor, EPP, boost, freq
|
||
|
|
```
|
||
|
|
|
||
|
|
`veilor-power` calls `tuned-adm` via a NOPASSWD sudoers drop-in
|
||
|
|
locked to `veilor-*` profiles only (`/etc/sudoers.d/veilor-power`).
|
||
|
|
|
||
|
|
## Auto-switch on AC plug/unplug
|
||
|
|
|
||
|
|
`/etc/udev/rules.d/90-veilor-ac-switch.rules`:
|
||
|
|
|
||
|
|
```
|
||
|
|
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/bin/tuned-adm profile veilor-powersave"
|
||
|
|
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/bin/tuned-adm profile veilor-performance"
|
||
|
|
```
|
||
|
|
|
||
|
|
Override anytime with `veilor-power mid`.
|
||
|
|
|
||
|
|
## Battery longevity
|
||
|
|
|
||
|
|
`/etc/udev/rules.d/91-veilor-battery-threshold.rules` caps charge at
|
||
|
|
80% on supported hardware. Adjust by editing the rule or:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
echo 100 | sudo tee /sys/class/power_supply/BAT0/charge_control_end_threshold
|
||
|
|
```
|
||
|
|
|
||
|
|
## What each profile actually does
|
||
|
|
|
||
|
|
`/etc/tuned/profiles/veilor-<profile>/script.sh` writes:
|
||
|
|
|
||
|
|
- `/sys/devices/system/cpu/cpufreq/boost`
|
||
|
|
- `/sys/devices/platform/asus-nb-wmi/throttle_thermal_policy` (ASUS only)
|
||
|
|
- `/sys/bus/pci/devices/*/power/control` (NVMe autosuspend)
|
||
|
|
- `/sys/class/drm/card*/device/power_dpm_force_performance_level` (AMD iGPU)
|
||
|
|
- `usb_autosuspend` enable/disable
|
||
|
|
|
||
|
|
All writes are guarded with `[ -w ... ]` so non-applicable hardware
|
||
|
|
silently no-ops.
|
||
|
|
|
||
|
|
## Persistence
|
||
|
|
|
||
|
|
`tuned.service` starts at boot and loads the last active profile from
|
||
|
|
`/var/lib/tuned/save.conf`. No GRUB params needed.
|
||
|
|
|
||
|
|
## Caveat: `platform_profile` vs `throttle_thermal_policy`
|
||
|
|
|
||
|
|
On some ASUS laptops the `platform_profile` sysfs key maps to TTP in
|
||
|
|
non-obvious order (e.g. `quiet`→TTP2, `balanced`→TTP0,
|
||
|
|
`performance`→TTP1). veilor profiles write TTP directly and never
|
||
|
|
touch `platform_profile` to avoid the second-write override race.
|