From patchwork Fri Dec 7 23:50:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 10719005 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 1C12E15A6 for ; Fri, 7 Dec 2018 23:51:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A5112E155 for ; Fri, 7 Dec 2018 23:51:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0D822E310; Fri, 7 Dec 2018 23:51:29 +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,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]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 480B72E155 for ; Fri, 7 Dec 2018 23:51:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 12F16267D3A; Sat, 8 Dec 2018 00:51:15 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5E64E267D2C; Sat, 8 Dec 2018 00:51:06 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by alsa0.perex.cz (Postfix) with ESMTP id 91732267D2D for ; Sat, 8 Dec 2018 00:51:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2018 15:51:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,327,1539673200"; d="scan'208";a="99019143" Received: from shuhuang-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.255.77.13]) by orsmga006.jf.intel.com with ESMTP; 07 Dec 2018 15:51:01 -0800 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Date: Fri, 7 Dec 2018 17:50:04 -0600 Message-Id: <20181207235008.22988-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181207235008.22988-1-pierre-louis.bossart@linux.intel.com> References: <20181207235008.22988-1-pierre-louis.bossart@linux.intel.com> Cc: Cezary Rojewski , Filip Kaczmarski , tiwai@suse.de, Chris Chiu , Pierre-Louis Bossart , Daniel Drake , liam.r.girdwood@linux.intel.com, vkoul@kernel.org, broonie@kernel.org, Michal Wasko , Gustaw Lewandowski Subject: [alsa-devel] [PATCH 2/6] ASoC: Intel: Skylake: Harden DSP detection with PCI class/subclass info X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The existing PPCAP and GCAP fields cannot be used reliably to determine if the DSP is enabled by the BIOS. Instead rely on the class/subclass information to find out if this driver can run or not. The values in the code don't seem to be documented in publicly available documents but are part of recommendations made to BIOS writers and have been verified to be accurate on a number of platforms. Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/skylake/skl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index df36b8fe6d5e..41a084b3d48f 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -916,6 +916,21 @@ static int skl_first_init(struct hdac_bus *bus) unsigned short gcap; int cp_streams, pb_streams, start_idx; + /* + * detect DSP by checking class/subclass/prog-id information + * class=04 subclass 03 prog-if 00: no DSP, legacy driver needs to be used + * class=04 subclass 01 prog-if 00: DSP is present (and may be required e.g. for DMIC or SSP support) + * class=04 subclass 03 prog-if 80: either of DSP or legacy mode can be used + */ + if (pci->class == 0x040300) { + dev_err(bus->dev, "The DSP is not enabled on this platform, aborting probe\n"); + return -ENODEV; + } else if (pci->class != 0x040100 && pci->class != 0x040380) { + dev_err(bus->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, aborting probe\n", pci->class); + return -ENODEV; + } + dev_info(bus->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); + err = pci_request_regions(pci, "Skylake HD audio"); if (err < 0) return err;