pine64-pinephonepro: add ucm files for audio (MR 2742)

This commit is contained in:
Bart Ribbers 2021-12-12 15:28:31 +01:00
parent cdfbdc2a63
commit b91d951618
No known key found for this signature in database
GPG key ID: 0BF4C1B5988C50D8
4 changed files with 456 additions and 2 deletions

View file

@ -2,14 +2,14 @@
# Maintainer: Martijn Braam <martijn@brixit.nl>
pkgname=device-pine64-pinephonepro
pkgdesc="PINE64 PinePhone Pro"
pkgver=1
pkgver=1.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
alsa-ucm-conf
alsa-ucm-conf>=1.2.6.2
iw
linux-pine64-pinephonepro
mesa-dri-gallium
@ -21,6 +21,9 @@ subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="
deviceinfo
extlinux.conf
ucm/HiFi.conf
ucm/PinePhonePro.conf
ucm/VoiceCall.conf
"
build() {
@ -31,6 +34,11 @@ package() {
devicepkg_package $startdir $pkgname
install -D -m644 "$srcdir"/extlinux.conf \
"$pkgdir"/boot/extlinux/extlinux.conf
install -Dm644 -t "$pkgdir"/usr/share/alsa/ucm2/conf.d/simple-card \
"$srcdir"/PinePhonePro.conf \
"$srcdir"/HiFi.conf \
"$srcdir"/VoiceCall.conf
}
nonfree_firmware() {
@ -48,4 +56,7 @@ nonfree_firmware() {
sha512sums="
6497fcecd21343c1c1a4c1ca600a910b7c38efc8b5ab621c3a47a118056eb8ebee380aba44b53f89dba6e747ff2263069f9582e6bb8177904b91332fe8e75d25 deviceinfo
1332b541497b98c69163ca4d8fc70f028b35bce4905df0774269766f60b74076fd0e74c7eb4624c0c5cbc3756d9965df13c0f5bd6ea84762f18028094bca70a6 extlinux.conf
ac22c856af81d00aa6a349b68cf9e8645bf38277d9aafd07f1f46f5f932f48d37b9dfdcc8772fff4027f914c9b4c3b4a11c51bd9f2aa1abbc53abd3f54adb818 HiFi.conf
c57dae885c9a5f366f18b38a3ce3e21627baaf014724537eced9e8d6ac3ca61ade42b9fcf84db350b1e64742760e8cf4fe10639d41052387927238e85c3c4769 PinePhonePro.conf
e978876bda8874e30df75c80554ccbbc0dd202c852ecae0b5c1a0d845402a630962afc2691c6f7d5f478fb0e4be045af4ef62ad0b1ce77f62fe2f155dc0a9cff VoiceCall.conf
"

View file

@ -0,0 +1,194 @@
SectionVerb {
EnableSequence [
### Default rt5640 configuration, copied from /codecs/rt5640/EnableSeq.conf ###
# RT5640 default output routing
cset "name='DAC MIXL INF1 Switch' on"
cset "name='DAC MIXR INF1 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' 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"
# 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/IN3 internal mic boost to 8 (max)
# Set IN2 headset-mic boost to 1, headset mics are quite loud
cset "name='IN1 Boost' 8"
cset "name='IN2 Boost' 1"
# cset "name='IN3 Boost' 8"
# 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"
cset "name='RECMIXL BST2 Switch' off"
cset "name='RECMIXR BST2 Switch' off"
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"
# 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"
### PinePhonePro specific configuration ###
# 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"
# Modem audio is line level, no need to boost this signal
cset "name='IN3 Boost' 0"
# 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"
# Limit amplification factor of earpiece amplifier so sound stays clear
cset "name='Class D SPK Ratio Control' 1.66x"
]
DisableSequence [
# 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 [
"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"
]
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 "Headphone Jack"
PlaybackMixerElem "HP"
PlaybackVolume "HP Playback Volume"
PlaybackMasterElem "DAC1"
}
}
SectionDevice."DigitalMic" {
Comment "Internal Microphone"
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 200
CapturePCM "hw:${CardId}"
CaptureMixerElem "ADC"
CaptureVolume "ADC Capture Volume"
CaptureSwitch "ADC Capture Switch"
}
}

View file

@ -0,0 +1,16 @@
Syntax 4
Comment "PinePhone Pro"
SectionUseCase."HiFi" {
File "HiFi.conf"
Comment "Default"
}
SectionUseCase."VoiceCall" {
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"

View file

@ -0,0 +1,233 @@
SectionVerb {
EnableSequence [
### Default rt5640 configuration, copied from /codecs/rt5640/EnableSeq.conf ###
# RT5640 default output routing
# cset "name='DAC MIXL INF1 Switch' on"
# cset "name='DAC MIXR INF1 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' 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"
# 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/IN3 internal mic boost to 8 (max)
# Set IN2 headset-mic boost to 1, headset mics are quite loud
cset "name='IN1 Boost' 8"
cset "name='IN2 Boost' 1"
# cset "name='IN3 Boost' 8"
# 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"
# cset "name='RECMIXL BST2 Switch' off"
cset "name='RECMIXR BST2 Switch' off"
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"
# 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"
### PinePhonePro specific configuration ###
# 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"
# Route headset mic to the left channel and modem audio
# to the right channel
cset "name='RECMIXL BST2 Switch' on"
cset "name='RECMIXR BST3 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"
# Modem audio is line level, no need to boost this signal
cset "name='IN3 Boost' 0"
# 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"
# 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 SPK (earpiece) and HP (speaker/headphones)
# outputs as we're only routing modem audio to the right channel
cset "name='SPOL MIX SPKVOL L Switch' off"
cset "name='HP L Playback Switch' off"
]
DisableSequence [
# 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 [
"Speaker"
]
EnableSequence [
# 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 300
PlaybackPCM "hw:${CardId}"
PlaybackMixerElem "Speaker"
PlaybackVolume "Speaker Playback Volume"
PlaybackMasterElem "DAC1"
}
}
SectionDevice."Speaker" {
Comment "Internal Speaker"
ConflictingDevice [
"Earpiece"
]
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 100
PlaybackPCM "hw:${CardId}"
JackControl "Headphone Jack"
PlaybackMixerElem "HP"
PlaybackVolume "HP Playback Volume"
PlaybackMasterElem "DAC1"
}
}
SectionDevice."DigitalMic" {
Comment "Internal Microphone"
EnableSequence [
cset "name='Stereo ADC MIXL ADC2 Switch' on"
]
DisableSequence [
cset "name='Stereo ADC MIXL ADC2 Switch' off"
]
Value {
CapturePriority 200
CapturePCM "hw:${CardId}"
CaptureMixerElem "ADC"
CaptureVolume "ADC Capture Volume"
CaptureSwitch "ADC Capture Switch"
}
}
SectionDevice."HeadsetMic" {
Comment "Headset Microphone"
EnableSequence [
cset "name='Stereo ADC MIXL ADC1 Switch' on"
]
DisableSequence [
cset "name='Stereo ADC MIXL ADC1 Switch' off"
]
Value {
CapturePriority 100
CapturePCM "hw:${CardId}"
CaptureMixerElem "ADC"
CaptureVolume "ADC Capture Volume"
CaptureSwitch "ADC Capture Switch"
}
}