]> git.alsa-project.org Git - alsa-ucm-conf.git/commit
ucm2: HDA: HiFi-analog/mic: Refactor the analog mic discovery
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Mon, 10 Mar 2025 13:46:04 +0000 (15:46 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 21 Mar 2025 17:38:49 +0000 (18:38 +0100)
commit19fc5b90be085ebfe061d01011c433af6cc38c10
treee5acd9a53c56a98ba765cf5a40b2df59e7f9a683
parentb627bf6abe50b8bd84e455c6c0989b34b4b5803d
ucm2: HDA: HiFi-analog/mic: Refactor the analog mic discovery

The current mic device creation works on certain machines and fails on
others. There are several places of conflicts and setups which can only
just fail, but this is mostly not an issue if the user never uses the mic,
only the speaker/headset - which, to be honest is what most of us do ;)

As an example:
The mic selection in most codecs are via enum and it is assumed to be
named 'Input Source', which is not always the case as some device uses
'Capture Source' for the control's name.
There is also different sets of mics that one can select from:
Exhibit A
numid=6,iface=MIXER,name='Input Source'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Headset Mic'
  ; Item #1 'Headphone Mic'
  : values=1

Exhibit B
numid=6,iface=MIXER,name='Capture Source'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Internal Mic'
  ; Item #1 'Headset Mic'
  : values=0

Exhibit C
numid=6,iface=MIXER,name='Capture Source'
  ; type=ENUMERATED,access=rw------,values=1,items=3
  ; Item #0 'Internal Mic'
  ; Item #1 'Headset Mic'
  ; Item #2 'Headphone Mic'
  : values=0

Exhibit D (this pushes the limits... The patch will ignore item 1)
numid=6,iface=MIXER,name='Capture Source'
  ; type=ENUMERATED,access=rw------,values=1,items=3
  ; Item #0 'Internal Mic'
  ; Item #1 'Internal Mic 1'
  ; Item #2 'Mic'
  : values=2

Other issue is that we have this 'Headphone Mic', which turned out to be
a 'Stereo Microphone in Headphone Jack', so if it is selected then the
Headphone cannot work, they conflict, they use the same rings for different
direction and purpose.

This patch aims to make the mic discovery a bit more deterministic and
pragmatic.

But even if the UCM creates the use case profiles correctly, it is still
up to UIs (KDE/GNOME/etc) to misunderstand how UCM presents the profiles,
what they mean and most of all what 'Mic1', `Mic2', etc is.
KDE presents the profiles as they are and user can selct between them to
pick the right combination of output and input.
GNOME goes further with simplification (and fails with it) and presents
'random' Configuration profiles for Output and Input, plus a device
selection and they do work in an interesting way. GNOME also have popup
for specifying the type of the plugged accessory, which does not worl at
all with UCM profiles.

But, this patch is meant for a small step to have clear rules based mic
presentation for HDA.

The expectation is that what have worked will work as it used to and what
did not worked should be detected and presented correctly.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/526
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/HDA/HiFi-analog.conf
ucm2/HDA/HiFi-mic.conf [new file with mode: 0644]