Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Automatically set powersaving options on startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 140
Location: Finland

PostPosted: Tue Jul 23, 2013 9:08 am    Post subject: Automatically set powersaving options on startup Reply with quote

Powertop suggests the following powersaving options. How can i automatically set these options on startup? Is it possible with sysctl.conf or is there some other configs for these options?

Code:
ethtool -s eth0 wol d;
iw wlan0 set power_save on;
echo "disable" > '/proc/acpi/ibm/bluetooth';
echo '60' > '/sys/module/snd_hda_intel/parameters/power_save';

echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy';
echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy';

echo 'auto' > '/sys/bus/usb/devices/1-6/power/control';
echo 'auto' > '/sys/bus/usb/devices/4-1/power/control';
echo 'auto' > '/sys/bus/usb/devices/4-2/power/control';

echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.7/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:15:00.5/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:15:00.4/power/control';

_________________
https://github.com/defer-
Back to top
View user's profile Send private message
amospalla
n00b
n00b


Joined: 08 Mar 2013
Posts: 26

PostPosted: Tue Jul 23, 2013 9:51 am    Post subject: Reply with quote

What about a shell script in /etc/local.d named for example /etc/local.d/powersaving.start with the content you wrote ?
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 535

PostPosted: Wed Jul 24, 2013 8:46 am    Post subject: Reply with quote

/etc/udev/rules.d/10-local-powersave.rules (adjust for your own USB devices):
Code:
## PCI device autosuspend
ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"

## USB device autosuspend
# Only include known onboard devices of the Thinkpad W700/W701
# as other devices may not handle autosuspend well (input devices)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0765", ATTR{idProduct}=="5001", ATTR{power/control}="auto" # Colorimeter
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="08ff", ATTR{idProduct}=="2810", ATTR{power/control}="auto" # Fingerprint Reader (W700)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="147e", ATTR{idProduct}=="2016", ATTR{power/control}="auto" # Fingerprint Reader (W701)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0a5c", ATTR{idProduct}=="2145", ATTR{power/control}="auto" # Bluetooth (W700)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0a5c", ATTR{idProduct}=="217f", ATTR{power/control}="auto" # Bluetooth (W701)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", ATTR{idProduct}=="1008", ATTR{power/control}="auto" # Lenovo Hub
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", ATTR{idProduct}=="480c", ATTR{power/control}="auto" # Webcam (W700)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", ATTR{idProduct}=="4816", ATTR{power/control}="auto" # Webcam (W701)
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", ATTR{idProduct}=="6004", ATTR{power/control}="auto" # Tablet
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="1d6b", ATTR{power/control}="auto"                          # USB Hub
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0020", ATTR{power/control}="auto" # Intel USB Hub


/etc/modprobe.d/local.conf:
Code:
options snd_hda_intel powersave=1


/etc/bluetooth/main.conf:
Code:
# What value should be assumed for the adapter Powered property when
# SetProperty(Powered, ...) hasn't been called yet. Defaults to true
####InitiallyPowered = true
InitiallyPowered = false

# Remember the previously stored Powered state when initializing adapters
####RememberPowered = true
RememberPowered = false


pm-utils takes care of the others when AC is unplugged:

To enable SATA ALPM (did produce hangs when entering suspend on one of my laptops): /etc/pm/config.d/local:
Code:
SATA_ALPM_ENABLE="true"


If the following command fails, add pcie_aspm=force to your kernel command line
Code:
echo powersave >/sys/module/pcie_aspm/parameters/policy


Wifi should switch to powersave mode by default
Back to top
View user's profile Send private message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 140
Location: Finland

PostPosted: Thu Jul 25, 2013 12:28 pm    Post subject: Reply with quote

Thanks for advices. Heres how i did :

/etc/udev/rules.d/10-local-powersave.rules
Code:

# PCI runtime power management
ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"

# USB autosuspend
ACTION=="add", SUBSYSTEM=="usb", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="60"

# SATA active link power management
SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"

# Wlan power save
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw %k set power_save on"

# Disable bluetooth
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"

# Disable wake-on-LAN
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/sbin/ethtool -s %k wol d"


/etc/local.d/powersave.start
Code:
echo "disable" > /proc/acpi/ibm/bluetooth

_________________
https://github.com/defer-
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum