linux-samus icon indicating copy to clipboard operation
linux-samus copied to clipboard

Sound Settings

Open roobyz opened this issue 8 years ago • 47 comments

Thanks for updating the kernel to the latest version. After upgrading, everything is working except for sound. The instructions for configuring sound were obviously simplified. I'm guessing that the issue is that my sound is still set for the custom configuration that was required for linux-samus 4.5, which is incompatible with 4.7-2. Any suggestions? Are there any instructions to switch the sound configurations? Thank again!

roobyz avatar Aug 17 '16 04:08 roobyz

This worked for me, I've just updated to 4.7-2 and hit this same issue.

try editing the file /etc/pulse/default.pa and comment out the following two lines.

 55  #load-module module-alsa-source device=hw:0,1
 56  #load-module module-alsa-source device=hw:0,2

Then start the Pulse-Audio server $ pulseaudio

sambles avatar Aug 17 '16 11:08 sambles

You'll probably also want to nuke /etc/acpi/{actions/samus.sh,events/samus}.

EDIT: /opt/samus and /usr/share/alsa/ucm/bdw-rt5677 can probably go as well. Am I missing anything?

ehegnes avatar Aug 17 '16 11:08 ehegnes

Headphone Jack/Speaker toggle isn't working for me. I guess it means tweaking an acpi event handling script?

sambles avatar Aug 17 '16 12:08 sambles

Thanks, that mostly worked... here is what I did:

  1. edit the file /etc/pulse/default.pa and ensure these lines are commentted out:
#load-module module-alsa-sink device=hw:0,0
#load-module module-alsa-source device=hw:0,1
#load-module module-alsa-source device=hw:0,2
  1. remove the following folders: /opt/samus and /usr/share/alsa/ucm/bdw-rt5677
  2. edit the file /etc/acpi/handler.sh and remove any samus entries

As sambles pointed out, the missing piece is... add entries in /etc/acpi/handler.sh for the jack/headphone) event handlers plug) and unplug) with ones that work.

Could be useful to have these instructions on the README.md file for those upgrading kernels. :)

roobyz avatar Aug 17 '16 15:08 roobyz

Yes please! :)

raphael avatar Aug 17 '16 15:08 raphael

@raphael ... I proposed a README.md change, as requested. This is my first... so hopefully I got it correct. :)

roobyz avatar Aug 17 '16 18:08 roobyz

@roobyz I'm not seeing a PR - maybe you forgot to open it?

raphael avatar Aug 18 '16 01:08 raphael

Yeah... that's definitely weird, because I checked you repo and my repo around lunch time and it was good... but then around dinner time it looked like it disappeared.

Give me a few minutes and I'll recreate... ;)

roobyz avatar Aug 18 '16 04:08 roobyz

i'm getting no sound of my speakers. this is a fresh install. pavucontrol says there's sound coming out.

as for the headphones not working, i get this from dmesg

$ dmesg | grep jack
[    6.416834] rt5677 i2c-RT5677CE:00: Can't add headphone jack gpio
[    6.416882] rt5677 i2c-RT5677CE:00: Can't add mic jack gpio

wulvyrn avatar Aug 18 '16 17:08 wulvyrn

@wulvyrn have you checked with alsamixer that the outputs are not muted?

raphael avatar Aug 18 '16 17:08 raphael

i don't believe so. I'm am willing to be wrong. amixer output below and alsamixer screenshot.

 amixer 
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 65536 [100%] [on]
  Front Right: Playback 65536 [100%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 65536 [100%] [on]
  Front Right: Capture 65536 [100%] [on]

2016-08-18-130243_1276x812_scrot

wulvyrn avatar Aug 18 '16 18:08 wulvyrn

@raphael Alsamixer screenshot.

Stereo DAC MIXL DAC1 L (was muted) umuting sound plays.

On a fresh install, this was not easy to find. 2016-08-18-133733_1276x811_scrot

command line method

amixer -c 0 cget name='Stereo DAC MIXL DAC1 L Switch' 
numid=190,iface=MIXER,name='Stereo DAC MIXL DAC1 L Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

i used this to enable both channels

amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on

wulvyrn avatar Aug 18 '16 18:08 wulvyrn

I went back and did a fresh install. these are the initial settings

amixer -c 0 cget name='Stereo DAC MIXL DAC1 L Switch'
amixer -c 0 cget name='Stereo DAC MIXR DAC1 L Switch'
amixer -c 0 cget name='DAC1 MIXL DAC1 Switch' 
amixer -c 0 cget name='DAC1 MIXR DAC1 Switch'
numid=190,iface=MIXER,name='Stereo DAC MIXL DAC1 L Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=196,iface=MIXER,name='Stereo DAC MIXR DAC1 L Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=176,iface=MIXER,name='DAC1 MIXL DAC1 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=178,iface=MIXER,name='DAC1 MIXR DAC1 Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

wulvyrn avatar Aug 18 '16 22:08 wulvyrn

@wulvyrn : If you haven't noticed since you posted about it, I wanted to mention that at least in terms of getting audio to play, the messages Can't add {headphone,mic} jack gpio are a red herring. I see them despite both laptop-speaker and headphone audio working. @reynhout observed based on reading the code, and I agree, that they appear to do with the detection of headphones being plugged/unplugged. So, headphones can be inserted and audio will play through them, it just appears that the kernel won't notice this event happening. So that appears to still need fixing.

ghost avatar Aug 18 '16 22:08 ghost

Lastly, I have audio working with plain ALSA, without pulseaudio, and just wanted to mention that in case you hoped to work with something simpler.

ghost avatar Aug 18 '16 22:08 ghost

@genkimarshall thanks, i'll uninstall pulseaudio and see if it works that way. thanks.

wulvyrn avatar Aug 18 '16 22:08 wulvyrn

@genkimarshall on a fresh install, alsa still has the same results I reported above and no audio from the speakers. i also noticed the audio is swapped from the speakers by enabling and disabling these commands:

amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on

i'll have to look for a solution on that. I have not tried the headphones figuring getting speaker audio was the 1st priority and then headphone 2nd.

wulvyrn avatar Aug 18 '16 23:08 wulvyrn

From a fresh install with no preexisting custom sound config, I needed to enable these ten ALSA channels:

  • DAC1 MIXL DAC1
  • DAC1 MIXR DAC1
  • Stereo DAC MIXL DAC1 L
  • Stereo DAC MIXL DAC1 R
  • Stereo DAC MIXL DAC2 L
  • Stereo DAC MIXL ST L
  • Stereo DAC MIXR DAC1 L
  • Stereo DAC MIXR DAC1 R
  • Stereo DAC MIXR DAC2 R
  • Stereo DAC MIXR ST R

The first two are fairly early in the alsamixer scroll. The last eight are toward the end. Or you can enable them from the command line.

That's all the config required to get audio out. The bdw-rt5677 card shows up in slot 1 instead of 0, so I might end up replacing the /etc/modules.d file.

reynhout avatar Aug 18 '16 23:08 reynhout

using just alsa, i'm having a hard time setting the volume up and down to be consistent. so far, being able to mute or unmute or toggle Master has eluded me. it was working nicely with i3status and pulseaudio...

wulvyrn avatar Aug 18 '16 23:08 wulvyrn

A few thoughts:

  1. my speaker sound is working fine
  2. After putting these notes on the README...
  • remove the following folders: /opt/samus and /usr/share/alsa/ucm/bdw-rt5677
  • settings to toggle headphone/speaker during plug) and unplug) events still need to be implemented
  1. I started experimenting on how I might get the headphones to toggle... so I agree that "Can't add headphone jack gpio" is a red herring because:
  • I copied /usr/share/alsa/ucm/bdw-rt5677 back and learned than I could get the headphones working with alsaucm -c bdw-rt5677 set _verb HiFi set _enadev Headphone however I couldn't get the speakers back with alsaucm -c bdw-rt5677 set _verb HiFi set _disdev Headphone
  • I had to reboot after removing /usr/share/alsa/ucm/bdw-rt5677 again
  • after exploring the folder I saw it contained HIFI.conf and realized that the setting for cset "name='Speaker Switch' on" must be broken somehow.

I'm not an expert on those files, but I believe that if we correct HIFI.conf we could use the following acpi setting to get the toggle working:

    jack/headphone)
        case "$3" in
            plug)
                logger "headphone plugged"
                alsaucm -c bdw-rt5677 set _verb HiFi set _enadev Headphone
                ;;
            unplug)
                logger "headphone unplugged" 
                alsaucm -c bdw-rt5677 set _verb HiFi set _disdev Headphone
                ;;
            *)
                logger "ACPI action undefined: $3"
                ;;
        esac
        ;;

roobyz avatar Aug 19 '16 06:08 roobyz

vice changing the ten channels as @reynhout posted above, i found enabling two produced correct left and right speakers.

amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on

to test, i was using:

speaker-test -c2 -l1 -twav

note below: the two top ones are turn on from the default installation. this is the script i'm currently using (there are also other entries from testing i.e. the off ones):

#amixer -c 0 cset name='DAC1 MIXL DAC1 Switch' on
#amixer -c 0 cset name='DAC1 MIXR DAC1 Switch' on

amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' on
amixer -c 0 cset name='Stereo DAC MIXL DAC2 L Switch' off
amixer -c 0 cset name='Stereo DAC MIXL ST L Switch' off
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 R Switch' off
amixer -c 0 cset name='Stereo DAC MIXR DAC2 R Switch' off
amixer -c 0 cset name='Stereo DAC MIXR ST R Switch' off

wulvyrn avatar Aug 19 '16 09:08 wulvyrn

@wulvyrn I took what you posted last with what I got from HiFi.conf and created a brute force approach.

I created two scripts:

  1. /usr/local/bin/samus_headphones_ena.sh to enable headphones:
#!/bin/sh

amixer -c 0 cset name='Speaker Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' off
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' off
amixer -c 0 cset name='OUT1 Playback Switch' on
amixer -c 0 cset name='OUT2 Playback Switch' on
amixer -c 0 cset name='Headphone Switch' on
  1. /usr/local/bin/samus_headphones_dis.sh to enable speakers:
#!/bin/sh

amixer -c 0 cset name='Headphone Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on
amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' off
amixer -c 0 cset name='Stereo DAC MIXR DAC1 R Switch' off
amixer -c 0 cset name='Speaker Switch' on

The scripts work as expected. All we need now is an elegant approach. :)

I noticed that my computer is not registering any headphone plug and unplug events, so I need to manually run the scripts when I swap headphones/speakers. I think this may be related to "Can't add headphone jack gpio" kernel error. My theory is that although headphones are working, the kernel doesn't recognize them as active so doesn't send the events.

Any ideas?

roobyz avatar Aug 19 '16 14:08 roobyz

I'm also having difficulties getting sound to work. alsa programs won't start and my dmesg is flooded with this message:

[ 1722.498164] haswell-pcm-audio haswell-pcm-audio: ipc: --message timeout-- ipcx 0x83000000 isr 0x00000000 ipcd 0x00000000 imrx 0x7fff0000
[ 1722.498172] haswell-pcm-audio haswell-pcm-audio: error: stream commit failed
[ 1722.498176]  System PCM: error: failed to commit stream -110
[ 1722.498180] haswell-pcm-audio haswell-pcm-audio: ASoC: haswell-pcm-audio hw params failed: -110
[ 1722.498183]  System PCM: ASoC: hw_params FE failed -110

Looking around, I saw that it might be related to gdm https://bugs.archlinux.org/task/48936.

Has anyone had the same issue?

nilswiersma avatar Aug 19 '16 20:08 nilswiersma

@nilswiersma I had similar issues running just alsa. I reverted back to pulseaudio pulseaudii-alsa to no errors per say and a working volume control commands as referenced in the readme. Note: I'm not running GDM, just i3.

wulvyrn avatar Aug 19 '16 21:08 wulvyrn

You removed alsa completely?

I've also tried recompiling with CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y as suggested, but it did not solve anything so far.

nilswiersma avatar Aug 19 '16 22:08 nilswiersma

Pulseaudio and pulseaudio-alsa with alsa-uitils is my base sound packages.

wulvyrn avatar Aug 19 '16 22:08 wulvyrn

Ah, I think removing all the alsa-* packages and then reinstalling them has fixed the issue.

Now to get headphones and displayport audio to work..

nilswiersma avatar Aug 19 '16 22:08 nilswiersma

Tested out the new 4.7.2 kernel, sound output works better this time out of the box. Observations with initial default (I believe) configurations:

  • Still have to manually switch between headphones and speakers in Volume Control from the tray (no auto plugging detection)
  • When using headphones, the output is mono instead of stereo, testing with speaker-test -c2 -l -twav
  • There is no microphone detected at all so no audio input with initial config.

chepurko avatar Aug 21 '16 07:08 chepurko

Upgrading from linux-image-4.4.2ph went without a hitch following the instructions from @roobyz. As @chepurko stated, the headphone switch is still manual but the mic is detected, and in my case does seem to work as expected. If anyone needs information from my box I'm happy to help.

iflowfor8hours avatar Aug 23 '16 08:08 iflowfor8hours

I am still receiving the dmesg output mentioned before. I think I have tried all different permutations of removing and adding pulseaudio and alsa. Removing all of them, rebooting, enabling the channels and doing the speak test works -- however when I open any other program that wants to send audio to the speakers the error spam reappears.

Anyone got any ideas where this issue could stem from?

nilswiersma avatar Aug 24 '16 16:08 nilswiersma