GalliumOS / galliumos-distro

Docs, issues, and artwork sources for GalliumOS
https://galliumos.org/
GNU General Public License v2.0
347 stars 11 forks source link

Sound on Skylake #379

Open simonheb opened 7 years ago

simonheb commented 7 years ago

This is to concentrate efforts and document progress on the sound issues related to skylake and GalliumOS. All other skylake users are asked to also contribute their logs and use this issue to document progress towards finding a solution.

I am runnning a plain GalliumOS 2.1 via chrx on a CAVE model (Asus C302CA).

Right after the install, the system looks as follows:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ lspci | grep  -P audio\|snd\|sound\|audio
00:1f.3 Multimedia audio controller: Intel Corporation Sunrise Point-LP HD Audio (rev 21)

$ dmesg | grep -P audio\|snd\|sound\|audio
[    4.433088] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.559255] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input7
[    4.559335] input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input8
[    4.559421] input: HDA Intel PCH HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input9

My first step is trying out he solution @volfyd suggested for Caroline (https://github.com/GalliumOS/galliumos-distro/issues/274#issuecomment-311751198), I will post the result here.

reynhout commented 6 years ago

@kstenerud Unfortunately, also true on other Skylakes. Crappy workaround on CAROLINE and SENTRY is to install an SD card (you should also see tons of mmc1 timeouts in the logs -- and there is no mmc1 device). This is the kernel bug that's holding up package promotion. :(

kstenerud commented 6 years ago

Hmm that's unfortunate. I actually have my home dir on an SD card plugged into the side of the machine, but this workaround doesn't help on CAVE :/

reynhout commented 6 years ago

@kstenerud Hm, then maybe something else is going on too. When we've resolved the known kernel bug, we might need some system logs from your shutdown process to figure it out.

heavyslugs commented 6 years ago

@reynhout I've tried some config changes but a little hesitant to dive deep because I ended up bricking my CBP a while back due to my carelessness

reynhout commented 6 years ago

@heavyslugs Only a firmware update error can brick your device.

Do you see the non-HDMI device in aplay -l? You might try sudo apt-get install --reinstall galliumos-skylake.. Have you made any modifications trying to get sound to work, prior to packaged support?

In the worst case, you might need to reinstall. I've tested on CAROLINE repeatedly, it should definitely work.

heavyslugs commented 6 years ago

@reynhout yeah I'm pretty sure my tinkering before had nothing to do with it, it was a hardware failure (the power button wouldn't work even with pwr + refresh) so I guess overall its a unnecessary fear. I do not have my CBP with me at the moment but I remember only seeing my Fiio e17k (dac/amp). The only modification I made was alsaucm -c sklnau8825adi set _verb HiFi set _enadev Speaker In the playback device menu it said something close to skl_nau88l25 n/a + n/a. Sorry I can't give much meaningful logs atm :/

reynhout commented 6 years ago

alsaucm -c sklnau8825adi set _verb HiFi set _enadev Speaker

Hmm, I'm not sure if that would be related. The devices do report empty names in ALSA. We do a alsaucm -c sklnau8825adi set _verb HiFi, and then several csets to select the port.

Theoretically, you could override any previous config by manually selecting the Default Sink from pasystray (launched from the speaker icon in the system tray), and the Port from pavucontrol (launched from "Volume Control..." in pasystray).

heavyslugs commented 6 years ago

yeah I figured as much. but I'll try your first suggestion of sudo apt-get install --reinstall galliumos-skylake also I don't think this is an issue, but I am booting gallium off an external ssd, the internal storage has chromeos and crouton running ubuntu w/ kde

bassclarinetl2 commented 6 years ago

I have an asuka, what logs are y'all looking for.

heavyslugs commented 6 years ago

@reynhout yeah I tried using the command sudo apt-get install --reinstall galliumos-skylake and still no luck :( I can provide logs now if that will help

StephanvanSchaik commented 6 years ago

Sound works for me on the Asus Chromebook Flip C302CA (Cave) on both speakers and headphones. I am running Gentoo with Linux 4.14.11. I have adapted the necessary files from https://github.com/GalliumOS/galliumos-skylake:

  1. Download dfw_sst.bin to /lib/firmware.
  2. Add "blacklist snd-hda-intel" to /etc/modprobe.d/snd-hda-intel.conf.
  3. Open a terminal:
    sudo su
    mkdir -p /usr/share/alsa/ucm/sklnau8825max/
    cd /usr/share/alsa/ucm/sklnau8825max/
    wget https://raw.githubusercontent.com/GalliumOS/galliumos-skylake/master/usr/share/alsa/ucm/sklnau8825adi/sklnau8825adi.conf -O sklnau8825max.conf
    wget https://raw.githubusercontent.com/GalliumOS/galliumos-skylake/master/usr/share/alsa/ucm/sklnau8825adi/HiFi.conf
    sed -i 's/adi/max/g' /usr/share/alsa/ucm/sklnau8825max/HiFi.conf
    ln -s /usr/share/alsa/ucm/sklnau8825max/ /usr/share/alsa/ucm/Google-Cave-1.0-Cave
    ln -s /usr/share/alsa/ucm/sklnau8825max/sklnau8825max.conf /usr/share/alsa/ucm/sklnau8825max/Google-Cave-1.0-Cave.conf 
  4. Reboot the system.

After logging in, use the following commands to initialise or reset the device to a sane state:

alsaucm -c sklnau8825max set _verb HiFi set _disdev Speaker
alsaucm -c sklnau8825max set _verb HiFi set _disdev Headphone
alsaucm -c sklnau8825max set _verb HiFi set _enadev Speaker

Use the following to switch to headphones:

alsaucm -c sklnau8825max set _verb HiFi set _enadev Headphone

And the following to switch back to speakers:

alsaucm -c sklnau8825max set _verb HiFi set _enadev Speaker

One issue I noticed is that PulseAudio does not really like this. For instance, if you are watching a YouTube video, it will pause the playback and you will have to restart the browser.

Edit:

The input events for the headphone jack detection seem to be working as well. After unplugging and plugging the headphones, PulseAudio will stop working again, but once you open a new tab with a YouTube video it works again (after closing the previous tab using audio, and waiting for a bit).

evtest 
No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:  Lid Switch
/dev/input/event1:  Power Button
/dev/input/event2:  Tablet Mode Switch
/dev/input/event3:  Power Button
/dev/input/event4:  AT Translated Set 2 keyboard
/dev/input/event5:  sklnau8825max Headset Jack
/dev/input/event6:  sklnau8825max HDMI/DP, pcm=4 Jack
/dev/input/event7:  sklnau8825max HDMI/DP, pcm=5 Jack
/dev/input/event8:  sklnau8825max HDMI/DP, pcm=6 Jack
/dev/input/event9:  Elan Touchscreen
/dev/input/event10: Elan Touchpad
/dev/input/event11: USB2.0 HD UVC WebCam: USB2.0 HD
Select the device event number [0-11]: 5
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "sklnau8825max Headset Jack"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 256 (BTN_0)
    Event code 257 (BTN_1)
    Event code 258 (BTN_2)
    Event code 259 (BTN_3)
  Event type 5 (EV_SW)
    Event code 2 (SW_HEADPHONE_INSERT)
    Event code 4 (SW_MICROPHONE_INSERT)
Properties:
Testing ... (interrupt to exit)
Event: time 1519709706.476019, type 5 (EV_SW), code 2 (SW_HEADPHONE_INSERT), value 0
Event: time 1519709706.476019, -------------- SYN_REPORT ------------
Event: time 1519709710.646785, type 5 (EV_SW), code 2 (SW_HEADPHONE_INSERT), value 1
Event: time 1519709710.646785, -------------- SYN_REPORT ------------
fnook1331 commented 6 years ago

I may have just stumbled upon a partial fix for skylake cave models. I am on the 4.14.xx Gallium Os Kernel on an Asus Chromebook Flip c302ca. First, enable testing and prerelease kernel repos sudo galliumos-repodist --enable prerelease sudo galliumos-repodist --enable testing Second, run an update cycle sudo galliumos-update Third, reboot sudo reboot Then, once the computer comes back up into galliumos, change directories to /usr/share/alsa/ucm/ cd /usr/share/alsa/ucm/ # do an ls - l to reveal the directory contents ls -l You should see a folder called "sklnau8825adi" execute this command to make it discoverable by ALSA. sudo mv sklnau8825adi sklnau8825max Now enter the newly renamed directory. cd sklnau8825max ......And repeat the mv command on the sklnau8825adi.conf file. sudo mv sklnau8825adi.conf sklnau8825max.conf You do not need to edit any of the code in the *max.conf file. You do, however, need to edit the HiFi.conf file. It is easiest in gedit with it's find and replace feature. 'sudo gedit HiFi.conf' In gedit, Go to Search ------> Find and replace (or hit control + H) screenshot_2018-02-27_01-02-06 then hit "replace all" it should look something like this: screenshot_2018-02-27_01-03-03 Once that is done, save and exit and return to the command line. in the command line run: sudo alsaucm -c sklnau8825max set _verb HiFi If it completes successfully, there will not be a response. Do another reboot: sudo reboot Once this has completed, you should have very overmodulated audio. To fix this decrease in pulse audio the output volume value of the soundcard to 40%.

You should have good quality audio by now through the internal speakers. As of right now, I haven't figured out a good fix for the headphone port as of yet.

BTW: Do not try the headphone switch within gallium that is described in the post above mine. That will crash pulse so badly that you will have to reboot as I will have to once I post this. Also, the adapter name in that one will cause a "no such file error."

Edit It seems like the commands described in the above did much more than crash pulseaudio. It completely corrupted it. As seen here:

screenshot_2018-02-27_01-50-48

Thanks, Adam

StephanvanSchaik commented 6 years ago

@fnook1331 Thanks, I fixed the card name for the alsaucm commands in my original post and I just realised I also mentioned the wrong file.

For the substitution, you could easily run a command like: sed -i 's/adi/max/g' /usr/share/alsa/ucm/sklnau8825max/HiFi.conf

In my case PulseAudio seems to restart automatically after changing to the headphones (or back to the speakers), but existing clients will stop working. You should run pulseaudio -k to kill the existing daemon and then you can just use any application using audio (as that will automatically restart pulseaudio), if need be. PulseAudio isn't a system-wide service, but instead runs as part of your user session.

Update: when unplugging the headphones and plugging them again, I can still hear the audio properly once the headphone plug makes proper contact with the jack, until it is fully plugged in. That causes an event to happen where PulseAudio stops working for a bit.

Update: I tested the internal microphone using arecord -D hw:0,3 -f S16_LE -c 2 test.wav. This seems to work fine. hw:0,1 appears to record the audio output, which also seems to work fine. I changed the UCM-file to have PulseAudio detect the input device.

Change the following line in /usr/share/alsa/ucm/sklnau8825max/HiFi.conf:

CapturePCM "hw:sklnau8825max,1"

to:

CapturePCM "hw:sklnau8825max,3"

Then add the following SectionDevice below the speaker:

SectionDevice."InternalMic".0 {
    Value {
        CaptureChannels "2"
        CapturePriority "1"
    }

    EnableSequence [
    ]

    DisableSequence [
    ]
}

Right after JackName "sklnau8825max Headset Jack" in SectionDevice."Mic" 0 { add the following:

CaptureChannels "2"
CapturePriority "2"

Load the UCM profile using alsaucm and restart PulseAudio.

RiverCambria commented 6 years ago

I wasn't able to get sound on my C302 running version: 4.14.14-galliumos.

I enabled testing distros and updated/reboot. I copied and renamed everything sklnau8825max like described and replaced sklnau885 names in the HiFi.conf file. When running the alsaucm command I get:

ALSA lib main.c:344:(execute_sequence) unable to open ctl device 'hw:sklnau8825max' ALSA lib main.c:1546:(set_verb_user) error: failed to initialize new use case: HiFi alsaucm: error failed to set _verb=HiFi: No such device

StephanvanSchaik commented 6 years ago

@RiverCambria Hmm, alsaucm is complaining that the ALSA device doesn't exist, which means the driver failed to initialise. Could you perhaps upload the output from dmesg after booting up your Chromebook? (sudo dmesg >dmesg.txt in a terminal)

The relevant lines from dmesg show this for me (for a successful attempt):

[    4.368172] nau8825 i2c-10508825:00: No 'mclk' clock found, assume MCLK is managed externally
[    4.380909] snd_soc_skl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops)
[    4.419973] HDMI HDA Codec ehdaudio0D2: Max dais supported: 3
[    4.426297] snd_soc_skl 0000:00:1f.3: Direct firmware load for 9d70-CORE-COREBOOT-0-tplg.bin failed with error -2
[    4.426299] snd_soc_skl 0000:00:1f.3: tplg fw 9d70-CORE-COREBOOT-0-tplg.bin load failed with -2, falling back to dfw_sst.bin
[    4.429631] snd_soc_skl 0000:00:1f.3: ASoC: Parent card not yet available, widget card binding deferred
[    4.460998] HDMI HDA Codec ehdaudio0D2: hdac_hdmi_present_sense: disconnect for pin:port 5:0
[    4.461109] HDMI HDA Codec ehdaudio0D2: hdac_hdmi_present_sense: disconnect for pin:port 6:0
[    4.461220] HDMI HDA Codec ehdaudio0D2: hdac_hdmi_present_sense: disconnect for pin:port 7:0
[    4.461416] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[    4.461445] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[    4.461473] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> Reference Pin mapping ok
[    4.461497] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> DMIC Pin mapping ok
[    4.461522] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI1 Pin mapping ok
[    4.461547] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI2 Pin mapping ok
[    4.461577] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI3 Pin mapping ok
[    4.461589] skl_n88l25_m98357a skl_n88l25_m98357a: HiFi <-> SSP0 Pin mapping ok
[    4.462890] skl_n88l25_m98357a skl_n88l25_m98357a: nau8825-hifi <-> SSP1 Pin mapping ok
[    4.462900] skl_n88l25_m98357a skl_n88l25_m98357a: dmic-hifi <-> DMIC01 Pin mapping ok
[    4.462909] skl_n88l25_m98357a skl_n88l25_m98357a: intel-hdmi-hifi1 <-> iDisp1 Pin mapping ok
[    4.462917] skl_n88l25_m98357a skl_n88l25_m98357a: intel-hdmi-hifi2 <-> iDisp2 Pin mapping ok
[    4.462926] skl_n88l25_m98357a skl_n88l25_m98357a: intel-hdmi-hifi3 <-> iDisp3 Pin mapping ok
[    4.463582] input: sklnau8825max Headset Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input4
[    4.463646] input: sklnau8825max HDMI/DP, pcm=4 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input5
[    4.463701] input: sklnau8825max HDMI/DP, pcm=5 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input6
[    4.463754] input: sklnau8825max HDMI/DP, pcm=6 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input7

I have also added my kernel config for 4.14.11 and 4.15.0 (both work for me) and the list of kernel modules that are active:

RiverCambria commented 6 years ago

Sure, RiverDmesg.txt

I see the following for myself:

[ 3.187092] nau8825 i2c-10508825:00: No 'mclk' clock found, assume MCLK is managed externally [ 3.198869] input: Elan Touchscreen as /devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/i2c-ELAN0001:00/input/input4 [ 3.218188] elan_i2c i2c-ELAN0000:00: Elan Touchpad: Module ID: 0x008f, Firmware: 0x0005, Sample: 0x0008, IAP: 0x0009 [ 3.218309] input: Elan Touchpad as /devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-7/i2c-ELAN0000:00/input/input5 [ 3.219122] Intel(R) Wireless WiFi driver for Linux [ 3.219123] Copyright(c) 2003- 2015 Intel Corporation [ 3.226892] cros_ec_lpcs: unsupported system. [ 3.286526] iwlwifi 0000:01:00.0: loaded firmware version 29.610311.0 op_mode iwlmvm [ 3.294471] Bluetooth: Core ver 2.22 [ 3.294497] NET: Registered protocol family 31 [ 3.294498] Bluetooth: HCI device and connection manager initialized [ 3.294505] Bluetooth: HCI socket layer initialized [ 3.294512] Bluetooth: L2CAP socket layer initialized [ 3.294519] Bluetooth: SCO socket layer initialized [ 3.332016] media: Linux media interface: v0.10 [ 3.343222] random: crng init done [ 3.354899] snd_soc_skl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915]) [ 3.360086] usbcore: registered new interface driver btusb [ 3.362550] AVX2 version of gcm_enc/dec engaged. [ 3.362551] AES CTR mode by8 optimization enabled [ 3.376820] Bluetooth: hci0: read Intel version: 370810225019140f0d [ 3.376823] Bluetooth: hci0: Intel device is already patched. patch num: 0d [ 3.379103] Linux video capture interface: v2.00 [ 3.402190] iwlwifi 0000:01:00.0: Detected Intel(R) Dual Band Wireless AC 7265, REV=0x210 [ 3.404203] dw-apb-uart.2: ttyS4 at MMIO 0xd1134000 (irq = 32, base_baud = 115200) is a 16550A [ 3.416593] dw-apb-uart.4: ttyS5 at MMIO 0xd1136000 (irq = 20, base_baud = 115200) is a 16550A [ 3.425160] uvcvideo: Found UVC 1.00 device USB2.0 HD UVC WebCam (13d3:5679) [ 3.430368] uvcvideo 1-7:1.0: Entity type for entity Realtek Extended Controls Unit was not initialized! [ 3.430371] uvcvideo 1-7:1.0: Entity type for entity Extension 4 was not initialized! [ 3.430373] uvcvideo 1-7:1.0: Entity type for entity Processing 2 was not initialized! [ 3.430375] uvcvideo 1-7:1.0: Entity type for entity Camera 1 was not initialized! [ 3.430834] input: USB2.0 HD UVC WebCam: USB2.0 HD as /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/input/input6 [ 3.431443] usbcore: registered new interface driver uvcvideo [ 3.431445] USB Video Class driver (1.1.1) [ 3.431899] iwlwifi 0000:01:00.0: base HW address: 88:78:73:69:a9:29 [ 3.467132] HDMI HDA Codec ehdaudio0D2: Max dais supported: 3 [ 3.474874] snd_soc_skl 0000:00:1f.3: Direct firmware load for 9d70-CORE-COREBOOT-0-tplg.bin failed with error -2 [ 3.474878] snd_soc_skl 0000:00:1f.3: tplg fw 9d70-CORE-COREBOOT-0-tplg.bin load failed with -2, falling back to dfw_sst.bin [ 3.476583] intel_rapl: Found RAPL domain package [ 3.476585] intel_rapl: Found RAPL domain core [ 3.476587] intel_rapl: Found RAPL domain uncore [ 3.476588] intel_rapl: Found RAPL domain dram [ 3.481994] snd_soc_skl 0000:00:1f.3: ASoC: Parent card not yet available, widget card binding deferred [ 3.504357] max98357a MX98357A:00: ASoC: failed to probe component -517 [ 3.504412] skl_n88l25_m98357a skl_n88l25_m98357a: ASoC: failed to instantiate card -517

StephanvanSchaik commented 6 years ago

My friend has the exact same issue on his Asus Chromebook Flip C302CA (Cave). I guess this is the other behaviour people have been getting when it doesn't work:

[ 3.504357] max98357a MX98357A:00: ASoC: failed to probe component -517
[ 3.504412] skl_n88l25_m98357a skl_n88l25_m98357a: ASoC: failed to instantiate card -517
NUCUser commented 6 years ago

A post in one of these issues (this one and #274) says CAVE and LARS use the same chip, so I tried the above steps. No luck. Relevant cut/pastes follow. Happy to be someone's guinea pig, but I know little about the guts of ALSA.

root@chromebook3:~# alsaucm -c sklnau8825max set _verb HiFi
ALSA lib main.c:350:(execute_sequence) unable to execute cset 'name='Pin5-Port0 Mux' 1'

ALSA lib main.c:1546:(set_verb_user) error: failed to initialize new use case: HiFi
alsaucm: error failed to set _verb=HiFi: No such file or directory
username@chromebook3:~$ dmesg | grep snd
[    4.479862] snd_soc_skl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.909774] snd_soc_skl 0000:00:1f.3: Direct firmware load for 9d70-CORE-COREBOOT-0-tplg.bin failed with error -2
[    4.909777] snd_soc_skl 0000:00:1f.3: tplg fw 9d70-CORE-COREBOOT-0-tplg.bin load failed with -2
[    4.917445] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917447] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917448] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917454] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917455] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917456] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917462] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917463] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917464] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    4.917510] snd_soc_skl 0000:00:1f.3: ASoC: Parent card not yet available,Do not add new widgets now
[    4.958102] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[    4.959133] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[    4.959176] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> Reference Pin mapping ok
[    4.959220] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> DMIC Pin mapping ok
[    4.959259] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI1 Pin mapping ok
[    4.959297] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI2 Pin mapping ok
[    4.959331] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI3 Pin mapping ok
username@chromebook3:~$ uname -a
Linux chromebook3 4.10.5-galliumos #1 SMP PREEMPT Thu Apr 20 17:57:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
username@chromebook3:~$ cat /etc/issue
GalliumOS 2.1 \n \l
username@chromebook3:~$ galliumos-repodist 
xenon-devel                 (disabled)  GalliumOS "devel" packages
xenon-prerelease            (enabled)   GalliumOS "prerelease" packages
xenon-testing               (enabled)   GalliumOS "testing" packages
username@chromebook3:~$ ls -l /lib/firmware/dfw_sst.bin 
-rw-r--r-- 1 root root 23120 Jan 19 00:49 /lib/firmware/dfw_sst.bin
username@chromebook3:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sklnau8825max [sklnau8825max], device 0: Audio (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sklnau8825max [sklnau8825max], device 4: Hdmi1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sklnau8825max [sklnau8825max], device 5: Hdmi2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sklnau8825max [sklnau8825max], device 6: Hdmi3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
username@chromebook3:~$ ls -l /usr/share/alsa/ucm/sklnau8825max/
total 8
-rw-r--r-- 1 root root 1840 Feb 27 17:10 HiFi.conf
-rw-r--r-- 1 root root   97 Feb 27 17:00 sklnau8825max.conf
username@chromebook3:~$ # Yes, I changed all references from adi to max:
username@chromebook3:~$ grep sklnau8825adi /usr/share/alsa/ucm/sklnau8825max/HiFi.conf | wc -l
0
username@chromebook3:~$ grep sklnau8825max /usr/share/alsa/ucm/sklnau8825max/HiFi.conf | wc -l
10
StephanvanSchaik commented 6 years ago

@NUCUser For LARS, did you try adding the following symbolic links?

ln -s /usr/share/alsa/ucm/sklnau8825max/ /usr/share/alsa/ucm/Google-Lars-1.0-Lars
ln -s /usr/share/alsa/ucm/sklnau8825max/sklnau8825max.conf /usr/share/alsa/ucm/sklnau8825max/Google-Lars-1.0-Lars.conf 

Otherwise, open up alsamixer -c 0 and check if you have these controls: alsamixer

NUCUser commented 6 years ago

@StephanvanSchaik Made the additional links, rebooted, no change. Alsamixer in second screenshot below. Not surprising that Pin?-Port? devices aren't here when the first command I copypasted in my previous post failed. The volume control widget in the system tray, when opened, looks like the first screenshot here. There is activity in the volume meter when something is playing, "headphone" is the only option in the "Port" dropdown, and there's no sound coming from the headphone jack.

asdf

screenshot_2018-02-27_19-44-23

StephanvanSchaik commented 6 years ago

@NUCUser The good news is that the driver seems to work for you. It's just that the UCM-profile seems to be incompatible.

Can you try changing the following in /usr/share/alsa/ucm/sklnau8825max/HiFi.conf:

cset "name='Pin5-Port0 Mux' 1"
cset "name='Pin6-Port0 Mux' 2"
cset "name='Pin7-Port0 Mux' 3"

to:

cset "name='Pin 5 Mux' 1"
cset "name='Pin 6 Mux' 2"
cset "name='Pin 7 Mux' 3"

And then try using the alsaucm commands to set up speakers/headphones (instead of the user interface).

NUCUser commented 6 years ago

Made those changes, and after a reboot, things looks like the following. No sound coming out of speakers or headphone jack. Tried running all permutations of these commands:

alsaucm -c sklnau8825max set _verb HiFi set _disdev Speaker
alsaucm -c sklnau8825max set _verb HiFi set _disdev Headphone
alsaucm -c sklnau8825max set _verb HiFi set _enadev Speaker
alsaucm -c sklnau8825max set _verb HiFi set _enadev Headphone

No output from any of them, but no changes in behavior, either. Alsamixer shows no sliders for the "Pin #" items. Note that the desktop volume app has two devices named "n/a" now. Screenshots below.

Here's dmesg output this time (note that I didn't include "max" in the pattern in my earlier message). Note particularly the last line:

root@chromebook3:~# dmesg | egrep "snd|max"
[    0.000000] e820: last_pfn = 0x27f000 max_arch_pfn = 0x400000000
[    0.000000] e820: last_pfn = 0x7aa28 max_arch_pfn = 0x400000000
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635855245 ns
[    0.000025] pid_max: default: 32768 minimum: 301
[    0.036967] ... max period:             00007fffffffffff
[    0.258687] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.599436] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x2135f7c97c8, max_idle_ns: 440795273205 ns
[    0.600475] workingset: timestamp_bits=40 max_order=21 bucket_order=0
[    0.746713] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    4.942296] snd_soc_skl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    5.024994] snd_soc_skl 0000:00:1f.3: Direct firmware load for 9d70-CORE-COREBOOT-0-tplg.bin failed with error -2
[    5.025001] snd_soc_skl 0000:00:1f.3: tplg fw 9d70-CORE-COREBOOT-0-tplg.bin load failed with -2
[    5.025560] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025565] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025570] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025586] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025591] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025595] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025612] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025616] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025620] snd_soc_skl 0000:00:1f.3: Control load not supported 64:64:64
[    5.025756] snd_soc_skl 0000:00:1f.3: ASoC: Parent card not yet available,Do not add new widgets now
[    5.048224] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[    5.048328] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[    5.048392] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> Reference Pin mapping ok
[    5.048450] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> DMIC Pin mapping ok
[    5.048504] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI1 Pin mapping ok
[    5.048556] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI2 Pin mapping ok
[    5.048627] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI3 Pin mapping ok
[    5.053339] input: sklnau8825max Headset Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input5
[    5.053549] input: sklnau8825max HDMI/DP, pcm=4 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input6
[    5.053669] input: sklnau8825max HDMI/DP, pcm=5 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input7
[    5.053776] input: sklnau8825max HDMI/DP, pcm=6 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input8
[   30.975082] snd_soc_skl 0000:00:1f.3: ASoC: POST_PMU: codec0_out mo event failed: -22

11 22

StephanvanSchaik commented 6 years ago

@NUCUser ALSA not showing sliders is normal (you can still select the fields and use your up/down keys to select the right option). I have the exact same. Interesting that the ports changed to "n/a" and "n/a" for you as well (I have the same). I was wondering what the names are based on, but I haven't been able to figure that part out yet.

What works for me is setting the following while no audio is playing:

alsaucm -c sklnau8825max set _verb HiFi set _enadev Speaker

Then waiting for a few seconds before playing audio. This also works for the headphones when using:

alsaucm -c sklnau8825max set _verb HiFi set _enadev Headphone

And waiting for a few seconds before resuming any audio.

Also make sure your volume isn't too loud (start around 10% or so and then increase it until your hear something). If your volume is loud enough you will also hear pops and clicks a few seconds after you switch between speakers and headphones, because of the the audio codecs being powered down/up.

NUCUser commented 6 years ago

@StephanvanSchaik ALSA not showing sliders is normal (you can still select the fields and use your up/down keys to select the right option). ... Also make sure your volume isn't too loud (start around 10% or so and then increase it until your hear something)."

I can't see how I can change volume on something when it doesn't have volume sliders.

StephanvanSchaik commented 6 years ago

@NUCUser Ah, sorry. I misunderstood. You can control the volume for PulseAudio, either through the user interface you were using or by using alsamixer (without specifying the card).

NUCUser commented 6 years ago

Anytime audio output is initialized (e.g. by switching to the second "n/a" in the Port dropdown, then switching back to the first), the same message gets spit out in dmesg:

[   91.389388] snd_soc_skl 0000:00:1f.3: ASoC: POST_PMU: codec1_out mo event failed: -22
StephanvanSchaik commented 6 years ago

I have been browsing through some of the patches that have been merged for linux-next, and this one seems promising. It sounds like this patch fixes the issue where the driver fails with a probe error. Maybe this patch could be backported for galliumos-4.14.14 in the meanwhile to see if it fixes the problem of the driver not loading?

@NUCUser I have the same kind of issue when trying to use pavucontrol (the PulseAudio application). Hence why I exclusively use alsaucm to switch, but if that doesn't work, then I am not sure what to do yet.

NUCUser commented 6 years ago

Heh. Re: Backporting to galliumos-4.14: Last night I tried a fresh install/upgrade just to be sure. Enabling testing/development gave me a 4.14 kernel at first. Nothing figured out so far works on it:

root@chromebook3:~# alsaucm -c sklnau8825max set _verb HiFi
ALSA lib main.c:344:(execute_sequence) unable to open ctl device 'hw:sklnau8825max'
ALSA lib main.c:1546:(set_verb_user) error: failed to initialize new use case: HiFi
alsaucm: error failed to set _verb=HiFi: No such device

root@chromebook3:~# aplay -l
aplay: device_list:268: no soundcards found...
RiverCambria commented 6 years ago

I updated my linux kernel through ukuu to 4.15.7 and ran sudo alsaucm -c sklnau8825max set _verb HiFi then rebooted. I now have modulated audio. I tried setting the volume to 40 percent as suggested but it persist. At least the soundcard is loading now!

NUCUser commented 6 years ago

I guess I'm headed back to the USB audio dongle for now.

genusistimelord commented 6 years ago

I was able to finally get the card to appear as it should be by taking @RiverCambria advice and updating the kernel to 4.15.7. However, even though it does now appear I only get a bleep of sound when attempting to switch between the N/A ports. This is what my current system shows for dmesg.

genusis@genusislappy:~$ dmesg | egrep "snd|max"
[    0.000000] e820: last_pfn = 0x27f000 max_arch_pfn = 0x400000000
[    0.000000] e820: last_pfn = 0x7aa28 max_arch_pfn = 0x400000000
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635855245 ns
[    0.028000] pid_max: default: 32768 minimum: 301
[    0.034353] ... max period:             00007fffffffffff
[    0.040875] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    1.108820] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0xd255cc052d, max_idle_ns: 440795236083 ns
[    1.109943] workingset: timestamp_bits=36 max_order=21 bucket_order=0
[   11.442732] snd_soc_skl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   11.779254] snd_soc_skl 0000:00:1f.3: Direct firmware load for 9d70-CORE-COREBOOT-0-tplg.bin failed with error -2
[   11.779258] snd_soc_skl 0000:00:1f.3: tplg fw 9d70-CORE-COREBOOT-0-tplg.bin load failed with -2, falling back to dfw_sst.bin
[   11.780566] snd_soc_skl 0000:00:1f.3: ASoC: Parent card not yet available, widget card binding deferred
[   11.813570] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[   11.813620] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> System Pin mapping ok
[   11.813664] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> Reference Pin mapping ok
[   11.813709] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> DMIC Pin mapping ok
[   11.813748] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI1 Pin mapping ok
[   11.813781] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI2 Pin mapping ok
[   11.813819] skl_n88l25_m98357a skl_n88l25_m98357a: snd-soc-dummy-dai <-> HDMI3 Pin mapping ok
[   11.819170] input: sklnau8825max Headset Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input7
[   11.819246] input: sklnau8825max HDMI/DP, pcm=4 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input8
[   11.819310] input: sklnau8825max HDMI/DP, pcm=5 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input9
[   11.819375] input: sklnau8825max HDMI/DP, pcm=6 Jack as /devices/platform/skl_n88l25_m98357a/sound/card0/input10
[   12.791128] nf_conntrack version 0.5.0 (65536 buckets, 262144 max)
[   13.922511] snd_soc_skl 0000:00:1f.3: ASoC: can't open interface DMIC Pin: -22
[   24.104427] snd_soc_skl 0000:00:1f.3: ASoC: POST_PMU: codec0_out mo event failed: -22

Notice its having a codec issue near the bottom there. Though I am just happy that this is a step in the right direction and shows they are most likely doing something wrong in the previous gallium kernel if updating to the latest via ukuu shows the sound card now with everything else still working.

EDIT: after messing with Alsa and not using the pulse audio GUI the sound plays. Works as @StephanvanSchaik it would. Just dont use pusle audio till they get that fixed and working as it may make it so the sound no longer works till you reboot.

lonasozo commented 6 years ago

HP chromebook G1 with M3, same problem here like the image posted by @NUCUser , there is activity but no audio from speaker/headphone. [like this image] https://user-images.githubusercontent.com/10282905/36765633-cbf1a964-1bf7-11e8-9fce-10cfd4e7b99d.png

elhenro commented 6 years ago

I also have the Asus C302-CA Flip (CAVE), and am on GalliumOS 2.1 x86_64.

I followed the steps of @fnook1331 then had the same error as @RiverCambri.

Then I upgraded to Kernel 4.15.7 and have now at least the internal headphone jack working as expected. Internal speakers still don't seem to work.

Summary of my steps:

sudo galliumos-repodist --enable testing

galliumos-update

sudo reboot

Then, once the computer comes back up into galliumos, change directories to /usr/share/alsa/ucm/

ls -l

look for sklnau8825adi

sudo mv sklnau8825adi sklnau8825max

cd sklnau8825max

sudo mv sklnau8825adi.conf sklnau8825max.conf

'sudo gedit HiFi.conf and replace all sklnau8825adi by sklnau8825max

use ukuu to upgrade to kernel 4.15.7

sudo reboot

TesseractCat commented 6 years ago

@elhenro I tried following the steps you posted, but audio still doesn't seem to work. In the audio menu the only output device is the dummy output. Can you share the sklnau8825max folder you have?

Edit: The sudo alsaucm -c sklnau8825max set _verb HiFi also gives me the same error that rivercambria had. Edit 2: Running aplay -l gives me this output: aplay: device_list:268: no soundcards found..., which I suspect is the issue.

kn6james commented 6 years ago

Just updated to kernel 4.16.0 via ukuu and I now have undistorted sound working through Pulseaudio (above ~20% volume anyway) through the speakers on CAVE. I originally followed the instructions in @fnook1331's post and was getting distorted audio, til now.

elhenro commented 6 years ago

@TesseractCat here is my /usr/share/alsa/ucm/sklnau8825max folder.

@jtomwilson i tried upgrading kernel to 4.16.0. Headphones not working anymore, when i selected the speakers port in sound settings ( n/a ) a static noise on the speakers, then strange static sounds and i noticed the areas of the speakers getting very warm, so i downgraded to 4.15.7 again. First the headphone port seemed to have stopped working again, but after another reboot it was fine.

So now: Kernel 4.15.7, headphone port working, speakers not, so currently I'm using a small Bluetooth speaker for that..

NUCUser commented 6 years ago

On LARS, with GalliumOS 2.1 fresh install, then kernel upgraded to 4.16.1 with ukuu, the HDMI/DisplayPort output is available, but still no internal speakers.

LinkofHyrule89 commented 6 years ago

Any more progress on internal speaker audio for cave?

PennRobotics commented 6 years ago

I switched back to ChromeOS, so I haven't kept up with the progress on this issue. A few days ago, I ran across this site: https://www.codentium.com/category/chromebooks.html

According to the page, CAVE, SENTRY, LARS, and ASUKA have fully functional audio on Gentoo with the tools and configuration listed. In advance, I apologize if this is a false lead.

LinkofHyrule89 commented 6 years ago

I mainly use Chrome OS but I'm using Gallium OS for development until I can run PHPStorm and other things directly in Chrome OS via Crustini.

StephanvanSchaik commented 6 years ago

@usfbrian Hi, I am the author of that website. I documented the process of installing a functional Linux system and those instructions worked for me on CAVE. For the other platforms, I mostly checked in what way they differ by checking the Chromium repositories. Hence the instructions should be complete. Besides GalliumOS is already coherent with most of these instructions (e.g. they already have the appropriate settings enabled in the kernel config), except for maybe the ALSA UCM profiles. However, the snd_soc_skl kernel module, the universal driver for all these devices, does seem to behave weirdly in many cases and I want to stress that fully functional here means that I have tested the separate components (speakers, headphones, internal microphone and the headphone jack) and that they all seem to work on their own, but that they do not play well together (e.g. plugging in the headphone jack crashes PulseAudio if you are playing music).

For instance, recently the audio driver on my Chromebook (CAVE) broke down entirely after the Chromebook accidentally ended up being discharged and I am now mostly getting errors like the following when trying to play audio:

[36458.497397]  Skl Audio DMIC cap: ASoC: trigger FE failed -32
[36463.807628] snd_soc_skl 0000:00:1f.3: ipc: bind/unbind failed
[36464.111579] snd_soc_skl 0000:00:1f.3: ipc: delete pipeline failed, err -110
[36464.111583] snd_soc_skl 0000:00:1f.3: Failed to delete pipeline
[36840.128327] snd_soc_skl 0000:00:1f.3: skl_is_pipe_mcps_avail: module_id -1 instance 0
[36840.128329] snd_soc_skl 0000:00:1f.3: exceeds ppl mcps available 30000000 > mem -2800000
[36840.128331] snd_soc_skl 0000:00:1f.3: ASoC: PRE_PMU: media0_in cpr 0 event failed: -16
[36840.128333] snd_soc_skl 0000:00:1f.3: skl_is_pipe_mcps_avail: module_id -1 instance 0
[36840.128334] snd_soc_skl 0000:00:1f.3: exceeds ppl mcps available 30000000 > mem -2800000
[36840.128335] snd_soc_skl 0000:00:1f.3: ASoC: PRE_PMU: codec0_out mo event failed: -16
[36875.169293] snd_soc_skl 0000:00:1f.3: ASoC: POST_PMD: codec0_out mo event failed: -22
[36875.169296] snd_soc_skl 0000:00:1f.3: ASoC: POST_PMD: media0_in cpr 0 event failed: -22

This is on Linux 4.15.9, but upgrading to 4.16.5 does not fix the problem.

In addition, before I got it to work way back, the i²s controller got stuck in a weird state where the audio driver wouldn't work before I powered down the Chromebook completely and then powered it back on.

Beatnukem commented 6 years ago

@StephanvanSchaik: thanks a lot for your work, after replacing the dfw_sst.bin from GalliumOS with the one from your github the audio quality has improved a lot. I am running ubuntu studio (18.04) in a dual boot on my CAVE.

LufyCZ commented 6 years ago

@Beatnukem Would you please share a guide on how to get it to work ? I'm on 18.04 (vanilla), and when I try to run the alsaucm command, I get a no such device (HiFi) found. LARS

Edit: Got working audio after blacklisting HDMI. After pausing, waiting for a bit and then unpausing, I hear a loud distorted pop, which is annoying, does anyone know how to fix that ?

StephanvanSchaik commented 6 years ago

@LufyCZ The clicking and popping is caused by the audio driver powering up/down the audio chipset. There is a commit that is supposed to fix it, but unfortunately the popping and clicking is still audible in recent versions of the Linux kernel.

Beatnukem commented 6 years ago

@LufyCZ I was pretty much following https://github.com/GalliumOS/galliumos-distro/issues/379#issuecomment-368751023, which already worked but the audio quality was pretty bad. switched dwf_sst.bin with the one from https://www.codentium.com/category/chromebooks.html fixed the audio quality. There are still issues, the loud click when the audio chip powers up/down is still there, and some apps - for example skype - don't seem to adjust the volume based on the system sound level, but it's good enough to watch a video or listen to some music, and google hangout calls work fine too (with microphone)

bigc0127 commented 6 years ago

I'm running Linux Mint 18.3 on Sentry and followed same steps as @Beatnukem basically ... and nothing happened.

until I plugged in my USB c to analog adapter.... then the 2 "N/A" options popped up along with the adapter ... and long story short the speakers now mirror my headphones and the quality is great

UPDATE: the speakers now can work independently and don't mirror the headphones and sound is still great ... despite a random loud pop sound

I'm on Linux kernel 4.15-15 image

francato commented 6 years ago

@LufyCZ Can you please share how you got past the "alsaucm" command? I am getting the same "no such device (HiFi) found" error. Thanks.

LufyCZ commented 6 years ago

I have actually not used it at all. The only thing I did was reboot

TesseractCat commented 6 years ago

I've been following some of the instructions here, but I think the issue is at the kernel level, as the driver for the nau8825 doesn't load at all. This leads to the aplay message: aplay: device_list:268: no soundcards found.... I'm not exactly sure how to decipher the dmesg output but if anyone could take a look at it, that would be super helpful. dmesg.txt

EDIT: Not sure how this happened, but I powerwashed my chromebook, and the problem has solved itself, and now audio is working perfectly!

elhenro commented 6 years ago

@TesseractCat Which Cave model do you have? What do you mean by "powerwashed" ?