From cd23256ce02f3ee36c453f1a2024dded6c7a8cd7 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Sun, 29 Oct 2023 18:58:22 +0000
Subject: [PATCH] [RPI] Implement xvf3510 ALSA profiles for pipewire use.
---
.../etc/udev/rules.d/91-vocalfusion.rules | 4 ++
.../mixer/profile-sets/xvf3510.conf | 38 +++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 buildroot-external/board/ovos/raspberrypi/rootfs-overlay/usr/share/alsa-card-profile/mixer/profile-sets/xvf3510.conf
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/91-vocalfusion.rules b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/91-vocalfusion.rules
index c8539461..7c18c0c8 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/91-vocalfusion.rules
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/91-vocalfusion.rules
@@ -2,6 +2,10 @@ SUBSYSTEM!="sound", GOTO="vocalfusion_end"
ACTION!="change", GOTO="vocalfusion_end"
KERNEL!="card*", GOTO="vocalfusion_end"
+# PulseAudio profile sets
ATTR{id}=="sndxmosvocalfus",ENV{PULSE_PROFILE_SET}="xvf3510.conf"
+# ALSA profile sets
+ATTR{id}=="sndxmosvocalfus",ENV{ACP_PROFILE_SET}="xvf3510.conf"
+
LABEL="vocalfusion_end"
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/usr/share/alsa-card-profile/mixer/profile-sets/xvf3510.conf b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/usr/share/alsa-card-profile/mixer/profile-sets/xvf3510.conf
new file mode 100644
index 00000000..dfd4774b
--- /dev/null
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/usr/share/alsa-card-profile/mixer/profile-sets/xvf3510.conf
@@ -0,0 +1,38 @@
+# /usr/share/alsa-card-profile/mixer/profile-sets/xvf3510.conf
+
+[General]
+auto-profiles = no
+
+[Mapping xvf3510-2mic]
+device-strings = hw:%f
+channel-map = front-left,front-right
+exact-channels = yes
+fallback = yes
+paths-input = xvf3510-2mic
+priority = 3
+direction = input
+
+[Mapping xvf3510-stereo-output]
+device-strings = hw:%f
+channel-map = front-left,front-right
+exact-channels = yes
+fallback = yes
+paths-output = xvf3510-stereo-output
+direction = output
+priority = 2
+
+[Profile output:xvf3510-stereo-output+input:xvf3510-2mic]
+output-mappings = xvf3510-stereo-output
+input-mappings = xvf3510-2mic
+priority = 100
+skip-probe = yes
+
+[Profile output:xvf3510-stereo-output]
+output-mappings = xvf3510-stereo-output
+priority = 4
+skip-probe = yes
+
+[Profile input:xvf3510-2mic]
+input-mappings = xvf3510-2mic
+priority = 5
+skip-probe = yes