Skip to content

PP audio calls do not work out-of-the-box on Mobian/trixie

PP audio calls do not work out-of-the-box on Mobian/trixie

DESCRIPTION:

Audio calls from the PinePhone v1.2 to a remote phone over the mobile network on Mobian/trixie do not work out-of-the-box: the person at the remote phone does not hear the person talking to the microphone on the PP; and the person on the PP does not hear the person talking to the microphone on the remote phone.

CONTEXT:

  • Mobian/trixie, aptitude update && aptitude safe-upgrade 2027-07-30

  • biktorgj modem package 0.7.2

  • ADSP 30.007.30.007 (correction: I'm fairly sure that this was for 01.003.01.003, not 30.007.30.007; I started preparing the bug report before settling on a final set of best parameters)

  • Most tests done with a PP to a landline "remote" phone that is in reality nearby; the remote phone microphone is physically obstructed for checking audio from the PP; this is one-person testing, so not perfect, but seems to be adequate. The PP switched to 2G each time I started a call, at those times when I checked the icons at the top of the touchscreen.

  • Final test done to a remote mobile phone. The PP proximity detector detected my ear and switched off the screen, so I didn't see if 2G, 3G or 4G was used.

  • A desktop computer is connected to the PP over ssh on the USB-C port, for checking alsamixer and editing files on the PP.

ANALYSIS:

  • Main analysis method is editing 'VoiceCall.conf' [1] from alsa-ucm-conf-1.2.9-1, rebooting, and trying a phone call again. Comment: It seems that the only way to get 'VoiceCall.conf' to be re-evaluated when making a phone call with the gnome gui is to reboot. Interpretation: this is likely to be a feature rather than a bug (to make sure that the user cannot easily mess up audio for phone calls). (see the comment below for a better alternative to a reboot)

  • Using alsamixer, and guessing alsa parameters for the .conf files:

sudo alsactl store
cp -pv /var/lib/alsa/asound.state /tmp/try.n

generally helped, though guessing the actual names in the .conf files is not always obvious.

  • Which sections are acted on? It seems that the only parts of VoiceCalls.conf [1] that are acted on during a phone call are

  • the SectionVerb { EnableSequence [ ] } part and

  • the SectionDevice."Speaker" { } part, but

  • not the SectionDevice."Mic" { } part.

  • Both Mic1 and Mic2 seem to be needed.

  • A parameter set that allows some audio communication (patch below) disables all use of 'Line Out Capture Switch'; this was done because certain parameter combinations led to screeching either on reboot of the PP, and/or on starting an audio call.

Interpretation: this appears to be a side effect of testing this with the USB-C port in usage and `SectionDevice."Speaker" being triggered.

RELATED BUGS: https://github.com/the-modem-distro/pinephone_modem_sdk/issues/211

PATCH:

The following patch against three files in alsa-ucm-conf-1.2.9-1 in the /usr/share/alsa/ucm2/Allwinner/A64/PinePhone/ directory [2] partially works. I heard the person on the remote phone well.

Fatal flaws in final test:

  • the person on the remote phone heard his/her voice echoed;

  • the person on the remote phone heard several of my sentences for the first 10-15 seconds or so; and didn't hear me for the following 20-30 seconds.

diff -ubr Mobian_PP_trixie/HiFi.conf PinePhone/HiFi.conf
--- Mobian_PP_trixie/HiFi.conf  2023-06-14 14:10:42.000000000 +0200
+++ PinePhone/HiFi.conf 2023-07-31 19:15:24.663115013 +0200
@@ -19,7 +19,8 @@
        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 Switch' on" # 2023-07-31 forcibly disabled
+               cset "name='Line Out Playback Switch' off"
                cset "name='Line Out Playback Volume' 100%"
        ]

diff -ubr Mobian_PP_trixie/PinePhone.conf PinePhone/PinePhone.conf
--- Mobian_PP_trixie/PinePhone.conf     2023-06-14 14:10:42.000000000 +0200
+++ PinePhone/PinePhone.conf    2023-07-31 19:17:52.875883854 +0200
@@ -31,6 +31,9 @@
        cset "name='Headphone Source Playback Route' DAC"
        # The Pinephone speaker is mono.
        cset "name='Line Out Source Playback Route' Mono Differential"
+       # 2023-07-31 hack to try to prevent unexplained switching
+       # on/unmuting of the Line Out parameter
+       cset "name='Line Out Playback Switch' off"
 ]

 SectionDefaults [
diff -ubr Mobian_PP_trixie/VoiceCall.conf PinePhone/VoiceCall.conf
--- Mobian_PP_trixie/VoiceCall.conf     2023-07-30 21:04:13.000000000 +0200
+++ PinePhone/VoiceCall.conf    2023-07-31 19:28:32.696313695 +0200
@@ -1,17 +1,37 @@
 SectionVerb {
        EnableSequence [
                # Playback volumes.
-               cset "name='DAC Playback Volume' 160"
+               cset "name='DAC Playback Volume' 163"
+               cset "name='DAC Playback Switch' on"
                cset "name='AIF1 DA0 Playback Volume' 160"
-               cset "name='AIF2 DAC Playback Volume' 160"
+               #cset "name='AIF2 DAC Playback Volume' 160"
+               cset "name='AIF2 DAC Playback Volume' 186"
                # Capture volumes.
-               cset "name='ADC Capture Volume' 160"
+               #cset "name='ADC Capture Volume' 160"
+               cset "name='ADC Capture Volume' 179"
+               # Make sure that if you plug something into your USB-C you won't get screeching
+               cset "name='Line Out Playback Switch' off"
+               #
                cset "name='AIF1 AD0 Capture Volume' 160"
-               cset "name='AIF2 ADC Capture Volume' 160"
+               #cset "name='AIF2 ADC Capture Volume' 160"
+               cset "name='AIF2 ADC Capture Volume' 186"
                cset "name='Mic2 Boost Volume' 1"
                # Routing
                cset "name='AIF2 Digital DAC Playback Switch' on"
                cset "name='AIF2 ADC Mixer ADC Capture Switch' on"
+               # Assume only 'Mic' will be used, not a headset
+               cset "name='Mic1 Capture Switch' on"
+               cset "name='Mic1 Playback Volume' 5"
+               cset "name='Mic1 Playback Switch' on"
+               cset "name='Mic2 Capture Switch' on"
+               cset "name='Mic2 Playback Volume' 5"
+               # 'Plackback Switch' typically corresponds to 'mute' in alsamixer
+               cset "name='Mic2 Playback Switch' on"
+       ]
+
+       DisableSequence [
+               cset "name='Mic1 Capture Switch' off"
+               cset "name='Mic2 Capture Switch' off"
        ]

        Value {
@@ -24,7 +44,8 @@

        EnableSequence [
                cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
-               cset "name='Line Out Playback Switch' on"
+               #cset "name='Line Out Playback Switch' on" # 2023-07-31 forcibly disabled
+               cset "name='Line Out Playback Switch' off"
                cset "name='Line Out Playback Volume' 100%"
        ]

@@ -68,10 +89,14 @@

        EnableSequence [
                cset "name='Mic1 Capture Switch' on"
+               cset "name='Mic1 Playback Volume' 5 on"
+               cset "name='Mic2 Capture Switch' on"
+               cset "name='Mic2 Playback Volume' 5 on"
        ]

        DisableSequence [
                cset "name='Mic1 Capture Switch' off"
+               cset "name='Mic2 Capture Switch' off"
        ]

        Value {

[1] https://salsa.debian.org/alsa-team/alsa-ucm-conf/-/blob/debian/master/ucm2/Allwinner/A64/PinePhone/VoiceCall.conf

[2] https://salsa.debian.org/alsa-team/alsa-ucm-conf/-/blob/debian/master/ucm2/Allwinner/A64/

Edited by Boud Roukema