#! /bin/bash
# 
# Laptop mode tools module, called from /usr/sbin/laptop_mode.
# Configuration in /etc/laptop-mode/conf.d/ac97-powersave.conf.
#
# PURPOSE: enable power saving mode for the Intel AC97 integrated audio.
#

if [ x$CONTROL_AC97_POWER == x1 ] ; then
	if [ -w /sys/module/snd_ac97_codec/parameters/power_save ]; then
		echo 1 > /sys/module/snd_ac97_codec/parameters/power_save
		echo "AC97 power save mode enabled." >> $OUTPUT
	else
		echo "AC97 power saving is not available. Perhaps CONFIG_SND_AC97_POWER_SAVE option"
		echo "is not set in the kernel config, or the snd_ac97_codec module is not loaded." >> $OUTPUT
	fi
else
	echo "AC97 audio power setting is disabled." >> $OUTPUT
fi
