Some checks are pending
Validate UCM configuration / ucm_validate (push) Waiting to run
Use boost volume controls to detect this case. Link: https://github.com/alsa-project/alsa-ucm-conf/pull/792 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
262 lines
6 KiB
Text
262 lines
6 KiB
Text
# Generic handling of analog microphones on HDA devices
|
|
|
|
# Microphone related variables on entry
|
|
# MicType == "hda" # HDA microphone
|
|
# MicType != "hda" # other microphone type (AMD 'acp', Intel 'sof-dsp')
|
|
|
|
# Microphone related variables as used internally
|
|
# HDA codecs can offer input source selection (mux) via "Input Source" or
|
|
# "Capture Source" with varying options '[PREFIX ]Mic' where PREFIX is
|
|
# <Empty>,Internal,Headset,Headphone.
|
|
#
|
|
# or there can be 'Mic' and optional 'Front Mic' available
|
|
#
|
|
# There is also third variant - driver supports auto-switching. In
|
|
# this case, the '[Prefix ]Mic Boost Volume' controls exists. There are also
|
|
# phantom jacks exported by the driver in this case, but it's not
|
|
# necessary to use them. Prefixes: <Empty>,Internal,Front
|
|
#
|
|
# This leads to up to maximum of four possible input devices.
|
|
|
|
Define.SourceControl ""
|
|
Define.MicExtraPriority 0
|
|
Define.MicJackControl ""
|
|
Define.MicHPJackControl ""
|
|
Define.MicHSJackControl ""
|
|
|
|
# evaluate the microphone jack name
|
|
If.micjack {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "iface=CARD,name='Mic Jack'"
|
|
}
|
|
True.Define.MicJackControl "Mic Jack"
|
|
}
|
|
|
|
If.hsjack {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "iface=CARD,name='Headset Mic Jack'"
|
|
}
|
|
True.Define.MicHSJackControl "Headset Mic Jack"
|
|
}
|
|
|
|
If.hpjack {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "iface=CARD,name='Headphone Mic Jack'"
|
|
}
|
|
True.Define.MicHPJackControl "Headphone Mic Jack"
|
|
}
|
|
|
|
If.jacksel1 {
|
|
Condition {
|
|
Type String
|
|
Empty "${var:MicJackControl}"
|
|
}
|
|
True.Define.MicJackControl "${var:MicHPJackControl}"
|
|
}
|
|
|
|
If.jacksel2 {
|
|
Condition {
|
|
Type String
|
|
Empty "${var:MicJackControl}"
|
|
}
|
|
True.Define.MicJackControl "${var:MicHSJackControl}"
|
|
}
|
|
|
|
If.jacksel3 {
|
|
Condition {
|
|
Type String
|
|
Empty "${var:MicHPJackControl}"
|
|
}
|
|
True.Define.MicHPJackControl "${var:MicJackControl}"
|
|
}
|
|
|
|
If.jacksel4 {
|
|
Condition {
|
|
Type String
|
|
Empty "${var:MicHSJackControl}"
|
|
}
|
|
True.Define.MicHSJackControl "${var:MicJackControl}"
|
|
}
|
|
|
|
# determine the name of the source selection enum, if present
|
|
If.inputsourcectl {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "name='Input Source'"
|
|
}
|
|
True.Define.SourceControl "Input Source"
|
|
False.If.capturesourcectl {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "name='Capture Source'"
|
|
}
|
|
True.Define.SourceControl "Capture Source"
|
|
}
|
|
}
|
|
|
|
# Extra priority for systems with DMIC presence (MicType != 'hda')
|
|
If.micdevs {
|
|
Condition {
|
|
Type String
|
|
String1 "${var:MicType}"
|
|
String2 "hda"
|
|
}
|
|
False.Define.MicExtraPriority 100
|
|
}
|
|
|
|
# Macro HDAMicEnum - Create the SectionDevice for HDA inputs
|
|
#
|
|
# Arguments:
|
|
# DevName - Name of the device (used as SectionDevice."${var:__DevName}"
|
|
# Enum - Name of the source/input enum
|
|
# Comment - Long name of the SectionDevice
|
|
# Jack - Jack control if available
|
|
# Priority - CapturePriority
|
|
DefineMacro.HDAMicEnum.SectionDevice."${var:__DevName}" {
|
|
Comment "${var:__Comment}"
|
|
|
|
EnableSequence [
|
|
cset "name='${var:SourceControl}' '${var:__Enum}'"
|
|
]
|
|
|
|
Value {
|
|
CapturePriority "${eval:($__Priority+$MicExtraPriority)}"
|
|
CapturePCM "hw:${CardId}"
|
|
CaptureMixerElem "Capture"
|
|
CaptureVolume "Capture Volume"
|
|
CaptureSwitch "Capture Switch"
|
|
CaptureMasterElem "${var:__Enum} Boost"
|
|
}
|
|
If.jack {
|
|
Condition {
|
|
Type String
|
|
Empty "${var:-__Jack}"
|
|
}
|
|
False.Value.JackControl "${var:__Jack}"
|
|
}
|
|
|
|
ConflictingDevice [
|
|
"Mic:hda-int"
|
|
"Mic:hda-hp"
|
|
"Mic:hda"
|
|
"Headset:hda-mic"
|
|
]
|
|
}
|
|
|
|
# Macro HDAMicSwitch - Create the SectionDevice for HDA inputs (switches)
|
|
#
|
|
# Arguments:
|
|
# DevName - Name of the device (used as SectionDevice."${var:__DevName}"
|
|
# Name - Name of the controls
|
|
# Comment - Long name of the SectionDevice
|
|
# Jack - Jack control if available
|
|
# Priority - CapturePriority
|
|
DefineMacro.HDAMicSwitch.SectionDevice."${var:__DevName}" {
|
|
Comment "${var:__Comment}"
|
|
|
|
Value {
|
|
CapturePriority "${eval:($__Priority+$MicExtraPriority)}"
|
|
CapturePCM "hw:${CardId}"
|
|
CaptureMixerElem "${var:__Name}"
|
|
CaptureVolume "${var:__Name} Volume"
|
|
CaptureSwitch "${var:__Name} Switch"
|
|
CaptureMasterElem "${var:__Name} Boost"
|
|
JackControl "${var:-__Jack}"
|
|
}
|
|
}
|
|
|
|
If.micsetup {
|
|
Condition {
|
|
Type String
|
|
Empty "${var:SourceControl}"
|
|
}
|
|
False {
|
|
# the input selection is via ENUM, the possible types are
|
|
# Internal, Headset, Headphone and just 'Mic'
|
|
Macro.in.HDAMicEnum {
|
|
DevName "Mic:hda-int"
|
|
Comment "Internal Stereo Microphone"
|
|
Enum "Internal Mic"
|
|
Priority 100
|
|
}
|
|
Macro.hp.HDAMicEnum {
|
|
DevName "Mic:hda-hp"
|
|
Comment "Headphones Stereo Microphone"
|
|
Enum "Headphone Mic"
|
|
Priority 200
|
|
Jack "${var:MicHPJackControl}"
|
|
}
|
|
Macro.mi.HDAMicEnum {
|
|
DevName "Mic:hda"
|
|
Comment "Stereo Microphone"
|
|
Enum "Mic"
|
|
Priority 300
|
|
Jack "${var:MicJackControl}"
|
|
}
|
|
Macro.hs.HDAMicEnum {
|
|
DevName "Headset:hda-mic"
|
|
Comment "Headset Mono Microphone"
|
|
Enum "Headset Mic"
|
|
Priority 400
|
|
Jack "${var:MicHSJackControl}"
|
|
}
|
|
}
|
|
True.If.autoswitch {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "name='Internal Mic Boost Volume'"
|
|
}
|
|
False {
|
|
# the input selection is via switches, the possible types are
|
|
# Mic and Front Mic
|
|
Macro.mic.HDAMicSwitch {
|
|
DevName "Mic:hda"
|
|
Comment "Stereo Microphone"
|
|
Name "Mic"
|
|
Priority 100
|
|
Jack "${var:MicJackControl}"
|
|
}
|
|
If.fmic {
|
|
Condition {
|
|
Type ControlExists
|
|
Control "name='Front Mic Playback Switch'"
|
|
}
|
|
True.Macro.fmic.HDAMicSwitch {
|
|
DevName "Mic:hda-front"
|
|
Comment "Front Stereo Microphone"
|
|
Name "Front Mic"
|
|
Priority 200
|
|
Jack "Front Mic Jack"
|
|
}
|
|
}
|
|
}
|
|
True {
|
|
# third variant - the driver does auto-switching
|
|
# note that we should assign right Jack controls to
|
|
# allow expose the boost volume
|
|
Macro.mic.HDAMicSwitch {
|
|
DevName "Mic:hda-int"
|
|
Comment "Internal Stereo Microphone"
|
|
Name "Internal Mic"
|
|
Priority 100
|
|
}
|
|
If.mic {
|
|
# external microphone
|
|
Condition {
|
|
Type ControlExists
|
|
Control "name='Mic Boost Volume'"
|
|
}
|
|
True.Macro.mic.HDAMicSwitch {
|
|
DevName "Mic:hda"
|
|
Comment "Stereo Microphone"
|
|
Name "Mic"
|
|
Priority 200
|
|
Jack "${var:MicJackControl}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|