From patchwork Tue Apr 7 07:14:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1267265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xJZp61Dqz9sSr; Tue, 7 Apr 2020 17:15:14 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jLiRy-0006gW-CW; Tue, 07 Apr 2020 07:15:10 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiRv-0006g4-GW for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:07 +0000 Received: from [114.254.47.51] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiRu-0001HR-Ig for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:07 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E][PATCH 1/6] ALSA: hda: add Intel DSP configuration / probe code Date: Tue, 7 Apr 2020 15:14:37 +0800 Message-Id: <20200407071448.16335-2-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407071448.16335-1-hui.wang@canonical.com> References: <20200407071448.16335-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jaroslav Kysela BugLink: https://bugs.launchpad.net/bugs/1871284 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 Tested-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20191022174313.29087-1-perex@perex.cz Signed-off-by: Takashi Iwai (backported from commit 82d9d54a6c0ee8b12211fa4e59fd940a2da4e063) Signed-off-by: Hui Wang --- include/sound/intel-dsp-config.h | 34 +++++ sound/hda/Kconfig | 10 +- sound/hda/Makefile | 5 +- sound/hda/intel-dsp-config.c | 249 +++++++++++++++++++++++++++++++ sound/hda/intel-nhlt.c | 3 - sound/pci/hda/Kconfig | 11 +- sound/pci/hda/hda_intel.c | 49 ++---- sound/soc/intel/Kconfig | 2 +- sound/soc/intel/skylake/skl.c | 19 +-- sound/soc/sof/intel/Kconfig | 1 + sound/soc/sof/sof-pci-dev.c | 6 + 11 files changed, 322 insertions(+), 67 deletions(-) create mode 100644 include/sound/intel-dsp-config.h create mode 100644 sound/hda/intel-dsp-config.c diff --git a/include/sound/intel-dsp-config.h b/include/sound/intel-dsp-config.h new file mode 100644 index 000000000000..c36622bee3f8 --- /dev/null +++ b/include/sound/intel-dsp-config.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * intel-dsp-config.h - Intel DSP config + * + * Copyright (c) 2019 Jaroslav Kysela + */ + +#ifndef __INTEL_DSP_CONFIG_H__ +#define __INTEL_DSP_CONFIG_H__ + +struct pci_dev; + +enum { + SND_INTEL_DSP_DRIVER_ANY = 0, + SND_INTEL_DSP_DRIVER_LEGACY, + SND_INTEL_DSP_DRIVER_SST, + SND_INTEL_DSP_DRIVER_SOF, + SND_INTEL_DSP_DRIVER_LAST = SND_INTEL_DSP_DRIVER_SOF +}; + +#if IS_ENABLED(CONFIG_SND_INTEL_DSP_CONFIG) + +int snd_intel_dsp_driver_probe(struct pci_dev *pci); + +#else + +static inline int snd_intel_dsp_driver_probe(struct pci_dev *pci) +{ + return SND_INTEL_DSP_DRIVER_ANY; +} + +#endif + +#endif diff --git a/sound/hda/Kconfig b/sound/hda/Kconfig index 9ccbcb5a06bd..373350a8621a 100644 --- a/sound/hda/Kconfig +++ b/sound/hda/Kconfig @@ -31,6 +31,12 @@ config SND_HDA_PREALLOC_SIZE via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. config SND_INTEL_NHLT - tristate + bool # this config should be selected only for Intel ACPI platforms. - # A fallback is provided so that the code compiles in all cases. \ No newline at end of file + # A fallback is provided so that the code compiles in all cases. + +config SND_INTEL_DSP_CONFIG + tristate + select SND_INTEL_NHLT if ACPI + # this config should be selected only for Intel DSP platforms. + # A fallback is provided so that the code compiles in all cases. diff --git a/sound/hda/Makefile b/sound/hda/Makefile index 8560f6ef1b19..601e617918b8 100644 --- a/sound/hda/Makefile +++ b/sound/hda/Makefile @@ -14,5 +14,6 @@ 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 +snd-intel-dspcfg-$(CONFIG_SND_INTEL_NHLT) += intel-nhlt.o +obj-$(CONFIG_SND_INTEL_DSP_CONFIG) += snd-intel-dspcfg.o diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c new file mode 100644 index 000000000000..d9f6d9e872b4 --- /dev/null +++ b/sound/hda/intel-dsp-config.c @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2019 Jaroslav Kysela + +#include +#include +#include +#include +#include +#include +#include + +static int dsp_driver; + +module_param(dsp_driver, int, 0444); +MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP (0=auto, 1=legacy, 2=SST, 3=SOF)"); + +#define FLAG_SST BIT(0) +#define FLAG_SOF BIT(1) +#define FLAG_SOF_ONLY_IF_DMIC BIT(16) + +struct config_entry { + u32 flags; + u16 device; + const struct dmi_system_id *dmi_table; +}; + +/* + * configuration table + * - the order of similar PCI ID entries is important! + * - the first successful match will win + */ +static const struct config_entry config_table[] = { +/* Cometlake-LP */ +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_LP) + { + /* prefer SST */ + .flags = FLAG_SST, + .device = 0x02c8, + }, +#elif IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) + { + .flags = FLAG_SOF, + .device = 0x02c8, + }, +#endif +/* Cometlake-H */ +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_H) + { + .flags = FLAG_SST, + .device = 0x06c8, + }, +#elif IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) + { + .flags = FLAG_SOF, + .device = 0x06c8, + }, +#endif +/* Merrifield */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD) + { + .flags = FLAG_SOF, + .device = 0x119a, + }, +#endif +/* Broxton-T */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x1a98, + }, +#endif +/* Geminilake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_GEMINILAKE) + { + .flags = FLAG_SOF, + .device = 0x3198, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, +#endif +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_GLK) + { + .flags = FLAG_SST, + .device = 0x3198, + }, +#endif +/* Icelake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x34c8, + }, +#endif +/* Elkhart Lake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x4b55, + }, +#endif +/* Appololake (Broxton-P) */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) + { + .flags = FLAG_SOF, + .device = 0x5a98, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Up Squared", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), + DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"), + } + }, + {} + } + }, +#endif +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL) + { + .flags = FLAG_SST, + .device = 0x5a98, + }, +#endif +/* Cannonlake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_CANNONLAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x9dc8, + }, +#endif +/* Sunrise Point-LP */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_SKYLAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x9d70, + }, +#endif +/* Kabylake-LP */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_KABYLAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x9d71, + }, +#endif +/* Tigerlake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0xa0c8, + }, +#endif +/* Coffelake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE) + { + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0xa348, + }, +#endif +}; + +static const struct config_entry *snd_intel_dsp_find_config + (struct pci_dev *pci, const struct config_entry *table, u32 len) +{ + u16 device; + + device = pci->device; + for (; len > 0; len--, table++) { + if (table->device != device) + continue; + if (table->dmi_table && !dmi_check_system(table->dmi_table)) + continue; + return table; + } + return NULL; +} + +static int snd_intel_dsp_check_dmic(struct pci_dev *pci) +{ + struct nhlt_acpi_table *nhlt; + int ret = 0; + + nhlt = intel_nhlt_init(&pci->dev); + if (nhlt) { + if (intel_nhlt_get_dmic_geo(&pci->dev, nhlt)) + ret = 1; + intel_nhlt_free(nhlt); + } + return ret; +} + +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; + } + + dev_info(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); + + /* find the configuration for the specific device */ + cfg = snd_intel_dsp_find_config(pci, config_table, ARRAY_SIZE(config_table)); + if (!cfg) + return SND_INTEL_DSP_DRIVER_ANY; + + if (cfg->flags & FLAG_SOF) { + if (cfg->flags & FLAG_SOF_ONLY_IF_DMIC) { + if (snd_intel_dsp_check_dmic(pci)) { + dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SOF driver\n"); + return SND_INTEL_DSP_DRIVER_SOF; + } + } else { + return SND_INTEL_DSP_DRIVER_SOF; + } + } + + if (cfg->flags & FLAG_SST) + return SND_INTEL_DSP_DRIVER_SST; + + return SND_INTEL_DSP_DRIVER_LEGACY; +} +EXPORT_SYMBOL_GPL(snd_intel_dsp_driver_probe); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Intel DSP config driver"); diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c index daede96f28ee..097ff6c10099 100644 --- a/sound/hda/intel-nhlt.c +++ b/sound/hda/intel-nhlt.c @@ -102,6 +102,3 @@ int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt) return dmic_geo; } EXPORT_SYMBOL_GPL(intel_nhlt_get_dmic_geo); - -MODULE_LICENSE("GPL v2"); -MODULE_DESCRIPTION("Intel NHLT driver"); diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index b5966014b5f7..276b02347dcf 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig @@ -12,7 +12,7 @@ config SND_HDA_INTEL tristate "HD Audio PCI" depends on SND_PCI select SND_HDA - select SND_INTEL_NHLT if ACPI + select SND_INTEL_DSP_CONFIG help Say Y here to include support for Intel "High Definition Audio" (Azalia) and its compatible devices. @@ -23,15 +23,6 @@ config SND_HDA_INTEL To compile this driver as a module, choose M here: the module will be called snd-hda-intel. -config SND_HDA_INTEL_DETECT_DMIC - bool "DMIC detection and probe abort" - depends on SND_HDA_INTEL - help - Say Y to detect digital microphones on SKL+ devices. DMICs - cannot be handled by the HDaudio legacy driver and are - currently only supported by the SOF driver. - If unsure say N. - config SND_HDA_TEGRA tristate "NVIDIA Tegra HD Audio" depends on ARCH_TEGRA diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 9018b3c3769f..caa8dbe3966f 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -126,7 +126,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 dsp_driver = 1; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); @@ -161,8 +161,9 @@ 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(dsp_driver, bool, 0444); +MODULE_PARM_DESC(dsp_driver, "Allow DSP driver selection (bypass this driver) " + "(0=off, 1=on) (default=1)"); #ifdef CONFIG_PM static int param_set_xint(const char *val, const struct kernel_param *kp); @@ -2096,25 +2097,6 @@ static const struct hda_controller_ops pci_hda_ops = { .position_check = azx_position_check, }; -static int azx_check_dmic(struct pci_dev *pci, struct azx *chip) -{ - struct nhlt_acpi_table *nhlt; - int ret = 0; - - if (chip->driver_type == AZX_DRIVER_SKL && - pci->class != 0x040300) { - nhlt = intel_nhlt_init(&pci->dev); - if (nhlt) { - if (intel_nhlt_get_dmic_geo(&pci->dev, nhlt)) { - ret = -ENODEV; - dev_info(&pci->dev, "Digital mics found on Skylake+ platform, aborting probe\n"); - } - intel_nhlt_free(nhlt); - } - } - return ret; -} - static int azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -2132,6 +2114,16 @@ static int azx_probe(struct pci_dev *pci, return -ENOENT; } + /* + * stop probe if another Intel's DSP driver should be activated + */ + if (dsp_driver) { + err = snd_intel_dsp_driver_probe(pci); + if (err != SND_INTEL_DSP_DRIVER_ANY && + err != SND_INTEL_DSP_DRIVER_LEGACY) + return -ENODEV; + } + err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 0, &card); if (err < 0) { @@ -2145,17 +2137,6 @@ static int azx_probe(struct pci_dev *pci, card->private_data = chip; hda = container_of(chip, struct hda_intel, chip); - /* - * stop probe if digital microphones detected on Skylake+ platform - * with the DSP enabled. This is an opt-in behavior defined at build - * time or at run-time with a module parameter - */ - if (dmic_detect) { - err = azx_check_dmic(pci, chip); - if (err < 0) - goto out_free; - } - pci_set_drvdata(pci, card); err = register_vga_switcheroo(chip); diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index f646ec4292f3..c15230cec851 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig @@ -218,7 +218,7 @@ config SND_SOC_INTEL_SKYLAKE_COMMON select SND_SOC_INTEL_SST select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC select SND_SOC_ACPI_INTEL_MATCH - select SND_INTEL_NHLT + select SND_INTEL_DSP_CONFIG help If you have a Intel Skylake/Broxton/ApolloLake/KabyLake/ GeminiLake or CannonLake platform with the DSP enabled in the BIOS diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 2b5159890a57..d3b78db44412 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "skl.h" #include "skl-sst-dsp.h" #include "skl-sst-ipc.h" @@ -988,22 +989,10 @@ static int skl_probe(struct pci_dev *pci, switch (skl_pci_binding) { case SND_SKL_PCI_BIND_AUTO: - /* - * 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) { - dev_info(&pci->dev, "The DSP is not enabled on this platform, aborting probe\n"); + err = snd_intel_dsp_driver_probe(pci); + if (err != SND_INTEL_DSP_DRIVER_ANY && + err != SND_INTEL_DSP_DRIVER_SST) return -ENODEV; - } - if (pci->class != 0x040100 && pci->class != 0x040380) { - dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, aborting probe\n", pci->class); - return -ENODEV; - } - dev_info(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); break; case SND_SKL_PCI_BIND_LEGACY: dev_info(&pci->dev, "Module parameter forced binding with HDaudio legacy, aborting probe\n"); diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig index 70c2a7cb2d97..eb381556dcbe 100644 --- a/sound/soc/sof/intel/Kconfig +++ b/sound/soc/sof/intel/Kconfig @@ -282,6 +282,7 @@ config SND_SOC_SOF_HDA tristate select SND_HDA_EXT_CORE if SND_SOC_SOF_HDA_LINK select SND_SOC_HDAC_HDA if SND_SOC_SOF_HDA_AUDIO_CODEC + select SND_INTEL_DSP_CONFIG help This option is not user-selectable but automagically handled by 'select' statements at a higher level diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index 21b0a07544ed..564421f95865 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -241,6 +242,11 @@ static int sof_pci_probe(struct pci_dev *pci, const struct snd_sof_dsp_ops *ops; int ret; + ret = snd_intel_dsp_driver_probe(pci); + if (ret != SND_INTEL_DSP_DRIVER_ANY && + ret != SND_INTEL_DSP_DRIVER_SOF) + return -ENODEV; + dev_dbg(&pci->dev, "PCI DSP detected"); /* get ops for platform */ From patchwork Tue Apr 7 07:14:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1267266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xJZr5lKgz9sSj; Tue, 7 Apr 2020 17:15:16 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jLiS0-0006hD-KA; Tue, 07 Apr 2020 07:15:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiRx-0006gJ-Ba for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:09 +0000 Received: from [114.254.47.51] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiRw-0001HR-Ce for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:09 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E][PATCH 2/6] ALSA: hda: fix intel DSP config Date: Tue, 7 Apr 2020 15:14:38 +0800 Message-Id: <20200407071448.16335-3-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407071448.16335-1-hui.wang@canonical.com> References: <20200407071448.16335-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Pierre-Louis Bossart BugLink: https://bugs.launchpad.net/bugs/1871284 Reshuffle list of devices by historical order and add correct information as needed. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20191022174313.29087-2-perex@perex.cz Signed-off-by: Takashi Iwai (cherry picked from commit cc8f81c7e625168a60843b2b39e3a327cf5170fe) Signed-off-by: Hui Wang --- sound/hda/intel-dsp-config.c | 220 ++++++++++++++++++++++++++--------- 1 file changed, 164 insertions(+), 56 deletions(-) diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c index d9f6d9e872b4..0b2a7201a46a 100644 --- a/sound/hda/intel-dsp-config.c +++ b/sound/hda/intel-dsp-config.c @@ -30,45 +30,98 @@ struct config_entry { * - the first successful match will win */ static const struct config_entry config_table[] = { -/* Cometlake-LP */ -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_LP) +/* Merrifield */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD) { - /* prefer SST */ - .flags = FLAG_SST, - .device = 0x02c8, + .flags = FLAG_SOF, + .device = 0x119a, }, -#elif IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) +#endif +/* Broxton-T */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) { .flags = FLAG_SOF, - .device = 0x02c8, + .device = 0x1a98, }, #endif -/* Cometlake-H */ -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_H) +/* + * Apollolake (Broxton-P) + * the legacy HDaudio driver is used except on Up Squared (SOF) and + * Chromebooks (SST) + */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) { - .flags = FLAG_SST, - .device = 0x06c8, + .flags = FLAG_SOF, + .device = 0x5a98, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Up Squared", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), + DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"), + } + }, + {} + } }, -#elif IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) +#endif +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL) { - .flags = FLAG_SOF, - .device = 0x06c8, + .flags = FLAG_SST, + .device = 0x5a98, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } }, #endif -/* Merrifield */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD) +/* + * Skylake and Kabylake use legacy HDaudio driver except for Google + * Chromebooks (SST) + */ + +/* Sunrise Point-LP */ +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL) { - .flags = FLAG_SOF, - .device = 0x119a, + .flags = FLAG_SST, + .device = 0x9d70, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } }, #endif -/* Broxton-T */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) +/* Kabylake-LP */ +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL) { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0x1a98, + .flags = FLAG_SST, + .device = 0x9d71, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } }, #endif + +/* + * Geminilake uses legacy HDaudio driver except for Google + * Chromebooks + */ /* Geminilake */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_GEMINILAKE) { @@ -85,84 +138,139 @@ static const struct config_entry config_table[] = { } }, #endif -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_GLK) + +/* + * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy + * HDaudio driver except for Google Chromebooks and when DMICs are + * present. Two cases are required since Coreboot does not expose NHLT + * tables. + * + * When the Chromebook quirk is not present, it's based on information + * that no such device exists. When the quirk is present, it could be + * either based on product information or a placeholder. + */ + +/* Cannonlake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_CANNONLAKE) { - .flags = FLAG_SST, - .device = 0x3198, + .flags = FLAG_SOF, + .device = 0x9dc8, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } }, -#endif -/* Icelake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE) { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0x34c8, + .device = 0x9dc8, }, #endif -/* Elkhart Lake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE) + +/* Coffelake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE) + { + .flags = FLAG_SOF, + .device = 0xa348, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0x4b55, + .device = 0xa348, }, #endif -/* Appololake (Broxton-P) */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) + +/* Cometlake-LP */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) { .flags = FLAG_SOF, - .device = 0x5a98, + .device = 0x02c8, .dmi_table = (const struct dmi_system_id []) { { - .ident = "Up Squared", + .ident = "Google Chromebooks", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "AAEON"), - DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"), + DMI_MATCH(DMI_SYS_VENDOR, "Google"), } }, {} } }, -#endif -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL) { - .flags = FLAG_SST, - .device = 0x5a98, + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, + .device = 0x02c8, }, #endif -/* Cannonlake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_CANNONLAKE) +/* Cometlake-H */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0x9dc8, + .device = 0x06c8, }, #endif -/* Sunrise Point-LP */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_SKYLAKE) + +/* Icelake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE) { - .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0x9d70, + .flags = FLAG_SOF, + .device = 0x34c8, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } }, -#endif -/* Kabylake-LP */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_KABYLAKE) { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0x9d71, + .device = 0x34c8, }, #endif + /* Tigerlake */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE) + { + .flags = FLAG_SOF, + .device = 0xa0c8, + .dmi_table = (const struct dmi_system_id []) { + { + .ident = "Google Chromebooks", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Google"), + } + }, + {} + } + }, + { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, .device = 0xa0c8, }, #endif -/* Coffelake */ -#if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE) + +/* Elkhart Lake */ +#if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE) { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC, - .device = 0xa348, + .device = 0x4b55, }, #endif + }; static const struct config_entry *snd_intel_dsp_find_config From patchwork Tue Apr 7 07:14:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1267267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xJZt0PQYz9sSc; Tue, 7 Apr 2020 17:15:18 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jLiS1-0006hq-CG; Tue, 07 Apr 2020 07:15:13 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiRz-0006gw-Ff for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:11 +0000 Received: from [114.254.47.51] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiRy-0001HR-6v for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:10 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E][PATCH 3/6] ALSA: hda: Allow non-Intel device probe gracefully Date: Tue, 7 Apr 2020 15:14:39 +0800 Message-Id: <20200407071448.16335-4-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407071448.16335-1-hui.wang@canonical.com> References: <20200407071448.16335-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Takashi Iwai BugLink: https://bugs.launchpad.net/bugs/1871284 The recent addition of snd_intel_dsp_driver_probe() check caused a spurious kernel warning when the driver is loaded for a non-Intel hardware due to snd_BUG_ON(). Moreover, for such a hardware, we should always return SND_INTEL_DSP_DRIVER_ANY, not check the dsp_driver option at all. This patch fixes these issues for non-Intel devices. Fixes: 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code") Signed-off-by: Takashi Iwai Link: https://lore.kernel.org/r/20191028130634.3501-1-tiwai@suse.de Signed-off-by: Takashi Iwai (cherry picked from commit 91636a82044a2821201b54faac4d1d2425260842) Signed-off-by: Hui Wang --- sound/hda/intel-dsp-config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c index 0b2a7201a46a..be1df80ed013 100644 --- a/sound/hda/intel-dsp-config.c +++ b/sound/hda/intel-dsp-config.c @@ -307,13 +307,13 @@ 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)) + if (pci->vendor != 0x8086) return SND_INTEL_DSP_DRIVER_ANY; + if (dsp_driver > 0 && dsp_driver <= SND_INTEL_DSP_DRIVER_LAST) + return dsp_driver; + /* * detect DSP by checking class/subclass/prog-id information * class=04 subclass 03 prog-if 00: no DSP, use legacy driver From patchwork Tue Apr 7 07:14:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1267272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xJb93d6xz9sSj; Tue, 7 Apr 2020 17:15:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jLiSG-0006tW-O4; Tue, 07 Apr 2020 07:15:28 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiS1-0006hs-Rq for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:13 +0000 Received: from [114.254.47.51] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiS0-0001HR-Hv for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:13 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E][PATCH 4/6] ALSA: hda: More constifications Date: Tue, 7 Apr 2020 15:14:40 +0800 Message-Id: <20200407071448.16335-5-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407071448.16335-1-hui.wang@canonical.com> References: <20200407071448.16335-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Takashi Iwai BugLink: https://bugs.launchpad.net/bugs/1871284 Apply const prefix to the remaining possible places: the string tables, the rate tables, the verb tables, the index tables, etc. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-10-tiwai@suse.de Signed-off-by: Takashi Iwai (cherry picked from commit bf82326fce53321c3f9088874dc12dcbd6d0ca06) Signed-off-by: Hui Wang --- sound/hda/hdac_device.c | 4 ++-- sound/hda/hdmi_chmap.c | 2 +- sound/hda/intel-nhlt.c | 2 +- sound/pci/hda/hda_codec.c | 6 +++--- sound/pci/hda/hda_eld.c | 6 +++--- sound/pci/hda/hda_intel.c | 8 ++++---- sound/pci/hda/hda_proc.c | 2 +- sound/pci/hda/hda_sysfs.c | 2 +- sound/pci/hda/patch_analog.c | 2 +- sound/pci/hda/patch_ca0132.c | 18 +++++++++--------- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index b26cc93e7e10..33a69751a8dd 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -639,7 +639,7 @@ struct hda_vendor_id { const char *name; }; -static struct hda_vendor_id hda_vendor_ids[] = { +static const struct hda_vendor_id hda_vendor_ids[] = { { 0x1002, "ATI" }, { 0x1013, "Cirrus Logic" }, { 0x1057, "Motorola" }, @@ -694,7 +694,7 @@ struct hda_rate_tbl { (AC_FMT_BASE_##base##K | (((mult) - 1) << AC_FMT_MULT_SHIFT) | \ (((div) - 1) << AC_FMT_DIV_SHIFT)) -static struct hda_rate_tbl rate_bits[] = { +static const struct hda_rate_tbl rate_bits[] = { /* rate in Hz, ALSA rate bitmask, HDA format value */ /* autodetected value used in snd_hda_query_supported_pcm */ diff --git a/sound/hda/hdmi_chmap.c b/sound/hda/hdmi_chmap.c index 886cb7811bd6..5fd6d575e123 100644 --- a/sound/hda/hdmi_chmap.c +++ b/sound/hda/hdmi_chmap.c @@ -59,7 +59,7 @@ static const char * const cea_speaker_allocation_names[] = { /* * ELD SA bits in the CEA Speaker Allocation data block */ -static int eld_speaker_allocation_bits[] = { +static const int eld_speaker_allocation_bits[] = { [0] = FL | FR, [1] = LFE, [2] = FC, diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c index 097ff6c10099..99a23fe7fab9 100644 --- a/sound/hda/intel-nhlt.c +++ b/sound/hda/intel-nhlt.c @@ -7,7 +7,7 @@ #define NHLT_ACPI_HEADER_SIG "NHLT" /* Unique identification for getting NHLT blobs */ -static guid_t osc_guid = +static const guid_t osc_guid = GUID_INIT(0xA69F886E, 0x6CEB, 0x4594, 0xA4, 0x1F, 0x7B, 0x5D, 0xCE, 0x24, 0xC5, 0x53); diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index a2fb19129219..bd518fe8b2ce 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3201,7 +3201,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type) /* assigned to static slots up to dev#10; if more needed, assign * the later slot dynamically (when CONFIG_SND_DYNAMIC_MINORS=y) */ - static int audio_idx[HDA_PCM_NTYPES][5] = { + static const int audio_idx[HDA_PCM_NTYPES][5] = { [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 }, [HDA_PCM_TYPE_SPDIF] = { 1, -1 }, [HDA_PCM_TYPE_HDMI] = { 3, 7, 8, 9, -1 }, @@ -3869,7 +3869,7 @@ EXPORT_SYMBOL_GPL(snd_hda_get_default_vref); unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, hda_nid_t pin, unsigned int val) { - static unsigned int cap_lists[][2] = { + static const unsigned int cap_lists[][2] = { { AC_PINCTL_VREF_100, AC_PINCAP_VREF_100 }, { AC_PINCTL_VREF_80, AC_PINCAP_VREF_80 }, { AC_PINCTL_VREF_50, AC_PINCAP_VREF_50 }, @@ -4014,7 +4014,7 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus) */ void snd_print_pcm_bits(int pcm, char *buf, int buflen) { - static unsigned int bits[] = { 8, 16, 20, 24, 32 }; + static const unsigned int bits[] = { 8, 16, 20, 24, 32 }; int i, j; for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++) diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index d081fb2880a0..bb46c89b7f63 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -98,7 +98,7 @@ static const char * const cea_audio_coding_type_names[] = { /* * SS1:SS0 index => sample size */ -static int cea_sample_sizes[4] = { +static const int cea_sample_sizes[4] = { 0, /* 0: Refer to Stream Header */ AC_SUPPCM_BITS_16, /* 1: 16 bits */ AC_SUPPCM_BITS_20, /* 2: 20 bits */ @@ -108,7 +108,7 @@ static int cea_sample_sizes[4] = { /* * SF2:SF1:SF0 index => sampling frequency */ -static int cea_sampling_frequencies[8] = { +static const int cea_sampling_frequencies[8] = { 0, /* 0: Refer to Stream Header */ SNDRV_PCM_RATE_32000, /* 1: 32000Hz */ SNDRV_PCM_RATE_44100, /* 2: 44100Hz */ @@ -352,7 +352,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, */ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen) { - static unsigned int alsa_rates[] = { + static const unsigned int alsa_rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, 384000 }; diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index caa8dbe3966f..2c7d7cd5e075 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -374,7 +374,7 @@ enum { #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) #define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) -static char *driver_short_names[] = { +static const char * const driver_short_names[] = { [AZX_DRIVER_ICH] = "HDA Intel", [AZX_DRIVER_PCH] = "HDA Intel PCH", [AZX_DRIVER_SCH] = "HDA Intel MID", @@ -500,7 +500,7 @@ static void bxt_reduce_dma_latency(struct azx *chip) static int intel_get_lctl_scf(struct azx *chip) { struct hdac_bus *bus = azx_bus(chip); - static int preferred_bits[] = { 2, 3, 1, 4, 5 }; + static const int preferred_bits[] = { 2, 3, 1, 4, 5 }; u32 val, t; int i; @@ -1515,7 +1515,7 @@ static int check_position_fix(struct azx *chip, int fix) static void assign_position_fix(struct azx *chip, int fix) { - static azx_get_pos_callback_t callbacks[] = { + static const azx_get_pos_callback_t callbacks[] = { [POS_FIX_AUTO] = NULL, [POS_FIX_LPIB] = azx_get_pos_lpib, [POS_FIX_POSBUF] = azx_get_pos_posbuf, @@ -2249,7 +2249,7 @@ static void set_default_power_save(struct azx *chip) } /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ -static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { +static const unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { [AZX_DRIVER_NVIDIA] = 8, [AZX_DRIVER_TERA] = 1, }; diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 468836c65445..0631f31ef87f 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -160,7 +160,7 @@ static void print_amp_vals(struct snd_info_buffer *buffer, static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) { - static unsigned int rates[] = { + static const unsigned int rates[] = { 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000, 384000 }; diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c index fcc34417cbce..0607ed5d1959 100644 --- a/sound/pci/hda/hda_sysfs.c +++ b/sound/pci/hda/hda_sysfs.c @@ -611,7 +611,7 @@ struct hda_patch_item { void (*parser)(char *buf, struct hda_bus *bus, struct hda_codec **retc); }; -static struct hda_patch_item patch_items[NUM_LINE_MODES] = { +static const struct hda_patch_item patch_items[NUM_LINE_MODES] = { [LINE_MODE_CODEC] = { .tag = "[codec]", .parser = parse_codec_mode, diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index bc9dd8e6fd86..261e651135f8 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -812,7 +812,7 @@ static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) /* we create four static faked paths, since AD codecs have odd * widget connections regarding the SPDIF out source */ - static struct nid_path fake_paths[4] = { + static const struct nid_path fake_paths[4] = { { .depth = 3, .path = { 0x02, 0x1d, 0x1b }, diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 32ed46464af7..212f169f5bc9 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -3768,7 +3768,7 @@ static const unsigned int float_xbass_xover_lookup[] = { /* The following are for tuning of products */ #ifdef ENABLE_TUNING_CONTROLS -static unsigned int voice_focus_vals_lookup[] = { +static const unsigned int voice_focus_vals_lookup[] = { 0x41A00000, 0x41A80000, 0x41B00000, 0x41B80000, 0x41C00000, 0x41C80000, 0x41D00000, 0x41D80000, 0x41E00000, 0x41E80000, 0x41F00000, 0x41F80000, 0x42000000, 0x42040000, 0x42080000, 0x420C0000, 0x42100000, 0x42140000, @@ -3798,7 +3798,7 @@ static unsigned int voice_focus_vals_lookup[] = { 0x43300000, 0x43310000, 0x43320000, 0x43330000, 0x43340000 }; -static unsigned int mic_svm_vals_lookup[] = { +static const unsigned int mic_svm_vals_lookup[] = { 0x00000000, 0x3C23D70A, 0x3CA3D70A, 0x3CF5C28F, 0x3D23D70A, 0x3D4CCCCD, 0x3D75C28F, 0x3D8F5C29, 0x3DA3D70A, 0x3DB851EC, 0x3DCCCCCD, 0x3DE147AE, 0x3DF5C28F, 0x3E051EB8, 0x3E0F5C29, 0x3E19999A, 0x3E23D70A, 0x3E2E147B, @@ -3818,7 +3818,7 @@ static unsigned int mic_svm_vals_lookup[] = { 0x3F75C28F, 0x3F7851EC, 0x3F7AE148, 0x3F7D70A4, 0x3F800000 }; -static unsigned int equalizer_vals_lookup[] = { +static const unsigned int equalizer_vals_lookup[] = { 0xC1C00000, 0xC1B80000, 0xC1B00000, 0xC1A80000, 0xC1A00000, 0xC1980000, 0xC1900000, 0xC1880000, 0xC1800000, 0xC1700000, 0xC1600000, 0xC1500000, 0xC1400000, 0xC1300000, 0xC1200000, 0xC1100000, 0xC1000000, 0xC0E00000, @@ -3831,7 +3831,7 @@ static unsigned int equalizer_vals_lookup[] = { }; static int tuning_ctl_set(struct hda_codec *codec, hda_nid_t nid, - unsigned int *lookup, int idx) + const unsigned int *lookup, int idx) { int i = 0; @@ -7642,14 +7642,14 @@ static void ca0132_init_unsol(struct hda_codec *codec) */ /* Sends before DSP download. */ -static struct hda_verb ca0132_base_init_verbs[] = { +static const struct hda_verb ca0132_base_init_verbs[] = { /*enable ct extension*/ {0x15, VENDOR_CHIPIO_CT_EXTENSIONS_ENABLE, 0x1}, {} }; /* Send at exit. */ -static struct hda_verb ca0132_base_exit_verbs[] = { +static const struct hda_verb ca0132_base_exit_verbs[] = { /*set afg to D3*/ {0x01, AC_VERB_SET_POWER_STATE, 0x03}, /*disable ct extension*/ @@ -7659,7 +7659,7 @@ static struct hda_verb ca0132_base_exit_verbs[] = { /* Other verbs tables. Sends after DSP download. */ -static struct hda_verb ca0132_init_verbs0[] = { +static const struct hda_verb ca0132_init_verbs0[] = { /* chip init verbs */ {0x15, 0x70D, 0xF0}, {0x15, 0x70E, 0xFE}, @@ -7692,7 +7692,7 @@ static struct hda_verb ca0132_init_verbs0[] = { }; /* Extra init verbs for desktop cards. */ -static struct hda_verb ca0132_init_verbs1[] = { +static const struct hda_verb ca0132_init_verbs1[] = { {0x15, 0x70D, 0x20}, {0x15, 0x70E, 0x19}, {0x15, 0x707, 0x00}, @@ -8869,7 +8869,7 @@ static int patch_ca0132(struct hda_codec *codec) /* * patch entries */ -static struct hda_device_id snd_hda_id_ca0132[] = { +static const struct hda_device_id snd_hda_id_ca0132[] = { HDA_CODEC_ENTRY(0x11020011, "CA0132", patch_ca0132), {} /* terminator */ }; From patchwork Tue Apr 7 07:14:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1267268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xJZz2dQ6z9sSj; Tue, 7 Apr 2020 17:15:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jLiS7-0006ls-9n; Tue, 07 Apr 2020 07:15:19 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiS4-0006jA-2V for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:16 +0000 Received: from [114.254.47.51] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiS2-0001HR-AZ for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:15 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E][PATCH 5/6] ALSA: hda: Rename back to dmic_detect option Date: Tue, 7 Apr 2020 15:14:41 +0800 Message-Id: <20200407071448.16335-6-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407071448.16335-1-hui.wang@canonical.com> References: <20200407071448.16335-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Takashi Iwai BugLink: https://bugs.launchpad.net/bugs/1871284 We've got quite a few bug reports showing the SOF driver being loaded unintentionally recently, and the reason seems to be that users didn't know the module option change: with the recent kernel, a new option dsp_driver=1 has to be passed to a new module snd-intel-dspcfg instead of snd_hda_intel.dmic_detect=0 option. That is, actually there are two tricky things here: - We changed the whole detection in another module and another option semantics. - The existing option for skipping the DSP probe was also renamed. For avoiding the confusion and giving user more hint, this patch reverts the renamed option dsp_driver back to dmic_detect for snd-hda-intel module, and show the warning about the module option change when the non-default value is passed. Fixes: 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code") Link: https://lore.kernel.org/r/20200109082000.26729-1-tiwai@suse.de Signed-off-by: Takashi Iwai (cherry picked from commit 7fba6aea4472f01a404d81a12237ae9a1ff418ce) Signed-off-by: Hui Wang --- sound/pci/hda/hda_intel.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 2c7d7cd5e075..41bab457d768 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -126,7 +126,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 dsp_driver = 1; +static bool dmic_detect = 1; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); @@ -161,9 +161,10 @@ 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(dsp_driver, bool, 0444); -MODULE_PARM_DESC(dsp_driver, "Allow DSP driver selection (bypass this driver) " - "(0=off, 1=on) (default=1)"); +module_param(dmic_detect, bool, 0444); +MODULE_PARM_DESC(dmic_detect, "Allow DSP driver selection (bypass this driver) " + "(0=off, 1=on) (default=1); " + "deprecated, use snd-intel-dspcfg.dsp_driver option instead"); #ifdef CONFIG_PM static int param_set_xint(const char *val, const struct kernel_param *kp); @@ -2117,11 +2118,13 @@ static int azx_probe(struct pci_dev *pci, /* * stop probe if another Intel's DSP driver should be activated */ - if (dsp_driver) { + if (dmic_detect) { err = snd_intel_dsp_driver_probe(pci); if (err != SND_INTEL_DSP_DRIVER_ANY && err != SND_INTEL_DSP_DRIVER_LEGACY) return -ENODEV; + } else { + dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n"); } err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, From patchwork Tue Apr 7 07:14:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1267269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xJb13w62z9sSq; Tue, 7 Apr 2020 17:15:24 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jLiS8-0006mo-L5; Tue, 07 Apr 2020 07:15:20 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiS4-0006kN-Vy for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:16 +0000 Received: from [114.254.47.51] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLiS4-0001HR-3V for kernel-team@lists.ubuntu.com; Tue, 07 Apr 2020 07:15:16 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E][PATCH 6/6] UBUNTU: [Config] SND_INTEL_DSP_CONFIG=m Date: Tue, 7 Apr 2020 15:14:42 +0800 Message-Id: <20200407071448.16335-7-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200407071448.16335-1-hui.wang@canonical.com> References: <20200407071448.16335-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1871284 Signed-off-by: Hui Wang --- debian.master/config/annotations | 5 +++++ debian.master/config/config.common.ubuntu | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian.master/config/annotations b/debian.master/config/annotations index bb736bc403da..af3c4ef1bf74 100644 --- a/debian.master/config/annotations +++ b/debian.master/config/annotations @@ -8106,6 +8106,11 @@ CONFIG_SND_HDA_POWER_SAVE_DEFAULT policy<{'amd64': '1', 'arm64': ' CONFIG_SND_HDA_RECONFIG note CONFIG_SND_HDA_POWER_SAVE_DEFAULT note +CONFIG_SND_INTEL_NHLT policy<{'amd64': 'y', 'arm64': 'n', 'armhf': 'n', 'i386': 'y', 'ppc64el': 'n'}> +CONFIG_SND_INTEL_NHLT note +CONFIG_SND_INTEL_DSP_CONFIG policy<{'amd64': 'm', 'arm64': 'n', 'armhf': 'n', 'i386': 'm', 'ppc64el': 'n'}> +CONFIG_SND_INTEL_DSP_CONFIG note + # Menu: Device Drivers >> Sound card support >> Advanced Linux Sound Architecture >> ISA sound devices CONFIG_SND_ISA policy<{'i386': 'y'}> CONFIG_SND_ADLIB policy<{'i386': 'm'}> diff --git a/debian.master/config/config.common.ubuntu b/debian.master/config/config.common.ubuntu index 4dbec05c6dbf..3568f6ab9848 100644 --- a/debian.master/config/config.common.ubuntu +++ b/debian.master/config/config.common.ubuntu @@ -8881,7 +8881,8 @@ CONFIG_SND_INDIGOIO=m CONFIG_SND_INDIGOIOX=m CONFIG_SND_INTEL8X0=m CONFIG_SND_INTEL8X0M=m -CONFIG_SND_INTEL_NHLT=m +CONFIG_SND_INTEL_NHLT=y +CONFIG_SND_INTEL_DSP_CONFIG=m CONFIG_SND_INTERWAVE=m CONFIG_SND_INTERWAVE_STB=m CONFIG_SND_ISA=y