summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
Diffstat (limited to 'pm')
-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