Macbook 14 audio

System:
  Kernel: 5.4.173-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
    Desktop: KDE Plasma 5.23.5 Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: Apple product: MacBookPro14,1 v: 1.0
    serial: <superuser required>
  Mobo: Apple model: Mac-B4831CEBD52A0C4C v: MacBookPro14,1
    serial: <superuser required> UEFI: Apple v: 447.40.12.0.0 date: 09/25/2021
Battery:
  ID-1: BAT0 charge: 37.4 Wh (97.1%) condition: 38.5/54.6 Wh (70.6%)
    volts: 12.9 min: 11.4 model: DSY bq20z451 status: Charging
CPU:
  Info: dual core model: Intel Core i5-7360U bits: 64 type: MT MCP
    arch: Amber/Kaby Lake note: check rev: 9 cache: L1: 128 KiB L2: 512 KiB
    L3: 4 MiB
  Speed (MHz): avg: 700 high: 702 min/max: 400/3600 cores: 1: 700 2: 700
    3: 700 4: 702 bogomips: 18406
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel Iris Plus Graphics 640 vendor: Apple driver: i915 v: kernel
    bus-ID: 00:02.0
  Display: x11 server: X.org 1.21.1.3 driver: loaded: modesetting
    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
    bus-ID: 00:1f.3
  Device-2: Broadcom 720p FaceTime HD Camera driver: N/A bus-ID: 03:00.0
  Sound Server-1: ALSA v: k5.4.173-1-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.20 running: no
  Sound Server-3: PulseAudio v: 15.0 running: no
  Sound Server-4: PipeWire v: 0.3.43 running: yes
Network:
  Device-1: Broadcom BCM4350 802.11ac Wireless Network Adapter vendor: Apple
    driver: brcmfmac v: kernel bus-ID: 02:00.0
  IF: wlp2s0 state: up mac: <filter>
Drives:
  Local Storage: total: 113 GiB used: 22.04 GiB (19.5%)
  ID-1: /dev/nvme0n1 vendor: Apple model: SSD SM0128L size: 113 GiB
Partition:
  ID-1: / size: 110.32 GiB used: 22.04 GiB (20.0%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-2: /boot/efi size: 299.3 MiB used: 288 KiB (0.1%) fs: vfat
    dev: /dev/nvme0n1p1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 62.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 190 Uptime: 4m Memory: 7.64 GiB used: 2.24 GiB (29.3%)
  Init: systemd Compilers: gcc: 11.1.0 clang: 13.0.0 Packages: 1219
  Shell: Zsh v: 5.8 inxi: 3.3.12

okay, alsa is removed and pipewire is installed. may you check pavucontrol again. are there any changes or different devices ?

Nothing changed.

Output devices:

Configuration:

did you try to activate the hook (Haken) at output-device in pavucontrol ? click on it and activate the speaker.

Yes, nothing happens

Yes, thank you, I know :slight_smile: that is why I want to try to install this driver: GitHub - davidjo/snd_hda_macbookpro: Kernel audio driver for Macs with 8409 HDA chip + MAX98706/SSM3515 amps to see if that works.

what about buying a cheap usb-sound adapter (often in combination with some usb-ports) and use this instead. saves a lot of lifetime and they are sold below 20 bucks ?

Which commands you followed? The github page specifies this for Arch based distros:

pacman -S wget make gcc linux-headers
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

It is also a very not elegant solution and wouldn’t work for the internal speakers.

I followed those that you posted. And I know it is for Arch, but since Manjaro was arch based, I assumed it would work. It might not, but so far I can’t try because it cannot find the appropriate headers.

you can install the headers from the software-center. search for “linux-headers” and install the headers. in case of doubt install all headers starting with 5.xx

I already installed the headers :slight_smile:

Problem is the installer script cannot find them. I assume because it is looking the wrong place.

at the step

pacman -S wget make gcc linux-headers

replace linux-header with linux5xx-headers depending what header package you’re using

Unless I am missing something, I should already have the right headers installed.

The problem was not installing the headers, but that the installer script cannot find them.

pacman -Q | grep headers                                                                                                          ✔  4s  
linux-api-headers 5.12.3-1
linux54-headers 5.4.173-1
vulkan-headers 1:1.2.203-1

You are right. See this pull request. Copy and paste the contents below into the install script and delete the original and run as root:

#!/bin/bash

# NOTA BENE - this script should be run as root

kernel_version=$(uname -r | cut -d '-' -f1)  #ie 5.2.7
major_version=$(echo $kernel_version | cut -d '.' -f1)
minor_version=$(echo $kernel_version | cut -d '.' -f2)
major_minor=${major_version}${minor_version}

revision=$(uname -r | cut -d '.' -f3)
revpart1=$(echo $revision | cut -d '-' -f1)
revpart2=$(echo $revision | cut -d '-' -f2)
revpart3=$(echo $revision | cut -d '-' -f3)

build_dir='build'
update_dir="/lib/modules/$(uname -r)/updates"
patch_dir='patch_cirrus'
hda_dir="$build_dir/hda-$kernel_version"

[[ ! -d $update_dir ]] && mkdir $update_dir
[[ ! -d $build_dir ]] && mkdir $build_dir
[[ -d $hda_dir ]] && rm -rf $hda_dir

if [ -d /usr/src/linux-headers-$(uname -r) ]; then
	# Debian Based Distro
	:
elif [ -d /usr/src/kernels/$(uname -r) ]; then
	# Fedora Based Distro
	:
elif [ -d /usr/lib/modules/$(uname -r) ]; then
	# Arch Linux Based Distro
	:
else
	echo "Linux kernel headers not found."
	echo "Debian (eg Ubuntu): /usr/src/linux-headers-$(uname -r)"
	echo "Fedora: /usr/src/kernels/$(uname -r)"
	echo "Arch Linux: /usr/lib/modules/$(uname -r)"
	echo "assuming the linux kernel headers package is not installed"
	echo "please install the appropriate linux kernel headers package:"
	echo "Debian: sudo apt install linux-headers-$revpart3"
	echo "Fedora: sudo dnf install kernel-headers"
	echo "Arch Linux: sudo pacman -S linux-headers"

	exit 1

fi


# so for 5.4.0-48 version we need to use the patched Ubuntu source
# and not the mainline kernel source
# for the moment assume will be required for any further versions
# what about 5.5, 5.6, 5.8 etc???
if [ $major_version -eq 5 -a $minor_version -eq 4 -a $revpart2 -ge 48  -a `uname -v | grep -c Ubuntu` -eq 1 ]; then

	# supposedly this should download to here
	# well that fails - get the useless metadata package
	# (remember this script should be run as root)
	#apt source linux-source

	if [ ! -d /usr/src/linux-source-$kernel_version ]; then

		echo "linux kernel source not found in /usr/src: /usr/src/linux-source-$kernel_version"
		echo "assuming the linux kernel source package is not installed"
		echo "please install the linux kernel source package:"
		echo "sudo apt install linux-source"

		exit 1
	
	fi

	tar --strip-components=3 -xvf /usr/src/linux-source-$kernel_version.tar.bz2 linux-source-$kernel_version/sound/pci/hda

else

	# attempt to download linux-x.x.x.tar.xz kernel
	wget -c https://cdn.kernel.org/pub/linux/kernel/v$major_version.x/linux-$kernel_version.tar.xz -P $build_dir

	if [[ $? -ne 0 ]]; then
   		# if first attempt fails, attempt to download linux-x.x.tar.xz kernel
   		kernel_version=$major_version.$minor_version
   		wget -c https://cdn.kernel.org/pub/linux/kernel/v$major_version.x/linux-$kernel_version.tar.xz -P $build_dir
	fi

	[[ $? -ne 0 ]] && echo "kernel could not be downloaded...exiting" && exit

	tar --strip-components=3 -xvf $build_dir/linux-$kernel_version.tar.xz linux-$kernel_version/sound/pci/hda --directory=build/

fi

mv hda $hda_dir
mv $hda_dir/Makefile $hda_dir/Makefile.orig
mv $hda_dir/patch_cirrus.c $hda_dir/patch_cirrus.c.orig
cp $patch_dir/Makefile $patch_dir/patch_cirrus* $hda_dir/
[[ $major_version == '4' ]] && sed -i 's/^#include <sound\/hda_codec.h>$/#include "hda_codec.h"/' $hda_dir/patch_cirrus.c

# as of 5.4.0-48 the 5.5 change has apparently been backported to 5.4 for Ubuntu and debian??
[[ $major_version -eq 5 && $minor_version -eq 4 && $revpart2 -ge 48 ]] && sed -i 's/event = snd_hda_jack_tbl_get_from_tag(codec, tag);/event = snd_hda_jack_tbl_get_from_tag(codec, tag, 0);/' $hda_dir/patch_cirrus.c

# if kernel version is >= 5.5 then change
# event = snd_hda_jack_tbl_get_from_tag(codec, tag);
# to
# event = snd_hda_jack_tbl_get_from_tag(codec, tag, 0);
[[ $major_version -eq 5 && $minor_version -ge 5 ]] && sed -i 's/event = snd_hda_jack_tbl_get_from_tag(codec, tag);/event = snd_hda_jack_tbl_get_from_tag(codec, tag, 0);/' $hda_dir/patch_cirrus.c

# if kernel version >= 5.6 then
# change timespec to timespec64
# change getnstimeofday to ktime_get_real_ts64
if [ $major_version -eq 5 -a $minor_version -ge 6 ]; then
   sed -i 's/timespec/timespec64/' $hda_dir/patch_cirrus.c
   sed -i 's/timespec/timespec64/' $hda_dir/patch_cirrus_new84.h
   sed -i 's/getnstimeofday/ktime_get_real_ts64/' $hda_dir/patch_cirrus.c
   sed -i 's/getnstimeofday/ktime_get_real_ts64/' $hda_dir/patch_cirrus_new84.h
fi

cd $hda_dir

make

make install

echo -e "\ncontents of $update_dir"
ls -lA $update_dir
1 Like

Amazing! It works :smiley: Thank you so much, to both of you! Now to make it easier for the OP to follow:

Step 1: Installed the 5.4.173-1 Kernel
Step 2: Installed the corresponding kernel headers
Step 3: Installed the packages ‘make’, ‘gcc’ and ‘wget’
Step 4: Downloaded the driver from GitHub - davidjo/snd_hda_macbookpro: Kernel audio driver for Macs with 8409 HDA chip + MAX98706/SSM3515 amps
Step 5: Changed script as per ishaanbhimwal’s instructions
Step 6: Installed the script as descriped on github

1 Like

sound is running ?

Yes it is :slight_smile:

schwere Geburt :sweat_smile:
don’t forget to mark it as solved, so other users with the same problem might find it also.

1 Like