I've run into a peculiar issue. Let me describe: (please read EDIT2 as it gives the most important piece of the situation)
- On boot, from GRUB I pass arguments
snd_hda_intel.power_save=0 snd_hda_intel.power_save_controller=N
Laptop mode tools starts up, power saving for snd_hda_intel is disabled:
See text file at https://pastebin.com/R6SMzTAT
/sys/module/snd_hda_intel/parameters/power_saveis set to 0, but the system still shows power saving behavior – the characteristic clicking in headphones a while after stopping sound playback, and again when starting sounding as the card powers on.If I use powertop, go to Tunables, it says Audio codec power management is off. Now, if here, pressing Enter is turn the power management on and then off, the issue is fixed, no more power saving. I'm puzzled why this is needed though. Also, maybe im being silly, but powertop claims it runs the command
echo '' > '/sys/module/snd_hda_intel/parameters/power_save';
to turn this off. Running this from the terminal however gives an error
bash: echo: write error: Invalid argumentI can do
echo '0' > /sys/module/snd_hda_intel/parameters/power_savebut that parameter is supposedly already set to 0, and this command doesn't fix the issue. I need to enable and disable in powertop.
Any explanation for this and how to fix it without having to do the powertop trick afer every boot? And why does powertop claim to run a command that gives an error when I try top execute it? Why is power saving going on when the power_save parameter is 0 (and power_save_controller=N too)?
Some more info:
Linux gentoo 4.19.1-gentoo #1 SMP Mon Nov 5 21:27:35 CET 2018 x86_64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz GenuineIntel GNU/Linux
Sound card:
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
EDIT: Also an interesting fact – if I do the powertop thing, and then stop laptop mode tools:
systemctl stop laptop-mode
that causes the power saving behavior to come back, and the powertop trick is needed. So clearly laptop mode tools does something weird here. Booting the system with laptop mode tools disabled makes everything okay too – no annoying power saving on the sound card.
EDIT2: Okay, i have no idea why powertop claims to do echo '', because after investigating the source code, it clearly does
ofstream file;
file.open("/sys/module/snd_hda_intel/parameters/power_save", ios::out);
file << 0;
file.close()
So there's nothing special about what it does. As expected running this code doesn't do anything, because it's the same as echo '0'. What fixes the problem and disables the power saving is 'flipping' the value of power_save parameter. So:
echo '1' > /sys/module/snd_hda_intel/parameters/power_save
echo '0' > /sys/module/snd_hda_intel/parameters/power_save
works. laptop-mode-tools must be doing something weird, but overall this has to be a bug in the driver, am I correct?