Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C665AC4360C for ; Mon, 7 Oct 2019 01:51:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A4362080F for ; Mon, 7 Oct 2019 01:51:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="TDM8zgGh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A4362080F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7C29A857; Mon, 7 Oct 2019 03:50:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7C29A857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570413078; bh=i6cpDhxxwYl2kY3T2BZ+pnzMWTmd26uCXUjVru4jsN4=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TDM8zgGhjkIVKK688eb/o9pdlnfp5Mvcueu+26/dl78vxb4gOviRjuC6SCQ4gMThz eoqu5E0Icj9EvLKPjdlf1kIyVhIOO0KO7X4YOOjWW+0nzgc7O/RS1HsCybUTkfbz8U NZytSWIwLwhiA+hh8BLouWfk5lVx7jCT+okUYu1M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0F6FEF80096; Mon, 7 Oct 2019 03:50:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9003BF802BE; Mon, 7 Oct 2019 03:50:26 +0200 (CEST) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B7682F80096 for ; Mon, 7 Oct 2019 03:50:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B7682F80096 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 987F2ADAB; Mon, 7 Oct 2019 01:50:22 +0000 (UTC) Date: Mon, 07 Oct 2019 03:50:22 +0200 Message-ID: From: Takashi Iwai To: Jaroslav Kysela In-Reply-To: <20191006152232.17701-1-perex@perex.cz> References: <20191006152232.17701-1-perex@perex.cz> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Cezary Rojewski , ALSA development , Pierre-Louis Bossart Subject: Re: [alsa-devel] [PATCH v3] ALSA: hda: add Intel DSP configuration / probe code X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sun, 06 Oct 2019 17:22:32 +0200, Jaroslav Kysela wrote: > > For distributions, we need one place where we can decide > which driver will be activated for the auto-configation of the > Intel's HDA hardware with DSP. Actually, we cover three drivers: > > * Legacy HDA > * Intel SST > * Intel Sound Open Firmware (SOF) > > All those drivers registers similar PCI IDs, so the first > driver probed from the PCI stack can win. But... it is not > guaranteed that the correct driver wins. > > This commit changes Intel's NHLT ACPI module to a common > DSP probe module for the Intel's hardware. All above sound > drivers calls this code. The user can force another behaviour > using the module parameter 'dsp_driver' located in > the 'snd-intel-dspcfg' module. > > This change allows to add specific dmi checks for the specific > systems. The examples are taken from the pull request: > > https://github.com/thesofproject/linux/pull/927 > > Tested on Lenovo Carbon X1 7th gen. > > Signed-off-by: Jaroslav Kysela > Cc: Pierre-Louis Bossart > Cc: Cezary Rojewski Since I've been still traveling, just a few nitpicking: > --- a/sound/hda/Makefile > +++ b/sound/hda/Makefile > @@ -14,5 +14,8 @@ obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o > #extended hda > obj-$(CONFIG_SND_HDA_EXT_CORE) += ext/ > > -snd-intel-nhlt-objs := intel-nhlt.o > -obj-$(CONFIG_SND_INTEL_NHLT) += snd-intel-nhlt.o > +snd-intel-dspcfg-objs := intel-dsp-config.o > +ifneq ($(CONFIG_ACPI),) > + snd-intel-dspcfg-objs += intel-nhlt.o > +endif This can be simplified by snd-intel-dspcfg-$(CONFIG_SND_INTEL_NHLT) += intel-nhlt.o > --- /dev/null > +++ b/sound/hda/intel-dsp-config.c > @@ -0,0 +1,247 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (c) 2019 Jaroslav Kysela > + > +#include > +#include > +#include > +#include > +#include > +#include Please put sound/core.h after linux/*.h inclusions. Also in general the inclusions are arranged in the alphabetical order nowadays. > +int snd_intel_dsp_driver_probe(struct pci_dev *pci) > +{ > + const struct config_entry *cfg; > + > + if (dsp_driver > 0 && dsp_driver <= SND_INTEL_DSP_DRIVER_LAST) > + return dsp_driver; > + > + /* Intel vendor only */ > + if (snd_BUG_ON(pci->vendor != 0x8086)) > + return SND_INTEL_DSP_DRIVER_ANY; > + > + /* > + * detect DSP by checking class/subclass/prog-id information > + * class=04 subclass 03 prog-if 00: no DSP, use legacy driver > + * 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: use DSP or legacy mode > + */ > + if (pci->class == 0x040300) > + return SND_INTEL_DSP_DRIVER_LEGACY; > + if (pci->class != 0x040100 && pci->class != 0x040380) { > + dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDA legacy driver\n", pci->class); > + return SND_INTEL_DSP_DRIVER_LEGACY; > + } If we treat this as an error, we should provide a code to work around this (e.g. quirk entry or such), so that the error can be avoided later. Or, just make it dev_info() for now so that it won't appear in the splash screen. > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c .... > @@ -124,7 +124,7 @@ static char *patch[SNDRV_CARDS]; > static bool beep_mode[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = > CONFIG_SND_HDA_INPUT_BEEP_MODE}; > #endif > -static bool dmic_detect = IS_ENABLED(CONFIG_SND_HDA_INTEL_DETECT_DMIC); > +static bool no_dsp_driver; > > module_param_array(index, int, NULL, 0444); > MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); > @@ -159,8 +159,8 @@ module_param_array(beep_mode, bool, NULL, 0444); > MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode " > "(0=off, 1=on) (default=1)."); > #endif > -module_param(dmic_detect, bool, 0444); > -MODULE_PARM_DESC(dmic_detect, "DMIC detect on SKL+ platforms"); > +module_param(no_dsp_driver, bool, 0444); > +MODULE_PARM_DESC(no_dsp_driver, "Force this driver to be used and bypass the DSP driver selection"); A negative option is often confusing, e.g. you may pass like no_dsp_driver=no. Better to use a positive form if possible. I'll be still off until the Thursday in the next week, so the further reply may be delayed. thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel