summaryrefslogtreecommitdiffstats
path: root/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d
diff options
context:
space:
mode:
Diffstat (limited to 'meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d')
-rw-r--r--meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-alsa-monitor.lua151
-rw-r--r--meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua48
-rw-r--r--meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua26
-rw-r--r--meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua20
4 files changed, 245 insertions, 0 deletions
diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-alsa-monitor.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-alsa-monitor.lua
new file mode 100644
index 000000000..75a169675
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-alsa-monitor.lua
@@ -0,0 +1,151 @@
+-- ALSA monitor config file --
+
+alsa_monitor = {}
+
+alsa_monitor.properties = {
+ ["alsa.jack-device"] = false,
+ ["alsa.reserve"] = false,
+}
+
+alsa_monitor.rules = {
+ -- disable ACP (PulseAudio-like profiles)
+ {
+ matches = {
+ {
+ { "device.name", "matches", "alsa_card.*" },
+ },
+ },
+ apply_properties = {
+ ["api.alsa.use-acp"] = false,
+ },
+ },
+
+ --
+ -- Bump priority of well-known output devices
+ -- Higher priority means it gets selected as the default if it's present
+ --
+
+ -- USB card
+ {
+ matches = {
+ {
+ { "node.name", "matches", "alsa_output.*" },
+ { "api.alsa.card.driver", "=", "USB-Audio" },
+ },
+ },
+ apply_properties = {
+ ["priority.driver"] = 1300,
+ ["priority.session"] = 1300,
+ }
+ },
+
+ -- fiberdyne amp
+ {
+ matches = {
+ {
+ { "node.name", "matches", "alsa_output.*" },
+ { "api.alsa.card.id", "=", "ep016ch" },
+ },
+ },
+ apply_properties = {
+ ["priority.driver"] = 1200,
+ ["priority.session"] = 1200,
+ }
+ },
+
+ -- well-known internal devices
+ {
+ matches = {
+ {
+ -- ak4613
+ { "node.name", "matches", "alsa_output.*" },
+ { "api.alsa.card.id", "=", "ak4613" },
+ { "api.alsa.pcm.device", "=", "0" },
+ },
+ {
+ -- imx8mq
+ { "node.name", "matches", "alsa_output.*" },
+ { "api.alsa.card.id", "=", "wm8524audio" },
+ },
+ {
+ -- rcarsound
+ { "node.name", "matches", "alsa_output.*" },
+ { "api.alsa.card.id", "=", "rcarsound" },
+ { "api.alsa.pcm.device", "=", "0" },
+ },
+ {
+ -- rpi3
+ { "node.name", "matches", "alsa_output.*" },
+ { "api.alsa.pcm.name", "=", "bcm2835 ALSA" },
+ },
+ },
+ apply_properties = {
+ ["priority.driver"] = 1100,
+ ["priority.session"] = 1100,
+ }
+ },
+
+ --
+ -- Same for input devices
+ --
+
+ -- USB card
+ {
+ matches = {
+ {
+ { "node.name", "matches", "alsa_input.*" },
+ { "api.alsa.card.driver", "=", "USB-Audio" },
+ },
+ },
+ apply_properties = {
+ ["priority.driver"] = 2300,
+ ["priority.session"] = 2300,
+ }
+ },
+
+ -- microchip mic
+ {
+ matches = {
+ {
+ { "node.name", "matches", "alsa_input.*" },
+ { "api.alsa.card.id", "=", "ep811ch" },
+ },
+ },
+ apply_properties = {
+ ["priority.driver"] = 2200,
+ ["priority.session"] = 2200,
+ }
+ },
+
+ -- well-known internal devices
+ {
+ matches = {
+ {
+ -- ak4613
+ { "node.name", "matches", "alsa_input.*" },
+ { "api.alsa.card.id", "=", "ak4613" },
+ },
+ {
+ -- imx8mq
+ { "node.name", "matches", "alsa_input.*" },
+ { "api.alsa.card.id", "=", "wm8524audio" },
+ },
+ {
+ -- rcarsound
+ { "node.name", "matches", "alsa_input.*" },
+ { "api.alsa.card.id", "=", "rcarsound" },
+ },
+ },
+ apply_properties = {
+ ["priority.driver"] = 2100,
+ ["priority.session"] = 2100,
+ }
+ },
+}
+
+function alsa_monitor.enable()
+ load_monitor("alsa", {
+ properties = alsa_monitor.properties,
+ rules = alsa_monitor.rules,
+ })
+end
diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua
new file mode 100644
index 000000000..a4eb58ac8
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua
@@ -0,0 +1,48 @@
+-- V4L2 monitor config file --
+
+v4l2_monitor = {}
+v4l2_monitor.properties = {}
+
+v4l2_monitor.rules = {
+ -- An array of matches/actions to evaluate.
+ {
+ -- Rules for matching a device or node. It is an array of
+ -- properties that all need to match the regexp. If any of the
+ -- matches work, the actions are executed for the object.
+ matches = {
+ {
+ -- This matches all cards.
+ { "device.name", "matches", "v4l2_device.*" },
+ },
+ },
+ -- Apply properties on the matched object.
+ apply_properties = {
+ -- ["device.nick"] = "My Device",
+ },
+ },
+ {
+ matches = {
+ {
+ -- Matches all sources.
+ { "node.name", "matches", "v4l2_input.*" },
+ },
+ {
+ -- Matches all sinks.
+ { "node.name", "matches", "v4l2_output.*" },
+ },
+ },
+ apply_properties = {
+ --["node.nick"] = "My Node",
+ --["priority.driver"] = 100,
+ --["priority.session"] = 100,
+ --["node.pause-on-idle"] = false,
+ },
+ },
+}
+
+function v4l2_monitor.enable()
+ load_monitor("v4l2", {
+ properties = v4l2_monitor.properties,
+ rules = v4l2_monitor.rules,
+ })
+end
diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua
new file mode 100644
index 000000000..365bab59a
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua
@@ -0,0 +1,26 @@
+device_defaults = {}
+
+device_defaults.properties = {
+ -- store preferences to the file system and restore them at startup;
+ -- when set to false, default nodes and routes are selected based on
+ -- their priorities and any runtime changes do not persist after restart
+ ["use-persistent-storage"] = false,
+}
+
+function device_defaults.enable()
+ -- Selects appropriate default nodes and enables saving and restoring them
+ load_module("default-nodes", device_defaults.properties)
+
+ -- Selects appropriate default routes ("ports" in pulseaudio terminology)
+ -- and enables saving and restoring them together with
+ -- their properties (per-route/port volume levels, channel maps, etc)
+ load_script("default-routes.lua", device_defaults.properties)
+
+ if device_defaults.properties["use-persistent-storage"] then
+ -- Enables functionality to save and restore default device profiles
+ load_module("default-profile")
+
+ -- Save and restore stream-specific properties
+ load_script("restore-stream.lua")
+ end
+end
diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua
new file mode 100644
index 000000000..f6d73a3f1
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua
@@ -0,0 +1,20 @@
+-- Provide the "default" pw_metadata, which stores
+-- dynamic properties of pipewire objects in RAM
+load_module("metadata")
+
+-- Load devices
+alsa_monitor.enable()
+--v4l2_monitor.enable()
+
+-- Track/store/restore user choices about devices
+device_defaults.enable()
+
+-- Automatically suspends idle nodes after 3 seconds
+load_script("suspend-node.lua")
+
+-- Automatically sets device profiles to 'On'
+load_module("device-activation")
+
+-- Mute ALSA sinks when requested by pipewire-ic-ipc
+load_module("mixer-api")
+load_script("alsa-suspend.lua")