/etc/pm/power.d/kms_powermode is in powernap-common 2.18-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/bin/sh
#
# kms_powersave: this script switchs between GPU power mode
#
# Copyright (C) 2011 Mathieu Bérard
#
# Authors: Mathieu Bérard <mathieu@mberard.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Only support radeon kms driver pm modes for now.
# The sysfs interface is explained here, I highly recommend reading it
# before tweaking this script:
# http://lists.freedesktop.org/archives/dri-devel/2010-May/000492.html
#Full power, default profile mode
#Laptops may benefit from using FULL_PROFILE="auto"
FULL_METHOD="profile"
FULL_PROFILE="default"
#Alternativly dynpm mode
#FULL_METHOD="dynpm"
#FULL_PROFILE="default"
#Powersave mode
LOW_METHOD="profile"
LOW_PROFILE="low"
DRM_PATH="/sys/class/drm/card0/device"
DRM_DRIVER="${DRM_PATH}/driver"
METHOD_SYSFILE="${DRM_PATH}/power_method"
PROFILE_SYSFILE="${DRM_PATH}/power_profile"
[ -e $DRM_DRIVER ] && [ -w $METHOD_SYSFILE ] && [ -w $METHOD_SYSFILE ] || exit 0
#At this point we should be using the radeon driver, but let's be extra carefull.
DRM_DRIVER=`readlink -f ${DRM_DRIVER}`
DRM_DRV_NAME=`basename ${DRM_DRIVER}`
[ "$DRM_DRV_NAME" = "radeon" ] || exit 0
set_kms_power() {
echo $1 > $PROFILE_SYSFILE
echo $2 > $METHOD_SYSFILE
}
help() {
echo "Radeon KMS power mode to save power."
}
case $1 in
true)
set_kms_power $LOW_PROFILE $LOW_METHOD ;;
false)
set_kms_power $FULL_PROFILE $FULL_METHOD ;;
help)
help;;
*)
exit $NA ;;
esac
|