From 5ed7888710ed4d0053a6b68d608d9bdf61de7810 Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 26 Sep 2022 01:42:31 -0700 Subject: [PATCH] moby: switch to manjaro alsa UCM files the "internal speaker" is broken -- not sure if this minor change will fix that or not --- machines/moby/default.nix | 6 ++- machines/moby/ucm2/PinePhone/HiFi.conf | 44 ++++++++++--------- machines/moby/ucm2/PinePhone/VoiceCall.conf | 47 ++++++++++++--------- 3 files changed, 57 insertions(+), 40 deletions(-) diff --git a/machines/moby/default.nix b/machines/moby/default.nix index 74ed1593..97f7ab28 100644 --- a/machines/moby/default.nix +++ b/machines/moby/default.nix @@ -73,7 +73,11 @@ hardware.sensor.iio.enable = true; # from https://gitlab.manjaro.org/manjaro-arm/packages/community/phosh/alsa-ucm-pinephone - # mobile-nixos does this same thing + # mobile-nixos does this same thing, with *slightly different settings*. + # i trust manjaro more because the guy maintaining that is actively trying to upstream into alsa-ucm-conf. + # an alternative may be to build a custom alsa with the PinePhone config patch applied: + # - + # that would make this be not device-specific environment.variables.ALSA_CONFIG_UCM2 = "${./ucm2}"; systemd.services.pulseaudio.environment.ALSA_CONFIG_UCM2 = "${./ucm2}"; diff --git a/machines/moby/ucm2/PinePhone/HiFi.conf b/machines/moby/ucm2/PinePhone/HiFi.conf index af4999c7..a2432495 100644 --- a/machines/moby/ucm2/PinePhone/HiFi.conf +++ b/machines/moby/ucm2/PinePhone/HiFi.conf @@ -21,11 +21,9 @@ SectionVerb { 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='Mic1 Boost Volume' 7" cset "name='Mic2 Capture Switch' off" - cset "name='Mic2 Boost Volume' 0" - cset "name='Mic2 Playback Volume' 7" + 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" @@ -38,8 +36,10 @@ SectionVerb { cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" ] - DisableSequence [ - ] + + DisableSequence [ + ] + Value { } } @@ -59,7 +59,7 @@ SectionDevice."Speaker" { Value { PlaybackVolume "Line Out Playback Volume" PlaybackSwitch "Line Out Playback Switch" - PlaybackChannels "2" + PlaybackChannels 2 PlaybackPriority 300 PlaybackPCM "hw:${CardId},0" } @@ -79,15 +79,15 @@ SectionDevice."Earpiece" { Value { PlaybackVolume "Earpiece Playback Volume" PlaybackSwitch "Earpiece Playback Switch" - PlaybackChannels "2" - PlaybackPriority 100 + PlaybackChannels 2 + PlaybackPriority 200 PlaybackPCM "hw:${CardId},0" } } -SectionDevice."DigitalMic" { +SectionDevice."Mic" { Comment "Internal Microphone" ConflictingDevice [ - "HeadsetMic" + "Headset" ] EnableSequence [ cset "name='Mic1 Capture Switch' on" @@ -98,13 +98,16 @@ SectionDevice."DigitalMic" { Value { CapturePriority 100 CapturePCM "hw:${CardId},0" - CaptureChannels "2" + CaptureChannels 2 + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" } } -SectionDevice."HeadsetMic" { +SectionDevice."Headset" { Comment "Headset Microphone" ConflictingDevice [ - "DigitalMic" + "Mic" ] EnableSequence [ cset "name='Mic2 Capture Switch' on" @@ -113,18 +116,21 @@ SectionDevice."HeadsetMic" { cset "name='Mic2 Capture Switch' off" ] Value { - CapturePriority 200 + CapturePriority 500 CapturePCM "hw:${CardId},0" - CaptureChannels "2" + CaptureChannels 2 + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" JackControl "Headset Microphone Jack" } } -SectionDevice."Headphone" { +SectionDevice."Headphones" { Comment "Headphones" EnableSequence [ cset "name='AIF1 DA0 Stereo Playback Route' Stereo" cset "name='Headphone Playback Switch' on" - cset "name='Headphone Playback Volume' 100%" + cset "name='Headphone Playback Volume' 70%" ] DisableSequence [ @@ -134,7 +140,7 @@ SectionDevice."Headphone" { Value { PlaybackVolume "Headphone Playback Volume" PlaybackSwitch "Headphone Playback Switch" - PlaybackChannels "2" + PlaybackChannels 2 PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" JackControl "Headphone Jack" diff --git a/machines/moby/ucm2/PinePhone/VoiceCall.conf b/machines/moby/ucm2/PinePhone/VoiceCall.conf index dce023e9..349ac8bd 100644 --- a/machines/moby/ucm2/PinePhone/VoiceCall.conf +++ b/machines/moby/ucm2/PinePhone/VoiceCall.conf @@ -9,7 +9,6 @@ SectionVerb { cset "name='Mic2 Playback Switch' off" cset "name='AIF1 DA0 Playback Volume' 160" cset "name='AIF2 DAC Playback Volume' 160" - cset "name='AIF2 DAC Stereo Playback Route' Mix Mono" cset "name='AIF3 ADC Source Capture Route' None" cset "name='AIF2 DAC Source Playback Route' AIF2" cset "name='DAC Playback Switch' on" @@ -41,8 +40,10 @@ SectionVerb { cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" cset "name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off" ] - DisableSequence [ - ] + + DisableSequence [ + ] + Value { PlaybackRate 8000 } @@ -53,7 +54,7 @@ SectionDevice."Speaker" { EnableSequence [ cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono" cset "name='Line Out Playback Switch' on" - cset "name='Line Out Playback Volume' 80%" + cset "name='Line Out Playback Volume' 100%" ] DisableSequence [ @@ -63,8 +64,8 @@ SectionDevice."Speaker" { Value { PlaybackVolume "Line Out Playback Volume" PlaybackSwitch "Line Out Playback Switch" - PlaybackChannels "2" - PlaybackPriority 100 + PlaybackChannels 2 + PlaybackPriority 300 PlaybackPCM "hw:${CardId},0" } } @@ -83,15 +84,15 @@ SectionDevice."Earpiece" { Value { PlaybackVolume "Earpiece Playback Volume" PlaybackSwitch "Earpiece Playback Switch" - PlaybackChannels "2" - PlaybackPriority 300 + PlaybackChannels 2 + PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" } } -SectionDevice."DigitalMic" { +SectionDevice."Mic" { Comment "Internal Microphone" ConflictingDevice [ - "HeadsetMic" + "Headset" ] EnableSequence [ cset "name='Mic1 Capture Switch' on" @@ -100,15 +101,18 @@ SectionDevice."DigitalMic" { cset "name='Mic1 Capture Switch' off" ] Value { - CapturePriority 100 + CapturePriority 200 CapturePCM "hw:${CardId},0" - CaptureChannels "2" + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic1 Capture Switch" + CaptureChannels 2 } } -SectionDevice."HeadsetMic" { +SectionDevice."Headset" { Comment "Headset Microphone" ConflictingDevice [ - "DigitalMic" + "Mic" ] EnableSequence [ cset "name='Mic2 Capture Switch' on" @@ -117,18 +121,21 @@ SectionDevice."HeadsetMic" { cset "name='Mic2 Capture Switch' off" ] Value { - CapturePriority 200 + CapturePriority 500 CapturePCM "hw:${CardId},0" - CaptureChannels "2" + CaptureChannels 2 + CaptureMixerElem "ADC" + CaptureVolume "ADC Capture Volume" + CaptureSwitch "Mic2 Capture Switch" JackControl "Headset Microphone Jack" } } -SectionDevice."Headphone" { - Comment "Headset" +SectionDevice."Headphones" { + Comment "Headphones" EnableSequence [ cset "name='AIF1 DA0 Stereo Playback Route' Stereo" cset "name='Headphone Playback Switch' on" - cset "name='Headphone Playback Volume' 70%" + cset "name='Headphone Playback Volume' 100%" ] DisableSequence [ @@ -138,7 +145,7 @@ SectionDevice."Headphone" { Value { PlaybackVolume "Headphone Playback Volume" PlaybackSwitch "Headphone Playback Switch" - PlaybackChannels "2" + PlaybackChannels 2 PlaybackPriority 500 PlaybackPCM "hw:${CardId},0" JackControl "Headphone Jack"