ALSA: hda: mic: add initial support for driver source auto-switching
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>
This commit is contained in:
Jaroslav Kysela 2026-07-01 16:41:23 +02:00
commit c17dfb63ae

View file

@ -6,14 +6,16 @@
# Microphone related variables as used internally # Microphone related variables as used internally
# HDA codecs can offer input source selection (mux) via "Input Source" or # HDA codecs can offer input source selection (mux) via "Input Source" or
# "Capture Source" with varying options: # "Capture Source" with varying options '[PREFIX ]Mic' where PREFIX is
# 'Internal Mic' # <Empty>,Internal,Headset,Headphone.
# 'Headset Mic'
# 'Headphone Mic'
# 'Mic'
# #
# or there can be 'Mic' and optional 'Front Mic' available # 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. # This leads to up to maximum of four possible input devices.
Define.SourceControl "" Define.SourceControl ""
@ -162,7 +164,7 @@ DefineMacro.HDAMicSwitch.SectionDevice."${var:__DevName}" {
CaptureVolume "${var:__Name} Volume" CaptureVolume "${var:__Name} Volume"
CaptureSwitch "${var:__Name} Switch" CaptureSwitch "${var:__Name} Switch"
CaptureMasterElem "${var:__Name} Boost" CaptureMasterElem "${var:__Name} Boost"
JackControl "${var:__Jack}" JackControl "${var:-__Jack}"
} }
} }
@ -202,27 +204,58 @@ If.micsetup {
Jack "${var:MicHSJackControl}" Jack "${var:MicHSJackControl}"
} }
} }
True { True.If.autoswitch {
# the input selection is via switches, the possible types are Condition {
# Mic and Front Mic Type ControlExists
Macro.mic.HDAMicSwitch { Control "name='Internal Mic Boost Volume'"
DevName "Mic:hda"
Comment "Stereo Microphone"
Name "Mic"
Priority 100
Jack "${var:MicJackControl}"
} }
If.fmic { False {
Condition { # the input selection is via switches, the possible types are
Type ControlExists # Mic and Front Mic
Control "name='Front Mic Playback Switch'" Macro.mic.HDAMicSwitch {
DevName "Mic:hda"
Comment "Stereo Microphone"
Name "Mic"
Priority 100
Jack "${var:MicJackControl}"
} }
True.Macro.fmic.HDAMicSwitch { If.fmic {
DevName "Mic:hda-front" Condition {
Comment "Front Stereo Microphone" Type ControlExists
Name "Front Mic" Control "name='Front Mic Playback Switch'"
Priority 200 }
Jack "Front Mic Jack" 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}"
}
} }
} }
} }