Received: by 10.223.185.116 with SMTP id b49csp6101363wrg; Thu, 8 Mar 2018 01:39:57 -0800 (PST) X-Google-Smtp-Source: AG47ELuRCiJgmOEmhL7OzPXjGCbnWIXo+hXPqAp+Cwn9mXXuDPagduoi4owZp5OZSXf7hX+IlyUz X-Received: by 10.99.113.85 with SMTP id b21mr21196911pgn.305.1520501997015; Thu, 08 Mar 2018 01:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520501996; cv=none; d=google.com; s=arc-20160816; b=bn5Duzic7GuH5dLmjgXpXP9nMxRC7D1nMHX7mLBWNuv4lSBEOU2D4xxNKq5AuZDeD6 4zJaNRJAjblLS+5TbuRJnuvu+CAk8KeW8uByIPRO+uhjAV0xobySxNQWfB6oowhelCG2 jTgKrfYtgys7qRQ1d33qm62gVRaTAx1ZCbU2EeZEZ2fM07sJs6H4Yd8R8nO65g6mWQzd mLNYy8TsewOHW5cRS1k+DPKVOWrD1TW7DftYdm6bePf+Ve2Pp2WBJ/CjifJQzE/uhEpP QzkAMWHcCU1itAgC/Nukkr1AKd0MHNaoLZNheuF6mrUA8inKemg4wP1UoWB2uvBX+CMc KkCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=QIKN5oQXV1qzDQVmN1cz6bub+atNeQJbxQmH380vAkg=; b=sJsAHUbUX0f29z+il7E2dpxwLzFV0RACjMYJo88EXeE7O9bsv4xvVyPaiJtD/qVTfh YW2AfBHZp0+6948i/sW5lXXPxdP2krv4h9PNSMWztEwK+Rq3QgHg+Eal+qnvLAotNxYV UaqhPRLZRSbB7inJFgPUsw6D1TuqWBIbViAmc8ERohyLqBeWqTXE8xBAxDevwdtS7ZcM sCiwsScU/je9K3wDA0Fd5clRLpIHVlKGfj29kP9ggvxiYZnxT7n7AcLvixvd5d1Xb5D+ 9yj8qjArDAPHKArRPiramPcPSLDQTmZUq+zOZCTQimvAQR6kOuzIM3IUlo76p6hCeVZ3 Zc8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si869541pgp.249.2018.03.08.01.39.42; Thu, 08 Mar 2018 01:39:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935699AbeCHJix (ORCPT + 99 others); Thu, 8 Mar 2018 04:38:53 -0500 Received: from bmailout1.hostsharing.net ([83.223.95.100]:47529 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755153AbeCHJiu (ORCPT ); Thu, 8 Mar 2018 04:38:50 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id D4AC83000250B; Thu, 8 Mar 2018 10:38:48 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B1386D6F2; Thu, 8 Mar 2018 10:38:48 +0100 (CET) Date: Thu, 8 Mar 2018 10:38:48 +0100 From: Lukas Wunner To: Kai-Heng Feng Cc: mjg59@srcf.ucam.org, pali.rohar@gmail.com, dvhart@infradead.org, andy@infradead.org, mario.limonciello@dell.com, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: Re: [alsa-devel] [PATCH v2 3/3] ALSA: hda: Disabled unused audio controller for Dell platforms with Switchable Graphics Message-ID: <20180308093848.GA24068@wunner.de> References: <20180308091023.9061-1-kai.heng.feng@canonical.com> <20180308091023.9061-3-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180308091023.9061-3-kai.heng.feng@canonical.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 08, 2018 at 05:10:23PM +0800, Kai-Heng Feng wrote: > Some Dell platforms (Preicsion 7510/7710/7520/7720) have a BIOS option > "Switchable Graphics" (SG). > > When SG is enabled, we have: > 00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04) > 00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev 31) > 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Polaris10] > 01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 580] > > The Intel Audio outputs all the sound, including HDMI audio. The audio > controller comes with AMD graphics doesn't get used. > > When SG is disabled, we have: > 00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev 31) > 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Polaris10] > 01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 580] > > Now it's a typical discrete-only system. HDMI audio comes from AMD audio > controller, others from Intel audio controller. > > When SG is enabled, the unused AMD audio controller still exposes its > sysfs, so userspace still opens the control file and stream. If > userspace tries to output sound through the stream, it hangs when > runtime suspend kicks in: > [ 12.796265] snd_hda_intel 0000:01:00.1: Disabling via vga_switcheroo > [ 12.796367] snd_hda_intel 0000:01:00.1: Cannot lock devices! This should be fixed by the following series: https://lists.freedesktop.org/archives/dri-devel/2018-March/168012.html Please verify that by testing the series on the machine in question. I'm hoping to get those patches in for 4.17. I suspect that your patch may not be necessary then. > Since the discrete audio controller isn't useful when SG enabled, we > should just disable the device. I don't quite follow, when SG is enabled but hda_intel doesn't bind to the AMD audio device, how are you going to stream audio to external displays? Are external DP/HDMI ports muxed to the integrated GPU when SG is enabled? Thanks, Lukas > > Signed-off-by: Kai-Heng Feng > --- > v2: Mario suggested to squash the HDA part into the same series. > > sound/pci/hda/hda_intel.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index 96143df19b21..8e3e8b88624a 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -49,6 +49,7 @@ > #include > #include > #include > +#include > > #ifdef CONFIG_X86 > /* for snoop control */ > @@ -1620,6 +1621,35 @@ static void check_msi(struct azx *chip) > } > } > > +#if IS_ENABLED(CONFIG_DELL_LAPTOP) > +static bool check_dell_switchable_gfx(struct pci_dev *pdev) > +{ > + static int (*dell_switchable_gfx_enabled_func)(bool *); > + bool enabled; > + int err; > + > + if (pdev->vendor != PCI_VENDOR_ID_ATI || > + pdev->subsystem_vendor != PCI_VENDOR_ID_DELL) > + return false; > + > + dell_switchable_gfx_enabled_func = > + symbol_request(dell_switchable_gfx_enabled); > + if (!dell_switchable_gfx_enabled_func) > + return false; > + > + err = dell_switchable_gfx_enabled_func(&enabled); > + > + symbol_put(dell_switchable_gfx_enabled); > + > + return !err ? enabled : false; > +} > +#else > +static bool check_dell_switchable_gfx(struct pci_dev *pdev) > +{ > + return false; > +} > +#endif > + > /* check the snoop mode availability */ > static void azx_check_snoop_available(struct azx *chip) > { > @@ -1702,6 +1732,11 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, > if (err < 0) > return err; > > + if (check_dell_switchable_gfx(pci)) { > + pci_disable_device(pci); > + return -ENODEV; > + } > + > hda = kzalloc(sizeof(*hda), GFP_KERNEL); > if (!hda) { > pci_disable_device(pci); > -- > 2.15.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel