tirdc (tirdc) wrote,

Setting the power_profile for your Radeon graphics card using systemd

As of now pretty much everyone has heard of systemd, the next generation init system for Linux. Next to the fact that if provides a really fast boot (on different systems tested approximately 50% of the original boot time) and a clean solution for dependencies of services it also offers the capability to write services in a very simple manner. So today we are going to write a simple service to set your power profile (as introduced last year). Note that you (obviously) need a systemd enabled system like Fedora 15.

First of all we need to know how to set set power profile. This requires three things: a fairly recent kernel, a Radeon graphics card that supports power modes on Linux and sysfs enabled in your kernel. A simple way to test this is to execute the following command:

test -f /sys/class/drm/card0/device/power_profile && echo "power_profile supported" || echo "power_profile NOT supported"

Note: This assumes that your Radeon card is the "first card" (i.e. "card0"). This might vary from system to system.

The will show you if the power modes are supported by your system. If your system is supported you need two files:

1.) The systemd service file in /etc/systemd/system/radeon-power_profile
Description=Radeon Power Profile

ExecStart=/usr/local/sbin/radeon-power_profile low


2.) A small helper script to set the power mode in /usr/local/sbin/radeon-power_profile

EXEC_NAME=`basename $0`;


append_profile() {
        local PROFILE=$1
        echo -n "  ${PROFILE}"
        if [ "x${CURRENT_PROFILE}x" == "x${PROFILE}x" ]; then
                echo -n " (current)"

if [ $# != 1 ]; then
        echo "usage: ${EXEC_NAME} "
        echo "Valid profiles:"
        for AVAILABLE_PROFILE in low high default auto; do
                append_profile ${AVAILABLE_PROFILE}
        exit 0


if [ "x${PROFILE}x" == "xlowx" ] || [ "x${PROFILE}x" == "xhighx" ] || [ "x${PROFILE}x" == "xautox" ] || [ "x${PROFILE}x" == "xdefaultx" ]; then
        echo "${PROFILE}" > ${TARGET}
        logger "[${EXEC_NAME}] WARN: Invalid power_profile '${PROFILE}'"
        exit 1

exit 0

Note: If your card is not "card0" you need to change the value of TARGET to the proper value.

After you create the scripts you should test if this works for you. The service is meant to set your power mode to low which is the best for mobile devices running on battery or to cool down your system. To test the service call:


This will print out which profile is currently active ("default" in most cases). Now you can start the service

systemctl start radeon-power_profile.service

This will most likely cause a single flicker of the display (this might be a bug as it does not happen when GPU and memory clock changes happen on Microsoft Windows). After that a second call to /usr/local/sbin/radeon-power_profile should show your clock is now at "low". Verify that your system is running stable and smooth as before. Note: Setting the power mode to low will obviously cause your 3D rendering to be slower. If everything works as expected you can enable the service by default using

systemctl enable radeon-power_profile.service

Now your system will set the power mode during boot. On my systems it really extended the battery life time and my passive (fan-less) card went from 70°C to 45°C.

  • Update dri-log Android app

    I'd like to announce an update for the dri-log Android app users, the mobile version the DRI IRC log. The app recently gained with a complete…

  • Clover moves to the main mesa repository

    Until now Clover was developed in a separate git repository (and some forks on github as well). But today Francisco Jerez started preparing to add…

  • DRI-log Android App

    Did you ever wonder what is discussed between graphics hardware developers? If so, you might have found the IRC Logs. It is a handy and small web…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded