From 09bc9c70690b4bbce77f773b9f051b069f4f2fd9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 5 Nov 2019 20:09:21 +0100 Subject: [PATCH] sof-hda-dsp: adapt to latest alsa-lib - move to ucm2 - add 'Syntax 2' to the main configuration files - use condition for 'Headphone Jack' / 'Headphone Mic Jack' selection - remove cdev (not required) - use ${CardId} where appropriate - merge config for Lenovo Carbon X1 7th gen to main HiFi.conf Signed-off-by: Jaroslav Kysela --- .../HiFi.conf | 28 ---- ...000VMC-ThinkPadX1Carbon7th-20QE000VMC.conf | 14 -- ucm/sof-hda-dsp/HiFi.conf | 107 -------------- {ucm => ucm2}/sof-hda-dsp/Hdmi.conf | 12 +- ucm2/sof-hda-dsp/HiFi.conf | 132 ++++++++++++++++++ {ucm => ucm2}/sof-hda-dsp/sof-hda-dsp.conf | 7 +- 6 files changed, 137 insertions(+), 163 deletions(-) delete mode 100644 ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/HiFi.conf delete mode 100644 ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC.conf delete mode 100644 ucm/sof-hda-dsp/HiFi.conf rename {ucm => ucm2}/sof-hda-dsp/Hdmi.conf (78%) create mode 100644 ucm2/sof-hda-dsp/HiFi.conf rename {ucm => ucm2}/sof-hda-dsp/sof-hda-dsp.conf (67%) diff --git a/ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/HiFi.conf b/ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/HiFi.conf deleted file mode 100644 index ff86641..0000000 --- a/ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/HiFi.conf +++ /dev/null @@ -1,28 +0,0 @@ -# Use case Configuration for ThinkPad X1 Carbon 7th - - - -SectionDevice."BassSpeaker" { - Comment "Bass Speaker" - - EnableSequence [ - cdev "hw:sofhdadsp" - cset "name='Bass Speaker Playback Switch' on" - cset "name='Speaker Playback Switch' on" - cset "name='Speaker Playback Volume' 80" - ] - - DisableSequence [ - cdev "hw:sofhdadsp" - cset "name='Speaker Playback Switch' off" - cset "name='Bass Speaker Playback Switch' off" - ] - - Value { - PlaybackPCM "hw:sofhdadsp,0" - PlaybackChannels "2" - } -} - -# override JackHWMute -SectionDevice."Headphone".!JackHWMute "Speaker BassSpeaker" diff --git a/ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC.conf b/ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC.conf deleted file mode 100644 index 0e159d4..0000000 --- a/ucm/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC.conf +++ /dev/null @@ -1,14 +0,0 @@ -SectionUseCase."HiFi" { - File "../LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/HiFi.conf" - Comment "Play HiFi quality Music" -} - -SectionUseCase."Hdmi" { - File "../sof-hda-dsp/Hdmi.conf" - Comment "Play to HDMI/DP" -} - -ValueDefaults { - PlaybackCTL "hw:sofhdadsp" - CaptureCTL "hw:sofhdadsp" -} diff --git a/ucm/sof-hda-dsp/HiFi.conf b/ucm/sof-hda-dsp/HiFi.conf deleted file mode 100644 index f104354..0000000 --- a/ucm/sof-hda-dsp/HiFi.conf +++ /dev/null @@ -1,107 +0,0 @@ -# Use case Configuration for sof-hda-dsp - -SectionVerb { - EnableSequence [ - cdev "hw:sofhdadsp" - cset "name='Master Playback Switch' on" - cset "name='Capture Switch' on" - ] - - DisableSequence [ - cdev "hw:sofhdadsp" - ] -} - -SectionDevice."Headphone" { - Comment "Headphone" - - EnableSequence [ - cdev "hw:sofhdadsp" - cset "name='Headphone Playback Switch' on" - ] - - DisableSequence [ - cdev "hw:sofhdadsp" - cset "name='Headphone Playback Switch' off" - ] - - Value { - PlaybackPCM "hw:sofhdadsp,0" - PlaybackVolume "name='Headphone'" - PlaybackSwitch "name='Headphone Playback Switch'" - PlaybackChannels "2" - JackName "sof-hda-dsp Headphone" - JackType "gpio" - JackSwitch "12" - JackControl "Headphone Jack" - JackHWMute "Speaker" - } -} - -SectionDevice."Speaker" { - Comment "Speaker" - - EnableSequence [ - cdev "hw:sofhdadsp" - cset "name='Speaker Playback Switch' on" - ] - - DisableSequence [ - cdev "hw:sofhdadsp" - cset "name='Speaker Playback Switch' off" - ] - - Value { - PlaybackPCM "hw:sofhdadsp,0" - PlaybackVolume "name='Speaker'" - PlaybackSwitch "name='Speaker Playback Switch'" - PlaybackChannels "2" - } -} - -SectionDevice."HeadsetMic" { - Comment "Headset Microphone" - - ConflictingDevice [ - "DigitalMic" - ] - - EnableSequence [ - cdev "hw:sofhdadsp" - ] - - DisableSequence [ - cdev "hw:sofhdadsp" - ] - - Value { - CapturePCM "hw:sofhdadsp,0" - CaptureVolume "name='Capture'" - CaptureSwitch "name='Capture Switch'" - CaptureChannels "2" - JackControl "Mic Jack" - } -} - -SectionDevice."DigitalMic" { - Comment "Digital Microphone" - - ConflictingDevice [ - "HeadsetMic" - ] - - EnableSequence [ - cdev "hw:sofhdadsp" - ] - - DisableSequence [ - cdev "hw:sofhdadsp" - ] - - Value { - CapturePCM "hw:sofhdadsp,6" - CaptureVolume "name='Dmic0 Capture Volume'" - CaptureSwitch "name='Dmic0 Capture Switch'" - CaptureChannels "2" - } -} diff --git a/ucm/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf similarity index 78% rename from ucm/sof-hda-dsp/Hdmi.conf rename to ucm2/sof-hda-dsp/Hdmi.conf index 4605feb..a559bc6 100644 --- a/ucm/sof-hda-dsp/Hdmi.conf +++ b/ucm2/sof-hda-dsp/Hdmi.conf @@ -4,17 +4,15 @@ SectionDevice."HDMI1" { Comment "HDMI1/DP1 Output" EnableSequence [ - cdev "hw:sofhdadsp" cset "name='IEC958 Playback Switch' on" ] DisableSequence [ - cdev "hw:sofhdadsp" cset "name='IEC958 Playback Switch' off" ] Value { - PlaybackPCM "hw:sofhdadsp,3" + PlaybackPCM "hw:${CardId},3" PlaybackChannels "2" JackControl "HDMI/DP,pcm=3 Jack" } @@ -24,17 +22,15 @@ SectionDevice."HDMI2" { Comment "HDMI2/DP2 Output" EnableSequence [ - cdev "hw:sofhdadsp" cset "name='IEC958 Playback Switch',index=1 on" ] DisableSequence [ - cdev "hw:sofhdadsp" cset "name='IEC958 Playback Switch',index=1 off" ] Value { - PlaybackPCM "hw:sofhdadsp,4" + PlaybackPCM "hw:${CardId},4" PlaybackChannels "2" JackControl "HDMI/DP,pcm=4 Jack" } @@ -44,17 +40,15 @@ SectionDevice."HDMI3" { Comment "HDMI3/DP3 Output" EnableSequence [ - cdev "hw:sofhdadsp" cset "name='IEC958 Playback Switch',index=2 on" ] DisableSequence [ - cdev "hw:sofhdadsp" cset "name='IEC958 Playback Switch',index=2 off" ] Value { - PlaybackPCM "hw:sofhdadsp,5" + PlaybackPCM "hw:${CardId},5" PlaybackChannels "2" JackControl "HDMI/DP,pcm=5 Jack" } diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf new file mode 100644 index 0000000..5fbdd37 --- /dev/null +++ b/ucm2/sof-hda-dsp/HiFi.conf @@ -0,0 +1,132 @@ +# Use case Configuration for sof-hda-dsp + +SectionVerb { + EnableSequence [ + cset "name='Master Playback Switch' on" + cset "name='Capture Switch' on" + ] +} + +SectionDevice."Headphone" { + Comment "Headphone" + + EnableSequence [ + cset "name='Headphone Playback Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + + Value { + PlaybackPCM "hw:${CardId},0" + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + PlaybackChannels "2" + JackName "SOF HDA DSP Headphone" + JackType "gpio" + JackSwitch "12" + If.1 { + Condition { + Type ControlExists + Control "name='Bass Speaker Playback Switch'" + } + True { + JackHWMute "Speaker BassSpeaker" + } + False { + JackHWMute "Speaker" + } + } + If.2 { + Condition { + Type ControlExists + Control "iface=CARD,name='Headphone Mic Jack'" + } + True { + JackControl "Headphone Mic Jack" + } + False { + JackControl "Headphone Jack" + } + } + } +} + +SectionDevice."Speaker" { + Comment "Speaker" + + EnableSequence [ + cset "name='Speaker Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Playback Switch' off" + ] + + Value { + PlaybackPCM "hw:${CardId},0" + PlaybackVolume "Speaker Playback Volume" + PlaybackSwitch "Speaker Playback Switch" + PlaybackChannels "2" + } +} + +If.1 { + Condition { + Type ControlExists + Control "name='Bass Speaker Playback Switch'" + } + True { + SectionDevice."BassSpeaker" { + Comment "Bass Speaker" + + EnableSequence [ + cset "name='Bass Speaker Playback Switch' on" + cset "name='Speaker Playback Switch' on" + cset "name='Speaker Playback Volume' 80" + ] + + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Bass Speaker Playback Switch' off" + ] + + Value { + PlaybackPCM "hw:${CardId},0" + PlaybackChannels "2" + } + } + } +} + +SectionDevice."HeadsetMic" { + Comment "Headset Microphone" + + ConflictingDevice [ + "DigitalMic" + ] + + Value { + CapturePCM "hw:${CardId},0" + CaptureVolume "Capture Volume" + CaptureSwitch "Capture Switch" + CaptureChannels "2" + JackControl "Mic Jack" + } +} + +SectionDevice."DigitalMic" { + Comment "Digital Microphone" + + ConflictingDevice [ + "HeadsetMic" + ] + + Value { + CapturePCM "hw:${CardId},6" + CaptureVolume "Dmic0 Capture Volume" + CaptureSwitch "Dmic0 Capture Switch" + CaptureChannels "2" + } +} diff --git a/ucm/sof-hda-dsp/sof-hda-dsp.conf b/ucm2/sof-hda-dsp/sof-hda-dsp.conf similarity index 67% rename from ucm/sof-hda-dsp/sof-hda-dsp.conf rename to ucm2/sof-hda-dsp/sof-hda-dsp.conf index add60cc..c67d6e2 100644 --- a/ucm/sof-hda-dsp/sof-hda-dsp.conf +++ b/ucm2/sof-hda-dsp/sof-hda-dsp.conf @@ -1,3 +1,5 @@ +Syntax 2 + SectionUseCase."HiFi" { File "HiFi.conf" Comment "Play HiFi quality Music" @@ -7,8 +9,3 @@ SectionUseCase."Hdmi" { File "Hdmi.conf" Comment "Play to HDMI/DP" } - -ValueDefaults { - PlaybackCTL "hw:sofhdadsp" - CaptureCTL "hw:sofhdadsp" -} -- 2.47.1