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

MacBook Pro 15+: Audio Support #111

Open
aunali1 opened this issue Aug 6, 2019 · 19 comments
Open

MacBook Pro 15+: Audio Support #111

aunali1 opened this issue Aug 6, 2019 · 19 comments

Comments

@aunali1
Copy link
Contributor

aunali1 commented Aug 6, 2019

Discussion and updates regarding Apple Audio related support. Parent thread is #71.

@MCMrARM
Copy link

MCMrARM commented Aug 19, 2019

Small note: I fixed the start audio glitch, audio is mostly fine now.

As I stated before, the config has to be written if we want both speaker and headphones to work, and I have no 20 hours to waste. If anyone else is willing to spend the time trying to understand that format, I'd gladly appreciate it.

@MCMrARM
Copy link

MCMrARM commented Aug 19, 2019

Ok I wrote a config:

<confdir:pcm/front.conf>
<confdir:pcm/surround40.conf>

AppleT2.pcm.surround40.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type hw
	card $CARD
	device 1
}
AppleT2.pcm.front.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type hw
	card $CARD
	device 0
}

Put this in /usr/share/alsa/cards/AppleT2.conf
No idea if this can be written in a better way or not, for now this is what we're stuck with.

@mikeeq
Copy link

mikeeq commented Aug 19, 2019

I can confirm that with ALSA config file mentioned above there are now two configurations in sound settings:

  • Analog Surround 4.0 Output - speakers
  • Analog Stereo Output - headphone jack
    and one output device.
    Microphone is still not available and audio output configuration are not dynamically changed (dis/connecting headphones). Nevertheless really good job @MCMrARM!

In the mean time could you please check wifi thread - #112

I'm pretty sure noone (besides you) was able to make wifi working. Maybe we are missing something. Cheers everyone!

ppaulweber added a commit to ppaulweber/linux-mba that referenced this issue Aug 28, 2019
@mikeeq
Copy link

mikeeq commented Aug 28, 2019

@MCMrARM to make internal mic working do we need to only modify existing ALSA config file or does it need any work on driver side to be done?

@MCMrARM
Copy link

MCMrARM commented Aug 28, 2019

Work on the driver needs to be done.

@MCMrARM
Copy link

MCMrARM commented Aug 28, 2019

Implemented jack detection: MCMrARM/mbp2018-bridge-drv@d3224b8
No idea how to integrate into alsa ¯\_(ツ)_/¯

@MCMrARM
Copy link

MCMrARM commented Aug 28, 2019

I'll try to get the microphone working tomorrow, no promises though.

@MCMrARM
Copy link

MCMrARM commented Aug 29, 2019

Some good news: I got internal mic working at all, will push code today. Not sure how good are the results. The microphone is apparently a triple-channel device btw. Might be a little bit of a mess to get it working in alsa.

edit: will do it tomorrow, as I had issues with glitches and had to do some hacks.

@MCMrARM
Copy link

MCMrARM commented Aug 30, 2019

Ok, this took a while to figure out but I got the mic/external audio input working under Pulse.
https://gist.github.com/MCMrARM/c357291e4e5c18894bea10665dcebffb <- required files
Note that the new commits broke the old audio config, and you MUST switch to the new configuration if you update. Though the mic works now, so nice.

@mikeeq
Copy link

mikeeq commented Aug 30, 2019

@MCMrARM are there any additional steps needed? I copied those 3 config files, recompiled module, loaded it and there's no audio/input device now - only dummy output.

Update: My bad i didn't execute dracut to update initramfs... ehh. So after a reboot there are two output devices with two configurations each (as it is in pulseaudio config file from link above) but any input device is not recognized ;). I was trying to modify that pulseaudio config file and maybe we need to change paths-output to paths-input in mappings for mics ;)

@MCMrARM
Copy link

MCMrARM commented Sep 1, 2019

@mikeeq I mean, I don't know, it works for me. Does changing the paths-output to paths-input work for you?

@mikeeq
Copy link

mikeeq commented Sep 3, 2019

@aunali1 @ppaulweber @jhohisel Has anyone of you guys tried to use new audio driver and is microphone working for you? For me, after changing to paths-input microphones are visible in sound settings but they are not working.

@jbg
Copy link

jbg commented Apr 8, 2020

With the driver from latest git and the config files linked above, launching pulseaudio fails on my MBP15,2 with:

Apr 08 19:00:58 little kernel: aaudio_pcm_open
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_params
Apr 08 19:00:58 little kernel: aaudio_pcm_open
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_params
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_free
Apr 08 19:00:58 little kernel: aaudio_pcm_close
Apr 08 19:00:58 little kernel: aaudio_pcm_open
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_params
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_free
Apr 08 19:00:58 little kernel: aaudio_pcm_close
Apr 08 19:00:58 little kernel: aaudio_pcm_open
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_params
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_free
Apr 08 19:00:58 little kernel: aaudio_pcm_close
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_free
Apr 08 19:00:58 little kernel: aaudio_pcm_close
Apr 08 19:00:58 little kernel: aaudio_pcm_open
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_params
Apr 08 19:00:58 little kernel: aaudio_pcm_trigger 1
Apr 08 19:00:58 little kernel: aaudio: Backed up the buffer in 72794953ns [16640]
Apr 08 19:00:58 little kernel: aaudio aaudio: Received timestamp update for dev=3a ts=480cfd953e seed=0
Apr 08 19:00:58 little kernel: aaudio: Started the audio device in 97586739ns
Apr 08 19:00:58 little kernel: aaudio_pcm_open
Apr 08 19:00:58 little kernel: aaudio_pcm_hw_params
Apr 08 19:00:58 little kernel: x86/PAT: pulseaudio:1681 map pfn RAM range req uncached-minus for [mem 0x7c440000-0x7c470fff], got write-back
Apr 08 19:00:58 little kernel: aaudio_pcm_trigger 1
Apr 08 19:00:58 little kernel: aaudio: Started the audio device in 3235965ns
Apr 08 19:00:58 little kernel: aaudio_pcm_pointer while not started
Apr 08 19:00:58 little kernel: aaudio aaudio: Received timestamp update for dev=21 ts=4810dd812a seed=0
Apr 08 19:00:59 little systemd[748]: Started Sound Service.
Apr 08 19:00:59 little kernel: aaudio aaudio: Received timestamp update for dev=3a ts=4821a726d0 seed=0
Apr 08 19:00:59 little kernel: aaudio aaudio: Received timestamp update for dev=21 ts=48258774df seed=0
Apr 08 19:00:59 little kernel: aaudio aaudio: Received timestamp update for dev=3a ts=4836508bf2 seed=0
Apr 08 19:00:59 little kernel: aaudio_pcm_trigger 0
Apr 08 19:00:59 little kernel: aaudio_pcm_hw_free
Apr 08 19:00:59 little kernel: aaudio_pcm_close
Apr 08 19:00:59 little kernel: aaudio_pcm_trigger 0
Apr 08 19:00:59 little kernel: aaudio_pcm_hw_free
Apr 08 19:00:59 little kernel: aaudio_pcm_close
Apr 08 19:00:59 little systemd[748]: pulseaudio.service: Main process exited, code=killed, status=9/KILL

@jbg
Copy link

jbg commented Apr 8, 2020

Disabling realtime scheduling in pulseaudio fixes the above. It appears that with this driver, pulseaudio spends too much time in realtime blocks and gets killed.

@cristianmiranda
Copy link

Hi guys, you're doing a great job @MCMrARM !
I have a quick question, I'm running Ubuntu on a MacbookPro 2017 (no T2 chip), would this approach work for me? Can i try https://github.com/MCMrARM/mbp2018-bridge-drv ?
Thanks!

@leifliddy
Copy link

Have you tried this repo yet?
https://github.com/MCMrARM/mbp2018-bridge-drv

I would just add add an install command to that Makefile
ie

obj-m += bce.o
bce-objs := pci.o mailbox.o queue.o queue_dma.o vhci/vhci.o vhci/queue.o vhci/transfer.o audio/audio.o audio/protocol.o audio/protocol_bce.o audio/pcm.o

MY_CFLAGS += -DWITHOUT_NVME_PATCH
#MY_CFLAGS += -g -DDEBUG
ccflags-y += ${MY_CFLAGS}
CC += ${MY_CFLAGS}

all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

install:
        mkdir -p /lib/modules/$(shell uname -r)/updates
        cp bce.ko /lib/modules/$(shell uname -r)/updates
        depmod -a

**the lines under all: clean: and install: need to be indented with a tab
then just run, make + make install + reboot
Give that a shot and see if it works.

@cristianmiranda
Copy link

Hey, thanks! I haven't installed linux on my T2 macbook, but if I decide to do it I'll definitely check this out. Thanks again!

@mushoku-ningen
Copy link

mushoku-ningen commented Jul 30, 2020

@leifliddy it doesnt work why
im a simple man who uses 15,4 mac and wants sound in arch llinux

00:1f.3 Audio device: Intel Corporation Cannon Point-LP High Definition Audio Controller (rev 30)
        Subsystem: Intel Corporation Device 7270
        Flags: bus master, fast devsel, latency 64, IRQ 55
        Memory at 91a10000 (64-bit, non-prefetchable) [size=16K]
        Memory at 4000000000 (64-bit, non-prefetchable) [size=1M]
        Capabilities: <access denied>
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel, snd_soc_skl, snd_sof_pci
--
02:00.3 Multimedia audio controller: Apple Inc. Apple Audio Device (rev 01)
        Subsystem: Apple Inc. Device 1885
        Flags: fast devsel
        Memory at b0c00000 (64-bit, prefetchable) [disabled] [size=4M]
        Memory at b1180000 (64-bit, prefetchable) [disabled] [size=512K]
        Memory at b1230000 (64-bit, prefetchable) [disabled] [size=64K]
        Capabilities: <access denied>

@mushoku-ningen
Copy link

@leifliddy
my problem solved
you should add mkinitcpio -p linux at the end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants