pinephone: not using upstream alsa-ucm-conf
The alsa-ucm-conf has been upstreamed here and made it into the 1.2.9. release.
We should use it instead of our custom config in device-pine64-pinephone.
In theory:
- remove all ucm related files (ucm directory)
- depend on
alsa-ucm-conf>=1.2.9
- remove replaces="alsa-ucm-conf"
However as I tried to do this for the initial version of !4061 (merged), sound did not work anymore. I'm super busy this week and can't investigate further right now so I'll just add a replaces line to device-pine64-pinephone so sound doesn't break for everybody using edge.
If somebody could help out with figuring out why the upstream config doesn't just work, it would be highly appreciated. It did work six months ago when I tested the PR that upstreamed it.
(When testing, make sure you actually have alsa-ucm-conf >= 1.2.9 installed.)
CC: @PsychoGame, @Arnavion, @BobbyTheBuilder
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Administrator added device-pine64-pinephone help wanted release-edge type::bug labels · Imported
added device-pine64-pinephone help wanted release-edge type::bug labels
- Author OwnerResolved by Administrator
Sounds works for me with the new packages: !4061 (comment 1386297353)
Edit: Per !4061 (comment 1386345392) , works with
pipewire-pulse
but broken withpulseaudio
.By Arnav Singh on 2024-07-31T18:14:08
Edited by Administrator 2 replies Last reply by Administrator
- Administrator mentioned in merge request !4061 (merged) · Imported
mentioned in merge request !4061 (merged)
By Oliver Smith on 2023-05-11T08:04:12
- Author Owner
@Arnavion wrote in !4061 (comment 1386297353):
One thing is that the earpiece, speaker and mic are much louder by default now. Specifically the mic at max volume now sounds like a busy road to the person on the other end even if I'm completely quiet, and the speaker at max volume plays an audible electronic whine. So now at least those two need to be set to lower than max volume. I noticed that some properties are different in the new config vs the old one, eg
cset "name='Mic2 Boost Volume' 0"
is now1
, so I assume these changes are expected.Do you want to make an upstream PR to adjust these?
By Oliver Smith on 2023-05-11T08:26:38
Edited by Ghost User Collapse replies - Author Owner
From a quick glance, https://github.com/alsa-project/alsa-ucm-conf/pull/134 seems to have gone through a bunch of back-and-forth on these values. I'll go through the discussion in detail later.
By Arnav Singh on 2023-05-12T05:58:21
Edited by Ghost User 1
- Author Owner
Hey,
I want you to report that I updated (upgrade -a) my pinephone this morning and the sound is now broken.
I looked at the package-list (dl-cdn.alpinelinux.org/alpine/edge/main/aarch64) of alpine-linux and there was a update of alsa-ucm-conf at May the 13rd.
Any idea?
By shadowmaker on 2023-05-13T11:15:48
- Author Owner
ok I found the error with pulseaudio -vvv :
"Failed to open module module-alsa-card.so: Error loading shared library module-alsa-card.so: No such file or directory"
I don't know why module-alsa-card.so was missing. But i could fix this by downgrading pulseaudio-alsa to "pulseaudio-alsa-9999_git20220528-r0"
sorry for the posting
By shadowmaker on 2023-05-13T14:59:49
Edited by Administrator - Author Owner
Here is a diff of the changes made to upstream:
diff -Npur pmos/HiFi.conf upstream/HiFi.conf --- pmos/HiFi.conf 2023-05-16 22:18:02.000000000 +0200 +++ upstream/HiFi.conf 2023-05-04 19:59:00.000000000 +0200 @@ -1,55 +1,14 @@ 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 [ @@ -57,19 +16,17 @@ SectionDevice."Speaker" { ] Value { - PlaybackVolume "Line Out Playback Volume" - PlaybackSwitch "Line Out Playback Switch" - PlaybackChannels 2 + PlaybackMixerElem "Line Out" 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 [ @@ -77,54 +34,64 @@ SectionDevice."Earpiece" { ] Value { - PlaybackVolume "Earpiece Playback Volume" - PlaybackSwitch "Earpiece Playback Switch" - PlaybackChannels 2 + PlaybackMixerElem "Earpiece" 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 + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" } } + 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 + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" JackControl "Headset Microphone Jack" } } + SectionDevice."Headphones" { - Comment "Headset" + Comment "Headphones" + EnableSequence [ - cset "name='AIF1 DA0 Stereo Playback Route' Stereo" cset "name='Headphone Playback Switch' on" - cset "name='Headphone Playback Volume' 70%" ] DisableSequence [ @@ -132,9 +99,7 @@ SectionDevice."Headphones" { ] Value { - PlaybackVolume "Headphone Playback Volume" - PlaybackSwitch "Headphone Playback Switch" - PlaybackChannels 2 + PlaybackMixerElem "Headphone" PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" JackControl "Headphone Jack" diff -Npur pmos/PinePhone.conf upstream/PinePhone.conf --- pmos/PinePhone.conf 2023-05-16 22:18:02.000000000 +0200 +++ upstream/PinePhone.conf 2023-05-04 19:59:00.000000000 +0200 @@ -1,11 +1,67 @@ Syntax 2 +# https://wiki.pine64.org/index.php/PinePhone +# https://files.pine64.org/doc/PinePhone/PinePhone%20v1.2%20Released%20Schematic.pdf +# https://xnux.eu/devices/feature/audio-pp.html + SectionUseCase."HiFi" { - File "/PinePhone/HiFi.conf" + File "/Allwinner/A64/PinePhone/HiFi.conf" Comment "Play HiFi quality music" } SectionUseCase."Voice Call" { - File "/PinePhone/VoiceCall.conf" + File "/Allwinner/A64/PinePhone/VoiceCall.conf" Comment "Make a phone call" } + +FixedBootSequence [ + # Routing. + cset "name='ADC Digital DAC Playback Switch' off" + cset "name='AIF1 DA0 Stereo Playback Route' Stereo" + cset "name='AIF1 Data Digital ADC Capture Switch' on" + cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on" + cset "name='AIF2 DAC Source Playback Route' AIF2" + # AIF2 (Modem) is mono. + cset "name='AIF2 DAC Stereo Playback Route' Mix Mono" + cset "name='AIF3 ADC Source Capture Route' None" + cset "name='DAC Playback Switch' on" + # Routes DACR->MIXL and DACL->MIXR => MIXL are MIXR are identical mono-mix of the DAC. + cset "name='DAC Reversed Playback Switch' on" + cset "name='Earpiece Source Playback Route' Left Mixer" + cset "name='Headphone Source Playback Route' DAC" + # The Pinephone speaker is mono. + cset "name='Line Out Source Playback Route' Mono Differential" +] + +BootSequence [ + # Playback volumes. + cset "name='AIF1 DA0 Playback Volume' 160" + cset "name='AIF2 DAC Playback Volume' 160" + cset "name='DAC Playback Volume' 160" + cset "name='Earpiece Playback Volume' 100%" + cset "name='Headphone Playback Volume' 70%" + cset "name='Line Out Playback Volume' 100%" + cset "name='Mic2 Boost Volume' 1" + + # Capture volumes. + cset "name='ADC Capture Volume' 160" + cset "name='AIF1 AD0 Capture Volume' 160" + cset "name='AIF2 ADC Capture Volume' 160" +] + +SectionDefaults [ + # Switch playback off. + cset "name='Earpiece Playback Switch' off" + cset "name='Headphone Playback Switch' off" + cset "name='Line In Playback Switch' off" + cset "name='Line Out Playback Switch' off" + cset "name='Mic1 Playback Switch' off" + cset "name='Mic2 Playback Switch' off" + + # Switch capture off. + cset "name='Line In Capture Switch' off" + cset "name='Mic1 Capture Switch' off" + cset "name='Mic2 Capture Switch' off" + cset "name='Mixer Capture Switch' off" + cset "name='Mixer Reversed Capture Switch' off" +] \ Kein Zeilenumbruch am Dateiende. diff -Npur pmos/VoiceCall.conf upstream/VoiceCall.conf --- pmos/VoiceCall.conf 2023-05-16 22:18:02.000000000 +0200 +++ upstream/VoiceCall.conf 2023-05-04 19:59:00.000000000 +0200 @@ -1,49 +1,9 @@ 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 } @@ -51,10 +11,9 @@ SectionVerb { 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 [ @@ -62,19 +21,17 @@ SectionDevice."Speaker" { ] Value { - PlaybackVolume "Line Out Playback Volume" - PlaybackSwitch "Line Out Playback Switch" - PlaybackChannels 2 + PlaybackMixerElem "Line Out" 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 [ @@ -82,54 +39,64 @@ SectionDevice."Earpiece" { ] Value { - PlaybackVolume "Earpiece Playback Volume" - PlaybackSwitch "Earpiece Playback Switch" - PlaybackChannels 2 + PlaybackMixerElem "Earpiece" 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 + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" } } + 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 + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" JackControl "Headset Microphone Jack" } } + SectionDevice."Headphones" { - Comment "Headset" + Comment "Headphones" + EnableSequence [ - cset "name='AIF1 DA0 Stereo Playback Route' Stereo" cset "name='Headphone Playback Switch' on" - cset "name='Headphone Playback Volume' 100%" ] DisableSequence [ @@ -137,9 +104,7 @@ SectionDevice."Headphones" { ] Value { - PlaybackVolume "Headphone Playback Volume" - PlaybackSwitch "Headphone Playback Switch" - PlaybackChannels 2 + PlaybackMixerElem "Headphone" PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" JackControl "Headphone Jack"
By Philip Müller on 2023-05-17T09:06:46
- Author Owner
Seems a lot of refactoring happened in this branch: https://github.com/tomfitzhenry/alsa-ucm-conf/commits/pinephone-split
By Philip Müller on 2023-05-17T10:11:09
- Author Owner
Seems this is the commit which creates the regression: https://github.com/tomfitzhenry/alsa-ucm-conf/commit/8158c3b919a9c01f5223762a9f153789ff3a9695
By Philip Müller on 2023-05-17T15:27:11
Edited by Ghost User Collapse replies - Author Owner
-
You're looking at the fork of the person who made the PR to alsa-ucm-conf, not the alsa-ucm-conf repo.
-
We already know what the change was. #2115 (comment 1386372543)
By Arnav Singh on 2023-05-17T15:27:11
-
- Author Owner
Well I looked at that branch as it shows how the UCM config was created. As soon as sound levels got added to BootSequence or FixedBootSequence there is none audio in pulseaudio. Also on pipewire I wasn't able to get any sound. And if you look closer to the PR, those changes were part of the PR once and got tested by @ollieparanoid. The final version from Nov 27 and Jan 15 seems not.
By Philip Müller on 2023-05-17T21:33:14
- Author Owner
Well I looked at that branch as it shows how the UCM config was created.
The PR was made from a different branch.
Also on pipewire I wasn't able to get any sound.
It works fine with pipewire-pulse for me.
And if you look closer to the PR, those changes were part of the PR once and got tested by @ollieparanoid. The final version from Nov 27 and Jan 15 seems not.
We already know from git history of the file in alsa-ucm-conf that there are no other changes than the PR, so we already know that something in that PR is the problem. As I said in #2115 (comment 1386372543) and as one can see in the PR comment thread, there was a lot of back-and-forth on setting the properties, so someone needs to look at that back-and-forth to identify which change broke pulseaudio, made the volume higher, etc and what was the justification for doing so.
By Arnav Singh on 2023-05-17T21:43:11
Edited by Administrator - Author Owner
@Arnavion as I see it it started in the pinephone-wip branch, moved over to pinephone-split and finally that result got polished in pinephone branch. However the issue starts as soon as setting the volume gets moved to BootSequence.
By Philip Müller on 2023-05-18T06:23:51
- Author Owner
possibly related: pulseaudio might be broken until we remove
~/.config/pulse
as in https://gitlab.com/postmarketOS/postmarketos.org/-/merge_requests/223By Oliver Smith on 2023-09-06T06:36:01
Edited by Administrator - Administrator mentioned in issue #2306 · Imported
mentioned in issue #2306
By Alaraajavamma on 2023-10-02T16:01:05
- Author Owner
device-pine64-pinephone now forces the use of -audio-pipewire, so it's probably easier to switch to upstream ALSA UCM now. Need to retest issues like #2115 (comment 1386345968) and any others.
By Arnav Singh on 2024-08-04T20:27:53
Edited by Administrator Collapse replies - Author Owner
With alsa-ucm-conf 1.2.12, profiles appear fine, and "HiFi (Mic, Speaker)" profile can be selected fine, but the speaker produces no sound at all. So upstream config can't be used as-is. I haven't investigated in full, but I did take the opportunity to incorporate some of upstream's config in ours to reduce the diff: !5462 (merged)
By Arnav Singh on 2024-08-04T20:27:53
- Administrator mentioned in merge request !5462 (merged) · Imported
mentioned in merge request !5462 (merged)
By Arnav Singh on 2024-08-04T20:19:10
- Administrator mentioned in commit 553deb6c · Imported
mentioned in commit 553deb6c
By Arnav Singh on 2024-08-08T18:05:32