]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
sun4i-codec: add routing for headphones and internal speaker
authorRyan Walklin <ryan@testtoast.com>
Sat, 21 Dec 2024 10:01:14 +0000 (23:01 +1300)
committerJaroslav Kysela <perex@perex.cz>
Wed, 29 Jan 2025 09:26:34 +0000 (10:26 +0100)
The sun4i-codec kernel driver covers a large number of Allwinner SoCs.
The H616 codec has a single line-out route, which is used in concert
with a Toshiba mux chip to send audio to either an internal speaker or
headphone jack on a number of Anbernic handheld gaming devices.

Add a UCM configuration to allow enabling/disabling the speaker amp
depending on whether headphones are in use or not.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/491
Signed-off-by: Ryan Walklin <ryan@testtoast.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/Allwinner/sun4i-h616/HiFi.conf [new file with mode: 0644]
ucm2/conf.d/sun4i-codec/h616-audio-codec.conf [new file with mode: 0644]

diff --git a/ucm2/Allwinner/sun4i-h616/HiFi.conf b/ucm2/Allwinner/sun4i-h616/HiFi.conf
new file mode 100644 (file)
index 0000000..2cb9a31
--- /dev/null
@@ -0,0 +1,35 @@
+SectionDevice."Speaker" {
+       Comment "Internal Speaker"
+
+       EnableSequence [
+               cset "name='Speaker Switch' on"
+       ]
+
+       Value {
+               PlaybackMixerElem "Line Out"
+               PlaybackPCM "hw:${CardId},0"
+       }
+
+       DisableSequence [
+               cset "name='Speaker Switch' off"
+       ]
+
+       ConflictingDevice [
+               "Headphones"
+       ]
+}
+
+
+SectionDevice."Headphones" {
+       Comment "Headphones"
+
+       Value {
+               PlaybackMixerElem "Line Out"
+               PlaybackPCM "hw:${CardId},0"
+               JackControl "Headphone Jack"
+       }
+
+       ConflictingDevice [
+               "Speaker"
+       ]
+}
diff --git a/ucm2/conf.d/sun4i-codec/h616-audio-codec.conf b/ucm2/conf.d/sun4i-codec/h616-audio-codec.conf
new file mode 100644 (file)
index 0000000..240f41a
--- /dev/null
@@ -0,0 +1,8 @@
+# UCM for Allwinner H616 Codec
+
+Syntax 3
+
+SectionUseCase."HiFi" {
+       File "/Allwinner/sun4i-h616/HiFi.conf"
+       Comment "Play HiFi quality Music"
+}