Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp157031pxu; Thu, 10 Dec 2020 22:01:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqtubshjQP/rA6XZ2LwpQWIHV7npn36xE3PEkkdt3nCmsncTE0YrcfN9UIvLEcDS1cqHps X-Received: by 2002:a17:906:9613:: with SMTP id s19mr9588001ejx.351.1607666482841; Thu, 10 Dec 2020 22:01:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607666482; cv=none; d=google.com; s=arc-20160816; b=IhiPCTZ3t1UKCue4CgffwC4gEZ3WOulfIn5/p1DB7B0sMLCtCElHWfjOkeUe7Z7b2e 9vJWl4TnxnbXw3wch/QH+81Wlk6SBpMPDUJ3VTrPAPQseCRLFx9XBmpl4Wn36ZtrqV9L iDFVpPaU731/LvZHPv9hDrcZT0CG5dPV9G/zaPmMn5h+/0rZgNHFqXVC+FwwQLsShR40 8EOTiWAtkkHJomVnfYSPWGLvr4j/EEmpqlAMo/SbkCOFOY+12o/BNmkReA4tRqwH5Vhh u/YOMxhnOXOnv6GRL8zAUwqmJ779xmVUwPJ8KMgj4L9y7w56iW+JbGLEFsUytzsNDVTz /nsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=lvuUESsti3xvo/mEJhB1wFbpGF+x65yhTZtW55Y9zsA=; b=tc/+qoSkWIOf/hGMtZgGK276PQ8R9dZEV6o6hvsOVeaarVPba7xxV4lIkBMhFaSCpB Ai5b5nQ0VaPwpHsnko8NBV3KOWgBwaMNfZWKwLpeloZw9s2PmOgJEVLm99JgntZSie3s 3iyyiAfzQjd80zmZQaK8ofSEqN8vciC5zNYU072yr3a+4MN1TLI9RekQ3DYEj8gK6WH5 O7tLda+qffG9nGrNdHCrHNbtvnWDLY8YXlaMmBPosSbPyvXtdRdipVMuM4T732HrSbU0 peU+9ED9sjoSBnlrTPUkAfQgJlZ1mbNmlMvzmsvpX8Q7JX0kjKC+E7yvCvgZJlRmfTGg UhHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb5si4568081edb.393.2020.12.10.22.00.52; Thu, 10 Dec 2020 22:01:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390857AbgLJOfA (ORCPT + 99 others); Thu, 10 Dec 2020 09:35:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:41574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732919AbgLJOdL (ORCPT ); Thu, 10 Dec 2020 09:33:11 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.19 15/39] ALSA: hda/generic: Add option to enforce preferred_dacs pairs Date: Thu, 10 Dec 2020 15:26:54 +0100 Message-Id: <20201210142603.037114540@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210142602.272595094@linuxfoundation.org> References: <20201210142602.272595094@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai commit 242d990c158d5b1dabd166516e21992baef5f26a upstream. The generic parser accepts the preferred_dacs[] pairs as a hint for assigning a DAC to each pin, but this hint doesn't work always effectively. Currently it's merely a secondary choice after the trial with the path index failed. This made sometimes it difficult to assign DACs without mimicking the connection list and/or the badness table. This patch adds a new flag, obey_preferred_dacs, that changes the behavior of the parser. As its name stands, the parser obeys the given preferred_dacs[] pairs by skipping the path index matching and giving a high penalty if no DAC is assigned by the pairs. This mode will help for assigning the fixed DACs forcibly from the codec driver. Cc: Link: https://lore.kernel.org/r/20201127141104.11041-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_generic.c | 12 ++++++++---- sound/pci/hda/hda_generic.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -1376,16 +1376,20 @@ static int try_assign_dacs(struct hda_co struct nid_path *path; hda_nid_t pin = pins[i]; - path = snd_hda_get_path_from_idx(codec, path_idx[i]); - if (path) { - badness += assign_out_path_ctls(codec, path); - continue; + if (!spec->obey_preferred_dacs) { + path = snd_hda_get_path_from_idx(codec, path_idx[i]); + if (path) { + badness += assign_out_path_ctls(codec, path); + continue; + } } dacs[i] = get_preferred_dac(codec, pin); if (dacs[i]) { if (is_dac_already_used(codec, dacs[i])) badness += bad->shared_primary; + } else if (spec->obey_preferred_dacs) { + badness += BAD_NO_PRIMARY_DAC; } if (!dacs[i]) --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h @@ -240,6 +240,7 @@ struct hda_gen_spec { unsigned int power_down_unused:1; /* power down unused widgets */ unsigned int dac_min_mute:1; /* minimal = mute for DACs */ unsigned int suppress_vmaster:1; /* don't create vmaster kctls */ + unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */ /* other internal flags */ unsigned int no_analog:1; /* digital I/O only */