From 33b934c29d2911ef060d48b1a0ca9682645b68c8 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 17 Jun 2022 11:42:53 +0200 Subject: [PATCH] USB-Audio: Realtek ALC4080 cleanups Based on alsa-info.sh output, this is a complete cleanup for the ALC4080 codecs. The simple mixer controls names are fixed based on the amixer output contents. Because I cannot test those changes directly with hardware, please, create an issue or pull request to fix the possible regressions. PCM playback devices: 0,1,2,3 PCM capture devices: 0,1,2 Simple playback mixer controls: 'PCM',0 8ch 'PCM',1 2ch 'PCM',2 mono Simple capture mixer controls: 'Line',0 2ch 'Mic',0 2ch 'Analog In',0 2ch Jacks: 'Speaker - Output Jack' 'Headphone - Output Jack' 'Mic - Input Jack' 'Line - Input Jack' 'Analog In - Input Jack' Alsa-info: https://launchpadlibrarian.net/573795872/AlsaInfo.txt MAG X570S TORPEDO MAX (MS-7D54) USB0db0:a073 Alsa-info: https://github.com/alsa-project/alsa-ucm-conf/files/9078972/alsa-info.txt MAG X570S TOMAHAWK MAX WIFI (MS-7D54) USB0db0:a073 Alsa-info: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/uploads/8fb28cc3c7f98c642d0d1f0e8521dc49/alsa-info.txt MPG Z690 EDGE WIFI DDR4 (MS-7D31) USB0db0:1feb Alsa-info: http://alsa-project.org/db/?f=131d4da535c4ec4545c74616f83f393f1c9152dd ROG STRIX Z590-F GAMING WIFI USB0b05:1996 Signed-off-by: Jaroslav Kysela --- ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf | 197 +++++++++++++++++------ 1 file changed, 148 insertions(+), 49 deletions(-) diff --git a/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf b/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf index 6296a36..be2e273 100644 --- a/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf +++ b/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf @@ -1,5 +1,31 @@ -Define.SPDIFIndex "3" -Define.Mic1Name "Microphone" +Define { + SpeakerMixer "PCM" + SpeakerJack "Speaker - Output Jack" + SpeakerPCM "hw:${CardId}" + + HeadphonesName "Front Headphones" + HeadphonesMixer "PCM,1" + HeadphonesJack "Headphone - Output Jack" + HeadphonesPCM "hw:${CardId},1" + + Mic1Name "Microphone" + Mic1Mixer "Mic" + Mic1Jack "Mic - Input Jack" + Mic1PCM "hw:${CardId},2" + + Mic2Name "" + Mic2Mixer "" + Mic2Jack "" + Mic2PCM "" + + Line1Name "Line Input" + Line1Mixer "Line" + Line1Jack "Line - Input Jack" + Line1PCM "hw:${CardId},1" + + SpdifName "S/PDIF Output" + SpdifPCM "hw:${CardId},3" +} If.asus-rog-usb { Condition { @@ -7,79 +33,152 @@ If.asus-rog-usb { String "${CardComponents}" Regex "USB(0b05:1996)" } - True { - Define.SPDIFIndex "2" - Define.Mic1Name "Front Microphone" - - SectionDevice."Mic2" { - # On ASUS ROG Maximus XIII and others, back microphone - Comment "Microphone" - Value { - CapturePriority 300 - CapturePCM "hw:${CardId}" - JackControl "Mic - Input Jack" - CaptureMixerElem "Mic" - } - } + True.Define { + SpdifPCM "hw:${CardId},2" + Mic1Name "Front Microphone" + Mic2Name "Microphone" + Mic2Mixer "Analog In" + Mic2Jack "Analog In - Input Jack" + Mic2PCM "hw:${CardId}" } } +SectionVerb { + EnableSequence [ + disdevall "" + ] + + Value.TQ "HiFi" +} + SectionDevice."Speaker" { Comment "Speakers" + + EnableSequence [ + cset "name='${var:SpeakerMixer} Playback Switch' on" + ] + + DisableSequence [ + cset "name='${var:SpeakerMixer} Playback Switch' off" + ] + Value { PlaybackChannels 2 PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - JackControl "Speaker - Output Jack" - PlaybackMixerElem "Speaker" + PlaybackPCM "${var:SpeakerPCM}" + JackControl "${var:SpeakerJack}" + PlaybackMixerElem "${var:SpeakerMixer}" } + Variant."HiFi 5+1".Value.PlaybackChannels 6 Variant."HiFi 7+1".Value.PlaybackChannels 8 } SectionDevice."Headphones" { - Comment "Front Headphones" + Comment "${var:HeadphonesName}" + + EnableSequence [ + cset "name='${var:HeadphonesMixer} Playback Switch' on" + ] + + DisableSequence [ + cset "name='${var:HeadphonesMixer} Playback Switch' off" + ] + Value { PlaybackPriority 300 - PlaybackPCM "hw:${CardId},1" - JackControl "Headphone - Output Jack" - PlaybackMixerElem "Front Headphone" + PlaybackPCM "${var:HeadphonesPCM}" + JackControl "${var:HeadphonesJack}" + PlaybackMixerElem "${var:HeadphonesMixer}" } } -SectionDevice."SPDIF" { - Comment "S/PDIF Out" - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId},${var:SPDIFIndex}" - PlaybackMixerElem "IEC958" +If.spdif { + Condition { + Type String + Empty "${var:SpdifName}" + } + False.SectionDevice."SPDIF" { + Comment "${var:SpdifName}" + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${var:SpdifPCM}" + } } } -SectionDevice."Line" { - EnableSequence [ - cset "name='Line Capture Switch' on" - ] +If.line1 { + Condition { + Type String + Empty "${var:Line1Name}" + } + False.SectionDevice."Line1" { + Comment "${var:Line1Name}" - Comment "Line In" - Value { - CapturePriority 100 - CapturePCM "hw:${CardId},1" - JackControl "Line - Input Jack" - CaptureMixerElem "Line" + EnableSequence [ + cset "name='${var:Line1Mixer} Capture Switch' on" + ] + + DisableSequence [ + cset "name='${var:Line1Mixer} Capture Switch' off" + ] + + Value { + CapturePriority 100 + CapturePCM "${var:Line1PCM}" + JackControl "${var:Line1Jack}" + CaptureMixerElem "${var:Line1Mixer}" + } } } -SectionDevice."Mic1" { - EnableSequence [ - cset "name='Mic Capture Switch' on" - ] +If.mic1 { + Condition { + Type String + Empty "${var:Mic1Name}" + } + False.SectionDevice."Mic1" { + Comment "${var:Mic1Name}" - Comment "${var:Mic1Name}" - Value { - CapturePriority 200 - CapturePCM "hw:${CardId},2" - JackControl "Mic - Input Jack" - CaptureMixerElem "Mic" + EnableSequence [ + cset "name='${var:Mic1Mixer} Capture Switch' on" + ] + + DisableSequence [ + cset "name='${var:Mic1Mixer} Capture Switch' off" + ] + + Value { + CapturePriority 300 + CapturePCM "${var:Mic1PCM}" + JackControl "${var:Mic1Jack}" + CaptureMixerElem "${var:Mic1Mixer}" + } + } +} + +If.mic2 { + Condition { + Type String + Empty "${var:Mic2Name}" + } + False.SectionDevice."Mic2" { + Comment "${var:Mic2Name}" + + EnableSequence [ + cset "name='${var:Mic2Mixer} Capture Switch' on" + ] + + DisableSequence [ + cset "name='${var:Mic2Mixer} Capture Switch' off" + ] + + Value { + CapturePriority 400 + CapturePCM "hw:${CardId}" + JackControl "${var:Mic2Jack}" + CaptureMixerElem "${var:Mic2Mixer}" + } } } -- 2.47.1