Received: by 10.192.165.156 with SMTP id m28csp1549761imm; Tue, 17 Apr 2018 00:54:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+rA3ZGkDkdG8ZGAWVjaMwr0PO5M8bVaGx1L96ce3P8xIS54c3nZEd9iQBWZQhrFamM3WD9 X-Received: by 2002:a17:902:85:: with SMTP id a5-v6mr1077978pla.99.1523951684375; Tue, 17 Apr 2018 00:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523951684; cv=none; d=google.com; s=arc-20160816; b=vYL+Hh1qdgIH80CRgCXn1HepoexpPh8FNYyue+mlk8PcZeI8mwSm65xt8rSt8kABr9 Dm/r+aWWiNPOTUXv/WTC0Dg588pwJ976dwJhbInh8KW+CM7p29ELHLYhk9XsvxwIr3ZL WPjOz+xV/PeoqT3pWphYdzmDtXw9qdeuix2DqjEqcvnmKXbBRD4cQApKQR1woBROAleK KG9QXcw92I20JyFf+vFdvEd/2cw+mDGRUUgFpXq6GxkCRfQMncr8Y32cBRn2qQUaYL4A UcLMDfaGflDwZCxj5MirLe01GeEUqhRIoTD1g2H4YoN2t+nF/dxCNUEIYfLkvhnNij99 7ygA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=BLZlky32Ncc5IbcIlUhSapsoD9UMcjGBOQsIJQQBVQY=; b=XHHb4aZdow1k/TMQLxSpQ7C/M9nt3MXSSSEv14x66UrTQNsfyFwDm4m6kagipUXG0r /2ICz3XK05ZgaBg0Wjvt4K4aB5T5zav7GCoYmRrG/P4/wgkACIkTh4lW8gPnExqTzirY Fq+Iy21WVKKgZy2k++a5qpmFRCfDfr0j9ZEXgGQHfNBCsXFSLpVgZQWrmqJ9EpM9IigJ eyxt9/chMJzUapMhneNvu3q6v0atDZPt5KN2oj/+dtl7WTQDBQkMNojJ9nTt+2HAIBsB SjvF0t1ValLekJE8Qm5ORIRSVlhQ6O8ijJqb2/MChBlHTZtxL/xi8i6O16yxhKwBJlK8 CeOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iRi7JV9j; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b186si11106585pgc.569.2018.04.17.00.54.29; Tue, 17 Apr 2018 00:54:44 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iRi7JV9j; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751927AbeDQHxE (ORCPT + 99 others); Tue, 17 Apr 2018 03:53:04 -0400 Received: from mail-wr0-f182.google.com ([209.85.128.182]:44705 "EHLO mail-wr0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751096AbeDQHxC (ORCPT ); Tue, 17 Apr 2018 03:53:02 -0400 Received: by mail-wr0-f182.google.com with SMTP id o15so1680457wro.11; Tue, 17 Apr 2018 00:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=BLZlky32Ncc5IbcIlUhSapsoD9UMcjGBOQsIJQQBVQY=; b=iRi7JV9jVTDPTmMWfFDzfg8+8ydl8gTFF3Kv7hNqCA8tWVX/KIdvwJXRMZu8mm3FhW vMWIP5IpmKA8+rdCcoMopYCLR8ayoVLokp6SLT/gjEhRqUu5EAvv4rmvNdXtgYK8Ibxq Bmgg/EVqBcI7QgEwBMSRIiQMdmc4SHEjplaWxx+TY54whNTPIX2sseI5kJWrYcU7loBe Jt6pqEXQNL/iDJtUHM6kCTEvQKIMAqazU7rNFTMjcEXekzUljE5/+ULylulMRZwciMJo UYBGjCK/YBbuZFFACUTD1ng/7zeXVA6HQ+uQNQYGPoGFP2Fv5qbCRSBuyB46hjW72Cyl B0cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=BLZlky32Ncc5IbcIlUhSapsoD9UMcjGBOQsIJQQBVQY=; b=Wa+ElLXD+3AaacO0d5k8u/qFJ1LnQQpue6Bhjh/Rqz+ONYVNZgHGTkLlPOKxtKLUVM eW6l7fczqSEG1G0jIZZFPgEJcF+IKAnp+ehgcpTzVHybZdL9rCIknBSn+I4WQ5Fj75W3 pFtRORkjcXN4MvXRGRhr7nZMHQvw5BvUeQgtdsFDGBZh4Av/8C0dshz928zg+QP9Susm Fnh+8D4Ug6DEOgAxut07F7LnZev9drkVcgkZFqBYFyzErb212mmVux2HXVPxS/0rZ/Zv 0kbLsla4NlITw/OxscFbofjdT/EnyzcXL2FgCtVGY50WulR2iL655e/R31jyGeNfKsur Zw1w== X-Gm-Message-State: ALQs6tBFV19niQ7JWbajYQ/TNzOTNV3a6YjRDaPaYoIXTjwqwRn+PI/W 9Lkfp5qYpnYFxYqdcANPDF0= X-Received: by 10.28.159.81 with SMTP id i78mr162588wme.8.1523951580854; Tue, 17 Apr 2018 00:53:00 -0700 (PDT) Received: from pali ([2a02:2b88:2:1::5cc6:2f]) by smtp.gmail.com with ESMTPSA id p25sm8806684wmi.14.2018.04.17.00.52.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Apr 2018 00:52:59 -0700 (PDT) Date: Tue, 17 Apr 2018 09:52:57 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Lukas Wunner Cc: Kai-Heng Feng , Takashi Iwai , mario.limonciello@dell.com, andy@infradead.org, dvhart@infradead.org, mjg59@srcf.ucam.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: Re: [PATCH v3 3/3] ALSA: hda: Disabled unused audio controller for Dell platforms with Switchable Graphics Message-ID: <20180417075257.zjnju4jyyc3k5fez@pali> References: <20180412105909.tbyfcjm55sb47hiq@pali> <93DC0F40-81A5-49C6-A470-0D1B6AA85725@canonical.com> <20180414104512.GA27158@wunner.de> <20180414104950.ngomyjy5l5cwhb5i@pali> <20180414111711.GA4245@wunner.de> <20180415171746.futkvgbaoj6quy5z@pali> <20180415190523.GA16129@wunner.de> <20180416142512.bwsemgwrncyl5xan@pali> <20180417023829.GA1533@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180417023829.GA1533@wunner.de> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 17 April 2018 04:38:29 Lukas Wunner wrote: > On Mon, Apr 16, 2018 at 04:25:12PM +0200, Pali Rohár wrote: > > On Sunday 15 April 2018 21:05:23 Lukas Wunner wrote: > > > On Sun, Apr 15, 2018 at 07:17:46PM +0200, Pali Rohár wrote: > > > > On Saturday 14 April 2018 13:17:11 Lukas Wunner wrote: > > > > > On Sat, Apr 14, 2018 at 12:49:50PM +0200, Pali Rohár wrote: > > > > > > On Saturday 14 April 2018 12:45:12 Lukas Wunner wrote: > > > > > > > On Thu, Apr 12, 2018 at 10:15:41PM +0800, Kai-Heng Feng wrote: > > > > > > > > Do you have any suggestion to check if it connects to the system via > > > > > > > > Thunderbolt? > > > > > > > > > > > > > > Just use pci_is_thunderbolt_attached(), introduced by 8531e283bee6, > > > > > > > like this: > > > > > > > > > > > > > > if (check_dell_switchable_gfx(pci) && !pci_is_thunderbolt_attached(pci)) > > > > > > > > > > > > And what about PCI-e device attached to ExpressCard slot? > > > > > > > > > > I don't know of a bullet-proof way to recognize those. > > > > > > > > Hm... maybe another idea: Is it possible to detect which audio pci > > > > device belongs to graphics card via vga_switcheroo? Currently, looking > > > > at output it is same PCI device as graphic card, just different PCI > > > > function. > > > > > > No, the DRM drivers don't filter ExpressCard-attached GPUs when > > > registering with vga_switcheroo. > > > > > They do filter Thunderbolt-attached GPUs. > > > > So check via vga_switcheroo should at least work for Thunderbolt GPUs. > > > > I do not know if it is possible, but for me it looks like that check via > > vga_switcheroo should be better then adding another heuristic to other > > drivers. > > It is way simpler and more straightforward if hda_intel.c calls > pci_is_thunderbolt_attached() directly, as I've suggested above. > > The DRM drivers call that as well and register with vga_switcheroo > only if it returns false. So if hda_intel.c asked vga_switcheroo > and got back a negative answer, it would never know whether it's > because the DRM driver hasn't finished probing yet, or it's module > is blacklisted, or whatever. Ok, module blacklisting can be a problem. > > > And once we would have good/reliable check for EC devices we can add it > > into vga_switcheroo and all users of it could benefit. Anyway, I think > > that vga_switcheroo should filter also EC GPU cards if it already > > filters Thunderbolt. > > vga_switcheroo doesn't do the filtering, the DRM drivers themselves > decice whether to register with vga_switcheroo or not. The motivation > is to avoid middle layers and instead provide the DRM drivers with > a library of helpers that they may call at their own discretion. Understood. Driver itself can also do more work, e.g. ask ACPI or do some other check to decide whatever to register to vga_switcheroo or not. But probably, hda_intel should have same logic for disabling device like gpu drivers for detection if they are going to register into vga_switcheroo or not. Right now this seems to be really complicated and suggested solution with pci_is_thunderbolt_attached() looks to be really simple and better for now. > See this blog post and the links therein for background info: > http://blog.ffwll.ch/2016/12/midlayers-once-more-with-feeling.html > > Thanks, > > Lukas -- Pali Rohár pali.rohar@gmail.com