

9·
8 months agoI’m not familiar with Radeon PowerPlay, so I don’t know if there is a proper way to solve this, but you should be able to make a systemd system service to run the upp command on boot.
To do so, I think you can use the following:
[Unit]
Description=Run my_user_script
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
[Service]
Type=oneshot
ExecStart=upp -p /sys/class/drm/card1/device/pp_table set --write smc_pptable/SocketPowerLimitAc/0=312 smc_pptable/SocketPowerLimitDc/0=293 smc_pptable/TdcLimit/0=300 smc_pptable/FreqTableSocclk/1=1350 smc_pptable/FreqTableFclk/1=2000 smc_pptable/FclkBoostFreq=2000
[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
To configure this service:
- Save the text (using sudo/root) to a new
.servicefile in/etc/systemd/service. (e.g./etc/systemd/system/my_update_pp.service) - run
sudo systemctl daemon-reloadto tell systemd to re-read the service files - run
sudo systemctl restart my_update_pp.serviceto manually run the service - run
sudo systemctl enable my_update_pp.serviceto tell systemd to run your service automatically on boot/wake (WantedBytells systemd when it should include the unit/service,After,Wants,Requires, andBeforehelp systemd decide the order to run all the units/services)
Notes
- Usually for simple systemd services, you can omit
Afterand setWantedByto justWantedBy=multi-user.target, but if you also need to runuppafter sleep or hibernate, then you probably need something more complex. I copied theAfterandWantedByfrom a stackexchange answer, but I haven’t tried using those targets before. You might have to addmulti-user.targetto theWantedBylist. - I don’t actually know if you need to run
uppafter sleep/hibernate. Running on boot might be sufficient. - I think you can skip the
chmodif you runuppas sudo/root. Systemd system services run as root by default. - I don’t know how safe it is to mess with PowerPlay during boot. My gut says it’s probably fine, but it also seems like something that could cause graphics to not work. Tread carefully.
References:
- https://unix.stackexchange.com/questions/152039/how-to-run-a-user-script-after-systemd-wakeup
- https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html
- https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html
- https://www.man7.org/linux/man-pages/man7/systemd.special.7.html
Try keyd or kmonad. I do all my key mapping on the keyboard itself, so I can’t vouch for either.