Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] HDMI audio/video
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 203

PostPosted: Fri Jun 19, 2015 12:43 am    Post subject: [SOLVED] HDMI audio/video Reply with quote

On my laptop I have a HDMI output which works with video, but I can not send audio through it. This is a HP envy4 1130-us laptop running 3.18.x kernel. Audio works through headphone out, and the built in speakers.

I've searched around on arch wiki, debian forums, and the like and I've implemented or looked in the places they have mentioned and the fixes either do not work or the data that should be outputted is not present.

When I use `aplay -L` at the very bottom I see a HDMI audio interface listed so that is good, but inside ALSAMIXER the interface is not listed when pressing F6.

When I `cat /proc/asound/cards` the HDMI interface is not listed, and only a single snd-hda-intel interface is listed.

Is there a generic HDMI audio driver I should compile into the kernel that I missed? I don't believe my laptop has a GPU so it is using the intel I5 built in graphics chipset.

Also is there a way for the OS to automatically detect HDMI output and switch audio sources, or a script that I can run to manually select the output source? (or config file options that I can write a script to edit and restart services).

---------------------------------------------------------------------------------------------------------------------

Also is there a way to set a specific output resolution over HDMI? My native resolution on my laptop is 1366 x 768, and when I plug the HDMI in for external video it does not scale well to 1080p (native resolution on the TV's) causing parts of the screen to by cut off. I tried changing options on the TV such as 4:3, 16:9, "set by program", although none of them fixed the cut off issue.

I'm not sure if it's because of my laptops weird resolution or if it's because of X11/fluxbox not setting the correct resolution when I start X with the HDMI cord plugged in.

Any help will be appreciated!


Last edited by abduct on Sat Jun 20, 2015 6:34 am; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1762

PostPosted: Fri Jun 19, 2015 5:39 pm    Post subject: Reply with quote

I think audio over HDMI is only started to be supported in linux 4
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43754
Location: 56N 3W

PostPosted: Fri Jun 19, 2015 5:43 pm    Post subject: Reply with quote

abduct,

Post your lspci. You should have tws sound cards listed.
If not, poke around it he BIOS to see if HDMI sound is disabled.

szatox

HDMI sound has worked for me since late 2.6 when I needed radeon.audio=1 as it was disabled by default.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 203

PostPosted: Fri Jun 19, 2015 6:44 pm    Post subject: Reply with quote

Code:
 # lspci
00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM77 Express Chipset LPC Controller (rev 04)
00:1f.2 RAID bus controller: Intel Corporation 82801 Mobile SATA Controller [RAID mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01)
01:00.2 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0a)
02:00.0 Network controller: Intel Corporation Centrino Wireless-N 2230 (rev c4)


Code:
 # aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=PCH
    HDA Intel PCH, 92HD91BXX Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, 92HD91BXX Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD91BXX 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


Code:
 # cat /proc/asound/cards
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xc0710000 irq 31


Just to clarify I am running the 3.18.9 kernel and the bios does not have any options regarding sound or HDMI.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43754
Location: 56N 3W

PostPosted: Fri Jun 19, 2015 7:03 pm    Post subject: Reply with quote

abduct,

It looks like you only have a single sound card, in which case, the SPDI/F digital output will be routed to HDMI.

If you unmute the Digital/IEC/PPDIF the analogue sound will probably stop working and your sound will be HDMI only.

Digital and analogue sound use different sample rates. Digital is 48kHz, analogue is 44.1kHz. Most sound cards can do both but not at the same time.
If you choose to use digital that takes priority.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 203

PostPosted: Fri Jun 19, 2015 7:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
abduct,

It looks like you only have a single sound card, in which case, the SPDI/F digital output will be routed to HDMI.

If you unmute the Digital/IEC/PPDIF the analogue sound will probably stop working and your sound will be HDMI only.

Digital and analogue sound use different sample rates. Digital is 48kHz, analogue is 44.1kHz. Most sound cards can do both but not at the same time.
If you choose to use digital that takes priority.


Thank's for the help.

Where would I unmute this?

In alsamixer I only have the Master, Headphone, Speaker, PCM, Mic, Mic Boost, S/PDIF, Internal Mic Boost, all of which were already unmuted except for "Mic". "Auto-Mute Mode" is enabled and "Loopback Mixing" is disabled.

Also the S/PDIF channel does not have a bar graph I can adjust the volume with. It just shows the mute toggle box.

I noticed in /proc/asound/pcm I have two entries:

Code:
00-00: 92HD91BXX Analog : 92HD91BZZ Analog : playback 1 : capture 1
00-03: HDMI 0 : HDMI 0 : playback 1


Do I have to mute specific channels or something? Also where is that radeon.audio option found? I can't find it in the makemenu (unless I am not searching the correct keywords). Will this harmfully effect anything since I don't actually have a radeon gpu?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43754
Location: 56N 3W

PostPosted: Fri Jun 19, 2015 8:10 pm    Post subject: Reply with quote

abduct,

I was expecting your HDMI to be the S/PDIF control.
It's correct that there is no slider. Digital audio cannot easily have a souund level control. Its always converted to analogue to be fed to loudspeakers anyway, it is much easer to do sound level control on analoge signals.

A long time ago, when HDMI audio was experimental on ATI video cards with audio over HDMI outputs, the ATI open source driver, called Radeon, disables sound over HDMI by default.
At that time, the radeon.audio=1 on the kernel command line enabled the sound. That was a long time ago and you have an Intel graphics card, so that option is not for you.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 203

PostPosted: Fri Jun 19, 2015 9:24 pm    Post subject: Reply with quote

Sorry for my ignorance NeddySeagoon.

I just went searching through the options of my various media players/music players and I found that I there are a few options one being alsa 0.0 and alsa 0.3.

Well alsa 0.3 turns out to be the digital HDMI audio output and once set I got my audio working on those media players!

The downside is that applications which cannot choose a sound interface (Firefox Aurora) still plays through my laptop speakers with HDMI plugged in.

Is there a config file, or a way to make a system wide change for the default output device? Also is there a way to see what resolution X11 is displaying at? When HDMI is plugged in a bit of my screen is being cut off on all sides on the displaying TV.

EDIT:: After a few hours and finding the ever so useful tool xrandr, I fixed all my resolution and HDMI video problems.

I am just wondering how to change the system default playback device to HDMI via bash scripting so I can switch between the standard speakers/headphones to HDMI.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 203

PostPosted: Sat Jun 20, 2015 6:40 am    Post subject: Reply with quote

After the hints from you guys I successfully got a working audio switcher going and my video output over HDMI the correct resolution.

To fix my HDMI resolution I created a bash function which called on xrandr:

Code:
function enable-hdmi () { xrandr --output LVDS1 --auto --output HDMI1 --auto --right-of LVDS1


After booting into X you can insert your HDMI cable and run the command and it will automatically poll for the best supported resolutions for the two displays.

As for my audio I found that if you run `aplay -l` (lowercase L) rather than a capital L it shows you your outputs in card:device format.

This allowed me to write a quick bash script to switch the values in /etc/asound.conf around.

Code:

#analog global output
defaults.pcm.!card 0
defaults.pcm.!device 0

#HDMI global output
#defaults.pcm.!card 0
#defaults.pcm.!device 3


The bash script consisted of 2 logic statements depending on passed parameters, one for checking which output was currently enabled by grepping the device number, and the other to set either HDMI or analog outputs via echoing the lines into the file.
Back to top
View user's profile Send private message
bec
Apprentice
Apprentice


Joined: 30 Sep 2004
Posts: 218
Location: Cali - Colombia

PostPosted: Sat Jun 20, 2015 2:55 pm    Post subject: Reply with quote

abduct wrote:
After the hints from you guys I successfully got a working audio switcher going and my video output over HDMI the correct resolution.



Hi abduct,

It would be cool if you post the bash script to control asound.conf, thanks!
_________________
abe
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 203

PostPosted: Sat Jun 20, 2015 9:19 pm    Post subject: Reply with quote

bec wrote:

Hi abduct,

It would be cool if you post the bash script to control asound.conf, thanks!


No problem. It is very hack and included in my misc functions file which I source at login.

Note I typed this in by hand just now so it may contain syntax errors or typos.
Also note that sudo may or may not be required. I am very lazy and use it everywhere where I am unsure if I have correct permissions or not. I'd rather type in my password than spend the 10 seconds seeing if I have the correct permissions.

WARNING This script completely overwrites and obliterates your asound.conf file. So if you have any other settings you wish to keep implement them into the script or use sed/awk for a search and replace to change the defaults lines within your config. I didn't have any other settings so I just overwrote it each time I changed it.

Code:
function set-default-audio () {
    #List current output device via grepping for 3 (very hack, but I only have 1 sound card (0), and only use devices 0 and  3.
    #If you have other cards using sed/awk with regex to find your device would be better) and checking for success
    if [[ $1 == "-l" ]] ; then
        sudo grep "3" /etc/asound.conf >> /dev/null
        if [[ $? -eq 0 ]] ; then
            echo "Current default sound device: HDMI"
        else
            echo "Current default sound device: Analog"
        fi
    #Set the default output device to my HDMI (card 0 device 3)
    elif [[ $1 == "-h" ]] ; then
        sudo sh -c "echo 'defaults.pcm.!card 0' > /etc/asound.conf"
        sudo sh -c "echo 'defaults.pcm.!device 3' >> /etc/asound.conf"
    #Set the default output device to my analog (card 0 device 0)
    elif [[ $1 == '-a" ]] ; then
        sudo sh -c "echo 'defaults.pcm.!card 0' > /etc/asound.conf"
        sudo sh -c "echo 'defaults.pcm.!device 0' >> /etc/asound.conf"
    fi
}


It should be fairly clear what it is doing, and where edits should be made.

To find your card and device numbers you can run "aplay -l" and simply insert them where appropriate, or copy paste the elif spans to add more devices to switch between.
Back to top
View user's profile Send private message
bec
Apprentice
Apprentice


Joined: 30 Sep 2004
Posts: 218
Location: Cali - Colombia

PostPosted: Wed Jun 24, 2015 1:42 pm    Post subject: Reply with quote

abduct wrote:


No problem. It is very hack and included in my misc functions file which I source at login.




Thank you!
_________________
abe
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1125

PostPosted: Wed Mar 09, 2016 9:18 am    Post subject: Reply with quote

Script card and device values are matching fine.
Maybe a little typo at lign 16 as it should be
Code:
function set-default-audio () {
    #List current output device via grepping for 3 (very hack, but I only have 1 sound card (0), and only use devices 0 and  3.
    #If you have other cards using sed/awk with regex to find your device would be better) and checking for success
    if [[ $1 == "-l" ]] ; then
        sudo grep "3" /etc/asound.conf >> /dev/null
        if [[ $? -eq 0 ]] ; then
            echo "Current default sound device: HDMI"
        else
            echo "Current default sound device: Analog"
        fi
    #Set the default output device to my HDMI (card 0 device 3)
    elif [[ $1 == "-h" ]] ; then
        sudo sh -c "echo 'defaults.pcm.!card 0' > /etc/asound.conf"
        sudo sh -c "echo 'defaults.pcm.!device 3' >> /etc/asound.conf"
    #Set the default output device to my analog (card 0 device 0)
    elif [[ $1 == "-a" ]] ; then
        sudo sh -c "echo 'defaults.pcm.!card 0' > /etc/asound.conf"
        sudo sh -c "echo 'defaults.pcm.!device 0' >> /etc/asound.conf"
    fi
}

Thks 4 ur attention, interest & support
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum