Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rear audio port disables front audio port when connected. #144

Closed
chrisallen opened this issue Dec 10, 2019 · 27 comments · Fixed by #170
Closed

Rear audio port disables front audio port when connected. #144

chrisallen opened this issue Dec 10, 2019 · 27 comments · Fixed by #170
Labels
bug Something isn't working

Comments

@chrisallen
Copy link

chrisallen commented Dec 10, 2019

Describe the bug
When the rear audio port is connected to speakers, the front audio port is disabled. If I disconnect the speakers from the rear audio port, the front audio port works. Here is a table of the various states.

Front Port Rear Port Result
Connected Good (Front port outputs audio)
Connected Good (Rear port outputs audio
Connected Connected Bad (Rear port outputs audio)

Expected behavior
In the last case above, I would expect that plugging headphones into the front port would disable my speakers connected to the rear port. If I plug my speakers into the front and then use the rear port for my headphones the behaviour is as I would expect it to be.

Is it possible to flip the way the ports behave?

Configuration

  • HaC Mini version: 2.4
  • OSX version: 10.15.1
  • NUC model: NUC8i7HNK
  • Boot SSD model and protocol: Samsung SSD 970 PRO 1TB
  • Second SSD model and protocol: N/A
  • First DIMM model: Crucial DDR4-2400 16GB
  • Second DIMM model: Crucial DDR4-2400 16GB
  • Display port(s) used: 1x mini-DP
  • Display resolution(s): 3440x1440 (Dell U3415W)
  • Any TB3 devices: N/A
  • Any USB devices: Apple Wired Keyboard, Razer Deathadder Mouse

Modifications
Using DW1820 Wireless Card with the kexts installed from the 2.4 installer

@chrisallen chrisallen added the bug Something isn't working label Dec 10, 2019
@chrisallen
Copy link
Author

@osy86 Is there anything more I can gather to help with your investigations? Is there a layout ID change I could do? I'm happy to try things on my side and report back.

@osy
Copy link
Owner

osy commented Dec 12, 2019

Realistically I won't have time to look into this for a while. You can take the existing XML in AppleALC for ALC700 and play around with the XML entries and see what happens.

Right now both the front and rear are mapped to node 2 https://github.com/acidanthera/AppleALC/blob/master/Resources/ALC700/Platforms11.xml you can find all the connected paths here https://osy.gitbook.io/hac-mini-guide/details/hda-fix maybe try changing one of them to node 3?

@chrisallen
Copy link
Author

Thanks! I'll give this a go and report back :)

@chrisallen
Copy link
Author

I tried building AppleALC with the front port changed to Node 3 and rear port as node 2 (as well as the other way round) no change in behaviour. I'll try get more info from Linux using the graph tool to see what happens when the front audio port is connected vs the rear.

@osy
Copy link
Owner

osy commented Dec 13, 2019

What happens on linux when you have both ports plugged in?

@chrisallen
Copy link
Author

I booted the NUC using an Ubuntu 19.10 live USB and the front audio jack disables the rear jack when both are connected. This is the correct behaviour that I would expect (which is the opposite of what happens in macOS.)

I tried to generate a codecgraph for each state, but they all end up identical.

Screen Shot 2019-12-14 at 1 16 24 AM

@chrisallen
Copy link
Author

Here is the dmesg output from boot, and also the codec#0 output from each state.

dmesg | grep -i hda

[   10.369389] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[   10.369525] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   10.369950] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[   10.369998] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[   10.442749] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC700: line_outs=1 (0x1b/0x0/0x0/0x0/0x0) type:line
[   10.442750] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[   10.442751] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[   10.442751] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[   10.442752] snd_hda_codec_realtek hdaudioC0D0:    dig-out=0x1e/0x0
[   10.442752] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[   10.442753] snd_hda_codec_realtek hdaudioC0D0:      Internal Mic=0x13
[   10.442754] snd_hda_codec_realtek hdaudioC0D0:      Internal Mic=0x12
[   11.264993] input: HDA Intel PCH Line Out as /devices/pci0000:00/0000:00:1f.3/sound/card0/input28
[   11.265053] input: HDA Intel PCH Front Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input29
[   11.265102] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input30
[   11.265154] input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input31
[   11.265206] input: HDA Intel PCH HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input32
[   11.265258] input: HDA Intel PCH HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input33
[   11.265309] input: HDA Intel PCH HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input34

codec#0_ALC700_both.txt
codec#0_ALC700_front.txt
codec#0_ALC700_rear.txt

What I noticed is the following when diffing those outputs;

When changing from rear port only to either front port only or both ports connected, this is the change that happens;

Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out (Control: name="Headphone Playback Volume", index=0, device=0)
Amp-Out vals: [0x00 0x00] >> Amp-Out vals: [0x3c 0x3c]

Pin Default 0x01011020: [Jack] Line Out at Ext Rear
Pin-ctls: 0x00: VREF_HIZ >> Pin-ctls: 0x40: OUT VREF_HIZ

Node 0x21 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out (Control: name="Headphone Playback Switch", index=0, device=0)
Amp-Out vals: [0x00 0x00] >> Amp-Out vals: [0x80 0x80]

@chrisallen
Copy link
Author

@osy86 Is there anything else I could try?

@osy
Copy link
Owner

osy commented Dec 20, 2019

Those change basically are just volume changes so it doesn't seem that any internal config changed. My hunch is that it's an OSX config issue. Probably something in the XML tells the driver which port takes priority. Maybe it's worth asking around to see if anyone else experienced similar issues on other boards?

@chrisallen
Copy link
Author

@osy86 I have done some google searching and come up empty on people with similar issues. Do you think you might have some time to look into switching the port priority for macOS? Thanks in advance! I love this project and the amazing work you do :)

@osy
Copy link
Owner

osy commented Jan 14, 2020

This seems to be an OSX default behaviour. Line Out > Headphones > Speaker. Maybe if we fake the port to be speaker instead of line out, it might work, but I don't know if that will cause other issues. You can try changing https://github.com/acidanthera/AppleALC/blob/master/Resources/ALC700/Platforms11.xml#L127 to 20 or 21 or 22 or 22 and see if you get any output. It might not work because there might be some internal verb call that is needed.

@osy
Copy link
Owner

osy commented Jan 15, 2020

Here's another possible workaround. Change https://github.com/acidanthera/AppleALC/blob/master/Resources/PinConfigs.kext/Contents/Info.plist#L5501 to AZceYQGXByUBtx4R which will manually override the pin config from line out to speaker. I think this might be best because even though the pin config indicates line out, it also has an amp linked to it, which afaik (not an audio expert) is not what line out is supposed to do.

@chrisallen
Copy link
Author

Thank you for the things to try. I'll give those a go now and report back :)

@chrisallen
Copy link
Author

I tried changing https://github.com/acidanthera/AppleALC/blob/master/Resources/PinConfigs.kext/Contents/Info.plist#L5501 to <data>AZceYQGXByUBtx4R</data> and <data>AZceYQGXByUBtx4R=</data>. both attempts I end up with no audio device.

I am now trying to other option of changing the NodeID for the Rear Line Out in Platforms11.xml

@osy
Copy link
Owner

osy commented Jan 15, 2020

Something is wrong if you don’t get audio device. Make sure it still works with no change.

@chrisallen
Copy link
Author

It works if I build from master without changing the ConfigData. Is it possible that the manual override value is incorrect?

@osy
Copy link
Owner

osy commented Jan 15, 2020

Try opening the plist and Xcode and using the bytes directly <01 97 1e 61 01 97 07 25 01 b7 1e 11>

@chrisallen
Copy link
Author

I tried using Xcode and PlistEdit Pro. Both end up with the bytes you specified, but it results in no audio device. If I go back to the previous ConfigData value, I get my Line Out device back.

Xcode

image

PlistEdit Pro

image

When I build in Xcode, I am cleaning the build dir, and then clicking "Build"

The built kext is created in ~/Library/Developer/Xcode/DerivedData/AppleALC-csgudryvmrqwwvcbimznxctdgmby/Build/Products/AppleALC.kext which I then copy to EFI partition, replacing the exisitng kext.

@osy
Copy link
Owner

osy commented Jan 15, 2020

Don't worry it's fixed :)

acidanthera/AppleALC#494

Once AppleALC is updated, I will make a new release.

@chrisallen
Copy link
Author

Oh thank you!

I was wondering, how do the old tower Mac Pro's handle it? They have an internal speaker, front audio out, and rear audio out. If my memory is correct, the front port takes priority over the rear port, and both ports take priority over the internal speaker.

here are some screenshots I was able to dig up from a Mac Pro 5,1

Front I/O Rear I/O
image image

Based on those icons next to the ports, the front port is a Headphones, and the rear port is Analog Audio Out

https://support.apple.com/en-nz/guide/mac-help/cpmh0052/mac

@chrisallen
Copy link
Author

I think it is called AnalogOut instead of IntSpeaker

@osy
Copy link
Owner

osy commented Jan 15, 2020

Oh I was only looking for "speaker". Does "AnalogOut" work?

@osy
Copy link
Owner

osy commented Jan 15, 2020

AnalogOut does not work. I found the layout file for MacPro5,1. It's layout66.xml.zlib. Inside I see

            <key>Inputs</key>
            <array>
                <string>ExtMic</string>
                <string>LineIn</string>
                <string>SPDIFIn</string>
            </array>
...
            <key>LineOut</key>
            <dict>
                <key>MuteGPIO</key>
                <integer>1</integer>
            </dict>
...
            <key>Outputs</key>
            <array>
                <string>Headphone</string>
                <string>IntSpeaker</string>
                <string>LineOut</string>
                <string>SPDIFOut</string>
            </array>

Seems like the back port is line out. Are you sure the front port takes priority over the back line out?

@chrisallen
Copy link
Author

I have sent an email to a friend of mine that has a Mac Pro 5,1 to ask him to verify.

@chrisallen
Copy link
Author

Ahh! so from my friends feedback and this thread here https://forums.macrumors.com/threads/how-to-make-my-mac-automaticially-switch-to-headphone-out-when-plugged-in.245931/ it looks like the Mac Pro can show both Line Out and Headphones as sources to select from if both are connected. and only the internal speaker is muted when headphones are connected.

This Blog post here covers more detail

https://weblog.rogueamoeba.com/2007/09/05/

"On Mac Pros, the line output device is no longer paired with the headphone output, which means that plugging in headphones doesn’t automatically switch your output to the headphone jack. No longer do you need to manually change your output via the Sound system preference, or even in SoundSource. With SoundSource’s “Auto-Switch To Headphones” option turned on, your output will switch automatically."

I wonder if it would be better to have the ALC700 show both the Headphone and Line Out outputs when both are connected, then I can simply toggle it via the sound toolbar or using the Sound Source app :)

@osy
Copy link
Owner

osy commented Jan 15, 2020

This is one of those times I disagree with OSX’s design. I think back=“int speakers” and front=hp is the behaviour any sane person expects.

@chrisallen
Copy link
Author

I just built AppleALC using your changes in acidanthera/AppleALC#494 and it is working great. One interesting side effect is that Digital Out still shows up in the list. That said, it is something I don't use :)

Thank you for all your time spent looking into this and finding a solution!

osy pushed a commit that referenced this issue Jan 25, 2020
* Fix issue with headphone port priority (fixes #144)
* Support updating boot-args using `nvram` command
* WhateverGreen updated to support AMD GPU codecs

Updated:
AirportBrcmFixup 2.0.5
AppleALC 1.4.6
AppleSupport 2.1.5
BrcmPatchRAM 2.5.1
Lilu 1.4.1
MacInfoPkg 2.1.0
OpenCorePkg 0.5.4
VirtualSMC 1.1.0
WhateverGreen 1.3.6
osy pushed a commit that referenced this issue Jan 25, 2020
* Fix issue with headphone port priority (fixes #144)
* Support updating boot-args using `nvram` command
* WhateverGreen updated to support AMD GPU codecs

Updated:
AirportBrcmFixup 2.0.5
AppleALC 1.4.6
AppleSupport 2.1.5
BrcmPatchRAM 2.5.1
Lilu 1.4.1
MacInfoPkg 2.1.0
OpenCorePkg 0.5.4
VirtualSMC 1.1.0
WhateverGreen 1.3.6
osy pushed a commit that referenced this issue Jan 25, 2020
* Fix issue with headphone port priority (fixes #144)
* Support updating boot-args using `nvram` command
* WhateverGreen updated to support AMD GPU codecs

Updated:
AirportBrcmFixup 2.0.5
AppleALC 1.4.6
AppleSupport 2.1.5
BrcmPatchRAM 2.5.1
Lilu 1.4.1
MacInfoPkg 2.1.0
OpenCorePkg 0.5.4
VirtualSMC 1.1.0
WhateverGreen 1.3.6
@osy osy closed this as completed in #170 Jan 26, 2020
osy pushed a commit that referenced this issue Jan 26, 2020
* Fix issue with headphone port priority (fixes #144)
* Support updating boot-args using `nvram` command
* WhateverGreen updated to support AMD GPU codecs

Updated:
AirportBrcmFixup 2.0.5
AppleALC 1.4.6
AppleSupport 2.1.5
BrcmPatchRAM 2.5.1
Lilu 1.4.1
MacInfoPkg 2.1.0
OpenCorePkg 0.5.4
VirtualSMC 1.1.0
WhateverGreen 1.3.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants