Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp241881pxj; Thu, 20 May 2021 08:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgYMoj3tTs4olgbLkCZc1GHn5nm0SWwJStePeeXZNBjhCWySnixHl0ahTyufZbXTb5Nlc7 X-Received: by 2002:a02:5409:: with SMTP id t9mr6919054jaa.50.1621524291818; Thu, 20 May 2021 08:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621524291; cv=none; d=google.com; s=arc-20160816; b=pijwuvPsBk89Z7FZ/I1Mh788JWRo0Xs9fOZueHBDPqhWwvCpclON7bCpZucFfuHlcY 2c7D3SqcmVXwIy14HB5YyIbFW/88she6+f0V3bm0g2BA/xErgUBp0kOaRyQNltrPm2kT aFQDavbPY/16VfqJ05NNtFrlv0STo2jDwJvh5KP2WgXvmwFowFA4chGyzzb5negwGM1C bwTWq8/J+OZpuHG4XorsyG1ziECqPe9IZ9diWiw0wgZ8C6s4y/CT1vIiZ6z+VubwMO50 3Xj7wp49tZuMdorqZDyUfNKWAEnitnfgHvjIM2efbfHSm8D/nLPHoS9SkDqLBAGJndQb vesg== 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:dkim-signature; bh=645tfO+MbIUneehiJBVdyAKceWtCkDRmAI2cjGsnZZg=; b=iXvTuntHRh1gwsIAOCQHnO4SQUqLF6sBybMlRaIUTONw+gwrreqTGrl0AEqcTb9GwE xcT8mDBCULE0tpevNkkpWDLNS75OXmQFm9fjtFeR8AhSUh+sITlq36SxRWTJIO9gppSO wgrvZVignXBfxg9MwH4Fo1PKrQEhPQ45c58edUf5c1Ndw5+C62r7befKRkwl5V2pJVE/ K75ooCRdnpl4vmLvJ9SChpx62ncs6Vrhj8jiEQts6fFEnHEbxV/VP0WJMx2mR7vc8Lu+ URetRx0ufjm14eKVzaUjzf3TrU6dFnhH8uJMpc8F+qmhhg0Azpzv6tXbrXM3OYrkzBQn sElQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WjkvRlNn; 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=pass (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 w14si726444ilv.110.2021.05.20.08.24.38; Thu, 20 May 2021 08:24:51 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WjkvRlNn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231921AbhETJfo (ORCPT + 99 others); Thu, 20 May 2021 05:35:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232484AbhETJdN (ORCPT ); Thu, 20 May 2021 05:33:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4910D613E4; Thu, 20 May 2021 09:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621502922; bh=JIOOGo8j8PPtHVZMGr2X5RJlghlYZpPBoZ2yatFWF4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WjkvRlNnaIvacVbEUZeY0rPpeQgpJ1jUjY+f/hD/6ei0t1gLYXZmzIIt7H6htqnFs 23PLjzHAahQ1cFcR4rJd6oYArj3zqwKMGVMOJEEKND10h1OREH3kuhpJVA/jLK8ENt 6rmeoihbggwPRUByO5O+Gqv3X3kU33+lfvtj+Qto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hui Wang , Takashi Iwai , Sasha Levin Subject: [PATCH 5.4 27/37] ALSA: hda: generic: change the DAC ctl name for LO+SPK or LO+HP Date: Thu, 20 May 2021 11:22:48 +0200 Message-Id: <20210520092053.174597542@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092052.265851579@linuxfoundation.org> References: <20210520092052.265851579@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: Hui Wang [ Upstream commit f48652bbe3ae62ba2835a396b7e01f063e51c4cd ] Without this change, the DAC ctl's name could be changed only when the machine has both Speaker and Headphone, but we met some machines which only has Lineout and Headhpone, and the Lineout and Headphone share the Audio Mixer0 and DAC0, the ctl's name is set to "Front". On most of machines, the "Front" is used for Speaker only or Lineout only, but on this machine it is shared by Lineout and Headphone, This introduces an issue in the pipewire and pulseaudio, suppose users want the Headphone to be on and the Speaker/Lineout to be off, they could turn off the "Front", this works on most of the machines, but on this machine, the "Front" couldn't be turned off otherwise the headphone will be off too. Here we do some change to let the ctl's name change to "Headphone+LO" on this machine, and pipewire and pulseaudio already could handle "Headphone+LO" and "Speaker+LO". (https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/747) BugLink: http://bugs.launchpad.net/bugs/804178 Signed-off-by: Hui Wang Link: https://lore.kernel.org/r/20210504073917.22406-1-hui.wang@canonical.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_generic.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index efceeae09045..7ac3f04ca8c0 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -1202,11 +1202,17 @@ static const char *get_line_out_pfx(struct hda_codec *codec, int ch, *index = ch; return "Headphone"; case AUTO_PIN_LINE_OUT: - /* This deals with the case where we have two DACs and - * one LO, one HP and one Speaker */ - if (!ch && cfg->speaker_outs && cfg->hp_outs) { - bool hp_lo_shared = !path_has_mixer(codec, spec->hp_paths[0], ctl_type); - bool spk_lo_shared = !path_has_mixer(codec, spec->speaker_paths[0], ctl_type); + /* This deals with the case where one HP or one Speaker or + * one HP + one Speaker need to share the DAC with LO + */ + if (!ch) { + bool hp_lo_shared = false, spk_lo_shared = false; + + if (cfg->speaker_outs) + spk_lo_shared = !path_has_mixer(codec, + spec->speaker_paths[0], ctl_type); + if (cfg->hp_outs) + hp_lo_shared = !path_has_mixer(codec, spec->hp_paths[0], ctl_type); if (hp_lo_shared && spk_lo_shared) return spec->vmaster_mute.hook ? "PCM" : "Master"; if (hp_lo_shared) -- 2.30.2