Skip to content

Commit b0dca4a

Browse files
a-waishr-project
authored andcommitted
ucm2: add profile for the PinePhonePro
* imported from: https://gitlab.com/pine64-org/pine64-alsa-ucm/-/commit/ec0ef36b8b897ed1ae6bb0d0de13d5776f5d3659 * fixes: alsa-project#125 Signed-off-by: Arnaud Ferraris <[email protected]> Signed-off-by: Martin Jansa <[email protected]>
1 parent d42e1d1 commit b0dca4a

File tree

4 files changed

+570
-0
lines changed

4 files changed

+570
-0
lines changed
+278
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
SectionVerb {
2+
EnableSequence [
3+
# First of all, disable the internal speaker amplifier
4+
cset "name='Internal Speaker Switch' off"
5+
6+
### Based on /codecs/rt5640/EnableSeq.conf ###
7+
8+
# RT5640 default output routing
9+
cset "name='DAC MIXL INF1 Switch' on"
10+
cset "name='DAC MIXR INF1 Switch' on"
11+
cset "name='DAC MIXL Stereo ADC Switch' off"
12+
cset "name='DAC MIXR Stereo ADC Switch' off"
13+
cset "name='Stereo DAC MIXL DAC L1 Switch' on"
14+
cset "name='Stereo DAC MIXR DAC R1 Switch' on"
15+
cset "name='Stereo DAC MIXL DAC L2 Switch' on"
16+
cset "name='Stereo DAC MIXR DAC R2 Switch' on"
17+
cset "name='OUT MIXL DAC L1 Switch' on"
18+
cset "name='OUT MIXR DAC R1 Switch' on"
19+
cset "name='SPK MIXL DAC L1 Switch' on"
20+
cset "name='SPK MIXR DAC R1 Switch' on"
21+
22+
# uncomment to enable swap between AIF1 and AIF2
23+
# warning: can only work with SSP0 firmware enabled
24+
cset "name='SDI select' 0"
25+
cset "name='DAI select' 0"
26+
#cset "name='SDI select' 1"
27+
#cset "name='DAI select' 1"
28+
29+
cset "name='DAC2 Playback Switch' on"
30+
31+
# Input Configuration
32+
cset "name='Stereo ADC1 Mux' ADC"
33+
cset "name='Stereo ADC2 Mux' DMIC1"
34+
cset "name='ADC Capture Switch' on"
35+
36+
cset "name='Mono ADC L1 Mux' ADCL"
37+
cset "name='Mono ADC R1 Mux' ADCR"
38+
cset "name='Mono ADC L2 Mux' DMIC L1"
39+
cset "name='Mono ADC R2 Mux' DMIC R1"
40+
cset "name='Mono ADC Capture Switch' on"
41+
42+
# Set capture volume to 0dB so modem audio doesn't overdrive the ADC
43+
cset "name='ADC Capture Volume' 47"
44+
cset "name='Mono ADC Capture Volume' 47"
45+
46+
# The second 'Mono ADC' path does not have a 'Boost Gain',
47+
# set this to 0dB so that the volume of the AIF1 and AIF2 paths is equal.
48+
cset "name='ADC Boost Gain' 0"
49+
50+
# Set IN1 internal mic boost to 8 (max)
51+
# Set IN2 headset-mic boost to 1, headset mics are quite loud
52+
# Set IN3 (modem audio) boost to 0 as it's already loud enough
53+
cset "name='IN1 Boost' 8"
54+
cset "name='IN2 Boost' 1"
55+
cset "name='IN3 Boost' 0"
56+
57+
# Start with all controls which are used by the individual
58+
# input/output Enable/DisableSequences off
59+
60+
cset "name='RECMIXL BST1 Switch' off"
61+
cset "name='RECMIXR BST1 Switch' off"
62+
# IN2 is headset mic, make sure its route is enabled
63+
cset "name='RECMIXL BST2 Switch' on"
64+
cset "name='RECMIXR BST2 Switch' on"
65+
cset "name='RECMIXL BST3 Switch' off"
66+
cset "name='RECMIXR BST3 Switch' off"
67+
68+
cset "name='Stereo ADC MIXL ADC1 Switch' off"
69+
cset "name='Stereo ADC MIXR ADC1 Switch' off"
70+
cset "name='Stereo ADC MIXL ADC2 Switch' off"
71+
cset "name='Stereo ADC MIXR ADC2 Switch' off"
72+
cset "name='Mono ADC MIXL ADC1 Switch' off"
73+
cset "name='Mono ADC MIXR ADC1 Switch' off"
74+
cset "name='Mono ADC MIXL ADC2 Switch' off"
75+
cset "name='Mono ADC MIXR ADC2 Switch' off"
76+
77+
# Limit amplification factor of earpiece amplifier so sound stays clear
78+
cset "name='Class D SPK Ratio Control' 1.66x"
79+
80+
# Turn off playback switches by default, otherwise both Speaker
81+
# and headphones are playing audio initially until headphones are
82+
# re-inserted.
83+
cset "name='HP L Playback Switch' off"
84+
cset "name='HP R Playback Switch' off"
85+
cset "name='Speaker L Playback Switch' off"
86+
cset "name='Speaker R Playback Switch' off"
87+
88+
# MONO output is used as IN3 here, so make sure it's disabled
89+
cset "name='Mono Playback Switch' off"
90+
91+
# Set playback volumes to 0dB
92+
cset "name='HP Playback Volume' 31"
93+
cset "name='Speaker Playback Volume' 31"
94+
]
95+
96+
DisableSequence [
97+
# Turn off all output channels
98+
cset "name='HP L Playback Switch' off"
99+
cset "name='HP R Playback Switch' off"
100+
cset "name='HP Channel Switch' off"
101+
cset "name='HPO MIX HPVOL Switch' off"
102+
cset "name='Speaker L Playback Switch' off"
103+
cset "name='Speaker R Playback Switch' off"
104+
cset "name='Speaker Channel Switch' off"
105+
cset "name='SPOL MIX SPKVOL L Switch' off"
106+
cset "name='SPOL MIX SPKVOL R Switch' off"
107+
108+
109+
# Reset output routing
110+
cset "name='DAC MIXL INF1 Switch' off"
111+
cset "name='DAC MIXR INF1 Switch' off"
112+
cset "name='OUT MIXL DAC L1 Switch' off"
113+
cset "name='OUT MIXR DAC R1 Switch' off"
114+
cset "name='SPK MIXL DAC L1 Switch' off"
115+
cset "name='SPK MIXR DAC R1 Switch' off"
116+
]
117+
118+
Value {
119+
TQ "HiFi"
120+
}
121+
}
122+
123+
SectionDevice."Earpiece" {
124+
Comment "Internal Earpiece"
125+
126+
ConflictingDevice [
127+
"Headphones"
128+
"Speaker"
129+
]
130+
131+
EnableSequence [
132+
cset "name='SPOL MIX SPKVOL L Switch' on"
133+
# for mono speaker we apply left on right
134+
# cset "name='SPOR MIX SPKVOL R Switch' on"
135+
cset "name='SPOL MIX SPKVOL R Switch' on"
136+
cset "name='Speaker Channel Switch' on"
137+
cset "name='Speaker L Playback Switch' on"
138+
cset "name='Speaker R Playback Switch' on"
139+
]
140+
141+
DisableSequence [
142+
cset "name='Speaker Channel Switch' off"
143+
cset "name='Speaker L Playback Switch' off"
144+
cset "name='Speaker R Playback Switch' off"
145+
]
146+
147+
Value {
148+
PlaybackPriority 100
149+
PlaybackPCM "hw:${CardId}"
150+
PlaybackMixerElem "Speaker"
151+
PlaybackVolume "Speaker Playback Volume"
152+
PlaybackMasterElem "DAC1"
153+
}
154+
}
155+
156+
SectionDevice."Speaker" {
157+
Comment "Internal Speaker"
158+
159+
ConflictingDevice [
160+
"Earpiece"
161+
"Headphones"
162+
]
163+
164+
EnableSequence [
165+
cset "name='HPO MIX HPVOL Switch' on"
166+
cset "name='HP Channel Switch' on"
167+
cset "name='HP L Playback Switch' on"
168+
cset "name='HP R Playback Switch' on"
169+
cset "name='Internal Speaker Switch' on"
170+
]
171+
172+
DisableSequence [
173+
cset "name='Internal Speaker Switch' off"
174+
cset "name='HP Channel Switch' off"
175+
cset "name='HP L Playback Switch' off"
176+
cset "name='HP R Playback Switch' off"
177+
]
178+
179+
Value {
180+
PlaybackPriority 200
181+
PlaybackPCM "hw:${CardId}"
182+
PlaybackMixerElem "HP"
183+
PlaybackVolume "HP Playback Volume"
184+
PlaybackMasterElem "DAC1"
185+
}
186+
}
187+
188+
SectionDevice."Headphones" {
189+
Comment "Headphones"
190+
191+
ConflictingDevice [
192+
"Earpiece"
193+
"Speaker"
194+
]
195+
196+
EnableSequence [
197+
cset "name='HPO MIX HPVOL Switch' on"
198+
cset "name='HP Channel Switch' on"
199+
cset "name='HP L Playback Switch' on"
200+
cset "name='HP R Playback Switch' on"
201+
]
202+
203+
DisableSequence [
204+
cset "name='HP Channel Switch' off"
205+
cset "name='HP L Playback Switch' off"
206+
cset "name='HP R Playback Switch' off"
207+
]
208+
209+
Value {
210+
PlaybackPriority 300
211+
PlaybackPCM "hw:${CardId}"
212+
JackControl "Headphones Jack"
213+
PlaybackMixerElem "HP"
214+
PlaybackVolume "HP Playback Volume"
215+
PlaybackMasterElem "DAC1"
216+
}
217+
}
218+
219+
SectionDevice."Mic" {
220+
Comment "Internal Microphone"
221+
222+
ConflictingDevice [
223+
"Headset"
224+
]
225+
226+
EnableSequence [
227+
cset "name='Mono ADC MIXL ADC2 Switch' on"
228+
cset "name='Mono ADC MIXR ADC2 Switch' on"
229+
cset "name='Stereo ADC MIXL ADC2 Switch' on"
230+
cset "name='Stereo ADC MIXR ADC2 Switch' on"
231+
]
232+
233+
DisableSequence [
234+
cset "name='Mono ADC MIXL ADC2 Switch' off"
235+
cset "name='Mono ADC MIXR ADC2 Switch' off"
236+
cset "name='Stereo ADC MIXL ADC2 Switch' off"
237+
cset "name='Stereo ADC MIXR ADC2 Switch' off"
238+
]
239+
240+
Value {
241+
CapturePriority 100
242+
CapturePCM "hw:${CardId}"
243+
CaptureMixerElem "ADC"
244+
CaptureVolume "ADC Capture Volume"
245+
CaptureSwitch "ADC Capture Switch"
246+
}
247+
}
248+
249+
SectionDevice."Headset" {
250+
Comment "Headset Microphone"
251+
252+
ConflictingDevice [
253+
"Mic"
254+
]
255+
256+
EnableSequence [
257+
cset "name='Mono ADC MIXL ADC1 Switch' on"
258+
cset "name='Mono ADC MIXR ADC1 Switch' on"
259+
cset "name='Stereo ADC MIXL ADC1 Switch' on"
260+
cset "name='Stereo ADC MIXR ADC1 Switch' on"
261+
]
262+
263+
DisableSequence [
264+
cset "name='Mono ADC MIXL ADC1 Switch' off"
265+
cset "name='Mono ADC MIXR ADC1 Switch' off"
266+
cset "name='Stereo ADC MIXL ADC1 Switch' off"
267+
cset "name='Stereo ADC MIXR ADC1 Switch' off"
268+
]
269+
270+
Value {
271+
CapturePriority 200
272+
CapturePCM "hw:${CardId}"
273+
JackControl "Headphones Jack"
274+
CaptureMixerElem "ADC"
275+
CaptureVolume "ADC Capture Volume"
276+
CaptureSwitch "ADC Capture Switch"
277+
}
278+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Syntax 4
2+
Comment "PinePhone Pro"
3+
4+
SectionUseCase."HiFi" {
5+
File "HiFi.conf"
6+
Comment "Default"
7+
}
8+
9+
SectionUseCase."Voice Call" {
10+
File "VoiceCall.conf"
11+
Comment "Phone call"
12+
}
13+
14+
Include.card-init.File "/lib/card-init.conf"
15+
Include.ctl-remap.File "/lib/ctl-remap.conf"
16+
Include.codec-init.File "/codecs/rt5640/init.conf"

0 commit comments

Comments
 (0)