From patchwork Wed Sep 26 08:55:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 187014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 218062C0094 for ; Wed, 26 Sep 2012 18:55:54 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TGnMg-0006kP-Ac; Wed, 26 Sep 2012 08:53:06 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TGnMe-0006kF-15 for kernel-team@lists.ubuntu.com; Wed, 26 Sep 2012 08:53:04 +0000 Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1TGnP8-0006YF-IB; Wed, 26 Sep 2012 08:55:38 +0000 From: David Henningsson To: kernel-team@lists.ubuntu.com Subject: [QUANTAL PATCH] ALSA: hda - use both input paths on Conexant auto parser Date: Wed, 26 Sep 2012 10:55:37 +0200 Message-Id: <1348649737-5094-1-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.7.9.5 Cc: Takashi Iwai X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com 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 Signed-off-by: Takashi Iwai (cherry picked from commit 739572a545b8ab6faf9e266c3ed83ea202073699, linux/kernel/git/tiwai/sound.git) Signed-off-by: David Henningsson --- Motivation: * Bug tagged with regression-release * Takashi did not want to send to stable because it renames some mixer element (change of behaviour). Since we haven't released 12.10 yet, that argument does not apply to us. 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 41f28c8..0c127cf 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -3545,8 +3545,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: @@ -3570,14 +3571,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;