LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Sound not working with ALC262 (https://www.linuxquestions.org/questions/linux-hardware-18/sound-not-working-with-alc262-4175646440/)

dr_berta 01-18-2019 03:05 AM

Sound not working with ALC262
 
HI,
I'm not able to ear any sound from my panel pc. It has a Gentoo kernel 3.19.8 and the sound hardware is the following:
Code:

eposatom ~ # aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=PCH
    HDA Intel PCH, ALC262 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC262 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC262 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0
    HDA Intel PCH, HDMI 0
    HDMI Audio Output
hdmi:CARD=PCH,DEV=1
    HDA Intel PCH, HDMI 1
    HDMI Audio Output
hdmi:CARD=PCH,DEV=2
    HDA Intel PCH, HDMI 2
    HDMI Audio Output

The .asoundrc file is the following:
Code:

# alsa configuration file

pcm.hda-intel{
        type hw
        card 0
        }
ctl.hda-intel{
        type hw
        card 0
        }

The kernel has the following drivers:
Code:

eposatom ~ # zgrep -i snd_hda /boot/config-3.19.8-gentoo
CONFIG_SND_HDA=y
CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_PREALLOC_SIZE=64
CONFIG_SND_HDA_HWDEP=y
# CONFIG_SND_HDA_RECONFIG is not set
# CONFIG_SND_HDA_INPUT_BEEP is not set
# CONFIG_SND_HDA_INPUT_JACK is not set
# CONFIG_SND_HDA_PATCH_LOADER is not set
CONFIG_SND_HDA_CODEC_REALTEK=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_HDMI=y
CONFIG_SND_HDA_I915=y
CONFIG_SND_HDA_CODEC_CIRRUS=y
CONFIG_SND_HDA_CODEC_CONEXANT=y
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CA0132=y
# CONFIG_SND_HDA_CODEC_CA0132_DSP is not set
CONFIG_SND_HDA_CODEC_CMEDIA=y
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y

Finally the alsa.conf file is the following
Code:

# Alsa kernel modules' configuration file.

# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
##  ALSA portion
## alias snd-card-0 snd-interwave
## alias snd-card-1 snd-ens1371
alias snd-card-0 snd-hda-intel
##  OSS/Free portion
## alias sound-slot-0 snd-card-0
## alias sound-slot-1 snd-card-1
##

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
##  OSS/Free portion - card #2
## alias sound-service-1-0 snd-mixer-oss
## alias sound-service-1-3 snd-pcm-oss
## alias sound-service-1-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.
options snd cards_limit=1
options snd_hda_intel index=0 model=inv-dmic

The alsasound service has been enabled at boot
The system works under X without any windows manager but with a specific GUI application.


What do I have to do to have the audio working?

Thanks
Claudio

Shadow_7 01-18-2019 04:59 AM

$ speaker-test -c 2 -l 1 -D hw:PCH,0

Assuming you want the 3.5mm jack output and not the HDMI. Also make sure the user is in the audio group.

$ groups

And that the mixer levels are NOT muted.

$ alsamixer -c PCH

Optionally try the "other" devices until one works.

$ speaker-test -c 2 -l 1 -D hw:0,0
$ speaker-test -c 2 -l 1 -D hw:1,0
$ speaker-test -c 2 -l 1 -D hw:2,0

Or other device options, HDMI is often ,3 so...

$ speaker-test -c 2 -l 1 -D hw:0,3
$ speaker-test -c 2 -l 1 -D hw:1,3
$ speaker-test -c 2 -l 1 -D hw:2,3

The details for which are often in /proc/asound/, although a bit of understanding is needed to decrypt them from various files in /proc/asound/. And other things can get in the way like pulseaudio and jackd. But mostly being in the audio group, and setting mixer levels is what most initially get wrong. Followed by selecting the wrong device, hw:0,0 is default by default. Which could be a webcam (input only) depending on how things loaded at boot.

dr_berta 01-18-2019 09:10 AM

Hi, now I'm testing the sound as root, but even the user is in to the audio group.

The result of your command is the following:
Code:

eposatom ~ # speaker-test -c 2 -l 1 -D hw:PCH,0

speaker-test 1.1.7

Playback device is hw:PCH,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 64 to 16384
Period size range from 32 to 8192
Using max buffer size 16384
Periods = 4
was set period_size = 4096
was set buffer_size = 16384
 0 - Front Left
Write error: -5,Errore di input/output
xrun_recovery failed: -5,Errore di input/output
Transfer failed: Errore di input/output

I tried the other devices you suggested, but I receive always an error of invalid card

Just to complete the info of the system, dmesg says this:
Code:

eposatom ~ # dmesg | grep -i audio
[    2.490424] sound hdaudioC0D0: autoconfig: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
[    2.490427] sound hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.490429] sound hdaudioC0D0:    hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
[    2.490431] sound hdaudioC0D0:    mono: mono_out=0x0
[    2.490432] sound hdaudioC0D0:    inputs:
[    2.490434] sound hdaudioC0D0:      Internal Mic=0x19
[    2.490435] sound hdaudioC0D0:      Mic=0x18
[    2.495404] sound hdaudioC0D2: autoconfig: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line
[    2.495408] sound hdaudioC0D2:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.495410] sound hdaudioC0D2:    hp_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.495411] sound hdaudioC0D2:    mono: mono_out=0x0
[    2.495413] sound hdaudioC0D2:    dig-out=0x3/0x0
[    2.495414] sound hdaudioC0D2:    inputs:

This after putting the alsa driver as modules into the kernel. With the alsa driver integrated into the kernel I have only the hdaudioC0D0 in dmesg

Claudio

Shadow_7 01-18-2019 03:26 PM

C0D2 is the microphone input (typically). You might try a newer kernel, the snd-hda-intel driver is under constant change as most everything has a version of it these days. Version 3.19 is quite dated at this point, seem like 2015 was the last update to it and your hardware is likely newer than that. Unless you're building your alsa drivers from the alsa-project.org source and not the actual kernel tree for 3.19.

Shadow_7 01-18-2019 03:30 PM

You might also try:

$ speaker-test -c 2 -l 1 -D default
$ speaker-test -c 2 -l 1 -D pulse

And use pavucontrol to select your audio option if pulseaudio is in play. It likely is as modern gui web browsers require it for sound.

dr_berta 01-19-2019 08:03 AM

Hi,
the 3.19 is the higher version of kernel I can use because the system needs to work a specific usb driver that is incompatible with kernel 4.
I will try to disable the alsa driver into the kernel and download the latest version.

The system works as a kiosk with a custom graphic application under X but without any windows manager so I cannot install pavucontrol. The only tool I could use for the sound is aplay.

Claudio

Shadow_7 01-19-2019 01:45 PM

Not entirely true. You can use rec and play from the sox package. Also command line based. Technically ffplay and cvlc will work too. Or mpv and a number of mplayer variants.

I use rec when doing down an dirty recordings as it has a CLI based meter to tell what your level is at. Which otherwise verifies that you "are" recording IMO. With arecord you're literally flying blind, baring some form of tee and sound routing to hear what you're recording while recording. Although I'll often use arecord + tee to record a high quality version and an mp3 version at the same time. The mp3 version I hand off to the subjects being recorded while I take the high quality one home to process.

A down and dirty way of routing sound with alsa based systems.

FILE: $HOME/.asoundrc
Code:

defaults.ctl.card 1
defaults.pcm.card 1
defaults.pcm.device 0

Assuming that the -D hw:1,0 option worked. Otherwise hw:0,0 is always the default output.

dr_berta 02-02-2019 12:44 PM

HI,
I tried to follow your suggestion modifying the .asoundrc file, but I still have no sound.

dr_berta 02-06-2019 09:01 AM

I did some test with different kernels
It works with kernel 4.19 and with kernel 3.15, so I suppose there is a bug with the sound HDA modules into the kernel 3.19

Any idea about how to solve this issue?

Claudio

Shadow_7 02-07-2019 01:18 PM

There's often parameters that you can pass to tweak things. Which might help it work on other versions.

# modinfo snd-hda-intel
Code:

filename:      /lib/modules/4.19.0-1-amd64/kernel/sound/pci/hda/snd-hda-intel.ko
description:    Intel HDA driver
license:        GPL
...
...
...
depends:        snd-hda-core,snd-hda-codec,snd-pcm,snd
intree:        Y
name:          snd_hda_intel
vermagic:      4.19.0-1-amd64 SMP mod_unload modversions
sig_id:        PKCS#7
signer:       
sig_key:       
sig_hashalgo:  md4
signature:      ...
...
...
parm:          index:Index value for Intel HD audio interface. (array of int)
parm:          id:ID string for Intel HD audio interface. (array of charp)
parm:          enable:Enable Intel HD audio interface. (array of bool)
parm:          model:Use the given board model. (array of charp)
parm:          position_fix:DMA pointer read method.(-1 = system default, 0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO, 5 = SKL+). (array of int)
parm:          bdl_pos_adj:BDL position adjustment offset. (array of int)
parm:          probe_mask:Bitmask to probe codecs (default = -1). (array of int)
parm:          probe_only:Only probing and no codec initialization. (array of int)
parm:          jackpoll_ms:Ms between polling for jack events (default = 0, using unsol events only) (array of int)
parm:          single_cmd:Use single command to communicate with codecs (for debugging only). (bint)
parm:          enable_msi:Enable Message Signaled Interrupt (MSI) (bint)
parm:          patch:Patch file for Intel HD audio interface. (array of charp)
parm:          beep_mode:Select HDA Beep registration mode (0=off, 1=on) (default=1). (array of bool)
parm:          power_save:Automatic power-saving timeout (in second, 0 = disable). (xint)
parm:          pm_blacklist:Enable power-management blacklist (bool)
parm:          power_save_controller:Reset controller in power save mode. (bool)
parm:          align_buffer_size:Force buffer and period sizes to be multiple of 128 bytes. (bint)
parm:          snoop:Enable/disable snooping (bint)

The defaults for the other kernels are likely different. Or other bug fixes, check the changelog(s). You can set parms at load time $(modprobe snd-hda-intel pm_blacklist=true), or in /etc/modprobe.d/???.conf with the options line(s).

dr_berta 02-07-2019 05:27 PM

Thanks for the suggestion. I will try to use the parameters.

In any case I saw with alsamixer that every time only the hdmi codec is activated. I tried to disable that codec recompiling the kernel, but the result is a strange chip name shown with alsamixer, but always of type hdmi
The command "lsmod" shows that snd_hda_intel=0 always.

Edit:
I tried to use the "probe_mask" param to mask the hdmi codec. With this param in alsa.conf I have:
Code:

eposatom ~ # lsmod
Module                  Size  Used by
hid_multitouch          8164  0
usbhid                28999  0
snd_hda_codec_realtek    46545  1
snd_hda_codec_generic    41535  1 snd_hda_codec_realtek
snd_hda_intel          15457  0
snd_hda_controller    17278  1 snd_hda_intel
snd_hda_codec          73180  4 snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller
x86_pkg_temp_thermal    2932  0
snd_hwdep              5517  1 snd_hda_codec
snd_pcm                66372  3 snd_hda_codec,snd_hda_intel,snd_hda_controller
snd_timer              15553  1 snd_pcm
snd                    48364  6 snd_hwdep,snd_timer,snd_pcm,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
pcspkr                  1747  0

and
Code:

eposatom ~ # aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC262 Analog [ALC262 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Now alsamixer detects a Realtek ALC262 chip as expected, but snd-hda-intel is always 0 in lsmod. This means that it is not used.

In any case no sound

Shadow_7 02-08-2019 04:30 AM

There's stuff in /proc/asound/* that details what's available. Things shown by other means like amixer or aplay -l. Just make sure the sound is routed to the desired device. Harder to do these days since HDMI has audio, webcams have audio (input only), motherboards, graphics cards, and everything is an audio device it seems these days #surveillancestate.

Shadow_7 02-08-2019 04:34 AM

It'll be 0 in lsmod until something is using it. i.e. you have to be playing audio for it to not be 0. Not what you'd expect since other things like wifi, video, and such will always be in use by default (in most cases).

dr_berta 02-15-2019 01:59 AM

Hi,
if I try to use the command "aplay mysound.wav" I cannot ear any sound and snd-hda-intel remains 0 in lsmod
In /proc/asound I see a folder named card0 and a link to this folder named Intel. Inside card0 there ar files referencing codecs, id and so on.
My opinion is that some of these are wrong or the system is looking for something else

Using kernel 4.19 it works properly, but in /proc/asound instead to have a folder named "Intel" there is a folder named "PCH" and in card0 there are more files

Shadow_7 02-16-2019 06:24 AM

$ cat /proc/asound/cards

Should list known devices and their index. There's also a generic "name" associated with it, which allows you to call it by name without knowing it's index (if it's a unique device).

Code:

0 [Loopback      ]: Loopback - Loopback
                      Loopback 1
 1 [HDMI          ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xf0560000 irq 35
 2 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xf0564000 irq 36
 3 [C920          ]: USB-Audio - HD Pro Webcam C920
                      HD Pro Webcam C920 at usb-0000:00:12.0-1.1.1, high speed

In my case these are there. I can call the output hw:0,0 or hw:Loopback,0 for my default device. In my case I use the loopback device so I can route to pulseaudio over the network and do the resampling on the client machine. Letting the remote server machine do the resampling seems to crash pulseaudio after about an hour. Which didn't used to happen, but after an update.....

There's other things that are card specific.

$ ls -l /proc/asound/card2/
Code:

total 0
-r--r--r-- 1 root root 0 Feb 16 06:09 codec#0
-r--r--r-- 1 root root 0 Feb 16 06:09 id
dr-xr-xr-x 3 root root 0 Feb 16 06:09 pcm0c
dr-xr-xr-x 3 root root 0 Feb 16 06:09 pcm0p

The ID is the [NAME] you saw in /proc/asound/cards. The things that end in "c" are capture and that end in "p" are playback. So /proc/asound/card2/pcm0p would effectively by hw:2,0 in alsa naming conventions. Which in my case would be the speakers on the laptop. The ID is also useful if you have say two unique usb soundcards. To force the index via /etc/modprobe.d/custom_sound.conf or so with "options snd-usb-audio index=0 id=UR22mkII" in the case of my other machine with a steinberg usb soundcard. Which could also have an M-Audio usb soundcard using the same driver (snd-usb-audio)(id=MobilePre). Although it doesn't (this month).

Not that you need to know any/most of that. But if there is no index for your card in /proc/asound/cards, then you do not have a driver for it. And if the details under /proc/asound/card#/ for it lack things, you do not have certain functionality. Like "p" for playback or "c" for capture.

$ ls -l /proc/asound/card3/
Code:

total 0
-r--r--r-- 1 root root 0 Feb 16 06:21 id
dr-xr-xr-x 3 root root 0 Feb 16 06:21 pcm0c
-r--r--r-- 1 root root 0 Feb 16 06:21 stream0
-r--r--r-- 1 root root 0 Feb 16 06:21 usbbus
-r--r--r-- 1 root root 0 Feb 16 06:21 usbid
-r--r--r-- 1 root root 0 Feb 16 06:21 usbmixer

Note that my webcam, does NOT have pcm0p for "playback".

Things like pavucontrol will GUI-ize this for you, so you don't need to know / understand most of it. As long as things "work" as expected.


All times are GMT -5. The time now is 06:06 PM.