From: Tom Fitzhenry Date: Fri, 25 Mar 2022 17:19:23 +0000 (+1100) Subject: Add UCM for PinePhone X-Git-Tag: v1.2.9~33 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=93d514761c699028fd2e8c8da86901cf21725b8b;p=alsa-ucm-conf.git Add UCM for PinePhone The DTS configuration has had a unique audio card name since 5.14: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi?h=v5.14#n436d This UCM config is derived from https://gitlab.com/pine64-org/pine64-alsa-ucm/, which is BSD-3-Clause licensed. Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/134 Signed-off-by: Tom Fitzhenry Co-authored-by: Arnaud Ferraris Co-authored-by: Samuel Holland Signed-off-by: Jaroslav Kysela --- diff --git a/ucm2/Allwinner/A64/PinePhone/HiFi.conf b/ucm2/Allwinner/A64/PinePhone/HiFi.conf new file mode 100644 index 0000000..00779ae --- /dev/null +++ b/ucm2/Allwinner/A64/PinePhone/HiFi.conf @@ -0,0 +1,107 @@ +SectionVerb { + EnableSequence [ + cset "name='AIF2 Digital DAC Playback Switch' off" + cset "name='AIF2 ADC Mixer ADC Capture Switch' off" + ] +} + +SectionDevice."Speaker" { + Comment "Internal speaker" + EnableSequence [ + cset "name='Line Out Playback Switch' on" + ] + + DisableSequence [ + cset "name='Line Out Playback Switch' off" + ] + + Value { + PlaybackMixerElem "Line Out" + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},0" + } +} + +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + + EnableSequence [ + cset "name='Earpiece Playback Switch' on" + ] + + DisableSequence [ + cset "name='Earpiece Playback Switch' off" + ] + + Value { + PlaybackMixerElem "Earpiece" + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},0" + } +} + +SectionDevice."Mic" { + Comment "Internal Microphone" + + ConflictingDevice [ + "Headset" + ] + + EnableSequence [ + cset "name='Mic1 Capture Switch' on" + ] + + DisableSequence [ + cset "name='Mic1 Capture Switch' off" + ] + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId},0" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" + } +} + +SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ + "Mic" + ] + + EnableSequence [ + cset "name='Mic2 Capture Switch' on" + ] + + DisableSequence [ + cset "name='Mic2 Capture Switch' off" + ] + + Value { + CapturePriority 500 + CapturePCM "hw:${CardId},0" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" + JackControl "Headset Microphone Jack" + } +} + +SectionDevice."Headphones" { + Comment "Headphones" + + EnableSequence [ + cset "name='Headphone Playback Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackMixerElem "Headphone" + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},0" + JackControl "Headphone Jack" + } +} diff --git a/ucm2/Allwinner/A64/PinePhone/PinePhone.conf b/ucm2/Allwinner/A64/PinePhone/PinePhone.conf new file mode 100644 index 0000000..cdb18be --- /dev/null +++ b/ucm2/Allwinner/A64/PinePhone/PinePhone.conf @@ -0,0 +1,67 @@ +Syntax 2 + +# https://wiki.pine64.org/index.php/PinePhone +# https://files.pine64.org/doc/PinePhone/PinePhone%20v1.2%20Released%20Schematic.pdf +# https://xnux.eu/devices/feature/audio-pp.html + +SectionUseCase."HiFi" { + File "/Allwinner/A64/PinePhone/HiFi.conf" + Comment "Play HiFi quality music" +} + +SectionUseCase."Voice Call" { + File "/Allwinner/A64/PinePhone/VoiceCall.conf" + Comment "Make a phone call" +} + +FixedBootSequence [ + # Routing. + cset "name='ADC Digital DAC Playback Switch' off" + cset "name='AIF1 DA0 Stereo Playback Route' Stereo" + cset "name='AIF1 Data Digital ADC Capture Switch' on" + cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on" + cset "name='AIF2 DAC Source Playback Route' AIF2" + # AIF2 (Modem) is mono. + cset "name='AIF2 DAC Stereo Playback Route' Mix Mono" + cset "name='AIF3 ADC Source Capture Route' None" + cset "name='DAC Playback Switch' on" + # Routes DACR->MIXL and DACL->MIXR => MIXL are MIXR are identical mono-mix of the DAC. + cset "name='DAC Reversed Playback Switch' on" + cset "name='Earpiece Source Playback Route' Left Mixer" + cset "name='Headphone Source Playback Route' DAC" + # The Pinephone speaker is mono. + cset "name='Line Out Source Playback Route' Mono Differential" +] + +BootSequence [ + # Playback volumes. + cset "name='AIF1 DA0 Playback Volume' 160" + cset "name='AIF2 DAC Playback Volume' 160" + cset "name='DAC Playback Volume' 160" + cset "name='Earpiece Playback Volume' 100%" + cset "name='Headphone Playback Volume' 70%" + cset "name='Line Out Playback Volume' 100%" + cset "name='Mic2 Boost Volume' 1" + + # Capture volumes. + cset "name='ADC Capture Volume' 160" + cset "name='AIF1 AD0 Capture Volume' 160" + cset "name='AIF2 ADC Capture Volume' 160" +] + +SectionDefaults [ + # Switch playback off. + cset "name='Earpiece Playback Switch' off" + cset "name='Headphone Playback Switch' off" + cset "name='Line In Playback Switch' off" + cset "name='Line Out Playback Switch' off" + cset "name='Mic1 Playback Switch' off" + cset "name='Mic2 Playback Switch' off" + + # Switch capture off. + cset "name='Line In Capture Switch' off" + cset "name='Mic1 Capture Switch' off" + cset "name='Mic2 Capture Switch' off" + cset "name='Mixer Capture Switch' off" + cset "name='Mixer Reversed Capture Switch' off" +] \ No newline at end of file diff --git a/ucm2/Allwinner/A64/PinePhone/VoiceCall.conf b/ucm2/Allwinner/A64/PinePhone/VoiceCall.conf new file mode 100644 index 0000000..fb3cb58 --- /dev/null +++ b/ucm2/Allwinner/A64/PinePhone/VoiceCall.conf @@ -0,0 +1,112 @@ +SectionVerb { + EnableSequence [ + cset "name='AIF2 Digital DAC Playback Switch' on" + cset "name='AIF2 ADC Mixer ADC Capture Switch' on" + ] + + Value { + PlaybackRate 8000 + } +} + +SectionDevice."Speaker" { + Comment "Internal speaker" + + EnableSequence [ + cset "name='Line Out Playback Switch' on" + ] + + DisableSequence [ + cset "name='Line Out Playback Switch' off" + ] + + Value { + PlaybackMixerElem "Line Out" + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},0" + } +} + +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + + EnableSequence [ + cset "name='Earpiece Playback Switch' on" + ] + + DisableSequence [ + cset "name='Earpiece Playback Switch' off" + ] + + Value { + PlaybackMixerElem "Earpiece" + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},0" + } +} + +SectionDevice."Mic" { + Comment "Internal Microphone" + + ConflictingDevice [ + "Headset" + ] + + EnableSequence [ + cset "name='Mic1 Capture Switch' on" + ] + + DisableSequence [ + cset "name='Mic1 Capture Switch' off" + ] + + Value { + CapturePriority 200 + CapturePCM "hw:${CardId},0" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" + } +} + +SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ + "Mic" + ] + + EnableSequence [ + cset "name='Mic2 Capture Switch' on" + ] + + DisableSequence [ + cset "name='Mic2 Capture Switch' off" + ] + + Value { + CapturePriority 500 + CapturePCM "hw:${CardId},0" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" + JackControl "Headset Microphone Jack" + } +} + +SectionDevice."Headphones" { + Comment "Headphones" + + EnableSequence [ + cset "name='Headphone Playback Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackMixerElem "Headphone" + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},0" + JackControl "Headphone Jack" + } +} diff --git a/ucm2/conf.d/simple-card/PinePhone.conf b/ucm2/conf.d/simple-card/PinePhone.conf new file mode 120000 index 0000000..fc21f35 --- /dev/null +++ b/ucm2/conf.d/simple-card/PinePhone.conf @@ -0,0 +1 @@ +../../Allwinner/A64/PinePhone/PinePhone.conf \ No newline at end of file