summaryrefslogtreecommitdiff
path: root/pm/power.d/sata_alpm
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-03 16:30:32 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-05 13:42:46 -0500
commit381ff7b01f459e5767d927386dad48e52d2c5f02 (patch)
tree061be870dbb169bac14d9eb9f10bd5fb57af454a /pm/power.d/sata_alpm
parent43e64366c2c5c9831c041fb571bf7e92ad3598c2 (diff)
Add sata_alpm control hook.
Diffstat (limited to 'pm/power.d/sata_alpm')
-rw-r--r--pm/power.d/sata_alpm31
1 files changed, 31 insertions, 0 deletions
diff --git a/pm/power.d/sata_alpm b/pm/power.d/sata_alpm
new file mode 100644
index 0000000..e102998
--- /dev/null
+++ b/pm/power.d/sata_alpm
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. "${PM_FUNCTIONS}"
+
+SATA_ALPM_ENABLE=${SATA_ALPM_ENABLE:-true}
+
+help() {
+cat <<EOF
+SATA link ALPM parameters:
+
+SATA_ALPM_ENABLE = whether to use SATA ALPM on battery.
+Defaults to "true".
+
+EOF
+}
+
+set_sata_alpm() {
+ for f in /sys/class/scsi_host/host*/link_power_management_policy; do
+ [ -w "$f" ] || continue
+ echo "$1" > "$f"
+ done
+}
+
+case $1 in
+ true) [ "$SATA_ALPM_ENABLE" = true ] && set_sata_alpm min_power;;
+ false) set_sata_alpm max_performance;;
+ help) help;;
+ *) exit $NA;;
+esac
+
+exit 0 \ No newline at end of file