Skip to content

Instantly share code, notes, and snippets.

@amanjeev
Last active April 1, 2022 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amanjeev/69eeb3a37aadb403542a16903fd60cbb to your computer and use it in GitHub Desktop.
Save amanjeev/69eeb3a37aadb403542a16903fd60cbb to your computer and use it in GitHub Desktop.
Ryzen Gen 2 Lenovo ThinkPad - Systemd Service and Timer for Power management

Download and build the tool

https://github.com/FlyGoat/RyzenAdj

Deploy this tool somewhere on your machine.

Define the service

Add this to your /etc/systemd/system/ryzenadj.service

[Unit]
Description=Ryzen power mamangement
Wants=ryzenadj.timer

[Service]
Type=oneshot
ExecStart=/home/aj/bin/ryzenadj \
  --fast-limit=27000 \
  --slow-limit=27000 \
  --stapm-limit=27000 \
  --tctl-temp=96 \
  --apu-skin-temp=70

[Install]
WantedBy=multi-user.target

Define the Systemd Timer for above service

Add this to your /etc/systemd/system/ryzenadj.timer

[Unit]
Description=Ryzen power mamangement
Requires=ryzenadj.service

[Timer]
Unit=ryzenadj.service
OnCalendar=*:0/15

[Install]
WantedBy=timers.target

Enable even when the user is not logged in

loginctl enable-linger username

Reload

sudo systemctl daemon-reload

Enable the time

sudo systemctl enable ryzenadj.timer --now

This should run the tool every 15 minutes.

Check timer

sudo systemctl list-timers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment