From 24008a2f93b39a33863c7e64ab2f7214d9970a1c Mon Sep 17 00:00:00 2001 From: Ryan Walklin Date: Sat, 21 Dec 2024 23:01:14 +1300 Subject: [PATCH] sun4i-codec: add routing for headphones and internal speaker 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 Signed-off-by: Jaroslav Kysela --- ucm2/Allwinner/sun4i-h616/HiFi.conf | 35 +++++++++++++++++++ ucm2/conf.d/sun4i-codec/h616-audio-codec.conf | 8 +++++ 2 files changed, 43 insertions(+) create mode 100644 ucm2/Allwinner/sun4i-h616/HiFi.conf create mode 100644 ucm2/conf.d/sun4i-codec/h616-audio-codec.conf diff --git a/ucm2/Allwinner/sun4i-h616/HiFi.conf b/ucm2/Allwinner/sun4i-h616/HiFi.conf new file mode 100644 index 0000000..2cb9a31 --- /dev/null +++ b/ucm2/Allwinner/sun4i-h616/HiFi.conf @@ -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 index 0000000..240f41a --- /dev/null +++ b/ucm2/conf.d/sun4i-codec/h616-audio-codec.conf @@ -0,0 +1,8 @@ +# UCM for Allwinner H616 Codec + +Syntax 3 + +SectionUseCase."HiFi" { + File "/Allwinner/sun4i-h616/HiFi.conf" + Comment "Play HiFi quality Music" +} -- 2.47.1