rickysarraf / laptop-mode-tools

Power Savings tool for Linux
https://www.researchut.com/tags/laptop-mode-tools/
GNU General Public License v2.0
549 stars 47 forks source link

Cracking sound from mini-jack #133

Closed Butterneck closed 5 years ago

Butterneck commented 5 years ago

I have laptop-mode-tools 1.72.2-3 from [Arch's AUR](https://aur.archlinux.org/packages/laptop-mode-tools/)and if I connect my mini-jack earphones I hear a noisy crackling sound. If I play some music or any audio file the crackling sound disappears, but when the music is stopped after few seconds it reappears. Already tried to disable intel-hda-powersave and ac97-powersave modules, but I couldn't get rid of this annoying sound. Only entirely removing laptop-mode-tools I can use my laptop with earphones.

rickysarraf commented 5 years ago

You mean there is a continuous noise, that is heard a couple of seconds after the music stops playing ? If it is related to the sound card, it should have stopped after you disabled the respective modules.

Can you share the journal logs for laptop-mode-tools ? Also some more details about your hardware ? I've not had any such issues nor have I had any such reports yet.

Butterneck commented 5 years ago

Yes, continuous noise. For journal log do you mean the output of laptop_mode status? If yes this is the output:

Mounts:
   /dev/nvme0n1p5 on / type ext4 (rw,relatime)
   /dev/nvme0n1p2 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)

Drive power status:
   Cannot read /dev/[hs]d[abcdefgh], permission denied - /usr/bin/laptop_mode needs to be run as root

(NOTE: drive settings affected by Laptop Mode cannot be retrieved.)

Readahead states:
   /dev/nvme0n1p5: 128 kB
   /dev/nvme0n1p2: 128 kB

Laptop Mode Tools is allowed to run: /var/run/laptop-mode-tools/enabled exists.

/proc/sys/vm/laptop_mode:
   2

/proc/sys/vm/dirty_ratio:
   60

/proc/sys/vm/dirty_background_ratio:
   1

/proc/sys/vm/dirty_expire_centisecs:
   60000

/proc/sys/vm/dirty_writeback_centisecs:
   60000

/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu2/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu2/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu3/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu3/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu5/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu5/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu6/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu6/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu7/cpufreq/cpuinfo_max_freq:
   4000000

/sys/devices/system/cpu/cpu7/cpufreq/cpuinfo_min_freq:
   400000

/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu4/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu5/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu6/cpufreq/scaling_governor:
   powersave

/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:
   powersave

/proc/acpi/button/lid/LID0/state:
   state:      open

/sys/class/power_supply/ADP0/online:
   0 

About hardware I'm using Xiaomi mi notebook pro (i7 8550u, Mx150, 16GB)

rickysarraf commented 5 years ago

No. this is not the output I'm looking for. Please enable verbose logging in /etc/laptop-mode/laptop-mode.conf by setting VERBOSE_OUTPUT=1. Then restart laptop-mode.service.

Then, share the output of: journalctl --unit laptop-mode.service

Butterneck commented 5 years ago

Sorry, here is the output

rickysarraf commented 5 years ago
ott 02 14:40:18 mi-arch laptop-mode[11648]: Invoking module /usr/share/laptop-mode-tools/modules/intel-hda-powersave.
ott 02 14:40:18 mi-arch laptop_mode[11335]: Invoking module /usr/share/laptop-mode-tools/modules/intel-hda-powersave.
ott 02 14:40:18 mi-arch laptop-mode[11662]: Executing comand
ott 02 14:40:18 mi-arch laptop_mode[11335]: Executing comand
ott 02 14:40:18 mi-arch laptop_mode[11335]: Intel HDA power save mode enabled with timeout 2.
ott 02 14:40:18 mi-arch laptop_mode[11335]: Intel HDA Controller power save set to Y.

So you seem to have an Intel HDA sound card, whcih is a very common one in use today. I'm using the same and haven't run into any problem.

You mentioned initially that you disabled this module. But from the logs, it looks like this module is still invoked. Can you please check and report back the actual state ?

Also, check to see if disabling the runtime-pm module solves your problem ? As far as I see, there's nothing wrong with laptop-mode-tools here. It seems like your device may not be playing well with power saving mode. We definitely need to narrow down what in laptop-mode-tools is triggering the power saving for your sound card. At this moment, you have 2 suspects: intel-hda-powersave and runtime-pm

Butterneck commented 5 years ago

Yes, you are right, it was enabled because I had reinstalled it, but as you can see here it is now disabled and I continue to hear the noise. --Update-- Disabling runtime-pm solves the problem, thank you very much. Now I can also reenable intel-hda-powersave without any annoying sound

rickysarraf commented 5 years ago

I'm glad you were able to work around it. But remember, disabling runtime-pm comes at the cost of additional power consumption. You may want to check under /sys/bus/pci/devices/ on which devices power saving is causing this problem, and only disable that device in runtime-pm.conf. It may be a repetitive task to determine the actual device, but if you can, you would get much better battery backup.

As for this bug report, I am closing it. Thanks.