#! /bin/sh -e
# Power down HDA controller with corresponding Sigmatel/IDT codec after
# 10 idle seconds
# Author: Daniel T Chen <crimsun@ubuntu.com>

CODEC=/sys/module/snd_hda_codec_idt
PD=/sys/module/snd_hda_intel/parameters/power_save

[ -e $CODEC -a -w $PD ] || exit 0

if [ "$1" = true ]; then
    echo 10 > $PD
else
    echo 0 > $PD
fi
