From a53e14b3511b2b52df1b295d321b353cc0da3516 Mon Sep 17 00:00:00 2001
From: Philipp Paulweber
Date: Sat, 7 Sep 2019 01:24:21 +0200
Subject: [PATCH] Patch: updated and added ALSA/PulseAudio configuration files
* see: https://github.com/Dunedan/mbp-2016-linux/issues/111#issuecomment-526719347
* see: https://gist.github.com/MCMrARM/c357291e4e5c18894bea10665dcebffb
---
Makefile | 16 +++-
...ib-udev-rules.d-91-pulseaudio-custom.rules | 7 ++
setup-usr-share-alsa-cards-AppleT2.conf | 77 +++++++++++++++++++
setup-usr-share-alsa-cards-apple_t2.conf | 24 ------
...udio-alsa-mixer-profile-sets-apple-t2.conf | 55 +++++++++++++
5 files changed, 151 insertions(+), 28 deletions(-)
create mode 100644 setup-usr-lib-udev-rules.d-91-pulseaudio-custom.rules
create mode 100644 setup-usr-share-alsa-cards-AppleT2.conf
delete mode 100644 setup-usr-share-alsa-cards-apple_t2.conf
create mode 100644 setup-usr-share-pulseaudio-alsa-mixer-profile-sets-apple-t2.conf
diff --git a/Makefile b/Makefile
index 6d809b4..242ad78 100644
--- a/Makefile
+++ b/Makefile
@@ -84,10 +84,18 @@ install-modules: $(MODULE)/kernel/extra
install-systemd:
@echo "-- Installing systemd configuration"
- cp -f setup-etc-modules-load.d-bce.conf /etc/modules-load.d/bce.conf
- cp -f setup-etc-modules-load.d-spi.conf /etc/modules-load.d/spi.conf
- cp -f setup-usr-share-alsa-cards-apple_t2.conf /usr/share/alsa/cards/AppleT2.conf
- cp -f setup-usr-lib-systemd-system-brcmfmac.service /usr/lib/systemd/system/brcmfmac.service
+ cp -f setup-etc-modules-load.d-bce.conf \
+ /etc/modules-load.d/bce.conf
+ cp -f setup-etc-modules-load.d-spi.conf \
+ /etc/modules-load.d/spi.conf
+ cp -f setup-usr-lib-systemd-system-brcmfmac.service \
+ /usr/lib/systemd/system/brcmfmac.service
+ cp -f setup-usr-lib-udev-rules.d-91-pulseaudio-custom.rules \
+ /usr/lib/udev/rules.d/91-pulseaudio-custom.rules
+ cp -f setup-usr-share-alsa-cards-AppleT2.conf \
+ /usr/share/alsa/cards/AppleT2.conf
+ cp -f setup-usr-share-pulseaudio-alsa-mixer-profile-sets-apple-t2.conf \
+ /usr/share/pulseaudio/alsa-mixer/profile-sets/apple-t2.conf
systemd:
@echo "-- Updating systemd environment"
diff --git a/setup-usr-lib-udev-rules.d-91-pulseaudio-custom.rules b/setup-usr-lib-udev-rules.d-91-pulseaudio-custom.rules
new file mode 100644
index 0000000..33c2d91
--- /dev/null
+++ b/setup-usr-lib-udev-rules.d-91-pulseaudio-custom.rules
@@ -0,0 +1,7 @@
+SUBSYSTEM!="sound", GOTO="pulseaudio_end"
+ACTION!="change", GOTO="pulseaudio_end"
+KERNEL!="card*", GOTO="pulseaudio_end"
+
+SUBSYSTEMS=="pci", ATTRS{vendor}=="0x106b", ATTRS{device}=="0x1803", ENV{PULSE_PROFILE_SET}="apple-t2.conf"
+
+LABEL="pulseaudio_end"
diff --git a/setup-usr-share-alsa-cards-AppleT2.conf b/setup-usr-share-alsa-cards-AppleT2.conf
new file mode 100644
index 0000000..9d12163
--- /dev/null
+++ b/setup-usr-share-alsa-cards-AppleT2.conf
@@ -0,0 +1,77 @@
+
+
+
+AppleT2.pcm.default {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+
+ type asym
+ playback.pcm {
+ type plug
+ slave.pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ }
+ capture.pcm {
+ type plug
+ slave.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ }
+ hint.device_output 0
+ hint.device_input 1
+}
+
+AppleT2.pcm.front.0 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type hw
+ card $CARD
+ device 0
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 1
+ }
+ hint.device_output 0
+ hint.device_input 1
+}
+AppleT2.pcm.front.1 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type asym
+ playback.pcm {
+ type hw
+ card $CARD
+ device 2
+ }
+ capture.pcm {
+ type hw
+ card $CARD
+ device 3
+ }
+ hint.device_output 2
+ hint.device_input 3
+}
+AppleT2.pcm.front.2 {
+ @args [ CARD ]
+ @args.CARD {
+ type string
+ }
+ type hw
+ card $CARD
+ device 4
+}
diff --git a/setup-usr-share-alsa-cards-apple_t2.conf b/setup-usr-share-alsa-cards-apple_t2.conf
deleted file mode 100644
index b705760..0000000
--- a/setup-usr-share-alsa-cards-apple_t2.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-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
-}
diff --git a/setup-usr-share-pulseaudio-alsa-mixer-profile-sets-apple-t2.conf b/setup-usr-share-pulseaudio-alsa-mixer-profile-sets-apple-t2.conf
new file mode 100644
index 0000000..42ca60c
--- /dev/null
+++ b/setup-usr-share-pulseaudio-alsa-mixer-profile-sets-apple-t2.conf
@@ -0,0 +1,55 @@
+[General]
+auto-profiles = no
+
+[Mapping builtin-speaker]
+description = Built-in Speaker
+device-strings = front:%f
+paths-output = builtin-speaker-output
+channel-map = front-left,front-right,rear-left,rear-right
+priority = 100
+direction = output
+
+[Mapping builtin-mic]
+description = Built-in Mic
+device-strings = front:%f
+paths-output = builtin-mic-input
+channel-map = left,center,right
+priority = 100
+direction = input
+
+[Mapping codec-output]
+description = Headphone
+device-strings = front:%f,1
+paths-output = codec-output
+channel-map = left,right
+priority = 100
+direction = output
+
+[Mapping codec-input]
+description = Headphone Mic
+device-strings = front:%f,1
+paths-output = codec-input
+channel-map = mono
+priority = 100
+direction = input
+
+[Profile output:builtin-speaker+input:builtin-mic]
+description = Built-in Speaker + Built-in Mic
+output-mappings = builtin-speaker
+input-mappings = builtin-mic
+skip-probe = yes
+
+[Profile output:codec-output+input:builtin-mic]
+description = Headphones + Built-in Mic
+output-mappings = codec-output
+input-mappings = builtin-mic
+
+[Profile output:codec-output+input:codec-input]
+description = Headphones + External Mic
+output-mappings = codec-output
+input-mappings = codec-input
+
+[Profile output:builtin-speaker+input:codec-input]
+description = Built-in Speaker + External Mic
+output-mappings = builtin-speaker
+input-mappings = codec-input