From patchwork Thu Aug 15 08:30:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 11095193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F0B11399 for ; Thu, 15 Aug 2019 08:31:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FDEE28842 for ; Thu, 15 Aug 2019 08:31:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43BC828862; Thu, 15 Aug 2019 08:31:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F15C28842 for ; Thu, 15 Aug 2019 08:31:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 033C485D; Thu, 15 Aug 2019 10:30:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 033C485D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1565857878; bh=/It1dp4mLdYOfYhPs+jvjDrXtjqPjnK/n2DlIsIODoQ=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=Wco5RAfQZhyBuQn0LnzA5njPPBdKdDzc02G8017vtV76zmR+51shNRjGWrcOL9wnf uGGzJ2KOujuBkniEX1PwC0q1s/b4zyxWy8GjrWXLT/mjbHgJjCQMGfQAxHtiiGpnjB btqHknubK/6XmeWCfdhaph5J6Q22ObaEaNviRfXQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4E944F80273; Thu, 15 Aug 2019 10:30:27 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id AFC9CF80274; Thu, 15 Aug 2019 10:30:24 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C7F76F801DF for ; Thu, 15 Aug 2019 10:30:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C7F76F801DF Received: from [114.252.209.139] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hyB9H-0005Ya-A0; Thu, 15 Aug 2019 08:30:19 +0000 From: Hui Wang To: alsa-devel@alsa-project.org, tiwai@suse.de Date: Thu, 15 Aug 2019 16:30:00 +0800 Message-Id: <20190815083001.3793-1-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 Cc: stable@vger.kernel.org Subject: [alsa-devel] [PATCH 1/2] ALSA: hda - Add a new match function for only undef configurations X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP With the existing pintbl, we already have many entries in it. it is better to figure out a new match to reduce the size of the pintbl. For example, there are over 10 entries in the pintbl for: 0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE If we define a new tbl like below, and with the new adding match function, we can remove those over 10 entries: SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, {0x19, 0x40000000}, {0x1a, 0x40000000},), Here we put 0x19 and 0x1a in the tbl just because these two pins are undefined on Dell laptops with the codec alc255, and these two pins will be overwritten by ALC255_FIXUP_DELL1_MIC_NO_PRESENCE. In summary: the new match will check vendor id and codec id first, then check the pin_cfg defined in the tbl, only all pin_cfgs in the tbl are undef and the corresponding pin_cfgs on the laptop are undef too, this match returns true. This new match function has lower priority than existing match functions, so the existing tbls still work as before after applying this patch. My plan is to change the existing tbl to undef tbl for MIC_NO_PRESENCE fixups gradually. Signed-off-by: Hui Wang --- sound/pci/hda/hda_auto_parser.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 92390d457567..cfada7401b86 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c @@ -915,6 +915,36 @@ static bool pin_config_match(struct hda_codec *codec, return true; } +/* match the pintbl which only contains specific pins with undef configuration */ +static bool pin_config_match_undef(struct hda_codec *codec, + const struct hda_pintbl *pins) +{ + bool match = false; + + for (; pins->nid; pins++) { + const struct hda_pincfg *pin; + int i; + + if ((pins->val & 0xf0000000) != 0x40000000) + return false; + + match = false; + snd_array_for_each(&codec->init_pins, i, pin) { + if (pin->nid != pins->nid) + continue; + if ((pin->cfg & 0xf0000000) != 0x40000000) + return false; + match = true; + break; + } + + if (match == false) + return false; + } + + return match; +} + /** * snd_hda_pick_pin_fixup - Pick up a fixup matching with the pin quirk list * @codec: the HDA codec @@ -935,7 +965,7 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec, continue; if (codec->core.vendor_id != pq->codec) continue; - if (pin_config_match(codec, pq->pins)) { + if (pin_config_match(codec, pq->pins) || pin_config_match_undef(codec, pq->pins)) { codec->fixup_id = pq->value; #ifdef CONFIG_SND_DEBUG_VERBOSE codec->fixup_name = pq->name; From patchwork Thu Aug 15 08:30:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 11095195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83B3F1398 for ; Thu, 15 Aug 2019 08:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716E5287A8 for ; Thu, 15 Aug 2019 08:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6211A2884A; Thu, 15 Aug 2019 08:32:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B67D6287A8 for ; Thu, 15 Aug 2019 08:32:15 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E4A3B165E; Thu, 15 Aug 2019 10:31:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E4A3B165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1565857933; bh=08RG5EjFR2JetL9WeEEnIhS1pRxhajvBIOqC3PsXEjw=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QarkqqIedWFlIZf4iJaS27y/D8e4bZKb2fhhfi6GlohhFWQVB14mtE86R6yIQ0ZKX zhaIBirv7otKS8Of/CSqnGsD92DObsJ3DyZSkgypAD79LzLmWCiqbeKHff2ur/QLHT Ng3RKBUyiMS2bYjK/bfttAvFSqZ45n0M3NTeVB8U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4CAA9F801DF; Thu, 15 Aug 2019 10:30:32 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id BD4A0F805A0; Thu, 15 Aug 2019 10:30:28 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0AD16F8011F for ; Thu, 15 Aug 2019 10:30:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0AD16F8011F Received: from [114.252.209.139] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hyB9M-0005Ya-UO; Thu, 15 Aug 2019 08:30:25 +0000 From: Hui Wang To: alsa-devel@alsa-project.org, tiwai@suse.de Date: Thu, 15 Aug 2019 16:30:01 +0800 Message-Id: <20190815083001.3793-2-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190815083001.3793-1-hui.wang@canonical.com> References: <20190815083001.3793-1-hui.wang@canonical.com> Cc: stable@vger.kernel.org Subject: [alsa-devel] [PATCH 2/2] ALSA: hda - change the pintbl to undef tbl for Dell with alc289 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP We have another Dell laptop which needs the DELL4_MIC_NO_PRESENCE, and this laptop has different pincfg definitions from existing ones in the pintbl, rather adding a new entry, let us change the exiting tbl to undef tbl. It will cover all Dell laptops with alc289 codec and the pins of 0x19 and 0x1b are undef by default. Signed-off-by: Hui Wang --- sound/pci/hda/patch_realtek.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a1439c9a635a..50b977ea16c2 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7648,9 +7648,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { {0x14, 0x90170110}, {0x21, 0x0321101f}), SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, - {0x12, 0xb7a60130}, - {0x14, 0x90170110}, - {0x21, 0x04211020}), + {0x19, 0x40000000}, + {0x1b, 0x40000000}), SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, ALC290_STANDARD_PINS, {0x15, 0x04211040},