From patchwork Tue Jun 9 09:38:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 6570581 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A947D9F3D1 for ; Tue, 9 Jun 2015 09:38:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C730E204AB for ; Tue, 9 Jun 2015 09:38:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5A7FE204A7 for ; Tue, 9 Jun 2015 09:38:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 74082265185; Tue, 9 Jun 2015 11:38:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 922382606E9; Tue, 9 Jun 2015 11:38:46 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9BEF22606E9; Tue, 9 Jun 2015 11:38:45 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id A7F7026516E for ; Tue, 9 Jun 2015 11:38:38 +0200 (CEST) Received: from [116.213.191.74] (helo=[192.168.0.106]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1Z2FzS-00032c-2G; Tue, 09 Jun 2015 09:38:38 +0000 Message-ID: <5576B419.5010505@canonical.com> Date: Tue, 09 Jun 2015 17:38:33 +0800 From: hwang4 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Takashi Iwai , David Henningsson Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] 2 speakers are assigned to the same DAC, this can't support 4.0/2.1 channles X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP I am trying to enable the subwoofer speaker on a HP laptop, on this machine, there are two speakers and one headphone, but the BIOS verb only enabled one speaker(nid 0xd) and one headphone(nid 0xb), I need to use quirk in the kernel driver to configure the second speaker (subwoofer speaker, nid 0x10). Under current alsa driver, the headphone will be assigned a dac (nid 0x13) and the 2 speakers will be assigned a dac (nid 0x14), this assignment is not good since 2 speakers share the same dac, this means 2 speakers can't work at the same time to support 4.0/2.1 channels. On another Dell machine with realtek codec, there are also 2 speakers, 1 headphone and 2 dacs, on this machine, 1 speaker and 1 headphone are assigned 1 dac, and the other speaker is assigned another dac, so there is no problem for this machine to support 4.0/2.1 channels. Through debugging, I found on Dell machine, the speaker nid only has one connection to dac (hardwired), so when driver assign dac to it, the map_single() can successfully assign the each dac to the 2 speakers respectively. But on that HP machine, the speaker has multiple connections for dac, the map_single() can't work for this machine. The alsa-info.txt for that HP machine is at http://pastebin.ubuntu.com/11667947/ The alsa-info.txt for that Dell machine is at http://pastebin.ubuntu.com/11667982/ To fix this problem, I can use the quirk in the driver to make the speaker have only one connection for dac or do some change in the hda_generic.c like below, in your opinion, which one is better or probably you have a different idea to fix this problem? SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941, diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index ac0db16..8194ff1 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -1363,6 +1363,7 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs, dac = try_dac(codec, get_primary_out(codec, i), pin); if (!dac) dac = try_dac(codec, dacs[0], pin); if (!dac) dac = try_dac(codec, get_primary_out(codec, i), pin); if (dac) { @@ -1762,6 +1763,12 @@ static int fill_and_eval_dacs(struct hda_codec *codec, if (err < 0) return err; badness += err; + /* if there are 2 speakers and both of them are assigned to the same dac, + we need to increase the badness for this situation, because in this situation + the 2 speakers can't work together to support 4.0/2.1 channels */ + if (cfg->speaker_outs == 2 && err < spec->extra_out_badness->no_dac && + spec->multiout.extra_out_nid[1] == 0) + badness += spec->extra_out_badness->no_dac; } if (!spec->no_multi_io && cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index bdcda6a..717259c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2764,6 +2764,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = { "HP bNB13", STAC_HP_BNB13_EQ), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190e, "HP ENVY TS", STAC_HP_ENVY_TS_BASS), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1967, + "HP ENVY TS", STAC_HP_ENVY_TS_BASS), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940, "HP bNB13", STAC_HP_BNB13_EQ),