Code Monkey home page Code Monkey logo

snd_hda_macbookpro's Introduction

snd_hda_macbookpro

This is a kernel driver for sound on Macs with Cirrus 8409 HDA chips. Sound output is now reasonably complete and integrated with Linux. Sound input still needs work.

It will play audio through Internal speakers or headphones.

The primary audio should be set to Analogue Stereo Output in the Settings Audio dialog.

Sound recording from internal mike and headset mike is not yet fully interfaced with Linux user side.

The recorded sound level is very low but this is the sound level as returned in OSX. Amplification will be required eg using something like PulseEffects.

The hardware device sound format is limited to 2/4 channel 44.1 kHz S24_LE S32_LE. As long as use the default device volume control, other formats, frequencies work.

NOTA BENE: The direct hardware device (hw:0,0) and plughw:0,0 device have NO volume control so will be VERY loud!

Currently this works with MAX98706, SSM3515 and TAS5764L amplifiers. It will NOT work with other amplifiers as each amplifier requires specific programming.

Power down/sleep completely unknown and untested. At the moment everything is permanently powered on.

The Apple speaker setup is 4 speakers as a left tweeter, left woofer, right tweeter and right woofer so this is actually a classic HiFi stereo (ie 2 channel) speaker system. (These names are listed in the layout files under AppleHDA.kext/Contents/Resources).

The channel order for Linux has been modified to left tweeter, right tweeter and left woofer, right woofer as this fits in with the Linux way much better.

The driver also has been modified to duplicate a stereo sound source onto the second stereo channel so all speakers are driven (this essentially replicates the snd_hda_multi_out_analog_prepare function).

This will not sound the same as Apple (which is known to be using specific digital filter effects in CoreAudio).

To create a more Apple-like sound requires creating eg an Alsa pseudo device to channel duplicate a stereo sound and apply different digital filters to the tweeter and woofer channels.

NOTE. My primary testing kernel is now Ubuntu LTS 24.04 6.8.

The following installation setup provided by leifliddy.

Compiling and installing driver:

fedora package install

dnf install gcc kernel-devel make patch wget

ubuntu package install

apt install gcc linux-headers-generic make patch wget

arch package install

pacman -S gcc linux-headers make patch wget

void package install

xbps-install -S gcc make linux-headers patch wget

build driver

git clone https://github.com/davidjo/snd_hda_macbookpro.git
cd snd_hda_macbookpro/
#run the following command as root or with sudo
./install.cirrus.driver.sh
reboot

snd_hda_macbookpro's People

Contributors

curioustommy avatar davidjo avatar leifliddy avatar osalbahr avatar supreeeme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snd_hda_macbookpro's Issues

MacBook Pro 14,1

Thanks for working on this. I have successfully installed this patch on my MacBook Pro 14,1, based off kernel 5.3.7 and running Ubuntu 19.10. I've done a little bit of testing, and found that:

  • Headphones aren't correctly identified. The OS detects headphones whether any are plugged in or not, and sound comes out the main speaker.

  • Only the "front-left" speaker works, but this appears to come out centrally.

What other testing do you think needs to be done?

Consider adding one additional install instruction for latest Ubuntu

I performed a fresh install and needed to do one additional step to get the compile to work without hiccups:

sudo apt install linux-source-5.15.0

This is being presented as a hint once the error pops up but it's not mentioned in the install manual. I'm running Ubuntu Ubuntu 22.04 LTS but installed it via successive upgrades from 20.04 LTS - on the same day.

cp: cannot stat 'snd-hda-codec-cirrus.ko': No such file or directory

When I run the install script, I get this error

make -C /lib/modules/5.8.6-1-MANJARO/build CFLAGS_MODULE="-DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/home/jason/snd_hda_macbookpro/build/hda-5.8.6 modules
make[1]: Entering directory '/usr/lib/modules/5.8.6-1-MANJARO/build'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/lib/modules/5.8.6-1-MANJARO/build'
make: *** [Makefile:17: all] Error 2
cp snd-hda-codec-cirrus.ko /lib/modules/5.8.6-1-MANJARO/updates
cp: cannot stat 'snd-hda-codec-cirrus.ko': No such file or directory
make: *** [Makefile:22: install] Error 1

What I did was run the pacman install and then reboot, then git clone, cd, and install, but I get this error. I am using Manjaro KDE LinuX

22.04 ubuntu - steps not working?

I was using this fix in my 20.04 ubuntu mbp, I just installed 22.04 on the same mbp and the same steps did not work.
I noticed some 404s, in compilation I only see warnings pls help.
Note I have sound from Bluetooth/but nothing from wired headphones or speakers.
Thanks

$ sudo ./install.cirrus.driver.sh
--2022-04-28 17:25:09-- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.0.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.193.176, 151.101.129.176, 151.101.1.176, ...
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.193.176|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-04-28 17:25:09 ERROR 404: Not Found.

--2022-04-28 17:25:09-- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.193.176, 151.101.1.176, 151.101.65.176, ...
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.193.176|:443... connected.
HTTP request sent, awaiting response... 416 Range Not Satisfiable

The file is already fully retrieved; nothing to do.

linux-5.15/sound/pci/hda/
linux-5.15/sound/pci/hda/Kconfig
linux-5.15/sound/pci/hda/Makefile
linux-5.15/sound/pci/hda/ca0132_regs.h
linux-5.15/sound/pci/hda/hda_auto_parser.c
linux-5.15/sound/pci/hda/hda_auto_parser.h
linux-5.15/sound/pci/hda/hda_beep.c
linux-5.15/sound/pci/hda/hda_beep.h
linux-5.15/sound/pci/hda/hda_bind.c
linux-5.15/sound/pci/hda/hda_codec.c
linux-5.15/sound/pci/hda/hda_controller.c
linux-5.15/sound/pci/hda/hda_controller.h
linux-5.15/sound/pci/hda/hda_controller_trace.h
linux-5.15/sound/pci/hda/hda_eld.c
linux-5.15/sound/pci/hda/hda_generic.c
linux-5.15/sound/pci/hda/hda_generic.h
linux-5.15/sound/pci/hda/hda_hwdep.c
linux-5.15/sound/pci/hda/hda_intel.c
linux-5.15/sound/pci/hda/hda_intel.h
linux-5.15/sound/pci/hda/hda_intel_trace.h
linux-5.15/sound/pci/hda/hda_jack.c
linux-5.15/sound/pci/hda/hda_jack.h
linux-5.15/sound/pci/hda/hda_local.h
linux-5.15/sound/pci/hda/hda_proc.c
linux-5.15/sound/pci/hda/hda_sysfs.c
linux-5.15/sound/pci/hda/hda_tegra.c
linux-5.15/sound/pci/hda/hp_x360_helper.c
linux-5.15/sound/pci/hda/ideapad_s740_helper.c
linux-5.15/sound/pci/hda/patch_analog.c
linux-5.15/sound/pci/hda/patch_ca0110.c
linux-5.15/sound/pci/hda/patch_ca0132.c
linux-5.15/sound/pci/hda/patch_cirrus.c
linux-5.15/sound/pci/hda/patch_cmedia.c
linux-5.15/sound/pci/hda/patch_conexant.c
linux-5.15/sound/pci/hda/patch_cs8409-tables.c
linux-5.15/sound/pci/hda/patch_cs8409.c
linux-5.15/sound/pci/hda/patch_cs8409.h
linux-5.15/sound/pci/hda/patch_hdmi.c
linux-5.15/sound/pci/hda/patch_realtek.c
linux-5.15/sound/pci/hda/patch_si3054.c
linux-5.15/sound/pci/hda/patch_sigmatel.c
linux-5.15/sound/pci/hda/patch_via.c
linux-5.15/sound/pci/hda/thinkpad_helper.c
make -C /lib/modules/5.15.0-27-generic/build CFLAGS_MODULE="-DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/home/otuk/snd_hda_macbookpro/build/hda-5.15.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-27-generic'
CC [M] /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus.o
/home/otuk/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus.c: In function ‘cs_8409_init’:
/home/otuk/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus.c:1610:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1610 | hinfo = spec->gen.stream_analog_playback;
| ^
LD [M] /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/snd-hda-codec-cirrus.o
MODPOST /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/Module.symvers
CC [M] /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/snd-hda-codec-cirrus.mod.o
LD [M] /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/snd-hda-codec-cirrus.ko
BTF [M] /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/snd-hda-codec-cirrus.ko
Skipping BTF generation for /home/otuk/snd_hda_macbookpro/build/hda-5.15.0/snd-hda-codec-cirrus.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-27-generic'
cp snd-hda-codec-cirrus.ko /lib/modules/5.15.0-27-generic/updates
depmod -a

contents of /lib/modules/5.15.0-27-generic/updates
total 1772
-rw-r--r-- 1 root root 1812384 Apr 28 17:25 snd-hda-codec-cirrus.ko

Volume is pretty weird

Hi there!
Thanks for the fantastic work!
Everything works like a charm on MBPr 14,3.
I've a mixed feeling about the volume, I don't get if some bass are missing or the volume is very low (or both), at least compare to MacOs.
Is there a way I can help you out by providing logs or whatever?

Alsa not working

hehe... sorry to be annoying opening an issue with this title but thought it might get a ball rolling.

Good working advancing on this to this point. You might be the only person in the whole world looking into this!

It seems like understanding ALSA is an art limited to only a few. I am probably not going to be much use to you other than testing stuff if you like (and try not to blow my sound!). Where do you find ALSA guys anyways?

Macbook Pro 13.1 and various distros

Hi

Im mainly a linux server user rather than desktop, but seeing as Apple ending OS updates now for this model, i thought i would try linux in dual boot for now with the intention of fully installing and removing macos.

However regardless of the numerous distros i have tried and different mix of kernels, i cannot get the internal speakers to work. Im presuming its the newer distro releases or kernels that are giving the grief rather than the patch but this is my experience so far:

  • Ubuntu 22.04 stock kernel - Audio Device shows as Dummy Output - Patch failed with folder location erros, only tried once
  • Zorrin OS 16 Stock kernel and Liquorix - Audio device shows as Dummy Output Patch completed but no ko file in updates folder
  • Deepin Latest Stock Kernel - This one showed Intel PCH Speakers as option but no sound, Patch completed but no ko file in updates
  • Fedora 36 5.18 / 5.17 /5.16 kernel - Audio shows as dummy output patch completes fine and ko file located in update folder for each kernel tested.

Actually quite liking fedora 36 at the moment, however Bluetooth audio, usbc headphones and HDMI sound all work fine, however checking in terminal it only sees the HDMI outputs and no internal speakers.

TO be honest its fun playing and testing, be a shame to give up the macbook but worst case i will just pick up a linux compatible laptop instead

Mic not working on 14,3

I'm using Leifliddy's fork. Speakers work great, but the internal microphone still only gives static on the other end. What should I do to fix?

"linux kernel headers not found in /usr/src"

when running "sudo ./install.cirrus.driver.sh" i get the following messages:

linux kernel headers not found in /usr/src:
Debian (eg Ubuntu): /usr/src/linux-headers-5.15.8-arch1-1
Fedora: /usr/src/kernels/5.15.8-arch1-1
assuming the linux kernel headers package is not installed
please install the appropriate linux kernel headers package:
sudo apt install linux-headers-1

which is kind of annoying cuz i've definitely installed linux-headers
any help would be appreciated

Sound pops when coming from more than one audio source

When sound is played from more than one source at once (such as music and a system sound together), a very loud popping sound is emitted on the MacBookPro13,1. (Ubuntu 20.04.1 LTS, 5.4.0-56-generic). This occurs via the headphone jack and to a lesser degree, the speakers.

This does not happen every time two sounds are emitted, but it rather seems like when a waveform is at its peak and is mixed with another sound, the resulting waveform forces the speakers to jump. This is easy to test - play a YouTube video and turn the sound up and down or cause the beep sound in a terminal and every second time it will pop.

I'm going to assume this is a common problem so I'll use the rest of this issue to say that I'm happy to test or contribute to the driver in any way possible. I don't normally work with Linux drivers but I'm going to look through the code and see if I can understand any of it.

Request for help to make the scripts work

Hello,
so this is not really an issue but working with scripts is new for me and i don't know how to run them so i tried to modify Leifliddy's work related to the compiling and the installing but i didn't succeed.
I would be very glad with any help to compile and install the driver, i really hope to have my speakers working.
Regards,

Thomas.

Zorin OS (aka Ubuntu) Macbook Pro 14,1 no touchbar has no audio

I am using Zorin OS with Gnome on a macbook pro 14,1 no touchpad. if i have sound play, the bar moves up like audio is playing. The sound settings shows three audio devices, Speakers, Headphones, and HDMI / Display Port built in audio. I have installed the drivers with the package, it worked in mint, however it does not seem to be working with zorin, fedora, and arch. just to make it clear, audio works in both Windows and Mac. Thanks in advance.

Error when building driver

When I follow the instructions and run the install script, I run into the following error:

make -C /lib/modules/5.15.19-1-MANJARO/build CFLAGS_MODULE="-DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/home/daniel/drivers/snd_hda_macbookpro/build/hda-5.15.19 modules
make[1]: *** /lib/modules/5.15.19-1-MANJARO/build: No such file or directory.  Stop.
make: *** [Makefile:17: all] Error 2
cp snd-hda-codec-cirrus.ko /lib/modules/5.15.19-1-MANJARO/updates
cp: cannot stat 'snd-hda-codec-cirrus.ko': No such file or directory
make: *** [Makefile:22: install] Error 1

contents of /lib/modules/5.15.19-1-MANJARO/updates
total 0

When I check the missing file path, there is no build or updates. I made sure to run the script as root by running sudo ./install.cirrus.driver.sh.

inxi -Fazy
System:
Kernel: 5.15.19-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
root=UUID=77b72e4b-789f-458d-b88b-71d361b6e8cf rw quiet apparmor=1
security=apparmor udev.log_priority=3
Desktop: KDE Plasma 5.23.5 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM
Distro: Manjaro Linux base: Arch Linux
Machine:
Type: Laptop System: Apple product: MacBookPro14,1 v: 1.0
serial: Chassis: type: 9 v: Mac-B4831CEBD52A0C4C
serial:
Mobo: Apple model: Mac-B4831CEBD52A0C4C v: MacBookPro14,1
serial: UEFI: Apple v: 429.140.8.0.0 date: 06/13/2021
Battery:
ID-1: BAT0 charge: 51.6 Wh (100.0%) condition: 51.6/54.6 Wh (94.6%)
volts: 12.9 min: 11.4 model: SMP bq20z451 type: Li-ion serial: N/A
status: Full cycles: 23
Device-1: hidpp_battery_0 model: Logitech Wireless Mouse MX Master 3
serial: charge: 100% (should be ignored) rechargeable: yes
status: Discharging
CPU:
Info: model: Intel Core i5-7360U bits: 64 type: MT MCP arch: Amber/Kaby Lake
note: check family: 6 model-id: 0x8E (142) stepping: 9 microcode: 0xEA
Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache:
L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB
L3: 4 MiB desc: 1x4 MiB
Speed (MHz): avg: 700 min/max: 400/3600 scaling: driver: intel_pstate
governor: powersave cores: 1: 700 2: 700 3: 700 4: 700 bogomips: 18406
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities:
Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf
mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
Type: mds mitigation: Clear CPU buffers; SMT vulnerable
Type: meltdown mitigation: PTI
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl and seccomp
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional,
IBRS_FW, STIBP: conditional, RSB filling
Type: srbds mitigation: Microcode
Type: tsx_async_abort mitigation: TSX disabled
Graphics:
Device-1: Intel Iris Plus Graphics 640 vendor: Apple driver: i915 v: kernel
bus-ID: 00:02.0 chip-ID: 8086:5926 class-ID: 0300
Display: x11 server: X.org 1.21.1.3 compositor: kwin_x11 driver:
loaded: modesetting alternate: fbdev,vesa resolution: <missing: xdpyinfo>
Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:
Device-1: Intel Sunrise Point-LP HD Audio driver: snd_hda_intel v: kernel
alternate: snd_soc_skl bus-ID: 00:1f.3 chip-ID: 8086:9d71 class-ID: 0403
Device-2: Broadcom 720p FaceTime HD Camera driver: N/A bus-ID: 03:00.0
chip-ID: 14e4:1570 class-ID: 0480
Sound Server-1: ALSA v: k5.15.19-1-MANJARO running: yes
Sound Server-2: JACK v: 1.9.20 running: no
Sound Server-3: PulseAudio v: 15.0 running: yes
Sound Server-4: PipeWire v: 0.3.45 running: yes
Network:
Device-1: Broadcom BCM4350 802.11ac Wireless Network Adapter vendor: Apple
driver: brcmfmac v: kernel bus-ID: 02:00.0 chip-ID: 14e4:43a3 class-ID: 0280
IF: wlp2s0 state: up mac:
Drives:
Local Storage: total: 113 GiB used: 11.46 GiB (10.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Apple model: SSD AP0128J
size: 113 GiB block-size: physical: 4096 B logical: 4096 B speed: 31.6 Gb/s
lanes: 4 type: SSD serial: rev: 16.14.01 temp: 37.9 C scheme: GPT
ID-2: /dev/nvme0n2 maj-min: 259:3 vendor: Apple model: SSD AP0128J
size: 8 KiB block-size: physical: 4096 B logical: 4096 B speed: 31.6 Gb/s
lanes: 4 type: SSD serial: rev: 16.14.01 temp: 37.9 C
Partition:
ID-1: / raw-size: 112.65 GiB size: 110.32 GiB (97.93%)
used: 11.46 GiB (10.4%) fs: ext4 dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.3 MiB (99.76%)
used: 288 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
Alert: No swap data was found.
Sensors:
System Temperatures: cpu: 53.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info:
Processes: 203 Uptime: 55m wakeups: 4 Memory: 7.63 GiB
used: 2.12 GiB (27.8%) Init: systemd v: 250 tool: systemctl Compilers:
gcc: 11.1.0 clang: 13.0.0 Packages: pacman: 1223 lib: 332 flatpak: 0
Shell: Zsh v: 5.8 default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.12

Doesn't appear to be working on kernel 5.16.19

I upgraded to kernel 5.16.19 from (I think) 5.16.15, and this no longer appears to work. Sound does sometimes work if I plug headphones in via the USB port, but even that seems on-and-off.

I'm using Pop!_OS 22.04 beta which uses Pipewire, but prior to the kernel update, it was working fine.

If it's broken for anyone else, that would be helpful to know if it's just an issue with my system or an incompatibility with the kernel itself.

Gnome 40 - 4 channel swapped

If I set the output to analog surround 4.0 output i got front right swapped with back left.
Is there something I can do?

Ubuntu 22.04 not work while building from source

Hi, Thank you for the great driver.

I just installed Ubuntu 22.04 on my iMac 2017, and follow the steps to install the driver, but got building errors.

sudo ./install.cirrus.driver.sh 
linux-source-5.15.0/sound/pci/hda/
linux-source-5.15.0/sound/pci/hda/patch_ca0110.c
linux-source-5.15.0/sound/pci/hda/hda_intel.c
linux-source-5.15.0/sound/pci/hda/patch_cirrus.c
linux-source-5.15.0/sound/pci/hda/hda_bind.c
linux-source-5.15.0/sound/pci/hda/Kconfig
linux-source-5.15.0/sound/pci/hda/cs35l41_hda_spi.c
linux-source-5.15.0/sound/pci/hda/ideapad_s740_helper.c
linux-source-5.15.0/sound/pci/hda/patch_realtek.c
linux-source-5.15.0/sound/pci/hda/patch_analog.c
linux-source-5.15.0/sound/pci/hda/hp_x360_helper.c
linux-source-5.15.0/sound/pci/hda/hda_intel_trace.h
linux-source-5.15.0/sound/pci/hda/patch_cs8409.c
linux-source-5.15.0/sound/pci/hda/hda_controller.c
linux-source-5.15.0/sound/pci/hda/hda_intel.h
linux-source-5.15.0/sound/pci/hda/patch_hdmi.c
linux-source-5.15.0/sound/pci/hda/cs35l41_hda.c
linux-source-5.15.0/sound/pci/hda/hda_eld.c
linux-source-5.15.0/sound/pci/hda/hda_local.h
linux-source-5.15.0/sound/pci/hda/cs35l41_hda_i2c.c
linux-source-5.15.0/sound/pci/hda/ca0132_regs.h
linux-source-5.15.0/sound/pci/hda/hda_codec.c
linux-source-5.15.0/sound/pci/hda/hda_generic.h
linux-source-5.15.0/sound/pci/hda/hda_hwdep.c
linux-source-5.15.0/sound/pci/hda/hda_controller.h
linux-source-5.15.0/sound/pci/hda/hda_beep.h
linux-source-5.15.0/sound/pci/hda/patch_cs8409-tables.c
linux-source-5.15.0/sound/pci/hda/patch_sigmatel.c
linux-source-5.15.0/sound/pci/hda/cs35l41_hda.h
linux-source-5.15.0/sound/pci/hda/patch_ca0132.c
linux-source-5.15.0/sound/pci/hda/hda_component.h
linux-source-5.15.0/sound/pci/hda/hda_beep.c
linux-source-5.15.0/sound/pci/hda/patch_cs8409.h
linux-source-5.15.0/sound/pci/hda/hda_tegra.c
linux-source-5.15.0/sound/pci/hda/hda_generic.c
linux-source-5.15.0/sound/pci/hda/hda_sysfs.c
linux-source-5.15.0/sound/pci/hda/hda_auto_parser.h
linux-source-5.15.0/sound/pci/hda/hda_proc.c
linux-source-5.15.0/sound/pci/hda/hda_auto_parser.c
linux-source-5.15.0/sound/pci/hda/patch_conexant.c
linux-source-5.15.0/sound/pci/hda/hda_controller_trace.h
linux-source-5.15.0/sound/pci/hda/Makefile
linux-source-5.15.0/sound/pci/hda/patch_si3054.c
linux-source-5.15.0/sound/pci/hda/hda_jack.h
linux-source-5.15.0/sound/pci/hda/patch_via.c
linux-source-5.15.0/sound/pci/hda/thinkpad_helper.c
linux-source-5.15.0/sound/pci/hda/hda_jack.c
linux-source-5.15.0/sound/pci/hda/patch_cmedia.c
make -C /lib/modules/5.15.0-37-generic/build CFLAGS_MODULE="-DAPPLE_PINSENSE_FIXUP -DAPPLE_CODECS -DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-37-generic'
  CC [M]  /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.o
In file included from /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.c:1314:
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h: In function ‘cs_8409_apple_boot_init’:
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:1192:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1192 |         hinfo = spec->gen.stream_analog_playback;
      |               ^
  CC [M]  /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.o
In file included from ./include/sound/info.h:12,
                 from ./include/sound/hda_codec.h:13,
                 from /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.h:15,
                 from /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:11:
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:518:54: error: ‘CS8409_WARLOCK_MLK’ undeclared here (not in a function); did you mean ‘CS8409_WARLOCK’?
  518 |         SND_PCI_QUIRK(0x1028, 0x0B92, "Warlock MLK", CS8409_WARLOCK_MLK),
      |                                                      ^~~~~~~~~~~~~~~~~~
./include/sound/core.h:474:50: note: in definition of macro ‘SND_PCI_QUIRK’
  474 |         {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
      |                                                  ^~~
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:519:63: error: ‘CS8409_WARLOCK_MLK_DUAL_MIC’ undeclared here (not in a function)
  519 |       SND_PCI_QUIRK(0x1028, 0x0B93, "Warlock MLK Dual Mic", CS8409_WARLOCK_MLK_DUAL_MIC),
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

./include/sound/core.h:474:50: note: in definition of macro ‘SND_PCI_QUIRK’
  474 |         {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
      |                                                  ^~~
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:567:10: error: array index in initializer not of integer type
  567 |         [CS8409_WARLOCK_MLK] = {
      |          ^~~~~~~~~~~~~~~~~~
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:567:10: note: (near initialization for ‘cs8409_fixups’)
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:573:10: error: array index in initializer not of integer type
  573 |         [CS8409_WARLOCK_MLK_DUAL_MIC] = {
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.c:573:10: note: (near initialization for ‘cs8409_fixups’)
make[2]: *** [scripts/Makefile.build:285: /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409-tables.o] Error 1
make[1]: *** [Makefile:1875: /home/rkt/drivers/snd_hda_macbookpro/build/hda-5.15.0] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-37-generic'
make: *** [Makefile:22: all] Error 2
cp snd-hda-codec-cs8409.ko /lib/modules/5.15.0-37-generic/updates
cp: cannot stat 'snd-hda-codec-cs8409.ko': No such file or directory
make: *** [Makefile:30: install] Error 1

contents of /lib/modules/5.15.0-37-generic/updates
total 0

Is there any workaround or fix to this?

Microphone hang after plug in

Hi, hope this is the right place-

i have ubuntu 20.04 on macbook 13,1 and ran the cirrus patch. i am using at pulseaudio for surface diagnostics. I have a 3.5mm jack headphone with mic.

On start up with plugged in headphone, input works but output doesn't. (im assuming the input is receiving from internal mic based on the next behavior). after plugging out the headphone input continues to work and output (internal speaker) also works. plugging in again, output is transferred to headphone but the microphone bar hangs.

I reboot to try with no headphone, I/O works perfectly until headpphones plugged in again (same behavior as above)

Is there a solution for this? I can make do with permanent internal mic. Thanks

Can't make it work on Macbook Pro 13,3

Hi guys, first I want to thank you for the amazing work you've been doing so far, much appreciated!

I have Ubuntu running on a Macbook Pro 2017 (13,3) with touchbar. Since I don't have any experience compiling kernel modules and patches I tried out @leifliddy https://github.com/leifliddy/snd_hda_macbookpro instructions and got the following output:

Am I doing something wrong here? I'm on kernel 5.6 I think

Thanks in advance!

root@Linux-MBP:~/snd_hda_macbookpro# ./install.cirrus.driver.sh
--2020-04-20 18:18:58--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.0.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.217.176, 2a04:4e42:33::432
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.217.176|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-04-20 18:18:59 ERROR 404: Not Found.

--2020-04-20 18:18:59--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.217.176, 2a04:4e42:33::432
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.217.176|:443... connected.
HTTP request sent, awaiting response... 416 Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:120:18: error: field ‘last_play_time’ has incomplete type
  120 |  struct timespec last_play_time;
      |                  ^~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:125:18: error: field ‘first_play_time’ has incomplete type
  125 |  struct timespec first_play_time;
      |                  ^~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c: In function ‘cs_8409_hda_jack_detect_enable_callback’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:1434:6: warning: unused variable ‘err’ [-Wunused-variable]
 1434 |  int err;
      |      ^~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c: In function ‘cs_8409_init’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:1495:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1495 |         hinfo = spec->gen.stream_analog_playback;
      |               ^
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:1477:6: warning: unused variable ‘ret_unsol_enable’ [-Wunused-variable]
 1477 |  int ret_unsol_enable = 0;
      |      ^~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c: In function ‘cs_8409_cs42l83_callback’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:1844:18: warning: unused variable ‘spec’ [-Wunused-variable]
 1844 |  struct cs_spec *spec = codec->spec;
      |                  ^~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c: In function ‘cs_8409_automute’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:1885:18: warning: unused variable ‘spec’ [-Wunused-variable]
 1885 |  struct cs_spec *spec = codec->spec;
      |                  ^~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c: In function ‘patch_cs8409’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2133:8: error: implicit declaration of function ‘getnstimeofday’ [-Werror=implicit-function-declaration]
 2133 |        getnstimeofday(&(spec->last_play_time));
      |        ^~~~~~~~~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h: In function ‘cs_8409_save_and_clear_stream_format’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:697:13: warning: unused variable ‘format_id_sv’ [-Wunused-variable]
  697 |         int format_id_sv;
      |             ^~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:696:13: warning: unused variable ‘channel_id_sv’ [-Wunused-variable]
  696 |         int channel_id_sv;
      |             ^~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:695:13: warning: unused variable ‘stream_tag_sv’ [-Wunused-variable]
  695 |         u32 stream_tag_sv;
      |             ^~~~~~~~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:863,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_boot84.h: In function ‘cs42l83_device_id’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_boot84.h:2002:39: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
 2002 |         ret_id = ((retval_dev & 0xff) << 16) || (retval_rev & 0xff);
      |                  ~~~~~~~~~~~~~~~~~~~~~^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_boot84.h: In function ‘cs42l83_tip_sense’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_boot84.h:2244:13: warning: unused variable ‘newval2’ [-Wunused-variable]
 2244 |         int newval2;
      |             ^~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:865,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h: In function ‘cs42l83_headset_detect_off’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:254:13: warning: unused variable ‘newval’ [-Wunused-variable]
  254 |         int newval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h: In function ‘cs42l83_handle_button_detect’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:678:13: warning: unused variable ‘ret_detect2’ [-Wunused-variable]
  678 |         int ret_detect2 = 0;
      |             ^~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:677:13: warning: unused variable ‘ret_detect1’ [-Wunused-variable]
  677 |         int ret_detect1 = 0;
      |             ^~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h: In function ‘cs42l83_headset_rcv_enable_on’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:1054:13: warning: unused variable ‘retval’ [-Wunused-variable]
 1054 |         int retval;
      |             ^~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:867,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_intmike_format_setup_format33’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:78:13: warning: unused variable ‘new_coef9’ [-Wunused-variable]
   78 |         int new_coef9 = 0;
      |             ^~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:77:13: warning: unused variable ‘ret_coef9’ [-Wunused-variable]
   77 |         int ret_coef9 = 0;
      |             ^~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:76:13: warning: unused variable ‘retval’ [-Wunused-variable]
   76 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_intmike_format_setup_format’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:89:13: warning: unused variable ‘retval’ [-Wunused-variable]
   89 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_intmike_format_setup_enable’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:98:13: warning: unused variable ‘retval’ [-Wunused-variable]
   98 |         int retval;
      |             ^~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:867,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_intmike_stream_off_nid’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:478:13: warning: unused variable ‘retval’ [-Wunused-variable]
  478 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_linein_stream_off_nid’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:496:13: warning: unused variable ‘retval’ [-Wunused-variable]
  496 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_setup_TDM_proper_amps12’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:618:13: warning: unused variable ‘new_coef0’ [-Wunused-variable]
  618 |         int new_coef0 = 0;
      |             ^~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_sync_converters_on’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:894:13: warning: unused variable ‘retval’ [-Wunused-variable]
  894 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_sync_converters_off’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:1047:13: warning: unused variable ‘retval’ [-Wunused-variable]
 1047 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_inputs_power_nids_off’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:1355:13: warning: unused variable ‘retval’ [-Wunused-variable]
 1355 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_headset_amp_disable_TDM_proper’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2311:13: warning: unused variable ‘retval’ [-Wunused-variable]
 2311 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_linein_format_setup_enable’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2705:13: warning: unused variable ‘retval’ [-Wunused-variable]
 2705 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_interrupt_action’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2916:13: warning: unused variable ‘headset_state’ [-Wunused-variable]
 2916 |         int headset_state;
      |             ^~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2915:13: warning: unused variable ‘retval’ [-Wunused-variable]
 2915 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_headset_type_detect_event’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:3198:13: warning: unused variable ‘retstate’ [-Wunused-variable]
 3198 |         int retstate;
      |             ^~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:3197:13: warning: unused variable ‘retval’ [-Wunused-variable]
 3197 |         int retval;
      |             ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h: In function ‘cs_8409_headset_unplug_event’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:3585:25: warning: unused variable ‘spec’ [-Wunused-variable]
 3585 |         struct cs_spec *spec = codec->spec;
      |                         ^~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h: In function ‘cs_8409_headset_mike_setup’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:1075:25: warning: unused variable ‘spec’ [-Wunused-variable]
 1075 |         struct cs_spec *spec = codec->spec;
      |                         ^~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h: In function ‘cs_8409_pcm_playback_pre_prepare_hook’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:1156:19: error: storage size of ‘curtim’ isn’t known
 1156 |   struct timespec curtim;
      |                   ^~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:1160:26: warning: unused variable ‘p’ [-Wunused-variable]
 1160 |    struct hda_cvt_setup *p = NULL;
      |                          ^
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:1156:19: warning: unused variable ‘curtim’ [-Wunused-variable]
 1156 |   struct timespec curtim;
      |                   ^~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h: In function ‘cs_8409_playback_pcm_hook’:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:1250:19: error: storage size of ‘curtim’ isn’t known
 1250 |   struct timespec curtim;
      |                   ^~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:1250:19: warning: unused variable ‘curtim’ [-Wunused-variable]
At top level:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2158:1: warning: ‘cs_8409_extended_codec_verb’ defined but not used [-Wunused-function]
 2158 | cs_8409_extended_codec_verb(struct hda_codec *codec, hda_nid_t nid,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:867,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:3864:13: warning: ‘cs_8409_enable_headset_streaming_preplay’ defined but not used [-Wunused-function]
 3864 | static void cs_8409_enable_headset_streaming_preplay(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:3558:13: warning: ‘cs_8409_headset_plugin_preplay_unused2’ defined but not used [-Wunused-function]
 3558 | static void cs_8409_headset_plugin_preplay_unused2(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:3537:13: warning: ‘cs_8409_headset_plugin_preplay_unused1’ defined but not used [-Wunused-function]
 3537 | static void cs_8409_headset_plugin_preplay_unused1(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2585:13: warning: ‘cs42l83_headset_mike_format_setup_enable1b’ defined but not used [-Wunused-function]
 2585 | static void cs42l83_headset_mike_format_setup_enable1b(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2562:13: warning: ‘cs42l83_headset_mike_format_setup_enable1a’ defined but not used [-Wunused-function]
 2562 | static void cs42l83_headset_mike_format_setup_enable1a(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2529:13: warning: ‘cs42l83_headset_mike_format_setup_enable1’ defined but not used [-Wunused-function]
 2529 | static void cs42l83_headset_mike_format_setup_enable1(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:2478:13: warning: ‘cs42l83_mike_TDM_disable’ defined but not used [-Wunused-function]
 2478 | static void cs42l83_mike_TDM_disable(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:1347:13: warning: ‘playstop_disable_amp_max’ defined but not used [-Wunused-function]
 1347 | static void playstop_disable_amp_max(struct hda_codec *codec, int amp_address)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:177:13: warning: ‘cs_8409_linein_volume_setup_new’ defined but not used [-Wunused-function]
  177 | static void cs_8409_linein_volume_setup_new(struct hda_codec *codec, int volume)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84.h:166:13: warning: ‘cs_8409_intmike_volume_setup_new’ defined but not used [-Wunused-function]
  166 | static void cs_8409_intmike_volume_setup_new(struct hda_codec *codec, int volume)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:865,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:1586:13: warning: ‘cs42l83_line_or_mike_enable’ defined but not used [-Wunused-function]
 1586 | static void cs42l83_line_or_mike_enable(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:1564:13: warning: ‘cs42l83_line_or_mike_setup_audio_input’ defined but not used [-Wunused-function]
 1564 | static void cs42l83_line_or_mike_setup_audio_input(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:1527:13: warning: ‘cs42l83_line_or_mike_set_sample_rate1’ defined but not used [-Wunused-function]
 1527 | static void cs42l83_line_or_mike_set_sample_rate1(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:1091:13: warning: ‘cs42l83_set_power_state_on_nouse’ defined but not used [-Wunused-function]
 1091 | static void cs42l83_set_power_state_on_nouse(struct hda_codec *codec, int dummy)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:1052:13: warning: ‘cs42l83_headset_rcv_enable_on’ defined but not used [-Wunused-function]
 1052 | static void cs42l83_headset_rcv_enable_on(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:850:13: warning: ‘cs42l83_headset_power_on_on_nouse’ defined but not used [-Wunused-function]
  850 | static void cs42l83_headset_power_on_on_nouse(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:383:13: warning: ‘cs42l83_set_hpout_pulldown_onoff’ defined but not used [-Wunused-function]
  383 | static void cs42l83_set_hpout_pulldown_onoff(struct hda_codec *codec, int onstate)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_real84_i2c.h:277:13: warning: ‘cs42l83_headset_detect_onoff’ defined but not used [-Wunused-function]
  277 | static void cs42l83_headset_detect_onoff(struct hda_codec *codec, int onstate)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:863,
                 from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_boot84.h:1633:13: warning: ‘setup_jack_pin_config’ defined but not used [-Wunused-function]
 1633 | static void setup_jack_pin_config(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~~~
In file included from /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.c:2150:
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:653:13: warning: ‘cs_8409_reset_stream_format’ defined but not used [-Wunused-function]
  653 | static void cs_8409_reset_stream_format(struct hda_codec *codec, hda_nid_t nid, int format, int doreset)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:586:13: warning: ‘read_coefs_all_loop’ defined but not used [-Wunused-function]
  586 | static void read_coefs_all_loop(struct hda_codec *codec)
      |             ^~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:570:13: warning: ‘clear_pins’ defined but not used [-Wunused-function]
  570 | static void clear_pins(struct hda_codec *codec)
      |             ^~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:108:13: warning: ‘hda_check_power_state’ defined but not used [-Wunused-function]
  108 | static void hda_check_power_state(struct hda_codec *codec, hda_nid_t nid, int flagint)
      |             ^~~~~~~~~~~~~~~~~~~~~
/root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus_new84.h:90:21: warning: ‘hda_set_node_power_state_simple’ defined but not used [-Wunused-function]
   90 | static unsigned int hda_set_node_power_state_simple(struct hda_codec *codec, hda_nid_t nid, unsigned int power_state)
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:276: /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.o] Error 1
make[1]: *** [Makefile:1695: /root/snd_hda_macbookpro/build/hda-5.6.0] Error 2
make: *** [Makefile:5: all] Error 2
cp: cannot stat 'snd-hda-codec-cirrus.ko': No such file or directory
make: *** [Makefile:10: install] Error 1
root@Linux-MBP:~/snd_hda_macbookpro# cat compile.out 
linux-5.6/sound/pci/hda/
linux-5.6/sound/pci/hda/Kconfig
linux-5.6/sound/pci/hda/Makefile
linux-5.6/sound/pci/hda/ca0132_regs.h
linux-5.6/sound/pci/hda/hda_auto_parser.c
linux-5.6/sound/pci/hda/hda_auto_parser.h
linux-5.6/sound/pci/hda/hda_beep.c
linux-5.6/sound/pci/hda/hda_beep.h
linux-5.6/sound/pci/hda/hda_bind.c
linux-5.6/sound/pci/hda/hda_codec.c
linux-5.6/sound/pci/hda/hda_controller.c
linux-5.6/sound/pci/hda/hda_controller.h
linux-5.6/sound/pci/hda/hda_controller_trace.h
linux-5.6/sound/pci/hda/hda_eld.c
linux-5.6/sound/pci/hda/hda_generic.c
linux-5.6/sound/pci/hda/hda_generic.h
linux-5.6/sound/pci/hda/hda_hwdep.c
linux-5.6/sound/pci/hda/hda_intel.c
linux-5.6/sound/pci/hda/hda_intel.h
linux-5.6/sound/pci/hda/hda_intel_trace.h
linux-5.6/sound/pci/hda/hda_jack.c
linux-5.6/sound/pci/hda/hda_jack.h
linux-5.6/sound/pci/hda/hda_local.h
linux-5.6/sound/pci/hda/hda_proc.c
linux-5.6/sound/pci/hda/hda_sysfs.c
linux-5.6/sound/pci/hda/hda_tegra.c
linux-5.6/sound/pci/hda/hp_x360_helper.c
linux-5.6/sound/pci/hda/patch_analog.c
linux-5.6/sound/pci/hda/patch_ca0110.c
linux-5.6/sound/pci/hda/patch_ca0132.c
linux-5.6/sound/pci/hda/patch_cirrus.c
linux-5.6/sound/pci/hda/patch_cmedia.c
linux-5.6/sound/pci/hda/patch_conexant.c
linux-5.6/sound/pci/hda/patch_hdmi.c
linux-5.6/sound/pci/hda/patch_realtek.c
linux-5.6/sound/pci/hda/patch_si3054.c
linux-5.6/sound/pci/hda/patch_sigmatel.c
linux-5.6/sound/pci/hda/patch_via.c
linux-5.6/sound/pci/hda/thinkpad_helper.c
make -C /lib/modules/5.6.0-1007-oem/build M=/root/snd_hda_macbookpro/build/hda-5.6.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.6.0-1007-oem'
  CC [M]  /root/snd_hda_macbookpro/build/hda-5.6.0/patch_cirrus.o
make[1]: Leaving directory '/usr/src/linux-headers-5.6.0-1007-oem'
cp snd-hda-codec-cirrus.ko /lib/modules/5.6.0-1007-oem/updates

contents of /lib/modules/5.6.0-1007-oem/updates
total 4
drwxr-xr-x 2 root root 4096 abr 20 14:36 dkms

Linux Mint with kernel 5.15.0.33

attempting to build for Macbookpro14,1 using Linux Mint 20.3 with kernel 5.15.0.33. throwing build errors
not sure if dumb.

landon@Mintbook:~/snd_hda_macbookpro$ sudo ./install.cirrus.driver.sh 
--2022-06-28 17:46:01--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.0.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 2a04:4e42:72::432, 146.75.9.176
Connecting to cdn.kernel.org (cdn.kernel.org)|2a04:4e42:72::432|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-06-28 17:46:01 ERROR 404: Not Found.

Failed to download linux-5.15.0.tar.xz
Trying to download base kernel version linux-5.15.tar.xz
This may lead to build failures as too old
If this is an Ubuntu-based distribution this almost certainly will fail to build

--2022-06-28 17:46:01--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 2a04:4e42:72::432, 146.75.9.176
Connecting to cdn.kernel.org (cdn.kernel.org)|2a04:4e42:72::432|:443... connected.
HTTP request sent, awaiting response... 416 Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

linux-5.15/sound/pci/hda/
linux-5.15/sound/pci/hda/Kconfig
linux-5.15/sound/pci/hda/Makefile
linux-5.15/sound/pci/hda/ca0132_regs.h
linux-5.15/sound/pci/hda/hda_auto_parser.c
linux-5.15/sound/pci/hda/hda_auto_parser.h
linux-5.15/sound/pci/hda/hda_beep.c
linux-5.15/sound/pci/hda/hda_beep.h
linux-5.15/sound/pci/hda/hda_bind.c
linux-5.15/sound/pci/hda/hda_codec.c
linux-5.15/sound/pci/hda/hda_controller.c
linux-5.15/sound/pci/hda/hda_controller.h
linux-5.15/sound/pci/hda/hda_controller_trace.h
linux-5.15/sound/pci/hda/hda_eld.c
linux-5.15/sound/pci/hda/hda_generic.c
linux-5.15/sound/pci/hda/hda_generic.h
linux-5.15/sound/pci/hda/hda_hwdep.c
linux-5.15/sound/pci/hda/hda_intel.c
linux-5.15/sound/pci/hda/hda_intel.h
linux-5.15/sound/pci/hda/hda_intel_trace.h
linux-5.15/sound/pci/hda/hda_jack.c
linux-5.15/sound/pci/hda/hda_jack.h
linux-5.15/sound/pci/hda/hda_local.h
linux-5.15/sound/pci/hda/hda_proc.c
linux-5.15/sound/pci/hda/hda_sysfs.c
linux-5.15/sound/pci/hda/hda_tegra.c
linux-5.15/sound/pci/hda/hp_x360_helper.c
linux-5.15/sound/pci/hda/ideapad_s740_helper.c
linux-5.15/sound/pci/hda/patch_analog.c
linux-5.15/sound/pci/hda/patch_ca0110.c
linux-5.15/sound/pci/hda/patch_ca0132.c
linux-5.15/sound/pci/hda/patch_cirrus.c
linux-5.15/sound/pci/hda/patch_cmedia.c
linux-5.15/sound/pci/hda/patch_conexant.c
linux-5.15/sound/pci/hda/patch_cs8409-tables.c
linux-5.15/sound/pci/hda/patch_cs8409.c
linux-5.15/sound/pci/hda/patch_cs8409.h
linux-5.15/sound/pci/hda/patch_hdmi.c
linux-5.15/sound/pci/hda/patch_realtek.c
linux-5.15/sound/pci/hda/patch_si3054.c
linux-5.15/sound/pci/hda/patch_sigmatel.c
linux-5.15/sound/pci/hda/patch_via.c
linux-5.15/sound/pci/hda/thinkpad_helper.c
patching file patch_cs8409.c
Hunk #1 succeeded at 1262 (offset -8 lines).
Hunk #2 succeeded at 1271 (offset -8 lines).
Hunk #3 succeeded at 1300 (offset -8 lines).
patching file patch_cs8409.h
Hunk #3 FAILED at 328.
Hunk #4 succeeded at 359 (offset -1 lines).
1 out of 4 hunks FAILED -- saving rejects to file patch_cs8409.h.rej
make -C /lib/modules/5.15.0-33-generic/build CFLAGS_MODULE="-DAPPLE_PINSENSE_FIXUP -DAPPLE_CODECS -DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/home/landon/snd_hda_macbookpro/build/hda-5.15.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-33-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
  You are using:           gcc (Ubuntu 9.4.0-5ubuntu1) 9.4.0
  CC [M]  /home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.o
In file included from /home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.c:1306:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:157:10: error: ‘struct sub_codec’ has no member named ‘linein_jack_in’; did you mean ‘mic_jack_in’?
  157 |         .linein_jack_in = 0,
      |          ^~~~~~~~~~~~~~
      |          mic_jack_in
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:158:10: error: ‘struct sub_codec’ has no member named ‘force_status_change’
  158 |         .force_status_change = 1,
      |          ^~~~~~~~~~~~~~~~~~~
In file included from /home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.c:1306:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h: In function ‘cs_8409_apple_boot_init’:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:1192:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 1192 |         hinfo = spec->gen.stream_analog_playback;
      |               ^
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h: In function ‘cs8409_cs42l83_macbook_exec_verb’:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:2346:42: error: ‘struct sub_codec’ has no member named ‘linein_jack_in’; did you mean ‘mic_jack_in’?
 2346 |                         *res = (cs42l83->linein_jack_in) ? AC_PINSENSE_PRESENCE : 0;
      |                                          ^~~~~~~~~~~~~~
      |                                          mic_jack_in
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h: In function ‘cs8409_cs42l83_imac_exec_verb’:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:2392:42: error: ‘struct sub_codec’ has no member named ‘linein_jack_in’; did you mean ‘mic_jack_in’?
 2392 |                         *res = (cs42l83->linein_jack_in) ? AC_PINSENSE_PRESENCE : 0;
      |                                          ^~~~~~~~~~~~~~
      |                                          mic_jack_in
In file included from /home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_apple.h:3024,
                 from /home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.c:1306:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_new84.h: In function ‘get_hda_cvt_setup_apple_8409’:
/home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cirrus_new84.h:659:3: error: label at end of compound statement
  659 |   default:
      |   ^~~~~~~
make[2]: *** [scripts/Makefile.build:285: /home/landon/snd_hda_macbookpro/build/hda-5.15.0/patch_cs8409.o] Error 1
make[1]: *** [Makefile:1875: /home/landon/snd_hda_macbookpro/build/hda-5.15.0] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-33-generic'
make: *** [Makefile:22: all] Error 2
#cp snd-hda-codec-cs8409.ko /lib/modules/5.15.0-33-generic/updates
make INSTALL_MOD_DIR=updates -C /lib/modules/5.15.0-33-generic/build M=/home/landon/snd_hda_macbookpro/build/hda-5.15.0 modules_install
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-33-generic'
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support
cat: /home/landon/snd_hda_macbookpro/build/hda-5.15.0/modules.order: No such file or directory
  DEPMOD  /lib/modules/5.15.0-33-generic
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-33-generic'
depmod -a

contents of /lib/modules/5.15.0-33-generic/updates
total 0

DKMS support

I'm on arch linux and hacked the codebase for DKMS support a while ago, so the driver would get updated on each kernel upgrade (which kind-of works, but requires a long time due to the kernel-source download and the module not always working correctly until another DKMS rebuild from the new kernel after reboot, despite having build for the new kernel already).

Did anybody else work towards this or is there an easier way to handle this driver?


For my current work see:

MBP 13,1

➜  ~ uname -r
5.15.32-1-MANJARO

I installed the latest version and see the built in outputs and inputs in pavucontrol. However there is no sound output.

MacBook13,1 (A1708) audio quality is not ideal.

Hi there,

Firstly, thanks for the hard work!
We've installed your driver on our MacBook13,1 under Ubuntu 20.04 and found that the audio is particularly weak / poor.

Based on a little bit of googling, I got the impression, some MacBooks have multiple sets of speakers and the volume needs to be adjusted for the larger bass speaker, or something to that effect. Based on someone elses posts elsewhere.

However, upon opening the alsamixer tool, it does appear only one speaker has the ability to have the volume changed, remaning devices were locked at 0 and listed as s/pdif input / outputs of some kind.

Is this standard behaviour as the driver is incomplete, or is it possible to get 'good quality' sound, out of this model of Mac?

Audio device:
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
Subsystem: Intel Corporation Sunrise Point-LP HD Audio
Flags: bus master, fast devsel, latency 64, IRQ 59
Memory at 92820000 (64-bit, non-prefetchable) [size=16K]
Memory at 90000000 (64-bit, non-prefetchable) [size=64K]
Capabilities: [50] Power Management version 3
Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel

Please let me know what we should be doing, if anything. The sound works but it's not ideal for listening to music or even really video conferencing.

How to avoid stereo duplication / improve audio quality by replicating CoreAudio filtering

This commit talks about stereo duplication: 063110b and this is also mentioned in the README changes in 6640c79

I wonder if this (current-state) is enough for good audio, or if it's possible to get full access to the speaker array to do something like https://github.com/chadmed/asahi-audio (the author also wants to find a more generic plug-and-play solution: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2210).

//Edit:

Here's the resources I found already:

  • Lengthy discussion about alsa and pulse configs, but not channel-specific tuning / generic DSP: #23
  • Talks about volume being incorrect in old version and more generic presets for EasyEffects: #13

Support for MBP 14,2

Hello,
I would have to request the support for MBP 14,2 if you mind.
I managed (EDIT : with HUGE help from leifliddy) to make my speakers work by swapping the device id's with the MBP14,1 in the files you provided.
So I think the support for MBP 14,2 should be added if possible.

Regards,
Thomas.

Fedora 36 ends install with error

When I run the install.cirrus.driver.sh with sudo, the terminal prints the following error:

make[1]: Entering directory. '/usr/lib/modules/5.17.5-300.fc36.x86_64/build
make[1]: *** No rule to make target 'modules':
stop.
make[1]: Leaving diréctory'/usr/lib/modules/5.17.5-300.fc36.x86_64/build
make: *** Makefile:22: all] Error 2
cp snd-hda-codec-cs8409.ko/lib/modules/5.17.5-300.fc36.×86_64/updates
cp: cannot stat 'snd-hda-codec-cs8409. ko": No such file or directory
make: *** [Makefile:30: install] Error 1

Should I change something in the install.cirrus.driver.sh to prevent this error?

add patch to package listings

Please add the patch package to the install package instructions.
ie
dnf install wget make gcc kernel-devel patch

Also it might be a good idea to use set -e at the top of your install script

#!/bin/bash

set -e

# NOTA BENE - this script should be run as root

So that if any errors are encountered -- like if you don't have the patch binary installed for example, then the script will exit upon that command hitting a non-zero exit.

linux-5.18.13/sound/pci/hda/patch_sigmatel.c
linux-5.18.13/sound/pci/hda/patch_via.c
linux-5.18.13/sound/pci/hda/thinkpad_helper.c
./install.cirrus.driver.sh: line 142: patch: command not found

otherwise it'll keep right on going ; )

linux-5.18.13/sound/pci/hda/patch_sigmatel.c
linux-5.18.13/sound/pci/hda/patch_via.c
linux-5.18.13/sound/pci/hda/thinkpad_helper.c
./install.cirrus.driver.sh: line 141: patch: command not found
./install.cirrus.driver.sh: line 143: patch: command not found
make -C /lib/modules/5.18.13-200.fc36.x86_64/build CFLAGS_MODULE="-DAPPLE_PINSENSE_FIXUP -DAPPLE_CODECS -DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/root/snd_hda_macbookpro/build/hda-5.18.13 modules
make[1]: Entering directory '/usr/src/kernels/5.18.13-200.fc36.x86_64'
  CC [M]  /root/snd_hda_macbookpro/build/hda-5.18.13/patch_cs8409.o

major changes with 1.18.*?

You should take a look at kernel 5.18. (really usable changes systemwide!), whichs begins to pop up in major distributions currently.

The script throws out 3 new 'error' messages while compiling now. and while the errors seem not be severe ( some things seem not to be declared properly, you should have corrected it in a minute) the context is interesting: a whole zoology of different chip-types, amps and codes now ( this seemed to be not there in 5.17). Somehow the kernel itself seem to converge in your direction?

Hopefully you can alter the script soon. Just try a current kernel for fun for a few minutes, try the script and take a look at the errors. Realy, realy interesting.
Otherwise currently the script will not work anymore for anyone with a kernel after 5.17 anymore. Hope you fix this very soon.

No audio after suspend

Hi again folks! I've noticed that after sleeping and resuming my macbook (closing the lid) I get no audio. Maybe some modules need to be reloaded?

gentoo support

It seems that this shell script is to download a vanilla kernel source code and then modify the file for module compilation. Can you release it as a patch file or support the operation of the existing kernel source code version or support the compilation of Gentoo distribution?

Imac 18,1

squeaking, long beep or other sometimes when launching an application,

I think on Ubuntu the snaps cause a problem with the driver, when it gives a long beep, you have to change the socket, for example from internal to external to stop the snapping, see if such sound is produced for several seconds the took of;
twitches on gnome terminal when deleting while there is nothing in input etc...(noise), best solution would be to take another desktop environment, or fix tics at times, otherwise it usually works fine

Mainline?

Hi,

first off, thanks for making this driver! It works great.
My question would be if this could be mainlined into the kernel, since there is probably some demand for sound on newer MacBooks. It took me quite some time to discover this driver, since it's not yet mentioned in many of the forums.

I understand that this is still in very early stages, but mainlining it could kickstart more development work and significantly help the Linux-on-Mac ecosystem.

Let me know if this was already a topic being discussed.

Cheers!

Getting an error on Manjaro 5.8.16

make -C /lib/modules/5.8.16-2-MANJARO/build CFLAGS_MODULE="-DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/home/bruh/snd_hda_macbookpro/build/hda-5.8.16 modules
make[1]: Entering directory '/usr/lib/modules/5.8.16-2-MANJARO/build'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/lib/modules/5.8.16-2-MANJARO/build'
make: *** [Makefile:17: all] Error 2
cp snd-hda-codec-cirrus.ko /lib/modules/5.8.16-2-MANJARO/updates
cp: cannot stat 'snd-hda-codec-cirrus.ko': No such file or directory
make: *** [Makefile:22: install] Error 1

contents of /lib/modules/5.8.16-2-MANJARO/updates
total 0

Hi, I am getting this error on Manjaro kernel 5.8.16.

Can you please suggest a fix?

Thanks in advance 😄

iMac 19.1 sound issue

I am trying to make sound work on iMac 19.1. It looks like I have the same sound hardware as most latest MBPs. Everything I tried never worked. Here is the result of inxi -SMA:

System:
Host: aydar-iMac Kernel: 5.6.11-050611-generic x86_64 bits: 64
Desktop: Gnome 3.36.1 Distro: Ubuntu 20.04 LTS (Focal Fossa)
Machine:
Type: Laptop System: Apple product: iMac19,1 v: 1.0 serial: C02ZD2YBJV3N
Mobo: Apple model: Mac-AA95B1DDAB278B95 v: iMac19,1
serial: C02936600JNKDMX2S UEFI: Apple v: 1037.100.345.0.0 date: 02/17/2020
Audio:
Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel
Device-2: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]
driver: snd_hda_intel
Sound Server: ALSA v: k5.6.11-050611-generic

initialize apple hardware correct

Ever thought about why the verbs of Microsoft Windows drivers INF file didn't work? Might be we have a hardware initialization problem.

Problems with Imac 18.3 2017 27" 5K

I have tried installing this patch on the above running Linux mint, but with no success.

As far as I can see, the Cirrus soundchip is the same, but the amp chip maby not so.

Does anyone know whether this patch can work for an Imac 18.3 2017 27" 5K or if there are other ways of getting working audio on this with linux?

Doesn't work in kernel 5.13 (Ubuntu 21.10) for MBP13,1

Hello.
Thank you very much for working on this. I just tried it on kernel 5.13 (Ubuntu 21.10) for MBP13,1, and it didn't work unfortunately.
It seems to install correctly, but then I don't see any audio devices after rebooting.
Would it be possible to fix it? Thanks a lot!

Compile issue on Linux 4.15

I am having trouble compiling. Below is the output. Please help!

--2020-11-17 20:56:25-- https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.15.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.49.176, 2a04:4e42:c::432
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.49.176|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 102181404 (97M) [application/x-xz]
Saving to: ‘build/linux-4.15.tar.xz’

linux-4.15.tar.xz 100%[===================>] 97.45M 7.03MB/s in 14s

2020-11-17 20:56:39 (6.86 MB/s) - ‘build/linux-4.15.tar.xz’ saved [102181404/102181404]

linux-4.15/sound/pci/hda/
linux-4.15/sound/pci/hda/Kconfig
linux-4.15/sound/pci/hda/Makefile
linux-4.15/sound/pci/hda/ca0132_regs.h
linux-4.15/sound/pci/hda/dell_wmi_helper.c
linux-4.15/sound/pci/hda/hda_auto_parser.c
linux-4.15/sound/pci/hda/hda_auto_parser.h
linux-4.15/sound/pci/hda/hda_beep.c
linux-4.15/sound/pci/hda/hda_beep.h
linux-4.15/sound/pci/hda/hda_bind.c
linux-4.15/sound/pci/hda/hda_codec.c
linux-4.15/sound/pci/hda/hda_codec.h
linux-4.15/sound/pci/hda/hda_controller.c
linux-4.15/sound/pci/hda/hda_controller.h
linux-4.15/sound/pci/hda/hda_controller_trace.h
linux-4.15/sound/pci/hda/hda_eld.c
linux-4.15/sound/pci/hda/hda_generic.c
linux-4.15/sound/pci/hda/hda_generic.h
linux-4.15/sound/pci/hda/hda_hwdep.c
linux-4.15/sound/pci/hda/hda_intel.c
linux-4.15/sound/pci/hda/hda_intel.h
linux-4.15/sound/pci/hda/hda_intel_trace.h
linux-4.15/sound/pci/hda/hda_jack.c
linux-4.15/sound/pci/hda/hda_jack.h
linux-4.15/sound/pci/hda/hda_local.h
linux-4.15/sound/pci/hda/hda_proc.c
linux-4.15/sound/pci/hda/hda_sysfs.c
linux-4.15/sound/pci/hda/hda_tegra.c
linux-4.15/sound/pci/hda/local.h
linux-4.15/sound/pci/hda/patch_analog.c
linux-4.15/sound/pci/hda/patch_ca0110.c
linux-4.15/sound/pci/hda/patch_ca0132.c
linux-4.15/sound/pci/hda/patch_cirrus.c
linux-4.15/sound/pci/hda/patch_cmedia.c
linux-4.15/sound/pci/hda/patch_conexant.c
linux-4.15/sound/pci/hda/patch_hdmi.c
linux-4.15/sound/pci/hda/patch_realtek.c
linux-4.15/sound/pci/hda/patch_si3054.c
linux-4.15/sound/pci/hda/patch_sigmatel.c
linux-4.15/sound/pci/hda/patch_via.c
linux-4.15/sound/pci/hda/thinkpad_helper.c
make -C /lib/modules/4.15.0-124-generic/build CFLAGS_MODULE="-DCONFIG_SND_HDA_RECONFIG=1 -Wno-unused-variable -Wno-unused-function" M=/tmp/snd_hda_macbookpro/build/hda-4.15.0 modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-124-generic'
CC [M] /tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus.o
/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus.c: In function ‘cs_8409_init’:
/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus.c:1610:15: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
hinfo = spec->gen.stream_analog_playback;
^
In file included from /tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus.c:1944:0:
/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus_hda_generic_copy.h: In function ‘is_ctl_used’:
/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus_hda_generic_copy.h:273:2: error: implicit declaration of function ‘snd_array_for_each’; did you mean ‘snd_array_free’? [-Werror=implicit-function-declaration]
snd_array_for_each(&spec->paths, i, path) {
^~~~~~~~~~~~~~~~~~
snd_array_free
/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus_hda_generic_copy.h:273:44: error: expected ‘;’ before ‘{’ token
snd_array_for_each(&spec->paths, i, path) {
^
/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus_hda_generic_copy.h:278:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
cc1: some warnings being treated as errors
scripts/Makefile.build:330: recipe for target '/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus.o' failed
make[2]: *** [/tmp/snd_hda_macbookpro/build/hda-4.15.0/patch_cirrus.o] Error 1
Makefile:1585: recipe for target 'module/tmp/snd_hda_macbookpro/build/hda-4.15.0' failed
make[1]: *** [module/tmp/snd_hda_macbookpro/build/hda-4.15.0] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-124-generic'
Makefile:17: recipe for target 'all' failed
make: *** [all] Error 2
cp snd-hda-codec-cirrus.ko /lib/modules/4.15.0-124-generic/updates
cp: cannot stat 'snd-hda-codec-cirrus.ko': No such file or directory
Makefile:22: recipe for target 'install' failed
make: *** [install] Error 1

contents of /lib/modules/4.15.0-124-generic/updates
total 4
drwxr-xr-x 2 root root 4096 Nov 17 20:46 dkms

Document where you've forked these files

Could you please add a reference from which kernel/branch/sha you've forked your work?

It would be very practical for porting your changes to another kernel version, at this moment we'll have to guess what sources you've used as a base for patch_cirrus.c etc.

Nice work though! 🎊

MacBook Pro mid 2017

In 4.0 surround mode:
This would work perfectly if the front right was left and the rear right was right)
Can I change this somehow?

I add to default.pa
load-module module-remap-sink channels=2 master_channel_map=front-right,rear-right channel_map=left,right remix=no

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.