From 9da0515c16d371b6aa8c401d7aa4e9135269db46 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Wed, 26 May 2021 14:14:06 +0530 Subject: [PATCH 1/8] Add BSD-3-Clause license --- LICENSES/BSD-3-Clause.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 LICENSES/BSD-3-Clause.txt diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt new file mode 100644 index 00000000..6c9eef8d --- /dev/null +++ b/LICENSES/BSD-3-Clause.txt @@ -0,0 +1,11 @@ +Copyright (c) . All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 28ba3d0c2f3c213f377a312af1bd021f3bbafb5e Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Wed, 26 May 2021 14:28:20 +0530 Subject: [PATCH 2/8] Add PinePhone UCM This is tested with, ALSA version 1.2.4 and pulseaudio 14.0 This also licenses them to BSD-3-Clause license which is what is used by alsa-ucm-conf upstream to eventually move it there. This UCM are copied from the postmarketOS pmaports as ultimately most distributions have forked configs from them and this is currently most up-to-date source. --- .reuse/dep5 | 13 +++ ucm2/PinePhone/HiFi.conf | 142 ++++++++++++++++++++++++++++++++ ucm2/PinePhone/PinePhone.conf | 11 +++ ucm2/PinePhone/VoiceCall.conf | 147 ++++++++++++++++++++++++++++++++++ 4 files changed, 313 insertions(+) create mode 100644 .reuse/dep5 create mode 100644 ucm2/PinePhone/HiFi.conf create mode 100644 ucm2/PinePhone/PinePhone.conf create mode 100644 ucm2/PinePhone/VoiceCall.conf diff --git a/.reuse/dep5 b/.reuse/dep5 new file mode 100644 index 00000000..447735f4 --- /dev/null +++ b/.reuse/dep5 @@ -0,0 +1,13 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pine64-alsa-ucm +Source: https://gitlab.com/pine64-org/pine64-alsa-ucm + +Files: ucm2/PinePhone/* +License: BSD-3-Clause +Copyright: 2021 Martijn Braam +Copyright: 2020 Luca Weiss +Copyright: 2020 Minecrell +Copyright: 2020 Oliver Smith +Copyright: 2020 Pedro Moreno +Copyright: 2020 clayton craft +Copyright: 2020 Dylan Van Assche diff --git a/ucm2/PinePhone/HiFi.conf b/ucm2/PinePhone/HiFi.conf new file mode 100644 index 00000000..31c460ad --- /dev/null +++ b/ucm2/PinePhone/HiFi.conf @@ -0,0 +1,142 @@ +SectionVerb { + EnableSequence [ + cset "name='Headphone Playback Switch' off" + cset "name='Headphone Source Playback Route' DAC" + cset "name='Line In Playback Switch' off" + cset "name='Line Out Playback Switch' off" + cset "name='Line Out Source Playback Route' Mono Differential" + cset "name='Mic1 Playback Switch' off" + cset "name='Mic2 Playback Switch' off" + cset "name='AIF1 DA0 Playback Volume' 160" + cset "name='AIF3 ADC Source Capture Route' None" + cset "name='AIF2 DAC Source Playback Route' None" + cset "name='DAC Playback Switch' on" + cset "name='DAC Playback Volume' 160" + cset "name='ADC Digital DAC Playback Switch' off" + cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on" + cset "name='AIF2 Digital DAC Playback Switch' off" + cset "name='DAC Reversed Playback Switch' off" + cset "name='Earpiece Playback Switch' off" + cset "name='Earpiece Source Playback Route' DACL" + + cset "name='Line In Capture Switch' off" + cset "name='Mic1 Capture Switch' off" + cset "name='Mic1 Boost Volume' 7" + cset "name='Mic2 Capture Switch' off" + cset "name='Mic2 Boost Volume' 7" + cset "name='Mixer Capture Switch' off" + cset "name='Mixer Reversed Capture Switch' off" + cset "name='ADC Capture Volume' 160" + cset "name='ADC Gain Capture Volume' 7" + cset "name='AIF1 AD0 Capture Volume' 160" + cset "name='AIF1 Data Digital ADC Capture Switch' on" + cset "name='AIF2 ADC Mixer ADC Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + ] + + DisableSequence [ + ] + + Value { + } +} + +SectionDevice."Speaker" { + Comment "Internal speaker" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Line Out Playback Switch' on" + cset "name='Line Out Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Line Out Playback Switch' off" + ] + + Value { + PlaybackVolume "Line Out Playback Volume" + PlaybackSwitch "Line Out Playback Switch" + PlaybackChannels 2 + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},0" + } +} +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Earpiece Playback Switch' on" + cset "name='Earpiece Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Earpiece Playback Switch' off" + ] + + Value { + PlaybackVolume "Earpiece Playback Volume" + PlaybackSwitch "Earpiece Playback Switch" + PlaybackChannels 2 + 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" + CaptureChannels 2 + } +} +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" + CaptureChannels 2 + JackControl "Headset Microphone Jack" + } +} +SectionDevice."Headphones" { + Comment "Headset" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Stereo" + cset "name='Headphone Playback Switch' on" + cset "name='Headphone Playback Volume' 70%" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels 2 + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},0" + JackControl "Headset Microphone Jack" + } +} diff --git a/ucm2/PinePhone/PinePhone.conf b/ucm2/PinePhone/PinePhone.conf new file mode 100644 index 00000000..9a8ea12b --- /dev/null +++ b/ucm2/PinePhone/PinePhone.conf @@ -0,0 +1,11 @@ +Syntax 2 + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Play HiFi quality music" +} + +SectionUseCase."Voice Call" { + File "VoiceCall.conf" + Comment "Make a phone call" +} diff --git a/ucm2/PinePhone/VoiceCall.conf b/ucm2/PinePhone/VoiceCall.conf new file mode 100644 index 00000000..7cfa57b1 --- /dev/null +++ b/ucm2/PinePhone/VoiceCall.conf @@ -0,0 +1,147 @@ +SectionVerb { + EnableSequence [ + cset "name='Headphone Playback Switch' off" + cset "name='Headphone Source Playback Route' DAC" + cset "name='Line In Playback Switch' off" + cset "name='Line Out Playback Switch' off" + cset "name='Line Out Source Playback Route' Mono Differential" + cset "name='Mic1 Playback Switch' off" + cset "name='Mic2 Playback Switch' off" + cset "name='AIF1 DA0 Playback Volume' 160" + cset "name='AIF2 DAC Playback Volume' 160" + cset "name='AIF3 ADC Source Capture Route' None" + cset "name='AIF2 DAC Source Playback Route' None" + cset "name='DAC Playback Switch' on" + cset "name='DAC Playback Volume' 160" + cset "name='ADC Digital DAC Playback Switch' off" + cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on" + cset "name='AIF2 Digital DAC Playback Switch' on" + cset "name='DAC Reversed Playback Switch' off" + cset "name='Earpiece Playback Switch' off" + cset "name='Earpiece Source Playback Route' DACL" + + cset "name='Line In Capture Switch' off" + cset "name='Mic1 Capture Switch' off" + cset "name='Mic1 Boost Volume' 0" + cset "name='Mic1 Playback Volume' 7" + cset "name='Mic2 Capture Switch' off" + cset "name='Mic2 Boost Volume' 0" + cset "name='Mic2 Playback Volume' 7" + cset "name='Mixer Capture Switch' off" + cset "name='Mixer Reversed Capture Switch' off" + cset "name='ADC Capture Volume' 160" + cset "name='ADC Gain Capture Volume' 7" + cset "name='AIF1 AD0 Capture Volume' 160" + cset "name='AIF1 Data Digital ADC Capture Switch' on" + cset "name='AIF2 ADC Capture Volume' 160" + cset "name='AIF2 ADC Mixer ADC Capture Switch' on" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" + ] + + DisableSequence [ + ] + + Value { + PlaybackRate 8000 + } +} + +SectionDevice."Speaker" { + Comment "Internal speaker" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Line Out Playback Switch' on" + cset "name='Line Out Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Line Out Playback Switch' off" + ] + + Value { + PlaybackVolume "Line Out Playback Volume" + PlaybackSwitch "Line Out Playback Switch" + PlaybackChannels 2 + PlaybackPriority 300 + PlaybackPCM "hw:${CardId},0" + } +} +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" + cset "name='Earpiece Playback Switch' on" + cset "name='Earpiece Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Earpiece Playback Switch' off" + ] + + Value { + PlaybackVolume "Earpiece Playback Volume" + PlaybackSwitch "Earpiece Playback Switch" + PlaybackChannels 2 + 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" + CaptureChannels 2 + } +} +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" + CaptureChannels 2 + JackControl "Headset Microphone Jack" + } +} +SectionDevice."Headphones" { + Comment "Headset" + EnableSequence [ + cset "name='AIF1 DA0 Stereo Playback Route' Stereo" + cset "name='Headphone Playback Switch' on" + cset "name='Headphone Playback Volume' 100%" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels 2 + PlaybackPriority 500 + PlaybackPCM "hw:${CardId},0" + JackControl "Headset Microphone Jack" + } +} From e09d505deb5ea1016afe236472d8ca7e6fd1c42a Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Thu, 27 May 2021 09:24:19 +0530 Subject: [PATCH 3/8] PinePhone: add hardware CaptureVolume control This allows to mute microphone with setting microphone volume to 0 --- ucm2/PinePhone/HiFi.conf | 2 ++ ucm2/PinePhone/VoiceCall.conf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ucm2/PinePhone/HiFi.conf b/ucm2/PinePhone/HiFi.conf index 31c460ad..a1cc2b9d 100644 --- a/ucm2/PinePhone/HiFi.conf +++ b/ucm2/PinePhone/HiFi.conf @@ -99,6 +99,7 @@ SectionDevice."Mic" { CapturePriority 100 CapturePCM "hw:${CardId},0" CaptureChannels 2 + CaptureVolume "ADC Capture Volume" } } SectionDevice."Headset" { @@ -116,6 +117,7 @@ SectionDevice."Headset" { CapturePriority 500 CapturePCM "hw:${CardId},0" CaptureChannels 2 + CaptureVolume "ADC Capture Volume" JackControl "Headset Microphone Jack" } } diff --git a/ucm2/PinePhone/VoiceCall.conf b/ucm2/PinePhone/VoiceCall.conf index 7cfa57b1..a9d28e82 100644 --- a/ucm2/PinePhone/VoiceCall.conf +++ b/ucm2/PinePhone/VoiceCall.conf @@ -103,6 +103,7 @@ SectionDevice."Mic" { Value { CapturePriority 200 CapturePCM "hw:${CardId},0" + CaptureVolume "ADC Capture Volume" CaptureChannels 2 } } @@ -121,6 +122,7 @@ SectionDevice."Headset" { CapturePriority 500 CapturePCM "hw:${CardId},0" CaptureChannels 2 + CaptureVolume "ADC Capture Volume" JackControl "Headset Microphone Jack" } } From 94d24ce535b6cc6be870c77df376b7ab81996a03 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Thu, 27 May 2021 09:27:58 +0530 Subject: [PATCH 4/8] PinePhone: add CaptureSwitch for mic inputs For now it is not useful as none of pulseaudio or pipewire support this, but for future, let's add this control here already. --- ucm2/PinePhone/HiFi.conf | 2 ++ ucm2/PinePhone/VoiceCall.conf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ucm2/PinePhone/HiFi.conf b/ucm2/PinePhone/HiFi.conf index a1cc2b9d..301c3194 100644 --- a/ucm2/PinePhone/HiFi.conf +++ b/ucm2/PinePhone/HiFi.conf @@ -100,6 +100,7 @@ SectionDevice."Mic" { CapturePCM "hw:${CardId},0" CaptureChannels 2 CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" } } SectionDevice."Headset" { @@ -118,6 +119,7 @@ SectionDevice."Headset" { CapturePCM "hw:${CardId},0" CaptureChannels 2 CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" JackControl "Headset Microphone Jack" } } diff --git a/ucm2/PinePhone/VoiceCall.conf b/ucm2/PinePhone/VoiceCall.conf index a9d28e82..8a707aad 100644 --- a/ucm2/PinePhone/VoiceCall.conf +++ b/ucm2/PinePhone/VoiceCall.conf @@ -104,6 +104,7 @@ SectionDevice."Mic" { CapturePriority 200 CapturePCM "hw:${CardId},0" CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" CaptureChannels 2 } } @@ -123,6 +124,7 @@ SectionDevice."Headset" { CapturePCM "hw:${CardId},0" CaptureChannels 2 CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" JackControl "Headset Microphone Jack" } } From 42d2384ca4f6d238d3f20aefbb2e275a9114d358 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Thu, 27 May 2021 07:19:43 +0200 Subject: [PATCH 5/8] ucm2/PinePhone: detect headphones jack --- ucm2/PinePhone/HiFi.conf | 2 +- ucm2/PinePhone/VoiceCall.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ucm2/PinePhone/HiFi.conf b/ucm2/PinePhone/HiFi.conf index 301c3194..4032b0ca 100644 --- a/ucm2/PinePhone/HiFi.conf +++ b/ucm2/PinePhone/HiFi.conf @@ -141,6 +141,6 @@ SectionDevice."Headphones" { PlaybackChannels 2 PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" - JackControl "Headset Microphone Jack" + JackControl "Headhone Jack" } } diff --git a/ucm2/PinePhone/VoiceCall.conf b/ucm2/PinePhone/VoiceCall.conf index 8a707aad..a56bf259 100644 --- a/ucm2/PinePhone/VoiceCall.conf +++ b/ucm2/PinePhone/VoiceCall.conf @@ -146,6 +146,6 @@ SectionDevice."Headphones" { PlaybackChannels 2 PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" - JackControl "Headset Microphone Jack" + JackControl "Headphone Jack" } } From 801477c9b7ecce97346e25588bb7f2909d4b6d58 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Thu, 27 May 2021 15:03:01 +0530 Subject: [PATCH 6/8] PinePhone: Fix the JackControl Fixes 42d2384ca4f6d --- ucm2/PinePhone/HiFi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ucm2/PinePhone/HiFi.conf b/ucm2/PinePhone/HiFi.conf index 4032b0ca..ea4f74ec 100644 --- a/ucm2/PinePhone/HiFi.conf +++ b/ucm2/PinePhone/HiFi.conf @@ -141,6 +141,6 @@ SectionDevice."Headphones" { PlaybackChannels 2 PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" - JackControl "Headhone Jack" + JackControl "Headphone Jack" } } From 36930ed14d2b8f1f45bb72aa10e5a6ed9a7fc240 Mon Sep 17 00:00:00 2001 From: Bhushan Shah Date: Thu, 27 May 2021 15:19:17 +0530 Subject: [PATCH 7/8] PinePhone: Fix typo in the Comment --- ucm2/PinePhone/HiFi.conf | 2 +- ucm2/PinePhone/VoiceCall.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ucm2/PinePhone/HiFi.conf b/ucm2/PinePhone/HiFi.conf index ea4f74ec..5996e4a2 100644 --- a/ucm2/PinePhone/HiFi.conf +++ b/ucm2/PinePhone/HiFi.conf @@ -124,7 +124,7 @@ SectionDevice."Headset" { } } SectionDevice."Headphones" { - Comment "Headset" + Comment "Headphones" EnableSequence [ cset "name='AIF1 DA0 Stereo Playback Route' Stereo" cset "name='Headphone Playback Switch' on" diff --git a/ucm2/PinePhone/VoiceCall.conf b/ucm2/PinePhone/VoiceCall.conf index a56bf259..16305598 100644 --- a/ucm2/PinePhone/VoiceCall.conf +++ b/ucm2/PinePhone/VoiceCall.conf @@ -129,7 +129,7 @@ SectionDevice."Headset" { } } SectionDevice."Headphones" { - Comment "Headset" + Comment "Headphones" EnableSequence [ cset "name='AIF1 DA0 Stereo Playback Route' Stereo" cset "name='Headphone Playback Switch' on" From ec0ef36b8b897ed1ae6bb0d0de13d5776f5d3659 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Fri, 10 Dec 2021 14:02:51 +0100 Subject: [PATCH 8/8] ucm2: add profile for the PinePhonePro Signed-off-by: Arnaud Ferraris --- .reuse/dep5 | 4 + ucm2/PinePhonePro/HiFi.conf | 278 ++++++++++++++++++++++++++++ ucm2/PinePhonePro/PinePhonePro.conf | 16 ++ ucm2/PinePhonePro/VoiceCall.conf | 275 +++++++++++++++++++++++++++ 4 files changed, 573 insertions(+) create mode 100644 ucm2/PinePhonePro/HiFi.conf create mode 100644 ucm2/PinePhonePro/PinePhonePro.conf create mode 100644 ucm2/PinePhonePro/VoiceCall.conf diff --git a/.reuse/dep5 b/.reuse/dep5 index 447735f4..665b5fa7 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -11,3 +11,7 @@ Copyright: 2020 Oliver Smith Copyright: 2020 Pedro Moreno Copyright: 2020 clayton craft Copyright: 2020 Dylan Van Assche + +Files: ucm2/PinePhonePro/* +License: BSD-3-Clause +Copyright: 2021 Arnaud Ferraris diff --git a/ucm2/PinePhonePro/HiFi.conf b/ucm2/PinePhonePro/HiFi.conf new file mode 100644 index 00000000..73c8ff6e --- /dev/null +++ b/ucm2/PinePhonePro/HiFi.conf @@ -0,0 +1,278 @@ +SectionVerb { + EnableSequence [ + # First of all, disable the internal speaker amplifier + cset "name='Internal Speaker Switch' off" + + ### Based on /codecs/rt5640/EnableSeq.conf ### + + # RT5640 default output routing + cset "name='DAC MIXL INF1 Switch' on" + cset "name='DAC MIXR INF1 Switch' on" + cset "name='DAC MIXL Stereo ADC Switch' off" + cset "name='DAC MIXR Stereo ADC Switch' off" + cset "name='Stereo DAC MIXL DAC L1 Switch' on" + cset "name='Stereo DAC MIXR DAC R1 Switch' on" + cset "name='Stereo DAC MIXL DAC L2 Switch' on" + cset "name='Stereo DAC MIXR DAC R2 Switch' on" + cset "name='OUT MIXL DAC L1 Switch' on" + cset "name='OUT MIXR DAC R1 Switch' on" + cset "name='SPK MIXL DAC L1 Switch' on" + cset "name='SPK MIXR DAC R1 Switch' on" + + # uncomment to enable swap between AIF1 and AIF2 + # warning: can only work with SSP0 firmware enabled + cset "name='SDI select' 0" + cset "name='DAI select' 0" + #cset "name='SDI select' 1" + #cset "name='DAI select' 1" + + cset "name='DAC2 Playback Switch' on" + + # Input Configuration + cset "name='Stereo ADC1 Mux' ADC" + cset "name='Stereo ADC2 Mux' DMIC1" + cset "name='ADC Capture Switch' on" + + cset "name='Mono ADC L1 Mux' ADCL" + cset "name='Mono ADC R1 Mux' ADCR" + cset "name='Mono ADC L2 Mux' DMIC L1" + cset "name='Mono ADC R2 Mux' DMIC R1" + cset "name='Mono ADC Capture Switch' on" + + # Set capture volume to 0dB so modem audio doesn't overdrive the ADC + cset "name='ADC Capture Volume' 47" + cset "name='Mono ADC Capture Volume' 47" + + # The second 'Mono ADC' path does not have a 'Boost Gain', + # set this to 0dB so that the volume of the AIF1 and AIF2 paths is equal. + cset "name='ADC Boost Gain' 0" + + # Set IN1 internal mic boost to 8 (max) + # Set IN2 headset-mic boost to 1, headset mics are quite loud + # Set IN3 (modem audio) boost to 0 as it's already loud enough + cset "name='IN1 Boost' 8" + cset "name='IN2 Boost' 1" + cset "name='IN3 Boost' 0" + + # Start with all controls which are used by the individual + # input/output Enable/DisableSequences off + + cset "name='RECMIXL BST1 Switch' off" + cset "name='RECMIXR BST1 Switch' off" + # IN2 is headset mic, make sure its route is enabled + cset "name='RECMIXL BST2 Switch' on" + cset "name='RECMIXR BST2 Switch' on" + cset "name='RECMIXL BST3 Switch' off" + cset "name='RECMIXR BST3 Switch' off" + + cset "name='Stereo ADC MIXL ADC1 Switch' off" + cset "name='Stereo ADC MIXR ADC1 Switch' off" + cset "name='Stereo ADC MIXL ADC2 Switch' off" + cset "name='Stereo ADC MIXR ADC2 Switch' off" + cset "name='Mono ADC MIXL ADC1 Switch' off" + cset "name='Mono ADC MIXR ADC1 Switch' off" + cset "name='Mono ADC MIXL ADC2 Switch' off" + cset "name='Mono ADC MIXR ADC2 Switch' off" + + # Limit amplification factor of earpiece amplifier so sound stays clear + cset "name='Class D SPK Ratio Control' 1.66x" + + # Turn off playback switches by default, otherwise both Speaker + # and headphones are playing audio initially until headphones are + # re-inserted. + cset "name='HP L Playback Switch' off" + cset "name='HP R Playback Switch' off" + cset "name='Speaker L Playback Switch' off" + cset "name='Speaker R Playback Switch' off" + + # MONO output is used as IN3 here, so make sure it's disabled + cset "name='Mono Playback Switch' off" + + # Set playback volumes to 0dB + cset "name='HP Playback Volume' 31" + cset "name='Speaker Playback Volume' 31" + ] + + DisableSequence [ + # Turn off all output channels + cset "name='HP L Playback Switch' off" + cset "name='HP R Playback Switch' off" + cset "name='HP Channel Switch' off" + cset "name='HPO MIX HPVOL Switch' off" + cset "name='Speaker L Playback Switch' off" + cset "name='Speaker R Playback Switch' off" + cset "name='Speaker Channel Switch' off" + cset "name='SPOL MIX SPKVOL L Switch' off" + cset "name='SPOL MIX SPKVOL R Switch' off" + + + # Reset output routing + cset "name='DAC MIXL INF1 Switch' off" + cset "name='DAC MIXR INF1 Switch' off" + cset "name='OUT MIXL DAC L1 Switch' off" + cset "name='OUT MIXR DAC R1 Switch' off" + cset "name='SPK MIXL DAC L1 Switch' off" + cset "name='SPK MIXR DAC R1 Switch' off" + ] + + Value { + TQ "HiFi" + } +} + +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + + ConflictingDevice [ + "Headphones" + "Speaker" + ] + + EnableSequence [ + cset "name='SPOL MIX SPKVOL L Switch' on" +# for mono speaker we apply left on right +# cset "name='SPOR MIX SPKVOL R Switch' on" + cset "name='SPOL MIX SPKVOL R Switch' on" + cset "name='Speaker Channel Switch' on" + cset "name='Speaker L Playback Switch' on" + cset "name='Speaker R Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Channel Switch' off" + cset "name='Speaker L Playback Switch' off" + cset "name='Speaker R Playback Switch' off" + ] + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Speaker" + PlaybackVolume "Speaker Playback Volume" + PlaybackMasterElem "DAC1" + } +} + +SectionDevice."Speaker" { + Comment "Internal Speaker" + + ConflictingDevice [ + "Earpiece" + "Headphones" + ] + + EnableSequence [ + cset "name='HPO MIX HPVOL Switch' on" + cset "name='HP Channel Switch' on" + cset "name='HP L Playback Switch' on" + cset "name='HP R Playback Switch' on" + cset "name='Internal Speaker Switch' on" + ] + + DisableSequence [ + cset "name='Internal Speaker Switch' off" + cset "name='HP Channel Switch' off" + cset "name='HP L Playback Switch' off" + cset "name='HP R Playback Switch' off" + ] + + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "HP" + PlaybackVolume "HP Playback Volume" + PlaybackMasterElem "DAC1" + } +} + +SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Earpiece" + "Speaker" + ] + + EnableSequence [ + cset "name='HPO MIX HPVOL Switch' on" + cset "name='HP Channel Switch' on" + cset "name='HP L Playback Switch' on" + cset "name='HP R Playback Switch' on" + ] + + DisableSequence [ + cset "name='HP Channel Switch' off" + cset "name='HP L Playback Switch' off" + cset "name='HP R Playback Switch' off" + ] + + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" + JackControl "Headphones Jack" + PlaybackMixerElem "HP" + PlaybackVolume "HP Playback Volume" + PlaybackMasterElem "DAC1" + } +} + +SectionDevice."Mic" { + Comment "Internal Microphone" + + ConflictingDevice [ + "Headset" + ] + + EnableSequence [ + cset "name='Mono ADC MIXL ADC2 Switch' on" + cset "name='Mono ADC MIXR ADC2 Switch' on" + cset "name='Stereo ADC MIXL ADC2 Switch' on" + cset "name='Stereo ADC MIXR ADC2 Switch' on" + ] + + DisableSequence [ + cset "name='Mono ADC MIXL ADC2 Switch' off" + cset "name='Mono ADC MIXR ADC2 Switch' off" + cset "name='Stereo ADC MIXL ADC2 Switch' off" + cset "name='Stereo ADC MIXR ADC2 Switch' off" + ] + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "ADC Capture Switch" + } +} + +SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ + "Mic" + ] + + EnableSequence [ + cset "name='Mono ADC MIXL ADC1 Switch' on" + cset "name='Mono ADC MIXR ADC1 Switch' on" + cset "name='Stereo ADC MIXL ADC1 Switch' on" + cset "name='Stereo ADC MIXR ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Mono ADC MIXL ADC1 Switch' off" + cset "name='Mono ADC MIXR ADC1 Switch' off" + cset "name='Stereo ADC MIXL ADC1 Switch' off" + cset "name='Stereo ADC MIXR ADC1 Switch' off" + ] + + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headphones Jack" + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "ADC Capture Switch" + } +} diff --git a/ucm2/PinePhonePro/PinePhonePro.conf b/ucm2/PinePhonePro/PinePhonePro.conf new file mode 100644 index 00000000..18b544a8 --- /dev/null +++ b/ucm2/PinePhonePro/PinePhonePro.conf @@ -0,0 +1,16 @@ +Syntax 4 +Comment "PinePhone Pro" + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Default" +} + +SectionUseCase."Voice Call" { + File "VoiceCall.conf" + Comment "Phone call" +} + +Include.card-init.File "/lib/card-init.conf" +Include.ctl-remap.File "/lib/ctl-remap.conf" +Include.codec-init.File "/codecs/rt5640/init.conf" diff --git a/ucm2/PinePhonePro/VoiceCall.conf b/ucm2/PinePhonePro/VoiceCall.conf new file mode 100644 index 00000000..8055e5d3 --- /dev/null +++ b/ucm2/PinePhonePro/VoiceCall.conf @@ -0,0 +1,275 @@ +SectionVerb { + EnableSequence [ + # First of all, disable the internal speaker amplifier + cset "name='Internal Speaker Switch' off" + + ### Based on /codecs/rt5640/EnableSeq.conf ### + + # Get audio only from the microphones, not the system + cset "name='DAC MIXL INF1 Switch' off" + cset "name='DAC MIXR INF1 Switch' off" + cset "name='DAC MIXL Stereo ADC Switch' on" + cset "name='DAC MIXR Stereo ADC Switch' on" + cset "name='Stereo DAC MIXL DAC L1 Switch' on" + cset "name='Stereo DAC MIXR DAC R1 Switch' on" + cset "name='Stereo DAC MIXL DAC L2 Switch' on" + cset "name='Stereo DAC MIXR DAC R2 Switch' on" + cset "name='OUT MIXL DAC L1 Switch' off" + cset "name='OUT MIXR DAC R1 Switch' off" + cset "name='SPK MIXL DAC L1 Switch' off" + cset "name='SPK MIXR DAC R1 Switch' off" + + # uncomment to enable swap between AIF1 and AIF2 + # warning: can only work with SSP0 firmware enabled + cset "name='SDI select' 0" + cset "name='DAI select' 0" + #cset "name='SDI select' 1" + #cset "name='DAI select' 1" + + cset "name='DAC2 Playback Switch' on" + + # Input Configuration + cset "name='Stereo ADC1 Mux' ADC" + cset "name='Stereo ADC2 Mux' DMIC1" + cset "name='ADC Capture Switch' on" + + cset "name='Mono ADC L1 Mux' ADCL" + cset "name='Mono ADC R1 Mux' ADCR" + cset "name='Mono ADC L2 Mux' DMIC L1" + cset "name='Mono ADC R2 Mux' DMIC R1" + cset "name='Mono ADC Capture Switch' on" + + # Set capture volume to 0dB so modem audio doesn't overdrive the ADC + cset "name='ADC Capture Volume' 47" + cset "name='Mono ADC Capture Volume' 47" + + # The second 'Mono ADC' path does not have a 'Boost Gain', + # set this to 0dB so that the volume of the AIF1 and AIF2 paths is equal. + cset "name='ADC Boost Gain' 0" + + # Set IN1 internal mic boost to 8 (max) + # Set IN2 headset-mic boost to 1, headset mics are quite loud + # Set IN3 (modem audio) boost to 0 as it's already loud enough + cset "name='IN1 Boost' 8" + cset "name='IN2 Boost' 1" + cset "name='IN3 Boost' 0" + + # Start with all controls which are used by the individual + # input/output Enable/DisableSequences off + + cset "name='RECMIXL BST1 Switch' off" + cset "name='RECMIXR BST1 Switch' off" + # IN2 is headset mic, make sure its routed to the left channel + cset "name='RECMIXL BST2 Switch' on" + cset "name='RECMIXR BST2 Switch' off" + # IN3 is modem audio, route it to the right channel + cset "name='RECMIXL BST3 Switch' off" + cset "name='RECMIXR BST3 Switch' on" + + cset "name='Stereo ADC MIXL ADC1 Switch' off" + cset "name='Stereo ADC MIXR ADC1 Switch' off" + cset "name='Stereo ADC MIXL ADC2 Switch' off" + cset "name='Stereo ADC MIXR ADC2 Switch' off" + cset "name='Mono ADC MIXL ADC1 Switch' off" + cset "name='Mono ADC MIXR ADC1 Switch' off" + cset "name='Mono ADC MIXL ADC2 Switch' off" + cset "name='Mono ADC MIXR ADC2 Switch' off" + + # Limit amplification factor of earpiece amplifier so sound stays clear + cset "name='Class D SPK Ratio Control' 1.66x" + + # Loopback IN3 to earpiece/speaker/headphones + cset "name='OUT MIXR REC MIXR Switch' on" + cset "name='SPK MIXR OUT MIXR Switch' on" + + # Send the left channel (microphones) to the modem through DAC L1 + cset "name='LOUT MIX DAC L1 Switch' on" + # Don't use DAC R1 nor the OUTVOL blocks as we use them for + # routing audio from the modem + cset "name='LOUT MIX DAC R1 Switch' off" + cset "name='LOUT MIX OUTVOL L Switch' off" + cset "name='LOUT MIX OUTVOL R Switch' off" + + # Disable left channel for HP (speaker/headphones) output + # as we're only routing modem audio to the right channel + cset "name='HP L Playback Switch' off" + + # Turn off playback switches by default, otherwise both Speaker + # and headphones are playing audio initially until headphones are + # re-inserted. + cset "name='HP L Playback Switch' off" + cset "name='HP R Playback Switch' off" + cset "name='Speaker L Playback Switch' off" + cset "name='Speaker R Playback Switch' off" + + # MONO output is used as IN3 here, so make sure it's disabled + cset "name='Mono Playback Switch' off" + + # Set playback volumes to 0dB + cset "name='HP Playback Volume' 31" + cset "name='Speaker Playback Volume' 31" + ] + + DisableSequence [ + # Turn off all output channels + cset "name='HP L Playback Switch' off" + cset "name='HP R Playback Switch' off" + cset "name='HP Channel Switch' off" + cset "name='Speaker L Playback Switch' off" + cset "name='Speaker R Playback Switch' off" + cset "name='Speaker Channel Switch' off" + + # Reset output routing + cset "name='DAC MIXL Stereo ADC Switch' off" + cset "name='DAC MIXR Stereo ADC Switch' off" + cset "name='OUT MIXR REC MIXR Switch' off" + cset "name='SPK MIXR OUT MIXR Switch' off" + cset "name='LOUT MIX DAC L1 Switch' off" + + # Reset ADC input routing + cset "name='RECMIXL BST2 Switch' off" + cset "name='RECMIXR BST3 Switch' off" + ] + + Value { + TQ "VoiceCall" + } +} + +SectionDevice."Earpiece" { + Comment "Internal Earpiece" + + ConflictingDevice [ + "Headphones" + "Speaker" + ] + + EnableSequence [ + cset "name='SPOL MIX SPKVOL L Switch' on" + # Send right channel to left as it's mono only + cset "name='SPOL MIX SPKVOL R Switch' on" + cset "name='Speaker Channel Switch' on" + cset "name='Speaker L Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Channel Switch' off" + cset "name='Speaker L Playback Switch' off" + ] + + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Speaker" + PlaybackVolume "Speaker Playback Volume" + PlaybackMasterElem "DAC1" + } +} + +SectionDevice."Speaker" { + Comment "Internal Speaker" + + ConflictingDevice [ + "Earpiece" + "Headphones" + ] + + EnableSequence [ + cset "name='HPO MIX HPVOL Switch' on" + cset "name='HP Channel Switch' on" + cset "name='HP R Playback Switch' on" + cset "name='Internal Speaker Switch' on" + ] + + DisableSequence [ + cset "name='Internal Speaker Switch' off" + cset "name='HP Channel Switch' off" + cset "name='HP R Playback Switch' off" + ] + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "HP" + PlaybackVolume "HP Playback Volume" + PlaybackMasterElem "DAC1" + } +} + +SectionDevice."Headphones" { + Comment "Headphones" + + ConflictingDevice [ + "Earpiece" + "Speaker" + ] + + EnableSequence [ + cset "name='HPO MIX HPVOL Switch' on" + cset "name='HP Channel Switch' on" + cset "name='HP R Playback Switch' on" + ] + + DisableSequence [ + cset "name='HP Channel Switch' off" + cset "name='HP R Playback Switch' off" + ] + + Value { + PlaybackPriority 300 + PlaybackPCM "hw:${CardId}" + JackControl "Headphones Jack" + PlaybackMixerElem "HP" + PlaybackVolume "HP Playback Volume" + PlaybackMasterElem "DAC1" + } +} + +SectionDevice."Mic" { + Comment "Internal Microphone" + + ConflictingDevice [ + "Headset" + ] + + EnableSequence [ + cset "name='Stereo ADC MIXL ADC2 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo ADC MIXL ADC2 Switch' off" + ] + + Value { + CapturePriority 100 + CapturePCM "hw:${CardId}" + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "ADC Capture Switch" + } +} + +SectionDevice."Headset" { + Comment "Headset Microphone" + + ConflictingDevice [ + "Mic" + ] + + EnableSequence [ + cset "name='Stereo ADC MIXL ADC1 Switch' on" + ] + + DisableSequence [ + cset "name='Stereo ADC MIXL ADC1 Switch' off" + ] + + Value { + CapturePriority 200 + CapturePCM "hw:${CardId}" + JackControl "Headphones Jack" + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "ADC Capture Switch" + } +}