-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
The attached patch adds a suggestion support for the intel hda
controller found in many systems.
Best regards,
Erik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkmkS2oACgkQN7qBt+4UG0FzjACdFJD5XEOjQ/zQAC4ZGUuMZDu7
ejsAnR4yTbJEnCh1ZaEIRDxBVaA5aQzz
=3sKb
-----END PGP SIGNATURE-----
Index: powertop.c
===================================================================
--- powertop.c (revision 298)
+++ powertop.c (working copy)
@@ -978,6 +978,12 @@
_("Suggestion: Enable the CONFIG_SND_AC97_POWER_SAVE kernel configuration option.\n"
"This option will automatically power down your sound codec when not in use,\n"
"and can save approximately half a Watt of power."), 20);
+ if (!access("/sys/module/snd_hda_intel", F_OK) &&
+ access("/sys/module/snd_hda_intel/parameters/power_save", F_OK))
+ suggest_kernel_config("CONFIG_SND_HDA_POWER_SAVE", 1,
+ _("Suggestion: Enable the CONFIG_SND_HDA_POWER_SAVE kernel configuration option.\n"
+ "This option will automatically power down your sound codec when not in use,\n"
+ "and can save approximately half a Watt of power."), 20);
suggest_kernel_config("CONFIG_IRQBALANCE", 0,
_("Suggestion: Disable the CONFIG_IRQBALANCE kernel configuration option.\n" "The in-kernel irq balancer is obsolete and wakes the CPU up far more than needed."), 3);
suggest_kernel_config("CONFIG_CPU_FREQ_STAT", 1,
@@ -1034,6 +1040,7 @@
if (maxsleep > 15.0)
suggest_hpet();
suggest_ac97_powersave();
+ suggest_hda_intel_powersave();
suggest_wireless_powersave();
suggest_ondemand_governor();
suggest_noatime();
Index: powertop.h
===================================================================
--- powertop.h (revision 298)
+++ powertop.h (working copy)
@@ -50,6 +50,7 @@
void suggest_nmi_watchdog(void);
void suggest_hpet(void);
void suggest_ac97_powersave(void);
+void suggest_hda_intel_powersave(void);
void suggest_wireless_powersave(void);
void suggest_ondemand_governor(void);
void suggest_noatime(void);
Index: misctips.c
===================================================================
--- misctips.c (revision 298)
+++ misctips.c (working copy)
@@ -176,6 +176,67 @@
fclose(file);
}
+void hda_intel_power_on(void)
+{
+ FILE *file;
+ file = fopen("/sys/module/snd_hda_intel/parameters/power_save", "w");
+ if (!file)
+ return;
+ fprintf(file,"1");
+ fclose(file);
+ if (access("/dev/dsp", F_OK))
+ return;
+ file = fopen("/dev/dsp", "w");
+ if (file) {
+ fprintf(file,"1");
+ fclose(file);
+ }
+}
+
+void hda_intel_power_controller_on(void)
+{
+ FILE *file;
+ file = fopen("/sys/module/snd_hda_intel/parameters/power_save_controller", "w");
+ if (!file)
+ return;
+ fprintf(file,"Y");
+ fclose(file);
+}
+
+void suggest_hda_intel_powersave(void)
+{
+ FILE *file;
+ char buffer[1024];
+ file = fopen("/sys/module/snd_hda_intel/parameters/power_save", "r");
+ if (!file)
+ return;
+ memset(buffer, 0, 1024);
+ if (!fgets(buffer, 1023, file)) {
+ fclose(file);
+ return;
+ }
+ if (buffer[0]=='N' || buffer[0]=='0') {
+ add_suggestion( _("Suggestion: enable High-definition Intel codec powersave mode by executing the following command:\n"
+ " echo 1 > /sys/module/snd_hda_intel/parameters/power_save \n"
+ "or by passing power_save=1 as module parameter."), 25, 'A', _(" A - Turn HDA Intel powersave on "), hda_intel_power_on);
+ }
+ fclose(file);
+
+ file = fopen("/sys/module/snd_hda_intel/parameters/power_save_controller", "r");
+ if (!file)
+ return;
+ memset(buffer, 0, 1024);
+ if (!fgets(buffer, 1023, file)) {
+ fclose(file);
+ return;
+ }
+ if (buffer[0]=='N') {
+ add_suggestion( _("Suggestion: enable High-definition Intel codec controller powersave mode by executing the following command:\n"
+ " echo 1 > /sys/module/snd_hda_intel/parameters/power_save \n"
+ "or by passing power_save=1 as module parameter."), 25, 'A', _(" A - Turn HDA Intel powersave on "), hda_intel_power_controller_on);
+ }
+}
+
void noatime_on(void)
{
system("/bin/mount -o remount,noatime,nodiratime /");
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power