Yeah, I guess it's time. Let me know if you want six emails instead of one.

Over the past few weeks - although there always seems to be something else you have to fix first - I've been working on fixing the long-standing issues with the pulseaudio mixer paths not working correctly on the input side: basically it isn't showing helpful enough names (e g "Microphone 1" and "Microphone 2" instead of "Front Microphone" and "Rear Microphone"), and not always controlling the right sliders underneath.

I have tested it on the stuff I have here and it seems to work well enough. For Ubuntu users, easy testing is here: https://launchpad.net/~diwic/+archive/pulse-mixer

Realtek HDA codecs might need two recent ALSA commits that rename "Mic Boost" to "Mic Boost Volume", and to change an index error that made PA ignore the control. They are both in queue for 2.6.38. I've also made some changes in the kernel to clear up the namespace (i e change some of the more crazy names to standard names) recently that might be interesting.

As for where this is going (master, stable-queue, or /dev/null?) - speaking from Ubuntu's standpoint I'd strongly prefer stable-queue, because I want this in Ubuntu 11.04, which is based on stable-queue. Me being biassed, It'll be up to the rest of you (Colin etc) to make the decision given that there is somewhat of a regression risk, at least for unusual hardware.

// David

>From 729223d4c2c8e56e1e4bf838ee9aa11d36f2d90a Mon Sep 17 00:00:00 2001
From: David Henningsson <david.hennings...@canonical.com>
Date: Mon, 20 Dec 2010 11:13:37 +0100
Subject: [PATCH 1/6] alsa-mixer: Add a few well-known descriptions

Add front mic, rear mic, and docking line-in. These are likely to be
present on modern hda chips, for reference see
linux-2.6/sound/pci/hda/hda_codec.c:hda_get_input_pin_label

Signed-off-by: David Henningsson <david.hennings...@canonical.com>
---
 src/modules/alsa/alsa-mixer.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 1ede8cf..eb50ae2 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1701,8 +1701,11 @@ static int option_verify(pa_alsa_option *o) {
         { "input",                     N_("Input") },
         { "input-docking",             N_("Docking Station Input") },
         { "input-docking-microphone",  N_("Docking Station Microphone") },
+        { "input-docking-linein",      N_("Docking Station Line-In") },
         { "input-linein",              N_("Line-In") },
         { "input-microphone",          N_("Microphone") },
+        { "input-microphone-front",    N_("Front Microphone") },
+        { "input-microphone-rear",     N_("Rear Microphone") },
         { "input-microphone-external", N_("External Microphone") },
         { "input-microphone-internal", N_("Internal Microphone") },
         { "input-radio",               N_("Radio") },
@@ -1776,6 +1779,10 @@ static int path_verify(pa_alsa_path *p) {
     static const struct description_map well_known_descriptions[] = {
         { "analog-input",               N_("Analog Input") },
         { "analog-input-microphone",    N_("Analog Microphone") },
+        { "analog-input-microphone-front",    N_("Front Microphone") },
+        { "analog-input-microphone-rear",     N_("Rear Microphone") },
+        { "analog-input-microphone-dock",     N_("Docking Station Microphone") },
+        { "analog-input-microphone-internal", N_("Internal Microphone") },
         { "analog-input-linein",        N_("Analog Line-In") },
         { "analog-input-radio",         N_("Analog Radio") },
         { "analog-input-video",         N_("Analog Video") },
-- 
1.7.1

>From ae83e51c82a747332494bf10c245281e49343fe3 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.hennings...@canonical.com>
Date: Mon, 20 Dec 2010 12:29:27 +0100
Subject: [PATCH 2/6] alsa-mixer: add required-any and required-* for enum options

Now you can add required-any to elements in a path and the path
will be valid as long as at least one of the elements are present.
Also you can have required, required-any and required-absent in
element options, causing a path to be unsupported if an option is
(not) present (simplified example: to skip line in path if
"Capture source" doesn't have a "Line In" option).

Signed-off-by: David Henningsson <david.hennings...@canonical.com>
---
 src/modules/alsa/alsa-mixer.c                      |   90 +++++++++++++++++---
 src/modules/alsa/alsa-mixer.h                      |    8 ++
 .../alsa/mixer/paths/analog-output.conf.common     |    5 +
 3 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index eb50ae2..2c47319 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1018,6 +1018,38 @@ static int check_required(pa_alsa_element *e, snd_mixer_elem_t *me) {
     if (e->required_absent == PA_ALSA_REQUIRED_ANY && (has_switch || has_volume || has_enumeration))
         return -1;
 
+    if (e->required_any != PA_ALSA_REQUIRED_IGNORE) {
+        switch (e->required_any) {
+        case PA_ALSA_REQUIRED_VOLUME:
+            e->path->req_any_present |= (e->volume_use != PA_ALSA_VOLUME_IGNORE);
+            break;
+        case PA_ALSA_REQUIRED_SWITCH:
+            e->path->req_any_present |= (e->switch_use != PA_ALSA_SWITCH_IGNORE);
+            break;
+        case PA_ALSA_REQUIRED_ENUMERATION:
+            e->path->req_any_present |= (e->enumeration_use != PA_ALSA_ENUMERATION_IGNORE);
+            break;
+        case PA_ALSA_REQUIRED_ANY:
+            e->path->req_any_present |=
+                (e->volume_use != PA_ALSA_VOLUME_IGNORE) ||
+                (e->switch_use != PA_ALSA_SWITCH_IGNORE) ||
+                (e->enumeration_use != PA_ALSA_ENUMERATION_IGNORE);
+            break;
+        }
+    }
+
+    if (e->enumeration_use == PA_ALSA_ENUMERATION_SELECT) {
+        pa_alsa_option *o;
+        PA_LLIST_FOREACH(o, e->options) {
+            e->path->req_any_present |= (o->required_any != PA_ALSA_REQUIRED_IGNORE) &&
+                (o->alsa_idx >= 0);
+            if (o->required != PA_ALSA_REQUIRED_IGNORE && o->alsa_idx < 0)
+                return -1;
+            if (o->required_absent != PA_ALSA_REQUIRED_IGNORE && o->alsa_idx >= 0)
+                return -1;
+        }
+    }
+
     return 0;
 }
 
@@ -1190,9 +1222,6 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
 
     }
 
-    if (check_required(e, me) < 0)
-        return -1;
-
     if (e->switch_use == PA_ALSA_SWITCH_SELECT) {
         pa_alsa_option *o;
 
@@ -1224,6 +1253,9 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) {
         }
     }
 
+    if (check_required(e, me) < 0)
+        return -1;
+
     return 0;
 }
 
@@ -1478,20 +1510,23 @@ static int element_parse_required(
 
     pa_alsa_path *p = userdata;
     pa_alsa_element *e;
+    pa_alsa_option *o;
     pa_alsa_required_t req;
 
     pa_assert(p);
 
-    if (!(e = element_get(p, section, TRUE))) {
+    e = element_get(p, section, TRUE);
+    o = option_get(p, section);
+    if (!e && !o) {
         pa_log("[%s:%u] Required makes no sense in '%s'", filename, line, section);
         return -1;
     }
 
     if (pa_streq(rvalue, "ignore"))
         req = PA_ALSA_REQUIRED_IGNORE;
-    else if (pa_streq(rvalue, "switch"))
+    else if (pa_streq(rvalue, "switch") && e)
         req = PA_ALSA_REQUIRED_SWITCH;
-    else if (pa_streq(rvalue, "volume"))
+    else if (pa_streq(rvalue, "volume") && e)
         req = PA_ALSA_REQUIRED_VOLUME;
     else if (pa_streq(rvalue, "enumeration"))
         req = PA_ALSA_REQUIRED_ENUMERATION;
@@ -1502,10 +1537,28 @@ static int element_parse_required(
         return -1;
     }
 
-    if (pa_streq(lvalue, "required-absent"))
-        e->required_absent = req;
-    else
-        e->required = req;
+    if (pa_streq(lvalue, "required-absent")) {
+        if (e)
+            e->required_absent = req;
+        if (o)
+            o->required_absent = req;
+    }
+    else if (pa_streq(lvalue, "required-any")) {
+        if (e) {
+            e->required_any = req;
+            e->path->has_req_any = TRUE;
+        }
+        if (o) {
+            o->required_any = req;
+            o->element->path->has_req_any = TRUE;
+        }
+    }
+    else {
+        if (e)
+            e->required = req;
+        if (o)
+            o->required = req;
+    }
 
     return 0;
 }
@@ -1757,7 +1810,10 @@ static int element_verify(pa_alsa_element *e) {
 
     pa_assert(e);
 
+//    pa_log_debug("Element %s, path %s: r=%d, r-any=%d, r-abs=%d", e->alsa_name, e->path->name, e->required, e->required_any, e->required_absent);
     if ((e->required != PA_ALSA_REQUIRED_IGNORE && e->required == e->required_absent) ||
+        (e->required_any != PA_ALSA_REQUIRED_IGNORE && e->required_any == e->required_absent) ||
+        (e->required_absent == PA_ALSA_REQUIRED_ANY && e->required_any != PA_ALSA_REQUIRED_IGNORE) ||
         (e->required_absent == PA_ALSA_REQUIRED_ANY && e->required != PA_ALSA_REQUIRED_IGNORE)) {
         pa_log("Element %s cannot be required and absent at the same time.", e->alsa_name);
         return -1;
@@ -1836,6 +1892,7 @@ pa_alsa_path* pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction)
         { "override-map.2",      element_parse_override_map,        NULL, NULL },
         /* ... later on we might add override-map.3 and so on here ... */
         { "required",            element_parse_required,            NULL, NULL },
+        { "required-any",        element_parse_required,            NULL, NULL },
         { "required-absent",     element_parse_required,            NULL, NULL },
         { "direction",           element_parse_direction,           NULL, NULL },
         { "direction-try-other", element_parse_direction_try_other, NULL, NULL },
@@ -2079,11 +2136,13 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
                                 min_dB[t] += e->min_dB;
                                 max_dB[t] += e->max_dB;
                             }
-                    } else
+                    } else {
                         /* Hmm, there's another element before us
                          * which cannot do dB volumes, so we we need
                          * to 'neutralize' this slider */
                         e->volume_use = PA_ALSA_VOLUME_ZERO;
+                        pa_log_info("Zeroing volume of '%s' on path '%s'", e->alsa_name, p->name);
+                    }
                 }
             } else if (p->has_volume)
                 /* We can't use this volume, so let's ignore it */
@@ -2096,6 +2155,12 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
             p->has_mute = TRUE;
     }
 
+    if (p->has_req_any && !p->req_any_present) {
+        p->supported = FALSE;
+        pa_log_debug("Skipping path '%s', none of required-any elements preset.", p->name);
+        return -1;
+    }
+
     path_drop_unsupported(p);
     path_make_options_unique(p);
     path_create_settings(p);
@@ -2141,13 +2206,14 @@ void pa_alsa_element_dump(pa_alsa_element *e) {
     pa_alsa_option *o;
     pa_assert(e);
 
-    pa_log_debug("Element %s, direction=%i, switch=%i, volume=%i, enumeration=%i, required=%i, required_absent=%i, mask=0x%llx, n_channels=%u, override_map=%s",
+    pa_log_debug("Element %s, direction=%i, switch=%i, volume=%i, enumeration=%i, required=%i, required_any=%i, required_absent=%i, mask=0x%llx, n_channels=%u, override_map=%s",
                  e->alsa_name,
                  e->direction,
                  e->switch_use,
                  e->volume_use,
                  e->enumeration_use,
                  e->required,
+                 e->required_any,
                  e->required_absent,
                  (long long unsigned) e->merged_mask,
                  e->n_channels,
diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
index a0d4fcb..a6499b6 100644
--- a/src/modules/alsa/alsa-mixer.h
+++ b/src/modules/alsa/alsa-mixer.h
@@ -111,6 +111,10 @@ struct pa_alsa_option {
     char *name;
     char *description;
     unsigned priority;
+
+    pa_alsa_required_t required;
+    pa_alsa_required_t required_any;
+    pa_alsa_required_t required_absent;
 };
 
 /* And element wraps one specific ALSA element. A series of elements *
@@ -128,6 +132,7 @@ struct pa_alsa_element {
     pa_alsa_enumeration_use_t enumeration_use;
 
     pa_alsa_required_t required;
+    pa_alsa_required_t required_any;
     pa_alsa_required_t required_absent;
 
     pa_bool_t override_map:1;
@@ -163,6 +168,9 @@ struct pa_alsa_path {
     pa_bool_t has_mute:1;
     pa_bool_t has_volume:1;
     pa_bool_t has_dB:1;
+    /* These two are used during probing only */
+    pa_bool_t has_req_any:1;
+    pa_bool_t req_any_present:1;
 
     long min_volume, max_volume;
     double min_dB, max_dB;
diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common
index 6131da5..ffd1b41 100644
--- a/src/modules/alsa/mixer/paths/analog-output.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-output.conf.common
@@ -63,10 +63,15 @@
 ;                                        # by the option name, resp. on/off if the element is a switch.
 ; name = ...                             # Logical name to use in the path identifier
 ; priority = ...                         # Priority if this is made into a device port
+; required = ignore | enumeration | any            # In this element, this option must exist or the path will be invalid. ("any" is an alias for "enumeration".)
+; required-any = ignore | enumeration | any        # In this element, either this or another option must exist (or an element)
+; required-absent = ignore | enumeration | any     # In this element, this option must not exist or the path will be invalid
 ;
 ; [Element ...]                          # For each element that we shall control
 ; required = ignore | switch | volume | enumeration | any     # If set, require this element to be of this kind and available,
 ;                                                             # otherwise don't consider this path valid for the card
+; required-any = ignore | switch | volume | enumeration | any # If set, at least one of the elements with required-any in this
+;                                                             # path must be present, otherwise this path is invalid for the card
 ; required-absent = ignore | switch | volume                  # If set, require this element to not be of this kind and not
 ;                                                             # available, otherwise don't consider this path valid for the card
 ;
-- 
1.7.1

>From 57030817e1a7c0b2dd7329a2b0a98d6c81d3d2da Mon Sep 17 00:00:00 2001
From: David Henningsson <david.hennings...@canonical.com>
Date: Wed, 5 Jan 2011 12:36:59 +0100
Subject: [PATCH 3/6] alsa-mixer: always round towards 0 dB

Always round towards 0 dB. Also add a few debug comments to aid
troubleshooting.

Signed-off-by: David Henningsson <david.hennings...@canonical.com>
---
 src/modules/alsa/alsa-mixer.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 2c47319..b3fcbec 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -714,19 +714,20 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
 
         if (e->has_dB) {
             long value = to_alsa_dB(f);
+            int rounding = value > 0 ? -1 : +1;
 
             if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
                 /* If we call set_play_volume() without checking first
                  * if the channel is available, ALSA behaves ver
                  * strangely and doesn't fail the call */
                 if (snd_mixer_selem_has_playback_channel(me, c)) {
-                    if ((r = snd_mixer_selem_set_playback_dB(me, c, value, +1)) >= 0)
+                    if ((r = snd_mixer_selem_set_playback_dB(me, c, value, rounding)) >= 0)
                         r = snd_mixer_selem_get_playback_dB(me, c, &value);
                 } else
                     r = -1;
             } else {
                 if (snd_mixer_selem_has_capture_channel(me, c)) {
-                    if ((r = snd_mixer_selem_set_capture_dB(me, c, value, +1)) >= 0)
+                    if ((r = snd_mixer_selem_set_capture_dB(me, c, value, rounding)) >= 0)
                         r = snd_mixer_selem_get_capture_dB(me, c, &value);
                 } else
                     r = -1;
@@ -2108,6 +2109,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
             pa_log_debug("Probe of element '%s' failed.", e->alsa_name);
             return -1;
         }
+        pa_log_debug("Probe of element '%s' succeeded (volume=%d, switch=%d, enumeration=%d).", e->alsa_name, e->volume_use, e->switch_use, e->enumeration_use);
 
         if (ignore_dB)
             e->has_dB = FALSE;
@@ -2144,10 +2146,11 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB) {
                         pa_log_info("Zeroing volume of '%s' on path '%s'", e->alsa_name, p->name);
                     }
                 }
-            } else if (p->has_volume)
+            } else if (p->has_volume) {
                 /* We can't use this volume, so let's ignore it */
                 e->volume_use = PA_ALSA_VOLUME_IGNORE;
-
+                pa_log_info("Ignoring volume of '%s' on path '%s' (missing dB info)", e->alsa_name, p->name);
+            }
             p->has_volume = TRUE;
         }
 
-- 
1.7.1

>From 9030819690d9f98b2c8aac5796a7c2faaa41dadb Mon Sep 17 00:00:00 2001
From: David Henningsson <david.hennings...@canonical.com>
Date: Wed, 5 Jan 2011 13:27:53 +0100
Subject: [PATCH 4/6] alsa-mixer: Add new paths for Internal Mic, Front Mic, Rear Mic and Dock Mic

Signed-off-by: David Henningsson <david.hennings...@canonical.com>
---
 src/Makefile.am                                    |    5 +-
 .../alsa/mixer/paths/analog-input-dock-mic.conf    |   79 +++++++++++++++++++
 .../alsa/mixer/paths/analog-input-front-mic.conf   |   79 +++++++++++++++++++
 .../mixer/paths/analog-input-internal-mic.conf     |   80 +++++++++++++++-----
 .../alsa/mixer/paths/analog-input-mic.conf.common  |   74 +++++--------------
 .../alsa/mixer/paths/analog-input-rear-mic.conf    |   79 +++++++++++++++++++
 src/modules/alsa/mixer/profile-sets/default.conf   |    4 +-
 7 files changed, 321 insertions(+), 79 deletions(-)
 create mode 100644 src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
 create mode 100644 src/modules/alsa/mixer/paths/analog-input-front-mic.conf
 create mode 100644 src/modules/alsa/mixer/paths/analog-input-rear-mic.conf

diff --git a/src/Makefile.am b/src/Makefile.am
index ec301da..05ec250 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -120,9 +120,12 @@ ALSA_PATHS = \
 		modules/alsa/mixer/paths/analog-input.conf \
 		modules/alsa/mixer/paths/analog-input.conf.common \
 		modules/alsa/mixer/paths/analog-input-fm.conf \
-		modules/alsa/mixer/paths/analog-input-internal-mic.conf \
 		modules/alsa/mixer/paths/analog-input-linein.conf \
 		modules/alsa/mixer/paths/analog-input-mic.conf \
+		modules/alsa/mixer/paths/analog-input-dock-mic.conf \
+		modules/alsa/mixer/paths/analog-input-front-mic.conf \
+		modules/alsa/mixer/paths/analog-input-internal-mic.conf \
+		modules/alsa/mixer/paths/analog-input-rear-mic.conf \
 		modules/alsa/mixer/paths/analog-input-mic.conf.common \
 		modules/alsa/mixer/paths/analog-input-mic-line.conf \
 		modules/alsa/mixer/paths/analog-input-tvtuner.conf \
diff --git a/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf b/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
new file mode 100644
index 0000000..df8567e
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
@@ -0,0 +1,79 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+; For devices where a 'Dock Mic' or 'Dock Mic Boost' element exists
+;
+; See analog-output.conf.common for an explanation on the directives
+
+[General]
+priority = 80
+name = analog-input-microphone-dock
+
+[Element Dock Mic Boost]
+required-any = any
+switch = select
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Option Dock Mic Boost:on]
+name = input-boost-on
+
+[Option Dock Mic Boost:off]
+name = input-boost-off
+
+[Element Dock Mic]
+required-any = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Capture]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Input Source]
+enumeration = select
+
+[Option Input Source:Dock Mic]
+name = analog-input-microphone-dock
+
+[Element Capture Source]
+enumeration = select
+
+[Option Capture Source:Dock Mic]
+name = analog-input-microphone-dock
+
+[Element Mic]
+switch = off
+volume = off
+
+[Element Internal Mic]
+switch = off
+volume = off
+
+[Element Front Mic]
+switch = off
+volume = off
+
+[Element Rear Mic]
+switch = off
+volume = off
+
+.include analog-input-mic.conf.common
diff --git a/src/modules/alsa/mixer/paths/analog-input-front-mic.conf b/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
new file mode 100644
index 0000000..516b487
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
@@ -0,0 +1,79 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+; For devices where a 'Front Mic' or 'Front Mic Boost' element exists
+;
+; See analog-output.conf.common for an explanation on the directives
+
+[General]
+priority = 90
+name = analog-input-microphone-front
+
+[Element Front Mic Boost]
+required-any = any
+switch = select
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Option Front Mic Boost:on]
+name = input-boost-on
+
+[Option Front Mic Boost:off]
+name = input-boost-off
+
+[Element Front Mic]
+required-any = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Capture]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Input Source]
+enumeration = select
+
+[Option Input Source:Front Mic]
+name = analog-input-microphone-front
+
+[Element Capture Source]
+enumeration = select
+
+[Option Capture Source:Front Mic]
+name = analog-input-microphone-front
+
+[Element Mic]
+switch = off
+volume = off
+
+[Element Internal Mic]
+switch = off
+volume = off
+
+[Element Rear Mic]
+switch = off
+volume = off
+
+[Element Dock Mic]
+switch = off
+volume = off
+
+.include analog-input-mic.conf.common
diff --git a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
index 70cd512..3e45bcf 100644
--- a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
@@ -14,54 +14,94 @@
 # along with PulseAudio; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 
-; For devices where a 'Internal Mic' element exists
+; For devices where a 'Internal Mic' or 'Internal Mic Boost' element exists
+; 'Int Mic' and 'Int Mic Boost' are for compatibility with kernels < 2.6.38
 ;
 ; See analog-output.conf.common for an explanation on the directives
 
 [General]
-priority = 90
-name = analog-input-microphone
+priority = 89
+name = analog-input-microphone-internal
 
-[Element Capture]
-switch = mute
+[Element Internal Mic Boost]
+required-any = any
+switch = select
 volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
-[Element Mic]
-switch = off
-volume = off
+[Option Internal Mic Boost:on]
+name = input-boost-on
+
+[Option Internal Mic Boost:off]
+name = input-boost-off
+
+[Element Int Mic Boost]
+required-any = any
+switch = select
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Option Int Mic Boost:on]
+name = input-boost-on
+
+[Option Int Mic Boost:off]
+name = input-boost-off
+
 
 [Element Internal Mic]
-required = any
+required-any = any
 switch = mute
 volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
-[Element Line]
-switch = off
-volume = off
+[Element Int Mic]
+required-any = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
 
-[Element Aux]
-switch = off
-volume = off
+[Element Capture]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Input Source]
+enumeration = select
+
+[Option Input Source:Internal Mic]
+name = analog-input-microphone-internal
+
+[Option Input Source:Int Mic]
+name = analog-input-microphone-internal
 
-[Element Video]
+[Element Capture Source]
+enumeration = select
+
+[Option Capture Source:Internal Mic]
+name = analog-input-microphone-internal
+
+[Option Capture Source:Int Mic]
+name = analog-input-microphone-internal
+
+[Element Mic]
 switch = off
 volume = off
 
-[Element Mic/Line]
+[Element Dock Mic]
 switch = off
 volume = off
 
-[Element TV Tuner]
+[Element Front Mic]
 switch = off
 volume = off
 
-[Element FM]
+[Element Rear Mic]
 switch = off
 volume = off
 
-.include analog-input.conf.common
 .include analog-input-mic.conf.common
diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
index 9bddd48..1ffe59f 100644
--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
@@ -18,64 +18,26 @@
 ;
 ; See analog-output.conf.common for an explanation on the directives
 
-;;; 'Mic Select'
+[Element Line]
+switch = off
+volume = off
 
-[Element Mic Select]
-enumeration = select
+[Element Aux]
+switch = off
+volume = off
 
-[Option Mic Select:Mic1]
-name = input-microphone
-priority = 20
+[Element Video]
+switch = off
+volume = off
 
-[Option Mic Select:Mic2]
-name = input-microphone
-priority = 19
+[Element Mic/Line]
+switch = off
+volume = off
 
-;;; Various Boosts
+[Element TV Tuner]
+switch = off
+volume = off
 
-[Element Mic Boost (+20dB)]
-switch = select
-volume = merge
-
-[Option Mic Boost (+20dB):on]
-name = input-boost-on
-
-[Option Mic Boost (+20dB):off]
-name = input-boost-off
-
-[Element Mic Boost]
-switch = select
-volume = merge
-
-[Option Mic Boost:on]
-name = input-boost-on
-
-[Option Mic Boost:off]
-name = input-boost-off
-
-[Element Front Mic Boost]
-switch = select
-
-[Option Front Mic Boost:on]
-name = input-boost-on
-
-[Option Front Mic Boost:off]
-name = input-boost-off
-
-[Element Rear Mic Boost]
-switch = select
-
-[Option Rear Mic Boost:on]
-name = input-boost-on
-
-[Option Rear Mic Boost:off]
-name = input-boost-off
-
-[Element Int Mic Boost]
-switch = select
-
-[Option Int Mic Boost:on]
-name = input-boost-on
-
-[Option Int Mic Boost:off]
-name = input-boost-off
+[Element FM]
+switch = off
+volume = off
diff --git a/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf b/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
new file mode 100644
index 0000000..45f7730
--- /dev/null
+++ b/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
@@ -0,0 +1,79 @@
+# This file is part of PulseAudio.
+#
+# PulseAudio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# PulseAudio is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with PulseAudio; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+; For devices where a 'Rear Mic' or 'Rear Mic Boost' element exists
+;
+; See analog-output.conf.common for an explanation on the directives
+
+[General]
+priority = 89
+name = analog-input-microphone-rear
+
+[Element Rear Mic Boost]
+required-any = any
+switch = select
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Option Rear Mic Boost:on]
+name = input-boost-on
+
+[Option Rear Mic Boost:off]
+name = input-boost-off
+
+[Element Rear Mic]
+required-any = any
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Capture]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
+
+[Element Input Source]
+enumeration = select
+
+[Option Input Source:Rear Mic]
+name = analog-input-microphone-rear
+
+[Element Capture Source]
+enumeration = select
+
+[Option Capture Source:Rear Mic]
+name = analog-input-microphone-rear
+
+[Element Mic]
+switch = off
+volume = off
+
+[Element Internal Mic]
+switch = off
+volume = off
+
+[Element Front Mic]
+switch = off
+volume = off
+
+[Element Dock Mic]
+switch = off
+volume = off
+
+.include analog-input-mic.conf.common
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
index 5d352f1..24a8d98 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -63,14 +63,14 @@ auto-profiles = yes
 device-strings = hw:%f
 channel-map = mono
 paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono
-paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
+paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
 priority = 1
 
 [Mapping analog-stereo]
 device-strings = front:%f hw:%f
 channel-map = left,right
 paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono
-paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
+paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
 priority = 10
 
 [Mapping analog-surround-40]
-- 
1.7.1

>From f020db16c8797522d67433791a2f3a34ab2f5520 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.hennings...@canonical.com>
Date: Wed, 5 Jan 2011 14:03:15 +0100
Subject: [PATCH 5/6] alsa-mixer: Fixup "Mic"/"Line"/"analog-input" paths to work with the new paths

Signed-off-by: David Henningsson <david.hennings...@canonical.com>
---
 .../alsa/mixer/paths/analog-input-linein.conf      |   25 ++++++-
 src/modules/alsa/mixer/paths/analog-input-mic.conf |   73 ++++++++++++++-----
 .../alsa/mixer/paths/analog-input-mic.conf.common  |    7 ++
 src/modules/alsa/mixer/paths/analog-input.conf     |   28 +++++++-
 4 files changed, 111 insertions(+), 22 deletions(-)

diff --git a/src/modules/alsa/mixer/paths/analog-input-linein.conf b/src/modules/alsa/mixer/paths/analog-input-linein.conf
index 57568cc..9362227 100644
--- a/src/modules/alsa/mixer/paths/analog-input-linein.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-linein.conf
@@ -36,12 +36,27 @@ switch = off
 volume = off
 
 [Element Line]
-required = any
+required-any = any
 switch = mute
 volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
+[Element Input Source]
+enumeration = select
+
+[Option Input Source:Line]
+name = analog-input-linein
+required-any = any
+
+[Element Capture Source]
+enumeration = select
+
+[Option Capture Source:Line]
+name = analog-input-linein
+required-any = any
+
+
 [Element Aux]
 switch = off
 volume = off
@@ -62,4 +77,10 @@ volume = off
 switch = off
 volume = off
 
-.include analog-input.conf.common
+[Element Mic Jack Mode]
+enumeration = select
+
+[Option Mic Jack Mode:Line In]
+priority = 19
+required-any = any
+name = input-linein
diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf b/src/modules/alsa/mixer/paths/analog-input-mic.conf
index 9b8b75a..8565ebe 100644
--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf
@@ -14,54 +14,89 @@
 # along with PulseAudio; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 
-; For devices where a 'Mic' element exists
+; For devices where a 'Mic' or 'Mic Boost' element exists
 ;
 ; See analog-output.conf.common for an explanation on the directives
 
 [General]
-priority = 100
+priority = 89
 name = analog-input-microphone
 
-[Element Capture]
-switch = mute
+[Element Mic Boost]
+required-any = any
+switch = select
 volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
+[Option Mic Boost:on]
+name = input-boost-on
+
+[Option Mic Boost:off]
+name = input-boost-off
+
 [Element Mic]
-required = any
+required-any = any
 switch = mute
 volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
-[Element Internal Mic]
-switch = off
-volume = off
+[Element Capture]
+switch = mute
+volume = merge
+override-map.1 = all
+override-map.2 = all-left,all-right
 
-[Element Line]
-switch = off
-volume = off
+[Element Input Source]
+enumeration = select
 
-[Element Aux]
-switch = off
-volume = off
+[Option Input Source:Mic]
+name = analog-input-microphone
+
+[Element Capture Source]
+enumeration = select
+
+[Option Capture Source:Mic]
+name = analog-input-microphone
+
+;;; Some AC'97s have "Mic Select" and "Mic Boost (+20dB)"
+
+[Element Mic Select]
+enumeration = select
 
-[Element Video]
+[Option Mic Select:Mic1]
+name = input-microphone
+priority = 20
+
+[Option Mic Select:Mic2]
+name = input-microphone
+priority = 19
+
+[Element Mic Boost (+20dB)]
+switch = select
+volume = merge
+
+[Option Mic Boost (+20dB):on]
+name = input-boost-on
+
+[Option Mic Boost (+20dB):off]
+name = input-boost-off
+
+[Element Front Mic]
 switch = off
 volume = off
 
-[Element Mic/Line]
+[Element Internal Mic]
 switch = off
 volume = off
 
-[Element TV Tuner]
+[Element Rear Mic]
 switch = off
 volume = off
 
-[Element FM]
+[Element Dock Mic]
 switch = off
 volume = off
 
-.include analog-input.conf.common
 .include analog-input-mic.conf.common
diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
index 1ffe59f..4bebc29 100644
--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf.common
@@ -41,3 +41,10 @@ volume = off
 [Element FM]
 switch = off
 volume = off
+
+[Element Mic Jack Mode]
+enumeration = select
+
+[Option Mic Jack Mode:Mic In]
+priority = 19
+name = input-microphone
diff --git a/src/modules/alsa/mixer/paths/analog-input.conf b/src/modules/alsa/mixer/paths/analog-input.conf
index 3050738..b86c356 100644
--- a/src/modules/alsa/mixer/paths/analog-input.conf
+++ b/src/modules/alsa/mixer/paths/analog-input.conf
@@ -32,9 +32,36 @@ override-map.2 = all-left,all-right
 [Element Mic]
 required-absent = any
 
+[Element Dock Mic]
+required-absent = any
+
+[Element Dock Mic Boost]
+required-absent = any
+
+[Element Front Mic]
+required-absent = any
+
+[Element Front Mic Boost]
+required-absent = any
+
+[Element Int Mic]
+required-absent = any
+
+[Element Int Mic Boost]
+required-absent = any
+
 [Element Internal Mic]
 required-absent = any
 
+[Element Internal Mic Boost]
+required-absent = any
+
+[Element Rear Mic]
+required-absent = any
+
+[Element Rear Mic Boost]
+required-absent = any
+
 [Element Line]
 required-absent = any
 
@@ -54,4 +81,3 @@ required-absent = any
 required-absent = any
 
 .include analog-input.conf.common
-.include analog-input-mic.conf.common
-- 
1.7.1

>From 72c52d0fdbef462e1c404a80543039afdc122338 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.hennings...@canonical.com>
Date: Wed, 19 Jan 2011 15:40:56 +0100
Subject: [PATCH 6/6] alsa-mixer: Make sure capture source and input source use right path

Make sure that mic and line (with common names) use the specific
path instead of the analog-input one.

Signed-off-by: David Henningsson <david.hennings...@canonical.com>
---
 .../alsa/mixer/paths/analog-input-dock-mic.conf    |    2 +
 .../alsa/mixer/paths/analog-input-front-mic.conf   |    2 +
 .../mixer/paths/analog-input-internal-mic.conf     |    4 ++
 src/modules/alsa/mixer/paths/analog-input-mic.conf |    2 +
 .../alsa/mixer/paths/analog-input-rear-mic.conf    |    2 +
 .../alsa/mixer/paths/analog-input.conf.common      |   45 --------------------
 6 files changed, 12 insertions(+), 45 deletions(-)

diff --git a/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf b/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
index df8567e..74826a9 100644
--- a/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-dock-mic.conf
@@ -53,12 +53,14 @@ enumeration = select
 
 [Option Input Source:Dock Mic]
 name = analog-input-microphone-dock
+required-any = any
 
 [Element Capture Source]
 enumeration = select
 
 [Option Capture Source:Dock Mic]
 name = analog-input-microphone-dock
+required-any = any
 
 [Element Mic]
 switch = off
diff --git a/src/modules/alsa/mixer/paths/analog-input-front-mic.conf b/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
index 516b487..6c58ece 100644
--- a/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-front-mic.conf
@@ -53,12 +53,14 @@ enumeration = select
 
 [Option Input Source:Front Mic]
 name = analog-input-microphone-front
+required-any = any
 
 [Element Capture Source]
 enumeration = select
 
 [Option Capture Source:Front Mic]
 name = analog-input-microphone-front
+required-any = any
 
 [Element Mic]
 switch = off
diff --git a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
index 3e45bcf..70a1cd1 100644
--- a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf
@@ -75,18 +75,22 @@ enumeration = select
 
 [Option Input Source:Internal Mic]
 name = analog-input-microphone-internal
+required-any = any
 
 [Option Input Source:Int Mic]
 name = analog-input-microphone-internal
+required-any = any
 
 [Element Capture Source]
 enumeration = select
 
 [Option Capture Source:Internal Mic]
 name = analog-input-microphone-internal
+required-any = any
 
 [Option Capture Source:Int Mic]
 name = analog-input-microphone-internal
+required-any = any
 
 [Element Mic]
 switch = off
diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf b/src/modules/alsa/mixer/paths/analog-input-mic.conf
index 8565ebe..d88028b 100644
--- a/src/modules/alsa/mixer/paths/analog-input-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf
@@ -53,12 +53,14 @@ enumeration = select
 
 [Option Input Source:Mic]
 name = analog-input-microphone
+required-any = any
 
 [Element Capture Source]
 enumeration = select
 
 [Option Capture Source:Mic]
 name = analog-input-microphone
+required-any = any
 
 ;;; Some AC'97s have "Mic Select" and "Mic Boost (+20dB)"
 
diff --git a/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf b/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
index 45f7730..75ed61b 100644
--- a/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
+++ b/src/modules/alsa/mixer/paths/analog-input-rear-mic.conf
@@ -53,12 +53,14 @@ enumeration = select
 
 [Option Input Source:Rear Mic]
 name = analog-input-microphone-rear
+required-any = any
 
 [Element Capture Source]
 enumeration = select
 
 [Option Capture Source:Rear Mic]
 name = analog-input-microphone-rear
+required-any = any
 
 [Element Mic]
 switch = off
diff --git a/src/modules/alsa/mixer/paths/analog-input.conf.common b/src/modules/alsa/mixer/paths/analog-input.conf.common
index 0b2cfd9..9416577 100644
--- a/src/modules/alsa/mixer/paths/analog-input.conf.common
+++ b/src/modules/alsa/mixer/paths/analog-input.conf.common
@@ -66,42 +66,18 @@ enumeration = select
 name = input-microphone
 priority = 20
 
-[Option Input Source:Mic]
-name = input-microphone
-priority = 20
-
 [Option Input Source:Microphone]
 name = input-microphone
 priority = 20
 
-[Option Input Source:Front Mic]
-name = input-microphone
-priority = 19
-
 [Option Input Source:Front Microphone]
 name = input-microphone
 priority = 19
 
-[Option Input Source:Int Mic]
-name = input-microphone
-priority = 19
-
-[Option Input Source:Internal Mic]
-name = input-microphone
-priority = 19
-
-[Option Input Source:Rear Mic]
-name = input-microphone
-priority = 19
-
 [Option Input Source:Internal Mic 1]
 name = input-microphone
 priority = 19
 
-[Option Input Source:Line]
-name = input-linein
-priority = 18
-
 [Option Input Source:Line-In]
 name = input-linein
 priority = 18
@@ -135,21 +111,12 @@ name = input
 [Option Capture Source:Line/Mic]
 name = input
 
-[Option Capture Source:Mic]
-name = input-microphone
-
 [Option Capture Source:Microphone]
 name = input-microphone
 
-[Option Capture Source:Int Mic]
-name = input-microphone-internal
-
 [Option Capture Source:Int DMic]
 name = input-microphone-internal
 
-[Option Capture Source:Internal Mic]
-name = input-microphone-internal
-
 [Option Capture Source:iMic]
 name = input-microphone-internal
 
@@ -159,15 +126,9 @@ name = input-microphone-internal
 [Option Capture Source:Internal Microphone]
 name = input-microphone-internal
 
-[Option Capture Source:Front Mic]
-name = input-microphone
-
 [Option Capture Source:Front Microphone]
 name = input-microphone
 
-[Option Capture Source:Rear Mic]
-name = input-microphone
-
 [Option Capture Source:Mic1]
 name = input-microphone
 
@@ -198,9 +159,6 @@ name = input-linein
 [Option Capture Source:Analog]
 name = input
 
-[Option Capture Source:Line]
-name = input-linein
-
 [Option Capture Source:Line-In]
 name = input-linein
 
@@ -261,9 +219,6 @@ name = input
 [Option Capture Source:Docking-Station]
 name = input-docking
 
-[Option Capture Source:Dock Mic]
-name = input-docking-microphone
-
 ;;; 'Mic Jack Mode'
 
 [Element Mic Jack Mode]
-- 
1.7.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to