On the Thinkpad W520 - and probably several other machines with
Conexant 506x chips - the Dock Mic and Mic are connected to the
same two selector nodes. This patch will make Dock Mic take one
selector node and Mic take the other, when possible.

Without the patch, both paths would take the first selector,
leading to the normal Mic's volume being controlled by
"Dock Mic Boost".
(On other machines, this could instead fixup similar problems between
Mic and Line In, for example.)

BugLink: https://bugs.launchpad.net/bugs/1037642
Signed-off-by: David Henningsson <[email protected]>
---

I asked for alsa-info on this one but got Ubuntu apport info instead,
see e g
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1037642/+attachment/3323954/+files/Card0.Codecs.codec.0.txt

In general I guess this could be sent to stable but it always feels scary
when it's generic code :-) what do you think?

 sound/pci/hda/patch_conexant.c |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b871b013..c03d3b8 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3540,8 +3540,9 @@ static int __select_input_connection(struct hda_codec 
*codec, hda_nid_t mux,
                                     hda_nid_t pin, hda_nid_t *srcp,
                                     bool do_select, int depth)
 {
+       struct conexant_spec *spec = codec->spec;
        hda_nid_t conn[HDA_MAX_NUM_INPUTS];
-       int i, nums;
+       int startidx, i, nums;
 
        switch (get_wcaps_type(get_wcaps(codec, mux))) {
        case AC_WID_AUD_IN:
@@ -3565,14 +3566,25 @@ static int __select_input_connection(struct hda_codec 
*codec, hda_nid_t mux,
        depth++;
        if (depth == 2)
                return -1;
+
+       /* Try to rotate around connections to avoid one boost controlling
+          another input path as well */
+       startidx = 0;
+       for (i = 0; i < spec->private_imux.num_items; i++)
+               if (spec->imux_info[i].pin == pin) {
+                       startidx = i;
+                       break;
+               }
+
        for (i = 0; i < nums; i++) {
-               int ret  = __select_input_connection(codec, conn[i], pin, srcp,
+               int j = (i + startidx) % nums;
+               int ret  = __select_input_connection(codec, conn[j], pin, srcp,
                                                     do_select, depth);
                if (ret >= 0) {
                        if (do_select)
                                snd_hda_codec_write(codec, mux, 0,
-                                                   AC_VERB_SET_CONNECT_SEL, i);
-                       return i;
+                                                   AC_VERB_SET_CONNECT_SEL, j);
+                       return j;
                }
        }
        return -1;
-- 
1.7.9.5


** Package changed: pulseaudio (Ubuntu Quantal) => linux (Ubuntu
Quantal)

** Changed in: linux (Ubuntu Quantal)
       Status: Confirmed => In Progress

** Summary changed:

- headset microphone no longer detected and therefore won't record
+ [Thinkpad W520] headset microphone no longer detected and therefore won't 
record

** Summary changed:

- [Thinkpad W520] headset microphone no longer detected and therefore won't 
record
+ [Thinkpad W520] headset microphone controlled by dock mic path

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to pulseaudio in Ubuntu.
https://bugs.launchpad.net/bugs/1037642

Title:
  [Thinkpad W520] headset microphone controlled by dock mic path

Status in “linux” package in Ubuntu:
  In Progress
Status in “linux” source package in Quantal:
  In Progress

Bug description:
  I'm not sure what package this should be targeted to, so feel free to
  reassign.

  I upgraded my main system to Quantal earlier in the week. I have a
  headset with a microphone and headphones that I use with my laptop,
  which has a headphone and microphone jack. On earlier releases when
  attending a meeting, I would plug the headphones into the headphones
  jack and the mic into the microphone jack and both would work without
  issue. In 12.10, only the headphone works automatically.

  Using gnome-control-center's sound settings, I observe on the output tab:
   * plugging in the headphone causes 'Play sound through' to change to 
'Headphones'
   * unplugging the headphones cause 'Play sound through' to change to 
'Speakers'

  Using gnome-control-center's sound settings, I observe on the input tab 
(notice there is no change-- it always says to use the Build-in Audio):
   * plugging in the microphone causes 'Record sound through' to change to 
'Microphone - Built-in Audio'
   * unplugging the microphone causes 'Record sound through' to change to 
'Microphone - Built-in Audio'

  Looking in alsamixer, pressing 'F4: [Capture]' I see settings for 'Doc Mic' 
and 'Internal Mic' (and Boosts for each). I observe:
   * plugging in the microphone causes no change in 'Doc Mic'. It's levels are 
'0' and it is not set to capture. I can't find a way to enable 'CAPTURE" in 
alsamixer
   * unplugging the microphone causes 'Internal Mic' to display 'CAPTURE' in 
red, with levels at 100/78

  Looking in pavucontrol, and clicking 'Input Devices', I can select a
  'Port'. The 'Microphone' port is displayed by default. However I am
  able to force levels with this. When the microphone is plugged in, the
  'Microphone' port (internal mic) does not record. If I change the port
  to be 'Dock Microphone', I can record. Furthermore, after making this
  change in pavucontrol, I observe in alsamixer that the 'Doc Mic' is
  now setup for 'CAPTURE' with levels at 96/96. If I unplug the
  microphone and plug it back in, I must manually pick the port in
  pavucontrol to have the mic work again.

  What appears to be happening is that everything works fine for the
  internal speakers and mic. Everything works fine when I plug in the
  headphones. When I unplug the microphone, the headset mic ('Doc Mic')
  is automatically set to not capture and the internal mic is. When I
  plug the headset, the internal mic is set to not capture, but the 'Doc
  Mic' is not set to capture. pavucontrol allows me to force using the
  'Doc Mic'.

  WORKAROUND: after plugging in the headset microphone, launch
  pavucontrol, go to 'Input Devices' and select the 'Dock Microphone'
  port.

  ProblemType: Bug
  DistroRelease: Ubuntu 12.10
  Package: gnome-control-center 1:3.4.2-0ubuntu8
  ProcVersionSignature: Ubuntu 3.5.0-10.10-generic 3.5.1
  Uname: Linux 3.5.0-10-generic x86_64
  ApportVersion: 2.4-0ubuntu6
  Architecture: amd64
  Date: Thu Aug 16 10:22:59 2012
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110425.2)
  SourcePackage: gnome-control-center
  UpgradeStatus: Upgraded to quantal on 2012-08-13 (2 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1037642/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to