From dcef48f13d4f5db79b006755074940b94730a883 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 24 Jun 2020 13:39:07 +0200 Subject: HDA-Intel: add support for AMD acp microphone devices - move the generic HDA code from sof-hda-dsp to HDA-Intel - add generic codecs/hda/hdmi.conf Signed-off-by: Jaroslav Kysela --- ucm2/HDA-Intel/HDA-Capture-value.conf | 4 + ucm2/HDA-Intel/HDA-Intel.conf | 28 +++++++ ucm2/HDA-Intel/Hdmi.conf | 37 +++++++++ ucm2/HDA-Intel/HiFi-acp.conf | 8 ++ ucm2/HDA-Intel/HiFi-analog.conf | 133 +++++++++++++++++++++++++++++++ ucm2/HDA-Intel/HiFi.conf | 32 ++++++++ ucm2/HDA-Intel/init.conf | 39 +++++++++ ucm2/codecs/hda/hdmi.conf | 25 ++++++ ucm2/module/lib/linked.conf | 3 + ucm2/module/snd_acp3x_rn.conf | 1 + ucm2/sof-hda-dsp/HDA-Capture-value.conf | 4 - ucm2/sof-hda-dsp/Hdmi.conf | 78 +++++------------- ucm2/sof-hda-dsp/HiFi.conf | 135 +------------------------------- 13 files changed, 331 insertions(+), 196 deletions(-) create mode 100644 ucm2/HDA-Intel/HDA-Capture-value.conf create mode 100644 ucm2/HDA-Intel/HDA-Intel.conf create mode 100644 ucm2/HDA-Intel/Hdmi.conf create mode 100644 ucm2/HDA-Intel/HiFi-acp.conf create mode 100644 ucm2/HDA-Intel/HiFi-analog.conf create mode 100644 ucm2/HDA-Intel/HiFi.conf create mode 100644 ucm2/HDA-Intel/init.conf create mode 100644 ucm2/codecs/hda/hdmi.conf create mode 100644 ucm2/module/lib/linked.conf create mode 120000 ucm2/module/snd_acp3x_rn.conf delete mode 100644 ucm2/sof-hda-dsp/HDA-Capture-value.conf diff --git a/ucm2/HDA-Intel/HDA-Capture-value.conf b/ucm2/HDA-Intel/HDA-Capture-value.conf new file mode 100644 index 0000000..2f1316a --- /dev/null +++ b/ucm2/HDA-Intel/HDA-Capture-value.conf @@ -0,0 +1,4 @@ +CapturePCM "hw:${CardId}" +CaptureMixerElem "Capture" +CaptureVolume "Capture Volume" +CaptureSwitch "Capture Switch" diff --git a/ucm2/HDA-Intel/HDA-Intel.conf b/ucm2/HDA-Intel/HDA-Intel.conf new file mode 100644 index 0000000..109eea6 --- /dev/null +++ b/ucm2/HDA-Intel/HDA-Intel.conf @@ -0,0 +1,28 @@ +Syntax 3 + +Define.Use "" # a non-empty string to use UCM configuration for HDA devices + +Define.AcpCardId "$${CardIdByName:acp}" + +If.acp { + Condition { + Type String + Empty "${var:AcpCardId}" + } + False.Define.Use y +} + +If.use { + Condition { + Type String + Empty "${var:Use}" + } + False { + SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Play HiFi quality Music" + } + + Include.init.File "/HDA-Intel/init.conf" + } +} diff --git a/ucm2/HDA-Intel/Hdmi.conf b/ucm2/HDA-Intel/Hdmi.conf new file mode 100644 index 0000000..8b1843b --- /dev/null +++ b/ucm2/HDA-Intel/Hdmi.conf @@ -0,0 +1,37 @@ +# Use case Configuration for sof-hda-dsp + +If.hdmi1 { + Condition { Type String Empty "" } + True { + Define { + HdmiNum 1 + HdmiPCM 3 + HdmiPrio 500 + } + Include.hdmi1.File "/codecs/hda/hdmi.conf" + } +} + +If.hdmi2 { + Condition { Type String Empty "" } + True { + Define { + HdmiNum 2 + HdmiPCM 7 + HdmiPrio 600 + } + Include.hdmi2.File "/codecs/hda/hdmi.conf" + } +} + +If.hdmi3 { + Condition { Type String Empty "" } + True { + Define { + HdmiNum 3 + HdmiPCM 8 + HdmiPrio 700 + } + Include.hdmi3.File "/codecs/hda/hdmi.conf" + } +} diff --git a/ucm2/HDA-Intel/HiFi-acp.conf b/ucm2/HDA-Intel/HiFi-acp.conf new file mode 100644 index 0000000..123ae15 --- /dev/null +++ b/ucm2/HDA-Intel/HiFi-acp.conf @@ -0,0 +1,8 @@ +SectionDevice."Mic1" { + Comment "Digital Microphone" + + Value { + CapturePriority 100 + CapturePCM "hw:${var:AcpCardId}" + } +} diff --git a/ucm2/HDA-Intel/HiFi-analog.conf b/ucm2/HDA-Intel/HiFi-analog.conf new file mode 100644 index 0000000..1143a67 --- /dev/null +++ b/ucm2/HDA-Intel/HiFi-analog.conf @@ -0,0 +1,133 @@ +# Generic HDA devices for analog I/O + +SectionDevice."Headphones" { + Comment "Headphones" + + If.headphone_switch { + Condition { + Type ControlExists + Control "name='Headphone Playback Switch'" + } + True { + EnableSequence [ + cset "name='Headphone Playback Switch' on" + ] + DisableSequence [ + cset "name='Headphone Playback Switch' off" + ] + } + } + + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Headphone" + PlaybackMasterElem "Master" + PlaybackVolume "Headphone Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + If.jack { + Condition { + Type ControlExists + Control "iface=CARD,name='Headphone Mic Jack'" + } + True { + JackControl "Headphone Mic Jack" + } + False { + JackControl "Headphone Jack" + } + } + } +} + +SectionDevice."Speaker" { + Comment "Speaker" + + If.seq { + Condition { + Type ControlExists + Control "name='Bass Speaker Playback Switch'" + } + True { + EnableSequence [ + cset "name='Speaker Playback Switch' on" + cset "name='Bass Speaker Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Bass Speaker Playback Switch' off" + ] + } + False { + EnableSequence [ + cset "name='Speaker Playback Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Playback Switch' off" + ] + } + } + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "Speaker" + PlaybackMasterElem "Master" + PlaybackVolume "Speaker Playback Volume" + PlaybackSwitch "Speaker Playback Switch" + } +} + +If.monomic { + Condition { + Type ControlExists + Control "name='Input Source'" + ControlEnum "Headphone Mic" + } + True { + SectionDevice."Mic2" { + Comment "Headphones Stereo Microphone" + + ConflictingDevice [ + "Headset" + ] + + EnableSequence [ + cset "name='Input Source' 'Headphone Mic'" + ] + + Value { + CapturePriority 200 + Include.value.File "/HDA-Intel/HDA-Capture-value.conf" + JackControl "Headphone Mic Jack" + } + } + + SectionDevice."Headset" { + Comment "Headset Mono Microphone" + + EnableSequence [ + cset "name='Input Source' 'Headset Mic'" + ] + + Value { + CapturePriority 300 + Include.value.File "/HDA-Intel/HDA-Capture-value.conf" + JackControl "Headphone Mic Jack" + } + } + } + False { + SectionDevice."Mic2" { + Comment "Headphones Stereo Microphone" + + Value { + CapturePriority 200 + Include.value.File "/HDA-Intel/HDA-Capture-value.conf" + JackControl "Mic Jack" + } + } + } +} diff --git a/ucm2/HDA-Intel/HiFi.conf b/ucm2/HDA-Intel/HiFi.conf new file mode 100644 index 0000000..2d18c9e --- /dev/null +++ b/ucm2/HDA-Intel/HiFi.conf @@ -0,0 +1,32 @@ +# Use case Configuration for sof-hda-dsp + +SectionVerb { + Value.TQ "HiFi" +} + +If.analog { + Condition { + Type ControlExists + Control "name='Master Playback Switch'" + } + True.Include.analog.File "/HDA-Intel/HiFi-analog.conf" +} + +If.hdmi { + Condition { Type String Empty "" } + True.Include.hdmi.File "/HDA-Intel/Hdmi.conf" +} + +If.acp { + Condition { + Type String + Empty "${var:AcpCardId}" + } + True { + RenameDevice."Mic1" "Mic" + } + False.Include.acp { + Before.SectionDevice "Mic1" + File "/HDA-Intel/HiFi-acp.conf" + } +} diff --git a/ucm2/HDA-Intel/init.conf b/ucm2/HDA-Intel/init.conf new file mode 100644 index 0000000..1a351a9 --- /dev/null +++ b/ucm2/HDA-Intel/init.conf @@ -0,0 +1,39 @@ +If.amute { + Condition { + Type ControlExists + Control "name='Auto-Mute Mode'" + } + True.BootSequence [ + cset "name='Auto-Mute Mode' off" + ] +} + +If.master { + Condition { + Type ControlExists + Control "name='Master Playback Volume'" + } + True.BootSequence [ + cset "name='Master Playback Volume' 60%" + ] +} + +If.speaker { + Condition { + Type ControlExists + Control "name='Speaker Playback Volume'" + } + True.BootSequence [ + cset "name='Speaker Playback Volume' 60%" + ] +} + +If.headphone { + Condition { + Type ControlExists + Control "name='Headphone Playback Volume'" + } + True.BootSequence [ + cset "name='Headphone Playback Volume' 60%" + ] +} diff --git a/ucm2/codecs/hda/hdmi.conf b/ucm2/codecs/hda/hdmi.conf new file mode 100644 index 0000000..c22f615 --- /dev/null +++ b/ucm2/codecs/hda/hdmi.conf @@ -0,0 +1,25 @@ +If.hdmi { + Condition { + Type ControlExists + Control "iface=CARD,name='HDMI/DP,pcm=${var:HdmiPCM} Jack'" + } + True { + SectionDevice."HDMI${var:HdmiNum}" { + Comment "HDMI${var:HdmiNum}/${var:HdmiNum} Output" + + EnableSequence [ + cset "name='IEC958 Playback Switch' on" + ] + + DisableSequence [ + cset "name='IEC958 Playback Switch' off" + ] + + Value { + PlaybackPriority "${var:HdmiPrio}" + PlaybackPCM "hw:${CardId},${var:HdmiPCM}" + JackControl "HDMI/DP,pcm=${var:HdmiPCM} Jack" + } + } + } +} diff --git a/ucm2/module/lib/linked.conf b/ucm2/module/lib/linked.conf new file mode 100644 index 0000000..d7656a8 --- /dev/null +++ b/ucm2/module/lib/linked.conf @@ -0,0 +1,3 @@ +ValueDefaults { + Linked 1 +} diff --git a/ucm2/module/snd_acp3x_rn.conf b/ucm2/module/snd_acp3x_rn.conf new file mode 120000 index 0000000..b56794a --- /dev/null +++ b/ucm2/module/snd_acp3x_rn.conf @@ -0,0 +1 @@ +lib/linked.conf \ No newline at end of file diff --git a/ucm2/sof-hda-dsp/HDA-Capture-value.conf b/ucm2/sof-hda-dsp/HDA-Capture-value.conf deleted file mode 100644 index 2f1316a..0000000 --- a/ucm2/sof-hda-dsp/HDA-Capture-value.conf +++ /dev/null @@ -1,4 +0,0 @@ -CapturePCM "hw:${CardId}" -CaptureMixerElem "Capture" -CaptureVolume "Capture Volume" -CaptureSwitch "Capture Switch" diff --git a/ucm2/sof-hda-dsp/Hdmi.conf b/ucm2/sof-hda-dsp/Hdmi.conf index 6f2c4aa..480e2d6 100644 --- a/ucm2/sof-hda-dsp/Hdmi.conf +++ b/ucm2/sof-hda-dsp/Hdmi.conf @@ -1,79 +1,37 @@ # Use case Configuration for sof-hda-dsp If.hdmi1 { - Condition { - Type ControlExists - Control "iface=CARD,name='HDMI/DP,pcm=3 Jack'" - } + Condition { Type String Empty "" } True { - SectionDevice."HDMI1" { - Comment "HDMI1/DP1 Output" - - EnableSequence [ - cset "name='IEC958 Playback Switch' on" - ] - - DisableSequence [ - cset "name='IEC958 Playback Switch' off" - ] - - Value { - PlaybackPriority 500 - PlaybackPCM "hw:${CardId},3" - JackControl "HDMI/DP,pcm=3 Jack" - } + Define { + HdmiNum 1 + HdmiPCM 3 + HdmiPrio 500 } + Include.hdmi1.File "/codec/hda/hdmi.conf" } } If.hdmi2 { - Condition { - Type ControlExists - Control "iface=CARD,name='HDMI/DP,pcm=4 Jack'" - } + Condition { Type String Empty "" } True { - SectionDevice."HDMI2" { - Comment "HDMI2/DP2 Output" - - EnableSequence [ - cset "name='IEC958 Playback Switch',index=1 on" - ] - - DisableSequence [ - cset "name='IEC958 Playback Switch',index=1 off" - ] - - Value { - PlaybackPriority 600 - PlaybackPCM "hw:${CardId},4" - JackControl "HDMI/DP,pcm=4 Jack" - } + Define { + HdmiNum 2 + HdmiPCM 4 + HdmiPrio 600 } + Include.hdmi2.File "/codec/hda/hdmi.conf" } } If.hdmi3 { - Condition { - Type ControlExists - Control "iface=CARD,name='HDMI/DP,pcm=5 Jack'" - } + Condition { Type String Empty "" } True { - SectionDevice."HDMI3" { - Comment "HDMI3/DP3 Output" - - EnableSequence [ - cset "name='IEC958 Playback Switch',index=2 on" - ] - - DisableSequence [ - cset "name='IEC958 Playback Switch',index=2 off" - ] - - Value { - PlaybackPriority 700 - PlaybackPCM "hw:${CardId},5" - JackControl "HDMI/DP,pcm=5 Jack" - } + Define { + HdmiNum 3 + HdmiPCM 5 + HdmiPrio 700 } + Include.hdmi3.File "/codec/hda/hdmi.conf" } } diff --git a/ucm2/sof-hda-dsp/HiFi.conf b/ucm2/sof-hda-dsp/HiFi.conf index 62358e2..0f221b7 100644 --- a/ucm2/sof-hda-dsp/HiFi.conf +++ b/ucm2/sof-hda-dsp/HiFi.conf @@ -4,138 +4,9 @@ SectionVerb { Value.TQ "HiFi" } -SectionDevice."Headphones" { - Comment "Headphones" + - If.headphone_switch { - Condition { - Type ControlExists - Control "name='Headphone Playback Switch'" - } - True { - EnableSequence [ - cset "name='Headphone Playback Switch' on" - ] - DisableSequence [ - cset "name='Headphone Playback Switch' off" - ] - } - } - - Value { - PlaybackPriority 200 - PlaybackPCM "hw:${CardId}" - PlaybackMixerElem "Headphone" - PlaybackMasterElem "Master" - PlaybackVolume "Headphone Playback Volume" - PlaybackSwitch "Headphone Playback Switch" - If.jack { - Condition { - Type ControlExists - Control "iface=CARD,name='Headphone Mic Jack'" - } - True { - JackControl "Headphone Mic Jack" - } - False { - JackControl "Headphone Jack" - } - } - } -} - -SectionDevice."Speaker" { - Comment "Speaker" - - If.seq { - Condition { - Type ControlExists - Control "name='Bass Speaker Playback Switch'" - } - True { - EnableSequence [ - cset "name='Speaker Playback Switch' on" - cset "name='Bass Speaker Playback Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Playback Switch' off" - cset "name='Bass Speaker Playback Switch' off" - ] - } - False { - EnableSequence [ - cset "name='Speaker Playback Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Playback Switch' off" - ] - } - } - - Value { - PlaybackPriority 100 - PlaybackPCM "hw:${CardId}" - PlaybackMixerElem "Speaker" - PlaybackMasterElem "Master" - PlaybackVolume "Speaker Playback Volume" - PlaybackSwitch "Speaker Playback Switch" - } -} - -If.monomic { - Condition { - Type ControlExists - Control "name='Input Source'" - ControlEnum "Headphone Mic" - } - After.SectionDevice "Mic1" - True { - SectionDevice."Mic2" { - Comment "Headphones Stereo Microphone" - - ConflictingDevice [ - "Headset" - ] - - EnableSequence [ - cset "name='Input Source' 'Headphone Mic'" - ] - - Value { - CapturePriority 200 - Include.value.File "HDA-Capture-value.conf" - JackControl "Headphone Mic Jack" - } - } - - SectionDevice."Headset" { - Comment "Headset Mono Microphone" - - EnableSequence [ - cset "name='Input Source' Headset Mic" - ] - - Value { - CapturePriority 300 - Include.value.File "HDA-Capture-value.conf" - JackControl "Headphone Mic Jack" - } - } - } - False { - SectionDevice."Mic2" { - Comment "Headphones Stereo Microphone" - - Value { - CapturePriority 200 - Include.value.File "HDA-Capture-value.conf" - JackControl "Mic Jack" - } - } - } -} +If.monomic.After.SectionDevice "Mic1" SectionDevice."Mic1" { Comment "Digital Microphone" @@ -172,4 +43,4 @@ SectionDevice."Mic1" { } } - + -- cgit v1.2.3