pmaports/device/community/device-purism-librem5/librem5-base-ucm2.patch
Clayton Craft 22a5e4dda5
device-purism-librem5: upgrade to 1.11 (MR 1896)
- Upgrade librem5-base to v33
- Include the haptic vibration driver in initfs for supporting osk-sdl's
  haptic feedback feature
- remove gps udev rule in pmaports in favor of using rule from
  librem5-base
- install modem audio udev rule from librem5-base
- add openrc service for putting device into 'ship mode' on shutdown
  (prevents battery from slowly draining)
- include Evergreen/r4 dtb in /boot
- Fix audio with port of ucm config to ucm2 (patch submitted upstream
  here: https://source.puri.sm/Librem5/librem5-base/-/merge_requests/214)
2021-01-27 15:36:21 +01:00

219 lines
6.2 KiB
Diff

diff --git a/debian/librem5-base-defaults.install b/debian/librem5-base-defaults.install
index 067ba03..ce68610 100644
--- a/debian/librem5-base-defaults.install
+++ b/debian/librem5-base-defaults.install
@@ -5,7 +5,7 @@ default/adwaita-phone.jpg usr/share/librem5/default-theme/
# Audio configuration
default/audio/pulse etc/
default/audio/profile-sets usr/share/pulseaudio/alsa-mixer/
-default/audio/ucm usr/share/alsa/
+default/audio/ucm2 usr/share/alsa/
default/sm.puri.OSK0.desktop usr/share/applications/
diff --git a/default/audio/pulse/librem5.pa b/default/audio/pulse/librem5.pa
index e96de9a..f87d8f5 100644
--- a/default/audio/pulse/librem5.pa
+++ b/default/audio/pulse/librem5.pa
@@ -14,9 +14,9 @@ load-module module-alsa-card device_id="MODEM" name="platform-sound-wwan" card_p
.ifexists /sys/devices/platform/sound/308b0000.sai-wm8962
set-card-profile alsa_card.platform-sound HiFi
-set-default-sink alsa_output.platform-sound.HiFi__hw_CARD_wm8962__sink
-set-default-source alsa_input.platform-sound.HiFi__hw_CARD_wm8962__source
-update-source-proplist alsa_input.platform-sound.HiFi__hw_CARD_wm8962__source filter.apply.echo-cancel.parameters="aec_args=\"analog_gain_control=0\" use_master_format=yes channels=1"
+set-default-sink alsa_output.platform-sound.HiFi__hw_wm8962_0__sink
+set-default-source alsa_output.platform-sound.HiFi__hw_wm8962_0__source
+update-source-proplist alsa_input.platform-sound.HiFi__hw_wm8962_0__source filter.apply.echo-cancel.parameters="aec_args=\"analog_gain_control=0\" use_master_format=yes channels=1"
.endif
# cork/mute audio streams when on a phone call
diff --git a/default/audio/ucm/wm8962/HiFi.conf b/default/audio/ucm2/wm8962/HiFi.conf
similarity index 81%
rename from default/audio/ucm/wm8962/HiFi.conf
rename to default/audio/ucm2/wm8962/HiFi.conf
index 122484b..d88fa99 100644
--- a/default/audio/ucm/wm8962/HiFi.conf
+++ b/default/audio/ucm2/wm8962/HiFi.conf
@@ -1,6 +1,5 @@
SectionVerb {
EnableSequence [
- cdev "hw:wm8962"
cset "name='Digital Playback Volume' 100,100"
cset "name='MIXINL IN2L Switch' off"
cset "name='MIXINL IN3L Switch' off"
@@ -16,11 +15,13 @@ SectionVerb {
cset "name='INPGAL IN4L Switch' off"
cset "name='Input Mixer Switch' off,on"
cset "name='SPKOUTL PGA' Mixer"
+ cset "name='Speaker Volume', on"
+ cset "name='Headphone Volume', off"
+ cset "name='Digital Capture Volume', off"
cset "name='SPKOUTR PGA' Mixer"
]
DisableSequence [
- cdev "hw:wm8962"
cset "name='Digital Playback Volume' 0,0"
]
@@ -29,7 +30,7 @@ SectionVerb {
}
}
-SectionDevice."Handset".0 {
+SectionDevice."Handset" {
Comment "Handset"
ConflictingDevice [
@@ -38,7 +39,6 @@ SectionDevice."Handset".0 {
]
EnableSequence [
- cdev "hw:wm8962"
cset "name='Speaker Switch' off,on"
cset "name='DAC L/R Swap Switch' on"
cset "name='DAC Monomix Switch' on"
@@ -48,7 +48,6 @@ SectionDevice."Handset".0 {
]
DisableSequence [
- cdev "hw:wm8962"
cset "name='Speaker Switch' off,off"
cset "name='DAC L/R Swap Switch' off"
cset "name='DAC Monomix Switch' off"
@@ -58,13 +57,12 @@ SectionDevice."Handset".0 {
Value {
PlaybackChannels "2"
PlaybackPriority "100"
- PlaybackVolume "name='Speaker Volume'"
PlaybackSwitch "name='Speaker Switch'"
- PlaybackPCM "hw:CARD=wm8962"
+ PlaybackPCM "hw:${CardId},0"
}
}
-SectionDevice."Speaker".0 {
+SectionDevice."Speaker" {
Comment "Speaker"
ConflictingDevice [
@@ -73,7 +71,6 @@ SectionDevice."Speaker".0 {
]
EnableSequence [
- cdev "hw:wm8962"
cset "name='Speaker Switch' on,off"
cset "name='DAC Monomix Switch' on"
cset "name='SPKOUTL PGA' DAC"
@@ -82,7 +79,6 @@ SectionDevice."Speaker".0 {
]
DisableSequence [
- cdev "hw:wm8962"
cset "name='Speaker Switch' off,off"
cset "name='DAC Monomix Switch' off"
cset "name='SPKOUTL PGA' Mixer"
@@ -91,13 +87,32 @@ SectionDevice."Speaker".0 {
Value {
PlaybackChannels "2"
PlaybackPriority "500"
- PlaybackVolume "name='Speaker Volume'"
PlaybackSwitch "name='Speaker Switch'"
- PlaybackPCM "hw:CARD=wm8962"
+ PlaybackPCM "hw:${CardId},0"
}
}
-SectionDevice."Headphones".0 {
+SectionDevice."Mic" {
+ Comment "Internal Microphone"
+
+ EnableSequence [
+ cset "name='Digital Capture Volume' 116,116"
+ cset "name='ADC L/R Swap Switch' on"
+ ]
+
+ DisableSequence [
+ cset "name='Digital Capture Volume' 0,0"
+ cset "name='ADC L/R Swap Switch' off"
+ ]
+
+ Value {
+ CapturePriority "500"
+ CaptureChannels "2"
+ CapturePCM "hw:${CardId},0"
+ }
+}
+
+SectionDevice."Headphones" {
Comment "Headphones"
ConflictingDevice [
@@ -106,7 +121,6 @@ SectionDevice."Headphones".0 {
]
EnableSequence [
- cdev "hw:wm8962"
cset "name='Headphone Switch' on,on"
cset "name='HPOUTL PGA' 0 unmute"
cset "name='HPOUTR PGA' 0 unmute"
@@ -115,7 +129,6 @@ SectionDevice."Headphones".0 {
]
DisableSequence [
- cdev "hw:wm8962"
cset "name='Headphone Switch' off off"
cset "name='HPOUTL PGA' 0 mute"
cset "name='HPOUTR PGA' 0 mute"
@@ -124,36 +137,8 @@ SectionDevice."Headphones".0 {
Value {
PlaybackPriority "1000"
PlaybackChannels "2"
- PlaybackVolume "name='Headphone Volume'"
PlaybackSwitch "name='Headphone Switch'"
- PlaybackPCM "hw:CARD=wm8962"
+ PlaybackPCM "hw:${CardId},0"
JackControl "Headphones Jack"
}
}
-
-SectionDevice."Mic".0 {
- Comment "Internal Microphone"
-
- ConflictingDevice [
- "Headset"
- ]
-
- EnableSequence [
- cdev "hw:wm8962"
- cset "name='Digital Capture Volume' 116,116"
- cset "name='ADC L/R Swap Switch' on"
- ]
-
- DisableSequence [
- cdev "hw:wm8962"
- cset "name='Digital Capture Volume' 0,0"
- cset "name='ADC L/R Swap Switch' off"
- ]
-
- Value {
- CapturePriority "500"
- CaptureChannels "2"
- CaptureVolume "name='Digital Capture Volume'"
- CapturePCM "hw:CARD=wm8962"
- }
-}
diff --git a/default/audio/ucm/wm8962/wm8962.conf b/default/audio/ucm2/wm8962/wm8962.conf
similarity index 91%
rename from default/audio/ucm/wm8962/wm8962.conf
rename to default/audio/ucm2/wm8962/wm8962.conf
index ebdc11f..d4b95d8 100644
--- a/default/audio/ucm/wm8962/wm8962.conf
+++ b/default/audio/ucm2/wm8962/wm8962.conf
@@ -1,3 +1,5 @@
+Syntax 2
+
Comment "WM8962 Codec for Librem 5 Phone"
SectionUseCase."HiFi" {