From 3f0ba641cb0865e4ffaa6d7797e582fbfb0dd7dd Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: May 03 2020 13:36:10 +0000 Subject: Update to 5.4.38 --- diff --git a/.kernel.metadata b/.kernel.metadata index df0b3b5..99eaf48 100644 --- a/.kernel.metadata +++ b/.kernel.metadata @@ -1,2 +1,2 @@ 98ae49ad49397d5a4dcb3ff9a082223edf7c5bbd SOURCES/linux-5.4.tar.xz -c2fbd97eb5dbc30cbf4f125043ba272eeec7ddfa SOURCES/patch-5.4.28.xz +5857823d44cc11172b20d6e2667567441d9b6c7c SOURCES/patch-5.4.38.xz diff --git a/SOURCES/alsa-5.5.patch b/SOURCES/alsa-5.5.patch deleted file mode 100644 index b7ab52d..0000000 --- a/SOURCES/alsa-5.5.patch +++ /dev/null @@ -1,10817 +0,0 @@ -From 79b0618304c9a7512aba223ae187a8405656aa8e Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Sun, 25 Nov 2018 23:12:08 +0000 -Subject: [PATCH 001/109] ALSA: usb-audio: fix spelling mistake "Frequence" -> - "Frequency" - -There are spelling mistakes in equalizer name fields, fix them. - -Signed-off-by: Colin Ian King -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 940f457392e684bf0005628f6a155040648c5894) -Bugzilla: 1772498 ---- - sound/usb/mixer_us16x08.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c -index f0e8e1539450..aea3b4ad7ded 100644 ---- a/sound/usb/mixer_us16x08.c -+++ b/sound/usb/mixer_us16x08.c -@@ -1109,7 +1109,7 @@ static const struct snd_us16x08_control_params eq_controls[] = { - .control_id = SND_US16X08_ID_EQLOWFREQ, - .type = USB_MIXER_U8, - .num_channels = 16, -- .name = "EQ Low Frequence", -+ .name = "EQ Low Frequency", - }, - { /* EQ mid low gain */ - .kcontrol_new = &snd_us16x08_eq_gain_ctl, -@@ -1123,7 +1123,7 @@ static const struct snd_us16x08_control_params eq_controls[] = { - .control_id = SND_US16X08_ID_EQLOWMIDFREQ, - .type = USB_MIXER_U8, - .num_channels = 16, -- .name = "EQ MidLow Frequence", -+ .name = "EQ MidLow Frequency", - }, - { /* EQ mid low Q */ - .kcontrol_new = &snd_us16x08_eq_mid_width_ctl, -@@ -1144,7 +1144,7 @@ static const struct snd_us16x08_control_params eq_controls[] = { - .control_id = SND_US16X08_ID_EQHIGHMIDFREQ, - .type = USB_MIXER_U8, - .num_channels = 16, -- .name = "EQ MidHigh Frequence", -+ .name = "EQ MidHigh Frequency", - }, - { /* EQ mid high Q */ - .kcontrol_new = &snd_us16x08_eq_mid_width_ctl, -@@ -1165,7 +1165,7 @@ static const struct snd_us16x08_control_params eq_controls[] = { - .control_id = SND_US16X08_ID_EQHIGHFREQ, - .type = USB_MIXER_U8, - .num_channels = 16, -- .name = "EQ High Frequence", -+ .name = "EQ High Frequency", - }, - }; - --- -2.24.1 - -From 042dd0cc1f179d52acfea699239b87ef93dbd70d Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 14 Nov 2019 17:56:13 +0100 -Subject: [PATCH 003/109] ALSA: usb-audio: Add skip_validation option - -The unit descriptor validation may lead to a probe error when the -device provides a buggy descriptor or the validator detected -incorrectly. For identifying such an error and band-aiding, give a -new module option, skip_validation. With this option, the driver -ignores the validation errors with the hexdump of the unit -descriptor, so we can check it in a bit more details. - -Link: https://lore.kernel.org/r/20191114165613.7422-2-tiwai@suse.de -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit f35ef592477c5347b8f780a5f0d4970671e22c61) -Bugzilla: 1772498 ---- - sound/usb/card.c | 3 +++ - sound/usb/usbaudio.h | 1 + - sound/usb/validate.c | 23 ++++++++++++++++++++--- - 3 files changed, 24 insertions(+), 3 deletions(-) - -diff --git a/sound/usb/card.c b/sound/usb/card.c -index db91dc76cc91..9f743ebae615 100644 ---- a/sound/usb/card.c -+++ b/sound/usb/card.c -@@ -74,6 +74,7 @@ static bool autoclock = true; - static char *quirk_alias[SNDRV_CARDS]; - - bool snd_usb_use_vmalloc = true; -+bool snd_usb_skip_validation; - - module_param_array(index, int, NULL, 0444); - MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); -@@ -96,6 +97,8 @@ module_param_array(quirk_alias, charp, NULL, 0444); - MODULE_PARM_DESC(quirk_alias, "Quirk aliases, e.g. 0123abcd:5678beef."); - module_param_named(use_vmalloc, snd_usb_use_vmalloc, bool, 0444); - MODULE_PARM_DESC(use_vmalloc, "Use vmalloc for PCM intermediate buffers (default: yes)."); -+module_param_named(skip_validation, snd_usb_skip_validation, bool, 0444); -+MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no)."); - - /* - * we keep the snd_usb_audio_t instances by ourselves for merging -diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h -index e360680f45f3..6fe3ab582ec6 100644 ---- a/sound/usb/usbaudio.h -+++ b/sound/usb/usbaudio.h -@@ -121,5 +121,6 @@ int snd_usb_lock_shutdown(struct snd_usb_audio *chip); - void snd_usb_unlock_shutdown(struct snd_usb_audio *chip); - - extern bool snd_usb_use_vmalloc; -+extern bool snd_usb_skip_validation; - - #endif /* __USBAUDIO_H */ -diff --git a/sound/usb/validate.c b/sound/usb/validate.c -index 5a3c4f7882b0..c43d8c3895a9 100644 ---- a/sound/usb/validate.c -+++ b/sound/usb/validate.c -@@ -322,11 +322,28 @@ static bool validate_desc(unsigned char *hdr, int protocol, - - bool snd_usb_validate_audio_desc(void *p, int protocol) - { -- return validate_desc(p, protocol, audio_validators); -+ unsigned char *c = p; -+ bool valid; -+ -+ valid = validate_desc(p, protocol, audio_validators); -+ if (!valid && snd_usb_skip_validation) { -+ print_hex_dump(KERN_ERR, "USB-audio: buggy audio desc: ", -+ DUMP_PREFIX_NONE, 16, 1, c, c[0], true); -+ valid = true; -+ } -+ return valid; - } - - bool snd_usb_validate_midi_desc(void *p) - { -- return validate_desc(p, UAC_VERSION_1, midi_validators); -+ unsigned char *c = p; -+ bool valid; -+ -+ valid = validate_desc(p, UAC_VERSION_1, midi_validators); -+ if (!valid && snd_usb_skip_validation) { -+ print_hex_dump(KERN_ERR, "USB-audio: buggy midi desc: ", -+ DUMP_PREFIX_NONE, 16, 1, c, c[0], true); -+ valid = true; -+ } -+ return valid; - } -- --- -2.24.1 - -From 8d5568b5492d468acd4a49eefccaaed28dc62d22 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 22 Oct 2019 19:43:12 +0200 -Subject: [PATCH 004/109] ALSA: hda: add Intel DSP configuration / probe code - -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 - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 82d9d54a6c0ee8b12211fa4e59fd940a2da4e063) -Bugzilla: 1772498 ---- - 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 | 2 +- - sound/soc/sof/sof-pci-dev.c | 6 + - 11 files changed, 322 insertions(+), 68 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 3d33fc1757ba..b0c88fe040ee 100644 ---- a/sound/hda/Kconfig -+++ b/sound/hda/Kconfig -@@ -34,6 +34,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 dae47a45b2b8..bd48335d09d7 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 85beb172d810..2888f710e7e1 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 -@@ -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 dsp_driver = 1; - - module_param_array(index, int, NULL, 0444); - MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); -@@ -159,8 +159,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); -@@ -2030,25 +2031,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) - { -@@ -2066,6 +2048,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) { -@@ -2079,17 +2071,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 ef493cae78ff..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 if ACPI -+ 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 141dbbf975ac..58ba3e9469ba 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" -@@ -987,22 +988,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 8421b97d949e..d6d65e70eebb 100644 ---- a/sound/soc/sof/intel/Kconfig -+++ b/sound/soc/sof/intel/Kconfig -@@ -304,7 +304,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_NHLT if ACPI -+ 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 d66412a77873..3a9e0e2a150d 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 -@@ -277,6 +278,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 */ --- -2.24.1 - -From 08086a70efd7f4db4645e2a7b60b2aba4b620b18 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Tue, 22 Oct 2019 19:43:13 +0200 -Subject: [PATCH 005/109] ALSA: hda: fix intel DSP config - -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 - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit cc8f81c7e625168a60843b2b39e3a327cf5170fe) -Bugzilla: 1772498 ---- - 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 --- -2.24.1 - -From 5cd51df6f836090343aadd7ea4eacfde511660ad Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 28 Oct 2019 17:46:24 +0100 -Subject: [PATCH 006/109] ASoC: intel - fix the card names - -Those strings are exposed to the user space as the -card name thus used in the GUIs. The common -standard is to avoid '_' here. The worst case -is 'sof-skl_hda_card' string. - -Signed-off-by: Jaroslav Kysela -Cc: Pierre-Louis Bossart -Cc: Mark Brown -Acked-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191028164624.14334-1-perex@perex.cz -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit d745cc1ab65945b2d17ec9c5652f38299c054649) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 2 +- - sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 +- - sound/soc/intel/boards/sof_rt5682.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -index 67b276a65a8d..8ad31c91fc75 100644 ---- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -+++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -@@ -626,7 +626,7 @@ static int kabylake_card_late_probe(struct snd_soc_card *card) - * kabylake audio machine driver for MAX98927 + RT5514 + RT5663 - */ - static struct snd_soc_card kabylake_audio_card = { -- .name = "kbl_r5514_5663_max", -+ .name = "kbl-r5514-5663-max", - .owner = THIS_MODULE, - .dai_link = kabylake_dais, - .num_links = ARRAY_SIZE(kabylake_dais), -diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c -index 1778acdc367c..e8d676c192f6 100644 ---- a/sound/soc/intel/boards/skl_hda_dsp_generic.c -+++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c -@@ -90,7 +90,7 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link) - } - - static struct snd_soc_card hda_soc_card = { -- .name = "skl_hda_card", -+ .name = "hda-dsp", - .owner = THIS_MODULE, - .dai_link = skl_hda_be_dai_links, - .dapm_widgets = skl_hda_widgets, -diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c -index 4f6e58c3954a..320a9b9273db 100644 ---- a/sound/soc/intel/boards/sof_rt5682.c -+++ b/sound/soc/intel/boards/sof_rt5682.c -@@ -370,7 +370,7 @@ static int dmic_init(struct snd_soc_pcm_runtime *rtd) - - /* sof audio machine driver for rt5682 codec */ - static struct snd_soc_card sof_audio_card_rt5682 = { -- .name = "sof_rt5682", -+ .name = "rt5682", /* the sof- prefix is added by the core */ - .owner = THIS_MODULE, - .controls = sof_controls, - .num_controls = ARRAY_SIZE(sof_controls), --- -2.24.1 - -From 6d7c3f54de921a90a4ec08f5c9570222d9f647f3 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Mon, 28 Oct 2019 14:06:34 +0100 -Subject: [PATCH 007/109] ALSA: hda: Allow non-Intel device probe gracefully - -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 - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 91636a82044a2821201b54faac4d1d2425260842) -Bugzilla: 1772498 ---- - 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 --- -2.24.1 - -From d1e23b8b780640a6bcf75c854857034c45cd99f2 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Tue, 5 Nov 2019 09:18:06 +0100 -Subject: [PATCH 008/109] ALSA: hda: Disable regmap internal locking - -Since we apply the own mutex (bus->cmd_mutex) in HDA core side, the -internal locking in regmap is superfluous. This patch adds the flag -to indicate that. - -Also, an infamous side-effect by this change is that it disables the -regmap debugfs, too, and this is seen rather good; the regmap debugfs -isn't quite useful for HD-audio as it provides the very sparse -registers and its debugfs access tends to lead to the way too high -resource usages or sometimes hang up. So it'd be rather safe to -disable it altogether. - -Link: https://lore.kernel.org/r/2029139028.10333037.1572874551626.JavaMail.zimbra@redhat.com -Link: https://lore.kernel.org/r/20191105081806.4896-1-tiwai@suse.de -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 42ec336f1f9d54049811b749f729e9e01c152ade) -Bugzilla: 1772498 ---- - sound/hda/hdac_regmap.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c -index 286361ecd640..906b1e20bae0 100644 ---- a/sound/hda/hdac_regmap.c -+++ b/sound/hda/hdac_regmap.c -@@ -363,6 +363,7 @@ static const struct regmap_config hda_regmap_cfg = { - .reg_write = hda_reg_write, - .use_single_read = true, - .use_single_write = true, -+ .disable_locking = true, - }; - - /** --- -2.24.1 - -From 0f9c61a795f0ad4faab0582c7b792cebd85976c2 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:09 +0200 -Subject: [PATCH 009/109] ALSA: hda/hdmi - implement mst_no_extra_pcms flag - -To support the DP-MST multiple streams via single connector feature, -the HDMI driver was extended with the concept of backup PCMs. See -commit 9152085defb6 ("ALSA: hda - add DP MST audio support"). - -This implementation works fine with snd_hda_intel.c as PCM topology -is fully managed within the single driver. - -When the HDA codec driver is used from ASoC components, the concept -of backup PCMs no longer fits. For ASoC topologies, the physical -HDMI converters are presented as backend DAIs and these should match -with hardware capabilities. The ASoC topology may define arbitrary -PCMs (i.e. frontend DAIs) and have processing elements before eventual -routing to the HDMI BE DAIs. With backup PCMs, the link between -FE and BE DAIs would become dynamic and change when monitors are -(un)plugged. This would lead to modifying the topology every time -hotplug events happen, which is not currently possible in ASoC and -there does not seem to be any obvious benefits from this design. - -To overcome above problems and enable the HDMI driver to be used -from ASoC, this patch adds a new mode (mst_no_extra_pcms flags) to -patch_hdmi.c. In this mode, the codec driver does not assume -the backup PCMs to be created. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-2-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 2a2edfbbfee47947dd05f5860c66c0e80ee5e09d) -Bugzilla: 1772498 ---- - include/sound/hda_codec.h | 1 + - sound/pci/hda/patch_hdmi.c | 19 ++++++++++++++----- - 2 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h -index 9a0393cf024c..ac18f428eda6 100644 ---- a/include/sound/hda_codec.h -+++ b/include/sound/hda_codec.h -@@ -254,6 +254,7 @@ struct hda_codec { - unsigned int force_pin_prefix:1; /* Add location prefix */ - unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ - unsigned int relaxed_resume:1; /* don't resume forcibly for jack */ -+ unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */ - - #ifdef CONFIG_PM - unsigned long power_on_acct; -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 8ac805a634f4..1a29453bc26f 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -2082,15 +2082,24 @@ static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) - static int generic_hdmi_build_pcms(struct hda_codec *codec) - { - struct hdmi_spec *spec = codec->spec; -- int idx; -+ int idx, pcm_num; - - /* - * for non-mst mode, pcm number is the same as before -- * for DP MST mode, pcm number is (nid number + dev_num - 1) -- * dev_num is the device entry number in a pin -- * -+ * for DP MST mode without extra PCM, pcm number is same -+ * for DP MST mode with extra PCMs, pcm number is -+ * (nid number + dev_num - 1) -+ * dev_num is the device entry number in a pin - */ -- for (idx = 0; idx < spec->num_nids + spec->dev_num - 1; idx++) { -+ -+ if (codec->mst_no_extra_pcms) -+ pcm_num = spec->num_nids; -+ else -+ pcm_num = spec->num_nids + spec->dev_num - 1; -+ -+ codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); -+ -+ for (idx = 0; idx < pcm_num; idx++) { - struct hda_pcm *info; - struct hda_pcm_stream *pstr; - --- -2.24.1 - -From 33115cd895693c04723026e19a9eee0f34c4b853 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Mon, 11 Nov 2019 20:09:37 +0100 -Subject: [PATCH 010/109] ALSA: hda/hdmi - Clean up Intel platform-specific - fixup checks - -Introduce a new flag in hdmi_spec to indicate the Intel platform- -specific fixups so that we can get rid of the lengthy codec ID -checks. The flag is set in intel_hsw_common_init() commonly. - -Reviewed-by: Kai Vehmanen -Link: https://lore.kernel.org/r/20191111190937.19186-1-tiwai@suse.de -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit cb45722b289b54476b68883985c2824c69a7fba9) -Bugzilla: 1772498 ---- - sound/pci/hda/patch_hdmi.c | 27 +++++---------------------- - 1 file changed, 5 insertions(+), 22 deletions(-) - -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 1a29453bc26f..3f97a04de197 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -38,25 +38,6 @@ static bool static_hdmi_pcm; - module_param(static_hdmi_pcm, bool, 0644); - MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); - --#define is_haswell(codec) ((codec)->core.vendor_id == 0x80862807) --#define is_broadwell(codec) ((codec)->core.vendor_id == 0x80862808) --#define is_skylake(codec) ((codec)->core.vendor_id == 0x80862809) --#define is_broxton(codec) ((codec)->core.vendor_id == 0x8086280a) --#define is_kabylake(codec) ((codec)->core.vendor_id == 0x8086280b) --#define is_geminilake(codec) (((codec)->core.vendor_id == 0x8086280d) || \ -- ((codec)->core.vendor_id == 0x80862800)) --#define is_cannonlake(codec) ((codec)->core.vendor_id == 0x8086280c) --#define is_icelake(codec) ((codec)->core.vendor_id == 0x8086280f) --#define is_tigerlake(codec) ((codec)->core.vendor_id == 0x80862812) --#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec) \ -- || is_skylake(codec) || is_broxton(codec) \ -- || is_kabylake(codec) || is_geminilake(codec) \ -- || is_cannonlake(codec) || is_icelake(codec) \ -- || is_tigerlake(codec)) --#define is_valleyview(codec) ((codec)->core.vendor_id == 0x80862882) --#define is_cherryview(codec) ((codec)->core.vendor_id == 0x80862883) --#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec)) -- - struct hdmi_spec_per_cvt { - hda_nid_t cvt_nid; - int assigned; -@@ -163,6 +144,7 @@ struct hdmi_spec { - - bool dyn_pin_out; - bool dyn_pcm_assign; -+ bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ - /* - * Non-generic VIA/NVIDIA specific - */ -@@ -926,7 +908,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, - return err; - } - -- if (is_haswell_plus(codec)) { -+ if (spec->intel_hsw_fixup) { - - /* - * on recent platforms IEC Coding Type is required for HBR -@@ -1714,7 +1696,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) - * To simplify the implementation, malloc all - * the virtual pins in the initialization statically - */ -- if (is_haswell_plus(codec)) { -+ if (spec->intel_hsw_fixup) { - /* - * On Intel platforms, device entries number is - * changed dynamically. If there is a DP MST -@@ -1763,7 +1745,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) - per_pin->dev_id = i; - per_pin->non_pcm = false; - snd_hda_set_dev_select(codec, pin_nid, i); -- if (is_haswell_plus(codec)) -+ if (spec->intel_hsw_fixup) - intel_haswell_fixup_connect_list(codec, pin_nid); - err = hdmi_read_pin_conn(codec, pin_idx); - if (err < 0) -@@ -2832,6 +2814,7 @@ static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, - spec->vendor_nid = vendor_nid; - spec->port_map = port_map; - spec->port_num = port_num; -+ spec->intel_hsw_fixup = true; - - intel_haswell_enable_all_pins(codec, true); - intel_haswell_fixup_enable_dp12(codec); --- -2.24.1 - -From 75ce7bbf2d5d1de529a07eca217e02a9897d0277 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Fri, 15 Nov 2019 14:44:47 +0200 -Subject: [PATCH 011/109] ALSA: hda: hdmi - fix port numbering for ICL and TGL - platforms - -Semantics of port#0 differ between ICL and TGL: - - ICL port#0 -> never used for HDAudio - ICL port#1 -> should be mapped to first pin (0x04) - TGL port#0 -> typically not used, but HW has the support, - so should be mapped to first pin (0x04) - TGL port#1 -> should be mapped to 2nd pin (0x06) - -Refactor the port mapping logic to allow to take the above -differences into account. Fixes issues with HDAudio on some -TGL platforms. - -Co-developed-by: Pan Xiuli -Signed-off-by: Pan Xiuli -Signed-off-by: Kai Vehmanen -Link: https://lore.kernel.org/r/20191115124449.20512-2-kai.vehmanen@linux.intel.com -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit d577cf76fa3192f9e656bb101aa54d25a6a71347) -Bugzilla: 1772498 ---- - sound/pci/hda/patch_hdmi.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 3f97a04de197..75f0d2799847 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -2671,7 +2671,7 @@ static int intel_pin2port(void *audio_ptr, int pin_nid) - */ - for (i = 0; i < spec->port_num; i++) { - if (pin_nid == spec->port_map[i]) -- return i + 1; -+ return i; - } - - /* return -1 if pin number exceeds our expectation */ -@@ -2691,9 +2691,9 @@ static int intel_port2pin(struct hda_codec *codec, int port) - return port + intel_base_nid(codec) - 1; - } - -- if (port < 1 || port > spec->port_num) -+ if (port < 0 || port >= spec->port_num) - return 0; -- return spec->port_map[port - 1]; -+ return spec->port_map[port]; - } - - static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) -@@ -2845,9 +2845,9 @@ static int patch_i915_icl_hdmi(struct hda_codec *codec) - { - /* - * pin to port mapping table where the value indicate the pin number and -- * the index indicate the port number with 1 base. -+ * the index indicate the port number. - */ -- static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb}; -+ static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb}; - - return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); - } -@@ -2856,7 +2856,7 @@ static int patch_i915_tgl_hdmi(struct hda_codec *codec) - { - /* - * pin to port mapping table where the value indicate the pin number and -- * the index indicate the port number with 1 base. -+ * the index indicate the port number. - */ - static const int map[] = {0x4, 0x6, 0x8, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf}; - --- -2.24.1 - -From a8196a93444f3ff34e15c254f68ee046bef27109 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Fri, 15 Nov 2019 14:44:48 +0200 -Subject: [PATCH 012/109] ALSA: hda: hdmi - remove redundant code comments - -Remove unnecessary comments related to pin mapping on -Intel platforms. - -Signed-off-by: Kai Vehmanen -Link: https://lore.kernel.org/r/20191115124449.20512-3-kai.vehmanen@linux.intel.com -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit c8e3eb9be57f91751aeb9397118755390dbff9a4) -Bugzilla: 1772498 ---- - sound/pci/hda/patch_hdmi.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 75f0d2799847..2044bbb830f9 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -2662,7 +2662,7 @@ static int intel_pin2port(void *audio_ptr, int pin_nid) - base_nid = intel_base_nid(codec); - if (WARN_ON(pin_nid < base_nid || pin_nid >= base_nid + 3)) - return -1; -- return pin_nid - base_nid + 1; /* intel port is 1-based */ -+ return pin_nid - base_nid + 1; - } - - /* -@@ -2674,7 +2674,6 @@ static int intel_pin2port(void *audio_ptr, int pin_nid) - return i; - } - -- /* return -1 if pin number exceeds our expectation */ - codec_info(codec, "Can't find the HDMI/DP port for pin %d\n", pin_nid); - return -1; - } -@@ -2687,7 +2686,6 @@ static int intel_port2pin(struct hda_codec *codec, int port) - /* we assume only from port-B to port-D */ - if (port < 1 || port > 3) - return 0; -- /* intel port is 1-based */ - return port + intel_base_nid(codec) - 1; - } - -@@ -2863,7 +2861,6 @@ static int patch_i915_tgl_hdmi(struct hda_codec *codec) - return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map)); - } - -- - /* Intel Baytrail and Braswell; with eld notifier */ - static int patch_i915_byt_hdmi(struct hda_codec *codec) - { --- -2.24.1 - -From ad0389ef5e486a09a98cbfacd2bf56090b1346f1 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Fri, 15 Nov 2019 14:44:49 +0200 -Subject: [PATCH 013/109] ALSA: hda - remove forced polling workaround for CFL - and CNL - -Remove the workarounds added in commit fa763f1b2858 ("ALSA: -hda - Force polling mode on CNL for fixing codec communication") -and commit a8d7bde23e71 ("ALSA: hda - Force polling mode on CFL -for fixing codec communication"). - -The workarounds are no longer needed after the more generic -change done in commit 2756d9143aa5 ("ALSA: hda - Fix intermittent -CORB/RIRB stall on Intel chips"). This change applies to a larger -set of hardware and covers CFL and CNL as well. - -Similar change was already done to SOF DSP HDA driver with -no regressions detected. - -Signed-off-by: Kai Vehmanen -Link: https://lore.kernel.org/r/20191115124449.20512-4-kai.vehmanen@linux.intel.com -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit ee906c6b9c6e7e4ad749f5cfdf65768455f4bf43) -Bugzilla: 1772498 ---- - sound/pci/hda/hda_intel.c | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 2888f710e7e1..e2c08517a24c 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -370,8 +370,6 @@ enum { - ((pci)->device == 0x160c)) - - #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) --#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[] = { - [AZX_DRIVER_ICH] = "HDA Intel", -@@ -1764,10 +1762,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, - if (!azx_snoop(chip)) - azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_UC; - -- /* Workaround for a communication error on CFL (bko#199007) and CNL */ -- if (IS_CFL(pci) || IS_CNL(pci)) -- azx_bus(chip)->polling_mode = 1; -- - if (chip->driver_type == AZX_DRIVER_NVIDIA) { - dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); - chip->bus.needs_damn_long_delay = 1; --- -2.24.1 - -From 588faa6b4c0d18c504e6c32863ef82b63b6531ec Mon Sep 17 00:00:00 2001 -From: Kuninori Morimoto -Date: Tue, 15 Oct 2019 14:44:09 +0900 -Subject: [PATCH 014/109] ASoC: sof: include types.h at header.h -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Content-Transfer-Encoding: 8bit - -Without we will get these error - -linux/include/sound/sof/header.h:125:2: error: unknown type name ‘uint32_t’uint32_t size; -linux/include/sound/sof/header.h:136:2: error: unknown type name ‘uint32_t’uint32_t size; -linux/include/sound/sof/header.h:137:2: error: unknown type name ‘uint32_t’uint32_t cmd; -... -linux/include/sound/sof/dai-imx.h:18:2: error: unknown type name ‘uint16_t’uint16_t reserved1; -linux/include/sound/sof/dai-imx.h:30:2: error: unknown type name ‘uint16_t’uint16_t tdm_slot_width; -linux/include/sound/sof/dai-imx.h:31:2: error: unknown type name ‘uint16_t’uint16_t reserved2; - -Signed-off-by: Kuninori Morimoto -Link: https://lore.kernel.org/r/87a7a24l7r.wl-kuninori.morimoto.gx@renesas.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 03048217624a9472c1c7a205c8ea9bf8d4026e59) -Bugzilla: 1772498 ---- - include/sound/sof/header.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h -index 10f00c08dbb7..332143ff7278 100644 ---- a/include/sound/sof/header.h -+++ b/include/sound/sof/header.h -@@ -9,6 +9,7 @@ - #ifndef __INCLUDE_SOUND_SOF_HEADER_H__ - #define __INCLUDE_SOUND_SOF_HEADER_H__ - -+#include - #include - - /** \addtogroup sof_uapi uAPI --- -2.24.1 - -From 0378a1586c604515d4084c29ae689b5700315b7f Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 27 Sep 2019 15:05:28 -0500 -Subject: [PATCH 015/109] ASoC: SOF: trace: move to opt-in with Kconfig and - module parameter - -In a number of debug cases, the DMA-based trace can add problems -(e.g. with HDaudio channel allocation). It also generates additional -traffic on the bus and if the DMA handling is unreliable will prevent -audio use-cases from working normally. Using the trace also requires -tools to be installed on the target. - -The trace can be instead handled as dynamic debug. We can use a -Kconfig to force the trace to be enabled in all cases, or use a module -parameter to enable it on a need-basis, e.g. by setting "options -snd_sof sof_debug=0x1" in a /etc/modprobe.d file. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20190927200538.660-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 2ab4c50f6955514150f83b47b7aee3ba5fe3ac1d) -Bugzilla: 1772498 ---- - sound/soc/sof/Kconfig | 8 ++++++++ - sound/soc/sof/core.c | 25 +++++++++++++++++++------ - sound/soc/sof/sof-priv.h | 13 +++++++++---- - sound/soc/sof/trace.c | 17 ++++++++++++++++- - 4 files changed, 52 insertions(+), 11 deletions(-) - -diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig -index bb8036ae567e..cc592bcadae7 100644 ---- a/sound/soc/sof/Kconfig -+++ b/sound/soc/sof/Kconfig -@@ -142,6 +142,14 @@ config SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE - Say Y if you want to enable caching the memory windows. - If unsure, select "N". - -+config SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE -+ bool "SOF enable firmware trace" -+ help -+ The firmware trace can be enabled either at build-time with -+ this option, or dynamically by setting flags in the SOF core -+ module parameter (similar to dynamic debug) -+ If unsure, select "N". -+ - config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST - bool "SOF enable IPC flood test" - help -diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c -index 12aec140819a..1e7addfc0f61 100644 ---- a/sound/soc/sof/core.c -+++ b/sound/soc/sof/core.c -@@ -16,6 +16,11 @@ - #include "sof-priv.h" - #include "ops.h" - -+/* see SOF_DBG_ flags */ -+int sof_core_debug; -+module_param_named(sof_debug, sof_core_debug, int, 0444); -+MODULE_PARM_DESC(sof_debug, "SOF core debug options (0x0 all off)"); -+ - /* SOF defaults if not provided by the platform in ms */ - #define TIMEOUT_DEFAULT_IPC_MS 500 - #define TIMEOUT_DEFAULT_BOOT_MS 2000 -@@ -397,12 +402,20 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) - goto fw_run_err; - } - -- /* init DMA trace */ -- ret = snd_sof_init_trace(sdev); -- if (ret < 0) { -- /* non fatal */ -- dev_warn(sdev->dev, -- "warning: failed to initialize trace %d\n", ret); -+ if (IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE) || -+ (sof_core_debug & SOF_DBG_ENABLE_TRACE)) { -+ sdev->dtrace_is_supported = true; -+ -+ /* init DMA trace */ -+ ret = snd_sof_init_trace(sdev); -+ if (ret < 0) { -+ /* non fatal */ -+ dev_warn(sdev->dev, -+ "warning: failed to initialize trace %d\n", -+ ret); -+ } -+ } else { -+ dev_dbg(sdev->dev, "SOF firmware trace disabled\n"); - } - - /* hereafter all FW boot flows are for PM reasons */ -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 7b329bd99674..e68f3cb78cda 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -28,10 +28,14 @@ - #include - - /* debug flags */ --#define SOF_DBG_REGS BIT(1) --#define SOF_DBG_MBOX BIT(2) --#define SOF_DBG_TEXT BIT(3) --#define SOF_DBG_PCI BIT(4) -+#define SOF_DBG_ENABLE_TRACE BIT(0) -+#define SOF_DBG_REGS BIT(1) -+#define SOF_DBG_MBOX BIT(2) -+#define SOF_DBG_TEXT BIT(3) -+#define SOF_DBG_PCI BIT(4) -+ -+/* global debug state set by SOF_DBG_ flags */ -+extern int sof_core_debug; - - /* max BARs mmaped devices can use */ - #define SND_SOF_BARS 8 -@@ -443,6 +447,7 @@ struct snd_sof_dev { - int dma_trace_pages; - wait_queue_head_t trace_sleep; - u32 host_offset; -+ u32 dtrace_is_supported; /* set with Kconfig or module parameter */ - u32 dtrace_is_enabled; - u32 dtrace_error; - u32 dtrace_draining; -diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c -index 4c3cff031fd6..b0e4556c8536 100644 ---- a/sound/soc/sof/trace.c -+++ b/sound/soc/sof/trace.c -@@ -162,6 +162,9 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev) - struct sof_ipc_reply ipc_reply; - int ret; - -+ if (!sdev->dtrace_is_supported) -+ return 0; -+ - if (sdev->dtrace_is_enabled || !sdev->dma_trace_pages) - return -EINVAL; - -@@ -222,6 +225,9 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev) - { - int ret; - -+ if (!sdev->dtrace_is_supported) -+ return 0; -+ - /* set false before start initialization */ - sdev->dtrace_is_enabled = false; - -@@ -277,6 +283,9 @@ EXPORT_SYMBOL(snd_sof_init_trace); - int snd_sof_trace_update_pos(struct snd_sof_dev *sdev, - struct sof_ipc_dma_trace_posn *posn) - { -+ if (!sdev->dtrace_is_supported) -+ return 0; -+ - if (sdev->dtrace_is_enabled && sdev->host_offset != posn->host_offset) { - sdev->host_offset = posn->host_offset; - wake_up(&sdev->trace_sleep); -@@ -293,6 +302,9 @@ int snd_sof_trace_update_pos(struct snd_sof_dev *sdev, - /* an error has occurred within the DSP that prevents further trace */ - void snd_sof_trace_notify_for_error(struct snd_sof_dev *sdev) - { -+ if (!sdev->dtrace_is_supported) -+ return; -+ - if (sdev->dtrace_is_enabled) { - dev_err(sdev->dev, "error: waking up any trace sleepers\n"); - sdev->dtrace_error = true; -@@ -305,7 +317,7 @@ void snd_sof_release_trace(struct snd_sof_dev *sdev) - { - int ret; - -- if (!sdev->dtrace_is_enabled) -+ if (!sdev->dtrace_is_supported || !sdev->dtrace_is_enabled) - return; - - ret = snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_STOP); -@@ -326,6 +338,9 @@ EXPORT_SYMBOL(snd_sof_release_trace); - - void snd_sof_free_trace(struct snd_sof_dev *sdev) - { -+ if (!sdev->dtrace_is_supported) -+ return; -+ - snd_sof_release_trace(sdev); - - snd_dma_free_pages(&sdev->dmatb); --- -2.24.1 - -From 2e85462e14f0f736f4cace881c704ac8fa050475 Mon Sep 17 00:00:00 2001 -From: Liam Girdwood -Date: Fri, 27 Sep 2019 15:05:29 -0500 -Subject: [PATCH 016/109] ASoC: SOF: ipc: retain DSP context after FW - exception. - -Add config option to prevent DSP entering D3 after any FW exception. -This can then be used to dump FW context for debug. - -Signed-off-by: Liam Girdwood -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20190927200538.660-5-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 9a06508bf7824ba34f2e1e9e08df505ac14a44c2) -Bugzilla: 1772498 ---- - sound/soc/sof/Kconfig | 8 ++++++++ - sound/soc/sof/debug.c | 16 ++++++++++++++++ - sound/soc/sof/ipc.c | 4 +--- - sound/soc/sof/sof-priv.h | 2 ++ - 4 files changed, 27 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig -index cc592bcadae7..56a3ab66b46b 100644 ---- a/sound/soc/sof/Kconfig -+++ b/sound/soc/sof/Kconfig -@@ -158,6 +158,14 @@ config SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST - Say Y if you want to enable IPC flood test. - If unsure, select "N". - -+config SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT -+ bool "SOF retain DSP context on any FW exceptions" -+ help -+ This option keeps the DSP in D0 state so that firmware debug -+ information can be retained and dumped to userspace. -+ Say Y if you want to retain DSP context for FW exceptions. -+ If unsure, select "N". -+ - endif ## SND_SOC_SOF_DEBUG - - endif ## SND_SOC_SOF_OPTIONS -diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c -index 5529e8eeca46..d2b3b99d3a20 100644 ---- a/sound/soc/sof/debug.c -+++ b/sound/soc/sof/debug.c -@@ -463,3 +463,19 @@ void snd_sof_free_debug(struct snd_sof_dev *sdev) - debugfs_remove_recursive(sdev->debugfs_root); - } - EXPORT_SYMBOL_GPL(snd_sof_free_debug); -+ -+void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev) -+{ -+ if (IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT) || -+ (sof_core_debug & SOF_DBG_RETAIN_CTX)) { -+ /* should we prevent DSP entering D3 ? */ -+ dev_info(sdev->dev, "info: preventing DSP entering D3 state to preserve context\n"); -+ pm_runtime_get_noresume(sdev->dev); -+ } -+ -+ /* dump vital information to the logs */ -+ snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX); -+ snd_sof_ipc_dump(sdev); -+ snd_sof_trace_notify_for_error(sdev); -+} -+EXPORT_SYMBOL(snd_sof_handle_fw_exception); -diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c -index 8984d965037d..bc292f071a4f 100644 ---- a/sound/soc/sof/ipc.c -+++ b/sound/soc/sof/ipc.c -@@ -210,9 +210,7 @@ static int tx_wait_done(struct snd_sof_ipc *ipc, struct snd_sof_ipc_msg *msg, - if (ret == 0) { - dev_err(sdev->dev, "error: ipc timed out for 0x%x size %d\n", - hdr->cmd, hdr->size); -- snd_sof_dsp_dbg_dump(ipc->sdev, SOF_DBG_REGS | SOF_DBG_MBOX); -- snd_sof_ipc_dump(ipc->sdev); -- snd_sof_trace_notify_for_error(ipc->sdev); -+ snd_sof_handle_fw_exception(ipc->sdev); - ret = -ETIMEDOUT; - } else { - /* copy the data returned from DSP */ -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index e68f3cb78cda..a769687b576d 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -33,6 +33,7 @@ - #define SOF_DBG_MBOX BIT(2) - #define SOF_DBG_TEXT BIT(3) - #define SOF_DBG_PCI BIT(4) -+#define SOF_DBG_RETAIN_CTX BIT(5) /* prevent DSP D3 on FW exception */ - - /* global debug state set by SOF_DBG_ flags */ - extern int sof_core_debug; -@@ -589,6 +590,7 @@ void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code, - struct sof_ipc_panic_info *panic_info, - void *stack, size_t stack_words); - int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev); -+void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev); - - /* - * Platform specific ops. --- -2.24.1 - -From d55d009f0d9c4ef5c4b693b1f5ec6a0ae1f84c1d Mon Sep 17 00:00:00 2001 -From: Ranjani Sridharan -Date: Fri, 27 Sep 2019 15:05:32 -0500 -Subject: [PATCH 017/109] ASoC: SOF: core: check for mandatory fw_ready op - during SOF probe - -fw_ready should be a mandatory op. Make sure fw_ready ops is set -during probe. - -Signed-off-by: Ranjani Sridharan -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20190927200538.660-8-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 8692d498d675e2e1433274c5f03b855824f3f35d) -Bugzilla: 1772498 ---- - sound/soc/sof/core.c | 3 ++- - sound/soc/sof/ipc.c | 6 ------ - sound/soc/sof/sof-priv.h | 2 +- - 3 files changed, 3 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c -index 1e7addfc0f61..8a23739aa545 100644 ---- a/sound/soc/sof/core.c -+++ b/sound/soc/sof/core.c -@@ -504,7 +504,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) - if (!sof_ops(sdev) || !sof_ops(sdev)->probe || !sof_ops(sdev)->run || - !sof_ops(sdev)->block_read || !sof_ops(sdev)->block_write || - !sof_ops(sdev)->send_msg || !sof_ops(sdev)->load_firmware || -- !sof_ops(sdev)->ipc_msg_data || !sof_ops(sdev)->ipc_pcm_params) -+ !sof_ops(sdev)->ipc_msg_data || !sof_ops(sdev)->ipc_pcm_params || -+ !sof_ops(sdev)->fw_ready) - return -EINVAL; - - INIT_LIST_HEAD(&sdev->pcm_list); -diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c -index bc292f071a4f..dfe429f9e33f 100644 ---- a/sound/soc/sof/ipc.c -+++ b/sound/soc/sof/ipc.c -@@ -787,12 +787,6 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev) - struct snd_sof_ipc *ipc; - struct snd_sof_ipc_msg *msg; - -- /* check if mandatory ops required for ipc are defined */ -- if (!sof_ops(sdev)->fw_ready) { -- dev_err(sdev->dev, "error: ipc mandatory ops not defined\n"); -- return NULL; -- } -- - ipc = devm_kzalloc(sdev->dev, sizeof(*ipc), GFP_KERNEL); - if (!ipc) - return NULL; -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index a769687b576d..eb919527dd21 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -133,7 +133,7 @@ struct snd_sof_dsp_ops { - * FW ready checks for ABI compatibility and creates - * memory windows at first boot - */ -- int (*fw_ready)(struct snd_sof_dev *sdev, u32 msg_id); /* optional */ -+ int (*fw_ready)(struct snd_sof_dev *sdev, u32 msg_id); /* mandatory */ - - /* connect pcm substream to a host stream */ - int (*pcm_open)(struct snd_sof_dev *sdev, --- -2.24.1 - -From bed2180906afe06547bc434b4101da52ef5ef912 Mon Sep 17 00:00:00 2001 -From: Marcin Rajwa -Date: Fri, 27 Sep 2019 15:05:33 -0500 -Subject: [PATCH 018/109] ASoC: SOF: ipc: introduce no_stream_position in - sof_ipc_stream_params struct - -The host period bytes value needs to be passed to firmware. -However current implementation uses this field for different -purpose - to indicate whether FW should send stream position -to the host. Therefore this patch introduces another field -"no_stream_position", a boolean value aimed to store information -about position tracking. This way host_period_bytes preserves its -original value. - -Signed-off-by: Marcin Rajwa -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20190927200538.660-9-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit e3ebfd0ab5b4880bfb6a9f32614c2e389cc3da56) -Bugzilla: 1772498 ---- - include/sound/sof/stream.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/include/sound/sof/stream.h b/include/sound/sof/stream.h -index 0b71b381b952..7facefb541b3 100644 ---- a/include/sound/sof/stream.h -+++ b/include/sound/sof/stream.h -@@ -83,10 +83,10 @@ struct sof_ipc_stream_params { - uint16_t sample_valid_bytes; - uint16_t sample_container_bytes; - -- /* for notifying host period has completed - 0 means no period IRQ */ - uint32_t host_period_bytes; -+ uint16_t no_stream_position; /**< 1 means don't send stream position */ - -- uint32_t reserved[2]; -+ uint16_t reserved[3]; - uint16_t chmap[SOF_IPC_MAX_CHANNELS]; /**< channel map - SOF_CHMAP_ */ - } __packed; - --- -2.24.1 - -From 621e4be575f4ab56711478b4306ea7ba78cc922a Mon Sep 17 00:00:00 2001 -From: Marcin Rajwa -Date: Fri, 27 Sep 2019 15:05:34 -0500 -Subject: [PATCH 019/109] ASoC: SOF: Intel: hda: fix reset of host_period_bytes - -This patch prevents the reset of host period bytes -and uses no_stream_position to record requests -for stream position. - -Signed-off-by: Marcin Rajwa -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20190927200538.660-10-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit f567ff6c76f7e9b317248fcab7a0eb3ef432dc9e) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-pcm.c | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c -index 9b730f183529..575f5f5877d8 100644 ---- a/sound/soc/sof/intel/hda-pcm.c -+++ b/sound/soc/sof/intel/hda-pcm.c -@@ -89,6 +89,7 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev, - struct hdac_ext_stream *stream = stream_to_hdac_ext_stream(hstream); - struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; - struct snd_dma_buffer *dmab; -+ struct sof_ipc_fw_version *v = &sdev->fw_ready.version; - int ret; - u32 size, rate, bits; - -@@ -116,9 +117,17 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev, - /* disable SPIB, to enable buffer wrap for stream */ - hda_dsp_stream_spib_config(sdev, stream, HDA_DSP_SPIB_DISABLE, 0); - -- /* set host_period_bytes to 0 if no IPC position */ -- if (hda && hda->no_ipc_position) -- ipc_params->host_period_bytes = 0; -+ /* update no_stream_position flag for ipc params */ -+ if (hda && hda->no_ipc_position) { -+ /* For older ABIs set host_period_bytes to zero to inform -+ * FW we don't want position updates. Newer versions use -+ * no_stream_position for this purpose. -+ */ -+ if (v->abi_version < SOF_ABI_VER(3, 10, 0)) -+ ipc_params->host_period_bytes = 0; -+ else -+ ipc_params->no_stream_position = 1; -+ } - - ipc_params->stream_tag = hstream->stream_tag; - --- -2.24.1 - -From 244e3dece4e48b1aac798f9b1bf49565697cba87 Mon Sep 17 00:00:00 2001 -From: Liam Girdwood -Date: Fri, 27 Sep 2019 15:05:37 -0500 -Subject: [PATCH 020/109] ASoC: SOF: Intel: Add context data to any IPC - timeout. - -Helps with FW debug as it provides DSP IPC processing context. - -Signed-off-by: Liam Girdwood -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20190927200538.660-13-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 3a9e204d4e36904a464a2e53206b053a7ffc7bad) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/bdw.c | 22 +++++++++++++++++++++- - sound/soc/sof/intel/byt.c | 23 ++++++++++++++++++++++- - 2 files changed, 43 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c -index 80e2826fb447..f395d0638876 100644 ---- a/sound/soc/sof/intel/bdw.c -+++ b/sound/soc/sof/intel/bdw.c -@@ -247,7 +247,7 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) - struct sof_ipc_dsp_oops_xtensa xoops; - struct sof_ipc_panic_info panic_info; - u32 stack[BDW_STACK_DUMP_SIZE]; -- u32 status, panic; -+ u32 status, panic, imrx, imrd; - - /* now try generic SOF status messages */ - status = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD); -@@ -256,6 +256,26 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) - BDW_STACK_DUMP_SIZE); - snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack, - BDW_STACK_DUMP_SIZE); -+ -+ /* provide some context for firmware debug */ -+ imrx = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRX); -+ imrd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRD); -+ dev_err(sdev->dev, -+ "error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n", -+ panic & SHIM_IPCX_BUSY ? "yes" : "no", -+ panic & SHIM_IPCX_DONE ? "yes" : "no", panic); -+ dev_err(sdev->dev, -+ "error: mask host: pending %s complete %s raw 0x%8.8x\n", -+ imrx & SHIM_IMRX_BUSY ? "yes" : "no", -+ imrx & SHIM_IMRX_DONE ? "yes" : "no", imrx); -+ dev_err(sdev->dev, -+ "error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n", -+ status & SHIM_IPCD_BUSY ? "yes" : "no", -+ status & SHIM_IPCD_DONE ? "yes" : "no", status); -+ dev_err(sdev->dev, -+ "error: mask DSP: pending %s complete %s raw 0x%8.8x\n", -+ imrd & SHIM_IMRD_BUSY ? "yes" : "no", -+ imrd & SHIM_IMRD_DONE ? "yes" : "no", imrd); - } - - /* -diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c -index 41008c974ac6..3138d9a2c621 100644 ---- a/sound/soc/sof/intel/byt.c -+++ b/sound/soc/sof/intel/byt.c -@@ -146,7 +146,7 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags) - struct sof_ipc_dsp_oops_xtensa xoops; - struct sof_ipc_panic_info panic_info; - u32 stack[BYT_STACK_DUMP_SIZE]; -- u32 status, panic; -+ u32 status, panic, imrd, imrx; - - /* now try generic SOF status messages */ - status = snd_sof_dsp_read(sdev, BYT_DSP_BAR, SHIM_IPCD); -@@ -155,6 +155,27 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags) - BYT_STACK_DUMP_SIZE); - snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack, - BYT_STACK_DUMP_SIZE); -+ -+ /* provide some context for firmware debug */ -+ imrx = snd_sof_dsp_read(sdev, BYT_DSP_BAR, SHIM_IMRX); -+ imrd = snd_sof_dsp_read(sdev, BYT_DSP_BAR, SHIM_IMRD); -+ dev_err(sdev->dev, -+ "error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n", -+ panic & SHIM_IPCX_BUSY ? "yes" : "no", -+ panic & SHIM_IPCX_DONE ? "yes" : "no", panic); -+ dev_err(sdev->dev, -+ "error: mask host: pending %s complete %s raw 0x%8.8x\n", -+ imrx & SHIM_IMRX_BUSY ? "yes" : "no", -+ imrx & SHIM_IMRX_DONE ? "yes" : "no", imrx); -+ dev_err(sdev->dev, -+ "error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n", -+ status & SHIM_IPCD_BUSY ? "yes" : "no", -+ status & SHIM_IPCD_DONE ? "yes" : "no", status); -+ dev_err(sdev->dev, -+ "error: mask DSP: pending %s complete %s raw 0x%8.8x\n", -+ imrd & SHIM_IMRD_BUSY ? "yes" : "no", -+ imrd & SHIM_IMRD_DONE ? "yes" : "no", imrd); -+ - } - - /* --- -2.24.1 - -From 2ce45551453d13f25f89c4273934efd179c34195 Mon Sep 17 00:00:00 2001 -From: Jaska Uimonen -Date: Tue, 8 Oct 2019 11:44:41 -0500 -Subject: [PATCH 021/109] ASoC: SOF: enable dual control for pga - -Currently sof pga element supports only 1 kcontrol and you can't create -for example a mixer element with combined volume slider and mute switch. -So enable sof pga to have more than 1 kcontrol associated with it. Also -check for possible NULL tlv pointer as switch element might not have it. - -Signed-off-by: Jaska Uimonen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-8-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit a68c6b6cc77b841dc37c17a5d9a7074e26801af5) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index fa299e078156..96c20c889fa4 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -1581,7 +1581,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, - if (!volume) - return -ENOMEM; - -- if (le32_to_cpu(tw->num_kcontrols) != 1) { -+ if (!le32_to_cpu(tw->num_kcontrols)) { - dev_err(sdev->dev, "error: invalid kcontrol count %d for volume\n", - tw->num_kcontrols); - ret = -EINVAL; -@@ -1618,7 +1618,8 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, - swidget->private = volume; - - list_for_each_entry(scontrol, &sdev->kcontrol_list, list) { -- if (scontrol->comp_id == swidget->comp_id) { -+ if (scontrol->comp_id == swidget->comp_id && -+ scontrol->volume_table) { - min_step = scontrol->min_volume_step; - max_step = scontrol->max_volume_step; - volume->min_value = scontrol->volume_table[min_step]; --- -2.24.1 - -From 1abf144571f2f8791c1d6b5f9242da41e3ed8c2e Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 8 Oct 2019 11:44:36 -0500 -Subject: [PATCH 022/109] Revert "ASoC: SOF: Force polling mode on CFL and CNL" - -This reverts commit 64ca9d9fcb3e3c86b1417e3d17a90b43dd660f81. - -The workaround is no longer needed after configuring HDAC -bus with sync_write=1. - -Signed-off-by: Kai Vehmanen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 902fd492d5ea2c02666ddadc1da977ca94e6b52c) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda.c | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c -index 3c4b604412f0..ff3fa8670fd8 100644 ---- a/sound/soc/sof/intel/hda.c -+++ b/sound/soc/sof/intel/hda.c -@@ -32,9 +32,6 @@ - /* platform specific devices */ - #include "shim.h" - --#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) --#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) -- - #define EXCEPT_MAX_HDR_SIZE 0x400 - - /* -@@ -262,10 +259,6 @@ static int hda_init(struct snd_sof_dev *sdev) - /* HDA bus init */ - sof_hda_bus_init(bus, &pci->dev); - -- /* Workaround for a communication error on CFL (bko#199007) and CNL */ -- if (IS_CFL(pci) || IS_CNL(pci)) -- bus->polling_mode = 1; -- - bus->use_posbuf = 1; - bus->bdl_pos_adj = 0; - bus->sync_write = 1; --- -2.24.1 - -From 7947c07881d4fa46b74c5884d5e0a5ecbd2825b3 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Tue, 8 Oct 2019 11:44:37 -0500 -Subject: [PATCH 023/109] ASoC: SOF: acpi: add debug module param - -Add debug parameter for snd-sof-acpi. - -One of the usages for this debug parameter to disable pm_runtime, -which can be useful for platform bringup, or keep the parent device -active while enabling pm_runtime for child devices (e.g. with -SoundWire or MFD). This can also be useful to measure suspend-resume -latencies or child devices. - -Signed-off-by: Kai Vehmanen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 70b0c75ae1e3d35f829b5fe7ae5692efae63ca71) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-acpi-dev.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/sof/sof-acpi-dev.c b/sound/soc/sof/sof-acpi-dev.c -index ea7b8b895412..df318f50dd0b 100644 ---- a/sound/soc/sof/sof-acpi-dev.c -+++ b/sound/soc/sof/sof-acpi-dev.c -@@ -29,6 +29,12 @@ static char *tplg_path; - module_param(tplg_path, charp, 0444); - MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology."); - -+static int sof_acpi_debug; -+module_param_named(sof_acpi_debug, sof_acpi_debug, int, 0444); -+MODULE_PARM_DESC(sof_acpi_debug, "SOF ACPI debug options (0x0 all off)"); -+ -+#define SOF_ACPI_DISABLE_PM_RUNTIME BIT(0) -+ - #if IS_ENABLED(CONFIG_SND_SOC_SOF_HASWELL) - static const struct sof_dev_desc sof_acpi_haswell_desc = { - .machines = snd_soc_acpi_intel_haswell_machines, -@@ -121,6 +127,9 @@ static const struct dev_pm_ops sof_acpi_pm = { - - static void sof_acpi_probe_complete(struct device *dev) - { -+ if (sof_acpi_debug & SOF_ACPI_DISABLE_PM_RUNTIME) -+ return; -+ - /* allow runtime_pm */ - pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS); - pm_runtime_use_autosuspend(dev); -@@ -221,7 +230,8 @@ static int sof_acpi_probe(struct platform_device *pdev) - - static int sof_acpi_remove(struct platform_device *pdev) - { -- pm_runtime_disable(&pdev->dev); -+ if (!(sof_acpi_debug & SOF_ACPI_DISABLE_PM_RUNTIME)) -+ pm_runtime_disable(&pdev->dev); - - /* call sof helper for DSP hardware remove */ - snd_sof_device_remove(&pdev->dev); --- -2.24.1 - -From 21db8b682a3384a910d054fd8795b6dec380d700 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Tue, 8 Oct 2019 11:44:38 -0500 -Subject: [PATCH 024/109] ASoC: SOF: pci: add debug module param - -Add debug parameter for snd-sof-pci. - -One of the usages for this debug parameter to disable pm_runtime, -which can be useful for platform bringup, or keep the parent device -active while enabling pm_runtime for child devices (e.g. with -SoundWire or MFD). This can also be useful to measure suspend-resume -latencies or child devices. - -Signed-off-by: Kai Vehmanen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-5-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 8b160dc2a92c83a566b0596c79febb5933f9a6b5) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-pci-dev.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c -index 3a9e0e2a150d..be5a8da504c5 100644 ---- a/sound/soc/sof/sof-pci-dev.c -+++ b/sound/soc/sof/sof-pci-dev.c -@@ -30,6 +30,12 @@ static char *tplg_path; - module_param(tplg_path, charp, 0444); - MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology."); - -+static int sof_pci_debug; -+module_param_named(sof_pci_debug, sof_pci_debug, int, 0444); -+MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)"); -+ -+#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0) -+ - #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) - static const struct sof_dev_desc bxt_desc = { - .machines = snd_soc_acpi_intel_bxt_machines, -@@ -250,6 +256,9 @@ static void sof_pci_probe_complete(struct device *dev) - { - dev_dbg(dev, "Completing SOF PCI probe"); - -+ if (sof_pci_debug & SOF_PCI_DISABLE_PM_RUNTIME) -+ return; -+ - /* allow runtime_pm */ - pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS); - pm_runtime_use_autosuspend(dev); -@@ -376,7 +385,8 @@ static void sof_pci_remove(struct pci_dev *pci) - snd_sof_device_remove(&pci->dev); - - /* follow recommendation in pci-driver.c to increment usage counter */ -- pm_runtime_get_noresume(&pci->dev); -+ if (!(sof_pci_debug & SOF_PCI_DISABLE_PM_RUNTIME)) -+ pm_runtime_get_noresume(&pci->dev); - - /* release pci regions and disable device */ - pci_release_regions(pci); --- -2.24.1 - -From 7b65ba0fedde4554a709dce46318543f07b8fd5a Mon Sep 17 00:00:00 2001 -From: Jaska Uimonen -Date: Tue, 8 Oct 2019 11:44:43 -0500 -Subject: [PATCH 025/109] ASoC: SOF: acpi led support for switch controls - -Currently sof doesn't support acpi leds with mute switches. So implement -acpi leds following quite shamelessly existing HDA implementation by -Takashi Iwai. - -Mute leds can be enabled in topology by adding led and direction token -in switch control private data. - -Signed-off-by: Jaska Uimonen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-10-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 5d43001ae43606dc525f55c482c545afba01bb55) -Bugzilla: 1772498 ---- - include/uapi/sound/sof/tokens.h | 4 ++++ - sound/soc/sof/control.c | 32 ++++++++++++++++++++++++++++++++ - sound/soc/sof/sof-priv.h | 9 +++++++++ - sound/soc/sof/topology.c | 13 +++++++++++++ - 4 files changed, 58 insertions(+) - -diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h -index 8f996857fb24..28ef01a67765 100644 ---- a/include/uapi/sound/sof/tokens.h -+++ b/include/uapi/sound/sof/tokens.h -@@ -114,4 +114,8 @@ - #define SOF_TKN_IMX_ESAI_FIRST_TOKEN 1100 - /* TODO: Add ESAI tokens */ - -+/* Led control for mute switches */ -+#define SOF_TKN_MUTE_LED_USE 1300 -+#define SOF_TKN_MUTE_LED_DIRECTION 1301 -+ - #endif -diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c -index 2b8711eda362..b73d4587c5da 100644 ---- a/sound/soc/sof/control.c -+++ b/sound/soc/sof/control.c -@@ -11,8 +11,37 @@ - /* Mixer Controls */ - - #include -+#include - #include "sof-priv.h" - -+static void update_mute_led(struct snd_sof_control *scontrol, -+ struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ unsigned int temp = 0; -+ unsigned int mask; -+ int i; -+ -+ mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); -+ -+ for (i = 0; i < scontrol->num_channels; i++) { -+ if (ucontrol->value.integer.value[i]) { -+ temp |= mask; -+ break; -+ } -+ } -+ -+ if (temp == scontrol->led_ctl.led_value) -+ return; -+ -+ scontrol->led_ctl.led_value = temp; -+ -+ if (!scontrol->led_ctl.direction) -+ ledtrig_audio_set(LED_AUDIO_MUTE, temp ? LED_OFF : LED_ON); -+ else -+ ledtrig_audio_set(LED_AUDIO_MICMUTE, temp ? LED_OFF : LED_ON); -+} -+ - static inline u32 mixer_to_ipc(unsigned int value, u32 *volume_map, int size) - { - if (value >= size) -@@ -118,6 +147,9 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, - cdata->chanv[i].value = value; - } - -+ if (scontrol->led_ctl.use_led) -+ update_mute_led(scontrol, kcontrol, ucontrol); -+ - /* notify DSP of mixer updates */ - if (pm_runtime_active(sdev->dev)) - snd_sof_ipc_set_get_comp_data(sdev->ipc, scontrol, -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index eb919527dd21..9729deafec08 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -15,6 +15,7 @@ - - #include - #include -+#include - - #include - #include /* needs to be included before control.h */ -@@ -310,6 +311,12 @@ struct snd_sof_pcm { - bool prepared[2]; /* PCM_PARAMS set successfully */ - }; - -+struct snd_sof_led_control { -+ unsigned int use_led; -+ unsigned int direction; -+ unsigned int led_value; -+}; -+ - /* ALSA SOF Kcontrol device */ - struct snd_sof_control { - struct snd_sof_dev *sdev; -@@ -324,6 +331,8 @@ struct snd_sof_control { - u32 *volume_table; /* volume table computed from tlv data*/ - - struct list_head list; /* list in sdev control list */ -+ -+ struct snd_sof_led_control led_ctl; - }; - - /* ASoC SOF DAPM widget */ -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 96c20c889fa4..a1493961b51c 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -494,6 +494,11 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - } - - out: -+ /* set up possible led control from mixer private data */ -+ ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, -+ ARRAY_SIZE(led_tokens), mc->priv.array, -+ le32_to_cpu(mc->priv.size)); -+ - dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", - scontrol->comp_id, scontrol->num_channels); - -@@ -840,6 +845,14 @@ static const struct sof_topology_token dmic_pdm_tokens[] = { - static const struct sof_topology_token hda_tokens[] = { - }; - -+/* Leds */ -+static const struct sof_topology_token led_tokens[] = { -+ {SOF_TKN_MUTE_LED_USE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, -+ offsetof(struct snd_sof_led_control, use_led), 0}, -+ {SOF_TKN_MUTE_LED_DIRECTION, SND_SOC_TPLG_TUPLE_TYPE_WORD, -+ get_token_u32, offsetof(struct snd_sof_led_control, direction), 0}, -+}; -+ - static void sof_parse_uuid_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, --- -2.24.1 - -From 0017ac5f09b9a689a6f1b2ec3f0aa2f95753a1c1 Mon Sep 17 00:00:00 2001 -From: Daniel Baluta -Date: Tue, 8 Oct 2019 11:44:39 -0500 -Subject: [PATCH 026/109] ASoC: SOF: imx: Describe ESAI parameters to be sent - to DSP - -Introduce sof_ipc_dai_esai_params to keep information that -we get from topology and we send to DSP FW. - -Also bump the ABI minor to reflect the changes on DSP FW. - -Signed-off-by: Daniel Baluta -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-6-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit b4be427683cf6debda331a5d6a4af34885851d19) -Bugzilla: 1772498 ---- - include/sound/sof/dai-imx.h | 34 +++++++++++++++++++++++++++++++++ - include/sound/sof/dai.h | 2 ++ - include/uapi/sound/sof/abi.h | 2 +- - include/uapi/sound/sof/tokens.h | 3 +-- - 4 files changed, 38 insertions(+), 3 deletions(-) - create mode 100644 include/sound/sof/dai-imx.h - -diff --git a/include/sound/sof/dai-imx.h b/include/sound/sof/dai-imx.h -new file mode 100644 -index 000000000000..e02fb0b0fae1 ---- /dev/null -+++ b/include/sound/sof/dai-imx.h -@@ -0,0 +1,34 @@ -+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ -+/* -+ * Copyright 2019 NXP -+ * -+ * Author: Daniel Baluta -+ */ -+ -+#ifndef __INCLUDE_SOUND_SOF_DAI_IMX_H__ -+#define __INCLUDE_SOUND_SOF_DAI_IMX_H__ -+ -+#include -+ -+/* ESAI Configuration Request - SOF_IPC_DAI_ESAI_CONFIG */ -+struct sof_ipc_dai_esai_params { -+ struct sof_ipc_hdr hdr; -+ -+ /* MCLK */ -+ uint16_t reserved1; -+ uint16_t mclk_id; -+ uint32_t mclk_direction; -+ -+ uint32_t mclk_rate; /* MCLK frequency in Hz */ -+ uint32_t fsync_rate; /* FSYNC frequency in Hz */ -+ uint32_t bclk_rate; /* BCLK frequency in Hz */ -+ -+ /* TDM */ -+ uint32_t tdm_slots; -+ uint32_t rx_slots; -+ uint32_t tx_slots; -+ uint16_t tdm_slot_width; -+ uint16_t reserved2; /* alignment */ -+} __packed; -+ -+#endif -diff --git a/include/sound/sof/dai.h b/include/sound/sof/dai.h -index 0f1235022146..c229565767e5 100644 ---- a/include/sound/sof/dai.h -+++ b/include/sound/sof/dai.h -@@ -11,6 +11,7 @@ - - #include - #include -+#include - - /* - * DAI Configuration. -@@ -73,6 +74,7 @@ struct sof_ipc_dai_config { - struct sof_ipc_dai_dmic_params dmic; - struct sof_ipc_dai_hda_params hda; - struct sof_ipc_dai_alh_params alh; -+ struct sof_ipc_dai_esai_params esai; - }; - } __packed; - -diff --git a/include/uapi/sound/sof/abi.h b/include/uapi/sound/sof/abi.h -index a0fe0d4c4b66..ebfdc20ca081 100644 ---- a/include/uapi/sound/sof/abi.h -+++ b/include/uapi/sound/sof/abi.h -@@ -26,7 +26,7 @@ - - /* SOF ABI version major, minor and patch numbers */ - #define SOF_ABI_MAJOR 3 --#define SOF_ABI_MINOR 10 -+#define SOF_ABI_MINOR 11 - #define SOF_ABI_PATCH 0 - - /* SOF ABI version number. Format within 32bit word is MMmmmppp */ -diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h -index 28ef01a67765..d65406f34361 100644 ---- a/include/uapi/sound/sof/tokens.h -+++ b/include/uapi/sound/sof/tokens.h -@@ -111,8 +111,7 @@ - /* TODO: Add SAI tokens */ - - /* ESAI */ --#define SOF_TKN_IMX_ESAI_FIRST_TOKEN 1100 --/* TODO: Add ESAI tokens */ -+#define SOF_TKN_IMX_ESAI_MCLK_ID 1100 - - /* Led control for mute switches */ - #define SOF_TKN_MUTE_LED_USE 1300 --- -2.24.1 - -From 8a031dfe901dd997df316c2138153edff7af5731 Mon Sep 17 00:00:00 2001 -From: Daniel Baluta -Date: Tue, 8 Oct 2019 11:44:40 -0500 -Subject: [PATCH 027/109] ASoC: SOF: imx: Read ESAI parameters and send them to - DSP - -ESAI parameters are read for topology file, packed into -sof_ipc_dai_esai_parms struct and then sent to DSP. - -Signed-off-by: Daniel Baluta -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-7-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit a4eff5f86c9c5e7d07d880bd86ce8faad19d7063) -Bugzilla: 1772498 ---- - sound/soc/sof/pcm.c | 8 +++++ - sound/soc/sof/topology.c | 69 ++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 75 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c -index 2b876d497447..b0f4217433e5 100644 ---- a/sound/soc/sof/pcm.c -+++ b/sound/soc/sof/pcm.c -@@ -691,6 +691,14 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, - case SOF_DAI_INTEL_ALH: - /* do nothing for ALH dai_link */ - break; -+ case SOF_DAI_IMX_ESAI: -+ channels->min = dai->dai_config->esai.tdm_slots; -+ channels->max = dai->dai_config->esai.tdm_slots; -+ -+ dev_dbg(sdev->dev, -+ "channels_min: %d channels_max: %d\n", -+ channels->min, channels->max); -+ break; - default: - dev_err(sdev->dev, "error: invalid DAI type %d\n", - dai->dai_config->type); -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index a1493961b51c..b2cf450f763f 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -804,6 +804,13 @@ static const struct sof_topology_token dmic_tokens[] = { - - }; - -+/* ESAI */ -+static const struct sof_topology_token esai_tokens[] = { -+ {SOF_TKN_IMX_ESAI_MCLK_ID, -+ SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, -+ offsetof(struct sof_ipc_dai_esai_params, mclk_id), 0}, -+}; -+ - /* - * DMIC PDM Tokens - * SOF_TKN_INTEL_DMIC_PDM_CTRL_ID should be the first token -@@ -2550,8 +2557,66 @@ static int sof_link_esai_load(struct snd_soc_component *scomp, int index, - struct snd_soc_tplg_hw_config *hw_config, - struct sof_ipc_dai_config *config) - { -- /*TODO: Add implementation */ -- return 0; -+ struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -+ struct snd_soc_tplg_private *private = &cfg->priv; -+ struct sof_ipc_reply reply; -+ u32 size = sizeof(*config); -+ int ret; -+ -+ /* handle master/slave and inverted clocks */ -+ sof_dai_set_format(hw_config, config); -+ -+ /* init IPC */ -+ memset(&config->esai, 0, sizeof(struct sof_ipc_dai_esai_params)); -+ config->hdr.size = size; -+ -+ ret = sof_parse_tokens(scomp, &config->esai, esai_tokens, -+ ARRAY_SIZE(esai_tokens), private->array, -+ le32_to_cpu(private->size)); -+ if (ret != 0) { -+ dev_err(sdev->dev, "error: parse esai tokens failed %d\n", -+ le32_to_cpu(private->size)); -+ return ret; -+ } -+ -+ config->esai.mclk_rate = le32_to_cpu(hw_config->mclk_rate); -+ config->esai.bclk_rate = le32_to_cpu(hw_config->bclk_rate); -+ config->esai.fsync_rate = le32_to_cpu(hw_config->fsync_rate); -+ config->esai.mclk_direction = hw_config->mclk_direction; -+ config->esai.tdm_slots = le32_to_cpu(hw_config->tdm_slots); -+ config->esai.tdm_slot_width = le32_to_cpu(hw_config->tdm_slot_width); -+ config->esai.rx_slots = le32_to_cpu(hw_config->rx_slots); -+ config->esai.tx_slots = le32_to_cpu(hw_config->tx_slots); -+ -+ dev_info(sdev->dev, -+ "tplg: config ESAI%d fmt 0x%x mclk %d width %d slots %d mclk id %d\n", -+ config->dai_index, config->format, -+ config->esai.mclk_rate, config->esai.tdm_slot_width, -+ config->esai.tdm_slots, config->esai.mclk_id); -+ -+ if (config->esai.tdm_slots < 1 || config->esai.tdm_slots > 8) { -+ dev_err(sdev->dev, "error: invalid channel count for ESAI%d\n", -+ config->dai_index); -+ return -EINVAL; -+ } -+ -+ /* send message to DSP */ -+ ret = sof_ipc_tx_message(sdev->ipc, -+ config->hdr.cmd, config, size, &reply, -+ sizeof(reply)); -+ if (ret < 0) { -+ dev_err(sdev->dev, "error: failed to set DAI config for ESAI%d\n", -+ config->dai_index); -+ return ret; -+ } -+ -+ /* set config for all DAI's with name matching the link name */ -+ ret = sof_set_dai_config(sdev, size, link, config); -+ if (ret < 0) -+ dev_err(sdev->dev, "error: failed to save DAI config for ESAI%d\n", -+ config->dai_index); -+ -+ return ret; - } - - static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, --- -2.24.1 - -From 752cbeda2b3ac929a9b0891fa3a8fdd9a8bcc5d5 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 11 Oct 2019 11:43:09 -0500 -Subject: [PATCH 028/109] ASoC: SOF: Intel: byt: fix operator precedence - warnings - -Address cppcheck warnings - -sound/soc/sof/intel/byt.c:163:26: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - panic & SHIM_IPCX_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/byt.c:164:26: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - panic & SHIM_IPCX_DONE ? "yes" : "no", panic); - ^ - -sound/soc/sof/intel/byt.c:167:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrx & SHIM_IMRX_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/byt.c:168:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrx & SHIM_IMRX_DONE ? "yes" : "no", imrx); - ^ - -sound/soc/sof/intel/byt.c:171:27: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - status & SHIM_IPCD_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/byt.c:172:27: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - status & SHIM_IPCD_DONE ? "yes" : "no", status); - ^ - -sound/soc/sof/intel/byt.c:175:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrd & SHIM_IMRD_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/byt.c:176:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrd & SHIM_IMRD_DONE ? "yes" : "no", imrd); - ^ - -Fixes: 3a9e204d4e369 ("ASoC: SOF: Intel: Add context data to any IPC timeout.") -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191011164312.7988-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit f9f618e7128e834db3f54d290a926c4a71104e02) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/byt.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c -index 3138d9a2c621..84d6069b5075 100644 ---- a/sound/soc/sof/intel/byt.c -+++ b/sound/soc/sof/intel/byt.c -@@ -161,20 +161,20 @@ static void byt_dump(struct snd_sof_dev *sdev, u32 flags) - imrd = snd_sof_dsp_read(sdev, BYT_DSP_BAR, SHIM_IMRD); - dev_err(sdev->dev, - "error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n", -- panic & SHIM_IPCX_BUSY ? "yes" : "no", -- panic & SHIM_IPCX_DONE ? "yes" : "no", panic); -+ (panic & SHIM_IPCX_BUSY) ? "yes" : "no", -+ (panic & SHIM_IPCX_DONE) ? "yes" : "no", panic); - dev_err(sdev->dev, - "error: mask host: pending %s complete %s raw 0x%8.8x\n", -- imrx & SHIM_IMRX_BUSY ? "yes" : "no", -- imrx & SHIM_IMRX_DONE ? "yes" : "no", imrx); -+ (imrx & SHIM_IMRX_BUSY) ? "yes" : "no", -+ (imrx & SHIM_IMRX_DONE) ? "yes" : "no", imrx); - dev_err(sdev->dev, - "error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n", -- status & SHIM_IPCD_BUSY ? "yes" : "no", -- status & SHIM_IPCD_DONE ? "yes" : "no", status); -+ (status & SHIM_IPCD_BUSY) ? "yes" : "no", -+ (status & SHIM_IPCD_DONE) ? "yes" : "no", status); - dev_err(sdev->dev, - "error: mask DSP: pending %s complete %s raw 0x%8.8x\n", -- imrd & SHIM_IMRD_BUSY ? "yes" : "no", -- imrd & SHIM_IMRD_DONE ? "yes" : "no", imrd); -+ (imrd & SHIM_IMRD_BUSY) ? "yes" : "no", -+ (imrd & SHIM_IMRD_DONE) ? "yes" : "no", imrd); - - } - --- -2.24.1 - -From a825e9f8825891dfd84867f2916b0b69cda0de6a Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 11 Oct 2019 11:43:10 -0500 -Subject: [PATCH 029/109] ASoC: SOF: Intel: bdw: fix operator precedence - warnings - -Address cppcheck warnings - -sound/soc/sof/intel/bdw.c:265:26: style: Clarify calculation precedence -for '&' and '?'. [clarifyCalculation] - panic & SHIM_IPCX_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/bdw.c:266:26: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - panic & SHIM_IPCX_DONE ? "yes" : "no", panic); - ^ - -sound/soc/sof/intel/bdw.c:269:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrx & SHIM_IMRX_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/bdw.c:270:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrx & SHIM_IMRX_DONE ? "yes" : "no", imrx); - ^ - -sound/soc/sof/intel/bdw.c:273:27: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - status & SHIM_IPCD_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/bdw.c:274:27: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - status & SHIM_IPCD_DONE ? "yes" : "no", status); - ^ - -sound/soc/sof/intel/bdw.c:277:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrd & SHIM_IMRD_BUSY ? "yes" : "no", - ^ - -sound/soc/sof/intel/bdw.c:278:25: style: Clarify calculation -precedence for '&' and '?'. [clarifyCalculation] - imrd & SHIM_IMRD_DONE ? "yes" : "no", imrd); - ^ - -Fixes: 3a9e204d4e369 ("ASoC: SOF: Intel: Add context data to any IPC timeout.") -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191011164312.7988-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 7ad03a2c848f6fb0a8dea656c9c161929696878e) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/bdw.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c -index f395d0638876..bf961a8798a7 100644 ---- a/sound/soc/sof/intel/bdw.c -+++ b/sound/soc/sof/intel/bdw.c -@@ -262,20 +262,20 @@ static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) - imrd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRD); - dev_err(sdev->dev, - "error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n", -- panic & SHIM_IPCX_BUSY ? "yes" : "no", -- panic & SHIM_IPCX_DONE ? "yes" : "no", panic); -+ (panic & SHIM_IPCX_BUSY) ? "yes" : "no", -+ (panic & SHIM_IPCX_DONE) ? "yes" : "no", panic); - dev_err(sdev->dev, - "error: mask host: pending %s complete %s raw 0x%8.8x\n", -- imrx & SHIM_IMRX_BUSY ? "yes" : "no", -- imrx & SHIM_IMRX_DONE ? "yes" : "no", imrx); -+ (imrx & SHIM_IMRX_BUSY) ? "yes" : "no", -+ (imrx & SHIM_IMRX_DONE) ? "yes" : "no", imrx); - dev_err(sdev->dev, - "error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n", -- status & SHIM_IPCD_BUSY ? "yes" : "no", -- status & SHIM_IPCD_DONE ? "yes" : "no", status); -+ (status & SHIM_IPCD_BUSY) ? "yes" : "no", -+ (status & SHIM_IPCD_DONE) ? "yes" : "no", status); - dev_err(sdev->dev, - "error: mask DSP: pending %s complete %s raw 0x%8.8x\n", -- imrd & SHIM_IMRD_BUSY ? "yes" : "no", -- imrd & SHIM_IMRD_DONE ? "yes" : "no", imrd); -+ (imrd & SHIM_IMRD_BUSY) ? "yes" : "no", -+ (imrd & SHIM_IMRD_DONE) ? "yes" : "no", imrd); - } - - /* --- -2.24.1 - -From b130f3834c22757c7d8da463e77bc80c31035cd8 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 11 Oct 2019 11:43:11 -0500 -Subject: [PATCH 030/109] ASoC: SOF: topology: remove always-true redundant - test - -Address cppcheck warning: - -sound/soc/sof/topology.c:2322:6: style: Condition 'pcm' is always true -[knownConditionTrueFalse] - if (pcm) { - ^ - -sound/soc/sof/topology.c:2311:6: note: Assuming that condition '!pcm' -is not redundant - if (!pcm) - ^ - -sound/soc/sof/topology.c:2322:6: note: Condition 'pcm' is always true - if (pcm) { - ^ - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191011164312.7988-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 494e8f65da24d550a5e7c6a85b9433ffb181705c) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index b2cf450f763f..4fa38719c703 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -2309,10 +2309,9 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, - spcm->stream[SNDRV_PCM_STREAM_PLAYBACK].comp_id = COMP_ID_UNASSIGNED; - spcm->stream[SNDRV_PCM_STREAM_CAPTURE].comp_id = COMP_ID_UNASSIGNED; - -- if (pcm) { -- spcm->pcm = *pcm; -- dev_dbg(sdev->dev, "tplg: load pcm %s\n", pcm->dai_name); -- } -+ spcm->pcm = *pcm; -+ dev_dbg(sdev->dev, "tplg: load pcm %s\n", pcm->dai_name); -+ - dai_drv->dobj.private = spcm; - list_add(&spcm->list, &sdev->pcm_list); - --- -2.24.1 - -From b23994307d4c6bea1226d7d84c78de8f5a5f9afd Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 11 Oct 2019 11:43:12 -0500 -Subject: [PATCH 031/109] ASoC: SOF: topology: check errors when parsing LED - tokens - -sof_parse_tokens() returns a value that is checked on every call -except for LED tokens, fix with explicit test. - -Detected with cppcheck warning: - -sound/soc/sof/topology.c:973:6: style: Variable 'ret' is assigned a -value that is never used. [unreadVariable] - ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, - ^ - -Fixes: 5d43001ae4360 ("ASoC: SOF: acpi led support for switch controls") -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191011164312.7988-5-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 8a3ab38c36926ddbda3d2a3086c0a741fa175cff) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 4fa38719c703..6a4b59a0d8e6 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -498,6 +498,11 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, - ARRAY_SIZE(led_tokens), mc->priv.array, - le32_to_cpu(mc->priv.size)); -+ if (ret != 0) { -+ dev_err(sdev->dev, "error: parse led tokens failed %d\n", -+ le32_to_cpu(mc->priv.size)); -+ return ret; -+ } - - dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", - scontrol->comp_id, scontrol->num_channels); --- -2.24.1 - -From 0fce4bacf9c669391c8e149a1d50feeea8e7b45a Mon Sep 17 00:00:00 2001 -From: YueHaibing -Date: Mon, 14 Oct 2019 17:13:08 +0800 -Subject: [PATCH 032/109] ASoC: SOF: Fix randbuild error - -When LEDS_TRIGGER_AUDIO is m and SND_SOC_SOF is y, - -sound/soc/sof/control.o: In function `snd_sof_switch_put': -control.c:(.text+0x587): undefined reference to `ledtrig_audio_set' -control.c:(.text+0x593): undefined reference to `ledtrig_audio_set' - -Reported-by: Hulk Robot -Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls") -Signed-off-by: YueHaibing -Acked-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191014091308.23688-1-yuehaibing@huawei.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 9899a7a869935c4c93247b290ac7a70e0deab202) -Bugzilla: 1772498 ---- - sound/soc/sof/control.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c -index b73d4587c5da..7baf7f1507c3 100644 ---- a/sound/soc/sof/control.c -+++ b/sound/soc/sof/control.c -@@ -36,10 +36,12 @@ static void update_mute_led(struct snd_sof_control *scontrol, - - scontrol->led_ctl.led_value = temp; - -+#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) - if (!scontrol->led_ctl.direction) - ledtrig_audio_set(LED_AUDIO_MUTE, temp ? LED_OFF : LED_ON); - else - ledtrig_audio_set(LED_AUDIO_MICMUTE, temp ? LED_OFF : LED_ON); -+#endif - } - - static inline u32 mixer_to_ipc(unsigned int value, u32 *volume_map, int size) --- -2.24.1 - -From c0ad6198c8bf64123877e61ebff462fff7c37402 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Tue, 22 Oct 2019 14:28:43 -0500 -Subject: [PATCH 033/109] ASoC: SOF: Intel: hda-loader: improve error handling - -If a ROM timeout is detected, we still stop the DMA but will return -the initial error should the DMA stop also fail. - -Likewise the cleanup is handled regardless of the status, but we -return the initial error. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191022192844.21022-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 76dc6a2b312d15c91ff4b4d171e98cdc73ba3745) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-loader.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c -index 356bb134ae93..e24b99fd7d39 100644 ---- a/sound/soc/sof/intel/hda-loader.c -+++ b/sound/soc/sof/intel/hda-loader.c -@@ -253,10 +253,16 @@ static int cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *stream) - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_BASEFW_TIMEOUT_US); - -+ /* -+ * even in case of errors we still need to stop the DMAs, -+ * but we return the initial error should the DMA stop also fail -+ */ -+ - ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_STOP); - if (ret < 0) { - dev_err(sdev->dev, "error: DMA trigger stop failed\n"); -- return ret; -+ if (!status) -+ status = ret; - } - - return status; -@@ -340,13 +346,15 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) - /* - * Perform codeloader stream cleanup. - * This should be done even if firmware loading fails. -+ * If the cleanup also fails, we return the initial error - */ - ret1 = cl_cleanup(sdev, &sdev->dmab, stream); - if (ret1 < 0) { - dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); - - /* set return value to indicate cleanup failure */ -- ret = ret1; -+ if (!ret) -+ ret = ret1; - } - - /* --- -2.24.1 - -From e057b265445a38082f2f566809c98b4615cadbb6 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Tue, 22 Oct 2019 14:28:44 -0500 -Subject: [PATCH 034/109] ASoC: SOF: Intel: hda: add dev_err() traces for - snd_sof_dsp_read_poll_timeout() - -Such traces should be extremely rare but extremely useful for debug. - -Report errors for all calls to sdn_sof_dsp_read_poll_timeout(), but -only on negative values for consistency. - -Add traces that enable each timeout to be uniquely identified. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191022192844.21022-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 6a414489e0f3309a221f26b3d11c19d1a96a3635) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 30 +++++++++++++++++++++++++++--- - sound/soc/sof/intel/hda-loader.c | 13 ++++++++++++- - sound/soc/sof/intel/hda-stream.c | 24 ++++++++++++++++++++---- - 3 files changed, 59 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index fb55a3c5afd0..3ea401646e0c 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -42,6 +42,12 @@ int hda_dsp_core_reset_enter(struct snd_sof_dev *sdev, unsigned int core_mask) - ((adspcs & reset) == reset), - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_RESET_TIMEOUT_US); -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: timeout on HDA_DSP_REG_ADSPCS read\n", -+ __func__); -+ return ret; -+ } - - /* has core entered reset ? */ - adspcs = snd_sof_dsp_read(sdev, HDA_DSP_BAR, -@@ -77,6 +83,13 @@ int hda_dsp_core_reset_leave(struct snd_sof_dev *sdev, unsigned int core_mask) - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_RESET_TIMEOUT_US); - -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: timeout on HDA_DSP_REG_ADSPCS read\n", -+ __func__); -+ return ret; -+ } -+ - /* has core left reset ? */ - adspcs = snd_sof_dsp_read(sdev, HDA_DSP_BAR, - HDA_DSP_REG_ADSPCS); -@@ -151,8 +164,12 @@ int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask) - (adspcs & cpa) == cpa, - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_RESET_TIMEOUT_US); -- if (ret < 0) -- dev_err(sdev->dev, "error: timeout on core powerup\n"); -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: timeout on HDA_DSP_REG_ADSPCS read\n", -+ __func__); -+ return ret; -+ } - - /* did core power up ? */ - adspcs = snd_sof_dsp_read(sdev, HDA_DSP_BAR, -@@ -171,17 +188,24 @@ int hda_dsp_core_power_up(struct snd_sof_dev *sdev, unsigned int core_mask) - int hda_dsp_core_power_down(struct snd_sof_dev *sdev, unsigned int core_mask) - { - u32 adspcs; -+ int ret; - - /* update bits */ - snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, - HDA_DSP_REG_ADSPCS, - HDA_DSP_ADSPCS_SPA_MASK(core_mask), 0); - -- return snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, -+ ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, - HDA_DSP_REG_ADSPCS, adspcs, - !(adspcs & HDA_DSP_ADSPCS_SPA_MASK(core_mask)), - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_PD_TIMEOUT * USEC_PER_MSEC); -+ if (ret < 0) -+ dev_err(sdev->dev, -+ "error: %s: timeout on HDA_DSP_REG_ADSPCS read\n", -+ __func__); -+ -+ return ret; - } - - bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev, -diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c -index e24b99fd7d39..1782f5092639 100644 ---- a/sound/soc/sof/intel/hda-loader.c -+++ b/sound/soc/sof/intel/hda-loader.c -@@ -126,7 +126,8 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, - HDA_DSP_INIT_TIMEOUT_US); - - if (ret < 0) { -- dev_err(sdev->dev, "error: waiting for HIPCIE done\n"); -+ dev_err(sdev->dev, "error: %s: timeout for HIPCIE done\n", -+ __func__); - goto err; - } - -@@ -152,6 +153,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, - if (!ret) - return 0; - -+ dev_err(sdev->dev, -+ "error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n", -+ __func__); -+ - err: - hda_dsp_dump(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX); - hda_dsp_core_reset_power_down(sdev, chip->cores_mask); -@@ -258,6 +263,12 @@ static int cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *stream) - * but we return the initial error should the DMA stop also fail - */ - -+ if (status < 0) { -+ dev_err(sdev->dev, -+ "error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n", -+ __func__); -+ } -+ - ret = cl_trigger(sdev, stream, SNDRV_PCM_TRIGGER_STOP); - if (ret < 0) { - dev_err(sdev->dev, "error: DMA trigger stop failed\n"); -diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c -index 0c11fceb28a7..29ab43281670 100644 ---- a/sound/soc/sof/intel/hda-stream.c -+++ b/sound/soc/sof/intel/hda-stream.c -@@ -275,8 +275,12 @@ int hda_dsp_stream_trigger(struct snd_sof_dev *sdev, - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_STREAM_RUN_TIMEOUT); - -- if (ret) -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: cmd %d: timeout on STREAM_SD_OFFSET read\n", -+ __func__, cmd); - return ret; -+ } - - hstream->running = true; - break; -@@ -294,8 +298,12 @@ int hda_dsp_stream_trigger(struct snd_sof_dev *sdev, - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_STREAM_RUN_TIMEOUT); - -- if (ret) -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: cmd %d: timeout on STREAM_SD_OFFSET read\n", -+ __func__, cmd); - return ret; -+ } - - snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, sd_offset + - SOF_HDA_ADSP_REG_CL_SD_STS, -@@ -356,8 +364,12 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev, - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_STREAM_RUN_TIMEOUT); - -- if (ret) -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: timeout on STREAM_SD_OFFSET read1\n", -+ __func__); - return ret; -+ } - - snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, - sd_offset + SOF_HDA_ADSP_REG_CL_SD_STS, -@@ -418,8 +430,12 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev, - HDA_DSP_REG_POLL_INTERVAL_US, - HDA_DSP_STREAM_RUN_TIMEOUT); - -- if (ret) -+ if (ret < 0) { -+ dev_err(sdev->dev, -+ "error: %s: timeout on STREAM_SD_OFFSET read2\n", -+ __func__); - return ret; -+ } - - snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, - sd_offset + SOF_HDA_ADSP_REG_CL_SD_STS, --- -2.24.1 - -From 9ab29db3973a89c482f1ae7bee4d7800d77f45c2 Mon Sep 17 00:00:00 2001 -From: Pan Xiuli -Date: Tue, 22 Oct 2019 14:47:05 -0500 -Subject: [PATCH 035/109] ASoC: SOF: Intel: initial support to JasperLake. - -Add Kconfig, PCI ID and chip info for JSL platform. -The DSP only has 2 cores for this platform. - -Signed-off-by: Pan Xiuli -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191022194705.23347-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 6fd9903527bf103167004022a0199b8fac1b8b29) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/Kconfig | 16 ++++++++++++++++ - sound/soc/sof/intel/cnl.c | 17 +++++++++++++++++ - sound/soc/sof/intel/hda.h | 1 + - sound/soc/sof/sof-pci-dev.c | 22 ++++++++++++++++++++++ - 4 files changed, 56 insertions(+) - -diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig -index d6d65e70eebb..a40e10dc80d5 100644 ---- a/sound/soc/sof/intel/Kconfig -+++ b/sound/soc/sof/intel/Kconfig -@@ -29,6 +29,7 @@ config SND_SOC_SOF_INTEL_PCI - select SND_SOC_SOF_COMETLAKE_H if SND_SOC_SOF_COMETLAKE_H_SUPPORT - select SND_SOC_SOF_TIGERLAKE if SND_SOC_SOF_TIGERLAKE_SUPPORT - select SND_SOC_SOF_ELKHARTLAKE if SND_SOC_SOF_ELKHARTLAKE_SUPPORT -+ select SND_SOC_SOF_JASPERLAKE if SND_SOC_SOF_JASPERLAKE_SUPPORT - help - This option is not user-selectable but automagically handled by - 'select' statements at a higher level -@@ -252,6 +253,21 @@ config SND_SOC_SOF_ELKHARTLAKE - This option is not user-selectable but automagically handled by - 'select' statements at a higher level - -+config SND_SOC_SOF_JASPERLAKE_SUPPORT -+ bool "SOF support for JasperLake" -+ help -+ This adds support for Sound Open Firmware for Intel(R) platforms -+ using the JasperLake processors. -+ Say Y if you have such a device. -+ If unsure select "N". -+ -+config SND_SOC_SOF_JASPERLAKE -+ tristate -+ select SND_SOC_SOF_HDA_COMMON -+ help -+ This option is not user-selectable but automagically handled by -+ 'select' statements at a higher level -+ - config SND_SOC_SOF_HDA_COMMON - tristate - select SND_SOC_SOF_INTEL_COMMON -diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c -index 4ddd73762d81..5b97bdfba823 100644 ---- a/sound/soc/sof/intel/cnl.c -+++ b/sound/soc/sof/intel/cnl.c -@@ -327,3 +327,20 @@ const struct sof_intel_dsp_desc ehl_chip_info = { - .ssp_base_offset = CNL_SSP_BASE_OFFSET, - }; - EXPORT_SYMBOL(ehl_chip_info); -+ -+const struct sof_intel_dsp_desc jsl_chip_info = { -+ /* Jasperlake */ -+ .cores_num = 2, -+ .init_core_mask = 1, -+ .cores_mask = HDA_DSP_CORE_MASK(0) | -+ HDA_DSP_CORE_MASK(1), -+ .ipc_req = CNL_DSP_REG_HIPCIDR, -+ .ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY, -+ .ipc_ack = CNL_DSP_REG_HIPCIDA, -+ .ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE, -+ .ipc_ctl = CNL_DSP_REG_HIPCCTL, -+ .rom_init_timeout = 300, -+ .ssp_count = ICL_SSP_COUNT, -+ .ssp_base_offset = CNL_SSP_BASE_OFFSET, -+}; -+EXPORT_SYMBOL(jsl_chip_info); -diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h -index 23e430d3e056..ea02bf40cb25 100644 ---- a/sound/soc/sof/intel/hda.h -+++ b/sound/soc/sof/intel/hda.h -@@ -604,5 +604,6 @@ extern const struct sof_intel_dsp_desc skl_chip_info; - extern const struct sof_intel_dsp_desc icl_chip_info; - extern const struct sof_intel_dsp_desc tgl_chip_info; - extern const struct sof_intel_dsp_desc ehl_chip_info; -+extern const struct sof_intel_dsp_desc jsl_chip_info; - - #endif -diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c -index be5a8da504c5..e0b150f29e81 100644 ---- a/sound/soc/sof/sof-pci-dev.c -+++ b/sound/soc/sof/sof-pci-dev.c -@@ -246,6 +246,24 @@ static const struct sof_dev_desc ehl_desc = { - }; - #endif - -+#if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE) -+static const struct sof_dev_desc jsl_desc = { -+ .machines = snd_soc_acpi_intel_jsl_machines, -+ .resindex_lpe_base = 0, -+ .resindex_pcicfg_base = -1, -+ .resindex_imr_base = -1, -+ .irqindex_host_ipc = -1, -+ .resindex_dma_base = -1, -+ .chip_info = &jsl_chip_info, -+ .default_fw_path = "intel/sof", -+ .default_tplg_path = "intel/sof-tplg", -+ .nocodec_fw_filename = "sof-jsl.ri", -+ .nocodec_tplg_filename = "sof-jsl-nocodec.tplg", -+ .ops = &sof_cnl_ops, -+ .arch_ops = &sof_xtensa_arch_ops -+}; -+#endif -+ - static const struct dev_pm_ops sof_pci_pm = { - SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume) - SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume, -@@ -429,6 +447,10 @@ static const struct pci_device_id sof_pci_ids[] = { - { PCI_DEVICE(0x8086, 0x34C8), - .driver_data = (unsigned long)&icl_desc}, - #endif -+#if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE) -+ { PCI_DEVICE(0x8086, 0x38c8), -+ .driver_data = (unsigned long)&jsl_desc}, -+#endif - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) - { PCI_DEVICE(0x8086, 0x02c8), - .driver_data = (unsigned long)&cml_desc}, --- -2.24.1 - -From 8944590a924791652dc14b2e7cffb7102f366ad5 Mon Sep 17 00:00:00 2001 -From: Pan Xiuli -Date: Tue, 22 Oct 2019 14:47:04 -0500 -Subject: [PATCH 036/109] ASoC: Intel: common: add ACPI matching tables for JSL - -There are no upstream machine drivers just yet so just add dummy table -for compilation in nocodec-mode. - -Signed-off-by: Pan Xiuli -Link: https://lore.kernel.org/r/20191022194705.23347-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 4f0637eae56f02ef648de5ed839d572259d396e9) -Bugzilla: 1772498 ---- - include/sound/soc-acpi-intel-match.h | 1 + - sound/soc/intel/common/Makefile | 1 + - .../intel/common/soc-acpi-intel-jsl-match.c | 18 ++++++++++++++++++ - 3 files changed, 20 insertions(+) - create mode 100644 sound/soc/intel/common/soc-acpi-intel-jsl-match.c - -diff --git a/include/sound/soc-acpi-intel-match.h b/include/sound/soc-acpi-intel-match.h -index 6c9929abd90b..4e44782862df 100644 ---- a/include/sound/soc-acpi-intel-match.h -+++ b/include/sound/soc-acpi-intel-match.h -@@ -27,6 +27,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ehl_machines[]; -+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[]; - - /* - * generic table used for HDA codec-based platforms, possibly with -diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile -index 18d9630ae9a2..eafe95ead49b 100644 ---- a/sound/soc/intel/common/Makefile -+++ b/sound/soc/intel/common/Makefile -@@ -9,6 +9,7 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m - soc-acpi-intel-bxt-match.o soc-acpi-intel-glk-match.o \ - soc-acpi-intel-cnl-match.o soc-acpi-intel-icl-match.o \ - soc-acpi-intel-tgl-match.o soc-acpi-intel-ehl-match.o \ -+ soc-acpi-intel-jsl-match.o \ - soc-acpi-intel-hda-match.o - - obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o -diff --git a/sound/soc/intel/common/soc-acpi-intel-jsl-match.c b/sound/soc/intel/common/soc-acpi-intel-jsl-match.c -new file mode 100644 -index 000000000000..1c68a04f0c6e ---- /dev/null -+++ b/sound/soc/intel/common/soc-acpi-intel-jsl-match.c -@@ -0,0 +1,18 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * soc-apci-intel-jsl-match.c - tables and support for JSL ACPI enumeration. -+ * -+ * Copyright (c) 2019, Intel Corporation. -+ * -+ */ -+ -+#include -+#include -+ -+struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = { -+ {}, -+}; -+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_jsl_machines); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Intel Common ACPI Match module"); --- -2.24.1 - -From 4ab80912a87e828850601ac1d0d2804467e3e7f9 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 24 Oct 2019 16:03:17 -0500 -Subject: [PATCH 037/109] ASoC: SOF: define INFO_ flags in dsp_ops - -Currently the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP are defined -in the SOF PCM core, which doesn't scale. To account for platform -variations, these flags need to be set in DSP ops. - -This patch only moves the definitions and does not change any -functionality. - -Reviewed-by: Jaska Uimonen -Reviewed-by: Ranjani Sridharan -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191024210318.30068-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 27e322fabd508ba73ced625fc41f0b7ceee26416) -Bugzilla: 1772498 ---- - sound/soc/sof/imx/imx8.c | 7 +++++++ - sound/soc/sof/intel/apl.c | 7 +++++++ - sound/soc/sof/intel/bdw.c | 9 ++++++++- - sound/soc/sof/intel/byt.c | 21 +++++++++++++++++++++ - sound/soc/sof/intel/cnl.c | 7 +++++++ - sound/soc/sof/pcm.c | 8 +++----- - sound/soc/sof/sof-priv.h | 3 +++ - 7 files changed, 56 insertions(+), 6 deletions(-) - -diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c -index 69785f688ddf..aef6ca167b9c 100644 ---- a/sound/soc/sof/imx/imx8.c -+++ b/sound/soc/sof/imx/imx8.c -@@ -391,6 +391,13 @@ struct snd_sof_dsp_ops sof_imx8_ops = { - /* DAI drivers */ - .drv = imx8_dai, - .num_drv = 1, /* we have only 1 ESAI interface on i.MX8 */ -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP - }; - EXPORT_SYMBOL(sof_imx8_ops); - -diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c -index 8dc7a5558da4..15d26e8d90a9 100644 ---- a/sound/soc/sof/intel/apl.c -+++ b/sound/soc/sof/intel/apl.c -@@ -97,6 +97,13 @@ const struct snd_sof_dsp_ops sof_apl_ops = { - .runtime_resume = hda_dsp_runtime_resume, - .runtime_idle = hda_dsp_runtime_idle, - .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume, -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, - }; - EXPORT_SYMBOL(sof_apl_ops); - -diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c -index bf961a8798a7..7b4cd1f456bf 100644 ---- a/sound/soc/sof/intel/bdw.c -+++ b/sound/soc/sof/intel/bdw.c -@@ -591,7 +591,14 @@ const struct snd_sof_dsp_ops sof_bdw_ops = { - - /* DAI drivers */ - .drv = bdw_dai, -- .num_drv = ARRAY_SIZE(bdw_dai) -+ .num_drv = ARRAY_SIZE(bdw_dai), -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, - }; - EXPORT_SYMBOL(sof_bdw_ops); - -diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c -index 84d6069b5075..514cf4b9ebf4 100644 ---- a/sound/soc/sof/intel/byt.c -+++ b/sound/soc/sof/intel/byt.c -@@ -533,6 +533,13 @@ const struct snd_sof_dsp_ops sof_tng_ops = { - /* DAI drivers */ - .drv = byt_dai, - .num_drv = 3, /* we have only 3 SSPs on byt*/ -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, - }; - EXPORT_SYMBOL(sof_tng_ops); - -@@ -694,6 +701,13 @@ const struct snd_sof_dsp_ops sof_byt_ops = { - /* DAI drivers */ - .drv = byt_dai, - .num_drv = 3, /* we have only 3 SSPs on byt*/ -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, - }; - EXPORT_SYMBOL(sof_byt_ops); - -@@ -754,6 +768,13 @@ const struct snd_sof_dsp_ops sof_cht_ops = { - .drv = byt_dai, - /* all 6 SSPs may be available for cherrytrail */ - .num_drv = ARRAY_SIZE(byt_dai), -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, - }; - EXPORT_SYMBOL(sof_cht_ops); - -diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c -index 5b97bdfba823..e9cdcc040fb5 100644 ---- a/sound/soc/sof/intel/cnl.c -+++ b/sound/soc/sof/intel/cnl.c -@@ -255,6 +255,13 @@ const struct snd_sof_dsp_ops sof_cnl_ops = { - .runtime_resume = hda_dsp_runtime_resume, - .runtime_idle = hda_dsp_runtime_idle, - .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume, -+ -+ /* ALSA HW info flags */ -+ .hw_info = SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE | -+ SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, - }; - EXPORT_SYMBOL(sof_cnl_ops); - -diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c -index b0f4217433e5..b33928e1385b 100644 ---- a/sound/soc/sof/pcm.c -+++ b/sound/soc/sof/pcm.c -@@ -435,6 +435,7 @@ static int sof_pcm_open(struct snd_pcm_substream *substream) - struct snd_soc_component *component = - snd_soc_rtdcom_lookup(rtd, DRV_NAME); - struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); -+ const struct snd_sof_dsp_ops *ops = sof_ops(sdev); - struct snd_sof_pcm *spcm; - struct snd_soc_tplg_stream_caps *caps; - int ret; -@@ -464,11 +465,8 @@ static int sof_pcm_open(struct snd_pcm_substream *substream) - le32_to_cpu(caps->period_size_min)); - - /* set runtime config */ -- runtime->hw.info = SNDRV_PCM_INFO_MMAP | -- SNDRV_PCM_INFO_MMAP_VALID | -- SNDRV_PCM_INFO_INTERLEAVED | -- SNDRV_PCM_INFO_PAUSE | -- SNDRV_PCM_INFO_NO_PERIOD_WAKEUP; -+ runtime->hw.info = ops->hw_info; /* platform-specific */ -+ - runtime->hw.formats = le64_to_cpu(caps->formats); - runtime->hw.period_bytes_min = le32_to_cpu(caps->period_size_min); - runtime->hw.period_bytes_max = le32_to_cpu(caps->period_size_max); -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 9729deafec08..26ea5099bf4e 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -211,6 +211,9 @@ struct snd_sof_dsp_ops { - /* DAI ops */ - struct snd_soc_dai_driver *drv; - int num_drv; -+ -+ /* ALSA HW info flags, will be stored in snd_pcm_runtime.hw.info */ -+ u32 hw_info; - }; - - /* DSP architecture specific callbacks for oops and stack dumps */ --- -2.24.1 - -From 70c1d574a342bb625ac80e233531188121ecb526 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Thu, 24 Oct 2019 16:03:18 -0500 -Subject: [PATCH 038/109] ASoC: SOF: Intel: only support INFO_BATCH for legacy - platforms - -The current position update is not precise enough for PulseAudio to -work reliably with the timer-based scheduling on Baytrail, -Cherrytrail, Broadwell. - -Disable the NO_PERIOD_WAKEUP capability and use BATCH to signal that -the position is only reliable and updated during period_elapsed -events. - -This will be reverted when the firmware provides a more accurate -position for those platforms. - -Reviewed-by: Jaska Uimonen -Reviewed-by: Ranjani Sridharan -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191024210318.30068-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 4c02a7bd43e22f4de53ad55b94d24e4388f712f0) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/bdw.c | 2 +- - sound/soc/sof/intel/byt.c | 6 +++--- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c -index 7b4cd1f456bf..141dad554764 100644 ---- a/sound/soc/sof/intel/bdw.c -+++ b/sound/soc/sof/intel/bdw.c -@@ -598,7 +598,7 @@ const struct snd_sof_dsp_ops sof_bdw_ops = { - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_PAUSE | -- SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, -+ SNDRV_PCM_INFO_BATCH, - }; - EXPORT_SYMBOL(sof_bdw_ops); - -diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c -index 514cf4b9ebf4..a39a90d61b8f 100644 ---- a/sound/soc/sof/intel/byt.c -+++ b/sound/soc/sof/intel/byt.c -@@ -539,7 +539,7 @@ const struct snd_sof_dsp_ops sof_tng_ops = { - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_PAUSE | -- SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, -+ SNDRV_PCM_INFO_BATCH, - }; - EXPORT_SYMBOL(sof_tng_ops); - -@@ -707,7 +707,7 @@ const struct snd_sof_dsp_ops sof_byt_ops = { - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_PAUSE | -- SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, -+ SNDRV_PCM_INFO_BATCH, - }; - EXPORT_SYMBOL(sof_byt_ops); - -@@ -774,7 +774,7 @@ const struct snd_sof_dsp_ops sof_cht_ops = { - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_PAUSE | -- SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, -+ SNDRV_PCM_INFO_BATCH, - }; - EXPORT_SYMBOL(sof_cht_ops); - --- -2.24.1 - -From ba899e9f4bddd20463b3ba20ba77918ada567e5a Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 28 Oct 2019 18:33:29 +0100 -Subject: [PATCH 039/109] ASoC: SOF - remove the dead code (skylake/kabylake) - -Appearently the CONFIG_SND_SOC_SOF_KABYLAKE and CONFIG_SND_SOC_SOF_SKYLAKE -options are not present in Kconfig and 'struct snd_sof_dsp_ops sof_skl_ops' -is not declared in the code, too. - -Signed-off-by: Jaroslav Kysela -Cc: Pierre-Louis Bossart -Cc: Mark Brown -Link: https://lore.kernel.org/r/20191028173329.29538-1-perex@perex.cz -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit c3ad1092e1069f27d0ca110dcaada8a5435ea3e0) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda.h | 1 - - sound/soc/sof/sof-pci-dev.c | 44 ------------------------------------- - 2 files changed, 45 deletions(-) - -diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h -index ea02bf40cb25..8e03d876a0ac 100644 ---- a/sound/soc/sof/intel/hda.h -+++ b/sound/soc/sof/intel/hda.h -@@ -596,7 +596,6 @@ extern struct snd_soc_dai_driver skl_dai[]; - */ - extern const struct snd_sof_dsp_ops sof_apl_ops; - extern const struct snd_sof_dsp_ops sof_cnl_ops; --extern const struct snd_sof_dsp_ops sof_skl_ops; - - extern const struct sof_intel_dsp_desc apl_chip_info; - extern const struct sof_intel_dsp_desc cnl_chip_info; -diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c -index e0b150f29e81..067acf389af7 100644 ---- a/sound/soc/sof/sof-pci-dev.c -+++ b/sound/soc/sof/sof-pci-dev.c -@@ -174,42 +174,6 @@ static const struct sof_dev_desc icl_desc = { - }; - #endif - --#if IS_ENABLED(CONFIG_SND_SOC_SOF_SKYLAKE) --static const struct sof_dev_desc skl_desc = { -- .machines = snd_soc_acpi_intel_skl_machines, -- .resindex_lpe_base = 0, -- .resindex_pcicfg_base = -1, -- .resindex_imr_base = -1, -- .irqindex_host_ipc = -1, -- .resindex_dma_base = -1, -- .chip_info = &skl_chip_info, -- .default_fw_path = "intel/sof", -- .default_tplg_path = "intel/sof-tplg", -- .nocodec_fw_filename = "sof-skl.ri", -- .nocodec_tplg_filename = "sof-skl-nocodec.tplg", -- .ops = &sof_skl_ops, -- .arch_ops = &sof_xtensa_arch_ops --}; --#endif -- --#if IS_ENABLED(CONFIG_SND_SOC_SOF_KABYLAKE) --static const struct sof_dev_desc kbl_desc = { -- .machines = snd_soc_acpi_intel_kbl_machines, -- .resindex_lpe_base = 0, -- .resindex_pcicfg_base = -1, -- .resindex_imr_base = -1, -- .irqindex_host_ipc = -1, -- .resindex_dma_base = -1, -- .chip_info = &skl_chip_info, -- .default_fw_path = "intel/sof", -- .default_tplg_path = "intel/sof-tplg", -- .nocodec_fw_filename = "sof-kbl.ri", -- .nocodec_tplg_filename = "sof-kbl-nocodec.tplg", -- .ops = &sof_skl_ops, -- .arch_ops = &sof_xtensa_arch_ops --}; --#endif -- - #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE) - static const struct sof_dev_desc tgl_desc = { - .machines = snd_soc_acpi_intel_tgl_machines, -@@ -435,14 +399,6 @@ static const struct pci_device_id sof_pci_ids[] = { - { PCI_DEVICE(0x8086, 0xa348), - .driver_data = (unsigned long)&cfl_desc}, - #endif --#if IS_ENABLED(CONFIG_SND_SOC_SOF_KABYLAKE) -- { PCI_DEVICE(0x8086, 0x9d71), -- .driver_data = (unsigned long)&kbl_desc}, --#endif --#if IS_ENABLED(CONFIG_SND_SOC_SOF_SKYLAKE) -- { PCI_DEVICE(0x8086, 0x9d70), -- .driver_data = (unsigned long)&skl_desc}, --#endif - #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE) - { PCI_DEVICE(0x8086, 0x34C8), - .driver_data = (unsigned long)&icl_desc}, --- -2.24.1 - -From daeba620beb2a67339b7043c2804cf7f1833dbef Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:10 +0200 -Subject: [PATCH 040/109] ASoC: hdac_hda: add support for HDMI/DP as a HDA - codec - -Handle all HDA codecs using same logic, including HDMI/DP. - -Call to snd_hda_codec_build_controls() is delayed for HDMI/DP HDA -devices. This is needed to discover the PCM device numbers as -defined in topology. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-3-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 608b8c36c37114289e3ea328783161f542fdf71d) -Bugzilla: 1772498 ---- - sound/soc/codecs/hdac_hda.c | 114 ++++++++++++++++++++++++++++++++---- - sound/soc/codecs/hdac_hda.h | 13 +++- - 2 files changed, 114 insertions(+), 13 deletions(-) - -diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c -index d78f4d856aaf..43110151e928 100644 ---- a/sound/soc/codecs/hdac_hda.c -+++ b/sound/soc/codecs/hdac_hda.c -@@ -14,13 +14,11 @@ - #include - #include - #include -+#include - #include - #include --#include "hdac_hda.h" - --#define HDAC_ANALOG_DAI_ID 0 --#define HDAC_DIGITAL_DAI_ID 1 --#define HDAC_ALT_ANALOG_DAI_ID 2 -+#include "hdac_hda.h" - - #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ - SNDRV_PCM_FMTBIT_U8 | \ -@@ -32,6 +30,11 @@ - SNDRV_PCM_FMTBIT_U32_LE | \ - SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) - -+#define STUB_HDMI_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\ -+ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 |\ -+ SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\ -+ SNDRV_PCM_RATE_192000) -+ - static int hdac_hda_dai_open(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai); - static void hdac_hda_dai_close(struct snd_pcm_substream *substream, -@@ -121,7 +124,46 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = { - .formats = STUB_FORMATS, - .sig_bits = 24, - }, --} -+}, -+{ -+ .id = HDAC_HDMI_0_DAI_ID, -+ .name = "intel-hdmi-hifi1", -+ .ops = &hdac_hda_dai_ops, -+ .playback = { -+ .stream_name = "hifi1", -+ .channels_min = 1, -+ .channels_max = 32, -+ .rates = STUB_HDMI_RATES, -+ .formats = STUB_FORMATS, -+ .sig_bits = 24, -+ }, -+}, -+{ -+ .id = HDAC_HDMI_1_DAI_ID, -+ .name = "intel-hdmi-hifi2", -+ .ops = &hdac_hda_dai_ops, -+ .playback = { -+ .stream_name = "hifi2", -+ .channels_min = 1, -+ .channels_max = 32, -+ .rates = STUB_HDMI_RATES, -+ .formats = STUB_FORMATS, -+ .sig_bits = 24, -+ }, -+}, -+{ -+ .id = HDAC_HDMI_2_DAI_ID, -+ .name = "intel-hdmi-hifi3", -+ .ops = &hdac_hda_dai_ops, -+ .playback = { -+ .stream_name = "hifi3", -+ .channels_min = 1, -+ .channels_max = 32, -+ .rates = STUB_HDMI_RATES, -+ .formats = STUB_FORMATS, -+ .sig_bits = 24, -+ }, -+}, - - }; - -@@ -135,10 +177,11 @@ static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, - - hda_pvt = snd_soc_component_get_drvdata(component); - pcm = &hda_pvt->pcm[dai->id]; -+ - if (tx_mask) -- pcm[dai->id].stream_tag[SNDRV_PCM_STREAM_PLAYBACK] = tx_mask; -+ pcm->stream_tag[SNDRV_PCM_STREAM_PLAYBACK] = tx_mask; - else -- pcm[dai->id].stream_tag[SNDRV_PCM_STREAM_CAPTURE] = rx_mask; -+ pcm->stream_tag[SNDRV_PCM_STREAM_CAPTURE] = rx_mask; - - return 0; - } -@@ -278,6 +321,12 @@ static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt, - struct hda_pcm *cpcm; - const char *pcm_name; - -+ /* -+ * map DAI ID to the closest matching PCM name, using the naming -+ * scheme used by hda-codec snd_hda_gen_build_pcms() and for -+ * HDMI in hda_codec patch_hdmi.c) -+ */ -+ - switch (dai->id) { - case HDAC_ANALOG_DAI_ID: - pcm_name = "Analog"; -@@ -288,13 +337,22 @@ static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt, - case HDAC_ALT_ANALOG_DAI_ID: - pcm_name = "Alt Analog"; - break; -+ case HDAC_HDMI_0_DAI_ID: -+ pcm_name = "HDMI 0"; -+ break; -+ case HDAC_HDMI_1_DAI_ID: -+ pcm_name = "HDMI 1"; -+ break; -+ case HDAC_HDMI_2_DAI_ID: -+ pcm_name = "HDMI 2"; -+ break; - default: - dev_err(&hcodec->core.dev, "invalid dai id %d\n", dai->id); - return NULL; - } - - list_for_each_entry(cpcm, &hcodec->pcm_list_head, list) { -- if (strpbrk(cpcm->name, pcm_name)) -+ if (strstr(cpcm->name, pcm_name)) - return cpcm; - } - -@@ -302,6 +360,18 @@ static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt, - return NULL; - } - -+static bool is_hdmi_codec(struct hda_codec *hcodec) -+{ -+ struct hda_pcm *cpcm; -+ -+ list_for_each_entry(cpcm, &hcodec->pcm_list_head, list) { -+ if (cpcm->pcm_type == HDA_PCM_TYPE_HDMI) -+ return true; -+ } -+ -+ return false; -+} -+ - static int hdac_hda_codec_probe(struct snd_soc_component *component) - { - struct hdac_hda_priv *hda_pvt = -@@ -322,6 +392,15 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - - snd_hdac_ext_bus_link_get(hdev->bus, hlink); - -+ /* -+ * Ensure any HDA display is powered at codec probe. -+ * After snd_hda_codec_device_new(), display power is -+ * managed by runtime PM. -+ */ -+ if (hda_pvt->need_display_power) -+ snd_hdac_display_power(hdev->bus, -+ HDA_CODEC_IDX_CONTROLLER, true); -+ - ret = snd_hda_codec_device_new(hcodec->bus, component->card->snd_card, - hdev->addr, hcodec); - if (ret < 0) { -@@ -366,20 +445,31 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) - dev_dbg(&hdev->dev, "no patch file found\n"); - } - -+ /* configure codec for 1:1 PCM:DAI mapping */ -+ hcodec->mst_no_extra_pcms = 1; -+ - ret = snd_hda_codec_parse_pcms(hcodec); - if (ret < 0) { - dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret); - goto error; - } - -- ret = snd_hda_codec_build_controls(hcodec); -- if (ret < 0) { -- dev_err(&hdev->dev, "unable to create controls %d\n", ret); -- goto error; -+ /* HDMI controls need to be created in machine drivers */ -+ if (!is_hdmi_codec(hcodec)) { -+ ret = snd_hda_codec_build_controls(hcodec); -+ if (ret < 0) { -+ dev_err(&hdev->dev, "unable to create controls %d\n", -+ ret); -+ goto error; -+ } - } - - hcodec->core.lazy_cache = true; - -+ if (hda_pvt->need_display_power) -+ snd_hdac_display_power(hdev->bus, -+ HDA_CODEC_IDX_CONTROLLER, false); -+ - /* - * hdac_device core already sets the state to active and calls - * get_noresume. So enable runtime and set the device to suspend. -diff --git a/sound/soc/codecs/hdac_hda.h b/sound/soc/codecs/hdac_hda.h -index 6b1bd4f428e7..e145cec085b8 100644 ---- a/sound/soc/codecs/hdac_hda.h -+++ b/sound/soc/codecs/hdac_hda.h -@@ -6,6 +6,16 @@ - #ifndef __HDAC_HDA_H__ - #define __HDAC_HDA_H__ - -+enum { -+ HDAC_ANALOG_DAI_ID = 0, -+ HDAC_DIGITAL_DAI_ID, -+ HDAC_ALT_ANALOG_DAI_ID, -+ HDAC_HDMI_0_DAI_ID, -+ HDAC_HDMI_1_DAI_ID, -+ HDAC_HDMI_2_DAI_ID, -+ HDAC_LAST_DAI_ID = HDAC_HDMI_2_DAI_ID, -+}; -+ - struct hdac_hda_pcm { - int stream_tag[2]; - unsigned int format_val[2]; -@@ -13,7 +23,8 @@ struct hdac_hda_pcm { - - struct hdac_hda_priv { - struct hda_codec codec; -- struct hdac_hda_pcm pcm[2]; -+ struct hdac_hda_pcm pcm[HDAC_LAST_DAI_ID]; -+ bool need_display_power; - }; - - #define hdac_to_hda_priv(_hdac) \ --- -2.24.1 - -From c8494550b526e38b4db5ad1b3248d5713984ee72 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:35 -0500 -Subject: [PATCH 041/109] ASoC: SOF: Intel: Baytrail: clarify mutual exclusion - with Atom/SST driver - -Some distros select all options blindly, which leads to confusion and -bug reports. Since SOF does not support Baytrail-CR for now, and -UCM/topology files are still being propagated to downstream distros, -make SOF on Baytrail an opt-in option that first require distros to -opt-out of existing defaults. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit df7257e544faf838c3e7ad6b4e89ffe59e87f5e1) -Bugzilla: 1772498 ---- - sound/soc/intel/Kconfig | 3 +++ - sound/soc/sof/intel/Kconfig | 10 +++++++++- - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig -index c15230cec851..658eff2daf4e 100644 ---- a/sound/soc/intel/Kconfig -+++ b/sound/soc/intel/Kconfig -@@ -104,6 +104,9 @@ config SND_SST_ATOM_HIFI2_PLATFORM_ACPI - If you have a Intel Baytrail or Cherrytrail platform with an I2S - codec, then enable this option by saying Y or m. This is a - recommended option -+ This option is mutually exclusive with the SOF support on -+ Baytrail/Cherrytrail. If you want to enable SOF on -+ Baytrail/Cherrytrail, you need to deselect this option first. - - config SND_SOC_INTEL_SKYLAKE - tristate "All Skylake/SST Platforms" -diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig -index a40e10dc80d5..6e9a2633871f 100644 ---- a/sound/soc/sof/intel/Kconfig -+++ b/sound/soc/sof/intel/Kconfig -@@ -62,10 +62,18 @@ if SND_SOC_SOF_INTEL_ACPI - - config SND_SOC_SOF_BAYTRAIL_SUPPORT - bool "SOF support for Baytrail, Braswell and Cherrytrail" -+ depends on SND_SST_ATOM_HIFI2_PLATFORM_ACPI=n - help - This adds support for Sound Open Firmware for Intel(R) platforms - using the Baytrail, Braswell or Cherrytrail processors. -- Say Y if you have such a device. -+ This option is mutually exclusive with the Atom/SST and Baytrail -+ legacy drivers. If you want to enable SOF on Baytrail/Cherrytrail, -+ you need to deselect those options first. -+ SOF does not support Baytrail-CR for now, so this option is not -+ recommended for distros. At some point all legacy drivers will be -+ deprecated but not before all userspace firmware/topology/UCM files -+ are made available to downstream distros. -+ Say Y if you want to enable SOF on Baytrail/Cherrytrail - If unsure select "N". - - config SND_SOC_SOF_BAYTRAIL --- -2.24.1 - -From a83dca7b0d30f65ef5a06c46ce2140ead3a3443e Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:38 -0500 -Subject: [PATCH 042/109] ASoC: SOF: Kconfig: add EXPERT dependency for - developer options, clarify help - -Some distros select all possible options, despite existing warnings to -be careful. This leads to e.g. user reports that the HDaudio codec and -DMIC are not handled by SOF. - -Add an explicit menu item to unlock developer options, and make them -dependent on CONFIG_EXPERT. Hopefully with this double-lock these -options will only be selected by developers. - -GitHub issue: https://github.com/thesofproject/sof/issues/1885 -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-5-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 70ae4eb540af32ee6a6260143ccae6054ebd433f) -Bugzilla: 1772498 ---- - sound/soc/sof/Kconfig | 25 ++++++++++++++++--------- - 1 file changed, 16 insertions(+), 9 deletions(-) - -diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig -index 56a3ab66b46b..6435eb531668 100644 ---- a/sound/soc/sof/Kconfig -+++ b/sound/soc/sof/Kconfig -@@ -14,7 +14,6 @@ config SND_SOC_SOF_PCI - depends on PCI - select SND_SOC_SOF - select SND_SOC_ACPI if ACPI -- select SND_SOC_SOF_OPTIONS - select SND_SOC_SOF_INTEL_PCI if SND_SOC_SOF_INTEL_TOPLEVEL - help - This adds support for PCI enumeration. This option is -@@ -27,7 +26,6 @@ config SND_SOC_SOF_ACPI - depends on ACPI || COMPILE_TEST - select SND_SOC_SOF - select SND_SOC_ACPI if ACPI -- select SND_SOC_SOF_OPTIONS - select SND_SOC_SOF_INTEL_ACPI if SND_SOC_SOF_INTEL_TOPLEVEL - select IOSF_MBI if X86 && PCI - help -@@ -40,19 +38,23 @@ config SND_SOC_SOF_OF - tristate "SOF OF enumeration support" - depends on OF || COMPILE_TEST - select SND_SOC_SOF -- select SND_SOC_SOF_OPTIONS - help - This adds support for Device Tree enumeration. This option is - required to enable i.MX8 devices. - Say Y if you need this option. If unsure select "N". - --config SND_SOC_SOF_OPTIONS -- tristate -+config SND_SOC_SOF_DEVELOPER_SUPPORT -+ bool "SOF developer options support" -+ depends on EXPERT - help -- This option is not user-selectable but automagically handled by -- 'select' statements at a higher level -+ This option unlock SOF developer options for debug/performance/ -+ code hardening. -+ Distributions should not select this option, only SOF development -+ teams should select it. -+ Say Y if you are involved in SOF development and need this option -+ If not, select N - --if SND_SOC_SOF_OPTIONS -+if SND_SOC_SOF_DEVELOPER_SUPPORT - - config SND_SOC_SOF_NOCODEC - tristate -@@ -64,6 +66,11 @@ config SND_SOC_SOF_NOCODEC_SUPPORT - option if no known codec is detected. This is typically only - enabled for developers or devices where the sound card is - controlled externally -+ This option is mutually exclusive with the Intel HDaudio support, -+ selecting it may have negative impacts and prevent e.g. microphone -+ functionality from being enabled on Intel CoffeeLake and later -+ platforms. -+ Distributions should not select this option! - Say Y if you need this nocodec fallback option - If unsure select "N". - -@@ -168,7 +175,7 @@ config SND_SOC_SOF_DEBUG_RETAIN_DSP_CONTEXT - - endif ## SND_SOC_SOF_DEBUG - --endif ## SND_SOC_SOF_OPTIONS -+endif ## SND_SOC_SOF_DEVELOPER_SUPPORT - - config SND_SOC_SOF - tristate --- -2.24.1 - -From 43b263fd28a8cae9172f26bc6d35c5cee916f1e0 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:40 -0500 -Subject: [PATCH 043/109] ASoC: SOF: Intel: use def_tristate, avoid using - select - -So far we used select to use the relevant built-in/module options, but -this led to blurring layers between core and Intel Kconfigs. - -Use def_tristate works just as well and removes Intel stuff from the code. - -Suggested-by: Arnd Bergmann -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-7-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit b000135e5f272118e576e9720590e5979f0abe49) -Bugzilla: 1772498 ---- - sound/soc/sof/Kconfig | 2 -- - sound/soc/sof/intel/Kconfig | 4 ++-- - 2 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig -index 6435eb531668..71a0fc075a63 100644 ---- a/sound/soc/sof/Kconfig -+++ b/sound/soc/sof/Kconfig -@@ -14,7 +14,6 @@ config SND_SOC_SOF_PCI - depends on PCI - select SND_SOC_SOF - select SND_SOC_ACPI if ACPI -- select SND_SOC_SOF_INTEL_PCI if SND_SOC_SOF_INTEL_TOPLEVEL - help - This adds support for PCI enumeration. This option is - required to enable Intel Skylake+ devices -@@ -26,7 +25,6 @@ config SND_SOC_SOF_ACPI - depends on ACPI || COMPILE_TEST - select SND_SOC_SOF - select SND_SOC_ACPI if ACPI -- select SND_SOC_SOF_INTEL_ACPI if SND_SOC_SOF_INTEL_TOPLEVEL - select IOSF_MBI if X86 && PCI - help - This adds support for ACPI enumeration. This option is required -diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig -index 6e9a2633871f..acc3e91d9244 100644 ---- a/sound/soc/sof/intel/Kconfig -+++ b/sound/soc/sof/intel/Kconfig -@@ -10,7 +10,7 @@ config SND_SOC_SOF_INTEL_TOPLEVEL - if SND_SOC_SOF_INTEL_TOPLEVEL - - config SND_SOC_SOF_INTEL_ACPI -- tristate -+ def_tristate SND_SOC_SOF_ACPI - select SND_SOC_SOF_BAYTRAIL if SND_SOC_SOF_BAYTRAIL_SUPPORT - select SND_SOC_SOF_BROADWELL if SND_SOC_SOF_BROADWELL_SUPPORT - help -@@ -18,7 +18,7 @@ config SND_SOC_SOF_INTEL_ACPI - 'select' statements at a higher level - - config SND_SOC_SOF_INTEL_PCI -- tristate -+ def_tristate SND_SOC_SOF_PCI - select SND_SOC_SOF_MERRIFIELD if SND_SOC_SOF_MERRIFIELD_SUPPORT - select SND_SOC_SOF_APOLLOLAKE if SND_SOC_SOF_APOLLOLAKE_SUPPORT - select SND_SOC_SOF_GEMINILAKE if SND_SOC_SOF_GEMINILAKE_SUPPORT --- -2.24.1 - -From cedd030ba9990481d92f7461439460d1e93ac6f7 Mon Sep 17 00:00:00 2001 -From: Krzysztof Kozlowski -Date: Fri, 4 Oct 2019 16:49:31 +0200 -Subject: [PATCH 044/109] sound: Fix Kconfig indentation - -Adjust indentation from spaces to tab (+optional two spaces) as in -coding style with command like: - $ sed -e 's/^ /\t/' -i */Kconfig - -Signed-off-by: Krzysztof Kozlowski -Acked-by: Mark Brown -Link: https://lore.kernel.org/r/20191004144931.3851-1-krzk@kernel.org -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 82e8d723e9e6698572098bf2976223d5069b34b5) -Bugzilla: 1772498 ---- - sound/core/Kconfig | 28 ++++++++++---------- - sound/drivers/Kconfig | 20 +++++++------- - sound/firewire/Kconfig | 6 ++--- - sound/isa/Kconfig | 18 ++++++------- - sound/mips/Kconfig | 12 ++++----- - sound/pci/Kconfig | 2 +- - sound/soc/cirrus/Kconfig | 14 +++++----- - sound/soc/codecs/Kconfig | 32 +++++++++++------------ - sound/soc/intel/Kconfig | 2 +- - sound/soc/intel/boards/Kconfig | 48 +++++++++++++++++----------------- - sound/soc/pxa/Kconfig | 16 ++++++------ - sound/soc/qcom/Kconfig | 20 +++++++------- - sound/soc/samsung/Kconfig | 8 +++--- - sound/soc/sof/imx/Kconfig | 12 ++++----- - sound/soc/sof/intel/Kconfig | 22 ++++++++-------- - sound/soc/xilinx/Kconfig | 20 +++++++------- - sound/soc/zte/Kconfig | 12 ++++----- - sound/usb/Kconfig | 32 +++++++++++------------ - 18 files changed, 162 insertions(+), 162 deletions(-) - -diff --git a/sound/core/Kconfig b/sound/core/Kconfig -index 4ee79ad6ae22..4044c42d8595 100644 ---- a/sound/core/Kconfig -+++ b/sound/core/Kconfig -@@ -72,11 +72,11 @@ config SND_PCM_OSS - config SND_PCM_OSS_PLUGINS - bool "OSS PCM (digital audio) API - Include plugin system" - depends on SND_PCM_OSS -- default y -+ default y - help -- If you disable this option, the ALSA's OSS PCM API will not -- support conversion of channels, formats and rates. It will -- behave like most of new OSS/Free drivers in 2.4/2.6 kernels. -+ If you disable this option, the ALSA's OSS PCM API will not -+ support conversion of channels, formats and rates. It will -+ behave like most of new OSS/Free drivers in 2.4/2.6 kernels. - - config SND_PCM_TIMER - bool "PCM timer interface" if EXPERT -@@ -128,13 +128,13 @@ config SND_SUPPORT_OLD_API - or older). - - config SND_PROC_FS -- bool "Sound Proc FS Support" if EXPERT -- depends on PROC_FS -- default y -- help -- Say 'N' to disable Sound proc FS, which may reduce code size about -- 9KB on x86_64 platform. -- If unsure say Y. -+ bool "Sound Proc FS Support" if EXPERT -+ depends on PROC_FS -+ default y -+ help -+ Say 'N' to disable Sound proc FS, which may reduce code size about -+ 9KB on x86_64 platform. -+ If unsure say Y. - - config SND_VERBOSE_PROCFS - bool "Verbose procfs contents" -@@ -142,8 +142,8 @@ config SND_VERBOSE_PROCFS - default y - help - Say Y here to include code for verbose procfs contents (provides -- useful information to developers when a problem occurs). On the -- other side, it makes the ALSA subsystem larger. -+ useful information to developers when a problem occurs). On the -+ other side, it makes the ALSA subsystem larger. - - config SND_VERBOSE_PRINTK - bool "Verbose printk" -@@ -164,7 +164,7 @@ config SND_DEBUG_VERBOSE - depends on SND_DEBUG - help - Say Y here to enable extra-verbose debugging messages. -- -+ - Let me repeat: it enables EXTRA-VERBOSE DEBUGGING messages. - So, say Y only if you are ready to be annoyed. - -diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig -index 09932cc98e9d..15d6d46acf9c 100644 ---- a/sound/drivers/Kconfig -+++ b/sound/drivers/Kconfig -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0-only - config SND_MPU401_UART -- tristate -- select SND_RAWMIDI -+ tristate -+ select SND_RAWMIDI - - config SND_OPL3_LIB - tristate -@@ -90,16 +90,16 @@ config SND_DUMMY - will be called snd-dummy. - - config SND_ALOOP -- tristate "Generic loopback driver (PCM)" -- select SND_PCM -- help -- Say 'Y' or 'M' to include support for the PCM loopback device. -+ tristate "Generic loopback driver (PCM)" -+ select SND_PCM -+ help -+ Say 'Y' or 'M' to include support for the PCM loopback device. - This module returns played samples back to the user space using - the standard ALSA PCM device. The devices are routed 0->1 and -- 1->0, where first number is the playback PCM device and second -+ 1->0, where first number is the playback PCM device and second - number is the capture device. Module creates two PCM devices and - configured number of substreams (see the pcm_substreams module -- parameter). -+ parameter). - - The loopback device allows time sychronization with an external - timing source using the time shift universal control (+-20% -@@ -142,12 +142,12 @@ config SND_MTS64 - select SND_RAWMIDI - help - The ESI Miditerminal 4140 is a 4 In 4 Out MIDI Interface with -- additional SMPTE Timecode capabilities for the parallel port. -+ additional SMPTE Timecode capabilities for the parallel port. - - Say 'Y' to include support for this device. - - To compile this driver as a module, chose 'M' here: the module -- will be called snd-mts64. -+ will be called snd-mts64. - - config SND_SERIAL_U16550 - tristate "UART16550 serial MIDI driver" -diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig -index b0a904cdb932..995c2cefc222 100644 ---- a/sound/firewire/Kconfig -+++ b/sound/firewire/Kconfig -@@ -77,7 +77,7 @@ config SND_BEBOB - tristate "BridgeCo DM1000/DM1100/DM1500 with BeBoB firmware" - select SND_FIREWIRE_LIB - select SND_HWDEP -- help -+ help - Say Y here to include support for FireWire devices based - on BridgeCo DM1000/DM1100/DM1500 with BeBoB firmware: - * Edirol FA-66/FA-101 -@@ -111,8 +111,8 @@ config SND_BEBOB - * M-Audio FireWire 1814/ProjectMix IO - * Digidesign Mbox 2 Pro - -- To compile this driver as a module, choose M here: the module -- will be called snd-bebob. -+ To compile this driver as a module, choose M here: the module -+ will be called snd-bebob. - - config SND_FIREWIRE_DIGI00X - tristate "Digidesign Digi 002/003 family support" -diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig -index b690ed937cbe..6ffa48dd5983 100644 ---- a/sound/isa/Kconfig -+++ b/sound/isa/Kconfig -@@ -2,22 +2,22 @@ - # ALSA ISA drivers - - config SND_WSS_LIB -- tristate -- select SND_PCM -+ tristate -+ select SND_PCM - select SND_TIMER - - config SND_SB_COMMON -- tristate -+ tristate - - config SND_SB8_DSP -- tristate -- select SND_PCM -- select SND_SB_COMMON -+ tristate -+ select SND_PCM -+ select SND_SB_COMMON - - config SND_SB16_DSP -- tristate -- select SND_PCM -- select SND_SB_COMMON -+ tristate -+ select SND_PCM -+ select SND_SB_COMMON - - menuconfig SND_ISA - bool "ISA sound devices" -diff --git a/sound/mips/Kconfig b/sound/mips/Kconfig -index 8a33402fd415..b497b803c834 100644 ---- a/sound/mips/Kconfig -+++ b/sound/mips/Kconfig -@@ -14,15 +14,15 @@ config SND_SGI_O2 - tristate "SGI O2 Audio" - depends on SGI_IP32 - select SND_PCM -- help -- Sound support for the SGI O2 Workstation. -+ help -+ Sound support for the SGI O2 Workstation. - - config SND_SGI_HAL2 -- tristate "SGI HAL2 Audio" -- depends on SGI_HAS_HAL2 -+ tristate "SGI HAL2 Audio" -+ depends on SGI_HAS_HAL2 - select SND_PCM -- help -- Sound support for the SGI Indy and Indigo2 Workstation. -+ help -+ Sound support for the SGI Indy and Indigo2 Workstation. - - endif # SND_MIPS - -diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig -index 7630f808d087..93bc9bef7641 100644 ---- a/sound/pci/Kconfig -+++ b/sound/pci/Kconfig -@@ -217,7 +217,7 @@ config SND_CMIPCI - will be called snd-cmipci. - - config SND_OXYGEN_LIB -- tristate -+ tristate - - config SND_OXYGEN - tristate "C-Media 8786, 8787, 8788 (Oxygen)" -diff --git a/sound/soc/cirrus/Kconfig b/sound/soc/cirrus/Kconfig -index 2333efac758a..8039a8febefa 100644 ---- a/sound/soc/cirrus/Kconfig -+++ b/sound/soc/cirrus/Kconfig -@@ -33,13 +33,13 @@ config SND_EP93XX_SOC_AC97 - select SND_SOC_AC97_BUS - - config SND_EP93XX_SOC_SNAPPERCL15 -- tristate "SoC Audio support for Bluewater Systems Snapper CL15 module" -- depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15 && I2C -- select SND_EP93XX_SOC_I2S -- select SND_SOC_TLV320AIC23_I2C -- help -- Say Y or M here if you want to add support for I2S audio on the -- Bluewater Systems Snapper CL15 module. -+ tristate "SoC Audio support for Bluewater Systems Snapper CL15 module" -+ depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15 && I2C -+ select SND_EP93XX_SOC_I2S -+ select SND_SOC_TLV320AIC23_I2C -+ help -+ Say Y or M here if you want to add support for I2S audio on the -+ Bluewater Systems Snapper CL15 module. - - config SND_EP93XX_SOC_SIMONE - tristate "SoC Audio support for Simplemachines Sim.One board" -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 229cc89f8c5a..ef9d73b89623 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -257,16 +257,16 @@ config SND_SOC_ALL_CODECS - select SND_SOC_WM9705 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) - select SND_SOC_WM9712 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) - select SND_SOC_WM9713 if (SND_SOC_AC97_BUS || SND_SOC_AC97_BUS_NEW) -- help -- Normally ASoC codec drivers are only built if a machine driver which -- uses them is also built since they are only usable with a machine -- driver. Selecting this option will allow these drivers to be built -- without an explicit machine driver for test and development purposes. -+ help -+ Normally ASoC codec drivers are only built if a machine driver which -+ uses them is also built since they are only usable with a machine -+ driver. Selecting this option will allow these drivers to be built -+ without an explicit machine driver for test and development purposes. - - Support for the bus types used to access the codecs to be built must - be selected separately. - -- If unsure select "N". -+ If unsure select "N". - - config SND_SOC_88PM860X - tristate -@@ -570,8 +570,8 @@ config SND_SOC_CS42XX8_I2C - - # Cirrus Logic CS43130 HiFi DAC - config SND_SOC_CS43130 -- tristate "Cirrus Logic CS43130 CODEC" -- depends on I2C -+ tristate "Cirrus Logic CS43130 CODEC" -+ depends on I2C - - config SND_SOC_CS4341 - tristate "Cirrus Logic CS4341 CODEC" -@@ -643,19 +643,19 @@ config SND_SOC_L3 - tristate - - config SND_SOC_DA7210 -- tristate -+ tristate - - config SND_SOC_DA7213 -- tristate -+ tristate - - config SND_SOC_DA7218 - tristate - - config SND_SOC_DA7219 -- tristate -+ tristate - - config SND_SOC_DA732X -- tristate -+ tristate - - config SND_SOC_DA9055 - tristate -@@ -717,7 +717,7 @@ config SND_SOC_INNO_RK3036 - select REGMAP_MMIO - - config SND_SOC_ISABELLE -- tristate -+ tristate - - config SND_SOC_LM49453 - tristate -@@ -988,7 +988,7 @@ config SND_SOC_RT5640 - tristate - - config SND_SOC_RT5645 -- tristate -+ tristate - - config SND_SOC_RT5651 - tristate -@@ -1220,7 +1220,7 @@ config SND_SOC_UDA134X - tristate - - config SND_SOC_UDA1380 -- tristate -+ tristate - depends on I2C - - config SND_SOC_WCD9335 -@@ -1348,7 +1348,7 @@ config SND_SOC_WM8904 - depends on I2C - - config SND_SOC_WM8940 -- tristate -+ tristate - - config SND_SOC_WM8955 - tristate -diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig -index 658eff2daf4e..7e9feca333b7 100644 ---- a/sound/soc/intel/Kconfig -+++ b/sound/soc/intel/Kconfig -@@ -119,7 +119,7 @@ config SND_SOC_INTEL_SKYLAKE - select SND_SOC_INTEL_CNL - select SND_SOC_INTEL_CFL - help -- This is a backwards-compatible option to select all devices -+ This is a backwards-compatible option to select all devices - supported by the Intel SST/Skylake driver. This option is no - longer recommended and will be deprecated when the SOF - driver is introduced. Distributions should explicitly -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 5c27f7ab4a5f..882ff36a7c9c 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -3,13 +3,13 @@ menuconfig SND_SOC_INTEL_MACH - bool "Intel Machine drivers" - depends on SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL - help -- Intel ASoC Machine Drivers. If you have a Intel machine that -- has an audio controller with a DSP and I2S or DMIC port, then -- enable this option by saying Y -+ Intel ASoC Machine Drivers. If you have a Intel machine that -+ has an audio controller with a DSP and I2S or DMIC port, then -+ enable this option by saying Y - -- Note that the answer to this question doesn't directly affect the -- kernel: saying N will just cause the configurator to skip all -- the questions about Intel ASoC machine drivers. -+ Note that the answer to this question doesn't directly affect the -+ kernel: saying N will just cause the configurator to skip all -+ the questions about Intel ASoC machine drivers. - - if SND_SOC_INTEL_MACH - -@@ -114,11 +114,11 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH - depends on X86_INTEL_LPSS || COMPILE_TEST - select SND_SOC_ACPI - select SND_SOC_RT5670 -- help -- This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell -- platforms with RT5672 audio codec. -- Say Y or m if you have such a device. This is a recommended option. -- If unsure select "N". -+ help -+ This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell -+ platforms with RT5672 audio codec. -+ Say Y or m if you have such a device. This is a recommended option. -+ If unsure select "N". - - config SND_SOC_INTEL_CHT_BSW_RT5645_MACH - tristate "Cherrytrail & Braswell with RT5645/5650 codec" -@@ -311,20 +311,20 @@ config SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH - If unsure select "N". - - config SND_SOC_INTEL_KBL_RT5663_RT5514_MAX98927_MACH -- tristate "KBL with RT5663, RT5514 and MAX98927 in I2S Mode" -+ tristate "KBL with RT5663, RT5514 and MAX98927 in I2S Mode" - depends on I2C && ACPI - depends on MFD_INTEL_LPSS || COMPILE_TEST -- depends on SPI -- select SND_SOC_RT5663 -- select SND_SOC_RT5514 -- select SND_SOC_RT5514_SPI -- select SND_SOC_MAX98927 -- select SND_SOC_HDAC_HDMI -- help -- This adds support for ASoC Onboard Codec I2S machine driver. This will -- create an alsa sound card for RT5663 + RT5514 + MAX98927. -- Say Y or m if you have such a device. This is a recommended option. -- If unsure select "N". -+ depends on SPI -+ select SND_SOC_RT5663 -+ select SND_SOC_RT5514 -+ select SND_SOC_RT5514_SPI -+ select SND_SOC_MAX98927 -+ select SND_SOC_HDAC_HDMI -+ help -+ This adds support for ASoC Onboard Codec I2S machine driver. This will -+ create an alsa sound card for RT5663 + RT5514 + MAX98927. -+ Say Y or m if you have such a device. This is a recommended option. -+ If unsure select "N". - - config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH - tristate "KBL with DA7219 and MAX98357A in I2S Mode" -@@ -393,7 +393,7 @@ config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH - help - This adds support for ASoC machine driver for Intel platforms - SKL/KBL/BXT/APL with iDisp, HDA audio codecs. -- Say Y or m if you have such a device. This is a recommended option. -+ Say Y or m if you have such a device. This is a recommended option. - If unsure select "N". - - endif ## SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC -diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig -index 213d4dab0346..295cfffa4646 100644 ---- a/sound/soc/pxa/Kconfig -+++ b/sound/soc/pxa/Kconfig -@@ -190,14 +190,14 @@ config SND_PXA2XX_SOC_MAGICIAN - HTC Magician. - - config SND_PXA2XX_SOC_MIOA701 -- tristate "SoC Audio support for MIO A701" -- depends on SND_PXA2XX_SOC && MACH_MIOA701 -+ tristate "SoC Audio support for MIO A701" -+ depends on SND_PXA2XX_SOC && MACH_MIOA701 - depends on AC97_BUS=n -- select SND_PXA2XX_SOC_AC97 -- select SND_SOC_WM9713 -- help -- Say Y if you want to add support for SoC audio on the -- MIO A701. -+ select SND_PXA2XX_SOC_AC97 -+ select SND_SOC_WM9713 -+ help -+ Say Y if you want to add support for SoC audio on the -+ MIO A701. - - config SND_PXA2XX_SOC_IMOTE2 - tristate "SoC Audio support for IMote 2" -@@ -205,7 +205,7 @@ config SND_PXA2XX_SOC_IMOTE2 - select SND_PXA2XX_SOC_I2S - select SND_SOC_WM8940 - help -- Say Y if you want to add support for SoC audio on the -+ Say Y if you want to add support for SoC audio on the - IMote 2. - - config SND_MMP_SOC_BROWNSTONE -diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig -index 60086858e920..6530d2462a9e 100644 ---- a/sound/soc/qcom/Kconfig -+++ b/sound/soc/qcom/Kconfig -@@ -3,8 +3,8 @@ config SND_SOC_QCOM - tristate "ASoC support for QCOM platforms" - depends on ARCH_QCOM || COMPILE_TEST - help -- Say Y or M if you want to add support to use audio devices -- in Qualcomm Technologies SOC-based platforms. -+ Say Y or M if you want to add support to use audio devices -+ in Qualcomm Technologies SOC-based platforms. - - config SND_SOC_LPASS_CPU - tristate -@@ -30,17 +30,17 @@ config SND_SOC_STORM - select SND_SOC_LPASS_IPQ806X - select SND_SOC_MAX98357A - help -- Say Y or M if you want add support for SoC audio on the -- Qualcomm Technologies IPQ806X-based Storm board. -+ Say Y or M if you want add support for SoC audio on the -+ Qualcomm Technologies IPQ806X-based Storm board. - - config SND_SOC_APQ8016_SBC - tristate "SoC Audio support for APQ8016 SBC platforms" - depends on SND_SOC_QCOM - select SND_SOC_LPASS_APQ8016 - help -- Support for Qualcomm Technologies LPASS audio block in -- APQ8016 SOC-based systems. -- Say Y if you want to use audio devices on MI2S. -+ Support for Qualcomm Technologies LPASS audio block in -+ APQ8016 SOC-based systems. -+ Say Y if you want to use audio devices on MI2S. - - config SND_SOC_QCOM_COMMON - tristate -@@ -93,9 +93,9 @@ config SND_SOC_MSM8996 - select SND_SOC_QDSP6 - select SND_SOC_QCOM_COMMON - help -- Support for Qualcomm Technologies LPASS audio block in -- APQ8096 SoC-based systems. -- Say Y if you want to use audio device on this SoCs -+ Support for Qualcomm Technologies LPASS audio block in -+ APQ8096 SoC-based systems. -+ Say Y if you want to use audio device on this SoCs - - config SND_SOC_SDM845 - tristate "SoC Machine driver for SDM845 boards" -diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig -index 638983123d8f..9304177de78a 100644 ---- a/sound/soc/samsung/Kconfig -+++ b/sound/soc/samsung/Kconfig -@@ -195,10 +195,10 @@ config SND_SOC_ODROID - Say Y here to enable audio support for the Odroid XU3/XU4. - - config SND_SOC_ARNDALE_RT5631_ALC5631 -- tristate "Audio support for RT5631(ALC5631) on Arndale Board" -- depends on I2C -- select SND_SAMSUNG_I2S -- select SND_SOC_RT5631 -+ tristate "Audio support for RT5631(ALC5631) on Arndale Board" -+ depends on I2C -+ select SND_SAMSUNG_I2S -+ select SND_SOC_RT5631 - - config SND_SOC_SAMSUNG_TM2_WM5110 - tristate "SoC I2S Audio support for WM5110 on TM2 board" -diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig -index 71f318bc2c74..bae4f7bf5f75 100644 ---- a/sound/soc/sof/imx/Kconfig -+++ b/sound/soc/sof/imx/Kconfig -@@ -5,9 +5,9 @@ config SND_SOC_SOF_IMX_TOPLEVEL - depends on ARM64|| COMPILE_TEST - depends on SND_SOC_SOF_OF - help -- This adds support for Sound Open Firmware for NXP i.MX platforms. -- Say Y if you have such a device. -- If unsure select "N". -+ This adds support for Sound Open Firmware for NXP i.MX platforms. -+ Say Y if you have such a device. -+ If unsure select "N". - - if SND_SOC_SOF_IMX_TOPLEVEL - -@@ -16,9 +16,9 @@ config SND_SOC_SOF_IMX8_SUPPORT - depends on IMX_SCU - depends on IMX_DSP - help -- This adds support for Sound Open Firmware for NXP i.MX8 platforms -- Say Y if you have such a device. -- If unsure select "N". -+ This adds support for Sound Open Firmware for NXP i.MX8 platforms -+ Say Y if you have such a device. -+ If unsure select "N". - - config SND_SOC_SOF_IMX8 - def_tristate SND_SOC_SOF_OF -diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig -index acc3e91d9244..c263a8feff0a 100644 ---- a/sound/soc/sof/intel/Kconfig -+++ b/sound/soc/sof/intel/Kconfig -@@ -37,7 +37,7 @@ config SND_SOC_SOF_INTEL_PCI - config SND_SOC_SOF_INTEL_HIFI_EP_IPC - tristate - help -- This option is not user-selectable but automagically handled by -+ This option is not user-selectable but automagically handled by - 'select' statements at a higher level - - config SND_SOC_SOF_INTEL_ATOM_HIFI_EP -@@ -234,31 +234,31 @@ config SND_SOC_SOF_COMETLAKE_H_SUPPORT - config SND_SOC_SOF_TIGERLAKE_SUPPORT - bool "SOF support for Tigerlake" - help -- This adds support for Sound Open Firmware for Intel(R) platforms -- using the Tigerlake processors. -- Say Y if you have such a device. -- If unsure select "N". -+ This adds support for Sound Open Firmware for Intel(R) platforms -+ using the Tigerlake processors. -+ Say Y if you have such a device. -+ If unsure select "N". - - config SND_SOC_SOF_TIGERLAKE - tristate - select SND_SOC_SOF_HDA_COMMON - help -- This option is not user-selectable but automagically handled by -+ This option is not user-selectable but automagically handled by - 'select' statements at a higher level - - config SND_SOC_SOF_ELKHARTLAKE_SUPPORT - bool "SOF support for ElkhartLake" - help -- This adds support for Sound Open Firmware for Intel(R) platforms -- using the ElkhartLake processors. -- Say Y if you have such a device. -- If unsure select "N". -+ This adds support for Sound Open Firmware for Intel(R) platforms -+ using the ElkhartLake processors. -+ Say Y if you have such a device. -+ If unsure select "N". - - config SND_SOC_SOF_ELKHARTLAKE - tristate - select SND_SOC_SOF_HDA_COMMON - help -- This option is not user-selectable but automagically handled by -+ This option is not user-selectable but automagically handled by - 'select' statements at a higher level - - config SND_SOC_SOF_JASPERLAKE_SUPPORT -diff --git a/sound/soc/xilinx/Kconfig b/sound/soc/xilinx/Kconfig -index 69973179ef15..1d3586b68db7 100644 ---- a/sound/soc/xilinx/Kconfig -+++ b/sound/soc/xilinx/Kconfig -@@ -9,15 +9,15 @@ config SND_SOC_XILINX_I2S - encapsulates PCM in AES format and sends AES data. - - config SND_SOC_XILINX_AUDIO_FORMATTER -- tristate "Audio support for the the Xilinx audio formatter" -- help -- Select this option to enable Xilinx audio formatter -- support. This provides DMA platform device support for -- audio functionality. -+ tristate "Audio support for the the Xilinx audio formatter" -+ help -+ Select this option to enable Xilinx audio formatter -+ support. This provides DMA platform device support for -+ audio functionality. - - config SND_SOC_XILINX_SPDIF -- tristate "Audio support for the the Xilinx SPDIF" -- help -- Select this option to enable Xilinx SPDIF Audio. -- This provides playback and capture of SPDIF audio in -- AES format. -+ tristate "Audio support for the the Xilinx SPDIF" -+ help -+ Select this option to enable Xilinx SPDIF Audio. -+ This provides playback and capture of SPDIF audio in -+ AES format. -diff --git a/sound/soc/zte/Kconfig b/sound/soc/zte/Kconfig -index a7842e4b791c..a23d4f13ca19 100644 ---- a/sound/soc/zte/Kconfig -+++ b/sound/soc/zte/Kconfig -@@ -18,9 +18,9 @@ config ZX_I2S - ZTE ZX I2S interface - - config ZX_TDM -- tristate "ZTE ZX TDM Driver Support" -- depends on COMMON_CLK -- select SND_SOC_GENERIC_DMAENGINE_PCM -- help -- Say Y or M if you want to add support for codecs attached to the -- ZTE ZX TDM interface -+ tristate "ZTE ZX TDM Driver Support" -+ depends on COMMON_CLK -+ select SND_SOC_GENERIC_DMAENGINE_PCM -+ help -+ Say Y or M if you want to add support for codecs attached to the -+ ZTE ZX TDM interface -diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig -index e2c53a0841da..059242f15d75 100644 ---- a/sound/usb/Kconfig -+++ b/sound/usb/Kconfig -@@ -107,24 +107,24 @@ config SND_USB_US122L - will be called snd-usb-us122l. - - config SND_USB_6FIRE -- tristate "TerraTec DMX 6Fire USB" -- select FW_LOADER -- select BITREVERSE -- select SND_RAWMIDI -- select SND_PCM -- select SND_VMASTER -- help -- Say Y here to include support for TerraTec 6fire DMX USB interface. -- -- You will need firmware files in order to be able to use the device -- after it has been coldstarted. An install script for the firmware -- and further help can be found at -- http://sixfireusb.sourceforge.net -+ tristate "TerraTec DMX 6Fire USB" -+ select FW_LOADER -+ select BITREVERSE -+ select SND_RAWMIDI -+ select SND_PCM -+ select SND_VMASTER -+ help -+ Say Y here to include support for TerraTec 6fire DMX USB interface. -+ -+ You will need firmware files in order to be able to use the device -+ after it has been coldstarted. An install script for the firmware -+ and further help can be found at -+ http://sixfireusb.sourceforge.net - - config SND_USB_HIFACE -- tristate "M2Tech hiFace USB-SPDIF driver" -- select SND_PCM -- help -+ tristate "M2Tech hiFace USB-SPDIF driver" -+ select SND_PCM -+ help - Select this option to include support for M2Tech hiFace USB-SPDIF - interface. - --- -2.24.1 - -From d18fc5e6651042a56faa06beb92034728b751e7a Mon Sep 17 00:00:00 2001 -From: Naveen M -Date: Tue, 15 Oct 2019 00:28:00 +0800 -Subject: [PATCH 045/109] ASoC: Intel: eve: Enable mclk and ssp sclk early - -rt5663 and rt5514 needs mclk/sclk early to synchronize its internal -clocks. - -Signed-off-by: Naveen M -Signed-off-by: Harsha Priya -Signed-off-by: Subhransu S. Prusty -Signed-off-by: Brent Lu -Acked-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/1571070480-25666-1-git-send-email-brent.lu@intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 47cbea21628187c32efad562867aa2b6760d83cc) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 1 + - .../intel/boards/kbl_rt5663_rt5514_max98927.c | 94 +++++++++++++++++++ - 2 files changed, 95 insertions(+) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 882ff36a7c9c..778422d36e61 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -320,6 +320,7 @@ config SND_SOC_INTEL_KBL_RT5663_RT5514_MAX98927_MACH - select SND_SOC_RT5514_SPI - select SND_SOC_MAX98927 - select SND_SOC_HDAC_HDMI -+ select SND_SOC_INTEL_SKYLAKE_SSP_CLK - help - This adds support for ASoC Onboard Codec I2S machine driver. This will - create an alsa sound card for RT5663 + RT5514 + MAX98927. -diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -index 8ad31c91fc75..7b970219f39a 100644 ---- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -+++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -@@ -22,6 +22,9 @@ - #include "../../codecs/rt5514.h" - #include "../../codecs/rt5663.h" - #include "../../codecs/hdac_hdmi.h" -+#include -+#include -+#include - - #define KBL_REALTEK_CODEC_DAI "rt5663-aif" - #define KBL_REALTEK_DMIC_CODEC_DAI "rt5514-aif1" -@@ -50,6 +53,8 @@ struct kbl_codec_private { - struct snd_soc_jack kabylake_headset; - struct list_head hdmi_pcm_list; - struct snd_soc_jack kabylake_hdmi[2]; -+ struct clk *mclk; -+ struct clk *sclk; - }; - - enum { -@@ -71,6 +76,61 @@ static const struct snd_kcontrol_new kabylake_controls[] = { - SOC_DAPM_PIN_SWITCH("DMIC"), - }; - -+static int platform_clock_control(struct snd_soc_dapm_widget *w, -+ struct snd_kcontrol *k, int event) -+{ -+ struct snd_soc_dapm_context *dapm = w->dapm; -+ struct snd_soc_card *card = dapm->card; -+ struct kbl_codec_private *priv = snd_soc_card_get_drvdata(card); -+ int ret = 0; -+ -+ /* -+ * MCLK/SCLK need to be ON early for a successful synchronization of -+ * codec internal clock. And the clocks are turned off during -+ * POST_PMD after the stream is stopped. -+ */ -+ switch (event) { -+ case SND_SOC_DAPM_PRE_PMU: -+ /* Enable MCLK */ -+ ret = clk_set_rate(priv->mclk, 24000000); -+ if (ret < 0) { -+ dev_err(card->dev, "Can't set rate for mclk, err: %d\n", -+ ret); -+ return ret; -+ } -+ -+ ret = clk_prepare_enable(priv->mclk); -+ if (ret < 0) { -+ dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable SCLK */ -+ ret = clk_set_rate(priv->sclk, 3072000); -+ if (ret < 0) { -+ dev_err(card->dev, "Can't set rate for sclk, err: %d\n", -+ ret); -+ clk_disable_unprepare(priv->mclk); -+ return ret; -+ } -+ -+ ret = clk_prepare_enable(priv->sclk); -+ if (ret < 0) { -+ dev_err(card->dev, "Can't enable sclk, err: %d\n", ret); -+ clk_disable_unprepare(priv->mclk); -+ } -+ break; -+ case SND_SOC_DAPM_POST_PMD: -+ clk_disable_unprepare(priv->mclk); -+ clk_disable_unprepare(priv->sclk); -+ break; -+ default: -+ return 0; -+ } -+ -+ return 0; -+} -+ - static const struct snd_soc_dapm_widget kabylake_widgets[] = { - SND_SOC_DAPM_HP("Headphone Jack", NULL), - SND_SOC_DAPM_MIC("Headset Mic", NULL), -@@ -79,11 +139,15 @@ static const struct snd_soc_dapm_widget kabylake_widgets[] = { - SND_SOC_DAPM_MIC("DMIC", NULL), - SND_SOC_DAPM_SPK("HDMI1", NULL), - SND_SOC_DAPM_SPK("HDMI2", NULL), -+ SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, -+ platform_clock_control, SND_SOC_DAPM_PRE_PMU | -+ SND_SOC_DAPM_POST_PMD), - - }; - - static const struct snd_soc_dapm_route kabylake_map[] = { - /* Headphones */ -+ { "Headphone Jack", NULL, "Platform Clock" }, - { "Headphone Jack", NULL, "HPOL" }, - { "Headphone Jack", NULL, "HPOR" }, - -@@ -92,6 +156,7 @@ static const struct snd_soc_dapm_route kabylake_map[] = { - { "Right Spk", NULL, "Right BE_OUT" }, - - /* other jacks */ -+ { "Headset Mic", NULL, "Platform Clock" }, - { "IN1P", NULL, "Headset Mic" }, - { "IN1N", NULL, "Headset Mic" }, - -@@ -646,6 +711,7 @@ static int kabylake_audio_probe(struct platform_device *pdev) - { - struct kbl_codec_private *ctx; - struct snd_soc_acpi_mach *mach; -+ int ret = 0; - - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); - if (!ctx) -@@ -661,6 +727,34 @@ static int kabylake_audio_probe(struct platform_device *pdev) - dmic_constraints = mach->mach_params.dmic_num == 2 ? - &constraints_dmic_2ch : &constraints_dmic_channels; - -+ ctx->mclk = devm_clk_get(&pdev->dev, "ssp1_mclk"); -+ if (IS_ERR(ctx->mclk)) { -+ ret = PTR_ERR(ctx->mclk); -+ if (ret == -ENOENT) { -+ dev_info(&pdev->dev, -+ "Failed to get ssp1_mclk, defer probe\n"); -+ return -EPROBE_DEFER; -+ } -+ -+ dev_err(&pdev->dev, "Failed to get ssp1_mclk with err:%d\n", -+ ret); -+ return ret; -+ } -+ -+ ctx->sclk = devm_clk_get(&pdev->dev, "ssp1_sclk"); -+ if (IS_ERR(ctx->sclk)) { -+ ret = PTR_ERR(ctx->sclk); -+ if (ret == -ENOENT) { -+ dev_info(&pdev->dev, -+ "Failed to get ssp1_sclk, defer probe\n"); -+ return -EPROBE_DEFER; -+ } -+ -+ dev_err(&pdev->dev, "Failed to get ssp1_sclk with err:%d\n", -+ ret); -+ return ret; -+ } -+ - return devm_snd_soc_register_card(&pdev->dev, &kabylake_audio_card); - } - --- -2.24.1 - -From 58f6613059870eaa99a493cb3deaf49183b39092 Mon Sep 17 00:00:00 2001 -From: Brent Lu -Date: Fri, 25 Oct 2019 17:11:31 +0800 -Subject: [PATCH 046/109] ASoC: eve: implement set_bias_level function for - rt5514 - -The first DMIC capture always fail (zero sequence data from PCM port) -after using DSP hotwording function (i.e. Google assistant). - -This rt5514 codec requires to control mclk directly in the set_bias_level -function. Implement this function in machine driver to control the -ssp1_mclk clock explicitly could fix this issue. - -Signed-off-by: Brent Lu -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/1571994691-20199-1-git-send-email-brent.lu@intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 15747a80207585fe942416025540c0ff34e2aef8) -Bugzilla: 1772498 ---- - .../intel/boards/kbl_rt5663_rt5514_max98927.c | 50 +++++++++++++++++++ - 1 file changed, 50 insertions(+) - -diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -index 7b970219f39a..3e5f6bead229 100644 ---- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -+++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c -@@ -656,6 +656,55 @@ static struct snd_soc_dai_link kabylake_dais[] = { - }, - }; - -+static int kabylake_set_bias_level(struct snd_soc_card *card, -+ struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) -+{ -+ struct snd_soc_component *component = dapm->component; -+ struct kbl_codec_private *priv = snd_soc_card_get_drvdata(card); -+ int ret = 0; -+ -+ if (!component || strcmp(component->name, RT5514_DEV_NAME)) -+ return 0; -+ -+ if (IS_ERR(priv->mclk)) -+ return 0; -+ -+ /* -+ * It's required to control mclk directly in the set_bias_level -+ * function for rt5514 codec or the recording function could -+ * break. -+ */ -+ switch (level) { -+ case SND_SOC_BIAS_PREPARE: -+ if (dapm->bias_level == SND_SOC_BIAS_ON) { -+ dev_dbg(card->dev, "Disable mclk"); -+ clk_disable_unprepare(priv->mclk); -+ } else { -+ dev_dbg(card->dev, "Enable mclk"); -+ ret = clk_set_rate(priv->mclk, 24000000); -+ if (ret) { -+ dev_err(card->dev, "Can't set rate for mclk, err: %d\n", -+ ret); -+ return ret; -+ } -+ -+ ret = clk_prepare_enable(priv->mclk); -+ if (ret) { -+ dev_err(card->dev, "Can't enable mclk, err: %d\n", -+ ret); -+ -+ /* mclk is already enabled in FW */ -+ ret = 0; -+ } -+ } -+ break; -+ default: -+ break; -+ } -+ -+ return ret; -+} -+ - static int kabylake_card_late_probe(struct snd_soc_card *card) - { - struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card); -@@ -695,6 +744,7 @@ static struct snd_soc_card kabylake_audio_card = { - .owner = THIS_MODULE, - .dai_link = kabylake_dais, - .num_links = ARRAY_SIZE(kabylake_dais), -+ .set_bias_level = kabylake_set_bias_level, - .controls = kabylake_controls, - .num_controls = ARRAY_SIZE(kabylake_controls), - .dapm_widgets = kabylake_widgets, --- -2.24.1 - -From b8bcd22339ac11192d875837907233f6a5a6e781 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:11 +0200 -Subject: [PATCH 047/109] ASoC: Intel: skl-hda-dsp-generic: use - snd-hda-codec-hdmi - -Add support for using snd-hda-codec-hdmi driver for HDMI/DP -instead of ASoC hdac-hdmi. This is aligned with how other -HDA codecs are already handled. - -When snd-hda-codec-hdmi is used, the PCM device numbers are -parsed from card topology and passed to the codec driver. -This needs to be done at runtime as topology changes may -affect PCM device allocation. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-4-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 7de9a47c8971bdec07cc9a62e948382003c5908f) -Bugzilla: 1772498 ---- - include/sound/soc-acpi.h | 2 + - sound/soc/intel/boards/Makefile | 2 +- - sound/soc/intel/boards/hda_dsp_common.c | 85 ++++++++++++++++++++ - sound/soc/intel/boards/hda_dsp_common.h | 32 ++++++++ - sound/soc/intel/boards/skl_hda_dsp_common.c | 6 ++ - sound/soc/intel/boards/skl_hda_dsp_common.h | 23 ++++++ - sound/soc/intel/boards/skl_hda_dsp_generic.c | 1 + - 7 files changed, 150 insertions(+), 1 deletion(-) - create mode 100644 sound/soc/intel/boards/hda_dsp_common.c - create mode 100644 sound/soc/intel/boards/hda_dsp_common.h - -diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h -index 35b38e41e5b2..26d57bc9a91e 100644 ---- a/include/sound/soc-acpi.h -+++ b/include/sound/soc-acpi.h -@@ -60,12 +60,14 @@ static inline struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg) - * @acpi_ipc_irq_index: used for BYT-CR detection - * @platform: string used for HDaudio codec support - * @codec_mask: used for HDAudio support -+ * @common_hdmi_codec_drv: use commom HDAudio HDMI codec driver - */ - struct snd_soc_acpi_mach_params { - u32 acpi_ipc_irq_index; - const char *platform; - u32 codec_mask; - u32 dmic_num; -+ bool common_hdmi_codec_drv; - }; - - /** -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index 6445f90ea542..52e990b16b0d 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -24,7 +24,7 @@ snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o - snd-soc-kbl_rt5663_rt5514_max98927-objs := kbl_rt5663_rt5514_max98927.o - snd-soc-kbl_rt5660-objs := kbl_rt5660.o - snd-soc-skl_rt286-objs := skl_rt286.o --snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o -+snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o hda_dsp_common.o - snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o - snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o - -diff --git a/sound/soc/intel/boards/hda_dsp_common.c b/sound/soc/intel/boards/hda_dsp_common.c -new file mode 100644 -index 000000000000..ed36b68d6705 ---- /dev/null -+++ b/sound/soc/intel/boards/hda_dsp_common.c -@@ -0,0 +1,85 @@ -+// SPDX-License-Identifier: GPL-2.0 -+// -+// Copyright(c) 2019 Intel Corporation. All rights reserved. -+ -+#include -+#include -+#include -+#include -+#include "../../codecs/hdac_hda.h" -+ -+#include "hda_dsp_common.h" -+ -+/* -+ * Search card topology and return PCM device number -+ * matching Nth HDMI device (zero-based index). -+ */ -+struct snd_pcm *hda_dsp_hdmi_pcm_handle(struct snd_soc_card *card, -+ int hdmi_idx) -+{ -+ struct snd_soc_pcm_runtime *rtd; -+ struct snd_pcm *spcm; -+ int i = 0; -+ -+ for_each_card_rtds(card, rtd) { -+ spcm = rtd->pcm ? -+ rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].pcm : NULL; -+ if (spcm && strstr(spcm->id, "HDMI")) { -+ if (i == hdmi_idx) -+ return rtd->pcm; -+ ++i; -+ } -+ } -+ -+ return NULL; -+} -+ -+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) -+/* -+ * Search card topology and register HDMI PCM related controls -+ * to codec driver. -+ */ -+int hda_dsp_hdmi_build_controls(struct snd_soc_card *card, -+ struct snd_soc_component *comp) -+{ -+ struct hdac_hda_priv *hda_pvt; -+ struct hda_codec *hcodec; -+ struct snd_pcm *spcm; -+ struct hda_pcm *hpcm; -+ int err = 0, i = 0; -+ -+ if (!comp) -+ return -EINVAL; -+ -+ hda_pvt = snd_soc_component_get_drvdata(comp); -+ hcodec = &hda_pvt->codec; -+ -+ list_for_each_entry(hpcm, &hcodec->pcm_list_head, list) { -+ spcm = hda_dsp_hdmi_pcm_handle(card, i); -+ if (spcm) { -+ hpcm->pcm = spcm; -+ hpcm->device = spcm->device; -+ dev_dbg(card->dev, -+ "%s: mapping HDMI converter %d to PCM %d (%p)\n", -+ __func__, i, hpcm->device, spcm); -+ } else { -+ hpcm->pcm = 0; -+ hpcm->device = SNDRV_PCM_INVALID_DEVICE; -+ dev_warn(card->dev, -+ "%s: no PCM in topology for HDMI converter %d\n\n", -+ __func__, i); -+ } -+ i++; -+ } -+ snd_hdac_display_power(hcodec->core.bus, -+ HDA_CODEC_IDX_CONTROLLER, true); -+ err = snd_hda_codec_build_controls(hcodec); -+ if (err < 0) -+ dev_err(card->dev, "unable to create controls %d\n", err); -+ snd_hdac_display_power(hcodec->core.bus, -+ HDA_CODEC_IDX_CONTROLLER, false); -+ -+ return err; -+} -+ -+#endif -diff --git a/sound/soc/intel/boards/hda_dsp_common.h b/sound/soc/intel/boards/hda_dsp_common.h -new file mode 100644 -index 000000000000..431f7f09dccb ---- /dev/null -+++ b/sound/soc/intel/boards/hda_dsp_common.h -@@ -0,0 +1,32 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+/* -+ * Copyright(c) 2019 Intel Corporation. -+ */ -+ -+/* -+ * This file defines helper functions used by multiple -+ * Intel HDA based machine drivers. -+ */ -+ -+#ifndef __HDA_DSP_COMMON_H -+#define __HDA_DSP_COMMON_H -+ -+#include -+#include -+#include "../../codecs/hdac_hda.h" -+ -+struct snd_pcm *hda_dsp_hdmi_pcm_handle(struct snd_soc_card *card, -+ int hdmi_idx); -+ -+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) -+int hda_dsp_hdmi_build_controls(struct snd_soc_card *card, -+ struct snd_soc_component *comp); -+#else -+static inline int hda_dsp_hdmi_build_controls(struct snd_soc_card *card, -+ struct snd_soc_component *comp) -+{ -+ return -EINVAL; -+} -+#endif -+ -+#endif /* __HDA_DSP_COMMON_H */ -diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.c b/sound/soc/intel/boards/skl_hda_dsp_common.c -index e3d405e57c5f..78ff5f24c40e 100644 ---- a/sound/soc/intel/boards/skl_hda_dsp_common.c -+++ b/sound/soc/intel/boards/skl_hda_dsp_common.c -@@ -14,6 +14,9 @@ - #include "../../codecs/hdac_hdmi.h" - #include "skl_hda_dsp_common.h" - -+#include -+#include "../../codecs/hdac_hda.h" -+ - #define NAME_SIZE 32 - - int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device) -@@ -139,6 +142,9 @@ int skl_hda_hdmi_jack_init(struct snd_soc_card *card) - char jack_name[NAME_SIZE]; - int err; - -+ if (ctx->common_hdmi_codec_drv) -+ return skl_hda_hdmi_build_controls(card); -+ - list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - component = pcm->codec_dai->component; - snprintf(jack_name, sizeof(jack_name), -diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.h b/sound/soc/intel/boards/skl_hda_dsp_common.h -index daa582e513b2..bbe6e2acfda3 100644 ---- a/sound/soc/intel/boards/skl_hda_dsp_common.h -+++ b/sound/soc/intel/boards/skl_hda_dsp_common.h -@@ -14,6 +14,9 @@ - #include - #include - #include -+#include -+#include "../../codecs/hdac_hda.h" -+#include "hda_dsp_common.h" - - #define HDA_DSP_MAX_BE_DAI_LINKS 7 - -@@ -29,10 +32,30 @@ struct skl_hda_private { - int pcm_count; - int dai_index; - const char *platform_name; -+ bool common_hdmi_codec_drv; - }; - - extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS]; - int skl_hda_hdmi_jack_init(struct snd_soc_card *card); - int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device); - -+/* -+ * Search card topology and register HDMI PCM related controls -+ * to codec driver. -+ */ -+static inline int skl_hda_hdmi_build_controls(struct snd_soc_card *card) -+{ -+ struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); -+ struct snd_soc_component *component; -+ struct skl_hda_hdmi_pcm *pcm; -+ -+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm, -+ head); -+ component = pcm->codec_dai->component; -+ if (!component) -+ return -EINVAL; -+ -+ return hda_dsp_hdmi_build_controls(card, component); -+} -+ - #endif /* __SOUND_SOC_HDA_DSP_COMMON_H */ -diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c -index e8d676c192f6..4e45901e3a2f 100644 ---- a/sound/soc/intel/boards/skl_hda_dsp_generic.c -+++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c -@@ -178,6 +178,7 @@ static int skl_hda_audio_probe(struct platform_device *pdev) - ctx->pcm_count = hda_soc_card.num_links; - ctx->dai_index = 1; /* hdmi codec dai name starts from index 1 */ - ctx->platform_name = mach->mach_params.platform; -+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; - - hda_soc_card.dev = &pdev->dev; - snd_soc_card_set_drvdata(&hda_soc_card, ctx); --- -2.24.1 - -From 092c14f640de2cfdef47fc3991cb8a6c752cfecd Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:12 +0200 -Subject: [PATCH 048/109] ASoC: Intel: skl-hda-dsp-generic: fix include guard - name - -Match the include guard define to actual filename. The source -directory now has an actual hda_dsp_common.h header, so the old -include guard may cause confusion. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-5-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 0f163110256ac91aee562da149838fcb8a39d518) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/skl_hda_dsp_common.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/intel/boards/skl_hda_dsp_common.h b/sound/soc/intel/boards/skl_hda_dsp_common.h -index bbe6e2acfda3..d6150670ca05 100644 ---- a/sound/soc/intel/boards/skl_hda_dsp_common.h -+++ b/sound/soc/intel/boards/skl_hda_dsp_common.h -@@ -8,8 +8,8 @@ - * platforms with HDA Codecs. - */ - --#ifndef __SOUND_SOC_HDA_DSP_COMMON_H --#define __SOUND_SOC_HDA_DSP_COMMON_H -+#ifndef __SKL_HDA_DSP_COMMON_H -+#define __SKL_HDA_DSP_COMMON_H - #include - #include - #include --- -2.24.1 - -From 7abc02e54cfed33f105c33d20e1d9de2cae51978 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:14 +0200 -Subject: [PATCH 049/109] ASoC: Intel: bxt-da7219-max98357a: common hdmi codec - support - -Add support for using snd-hda-codec-hdmi driver for HDMI/DP -instead of ASoC hdac-hdmi. This is aligned with how other -HDA codecs are already handled. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-7-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 57ad18906f24278893b128967551fe7fa0996129) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Makefile | 2 +- - sound/soc/intel/boards/bxt_da7219_max98357a.c | 11 +++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index 52e990b16b0d..0cf4a984f083 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -4,7 +4,7 @@ snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o - snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o - snd-soc-sst-bdw-rt5677-mach-objs := bdw-rt5677.o - snd-soc-sst-broadwell-objs := broadwell.o --snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o -+snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o hda_dsp_common.o - snd-soc-sst-bxt-rt298-objs := bxt_rt298.o - snd-soc-sst-glk-rt5682_max98357a-objs := glk_rt5682_max98357a.o - snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o -diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c -index ac1dea5f9d11..5873abb46441 100644 ---- a/sound/soc/intel/boards/bxt_da7219_max98357a.c -+++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c -@@ -21,6 +21,7 @@ - #include "../../codecs/da7219.h" - #include "../../codecs/da7219-aad.h" - #include "../common/soc-intel-quirks.h" -+#include "hda_dsp_common.h" - - #define BXT_DIALOG_CODEC_DAI "da7219-hifi" - #define BXT_MAXIM_CODEC_DAI "HiFi" -@@ -38,6 +39,7 @@ struct bxt_hdmi_pcm { - - struct bxt_card_private { - struct list_head hdmi_pcm_list; -+ bool common_hdmi_codec_drv; - }; - - enum { -@@ -615,6 +617,13 @@ static int bxt_card_late_probe(struct snd_soc_card *card) - snd_soc_dapm_add_routes(&card->dapm, broxton_map, - ARRAY_SIZE(broxton_map)); - -+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, -+ head); -+ component = pcm->codec_dai->component; -+ -+ if (ctx->common_hdmi_codec_drv) -+ return hda_dsp_hdmi_build_controls(card, component); -+ - list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - component = pcm->codec_dai->component; - snprintf(jack_name, sizeof(jack_name), -@@ -720,6 +729,8 @@ static int broxton_audio_probe(struct platform_device *pdev) - if (ret) - return ret; - -+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; -+ - return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card); - } - --- -2.24.1 - -From 66a2d02030cb6cd534ef17a3fddab4f0ac54838e Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:15 +0200 -Subject: [PATCH 050/109] ASoC: Intel: glk_rt5682_max98357a: common hdmi codec - support - -Add support for using snd-hda-codec-hdmi driver for HDMI/DP -instead of ASoC hdac-hdmi. This is aligned with how other -HDA codecs are already handled. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-8-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit dfe87aa86cd92d21603d64f4035fecae19c92e7a) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Makefile | 2 +- - sound/soc/intel/boards/glk_rt5682_max98357a.c | 11 +++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index 0cf4a984f083..b36f44906c91 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -6,7 +6,7 @@ snd-soc-sst-bdw-rt5677-mach-objs := bdw-rt5677.o - snd-soc-sst-broadwell-objs := broadwell.o - snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o hda_dsp_common.o - snd-soc-sst-bxt-rt298-objs := bxt_rt298.o --snd-soc-sst-glk-rt5682_max98357a-objs := glk_rt5682_max98357a.o -+snd-soc-sst-glk-rt5682_max98357a-objs := glk_rt5682_max98357a.o hda_dsp_common.o - snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o - snd-soc-sst-bytcr-rt5651-objs := bytcr_rt5651.o - snd-soc-sst-cht-bsw-rt5672-objs := cht_bsw_rt5672.o -diff --git a/sound/soc/intel/boards/glk_rt5682_max98357a.c b/sound/soc/intel/boards/glk_rt5682_max98357a.c -index bd2d371f2acd..b36264d1d1cd 100644 ---- a/sound/soc/intel/boards/glk_rt5682_max98357a.c -+++ b/sound/soc/intel/boards/glk_rt5682_max98357a.c -@@ -19,6 +19,7 @@ - #include - #include "../../codecs/rt5682.h" - #include "../../codecs/hdac_hdmi.h" -+#include "hda_dsp_common.h" - - /* The platform clock outputs 19.2Mhz clock to codec as I2S MCLK */ - #define GLK_PLAT_CLK_FREQ 19200000 -@@ -41,6 +42,7 @@ struct glk_hdmi_pcm { - struct glk_card_private { - struct snd_soc_jack geminilake_headset; - struct list_head hdmi_pcm_list; -+ bool common_hdmi_codec_drv; - }; - - enum { -@@ -545,6 +547,13 @@ static int glk_card_late_probe(struct snd_soc_card *card) - int err = 0; - int i = 0; - -+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct glk_hdmi_pcm, -+ head); -+ component = pcm->codec_dai->component; -+ -+ if (ctx->common_hdmi_codec_drv) -+ return hda_dsp_hdmi_build_controls(card, component); -+ - list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - component = pcm->codec_dai->component; - snprintf(jack_name, sizeof(jack_name), -@@ -612,6 +621,8 @@ static int geminilake_audio_probe(struct platform_device *pdev) - if (ret) - return ret; - -+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; -+ - return devm_snd_soc_register_card(&pdev->dev, card); - } - --- -2.24.1 - -From bac23a9db964cffffb22223e1f1c6cc690c37f7e Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:16 +0200 -Subject: [PATCH 051/109] ASoC: intel: sof_rt5682: common hdmi codec support - -Add support for using snd-hda-codec-hdmi driver for HDMI/DP -instead of ASoC hdac-hdmi. This is aligned with how other -HDA codecs are already handled. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-9-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 59bbd703ea2eae7c2766713135e4742c07fbbad7) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Makefile | 2 +- - sound/soc/intel/boards/sof_rt5682.c | 11 +++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index b36f44906c91..255cee8c7906 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -17,7 +17,7 @@ snd-soc-sst-byt-cht-cx2072x-objs := bytcht_cx2072x.o - snd-soc-sst-byt-cht-da7213-objs := bytcht_da7213.o - snd-soc-sst-byt-cht-es8316-objs := bytcht_es8316.o - snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o --snd-soc-sof_rt5682-objs := sof_rt5682.o -+snd-soc-sof_rt5682-objs := sof_rt5682.o hda_dsp_common.o - snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o - snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o - snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o -diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c -index 320a9b9273db..751b8ea6ae1f 100644 ---- a/sound/soc/intel/boards/sof_rt5682.c -+++ b/sound/soc/intel/boards/sof_rt5682.c -@@ -21,6 +21,7 @@ - #include "../../codecs/rt5682.h" - #include "../../codecs/hdac_hdmi.h" - #include "../common/soc-intel-quirks.h" -+#include "hda_dsp_common.h" - - #define NAME_SIZE 32 - -@@ -53,6 +54,7 @@ struct sof_card_private { - struct clk *mclk; - struct snd_soc_jack sof_headset; - struct list_head hdmi_pcm_list; -+ bool common_hdmi_codec_drv; - }; - - static int sof_rt5682_quirk_cb(const struct dmi_system_id *id) -@@ -274,6 +276,13 @@ static int sof_card_late_probe(struct snd_soc_card *card) - if (is_legacy_cpu) - return 0; - -+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct sof_hdmi_pcm, -+ head); -+ component = pcm->codec_dai->component; -+ -+ if (ctx->common_hdmi_codec_drv) -+ return hda_dsp_hdmi_build_controls(card, component); -+ - list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - component = pcm->codec_dai->component; - snprintf(jack_name, sizeof(jack_name), -@@ -651,6 +660,8 @@ static int sof_audio_probe(struct platform_device *pdev) - if (ret) - return ret; - -+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; -+ - snd_soc_card_set_drvdata(&sof_audio_card_rt5682, ctx); - - return devm_snd_soc_register_card(&pdev->dev, --- -2.24.1 - -From 8526042dff63e9e4f6f6bde4f4b0fd3274240ce1 Mon Sep 17 00:00:00 2001 -From: Kai Vehmanen -Date: Tue, 29 Oct 2019 15:40:17 +0200 -Subject: [PATCH 052/109] ASoC: Intel: bxt_rt298: common hdmi codec support - -Add support for using snd-hda-codec-hdmi driver for HDMI/DP -instead of ASoC hdac-hdmi. This is aligned with how other -HDA codecs are already handled. - -Signed-off-by: Kai Vehmanen -Reviewed-by: Takashi Iwai -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191029134017.18901-10-kai.vehmanen@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 7d2ae58376658a3ca0d8f9a53f6f065df126c432) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Makefile | 2 +- - sound/soc/intel/boards/bxt_rt298.c | 11 +++++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index 255cee8c7906..8bddf379cef1 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -5,7 +5,7 @@ snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o - snd-soc-sst-bdw-rt5677-mach-objs := bdw-rt5677.o - snd-soc-sst-broadwell-objs := broadwell.o - snd-soc-sst-bxt-da7219_max98357a-objs := bxt_da7219_max98357a.o hda_dsp_common.o --snd-soc-sst-bxt-rt298-objs := bxt_rt298.o -+snd-soc-sst-bxt-rt298-objs := bxt_rt298.o hda_dsp_common.o - snd-soc-sst-glk-rt5682_max98357a-objs := glk_rt5682_max98357a.o hda_dsp_common.o - snd-soc-sst-bytcr-rt5640-objs := bytcr_rt5640.o - snd-soc-sst-bytcr-rt5651-objs := bytcr_rt5651.o -diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c -index adf416a49b48..eabf9d8468ae 100644 ---- a/sound/soc/intel/boards/bxt_rt298.c -+++ b/sound/soc/intel/boards/bxt_rt298.c -@@ -18,6 +18,7 @@ - #include - #include "../../codecs/hdac_hdmi.h" - #include "../../codecs/rt298.h" -+#include "hda_dsp_common.h" - - /* Headset jack detection DAPM pins */ - static struct snd_soc_jack broxton_headset; -@@ -31,6 +32,7 @@ struct bxt_hdmi_pcm { - - struct bxt_rt286_private { - struct list_head hdmi_pcm_list; -+ bool common_hdmi_codec_drv; - }; - - enum { -@@ -527,6 +529,13 @@ static int bxt_card_late_probe(struct snd_soc_card *card) - int err, i = 0; - char jack_name[NAME_SIZE]; - -+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm, -+ head); -+ component = pcm->codec_dai->component; -+ -+ if (ctx->common_hdmi_codec_drv) -+ return hda_dsp_hdmi_build_controls(card, component); -+ - list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - component = pcm->codec_dai->component; - snprintf(jack_name, sizeof(jack_name), -@@ -626,6 +635,8 @@ static int broxton_audio_probe(struct platform_device *pdev) - if (ret) - return ret; - -+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; -+ - return devm_snd_soc_register_card(&pdev->dev, card); - } - --- -2.24.1 - -From 628db9e1d5fea0baf512cfb523d45d81d8dc12f8 Mon Sep 17 00:00:00 2001 -From: Naveen Manohar -Date: Fri, 1 Nov 2019 12:18:46 -0500 -Subject: [PATCH 053/109] ASoC: Intel: Add acpi match for rt1011 based m/c - driver - -Add match for CML m/c with RT1011 and RT5682 - -Signed-off-by: Naveen Manohar -Signed-off-by: Sathya Prakash M R -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101171847.26767-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit f95ce1355944189c26e4182c813d7f018b434dbd) -Bugzilla: 1772498 ---- - sound/soc/intel/common/soc-acpi-intel-cnl-match.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c -index 985aa366c9e8..16d0bae8b316 100644 ---- a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c -+++ b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c -@@ -47,6 +47,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = { - .sof_fw_filename = "sof-cnl.ri", - .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg", - }, -+ { -+ .id = "10EC1011", -+ .drv_name = "cml_rt1011_rt5682", -+ .quirk_data = &cml_codecs, -+ .sof_fw_filename = "sof-cnl.ri", -+ .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg", -+ }, - { - .id = "10EC5682", - .drv_name = "sof_rt5682", --- -2.24.1 - -From 97082f367654546944ff5e2be8b8f12ab4ff1929 Mon Sep 17 00:00:00 2001 -From: Naveen Manohar -Date: Fri, 1 Nov 2019 12:18:47 -0500 -Subject: [PATCH 054/109] ASoC: Intel: boards: Add CML m/c using RT1011 and - RT5682 - -Machine driver to enable -RT5682 on SSP0, DMIC, HDMI and -RT1011 AMP on SSP1 with -2 CH / 24 bit TDM Playback over 4 individual codecs and -4 CH / 24 bit Capture to provide feedback. - -Signed-off-by: Naveen Manohar -Signed-off-by: Sathya Prakash M R -Signed-off-by: Kai Vehmanen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101171847.26767-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 17fe95d6df9320409015e5114309a3c05e31b736) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 14 + - sound/soc/intel/boards/Makefile | 2 + - sound/soc/intel/boards/cml_rt1011_rt5682.c | 487 +++++++++++++++++++++ - 3 files changed, 503 insertions(+) - create mode 100644 sound/soc/intel/boards/cml_rt1011_rt5682.c - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 778422d36e61..ef40f83e0a3b 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -423,6 +423,20 @@ config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH - depends on MFD_INTEL_LPSS || COMPILE_TEST - select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC - -+config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH -+ tristate "CML with RT1011 and RT5682 in I2S Mode" -+ depends on I2C && ACPI -+ depends on MFD_INTEL_LPSS || COMPILE_TEST -+ select SND_SOC_RT1011 -+ select SND_SOC_RT5682 -+ select SND_SOC_DMIC -+ select SND_SOC_HDAC_HDMI -+ help -+ This adds support for ASoC machine driver for SOF platform with -+ RT1011 + RT5682 I2S codec. -+ Say Y if you have such a device. -+ If unsure select "N". -+ - endif ## SND_SOC_SOF_COMETLAKE_LP && SND_SOC_SOF_HDA_LINK - - endif ## SND_SOC_INTEL_MACH -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index 8bddf379cef1..9ae6544c6f3b 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -18,6 +18,7 @@ snd-soc-sst-byt-cht-da7213-objs := bytcht_da7213.o - snd-soc-sst-byt-cht-es8316-objs := bytcht_es8316.o - snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o - snd-soc-sof_rt5682-objs := sof_rt5682.o hda_dsp_common.o -+snd-soc-cml_rt1011_rt5682-objs := cml_rt1011_rt5682.o hda_dsp_common.o - snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o - snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o - snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o -@@ -47,6 +48,7 @@ obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_CX2072X_MACH) += snd-soc-sst-byt-cht-cx2072x. - obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o - obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_ES8316_MACH) += snd-soc-sst-byt-cht-es8316.o - obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) += snd-soc-sst-byt-cht-nocodec.o -+obj-$(CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH) += snd-soc-cml_rt1011_rt5682.o - obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH) += snd-soc-kbl_da7219_max98357a.o - obj-$(CONFIG_SND_SOC_INTEL_KBL_DA7219_MAX98927_MACH) += snd-soc-kbl_da7219_max98927.o - obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH) += snd-soc-kbl_rt5663_max98927.o -diff --git a/sound/soc/intel/boards/cml_rt1011_rt5682.c b/sound/soc/intel/boards/cml_rt1011_rt5682.c -new file mode 100644 -index 000000000000..a22f97234201 ---- /dev/null -+++ b/sound/soc/intel/boards/cml_rt1011_rt5682.c -@@ -0,0 +1,487 @@ -+// SPDX-License-Identifier: GPL-2.0 -+// Copyright(c) 2019 Intel Corporation. -+ -+/* -+ * Intel Cometlake I2S Machine driver for RT1011 + RT5682 codec -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../../codecs/rt1011.h" -+#include "../../codecs/rt5682.h" -+#include "../../codecs/hdac_hdmi.h" -+#include "hda_dsp_common.h" -+ -+/* The platform clock outputs 24Mhz clock to codec as I2S MCLK */ -+#define CML_PLAT_CLK 24000000 -+#define CML_RT1011_CODEC_DAI "rt1011-aif" -+#define CML_RT5682_CODEC_DAI "rt5682-aif1" -+#define NAME_SIZE 32 -+ -+static struct snd_soc_jack hdmi_jack[3]; -+ -+struct hdmi_pcm { -+ struct list_head head; -+ struct snd_soc_dai *codec_dai; -+ int device; -+}; -+ -+struct card_private { -+ char codec_name[SND_ACPI_I2C_ID_LEN]; -+ struct snd_soc_jack headset; -+ struct list_head hdmi_pcm_list; -+ bool common_hdmi_codec_drv; -+}; -+ -+static const struct snd_kcontrol_new cml_controls[] = { -+ SOC_DAPM_PIN_SWITCH("Headphone Jack"), -+ SOC_DAPM_PIN_SWITCH("Headset Mic"), -+ SOC_DAPM_PIN_SWITCH("TL Ext Spk"), -+ SOC_DAPM_PIN_SWITCH("TR Ext Spk"), -+ SOC_DAPM_PIN_SWITCH("WL Ext Spk"), -+ SOC_DAPM_PIN_SWITCH("WR Ext Spk"), -+}; -+ -+static const struct snd_soc_dapm_widget cml_rt1011_rt5682_widgets[] = { -+ SND_SOC_DAPM_SPK("TL Ext Spk", NULL), -+ SND_SOC_DAPM_SPK("TR Ext Spk", NULL), -+ SND_SOC_DAPM_SPK("WL Ext Spk", NULL), -+ SND_SOC_DAPM_SPK("WR Ext Spk", NULL), -+ SND_SOC_DAPM_HP("Headphone Jack", NULL), -+ SND_SOC_DAPM_MIC("Headset Mic", NULL), -+ SND_SOC_DAPM_MIC("SoC DMIC", NULL), -+}; -+ -+static const struct snd_soc_dapm_route cml_rt1011_rt5682_map[] = { -+ /*speaker*/ -+ {"TL Ext Spk", NULL, "TL SPO"}, -+ {"TR Ext Spk", NULL, "TR SPO"}, -+ {"WL Ext Spk", NULL, "WL SPO"}, -+ {"WR Ext Spk", NULL, "WR SPO"}, -+ -+ /* HP jack connectors - unknown if we have jack detection */ -+ { "Headphone Jack", NULL, "HPOL" }, -+ { "Headphone Jack", NULL, "HPOR" }, -+ -+ /* other jacks */ -+ { "IN1P", NULL, "Headset Mic" }, -+ -+ /* DMIC */ -+ {"DMic", NULL, "SoC DMIC"}, -+}; -+ -+static int cml_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); -+ struct snd_soc_component *component = rtd->codec_dai->component; -+ struct snd_soc_jack *jack; -+ int ret; -+ -+ /* need to enable ASRC function for 24MHz mclk rate */ -+ rt5682_sel_asrc_clk_src(component, RT5682_DA_STEREO1_FILTER | -+ RT5682_AD_STEREO1_FILTER, -+ RT5682_CLK_SEL_I2S1_ASRC); -+ -+ /* -+ * Headset buttons map to the google Reference headset. -+ * These can be configured by userspace. -+ */ -+ ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", -+ SND_JACK_HEADSET | SND_JACK_BTN_0 | -+ SND_JACK_BTN_1 | SND_JACK_BTN_2 | -+ SND_JACK_BTN_3, -+ &ctx->headset, NULL, 0); -+ if (ret) { -+ dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret); -+ return ret; -+ } -+ -+ jack = &ctx->headset; -+ -+ snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); -+ snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); -+ snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); -+ snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); -+ ret = snd_soc_component_set_jack(component, jack, NULL); -+ if (ret) -+ dev_err(rtd->dev, "Headset Jack call-back failed: %d\n", ret); -+ -+ return ret; -+}; -+ -+static int cml_rt5682_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ int clk_id, clk_freq, pll_out, ret; -+ -+ clk_id = RT5682_PLL1_S_MCLK; -+ clk_freq = CML_PLAT_CLK; -+ -+ pll_out = params_rate(params) * 512; -+ -+ ret = snd_soc_dai_set_pll(codec_dai, 0, clk_id, clk_freq, pll_out); -+ if (ret < 0) -+ dev_warn(rtd->dev, "snd_soc_dai_set_pll err = %d\n", ret); -+ -+ /* Configure sysclk for codec */ -+ ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1, -+ pll_out, SND_SOC_CLOCK_IN); -+ if (ret < 0) -+ dev_warn(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); -+ -+ /* -+ * slot_width should be equal or large than data length, set them -+ * be the same -+ */ -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0, 0x0, 2, -+ params_width(params)); -+ if (ret < 0) -+ dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); -+ return ret; -+} -+ -+static int cml_rt1011_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai; -+ struct snd_soc_card *card = rtd->card; -+ int srate, i, ret = 0; -+ -+ srate = params_rate(params); -+ -+ for (i = 0; i < rtd->num_codecs; i++) { -+ codec_dai = rtd->codec_dais[i]; -+ -+ /* 100 Fs to drive 24 bit data */ -+ ret = snd_soc_dai_set_pll(codec_dai, 0, RT1011_PLL1_S_BCLK, -+ 100 * srate, 256 * srate); -+ if (ret < 0) { -+ dev_err(card->dev, "codec_dai clock not set\n"); -+ return ret; -+ } -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, -+ RT1011_FS_SYS_PRE_S_PLL1, -+ 256 * srate, SND_SOC_CLOCK_IN); -+ if (ret < 0) { -+ dev_err(card->dev, "codec_dai clock not set\n"); -+ return ret; -+ } -+ -+ /* -+ * Codec TDM is configured as 24 bit capture/ playback. -+ * 2 CH PB is done over 4 codecs - 2 Woofers and 2 Tweeters. -+ * The Left woofer and tweeter plays the Left playback data -+ * and similar by the Right. -+ * Hence 2 codecs (1 T and 1 W pair) share same Rx slot. -+ * The feedback is captured for each codec individually. -+ * Hence all 4 codecs use 1 Tx slot each for feedback. -+ */ -+ if (!strcmp(codec_dai->component->name, "i2c-10EC1011:00")) { -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, -+ 0x4, 0x1, 4, 24); -+ if (ret < 0) -+ break; -+ } -+ if (!strcmp(codec_dai->component->name, "i2c-10EC1011:02")) { -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, -+ 0x1, 0x1, 4, 24); -+ if (ret < 0) -+ break; -+ } -+ /* TDM Rx slot 2 is used for Right Woofer & Tweeters pair */ -+ if (!strcmp(codec_dai->component->name, "i2c-10EC1011:01")) { -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, -+ 0x8, 0x2, 4, 24); -+ if (ret < 0) -+ break; -+ } -+ if (!strcmp(codec_dai->component->name, "i2c-10EC1011:03")) { -+ ret = snd_soc_dai_set_tdm_slot(codec_dai, -+ 0x2, 0x2, 4, 24); -+ if (ret < 0) -+ break; -+ } -+ } -+ if (ret < 0) -+ dev_err(rtd->dev, -+ "set codec TDM slot for %s failed with error %d\n", -+ codec_dai->component->name, ret); -+ return ret; -+} -+ -+static struct snd_soc_ops cml_rt5682_ops = { -+ .hw_params = cml_rt5682_hw_params, -+}; -+ -+static const struct snd_soc_ops cml_rt1011_ops = { -+ .hw_params = cml_rt1011_hw_params, -+}; -+ -+static int sof_card_late_probe(struct snd_soc_card *card) -+{ -+ struct card_private *ctx = snd_soc_card_get_drvdata(card); -+ struct snd_soc_component *component = NULL; -+ char jack_name[NAME_SIZE]; -+ struct hdmi_pcm *pcm; -+ int ret, i = 0; -+ -+ pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, -+ head); -+ component = pcm->codec_dai->component; -+ -+ if (ctx->common_hdmi_codec_drv) -+ return hda_dsp_hdmi_build_controls(card, component); -+ -+ list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { -+ component = pcm->codec_dai->component; -+ snprintf(jack_name, sizeof(jack_name), -+ "HDMI/DP, pcm=%d Jack", pcm->device); -+ ret = snd_soc_card_jack_new(card, jack_name, -+ SND_JACK_AVOUT, &hdmi_jack[i], -+ NULL, 0); -+ if (ret) -+ return ret; -+ -+ ret = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device, -+ &hdmi_jack[i]); -+ if (ret < 0) -+ return ret; -+ -+ i++; -+ } -+ if (!component) -+ return -EINVAL; -+ -+ return hdac_hdmi_jack_port_init(component, &card->dapm); -+} -+ -+static int hdmi_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct card_private *ctx = snd_soc_card_get_drvdata(rtd->card); -+ struct snd_soc_dai *dai = rtd->codec_dai; -+ struct hdmi_pcm *pcm; -+ -+ pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); -+ if (!pcm) -+ return -ENOMEM; -+ -+ pcm->device = dai->id; -+ pcm->codec_dai = dai; -+ -+ list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); -+ -+ return 0; -+} -+ -+/* Cometlake digital audio interface glue - connects codec <--> CPU */ -+ -+SND_SOC_DAILINK_DEF(ssp0_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("SSP0 Pin"))); -+SND_SOC_DAILINK_DEF(ssp0_codec, -+ DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", -+ CML_RT5682_CODEC_DAI))); -+ -+SND_SOC_DAILINK_DEF(ssp1_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin"))); -+SND_SOC_DAILINK_DEF(ssp1_codec, -+ DAILINK_COMP_ARRAY( -+ /* WL */ COMP_CODEC("i2c-10EC1011:00", CML_RT1011_CODEC_DAI), -+ /* WR */ COMP_CODEC("i2c-10EC1011:01", CML_RT1011_CODEC_DAI), -+ /* TL */ COMP_CODEC("i2c-10EC1011:02", CML_RT1011_CODEC_DAI), -+ /* TR */ COMP_CODEC("i2c-10EC1011:03", CML_RT1011_CODEC_DAI))); -+ -+SND_SOC_DAILINK_DEF(dmic_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("DMIC01 Pin"))); -+ -+SND_SOC_DAILINK_DEF(dmic16k_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("DMIC16k Pin"))); -+ -+SND_SOC_DAILINK_DEF(dmic_codec, -+ DAILINK_COMP_ARRAY(COMP_CODEC("dmic-codec", "dmic-hifi"))); -+ -+SND_SOC_DAILINK_DEF(idisp1_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("iDisp1 Pin"))); -+SND_SOC_DAILINK_DEF(idisp1_codec, -+ DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi1"))); -+ -+SND_SOC_DAILINK_DEF(idisp2_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("iDisp2 Pin"))); -+SND_SOC_DAILINK_DEF(idisp2_codec, -+ DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi2"))); -+ -+SND_SOC_DAILINK_DEF(idisp3_pin, -+ DAILINK_COMP_ARRAY(COMP_CPU("iDisp3 Pin"))); -+SND_SOC_DAILINK_DEF(idisp3_codec, -+ DAILINK_COMP_ARRAY(COMP_CODEC("ehdaudio0D2", "intel-hdmi-hifi3"))); -+ -+SND_SOC_DAILINK_DEF(platform, -+ DAILINK_COMP_ARRAY(COMP_PLATFORM("0000:00:1f.3"))); -+ -+static struct snd_soc_dai_link cml_rt1011_rt5682_dailink[] = { -+ /* Back End DAI links */ -+ { -+ /* SSP0 - Codec */ -+ .name = "SSP0-Codec", -+ .id = 0, -+ .init = cml_rt5682_codec_init, -+ .ignore_pmdown_time = 1, -+ .ops = &cml_rt5682_ops, -+ .dpcm_playback = 1, -+ .dpcm_capture = 1, -+ .no_pcm = 1, -+ SND_SOC_DAILINK_REG(ssp0_pin, ssp0_codec, platform), -+ }, -+ { -+ .name = "dmic01", -+ .id = 1, -+ .ignore_suspend = 1, -+ .dpcm_capture = 1, -+ .no_pcm = 1, -+ SND_SOC_DAILINK_REG(dmic_pin, dmic_codec, platform), -+ }, -+ { -+ .name = "dmic16k", -+ .id = 2, -+ .ignore_suspend = 1, -+ .dpcm_capture = 1, -+ .no_pcm = 1, -+ SND_SOC_DAILINK_REG(dmic16k_pin, dmic_codec, platform), -+ }, -+ { -+ .name = "iDisp1", -+ .id = 3, -+ .init = hdmi_init, -+ .dpcm_playback = 1, -+ .no_pcm = 1, -+ SND_SOC_DAILINK_REG(idisp1_pin, idisp1_codec, platform), -+ }, -+ { -+ .name = "iDisp2", -+ .id = 4, -+ .init = hdmi_init, -+ .dpcm_playback = 1, -+ .no_pcm = 1, -+ SND_SOC_DAILINK_REG(idisp2_pin, idisp2_codec, platform), -+ }, -+ { -+ .name = "iDisp3", -+ .id = 5, -+ .init = hdmi_init, -+ .dpcm_playback = 1, -+ .no_pcm = 1, -+ SND_SOC_DAILINK_REG(idisp3_pin, idisp3_codec, platform), -+ }, -+ { -+ /* -+ * SSP1 - Codec : added to end of list ensuring -+ * reuse of common topologies for other end points -+ * and changing only SSP1's codec -+ */ -+ .name = "SSP1-Codec", -+ .id = 6, -+ .dpcm_playback = 1, -+ .dpcm_capture = 1, /* Capture stream provides Feedback */ -+ .no_pcm = 1, -+ .ops = &cml_rt1011_ops, -+ SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform), -+ }, -+}; -+ -+static struct snd_soc_codec_conf rt1011_conf[] = { -+ { -+ .dev_name = "i2c-10EC1011:00", -+ .name_prefix = "WL", -+ }, -+ { -+ .dev_name = "i2c-10EC1011:01", -+ .name_prefix = "WR", -+ }, -+ { -+ .dev_name = "i2c-10EC1011:02", -+ .name_prefix = "TL", -+ }, -+ { -+ .dev_name = "i2c-10EC1011:03", -+ .name_prefix = "TR", -+ }, -+}; -+ -+/* Cometlake audio machine driver for RT1011 and RT5682 */ -+static struct snd_soc_card snd_soc_card_cml = { -+ .name = "cml_rt1011_rt5682", -+ .dai_link = cml_rt1011_rt5682_dailink, -+ .num_links = ARRAY_SIZE(cml_rt1011_rt5682_dailink), -+ .codec_conf = rt1011_conf, -+ .num_configs = ARRAY_SIZE(rt1011_conf), -+ .dapm_widgets = cml_rt1011_rt5682_widgets, -+ .num_dapm_widgets = ARRAY_SIZE(cml_rt1011_rt5682_widgets), -+ .dapm_routes = cml_rt1011_rt5682_map, -+ .num_dapm_routes = ARRAY_SIZE(cml_rt1011_rt5682_map), -+ .controls = cml_controls, -+ .num_controls = ARRAY_SIZE(cml_controls), -+ .fully_routed = true, -+ .late_probe = sof_card_late_probe, -+}; -+ -+static int snd_cml_rt1011_probe(struct platform_device *pdev) -+{ -+ struct card_private *ctx; -+ struct snd_soc_acpi_mach *mach; -+ const char *platform_name; -+ int ret; -+ -+ ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC); -+ if (!ctx) -+ return -ENOMEM; -+ -+ INIT_LIST_HEAD(&ctx->hdmi_pcm_list); -+ mach = (&pdev->dev)->platform_data; -+ snd_soc_card_cml.dev = &pdev->dev; -+ platform_name = mach->mach_params.platform; -+ -+ /* set platform name for each dailink */ -+ ret = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cml, -+ platform_name); -+ if (ret) -+ return ret; -+ -+ ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; -+ -+ snd_soc_card_set_drvdata(&snd_soc_card_cml, ctx); -+ -+ return devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cml); -+} -+ -+static struct platform_driver snd_cml_rt1011_rt5682_driver = { -+ .probe = snd_cml_rt1011_probe, -+ .driver = { -+ .name = "cml_rt1011_rt5682", -+ .pm = &snd_soc_pm_ops, -+ }, -+}; -+module_platform_driver(snd_cml_rt1011_rt5682_driver); -+ -+/* Module information */ -+MODULE_DESCRIPTION("Cometlake Audio Machine driver - RT1011 and RT5682 in I2S mode"); -+MODULE_AUTHOR("Naveen Manohar "); -+MODULE_AUTHOR("Sathya Prakash M R "); -+MODULE_AUTHOR("Shuming Fan "); -+MODULE_LICENSE("GPL v2"); -+MODULE_ALIAS("platform:cml_rt1011_rt5682"); --- -2.24.1 - -From 19bae513625e312c4f6a26d967fe6421585aa144 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:37 -0500 -Subject: [PATCH 055/109] ASoC: Intel: add mutual exclusion between SOF and - legacy Baytrail driver - -This legacy driver is already deprecated, let's make sure there is no -conflict with SOF. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 280393b712b7e338addc2f7f60b4e4da787ba19b) -Bugzilla: 1772498 ---- - sound/soc/intel/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig -index 7e9feca333b7..d6c5c68b7499 100644 ---- a/sound/soc/intel/Kconfig -+++ b/sound/soc/intel/Kconfig -@@ -65,7 +65,7 @@ config SND_SOC_INTEL_HASWELL - - config SND_SOC_INTEL_BAYTRAIL - tristate "Baytrail (legacy) Platforms" -- depends on DMADEVICES && ACPI && SND_SST_ATOM_HIFI2_PLATFORM=n -+ depends on DMADEVICES && ACPI && SND_SST_ATOM_HIFI2_PLATFORM=n && SND_SOC_SOF_BAYTRAIL=n - select SND_SOC_INTEL_SST - select SND_SOC_INTEL_SST_ACPI - select SND_SOC_INTEL_SST_FIRMWARE --- -2.24.1 - -From 6d47735bff19d37abfcf32194eb61177209c4eef Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:41 -0500 -Subject: [PATCH 056/109] ASoC: Intel: Skylake: mark HDAudio codec support as - deprecated. - -This option famously broke audio on Linus' laptop and the problem have -not been fixed. - -Mark as DEPRECATED to avoid any ambiguity with distros. - -Use SOF if you need HDaudio support w/ the DSP enabled, e.g. for DMIC -capture. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-8-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 02701b909c2fab4b49f9c9545ab921c9b2c7a768) -Bugzilla: 1772498 ---- - sound/soc/intel/Kconfig | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig -index d6c5c68b7499..c8de0bb5bed9 100644 ---- a/sound/soc/intel/Kconfig -+++ b/sound/soc/intel/Kconfig -@@ -209,9 +209,12 @@ config SND_SOC_INTEL_SKYLAKE_SSP_CLK - config SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC - bool "HDAudio codec support" - help -- If you have a Intel Skylake/Broxton/ApolloLake/KabyLake/ -- GeminiLake or CannonLake platform with an HDaudio codec -- then enable this option by saying Y -+ This option broke audio on Linus' Skylake laptop in December 2018 -+ and the race conditions during the probe were not fixed since. -+ This option is DEPRECATED, all HDaudio codec support needs -+ to be handled by the SOF driver. -+ Distributions should not enable this option and there are no known -+ users of this capability. - - config SND_SOC_INTEL_SKYLAKE_COMMON - tristate --- -2.24.1 - -From e3ba0216af000f40e8578867a3ec02014612fda7 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:42 -0500 -Subject: [PATCH 057/109] ASoC: Intel: boards: remove select SND_HDA_DSP_LOADER - -This option is only required with the Skylake platform driver, there -is no reason to have this option in machine drivers. This is -e.g. useless for SOF-based solutions. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-9-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 9e7301762f6df44bb4a452b6aecbe0f322b370ee) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index ef40f83e0a3b..91952ffc0b67 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -270,7 +270,6 @@ config SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH - depends on I2C && ACPI - depends on MFD_INTEL_LPSS || COMPILE_TEST - select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC -- select SND_HDA_DSP_LOADER - help - This adds support for ASoC machine driver for Broxton-P platforms - with DA7219 + MAX98357A I2S audio codec. -@@ -284,7 +283,6 @@ config SND_SOC_INTEL_BXT_RT298_MACH - select SND_SOC_RT298 - select SND_SOC_DMIC - select SND_SOC_HDAC_HDMI -- select SND_HDA_DSP_LOADER - help - This adds support for ASoC machine driver for Broxton platforms - with RT286 I2S audio codec. -@@ -375,7 +373,6 @@ config SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH - select SND_SOC_MAX98357A - select SND_SOC_DMIC - select SND_SOC_HDAC_HDMI -- select SND_HDA_DSP_LOADER - help - This adds support for ASoC machine driver for Geminilake platforms - with RT5682 + MAX98357A I2S audio codec. --- -2.24.1 - -From 65ff2363e23c1f5e743b3781b8abf0abd0a4447c Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:43 -0500 -Subject: [PATCH 058/109] ASoC: Intel: boards: fix configs for - bxt-da7219-max98057a - -The same driver is reused for 3 different configurations, but the -driver will only be build if ApolloLake is selected. - -Fix and make sure each device can work without dependencies on others -(useful for minimal configurations). - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-10-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit c4a09f9a523e674ef9a046e05d99c90f2c9513b1) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 24 ++++++++++++++++++++++-- - sound/soc/intel/boards/Makefile | 2 +- - 2 files changed, 23 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 91952ffc0b67..826694ecfdbf 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -263,13 +263,17 @@ config SND_SOC_INTEL_DA7219_MAX98357A_GENERIC - select SND_SOC_DMIC - select SND_SOC_HDAC_HDMI - -+config SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON -+ tristate -+ select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC -+ - if SND_SOC_INTEL_APL - - config SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH - tristate "Broxton with DA7219 and MAX98357A in I2S Mode" - depends on I2C && ACPI - depends on MFD_INTEL_LPSS || COMPILE_TEST -- select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC -+ select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON - help - This adds support for ASoC machine driver for Broxton-P platforms - with DA7219 + MAX98357A I2S audio codec. -@@ -365,6 +369,17 @@ endif ## SND_SOC_INTEL_KBL - - if SND_SOC_INTEL_GLK || (SND_SOC_SOF_GEMINILAKE && SND_SOC_SOF_HDA_LINK) - -+config SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH -+ tristate "GLK with DA7219 and MAX98357A in I2S Mode" -+ depends on I2C && ACPI -+ depends on MFD_INTEL_LPSS || COMPILE_TEST -+ select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON -+ help -+ This adds support for ASoC machine driver for Geminilake platforms -+ with DA7219 + MAX98357A I2S audio codec. -+ Say Y or m if you have such a device. This is a recommended option. -+ If unsure select "N". -+ - config SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH - tristate "GLK with RT5682 and MAX98357A in I2S Mode" - depends on I2C && ACPI -@@ -418,7 +433,12 @@ config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH - tristate "CML_LP with DA7219 and MAX98357A in I2S Mode" - depends on I2C && ACPI - depends on MFD_INTEL_LPSS || COMPILE_TEST -- select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC -+ select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON -+ help -+ This adds support for ASoC machine driver for Cometlake platforms -+ with DA7219 + MAX98357A I2S audio codec. -+ Say Y or m if you have such a device. This is a recommended option. -+ If unsure select "N". - - config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH - tristate "CML with RT1011 and RT5682 in I2S Mode" -diff --git a/sound/soc/intel/boards/Makefile b/sound/soc/intel/boards/Makefile -index 9ae6544c6f3b..ba1aa89db09d 100644 ---- a/sound/soc/intel/boards/Makefile -+++ b/sound/soc/intel/boards/Makefile -@@ -33,7 +33,7 @@ obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o - obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o - obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o - obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o --obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH) += snd-soc-sst-bxt-da7219_max98357a.o -+obj-$(CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON) += snd-soc-sst-bxt-da7219_max98357a.o - obj-$(CONFIG_SND_SOC_INTEL_BXT_RT298_MACH) += snd-soc-sst-bxt-rt298.o - obj-$(CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH) += snd-soc-sst-glk-rt5682_max98357a.o - obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o --- -2.24.1 - -From 63fe227888be39183df411fc2032181a1d50408a Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:44 -0500 -Subject: [PATCH 059/109] ASoC: Intel: boards: Geminilake is only supported by - SOF - -Geminilake machine drivers are only tested and recommended with SOF. - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-11-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 3315e5b40f59d1aab6543773d99b1f19c3ea1848) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 826694ecfdbf..76d1e6ab30b5 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -367,7 +367,7 @@ config SND_SOC_INTEL_KBL_RT5660_MACH - - endif ## SND_SOC_INTEL_KBL - --if SND_SOC_INTEL_GLK || (SND_SOC_SOF_GEMINILAKE && SND_SOC_SOF_HDA_LINK) -+if SND_SOC_SOF_GEMINILAKE && SND_SOC_SOF_HDA_LINK - - config SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH - tristate "GLK with DA7219 and MAX98357A in I2S Mode" -@@ -394,7 +394,7 @@ config SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH - Say Y if you have such a device. - If unsure select "N". - --endif ## SND_SOC_INTEL_GLK || (SND_SOC_SOF_GEMINILAKE && SND_SOC_SOF_HDA_LINK) -+endif ## SND_SOC_SOF_GEMINILAKE && SND_SOC_SOF_HDA_LINK - - if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC - --- -2.24.1 - -From 400e61db419050e17d2eb05129ed548b2b3a817a Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Fri, 1 Nov 2019 12:30:45 -0500 -Subject: [PATCH 060/109] ASoC: Intel: boards: sof_rt5682: use dependency on - SOF_HDA_LINK - -The wrong dependency is used and the build can be broken - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101173045.27099-12-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 8039105987fcd8dda39074df013cfdf0025dd297) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 76d1e6ab30b5..2702aefee775 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -411,11 +411,11 @@ config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH - - endif ## SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC - --if SND_SOC_SOF_HDA_COMMON || SND_SOC_SOF_BAYTRAIL -+if SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL - config SND_SOC_INTEL_SOF_RT5682_MACH - tristate "SOF with rt5682 codec in I2S Mode" - depends on I2C && ACPI -- depends on (SND_SOC_SOF_HDA_COMMON && (MFD_INTEL_LPSS || COMPILE_TEST)) ||\ -+ depends on (SND_SOC_SOF_HDA_LINK && (MFD_INTEL_LPSS || COMPILE_TEST)) ||\ - (SND_SOC_SOF_BAYTRAIL && (X86_INTEL_LPSS || COMPILE_TEST)) - select SND_SOC_RT5682 - select SND_SOC_DMIC -@@ -425,7 +425,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH - with rt5682 codec. - Say Y if you have such a device. - If unsure select "N". --endif ## SND_SOC_SOF_HDA_COMMON || SND_SOC_SOF_BAYTRAIL -+endif ## SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL - - if (SND_SOC_SOF_COMETLAKE_LP && SND_SOC_SOF_HDA_LINK) - --- -2.24.1 - -From dc32112887d49cac7f705357c92a9abf390d438b Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 8 Nov 2019 10:46:37 +0100 -Subject: [PATCH 061/109] ASoC: intel: Avoid non-standard macro usage - -Pass the device pointer from the PCI pointer directly, instead of a -non-standard macro. The macro didn't give any better readability. - -Acked-by: Mark Brown -Link: https://lore.kernel.org/r/20191108094641.20086-5-tiwai@suse.de -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 6420c24a30006e2fdbc292f88d37db56ca28f6e8) -Bugzilla: 1772498 ---- - sound/soc/intel/skylake/skl-pcm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c -index 7f287424af9b..07bc047f077e 100644 ---- a/sound/soc/intel/skylake/skl-pcm.c -+++ b/sound/soc/intel/skylake/skl-pcm.c -@@ -1310,7 +1310,7 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd) - size = MAX_PREALLOC_SIZE; - snd_pcm_lib_preallocate_pages_for_all(pcm, - SNDRV_DMA_TYPE_DEV_SG, -- snd_dma_pci_data(skl->pci), -+ &skl->pci->dev, - size, MAX_PREALLOC_SIZE); - } - --- -2.24.1 - -From 11af41ca977482d5d5f6a312eced0f4e50ef898c Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:09 -0500 -Subject: [PATCH 062/109] ASoC: SOF: ipc: introduce message for DSP power - gating - -Add new ipc messages which will be sent from driver to FW, to ask FW to -enter specific power saving state. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-14-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 10992004e1e960c7e256ec70c7ab22895a7003d7) -Bugzilla: 1772498 ---- - include/sound/sof/header.h | 1 + - include/sound/sof/pm.h | 8 ++++++++ - 2 files changed, 9 insertions(+) - -diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h -index 332143ff7278..bf3edd9c08b4 100644 ---- a/include/sound/sof/header.h -+++ b/include/sound/sof/header.h -@@ -75,6 +75,7 @@ - #define SOF_IPC_PM_CLK_GET SOF_CMD_TYPE(0x005) - #define SOF_IPC_PM_CLK_REQ SOF_CMD_TYPE(0x006) - #define SOF_IPC_PM_CORE_ENABLE SOF_CMD_TYPE(0x007) -+#define SOF_IPC_PM_GATE SOF_CMD_TYPE(0x008) - - /* component runtime config - multiple different types */ - #define SOF_IPC_COMP_SET_VALUE SOF_CMD_TYPE(0x001) -diff --git a/include/sound/sof/pm.h b/include/sound/sof/pm.h -index 003879401d63..3cf2e0f39d94 100644 ---- a/include/sound/sof/pm.h -+++ b/include/sound/sof/pm.h -@@ -45,4 +45,12 @@ struct sof_ipc_pm_core_config { - uint32_t enable_mask; - } __packed; - -+struct sof_ipc_pm_gate { -+ struct sof_ipc_cmd_hdr hdr; -+ uint32_t flags; /* platform specific */ -+ -+ /* reserved for future use */ -+ uint32_t reserved[5]; -+} __packed; -+ - #endif --- -2.24.1 - -From 26ec2e5a52d27d29ea31bdf2fedfa19a76712f12 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:40:57 -0500 -Subject: [PATCH 063/109] ASoC: SOF: add a field to store the current D0 - substate of DSP - -Add field d0_substate to struct snd_sof_dev to store the current DSP -D0 sub-state(only meaningful when DSP in D0), which could be D0I0 or -D0I3. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 4c19030c511fd6eab029bae838f736256d2f43cd) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-priv.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 26ea5099bf4e..90a6def3b8d3 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -68,6 +68,12 @@ extern int sof_core_debug; - - #define DMA_CHAN_INVALID 0xFFFFFFFF - -+/* DSP D0ix sub-state */ -+enum sof_d0_substate { -+ SOF_DSP_D0I0 = 0, /* DSP default D0 substate */ -+ SOF_DSP_D0I3, /* DSP D0i3(low power) substate*/ -+}; -+ - struct snd_sof_dev; - struct snd_sof_ipc_msg; - struct snd_sof_ipc; -@@ -396,6 +402,9 @@ struct snd_sof_dev { - */ - struct snd_soc_component_driver plat_drv; - -+ /* power states related */ -+ enum sof_d0_substate d0_substate; -+ - /* DSP firmware boot */ - wait_queue_head_t boot_wait; - enum snd_sof_fw_state fw_state; --- -2.24.1 - -From 88b10cf888bbaccc413dfec7e82a5d642bf0d71f Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:40:58 -0500 -Subject: [PATCH 064/109] ASoC: SOF: reset default d0_substate at probe() and - resume() - -We initialize/reset d0_substate to default d0i0 value when doing -transition D3-->D0, e.g. at success of probing and resuming. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 09fe6b528886c0d07ce539b837749edcc46618d0) -Bugzilla: 1772498 ---- - sound/soc/sof/core.c | 3 +++ - sound/soc/sof/pm.c | 3 +++ - 2 files changed, 6 insertions(+) - -diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c -index 8a23739aa545..d6b827de26d4 100644 ---- a/sound/soc/sof/core.c -+++ b/sound/soc/sof/core.c -@@ -495,6 +495,9 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) - /* initialize sof device */ - sdev->dev = dev; - -+ /* initialize default D0 sub-state */ -+ sdev->d0_substate = SOF_DSP_D0I0; -+ - sdev->pdata = plat_data; - sdev->first_boot = true; - sdev->fw_state = SOF_FW_BOOT_NOT_STARTED; -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index 195af259e78e..f13a2eb28732 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -337,6 +337,9 @@ static int sof_resume(struct device *dev, bool runtime_resume) - "error: ctx_restore ipc error during resume %d\n", - ret); - -+ /* initialize default D0 sub-state */ -+ sdev->d0_substate = SOF_DSP_D0I0; -+ - return ret; - } - --- -2.24.1 - -From f082a124cb84e3a83d8ae35aa201698eea020e3b Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:40:59 -0500 -Subject: [PATCH 065/109] ASoC: SOF: add set_power_state() to dsp_ops for power - state update - -D0i3 is a platform-defined substate of D0, so we need a -platform-specific callback in dsp_ops to handle the relevant -configurations. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit e8f112d8c29f44ded83f97828c104bf0904871ec) -Bugzilla: 1772498 ---- - sound/soc/sof/ops.h | 9 +++++++++ - sound/soc/sof/sof-priv.h | 2 ++ - 2 files changed, 11 insertions(+) - -diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h -index 824d36fe59fd..d7c8fc06f961 100644 ---- a/sound/soc/sof/ops.h -+++ b/sound/soc/sof/ops.h -@@ -193,6 +193,15 @@ static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq) - return 0; - } - -+static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev, -+ enum sof_d0_substate substate) -+{ -+ if (sof_ops(sdev)->set_power_state) -+ return sof_ops(sdev)->set_power_state(sdev, substate); -+ -+ return 0; -+} -+ - /* debug */ - static inline void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, u32 flags) - { -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 90a6def3b8d3..e0adc34d4dec 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -189,6 +189,8 @@ struct snd_sof_dsp_ops { - int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */ - int (*runtime_idle)(struct snd_sof_dev *sof_dev); /* optional */ - int (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */ -+ int (*set_power_state)(struct snd_sof_dev *sdev, -+ enum sof_d0_substate d0_substate); /* optional */ - - /* DSP clocking */ - int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq); /* optional */ --- -2.24.1 - -From f637c49894fcc4a5f363661c369c17c41c676d58 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:00 -0500 -Subject: [PATCH 066/109] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP - D0ix substate - -Adding helper to implement setting dsp to d0i3 or d0i0 status, this will -be needed for driver D0ix support. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-5-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 62f8f76604623980d41cf73691ca45288871efd9) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 46 +++++++++++++++++++++++++++++++++++ - sound/soc/sof/intel/hda.h | 10 ++++++++ - 2 files changed, 56 insertions(+) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index 3ea401646e0c..fa2f1f66c72c 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -306,6 +306,52 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev) - HDA_DSP_REG_HIPCCTL_BUSY | HDA_DSP_REG_HIPCCTL_DONE, 0); - } - -+static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry) -+{ -+ struct hdac_bus *bus = sof_to_bus(sdev); -+ -+ while (snd_hdac_chip_readb(bus, VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) { -+ if (!retry--) -+ return -ETIMEDOUT; -+ usleep_range(10, 15); -+ } -+ -+ return 0; -+} -+ -+int hda_dsp_set_power_state(struct snd_sof_dev *sdev, -+ enum sof_d0_substate d0_substate) -+{ -+ struct hdac_bus *bus = sof_to_bus(sdev); -+ int retry = 50; -+ int ret; -+ u8 value; -+ -+ /* Write to D0I3C after Command-In-Progress bit is cleared */ -+ ret = hda_dsp_wait_d0i3c_done(sdev, retry); -+ if (ret < 0) { -+ dev_err(bus->dev, "CIP timeout before update D0I3C!\n"); -+ return ret; -+ } -+ -+ /* Update D0I3C register */ -+ value = d0_substate == SOF_DSP_D0I3 ? SOF_HDA_VS_D0I3C_I3 : 0; -+ snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value); -+ -+ /* Wait for cmd in progress to be cleared before exiting the function */ -+ retry = 50; -+ ret = hda_dsp_wait_d0i3c_done(sdev, retry); -+ if (ret < 0) { -+ dev_err(bus->dev, "CIP timeout after D0I3C updated!\n"); -+ return ret; -+ } -+ -+ dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n", -+ snd_hdac_chip_readb(bus, VS_D0I3C)); -+ -+ return 0; -+} -+ - static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend) - { - struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; -diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h -index 8e03d876a0ac..bc8b58ad2704 100644 ---- a/sound/soc/sof/intel/hda.h -+++ b/sound/soc/sof/intel/hda.h -@@ -64,6 +64,13 @@ - #define SOF_HDA_PPCTL_PIE BIT(31) - #define SOF_HDA_PPCTL_GPROCEN BIT(30) - -+/*Vendor Specific Registers*/ -+#define SOF_HDA_VS_D0I3C 0x104A -+ -+/* D0I3C Register fields */ -+#define SOF_HDA_VS_D0I3C_CIP BIT(0) /* Command-In-Progress */ -+#define SOF_HDA_VS_D0I3C_I3 BIT(2) /* D0i3 enable bit */ -+ - /* DPIB entry size: 8 Bytes = 2 DWords */ - #define SOF_HDA_DPIB_ENTRY_SIZE 0x8 - -@@ -455,6 +462,9 @@ int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev, - void hda_dsp_ipc_int_enable(struct snd_sof_dev *sdev); - void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev); - -+int hda_dsp_set_power_state(struct snd_sof_dev *sdev, -+ enum sof_d0_substate d0_substate); -+ - int hda_dsp_suspend(struct snd_sof_dev *sdev); - int hda_dsp_resume(struct snd_sof_dev *sdev); - int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev); --- -2.24.1 - -From 36bec5216fd616441e694d1793752a83b6e728e3 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:01 -0500 -Subject: [PATCH 067/109] ASoC: SOF: Intel: CNL: add set_power_state() ops - -Using hda_dsp_set_power_state() as set_power_state() ops for cnl to do -d0ix platform configuration updates. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-6-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 73b51957122dc47a40325a5359b44ef337cbf217) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/cnl.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c -index e9cdcc040fb5..982b81a0b13a 100644 ---- a/sound/soc/sof/intel/cnl.c -+++ b/sound/soc/sof/intel/cnl.c -@@ -255,6 +255,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = { - .runtime_resume = hda_dsp_runtime_resume, - .runtime_idle = hda_dsp_runtime_idle, - .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume, -+ .set_power_state = hda_dsp_set_power_state, - - /* ALSA HW info flags */ - .hw_info = SNDRV_PCM_INFO_MMAP | --- -2.24.1 - -From b094a6b925b36ec414772cf4ac7320597e30f592 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:02 -0500 -Subject: [PATCH 068/109] ASoC: SOF: Intel: APL: add set_power_state() ops - -Using hda_dsp_set_power_state() as set_power_state() ops for apl to do -d0ix platform configuration updates. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-7-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 35c930ba6025964ac71f041065ae212a0fcc7cca) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/apl.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c -index 15d26e8d90a9..7daa8eb456c8 100644 ---- a/sound/soc/sof/intel/apl.c -+++ b/sound/soc/sof/intel/apl.c -@@ -97,6 +97,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = { - .runtime_resume = hda_dsp_runtime_resume, - .runtime_idle = hda_dsp_runtime_idle, - .set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume, -+ .set_power_state = hda_dsp_set_power_state, - - /* ALSA HW info flags */ - .hw_info = SNDRV_PCM_INFO_MMAP | --- -2.24.1 - -From 3e61bd7113167792591babd06550cacd30b547d6 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:03 -0500 -Subject: [PATCH 069/109] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 - compatible stream - -Add flag d0i3_compatible to struct snd_sof_pcm_stream to denote if the -stream can tolerate a transition to the D0i3 substate while opened (thus -seen as 'active' by pm_runtime). - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-8-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit e5c97e88084b8dca6850eba5d2937716b88306c1) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-priv.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index e0adc34d4dec..35cdeb923898 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -310,6 +310,7 @@ struct snd_sof_pcm_stream { - struct sof_ipc_stream_posn posn; - struct snd_pcm_substream *substream; - struct work_struct period_elapsed_work; -+ bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */ - }; - - /* ALSA SOF PCM device */ --- -2.24.1 - -From 4a15ac8bae70390fdc72e96468526989be68a818 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:04 -0500 -Subject: [PATCH 070/109] ASoC: SOF: token: add tokens for PCM compatible with - D0i3 substate - -Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and -SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be -opened at low power d0i3 status or not. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-9-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 4a94940988cc44adeb383401dea0beeac4abbe63) -Bugzilla: 1772498 ---- - include/uapi/sound/sof/tokens.h | 4 ++++ - sound/soc/sof/topology.c | 10 ++++++++++ - 2 files changed, 14 insertions(+) - -diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h -index d65406f34361..76883e6fb750 100644 ---- a/include/uapi/sound/sof/tokens.h -+++ b/include/uapi/sound/sof/tokens.h -@@ -113,6 +113,10 @@ - /* ESAI */ - #define SOF_TKN_IMX_ESAI_MCLK_ID 1100 - -+/* Stream */ -+#define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 1200 -+#define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 1201 -+ - /* Led control for mute switches */ - #define SOF_TKN_MUTE_LED_USE 1300 - #define SOF_TKN_MUTE_LED_DIRECTION 1301 -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 6a4b59a0d8e6..8f73481fcdae 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -735,6 +735,16 @@ static const struct sof_topology_token pcm_tokens[] = { - offsetof(struct sof_ipc_comp_host, dmac_config), 0}, - }; - -+/* PCM */ -+static const struct sof_topology_token stream_tokens[] = { -+ {SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3, -+ SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16, -+ offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible), 0}, -+ {SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3, -+ SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16, -+ offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible), 0}, -+}; -+ - /* Generic components */ - static const struct sof_topology_token comp_tokens[] = { - {SOF_TKN_COMP_PERIOD_SINK_COUNT, --- -2.24.1 - -From b8955ca3f2a8eaa1130d2d6163bd9e6ad574133b Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:05 -0500 -Subject: [PATCH 071/109] ASoC: SOF: topology: parse and store d0i3_compatible - flag - -Parses the token from tplg file and store it to snd_sof_pcm_stream -d0i3_compatible flag, which can be used later for d0ix transition -management. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-10-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit c5232c0171428f005a3204e1c264231fb5999b28) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 8f73481fcdae..58c32e8e478e 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -2308,6 +2308,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, - { - struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); - struct snd_soc_tplg_stream_caps *caps; -+ struct snd_soc_tplg_private *private = &pcm->priv; - struct snd_sof_pcm *spcm; - int stream = SNDRV_PCM_STREAM_PLAYBACK; - int ret = 0; -@@ -2330,10 +2331,22 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, - dai_drv->dobj.private = spcm; - list_add(&spcm->list, &sdev->pcm_list); - -+ ret = sof_parse_tokens(scomp, spcm, stream_tokens, -+ ARRAY_SIZE(stream_tokens), private->array, -+ le32_to_cpu(private->size)); -+ if (ret) { -+ dev_err(sdev->dev, "error: parse stream tokens failed %d\n", -+ le32_to_cpu(private->size)); -+ return ret; -+ } -+ - /* do we need to allocate playback PCM DMA pages */ - if (!spcm->pcm.playback) - goto capture; - -+ dev_vdbg(sdev->dev, "tplg: pcm %s stream tokens: playback d0i3:%d\n", -+ spcm->pcm.pcm_name, spcm->stream[0].d0i3_compatible); -+ - caps = &spcm->pcm.caps[stream]; - - /* allocate playback page table buffer */ -@@ -2361,6 +2374,9 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, - if (!spcm->pcm.capture) - return ret; - -+ dev_vdbg(sdev->dev, "tplg: pcm %s stream tokens: capture d0i3:%d\n", -+ spcm->pcm.pcm_name, spcm->stream[1].d0i3_compatible); -+ - caps = &spcm->pcm.caps[stream]; - - /* allocate capture page table buffer */ --- -2.24.1 - -From c732dc51c229ed52e16df4a7ea41abcc8e07be5e Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:06 -0500 -Subject: [PATCH 072/109] ASoC: SOF: Intel: hda-dsp: align the comments for - D0I3C update - -Align the logs for CIP timeout at D0I3C.I3 updating. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-11-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit aae7c82d01219bf568a7b12f5839d7ca52b17d59) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index fa2f1f66c72c..74805a066183 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -330,7 +330,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - /* Write to D0I3C after Command-In-Progress bit is cleared */ - ret = hda_dsp_wait_d0i3c_done(sdev, retry); - if (ret < 0) { -- dev_err(bus->dev, "CIP timeout before update D0I3C!\n"); -+ dev_err(bus->dev, "CIP timeout before D0I3C update!\n"); - return ret; - } - -@@ -342,7 +342,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - retry = 50; - ret = hda_dsp_wait_d0i3c_done(sdev, retry); - if (ret < 0) { -- dev_err(bus->dev, "CIP timeout after D0I3C updated!\n"); -+ dev_err(bus->dev, "CIP timeout after D0I3C update!\n"); - return ret; - } - --- -2.24.1 - -From b729c392295ac0bbe1c74a0dd2d616eb06be40af Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:07 -0500 -Subject: [PATCH 073/109] ASoC: SOF: Intel: HDA: use macro for register polling - retry count - -Define macro and use it for the register polling retry count. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-12-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 92f4beb718d76e93b76343a3ba872df6cb210672) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 6 ++---- - sound/soc/sof/intel/hda.h | 1 + - 2 files changed, 3 insertions(+), 4 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index 74805a066183..936361bd25e9 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -323,12 +323,11 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - enum sof_d0_substate d0_substate) - { - struct hdac_bus *bus = sof_to_bus(sdev); -- int retry = 50; - int ret; - u8 value; - - /* Write to D0I3C after Command-In-Progress bit is cleared */ -- ret = hda_dsp_wait_d0i3c_done(sdev, retry); -+ ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT); - if (ret < 0) { - dev_err(bus->dev, "CIP timeout before D0I3C update!\n"); - return ret; -@@ -339,8 +338,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value); - - /* Wait for cmd in progress to be cleared before exiting the function */ -- retry = 50; -- ret = hda_dsp_wait_d0i3c_done(sdev, retry); -+ ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT); - if (ret < 0) { - dev_err(bus->dev, "CIP timeout after D0I3C update!\n"); - return ret; -diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h -index bc8b58ad2704..f1054e24cac0 100644 ---- a/sound/soc/sof/intel/hda.h -+++ b/sound/soc/sof/intel/hda.h -@@ -214,6 +214,7 @@ - #define HDA_DSP_CTRL_RESET_TIMEOUT 100 - #define HDA_DSP_WAIT_TIMEOUT 500 /* 500 msec */ - #define HDA_DSP_REG_POLL_INTERVAL_US 500 /* 0.5 msec */ -+#define HDA_DSP_REG_POLL_RETRY_COUNT 50 - - #define HDA_DSP_ADSPIC_IPC 1 - #define HDA_DSP_ADSPIS_IPC 1 --- -2.24.1 - -From 3ff8fd98199773620f7dda6069019036a734644b Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:08 -0500 -Subject: [PATCH 074/109] ASoC: SOF: PM: rename sof_send_pm_ipc to - sof_send_pm_ctx_ipc - -The helper sof_send_pm_ipc() is only suitable for context save/restore -IPCs' sending, so rename it to sof_send_pm_ctx_ipc here. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-13-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 7c7eba2402c11137d1fa1d3fb964a2c6fc1ded3e) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index f13a2eb28732..76a6785d17aa 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -197,7 +197,7 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev) - return ret; - } - --static int sof_send_pm_ipc(struct snd_sof_dev *sdev, int cmd) -+static int sof_send_pm_ctx_ipc(struct snd_sof_dev *sdev, int cmd) - { - struct sof_ipc_pm_ctx pm_ctx; - struct sof_ipc_reply reply; -@@ -331,7 +331,7 @@ static int sof_resume(struct device *dev, bool runtime_resume) - } - - /* notify DSP of system resume */ -- ret = sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_RESTORE); -+ ret = sof_send_pm_ctx_ipc(sdev, SOF_IPC_PM_CTX_RESTORE); - if (ret < 0) - dev_err(sdev->dev, - "error: ctx_restore ipc error during resume %d\n", -@@ -375,7 +375,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) - sof_cache_debugfs(sdev); - #endif - /* notify DSP of upcoming power down */ -- ret = sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_SAVE); -+ ret = sof_send_pm_ctx_ipc(sdev, SOF_IPC_PM_CTX_SAVE); - if (ret == -EBUSY || ret == -EAGAIN) { - /* - * runtime PM has logic to handle -EBUSY/-EAGAIN so --- -2.24.1 - -From f894ca4b705a92558268b6d828f6a0ac36032dcf Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:10 -0500 -Subject: [PATCH 075/109] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for - PM_GATE reply - -Memory windows could be powered off before receiving PM_GATE IPC reply -from FW, we can't read the mailbox to get reply. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-15-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 463fbf6dc03aff41e973602bbad6cb135fa6d48a) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-ipc.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c -index 6aae6f18b3dc..0fd2153c1769 100644 ---- a/sound/soc/sof/intel/hda-ipc.c -+++ b/sound/soc/sof/intel/hda-ipc.c -@@ -83,10 +83,12 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev) - } - - hdr = msg->msg_data; -- if (hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CTX_SAVE)) { -+ if (hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CTX_SAVE) || -+ hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) { - /* - * memory windows are powered off before sending IPC reply, -- * so we can't read the mailbox for CTX_SAVE reply. -+ * so we can't read the mailbox for CTX_SAVE and PM_GATE -+ * replies. - */ - reply.error = 0; - reply.hdr.cmd = SOF_IPC_GLB_REPLY; --- -2.24.1 - -From 39aecb24d8443afda51fa9d3402a76a422e5c2fd Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:11 -0500 -Subject: [PATCH 076/109] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC - header file - -On cAVS platforms, some IPCs are required to be sent via IPC registers -only(e.g. when in D0i3, mailbox is unaccessible), add hda-ipc.h to hold -definition of those compact IPCs. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-16-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 5056193d4d1a8b73087145add21141c46027d6a2) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-ipc.h | 51 +++++++++++++++++++++++++++++++++++ - 1 file changed, 51 insertions(+) - create mode 100644 sound/soc/sof/intel/hda-ipc.h - -diff --git a/sound/soc/sof/intel/hda-ipc.h b/sound/soc/sof/intel/hda-ipc.h -new file mode 100644 -index 000000000000..aef0ceac9803 ---- /dev/null -+++ b/sound/soc/sof/intel/hda-ipc.h -@@ -0,0 +1,51 @@ -+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ -+/* -+ * This file is provided under a dual BSD/GPLv2 license. When using or -+ * redistributing this file, you may do so under either license. -+ * -+ * Copyright(c) 2019 Intel Corporation. All rights reserved. -+ * -+ * Author: Keyon Jie -+ */ -+ -+#ifndef __SOF_INTEL_HDA_IPC_H -+#define __SOF_INTEL_HDA_IPC_H -+ -+/* -+ * Primary register, mapped to -+ * - DIPCTDR (HIPCIDR) in sideband IPC (cAVS 1.8+) -+ * - DIPCT in cAVS 1.5 IPC -+ * -+ * Secondary register, mapped to: -+ * - DIPCTDD (HIPCIDD) in sideband IPC (cAVS 1.8+) -+ * - DIPCTE in cAVS 1.5 IPC -+ */ -+ -+/* Common bits in primary register */ -+ -+/* Reserved for doorbell */ -+#define HDA_IPC_RSVD_31 BIT(31) -+/* Target, 0 - normal message, 1 - compact message(cAVS compatible) */ -+#define HDA_IPC_MSG_COMPACT BIT(30) -+/* Direction, 0 - request, 1 - response */ -+#define HDA_IPC_RSP BIT(29) -+ -+#define HDA_IPC_TYPE_SHIFT 24 -+#define HDA_IPC_TYPE_MASK GENMASK(28, 24) -+#define HDA_IPC_TYPE(x) ((x) << HDA_IPC_TYPE_SHIFT) -+ -+#define HDA_IPC_PM_GATE HDA_IPC_TYPE(0x8U) -+ -+/* Command specific payload bits in secondary register */ -+ -+/* Disable DMA tracing (0 - keep tracing, 1 - to disable DMA trace) */ -+#define HDA_PM_NO_DMA_TRACE BIT(4) -+/* Prevent clock gating (0 - cg allowed, 1 - DSP clock always on) */ -+#define HDA_PM_PCG BIT(3) -+/* Prevent power gating (0 - deep power state transitions allowed) */ -+#define HDA_PM_PPG BIT(2) -+/* Indicates whether streaming is active */ -+#define HDA_PM_PG_STREAMING BIT(1) -+#define HDA_PM_PG_RSVD BIT(0) -+ -+#endif --- -2.24.1 - -From faae0bada8e833d6dd8df487cef4b2ede5d6fa6b Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:12 -0500 -Subject: [PATCH 077/109] ASoC: SOF: configure D0ix IPC flags in - set_power_state - -The configuration for D0ix in FW is platform specific, let's do this and -send IPC in the platform set_power_state() ops. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-17-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 534037fddd34b58be86a826d449a5a6635ecdbf5) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 32 +++++++++++++++++++++++++++++++- - 1 file changed, 31 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index 936361bd25e9..b5070409a5e3 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -19,6 +19,7 @@ - #include - #include "../ops.h" - #include "hda.h" -+#include "hda-ipc.h" - - /* - * DSP Core control. -@@ -319,10 +320,28 @@ static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry) - return 0; - } - -+static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags) -+{ -+ struct sof_ipc_pm_gate pm_gate; -+ struct sof_ipc_reply reply; -+ -+ memset(&pm_gate, 0, sizeof(pm_gate)); -+ -+ /* configure pm_gate ipc message */ -+ pm_gate.hdr.size = sizeof(pm_gate); -+ pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE; -+ pm_gate.flags = flags; -+ -+ /* send pm_gate ipc to dsp */ -+ return sof_ipc_tx_message(sdev->ipc, pm_gate.hdr.cmd, &pm_gate, -+ sizeof(pm_gate), &reply, sizeof(reply)); -+} -+ - int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - enum sof_d0_substate d0_substate) - { - struct hdac_bus *bus = sof_to_bus(sdev); -+ u32 flags; - int ret; - u8 value; - -@@ -347,7 +366,18 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n", - snd_hdac_chip_readb(bus, VS_D0I3C)); - -- return 0; -+ if (d0_substate == SOF_DSP_D0I0) -+ flags = HDA_PM_PPG;/* prevent power gating in D0 */ -+ else -+ flags = HDA_PM_NO_DMA_TRACE;/* disable DMA trace in D0I3*/ -+ -+ /* sending pm_gate IPC */ -+ ret = hda_dsp_send_pm_gate_ipc(sdev, flags); -+ if (ret < 0) -+ dev_err(sdev->dev, -+ "error: PM_GATE ipc error %d\n", ret); -+ -+ return ret; - } - - static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend) --- -2.24.1 - -From 4cd64496be339c452c3de5602cd5d72e238cc34a Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:13 -0500 -Subject: [PATCH 078/109] ASoC: SOF: PM: add helpers for setting D0 substate - for ADSP - -Add snd_sof_set_d0_substate() helper for setting ADSP to a specific D0 -substate, it will call into the platform specific implementation, and -update the d0_substate at success. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-18-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 601252869f50af6f5ab377e7f4846d7b09cc66c0) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 17 +++++++++++++++++ - sound/soc/sof/sof-priv.h | 2 ++ - 2 files changed, 19 insertions(+) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index 76a6785d17aa..86bd2ffadfe5 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -434,6 +434,23 @@ int snd_sof_runtime_resume(struct device *dev) - } - EXPORT_SYMBOL(snd_sof_runtime_resume); - -+int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, -+ enum sof_d0_substate d0_substate) -+{ -+ int ret; -+ -+ /* do platform specific set_state */ -+ ret = snd_sof_dsp_set_power_state(sdev, d0_substate); -+ if (ret < 0) -+ return ret; -+ -+ /* update dsp D0 sub-state */ -+ sdev->d0_substate = d0_substate; -+ -+ return 0; -+} -+EXPORT_SYMBOL(snd_sof_set_d0_substate); -+ - int snd_sof_resume(struct device *dev) - { - return sof_resume(dev, false); -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 35cdeb923898..548cba7ac571 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -494,6 +494,8 @@ int snd_sof_runtime_resume(struct device *dev); - int snd_sof_runtime_idle(struct device *dev); - int snd_sof_resume(struct device *dev); - int snd_sof_suspend(struct device *dev); -+int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, -+ enum sof_d0_substate d0_substate); - - void snd_sof_new_platform_drv(struct snd_sof_dev *sdev); - --- -2.24.1 - -From b6d13fd241298270085e89880958c9d846413116 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:14 -0500 -Subject: [PATCH 079/109] ASoC: SOF: Intel: CNL: add support for sending - compact IPC - -For compact IPCs, we will send the IPC header/command via the HIPCIDR -register and the first 32bit payload via the HIPCIDD register, no -mailbox will be used. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-19-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 0267de58acfe5059ace739741f1533dd605ed22f) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/cnl.c | 42 ++++++++++++++++++++++++++++++++++----- - sound/soc/sof/intel/hda.h | 1 + - 2 files changed, 38 insertions(+), 5 deletions(-) - -diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c -index 982b81a0b13a..0e1e265f3f3b 100644 ---- a/sound/soc/sof/intel/cnl.c -+++ b/sound/soc/sof/intel/cnl.c -@@ -17,6 +17,7 @@ - - #include "../ops.h" - #include "hda.h" -+#include "hda-ipc.h" - - static const struct snd_sof_debugfs_map cnl_dsp_debugfs[] = { - {"hda", HDA_DSP_HDA_BAR, 0, 0x4000, SOF_DEBUGFS_ACCESS_ALWAYS}, -@@ -150,14 +151,45 @@ static void cnl_ipc_dsp_done(struct snd_sof_dev *sdev) - CNL_DSP_REG_HIPCCTL_DONE); - } - -+static bool cnl_compact_ipc_compress(struct snd_sof_ipc_msg *msg, -+ u32 *dr, u32 *dd) -+{ -+ struct sof_ipc_pm_gate *pm_gate; -+ -+ if (msg->header == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) { -+ pm_gate = msg->msg_data; -+ -+ /* send the compact message via the primary register */ -+ *dr = HDA_IPC_MSG_COMPACT | HDA_IPC_PM_GATE; -+ -+ /* send payload via the extended data register */ -+ *dd = pm_gate->flags; -+ -+ return true; -+ } -+ -+ return false; -+} -+ - static int cnl_ipc_send_msg(struct snd_sof_dev *sdev, - struct snd_sof_ipc_msg *msg) - { -- /* send the message */ -- sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, -- msg->msg_size); -- snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR, -- CNL_DSP_REG_HIPCIDR_BUSY); -+ u32 dr = 0; -+ u32 dd = 0; -+ -+ if (cnl_compact_ipc_compress(msg, &dr, &dd)) { -+ /* send the message via IPC registers */ -+ snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDD, -+ dd); -+ snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR, -+ CNL_DSP_REG_HIPCIDR_BUSY | dr); -+ } else { -+ /* send the message via mailbox */ -+ sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, -+ msg->msg_size); -+ snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR, -+ CNL_DSP_REG_HIPCIDR_BUSY); -+ } - - return 0; - } -diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h -index f1054e24cac0..16376f55e420 100644 ---- a/sound/soc/sof/intel/hda.h -+++ b/sound/soc/sof/intel/hda.h -@@ -312,6 +312,7 @@ - #define CNL_DSP_REG_HIPCTDD (CNL_DSP_IPC_BASE + 0x08) - #define CNL_DSP_REG_HIPCIDR (CNL_DSP_IPC_BASE + 0x10) - #define CNL_DSP_REG_HIPCIDA (CNL_DSP_IPC_BASE + 0x14) -+#define CNL_DSP_REG_HIPCIDD (CNL_DSP_IPC_BASE + 0x18) - #define CNL_DSP_REG_HIPCCTL (CNL_DSP_IPC_BASE + 0x28) - - /* HIPCI */ --- -2.24.1 - -From c4cf471d27ee3a0f30c4bcb894ce1b9a3254c350 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:15 -0500 -Subject: [PATCH 080/109] ASoC: SOF: add a flag to indicate the system suspend - target - -Add flag 's0_suspend' to indicate if the system is entering S0ix or -not. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-20-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 7367d3096b1443e55a2c730d1966f423b15d5cad) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-priv.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 548cba7ac571..f6ecd9f0fbc6 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -407,6 +407,8 @@ struct snd_sof_dev { - - /* power states related */ - enum sof_d0_substate d0_substate; -+ /* flag to track if the intended power target of suspend is S0ix */ -+ bool s0_suspend; - - /* DSP firmware boot */ - wait_queue_head_t boot_wait; --- -2.24.1 - -From 30c0391c903f66e9b1b921712900593c64510466 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:16 -0500 -Subject: [PATCH 081/109] ASoC: SOF: add a flag suspend_ignored for sof stream - -Add a suspend_ignored flag to snd_sof_pcm_stream that will be used to -decide if the corresponding FW pipeline should be kept active to perform -always on tasks when the system is entering the S0ix state. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-21-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 4cd933abd4820da7eefe672ff439b32d199a07be) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-priv.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index f6ecd9f0fbc6..47420d184b53 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -311,6 +311,11 @@ struct snd_sof_pcm_stream { - struct snd_pcm_substream *substream; - struct work_struct period_elapsed_work; - bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */ -+ /* -+ * flag to indicate that the DSP pipelines should be kept -+ * active or not while suspending the stream -+ */ -+ bool suspend_ignored; - }; - - /* ALSA SOF PCM device */ --- -2.24.1 - -From da323444a5345a0d95fb943b8af039623df2a36c Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:17 -0500 -Subject: [PATCH 082/109] ASoC: SOF: PM: implement prepare/complete callbacks - -Implement the prepare() and complete() callbacks for power management, -initialize s0_suspend flag at prepare(), and reset it at complete(). - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-22-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 0b50b3b1c3bc2a2c9eeab418b3de3e60e0530cf4) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 23 +++++++++++++++++++++++ - sound/soc/sof/sof-priv.h | 2 ++ - 2 files changed, 25 insertions(+) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index 86bd2ffadfe5..02189eb2e89a 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -462,3 +462,26 @@ int snd_sof_suspend(struct device *dev) - return sof_suspend(dev, false); - } - EXPORT_SYMBOL(snd_sof_suspend); -+ -+int snd_sof_prepare(struct device *dev) -+{ -+ struct snd_sof_dev *sdev = dev_get_drvdata(dev); -+ -+#if defined(CONFIG_ACPI) -+ sdev->s0_suspend = acpi_target_system_state() == ACPI_STATE_S0; -+#else -+ /* will suspend to S3 by default */ -+ sdev->s0_suspend = false; -+#endif -+ -+ return 0; -+} -+EXPORT_SYMBOL(snd_sof_prepare); -+ -+void snd_sof_complete(struct device *dev) -+{ -+ struct snd_sof_dev *sdev = dev_get_drvdata(dev); -+ -+ sdev->s0_suspend = false; -+} -+EXPORT_SYMBOL(snd_sof_complete); -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 47420d184b53..9bded2e48fba 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -501,6 +501,8 @@ int snd_sof_runtime_resume(struct device *dev); - int snd_sof_runtime_idle(struct device *dev); - int snd_sof_resume(struct device *dev); - int snd_sof_suspend(struct device *dev); -+int snd_sof_prepare(struct device *dev); -+void snd_sof_complete(struct device *dev); - int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, - enum sof_d0_substate d0_substate); - --- -2.24.1 - -From 78ecf411b770ea954e2bcd18b22b7c43ece9f54f Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:18 -0500 -Subject: [PATCH 083/109] ASoC: SOF: ignore suspend/resume for D0ix compatible - streams - -During system suspend, the PM framework will freeze all applications and -the ALSA/ASoC core will suspend all RUNNING PCM streams. - -However, D0ix-compatible PCM streams should keep the related pipelines -active in the DSP when the system is entering S0ix. The TRIGGER_SUSPEND -event is trapped in such cases to prevent the pipelines from being -stopped. Likewise, the TRIGGER_RESUME/START events should not affect the -pipeline state. - -The SOF driver also triggers some DSP Firmware pipelines based on the -DAPM widgets power events. In such cases, we also ignore PRE_PMU and -POST_PMD events to keep the pipelines active. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-23-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit ac8c046f19f94ec419c60d7a073af75a71386e97) -Bugzilla: 1772498 ---- - sound/soc/sof/pcm.c | 31 +++++++++++++++++++++++++++++++ - sound/soc/sof/topology.c | 17 ++++++++++++++++- - 2 files changed, 47 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c -index b33928e1385b..927b197c2c8d 100644 ---- a/sound/soc/sof/pcm.c -+++ b/sound/soc/sof/pcm.c -@@ -350,6 +350,16 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) - stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_RELEASE; - break; - case SNDRV_PCM_TRIGGER_RESUME: -+ if (spcm->stream[substream->stream].suspend_ignored) { -+ /* -+ * this case will be triggered when INFO_RESUME is -+ * supported, no need to resume streams that remained -+ * enabled in D0ix. -+ */ -+ spcm->stream[substream->stream].suspend_ignored = false; -+ return 0; -+ } -+ - /* set up hw_params */ - ret = sof_pcm_prepare(substream); - if (ret < 0) { -@@ -360,9 +370,30 @@ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) - - /* fallthrough */ - case SNDRV_PCM_TRIGGER_START: -+ if (spcm->stream[substream->stream].suspend_ignored) { -+ /* -+ * This case will be triggered when INFO_RESUME is -+ * not supported, no need to re-start streams that -+ * remained enabled in D0ix. -+ */ -+ spcm->stream[substream->stream].suspend_ignored = false; -+ return 0; -+ } - stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START; - break; - case SNDRV_PCM_TRIGGER_SUSPEND: -+ if (sdev->s0_suspend && -+ spcm->stream[substream->stream].d0i3_compatible) { -+ /* -+ * trap the event, not sending trigger stop to -+ * prevent the FW pipelines from being stopped, -+ * and mark the flag to ignore the upcoming DAPM -+ * PM events. -+ */ -+ spcm->stream[substream->stream].suspend_ignored = true; -+ return 0; -+ } -+ /* fallthrough */ - case SNDRV_PCM_TRIGGER_STOP: - stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP; - ipc_first = true; -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 58c32e8e478e..82d8cae44a9c 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -135,7 +135,9 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *k, int event) - { - struct snd_sof_widget *swidget = w->dobj.private; -+ int stream = SNDRV_PCM_STREAM_CAPTURE; - struct snd_sof_dev *sdev; -+ struct snd_sof_pcm *spcm; - int ret = 0; - - if (!swidget) -@@ -146,11 +148,19 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w, - dev_dbg(sdev->dev, "received event %d for widget %s\n", - event, w->name); - -+ /* get runtime PCM params using widget's stream name */ -+ spcm = snd_sof_find_spcm_name(sdev, swidget->widget->sname); -+ - /* process events */ - switch (event) { - case SND_SOC_DAPM_PRE_PMU: -+ if (spcm->stream[stream].suspend_ignored) { -+ dev_dbg(sdev->dev, "PRE_PMU event ignored, KWD pipeline is already RUNNING\n"); -+ return 0; -+ } -+ - /* set pcm params */ -- ret = ipc_pcm_params(swidget, SOF_IPC_STREAM_CAPTURE); -+ ret = ipc_pcm_params(swidget, stream); - if (ret < 0) { - dev_err(sdev->dev, - "error: failed to set pcm params for widget %s\n", -@@ -166,6 +176,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w, - swidget->widget->name); - break; - case SND_SOC_DAPM_POST_PMD: -+ if (spcm->stream[stream].suspend_ignored) { -+ dev_dbg(sdev->dev, "POST_PMD even ignored, KWD pipeline will remain RUNNING\n"); -+ return 0; -+ } -+ - /* stop trigger */ - ret = ipc_trigger(swidget, SOF_IPC_STREAM_TRIG_STOP); - if (ret < 0) --- -2.24.1 - -From 86489b5d1ebcdf9e23a2827d82f2fd7506946662 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:19 -0500 -Subject: [PATCH 084/109] ASoC: SOF: Intel: hda-dsp: implement suspend/resume - for S0ix<->S0 transition - -Enable system wake up via IPC interrupt from DSP when the system is -suspending to the S0ix state, and disable it in the corresponding -resuming. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-24-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 66e40876ddc325d892c493a6d83574bbba5770ce) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index b5070409a5e3..d23573d9e9c4 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -477,6 +477,15 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) - - int hda_dsp_resume(struct snd_sof_dev *sdev) - { -+ struct pci_dev *pci = to_pci_dev(sdev->dev); -+ -+ if (sdev->s0_suspend) { -+ /* restore and disable the system wakeup */ -+ pci_restore_state(pci); -+ disable_irq_wake(pci->irq); -+ return 0; -+ } -+ - /* init hda controller. DSP cores will be powered up during fw boot */ - return hda_resume(sdev, false); - } -@@ -509,8 +518,16 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev) - int hda_dsp_suspend(struct snd_sof_dev *sdev) - { - struct hdac_bus *bus = sof_to_bus(sdev); -+ struct pci_dev *pci = to_pci_dev(sdev->dev); - int ret; - -+ if (sdev->s0_suspend) { -+ /* enable the system waking up via IPC IRQ */ -+ enable_irq_wake(pci->irq); -+ pci_save_state(pci); -+ return 0; -+ } -+ - /* stop hda controller and power dsp off */ - ret = hda_suspend(sdev, false); - if (ret < 0) { --- -2.24.1 - -From 76547aaa1c920a91b99114d24945a2bf17974d0a Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:20 -0500 -Subject: [PATCH 085/109] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported - -No set_power_state ops means that the platform doesn't support D0i3, -return -ENOTSUPP for the case. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-25-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 5655ce660a6d3eec4a3ad37feb99fb228540d1a9) -Bugzilla: 1772498 ---- - sound/soc/sof/ops.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h -index d7c8fc06f961..93512dcbaacd 100644 ---- a/sound/soc/sof/ops.h -+++ b/sound/soc/sof/ops.h -@@ -199,7 +199,8 @@ static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev, - if (sof_ops(sdev)->set_power_state) - return sof_ops(sdev)->set_power_state(sdev, substate); - -- return 0; -+ /* D0 substate is not supported */ -+ return -ENOTSUPP; - } - - /* debug */ --- -2.24.1 - -From 6708194b3b3c49c2bf0370b2a69543c3fa98d513 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:21 -0500 -Subject: [PATCH 086/109] ASoC: SOF: PM: Add support for DSP D0i3 state when - entering S0ix - -When system is entering into S0ix, the PCI device may transition to the -D0i3 substate instead of D3. In D0i3, some always-on functionality can -be enabled, such as acoustic event detection, voice activity detection -or hotwording. When an event is detected, the DSP firmware can wake-up -the device for a transition to D0 with an interrupt. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-26-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit c470fc3f61b25e955f8ba90fc9dc554881e4e72c) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 46 insertions(+) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index 02189eb2e89a..4f8db8367d0a 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -453,12 +453,58 @@ EXPORT_SYMBOL(snd_sof_set_d0_substate); - - int snd_sof_resume(struct device *dev) - { -+ struct snd_sof_dev *sdev = dev_get_drvdata(dev); -+ int ret; -+ -+ if (sdev->s0_suspend) { -+ /* resume from D0I3 */ -+ dev_dbg(sdev->dev, "DSP will exit from D0i3...\n"); -+ ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I0); -+ if (ret == -ENOTSUPP) { -+ /* fallback to resume from D3 */ -+ dev_dbg(sdev->dev, "D0i3 not supported, fall back to resume from D3...\n"); -+ goto d3_resume; -+ } else if (ret < 0) { -+ dev_err(sdev->dev, "error: failed to exit from D0I3 %d\n", -+ ret); -+ return ret; -+ } -+ -+ /* platform-specific resume from D0i3 */ -+ return snd_sof_dsp_resume(sdev); -+ } -+ -+d3_resume: -+ /* resume from D3 */ - return sof_resume(dev, false); - } - EXPORT_SYMBOL(snd_sof_resume); - - int snd_sof_suspend(struct device *dev) - { -+ struct snd_sof_dev *sdev = dev_get_drvdata(dev); -+ int ret; -+ -+ if (sdev->s0_suspend) { -+ /* suspend to D0i3 */ -+ dev_dbg(sdev->dev, "DSP is trying to enter D0i3...\n"); -+ ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I3); -+ if (ret == -ENOTSUPP) { -+ /* fallback to D3 suspend */ -+ dev_dbg(sdev->dev, "D0i3 not supported, fall back to D3...\n"); -+ goto d3_suspend; -+ } else if (ret < 0) { -+ dev_err(sdev->dev, "error: failed to enter D0I3, %d\n", -+ ret); -+ return ret; -+ } -+ -+ /* platform-specific suspend to D0i3 */ -+ return snd_sof_dsp_suspend(sdev); -+ } -+ -+d3_suspend: -+ /* suspend to D3 */ - return sof_suspend(dev, false); - } - EXPORT_SYMBOL(snd_sof_suspend); --- -2.24.1 - -From 19f37f08da2c5bc26d8f5df3f66fb71cf3d9f831 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 25 Oct 2019 17:41:22 -0500 -Subject: [PATCH 087/109] ASoC: SOF: pci: Add prepare/complete PM callbacks - -Use the new implemented snd_sof_prepare() and snd_sof_complete() as the -power management callbacks for pci probing platforms. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191025224122.7718-27-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 6d407a39cc9619d0088b44333c6526924be00f8d) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-pci-dev.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c -index 067acf389af7..3b58b91e7b9e 100644 ---- a/sound/soc/sof/sof-pci-dev.c -+++ b/sound/soc/sof/sof-pci-dev.c -@@ -229,6 +229,8 @@ static const struct sof_dev_desc jsl_desc = { - #endif - - static const struct dev_pm_ops sof_pci_pm = { -+ .prepare = snd_sof_prepare, -+ .complete = snd_sof_complete, - SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume) - SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume, - snd_sof_runtime_idle) --- -2.24.1 - -From b6a2d55961bfc8c9eafdc520b34109420084b274 Mon Sep 17 00:00:00 2001 -From: Ranjani Sridharan -Date: Fri, 1 Nov 2019 12:09:16 -0500 -Subject: [PATCH 088/109] ASoC: SOF: Intel: hda: Simplify the - hda_dsp_wait_d0i3c_done() function - -Remove the retry argument for the hda_dsp_wait_d0i3c_done() -function and use the HDA_DSP_REG_POLL_RETRY_COUNT macro -directly. - -Signed-off-by: Ranjani Sridharan -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101170916.26517-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 65c56f5dccc87ca2993a50672e144c7378189f2c) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index d23573d9e9c4..8cd5ecc01b62 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -307,9 +307,10 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev) - HDA_DSP_REG_HIPCCTL_BUSY | HDA_DSP_REG_HIPCCTL_DONE, 0); - } - --static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry) -+static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev) - { - struct hdac_bus *bus = sof_to_bus(sdev); -+ int retry = HDA_DSP_REG_POLL_RETRY_COUNT; - - while (snd_hdac_chip_readb(bus, VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) { - if (!retry--) -@@ -346,7 +347,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - u8 value; - - /* Write to D0I3C after Command-In-Progress bit is cleared */ -- ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT); -+ ret = hda_dsp_wait_d0i3c_done(sdev); - if (ret < 0) { - dev_err(bus->dev, "CIP timeout before D0I3C update!\n"); - return ret; -@@ -357,7 +358,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev, - snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value); - - /* Wait for cmd in progress to be cleared before exiting the function */ -- ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT); -+ ret = hda_dsp_wait_d0i3c_done(sdev); - if (ret < 0) { - dev_err(bus->dev, "CIP timeout after D0I3C update!\n"); - return ret; --- -2.24.1 - -From 4260fe05dea091d2de9257f29c604c8b9530aa47 Mon Sep 17 00:00:00 2001 -From: Jaska Uimonen -Date: Tue, 8 Oct 2019 11:44:42 -0500 -Subject: [PATCH 089/109] AsoC: SOF: refactor control load code - -Move code around to enable token parsing in control load. - -Signed-off-by: Jaska Uimonen -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191008164443.1358-9-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit acf1b71cb693263c7c9373296e872a8fa61a5cf3) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 336 +++++++++++++++++++-------------------- - 1 file changed, 168 insertions(+), 168 deletions(-) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 82d8cae44a9c..143b8259a70a 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -447,174 +447,6 @@ static enum sof_comp_type find_process_comp_type(enum sof_ipc_process_type type) - return SOF_COMP_NONE; - } - --/* -- * Standard Kcontrols. -- */ -- --static int sof_control_load_volume(struct snd_soc_component *scomp, -- struct snd_sof_control *scontrol, -- struct snd_kcontrol_new *kc, -- struct snd_soc_tplg_ctl_hdr *hdr) --{ -- struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -- struct snd_soc_tplg_mixer_control *mc = -- container_of(hdr, struct snd_soc_tplg_mixer_control, hdr); -- struct sof_ipc_ctrl_data *cdata; -- int tlv[TLV_ITEMS]; -- unsigned int i; -- int ret; -- -- /* validate topology data */ -- if (le32_to_cpu(mc->num_channels) > SND_SOC_TPLG_MAX_CHAN) -- return -EINVAL; -- -- /* init the volume get/put data */ -- scontrol->size = struct_size(scontrol->control_data, chanv, -- le32_to_cpu(mc->num_channels)); -- scontrol->control_data = kzalloc(scontrol->size, GFP_KERNEL); -- if (!scontrol->control_data) -- return -ENOMEM; -- -- scontrol->comp_id = sdev->next_comp_id; -- scontrol->min_volume_step = le32_to_cpu(mc->min); -- scontrol->max_volume_step = le32_to_cpu(mc->max); -- scontrol->num_channels = le32_to_cpu(mc->num_channels); -- -- /* set cmd for mixer control */ -- if (le32_to_cpu(mc->max) == 1) { -- scontrol->cmd = SOF_CTRL_CMD_SWITCH; -- goto out; -- } -- -- scontrol->cmd = SOF_CTRL_CMD_VOLUME; -- -- /* extract tlv data */ -- if (get_tlv_data(kc->tlv.p, tlv) < 0) { -- dev_err(sdev->dev, "error: invalid TLV data\n"); -- return -EINVAL; -- } -- -- /* set up volume table */ -- ret = set_up_volume_table(scontrol, tlv, le32_to_cpu(mc->max) + 1); -- if (ret < 0) { -- dev_err(sdev->dev, "error: setting up volume table\n"); -- return ret; -- } -- -- /* set default volume values to 0dB in control */ -- cdata = scontrol->control_data; -- for (i = 0; i < scontrol->num_channels; i++) { -- cdata->chanv[i].channel = i; -- cdata->chanv[i].value = VOL_ZERO_DB; -- } -- --out: -- /* set up possible led control from mixer private data */ -- ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, -- ARRAY_SIZE(led_tokens), mc->priv.array, -- le32_to_cpu(mc->priv.size)); -- if (ret != 0) { -- dev_err(sdev->dev, "error: parse led tokens failed %d\n", -- le32_to_cpu(mc->priv.size)); -- return ret; -- } -- -- dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", -- scontrol->comp_id, scontrol->num_channels); -- -- return 0; --} -- --static int sof_control_load_enum(struct snd_soc_component *scomp, -- struct snd_sof_control *scontrol, -- struct snd_kcontrol_new *kc, -- struct snd_soc_tplg_ctl_hdr *hdr) --{ -- struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -- struct snd_soc_tplg_enum_control *ec = -- container_of(hdr, struct snd_soc_tplg_enum_control, hdr); -- -- /* validate topology data */ -- if (le32_to_cpu(ec->num_channels) > SND_SOC_TPLG_MAX_CHAN) -- return -EINVAL; -- -- /* init the enum get/put data */ -- scontrol->size = struct_size(scontrol->control_data, chanv, -- le32_to_cpu(ec->num_channels)); -- scontrol->control_data = kzalloc(scontrol->size, GFP_KERNEL); -- if (!scontrol->control_data) -- return -ENOMEM; -- -- scontrol->comp_id = sdev->next_comp_id; -- scontrol->num_channels = le32_to_cpu(ec->num_channels); -- -- scontrol->cmd = SOF_CTRL_CMD_ENUM; -- -- dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d comp_id %d\n", -- scontrol->comp_id, scontrol->num_channels, scontrol->comp_id); -- -- return 0; --} -- --static int sof_control_load_bytes(struct snd_soc_component *scomp, -- struct snd_sof_control *scontrol, -- struct snd_kcontrol_new *kc, -- struct snd_soc_tplg_ctl_hdr *hdr) --{ -- struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -- struct sof_ipc_ctrl_data *cdata; -- struct snd_soc_tplg_bytes_control *control = -- container_of(hdr, struct snd_soc_tplg_bytes_control, hdr); -- struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value; -- int max_size = sbe->max; -- -- /* init the get/put bytes data */ -- scontrol->size = sizeof(struct sof_ipc_ctrl_data) + -- le32_to_cpu(control->priv.size); -- -- if (scontrol->size > max_size) { -- dev_err(sdev->dev, "err: bytes data size %d exceeds max %d.\n", -- scontrol->size, max_size); -- return -EINVAL; -- } -- -- scontrol->control_data = kzalloc(max_size, GFP_KERNEL); -- cdata = scontrol->control_data; -- if (!scontrol->control_data) -- return -ENOMEM; -- -- scontrol->comp_id = sdev->next_comp_id; -- scontrol->cmd = SOF_CTRL_CMD_BINARY; -- -- dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", -- scontrol->comp_id, scontrol->num_channels); -- -- if (le32_to_cpu(control->priv.size) > 0) { -- memcpy(cdata->data, control->priv.data, -- le32_to_cpu(control->priv.size)); -- -- if (cdata->data->magic != SOF_ABI_MAGIC) { -- dev_err(sdev->dev, "error: Wrong ABI magic 0x%08x.\n", -- cdata->data->magic); -- return -EINVAL; -- } -- if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, -- cdata->data->abi)) { -- dev_err(sdev->dev, -- "error: Incompatible ABI version 0x%08x.\n", -- cdata->data->abi); -- return -EINVAL; -- } -- if (cdata->data->size + sizeof(const struct sof_abi_hdr) != -- le32_to_cpu(control->priv.size)) { -- dev_err(sdev->dev, -- "error: Conflict in bytes vs. priv size.\n"); -- return -EINVAL; -- } -- } -- return 0; --} -- - /* - * Topology Token Parsing. - * New tokens should be added to headers and parsing tables below. -@@ -1090,6 +922,174 @@ static void sof_dbg_comp_config(struct snd_soc_component *scomp, - config->frame_fmt); - } - -+/* -+ * Standard Kcontrols. -+ */ -+ -+static int sof_control_load_volume(struct snd_soc_component *scomp, -+ struct snd_sof_control *scontrol, -+ struct snd_kcontrol_new *kc, -+ struct snd_soc_tplg_ctl_hdr *hdr) -+{ -+ struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -+ struct snd_soc_tplg_mixer_control *mc = -+ container_of(hdr, struct snd_soc_tplg_mixer_control, hdr); -+ struct sof_ipc_ctrl_data *cdata; -+ int tlv[TLV_ITEMS]; -+ unsigned int i; -+ int ret; -+ -+ /* validate topology data */ -+ if (le32_to_cpu(mc->num_channels) > SND_SOC_TPLG_MAX_CHAN) -+ return -EINVAL; -+ -+ /* init the volume get/put data */ -+ scontrol->size = struct_size(scontrol->control_data, chanv, -+ le32_to_cpu(mc->num_channels)); -+ scontrol->control_data = kzalloc(scontrol->size, GFP_KERNEL); -+ if (!scontrol->control_data) -+ return -ENOMEM; -+ -+ scontrol->comp_id = sdev->next_comp_id; -+ scontrol->min_volume_step = le32_to_cpu(mc->min); -+ scontrol->max_volume_step = le32_to_cpu(mc->max); -+ scontrol->num_channels = le32_to_cpu(mc->num_channels); -+ -+ /* set cmd for mixer control */ -+ if (le32_to_cpu(mc->max) == 1) { -+ scontrol->cmd = SOF_CTRL_CMD_SWITCH; -+ goto out; -+ } -+ -+ scontrol->cmd = SOF_CTRL_CMD_VOLUME; -+ -+ /* extract tlv data */ -+ if (get_tlv_data(kc->tlv.p, tlv) < 0) { -+ dev_err(sdev->dev, "error: invalid TLV data\n"); -+ return -EINVAL; -+ } -+ -+ /* set up volume table */ -+ ret = set_up_volume_table(scontrol, tlv, le32_to_cpu(mc->max) + 1); -+ if (ret < 0) { -+ dev_err(sdev->dev, "error: setting up volume table\n"); -+ return ret; -+ } -+ -+ /* set default volume values to 0dB in control */ -+ cdata = scontrol->control_data; -+ for (i = 0; i < scontrol->num_channels; i++) { -+ cdata->chanv[i].channel = i; -+ cdata->chanv[i].value = VOL_ZERO_DB; -+ } -+ -+out: -+ /* set up possible led control from mixer private data */ -+ ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, -+ ARRAY_SIZE(led_tokens), mc->priv.array, -+ le32_to_cpu(mc->priv.size)); -+ if (ret != 0) { -+ dev_err(sdev->dev, "error: parse led tokens failed %d\n", -+ le32_to_cpu(mc->priv.size)); -+ return ret; -+ } -+ -+ dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", -+ scontrol->comp_id, scontrol->num_channels); -+ -+ return 0; -+} -+ -+static int sof_control_load_enum(struct snd_soc_component *scomp, -+ struct snd_sof_control *scontrol, -+ struct snd_kcontrol_new *kc, -+ struct snd_soc_tplg_ctl_hdr *hdr) -+{ -+ struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -+ struct snd_soc_tplg_enum_control *ec = -+ container_of(hdr, struct snd_soc_tplg_enum_control, hdr); -+ -+ /* validate topology data */ -+ if (le32_to_cpu(ec->num_channels) > SND_SOC_TPLG_MAX_CHAN) -+ return -EINVAL; -+ -+ /* init the enum get/put data */ -+ scontrol->size = struct_size(scontrol->control_data, chanv, -+ le32_to_cpu(ec->num_channels)); -+ scontrol->control_data = kzalloc(scontrol->size, GFP_KERNEL); -+ if (!scontrol->control_data) -+ return -ENOMEM; -+ -+ scontrol->comp_id = sdev->next_comp_id; -+ scontrol->num_channels = le32_to_cpu(ec->num_channels); -+ -+ scontrol->cmd = SOF_CTRL_CMD_ENUM; -+ -+ dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d comp_id %d\n", -+ scontrol->comp_id, scontrol->num_channels, scontrol->comp_id); -+ -+ return 0; -+} -+ -+static int sof_control_load_bytes(struct snd_soc_component *scomp, -+ struct snd_sof_control *scontrol, -+ struct snd_kcontrol_new *kc, -+ struct snd_soc_tplg_ctl_hdr *hdr) -+{ -+ struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); -+ struct sof_ipc_ctrl_data *cdata; -+ struct snd_soc_tplg_bytes_control *control = -+ container_of(hdr, struct snd_soc_tplg_bytes_control, hdr); -+ struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value; -+ int max_size = sbe->max; -+ -+ /* init the get/put bytes data */ -+ scontrol->size = sizeof(struct sof_ipc_ctrl_data) + -+ le32_to_cpu(control->priv.size); -+ -+ if (scontrol->size > max_size) { -+ dev_err(sdev->dev, "err: bytes data size %d exceeds max %d.\n", -+ scontrol->size, max_size); -+ return -EINVAL; -+ } -+ -+ scontrol->control_data = kzalloc(max_size, GFP_KERNEL); -+ cdata = scontrol->control_data; -+ if (!scontrol->control_data) -+ return -ENOMEM; -+ -+ scontrol->comp_id = sdev->next_comp_id; -+ scontrol->cmd = SOF_CTRL_CMD_BINARY; -+ -+ dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", -+ scontrol->comp_id, scontrol->num_channels); -+ -+ if (le32_to_cpu(control->priv.size) > 0) { -+ memcpy(cdata->data, control->priv.data, -+ le32_to_cpu(control->priv.size)); -+ -+ if (cdata->data->magic != SOF_ABI_MAGIC) { -+ dev_err(sdev->dev, "error: Wrong ABI magic 0x%08x.\n", -+ cdata->data->magic); -+ return -EINVAL; -+ } -+ if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, -+ cdata->data->abi)) { -+ dev_err(sdev->dev, -+ "error: Incompatible ABI version 0x%08x.\n", -+ cdata->data->abi); -+ return -EINVAL; -+ } -+ if (cdata->data->size + sizeof(const struct sof_abi_hdr) != -+ le32_to_cpu(control->priv.size)) { -+ dev_err(sdev->dev, -+ "error: Conflict in bytes vs. priv size.\n"); -+ return -EINVAL; -+ } -+ } -+ return 0; -+} -+ - /* external kcontrol init - used for any driver specific init */ - static int sof_control_load(struct snd_soc_component *scomp, int index, - struct snd_kcontrol_new *kc, --- -2.24.1 - -From 15c0bca54b7988f8f114d48e0b059ac02d729a90 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 19 Nov 2019 18:49:32 +0100 -Subject: [PATCH 090/109] ASoC: add control components management - -This ASCII string can carry additional information about -soundcard components or configuration. Add the possibility -to set this string via the ASoC card. - -Signed-off-by: Jaroslav Kysela -Cc: Mark Brown -Link: https://lore.kernel.org/r/20191119174933.25526-1-perex@perex.cz -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit dc73d73aa7145f55412611f3eead1e85ae026785) -Bugzilla: 1772498 ---- - include/sound/soc.h | 1 + - sound/soc/soc-core.c | 13 +++++++++++++ - 2 files changed, 14 insertions(+) - -diff --git a/include/sound/soc.h b/include/sound/soc.h -index f264c6509f00..efc5fb8f3d64 100644 ---- a/include/sound/soc.h -+++ b/include/sound/soc.h -@@ -978,6 +978,7 @@ struct snd_soc_card { - const char *name; - const char *long_name; - const char *driver_name; -+ const char *components; - char dmi_longname[80]; - char topology_shortname[32]; - -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index 9d3b546bae7b..da5111985a56 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -2097,6 +2097,19 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) - } - } - -+ if (card->components) { -+ /* the current implementation of snd_component_add() accepts */ -+ /* multiple components in the string separated by space, */ -+ /* but the string collision (identical string) check might */ -+ /* not work correctly */ -+ ret = snd_component_add(card->snd_card, card->components); -+ if (ret < 0) { -+ dev_err(card->dev, "ASoC: %s snd_component_add() failed: %d\n", -+ card->name, ret); -+ goto probe_end; -+ } -+ } -+ - if (card->late_probe) { - ret = card->late_probe(card); - if (ret < 0) { --- -2.24.1 - -From 4f4361e40a15f13cf9a8f55121265f34cca25539 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 20 Nov 2019 18:44:34 +0100 -Subject: [PATCH 091/109] ASoC: improve the DMI long card code in asoc-core - -Add append_dmi_string() function and make the code more readable. - -Signed-off-by: Jaroslav Kysela -Reviewed-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191120174435.30920-1-perex@perex.cz -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 4e01e5dbba96f731119f3f1a6bf51b54c98c5940) -Bugzilla: 1772498 ---- - sound/soc/soc-core.c | 66 +++++++++++++++++--------------------------- - 1 file changed, 25 insertions(+), 41 deletions(-) - -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index da5111985a56..fbe641ef8ed7 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -1729,6 +1729,23 @@ static int is_dmi_valid(const char *field) - return 1; - } - -+/* -+ * Append a string to card->dmi_longname with character cleanups. -+ */ -+static void append_dmi_string(struct snd_soc_card *card, const char *str) -+{ -+ char *dst = card->dmi_longname; -+ size_t dst_len = sizeof(card->dmi_longname); -+ size_t len; -+ -+ len = strlen(dst); -+ snprintf(dst + len, dst_len - len, "-%s", str); -+ -+ len++; /* skip the separator "-" */ -+ if (len < dst_len) -+ cleanup_dmi_name(dst + len); -+} -+ - /** - * snd_soc_set_dmi_name() - Register DMI names to card - * @card: The card to register DMI names -@@ -1763,61 +1780,36 @@ static int is_dmi_valid(const char *field) - int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) - { - const char *vendor, *product, *product_version, *board; -- size_t longname_buf_size = sizeof(card->snd_card->longname); -- size_t len; - - if (card->long_name) - return 0; /* long name already set by driver or from DMI */ - -- /* make up dmi long name as: vendor.product.version.board */ -+ /* make up dmi long name as: vendor-product-version-board */ - vendor = dmi_get_system_info(DMI_BOARD_VENDOR); - if (!vendor || !is_dmi_valid(vendor)) { - dev_warn(card->dev, "ASoC: no DMI vendor name!\n"); - return 0; - } - -- snprintf(card->dmi_longname, sizeof(card->snd_card->longname), -- "%s", vendor); -+ snprintf(card->dmi_longname, sizeof(card->dmi_longname), "%s", vendor); - cleanup_dmi_name(card->dmi_longname); - - product = dmi_get_system_info(DMI_PRODUCT_NAME); - if (product && is_dmi_valid(product)) { -- len = strlen(card->dmi_longname); -- snprintf(card->dmi_longname + len, -- longname_buf_size - len, -- "-%s", product); -- -- len++; /* skip the separator "-" */ -- if (len < longname_buf_size) -- cleanup_dmi_name(card->dmi_longname + len); -+ append_dmi_string(card, product); - - /* - * some vendors like Lenovo may only put a self-explanatory - * name in the product version field - */ - product_version = dmi_get_system_info(DMI_PRODUCT_VERSION); -- if (product_version && is_dmi_valid(product_version)) { -- len = strlen(card->dmi_longname); -- snprintf(card->dmi_longname + len, -- longname_buf_size - len, -- "-%s", product_version); -- -- len++; -- if (len < longname_buf_size) -- cleanup_dmi_name(card->dmi_longname + len); -- } -+ if (product_version && is_dmi_valid(product_version)) -+ append_dmi_string(card, product_version); - } - - board = dmi_get_system_info(DMI_BOARD_NAME); - if (board && is_dmi_valid(board)) { -- len = strlen(card->dmi_longname); -- snprintf(card->dmi_longname + len, -- longname_buf_size - len, -- "-%s", board); -- -- len++; -- if (len < longname_buf_size) -- cleanup_dmi_name(card->dmi_longname + len); -+ append_dmi_string(card, board); - } else if (!product) { - /* fall back to using legacy name */ - dev_warn(card->dev, "ASoC: no DMI board/product name!\n"); -@@ -1825,16 +1817,8 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) - } - - /* Add flavour to dmi long name */ -- if (flavour) { -- len = strlen(card->dmi_longname); -- snprintf(card->dmi_longname + len, -- longname_buf_size - len, -- "-%s", flavour); -- -- len++; -- if (len < longname_buf_size) -- cleanup_dmi_name(card->dmi_longname + len); -- } -+ if (flavour) -+ append_dmi_string(card, flavour); - - /* set the card long name */ - card->long_name = card->dmi_longname; --- -2.24.1 - -From f51fdb4ea9b75970096dc818c7737b6c6d611483 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 20 Nov 2019 18:44:35 +0100 -Subject: [PATCH 092/109] ASoC: DMI long name - avoid to add board name if - matches with product name - -Current code: - - LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC - -With the patch: - - LENOVO-20QE000VMC-ThinkPadX1Carbon7th - -Signed-off-by: Jaroslav Kysela -Link: https://lore.kernel.org/r/20191120174435.30920-2-perex@perex.cz -Reviewed-by: Pierre-Louis Bossart -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 39870b0dec68ed7dd814beb697e541670975c7d8) -Bugzilla: 1772498 ---- - sound/soc/soc-core.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index fbe641ef8ed7..f61e5b50a66f 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -1809,7 +1809,8 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) - - board = dmi_get_system_info(DMI_BOARD_NAME); - if (board && is_dmi_valid(board)) { -- append_dmi_string(card, board); -+ if (!product || strcasecmp(board, product)) -+ append_dmi_string(card, board); - } else if (!product) { - /* fall back to using legacy name */ - dev_warn(card->dev, "ASoC: no DMI board/product name!\n"); --- -2.24.1 - -From 2cc756fee053d7a99a683ba0636ce2dc37ef164a Mon Sep 17 00:00:00 2001 -From: Jens Verwiebe -Date: Sun, 24 Nov 2019 13:35:44 +0100 -Subject: [PATCH 093/109] ALSA: usb-audio: Fix Focusrite Scarlett 6i6 gen1 - - input handling - -The Scarlett 6i6 has no padding on rear inputs 3/4 but a gainstage. -This patch introduces this functionality as to be seen in the mac -or windows scarlett control. - -The correct address could already be found in the dump info, but was -never used. Without this patch inputs 3/4 are quite unusable else. - -Signed-off-by: Jens Verwiebe -Link: https://lore.kernel.org/r/384d65cd-5e87-91eb-9fc3-e57226f534c6@jensverwiebe.de -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit bf2aa5cadd1c7bb91af4b5b1218e643cfffb5c9a) -Bugzilla: 1772498 ---- - sound/usb/mixer_scarlett.c | 23 +++++++++++++++++++++-- - 1 file changed, 21 insertions(+), 2 deletions(-) - -diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c -index 83715fd8dfd6..9d10cbf1b5ed 100644 ---- a/sound/usb/mixer_scarlett.c -+++ b/sound/usb/mixer_scarlett.c -@@ -142,6 +142,7 @@ enum { - SCARLETT_OUTPUTS, - SCARLETT_SWITCH_IMPEDANCE, - SCARLETT_SWITCH_PAD, -+ SCARLETT_SWITCH_GAIN, - }; - - enum { -@@ -192,6 +193,15 @@ static const struct scarlett_mixer_elem_enum_info opt_pad = { - } - }; - -+static const struct scarlett_mixer_elem_enum_info opt_gain = { -+ .start = 0, -+ .len = 2, -+ .offsets = {}, -+ .names = (char const * const []){ -+ "Lo", "Hi" -+ } -+}; -+ - static const struct scarlett_mixer_elem_enum_info opt_impedance = { - .start = 0, - .len = 2, -@@ -652,8 +662,8 @@ static struct scarlett_device_info s6i6_info = { - { .num = 1, .type = SCARLETT_SWITCH_PAD, .name = NULL}, - { .num = 2, .type = SCARLETT_SWITCH_IMPEDANCE, .name = NULL}, - { .num = 2, .type = SCARLETT_SWITCH_PAD, .name = NULL}, -- { .num = 3, .type = SCARLETT_SWITCH_PAD, .name = NULL}, -- { .num = 4, .type = SCARLETT_SWITCH_PAD, .name = NULL}, -+ { .num = 3, .type = SCARLETT_SWITCH_GAIN, .name = NULL}, -+ { .num = 4, .type = SCARLETT_SWITCH_GAIN, .name = NULL}, - }, - - .matrix_mux_init = { -@@ -883,6 +893,15 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer, - if (err < 0) - return err; - break; -+ case SCARLETT_SWITCH_GAIN: -+ sprintf(mx, "Input %d Gain Switch", ctl->num); -+ err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, -+ scarlett_ctl_enum_resume, 0x01, -+ 0x08, ctl->num, USB_MIXER_S16, 1, mx, -+ &opt_gain, &elem); -+ if (err < 0) -+ return err; -+ break; - } - } - --- -2.24.1 - -From 217f33a7c631a8bfa8af1d3a3ddf448d614d2c33 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 1 Nov 2019 12:09:14 -0500 -Subject: [PATCH 094/109] ASoC: SOF: topology: fix missing NULL pointer check - -Add check to avoid possible NULL pointer dereference issue. - -This issue was reported by static analysis tools, we didn't face this -issue but we can't rule it out either as a false positive. - -Reported-by: Keqiao Zhang -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101170916.26517-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 8cd73ce7ba6381feb9df763240dee3a6d4aff1ca) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 143b8259a70a..6096731e89ce 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -150,6 +150,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w, - - /* get runtime PCM params using widget's stream name */ - spcm = snd_sof_find_spcm_name(sdev, swidget->widget->sname); -+ if (!spcm) { -+ dev_err(sdev->dev, "error: cannot find PCM for %s\n", -+ swidget->widget->name); -+ return -EINVAL; -+ } - - /* process events */ - switch (event) { --- -2.24.1 - -From 74dfe62b453b1472c56e3b2f9692394212e860e8 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Fri, 1 Nov 2019 12:09:15 -0500 -Subject: [PATCH 095/109] ASoC: SOF: Intel: hda: set L1SEN on S0ix suspend - -Set L1SEN to make sure the system can enter S0ix, and restore it on -resume. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191101170916.26517-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 16299326a0cbbc88d4d6491a8ceebbfca81064c5) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda-dsp.c | 15 +++++++++++++++ - sound/soc/sof/intel/hda.h | 3 +++ - 2 files changed, 18 insertions(+) - -diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c -index 8cd5ecc01b62..4a4d318f97ff 100644 ---- a/sound/soc/sof/intel/hda-dsp.c -+++ b/sound/soc/sof/intel/hda-dsp.c -@@ -478,9 +478,16 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) - - int hda_dsp_resume(struct snd_sof_dev *sdev) - { -+ struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; - struct pci_dev *pci = to_pci_dev(sdev->dev); - - if (sdev->s0_suspend) { -+ /* restore L1SEN bit */ -+ if (hda->l1_support_changed) -+ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, -+ HDA_VS_INTEL_EM2, -+ HDA_VS_INTEL_EM2_L1SEN, 0); -+ - /* restore and disable the system wakeup */ - pci_restore_state(pci); - disable_irq_wake(pci->irq); -@@ -518,11 +525,19 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev) - - int hda_dsp_suspend(struct snd_sof_dev *sdev) - { -+ struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; - struct hdac_bus *bus = sof_to_bus(sdev); - struct pci_dev *pci = to_pci_dev(sdev->dev); - int ret; - - if (sdev->s0_suspend) { -+ /* enable L1SEN to make sure the system can enter S0Ix */ -+ hda->l1_support_changed = -+ snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, -+ HDA_VS_INTEL_EM2, -+ HDA_VS_INTEL_EM2_L1SEN, -+ HDA_VS_INTEL_EM2_L1SEN); -+ - /* enable the system waking up via IPC IRQ */ - enable_irq_wake(pci->irq); - pci_save_state(pci); -diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h -index 16376f55e420..50e037f2973f 100644 ---- a/sound/soc/sof/intel/hda.h -+++ b/sound/soc/sof/intel/hda.h -@@ -408,6 +408,9 @@ struct sof_intel_hda_dev { - - int irq; - -+ /* PM related */ -+ bool l1_support_changed;/* during suspend, is L1SEN changed or not */ -+ - /* DMIC device */ - struct platform_device *dmic_dev; - }; --- -2.24.1 - -From 9298cb2df525d2f7e42fe14a257a2ae758302559 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Mon, 11 Nov 2019 16:29:01 -0600 -Subject: [PATCH 096/109] ASoC: SOF: Intel: hda: use fallback for firmware name - -We have platforms such as CFL with no known I2S codec being used, and -the ACPI tables are currently empty, so fall-back to using the -firmware filename used in nocodec mode - -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111222901.19892-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 0af237d51a4e734db959a158185f79019f022f59) -Bugzilla: 1772498 ---- - sound/soc/sof/intel/hda.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c -index ff3fa8670fd8..78c3de74c401 100644 ---- a/sound/soc/sof/intel/hda.c -+++ b/sound/soc/sof/intel/hda.c -@@ -410,9 +410,16 @@ static int hda_init_caps(struct snd_sof_dev *sdev) - pdata->tplg_filename = - hda_mach->sof_tplg_filename; - -- /* firmware: pick the first in machine list */ -+ /* -+ * firmware: pick the first in machine list, -+ * or use nocodec firmware name if list is empty -+ */ - mach = pdata->desc->machines; -- pdata->fw_filename = mach->sof_fw_filename; -+ if (mach->id[0]) -+ pdata->fw_filename = mach->sof_fw_filename; -+ else -+ pdata->fw_filename = -+ pdata->desc->nocodec_fw_filename; - - dev_info(bus->dev, "using HDA machine driver %s now\n", - hda_mach->drv_name); --- -2.24.1 - -From d4d3a9762c6ef736427a427f40dac50f8e17f625 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Mon, 11 Nov 2019 16:33:40 -0600 -Subject: [PATCH 097/109] ASoC: SOF: PM: add state machine to comments - -Add Audio DSP state machine with comments. Note that the -'D0<-->runtime D0I3' part is not implemented yet. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111223343.19986-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 74b4dd04b19cc03e1cc369d9c371cf4206367df4) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index 4f8db8367d0a..420615dff5ae 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -451,6 +451,38 @@ int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, - } - EXPORT_SYMBOL(snd_sof_set_d0_substate); - -+/* -+ * Audio DSP states may transform as below:- -+ * -+ * D0I3 compatible stream -+ * Runtime +---------------------+ opened only, timeout -+ * suspend | +--------------------+ -+ * +------------+ D0(active) | | -+ * | | <---------------+ | -+ * | +--------> | | | -+ * | |Runtime +--^--+---------^--+--+ The last | | -+ * | |resume | | | | opened D0I3 | | -+ * | | | | | | compatible | | -+ * | | resume| | | | stream closed | | -+ * | | from | | D3 | | | | -+ * | | D3 | |suspend | | d0i3 | | -+ * | | | | | |suspend | | -+ * | | | | | | | | -+ * | | | | | | | | -+ * +-v---+-----------+--v-------+ | | +------+----v----+ -+ * | | | +-----------> | -+ * | D3 (suspended) | | | D0I3 +-----+ -+ * | | +--------------+ | | -+ * | | resume from | | | -+ * +-------------------^--------+ d0i3 suspend +----------------+ | -+ * | | -+ * | D3 suspend | -+ * +------------------------------------------------+ -+ * -+ * d0i3_suspend = s0_suspend && D0I3 stream opened, -+ * D3 suspend = !d0i3_suspend, -+ */ -+ - int snd_sof_resume(struct device *dev) - { - struct snd_sof_dev *sdev = dev_get_drvdata(dev); --- -2.24.1 - -From 2ce44c4ffc5b1ee7b84d53f5d18eefe35a06092d Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Mon, 11 Nov 2019 16:33:41 -0600 -Subject: [PATCH 098/109] ASoC: SOF: PM: add check before setting d0_substate - -Add check before seeting d0_substate and return success if Audio DSP is -already in the target substate. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111223343.19986-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 58a972efd21bb5adadd97f2546693ec64bfc99b9) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index 420615dff5ae..ff966d004692 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -439,6 +439,9 @@ int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, - { - int ret; - -+ if (sdev->d0_substate == d0_substate) -+ return 0; -+ - /* do platform specific set_state */ - ret = snd_sof_dsp_set_power_state(sdev, d0_substate); - if (ret < 0) --- -2.24.1 - -From 2dbd8810f4d48ed09aa2be1e53f50fac7045ebc2 Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Mon, 11 Nov 2019 16:33:42 -0600 -Subject: [PATCH 099/109] ASoC: SOF: add helper to check if we should enter - d0i3 suspend - -Add helper to check if the DSP should be put in D0i3. This function -returns true if a stream has ignored the SUSPEND trigger to keep the -pipelines running in the DSP. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111223343.19986-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit a77e5d573f847d2f984c38eb711351326bc55258) -Bugzilla: 1772498 ---- - sound/soc/sof/core.c | 13 +++++++++++++ - sound/soc/sof/sof-priv.h | 2 ++ - 2 files changed, 15 insertions(+) - -diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c -index d6b827de26d4..a06a54f423dd 100644 ---- a/sound/soc/sof/core.c -+++ b/sound/soc/sof/core.c -@@ -132,6 +132,19 @@ struct snd_sof_dai *snd_sof_find_dai(struct snd_sof_dev *sdev, - return NULL; - } - -+bool snd_sof_dsp_d0i3_on_suspend(struct snd_sof_dev *sdev) -+{ -+ struct snd_sof_pcm *spcm; -+ -+ list_for_each_entry(spcm, &sdev->pcm_list, list) { -+ if (spcm->stream[SNDRV_PCM_STREAM_PLAYBACK].suspend_ignored || -+ spcm->stream[SNDRV_PCM_STREAM_CAPTURE].suspend_ignored) -+ return true; -+ } -+ -+ return false; -+} -+ - /* - * FW Panic/fault handling. - */ -diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h -index 9bded2e48fba..59cc711e99ff 100644 ---- a/sound/soc/sof/sof-priv.h -+++ b/sound/soc/sof/sof-priv.h -@@ -562,6 +562,8 @@ struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_sof_dev *sdev, - return NULL; - } - -+bool snd_sof_dsp_d0i3_on_suspend(struct snd_sof_dev *sdev); -+ - struct snd_sof_pcm *snd_sof_find_spcm_name(struct snd_sof_dev *sdev, - const char *name); - struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev, --- -2.24.1 - -From 156227215cacd87bfdeaa27ead855ff2310c1a9d Mon Sep 17 00:00:00 2001 -From: Keyon Jie -Date: Mon, 11 Nov 2019 16:33:43 -0600 -Subject: [PATCH 100/109] ASoC: SOF: PM: only suspend to D0I3 when needed - -We should suspend audio to D3 by default, for the sake of power saving, -change the condition of D0I3 suspending here to that when there is -stream with suspend_ignored specified. - -Signed-off-by: Keyon Jie -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111223343.19986-5-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 5e35d5f4224adb24c2bfa814b9fb562050aba3ea) -Bugzilla: 1772498 ---- - sound/soc/sof/pm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c -index ff966d004692..bc09cb5f458b 100644 ---- a/sound/soc/sof/pm.c -+++ b/sound/soc/sof/pm.c -@@ -491,7 +491,7 @@ int snd_sof_resume(struct device *dev) - struct snd_sof_dev *sdev = dev_get_drvdata(dev); - int ret; - -- if (sdev->s0_suspend) { -+ if (snd_sof_dsp_d0i3_on_suspend(sdev)) { - /* resume from D0I3 */ - dev_dbg(sdev->dev, "DSP will exit from D0i3...\n"); - ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I0); -@@ -520,7 +520,7 @@ int snd_sof_suspend(struct device *dev) - struct snd_sof_dev *sdev = dev_get_drvdata(dev); - int ret; - -- if (sdev->s0_suspend) { -+ if (snd_sof_dsp_d0i3_on_suspend(sdev)) { - /* suspend to D0i3 */ - dev_dbg(sdev->dev, "DSP is trying to enter D0i3...\n"); - ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I3); --- -2.24.1 - -From 39aa2d2215c31b1b9f6c3e77d00702c9dfa5e66d Mon Sep 17 00:00:00 2001 -From: Dragos Tarcatu -Date: Mon, 11 Nov 2019 16:20:38 -0600 -Subject: [PATCH 101/109] ASoC: SOF: topology: free kcontrol memory on error - -The volume and bytes kcontrols are currently not freeing their -memory on initialization failures. When an error occurs, all the -widgets loaded so far are unloaded via sof_widget_unload(). -But this only happens for the widgets that got successfully loaded. - -Fix that by kfree()-ing the allocated memory on load error. - -Fixes: 311ce4fe7637d ("ASoC: SOF: Add support for loading topologies") -Reviewed-by: Paul Olaru -Reviewed-by: Ranjani Sridharan -Signed-off-by: Dragos Tarcatu -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111222039.19651-1-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 1b4efdaf6d6053c8944cee0edba0969dc1be7d4b) -Bugzilla: 1772498 ---- - sound/soc/sof/topology.c | 67 +++++++++++++++++++++++++++++----------- - 1 file changed, 49 insertions(+), 18 deletions(-) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index 6096731e89ce..d82ab981e840 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -942,18 +942,22 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - struct sof_ipc_ctrl_data *cdata; - int tlv[TLV_ITEMS]; - unsigned int i; -- int ret; -+ int ret = 0; - - /* validate topology data */ -- if (le32_to_cpu(mc->num_channels) > SND_SOC_TPLG_MAX_CHAN) -- return -EINVAL; -+ if (le32_to_cpu(mc->num_channels) > SND_SOC_TPLG_MAX_CHAN) { -+ ret = -EINVAL; -+ goto out; -+ } - - /* init the volume get/put data */ - scontrol->size = struct_size(scontrol->control_data, chanv, - le32_to_cpu(mc->num_channels)); - scontrol->control_data = kzalloc(scontrol->size, GFP_KERNEL); -- if (!scontrol->control_data) -- return -ENOMEM; -+ if (!scontrol->control_data) { -+ ret = -ENOMEM; -+ goto out; -+ } - - scontrol->comp_id = sdev->next_comp_id; - scontrol->min_volume_step = le32_to_cpu(mc->min); -@@ -963,7 +967,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - /* set cmd for mixer control */ - if (le32_to_cpu(mc->max) == 1) { - scontrol->cmd = SOF_CTRL_CMD_SWITCH; -- goto out; -+ goto skip; - } - - scontrol->cmd = SOF_CTRL_CMD_VOLUME; -@@ -971,14 +975,15 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - /* extract tlv data */ - if (get_tlv_data(kc->tlv.p, tlv) < 0) { - dev_err(sdev->dev, "error: invalid TLV data\n"); -- return -EINVAL; -+ ret = -EINVAL; -+ goto out_free; - } - - /* set up volume table */ - ret = set_up_volume_table(scontrol, tlv, le32_to_cpu(mc->max) + 1); - if (ret < 0) { - dev_err(sdev->dev, "error: setting up volume table\n"); -- return ret; -+ goto out_free; - } - - /* set default volume values to 0dB in control */ -@@ -988,7 +993,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - cdata->chanv[i].value = VOL_ZERO_DB; - } - --out: -+skip: - /* set up possible led control from mixer private data */ - ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, - ARRAY_SIZE(led_tokens), mc->priv.array, -@@ -996,13 +1001,21 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, - if (ret != 0) { - dev_err(sdev->dev, "error: parse led tokens failed %d\n", - le32_to_cpu(mc->priv.size)); -- return ret; -+ goto out_free_table; - } - - dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", - scontrol->comp_id, scontrol->num_channels); - -- return 0; -+ return ret; -+ -+out_free_table: -+ if (le32_to_cpu(mc->max) > 1) -+ kfree(scontrol->volume_table); -+out_free: -+ kfree(scontrol->control_data); -+out: -+ return ret; - } - - static int sof_control_load_enum(struct snd_soc_component *scomp, -@@ -1047,6 +1060,7 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, - container_of(hdr, struct snd_soc_tplg_bytes_control, hdr); - struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value; - int max_size = sbe->max; -+ int ret = 0; - - /* init the get/put bytes data */ - scontrol->size = sizeof(struct sof_ipc_ctrl_data) + -@@ -1055,13 +1069,16 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, - if (scontrol->size > max_size) { - dev_err(sdev->dev, "err: bytes data size %d exceeds max %d.\n", - scontrol->size, max_size); -- return -EINVAL; -+ ret = -EINVAL; -+ goto out; - } - - scontrol->control_data = kzalloc(max_size, GFP_KERNEL); - cdata = scontrol->control_data; -- if (!scontrol->control_data) -- return -ENOMEM; -+ if (!scontrol->control_data) { -+ ret = -ENOMEM; -+ goto out; -+ } - - scontrol->comp_id = sdev->next_comp_id; - scontrol->cmd = SOF_CTRL_CMD_BINARY; -@@ -1076,23 +1093,32 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp, - if (cdata->data->magic != SOF_ABI_MAGIC) { - dev_err(sdev->dev, "error: Wrong ABI magic 0x%08x.\n", - cdata->data->magic); -- return -EINVAL; -+ ret = -EINVAL; -+ goto out_free; - } - if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, - cdata->data->abi)) { - dev_err(sdev->dev, - "error: Incompatible ABI version 0x%08x.\n", - cdata->data->abi); -- return -EINVAL; -+ ret = -EINVAL; -+ goto out_free; - } - if (cdata->data->size + sizeof(const struct sof_abi_hdr) != - le32_to_cpu(control->priv.size)) { - dev_err(sdev->dev, - "error: Conflict in bytes vs. priv size.\n"); -- return -EINVAL; -+ ret = -EINVAL; -+ goto out_free; - } - } -- return 0; -+ -+ return ret; -+ -+out_free: -+ kfree(scontrol->control_data); -+out: -+ return ret; - } - - /* external kcontrol init - used for any driver specific init */ -@@ -1150,6 +1176,11 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, - return 0; - } - -+ if (ret < 0) { -+ kfree(scontrol); -+ return ret; -+ } -+ - dobj->private = scontrol; - list_add(&scontrol->list, &sdev->kcontrol_list); - return ret; --- -2.24.1 - -From 88ecf253337ee8d8f0418e68af64d3dba6df27c1 Mon Sep 17 00:00:00 2001 -From: Liam Girdwood -Date: Mon, 11 Nov 2019 16:29:00 -0600 -Subject: [PATCH 102/109] ASoC: SOF: Intel: Fix CFL and CML FW nocodec binary - names. - -The manifest information is different between CNL, CML and CFL platforms -hence we need to load different files. - -Signed-off-by: Liam Girdwood -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111222901.19892-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 653c28afa76b45c570370c3c3a89975c68c5fc8e) -Bugzilla: 1772498 ---- - sound/soc/sof/sof-pci-dev.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c -index 3b58b91e7b9e..bbeffd932de7 100644 ---- a/sound/soc/sof/sof-pci-dev.c -+++ b/sound/soc/sof/sof-pci-dev.c -@@ -120,7 +120,7 @@ static const struct sof_dev_desc cnl_desc = { - - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COFFEELAKE) - static const struct sof_dev_desc cfl_desc = { -- .machines = snd_soc_acpi_intel_cnl_machines, -+ .machines = snd_soc_acpi_intel_cfl_machines, - .resindex_lpe_base = 0, - .resindex_pcicfg_base = -1, - .resindex_imr_base = -1, -@@ -129,7 +129,7 @@ static const struct sof_dev_desc cfl_desc = { - .chip_info = &cnl_chip_info, - .default_fw_path = "intel/sof", - .default_tplg_path = "intel/sof-tplg", -- .nocodec_fw_filename = "sof-cnl.ri", -+ .nocodec_fw_filename = "sof-cfl.ri", - .nocodec_tplg_filename = "sof-cnl-nocodec.tplg", - .ops = &sof_cnl_ops, - .arch_ops = &sof_xtensa_arch_ops -@@ -140,7 +140,7 @@ static const struct sof_dev_desc cfl_desc = { - IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) - - static const struct sof_dev_desc cml_desc = { -- .machines = snd_soc_acpi_intel_cnl_machines, -+ .machines = snd_soc_acpi_intel_cml_machines, - .resindex_lpe_base = 0, - .resindex_pcicfg_base = -1, - .resindex_imr_base = -1, -@@ -149,7 +149,7 @@ static const struct sof_dev_desc cml_desc = { - .chip_info = &cnl_chip_info, - .default_fw_path = "intel/sof", - .default_tplg_path = "intel/sof-tplg", -- .nocodec_fw_filename = "sof-cnl.ri", -+ .nocodec_fw_filename = "sof-cml.ri", - .nocodec_tplg_filename = "sof-cnl-nocodec.tplg", - .ops = &sof_cnl_ops, - .arch_ops = &sof_xtensa_arch_ops --- -2.24.1 - -From 64f7bbb57783645861b9d05d5f54c590e70f58ab Mon Sep 17 00:00:00 2001 -From: Krzysztof Kozlowski -Date: Wed, 20 Nov 2019 21:32:52 +0800 -Subject: [PATCH 103/109] ASoC: Fix Kconfig indentation - -Adjust indentation from spaces to tab (+optional two spaces) as in -coding style with command like: - $ sed -e 's/^ /\t/' -i */Kconfig - -Signed-off-by: Krzysztof Kozlowski -Acked-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191120133252.6365-1-krzk@kernel.org -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 3efd72330543da44e82e9371dfb639802c886f6c) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 24 ++++++++++++------------ - sound/soc/sof/intel/Kconfig | 10 +++++----- - 2 files changed, 17 insertions(+), 17 deletions(-) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index 2702aefee775..ef20316e83d1 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -441,18 +441,18 @@ config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH - If unsure select "N". - - config SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH -- tristate "CML with RT1011 and RT5682 in I2S Mode" -- depends on I2C && ACPI -- depends on MFD_INTEL_LPSS || COMPILE_TEST -- select SND_SOC_RT1011 -- select SND_SOC_RT5682 -- select SND_SOC_DMIC -- select SND_SOC_HDAC_HDMI -- help -- This adds support for ASoC machine driver for SOF platform with -- RT1011 + RT5682 I2S codec. -- Say Y if you have such a device. -- If unsure select "N". -+ tristate "CML with RT1011 and RT5682 in I2S Mode" -+ depends on I2C && ACPI -+ depends on MFD_INTEL_LPSS || COMPILE_TEST -+ select SND_SOC_RT1011 -+ select SND_SOC_RT5682 -+ select SND_SOC_DMIC -+ select SND_SOC_HDAC_HDMI -+ help -+ This adds support for ASoC machine driver for SOF platform with -+ RT1011 + RT5682 I2S codec. -+ Say Y if you have such a device. -+ If unsure select "N". - - endif ## SND_SOC_SOF_COMETLAKE_LP && SND_SOC_SOF_HDA_LINK - -diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig -index c263a8feff0a..0db92d81ea85 100644 ---- a/sound/soc/sof/intel/Kconfig -+++ b/sound/soc/sof/intel/Kconfig -@@ -264,16 +264,16 @@ config SND_SOC_SOF_ELKHARTLAKE - config SND_SOC_SOF_JASPERLAKE_SUPPORT - bool "SOF support for JasperLake" - help -- This adds support for Sound Open Firmware for Intel(R) platforms -- using the JasperLake processors. -- Say Y if you have such a device. -- If unsure select "N". -+ This adds support for Sound Open Firmware for Intel(R) platforms -+ using the JasperLake processors. -+ Say Y if you have such a device. -+ If unsure select "N". - - config SND_SOC_SOF_JASPERLAKE - tristate - select SND_SOC_SOF_HDA_COMMON - help -- This option is not user-selectable but automagically handled by -+ This option is not user-selectable but automagically handled by - 'select' statements at a higher level - - config SND_SOC_SOF_HDA_COMMON --- -2.24.1 - -From 07dfab3db6e4005c03903fe59c272da69678c40a Mon Sep 17 00:00:00 2001 -From: Ben Zhang -Date: Tue, 5 Nov 2019 17:13:27 -0800 -Subject: [PATCH 104/109] ASoC: bdw-rt5677: Add a DAI link for rt5677 SPI PCM - device - -This link is needed for the RT5677 DSP to do hotwording - -Signed-off-by: Ben Zhang -Signed-off-by: Curtis Malainey -Link: https://lore.kernel.org/r/20191106011335.223061-3-cujomalainey@chromium.org -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 157b006f6be46be833b2941856b86e0a9d8bfb0e) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/bdw-rt5677.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c -index 4a4d3353e26d..eeb9a11e4e14 100644 ---- a/sound/soc/intel/boards/bdw-rt5677.c -+++ b/sound/soc/intel/boards/bdw-rt5677.c -@@ -74,6 +74,7 @@ static const struct snd_soc_dapm_route bdw_rt5677_map[] = { - /* CODEC BE connections */ - {"SSP0 CODEC IN", NULL, "AIF1 Capture"}, - {"AIF1 Playback", NULL, "SSP0 CODEC OUT"}, -+ {"DSP Capture", NULL, "DSP Buffer"}, - }; - - static const struct snd_kcontrol_new bdw_rt5677_controls[] = { -@@ -258,6 +259,12 @@ SND_SOC_DAILINK_DEF(platform, - SND_SOC_DAILINK_DEF(be, - DAILINK_COMP_ARRAY(COMP_CODEC("i2c-RT5677CE:00", "rt5677-aif1"))); - -+/* Wake on voice interface */ -+SND_SOC_DAILINK_DEFS(dsp, -+ DAILINK_COMP_ARRAY(COMP_CPU("spi-RT5677AA:00")), -+ DAILINK_COMP_ARRAY(COMP_CODEC("i2c-RT5677CE:00", "rt5677-dspbuffer")), -+ DAILINK_COMP_ARRAY(COMP_PLATFORM("spi-RT5677AA:00"))); -+ - static struct snd_soc_dai_link bdw_rt5677_dais[] = { - /* Front End DAI links */ - { -@@ -276,6 +283,13 @@ static struct snd_soc_dai_link bdw_rt5677_dais[] = { - SND_SOC_DAILINK_REG(fe, dummy, platform), - }, - -+ /* Non-DPCM links */ -+ { -+ .name = "Codec DSP", -+ .stream_name = "Wake on Voice", -+ SND_SOC_DAILINK_REG(dsp), -+ }, -+ - /* Back End DAI links */ - { - /* SSP0 - Codec */ --- -2.24.1 - -From a21e2d41236808ea4fb355aaff8bb4012d539779 Mon Sep 17 00:00:00 2001 -From: Curtis Malainey -Date: Tue, 5 Nov 2019 17:13:34 -0800 -Subject: [PATCH 105/109] ASoC: bdw-rt5677: Turn on MCLK1 for DSP via DAPM - -The RT5677 DSP needs the I2S MCLK1 to run its DSP. Add a dapm route to -SSP0 CODEC IN so the clock is turned on automatically when the DSP is -turned on. - -Signed-off-by: Curtis Malainey -Link: https://lore.kernel.org/r/20191106011335.223061-10-cujomalainey@chromium.org -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 55229597a94531726878229ccfcd3fe4ec572dc3) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/bdw-rt5677.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c -index eeb9a11e4e14..b2475e3eff7b 100644 ---- a/sound/soc/intel/boards/bdw-rt5677.c -+++ b/sound/soc/intel/boards/bdw-rt5677.c -@@ -75,6 +75,10 @@ static const struct snd_soc_dapm_route bdw_rt5677_map[] = { - {"SSP0 CODEC IN", NULL, "AIF1 Capture"}, - {"AIF1 Playback", NULL, "SSP0 CODEC OUT"}, - {"DSP Capture", NULL, "DSP Buffer"}, -+ -+ /* DSP Clock Connections */ -+ { "DSP Buffer", NULL, "SSP0 CODEC IN" }, -+ { "SSP0 CODEC IN", NULL, "DSPTX" }, - }; - - static const struct snd_kcontrol_new bdw_rt5677_controls[] = { --- -2.24.1 - -From 71fffb28eefd175b6b84026a2d0f5fb79996f84b Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Mon, 11 Nov 2019 16:28:59 -0600 -Subject: [PATCH 106/109] ASoC: Intel: acpi-match: split CNL tables in three - -Due to firmware manifest/signature differences, we have to use -different firmware names, so split CNL machine table in three (CNL, -CFL, CML). - -The CFL table is currently empty since all known platforms use -HDaudio, but let's plan ahead. - -Reviewed-by: Ranjani Sridharan -Signed-off-by: Pierre-Louis Bossart -Link: https://lore.kernel.org/r/20191111222901.19892-2-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 1f24d93c4f4ec0bb0b73c5b020060aa2d9faa756) -Bugzilla: 1772498 ---- - include/sound/soc-acpi-intel-match.h | 2 + - sound/soc/intel/common/Makefile | 3 +- - .../intel/common/soc-acpi-intel-cfl-match.c | 18 ++++++ - .../intel/common/soc-acpi-intel-cml-match.c | 56 +++++++++++++++++++ - .../intel/common/soc-acpi-intel-cnl-match.c | 38 ------------- - 5 files changed, 78 insertions(+), 39 deletions(-) - create mode 100644 sound/soc/intel/common/soc-acpi-intel-cfl-match.c - create mode 100644 sound/soc/intel/common/soc-acpi-intel-cml-match.c - -diff --git a/include/sound/soc-acpi-intel-match.h b/include/sound/soc-acpi-intel-match.h -index 4e44782862df..20c0bee3b959 100644 ---- a/include/sound/soc-acpi-intel-match.h -+++ b/include/sound/soc-acpi-intel-match.h -@@ -24,6 +24,8 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[]; -+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_machines[]; -+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[]; - extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ehl_machines[]; -diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile -index eafe95ead49b..bd352878f89a 100644 ---- a/sound/soc/intel/common/Makefile -+++ b/sound/soc/intel/common/Makefile -@@ -7,7 +7,8 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m - soc-acpi-intel-hsw-bdw-match.o \ - soc-acpi-intel-skl-match.o soc-acpi-intel-kbl-match.o \ - soc-acpi-intel-bxt-match.o soc-acpi-intel-glk-match.o \ -- soc-acpi-intel-cnl-match.o soc-acpi-intel-icl-match.o \ -+ soc-acpi-intel-cnl-match.o soc-acpi-intel-cfl-match.o \ -+ soc-acpi-intel-cml-match.o soc-acpi-intel-icl-match.o \ - soc-acpi-intel-tgl-match.o soc-acpi-intel-ehl-match.o \ - soc-acpi-intel-jsl-match.o \ - soc-acpi-intel-hda-match.o -diff --git a/sound/soc/intel/common/soc-acpi-intel-cfl-match.c b/sound/soc/intel/common/soc-acpi-intel-cfl-match.c -new file mode 100644 -index 000000000000..d6fd2026d0b8 ---- /dev/null -+++ b/sound/soc/intel/common/soc-acpi-intel-cfl-match.c -@@ -0,0 +1,18 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * soc-apci-intel-cfl-match.c - tables and support for CFL ACPI enumeration. -+ * -+ * Copyright (c) 2019, Intel Corporation. -+ * -+ */ -+ -+#include -+#include -+ -+struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_machines[] = { -+ {}, -+}; -+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cfl_machines); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Intel Common ACPI Match module"); -diff --git a/sound/soc/intel/common/soc-acpi-intel-cml-match.c b/sound/soc/intel/common/soc-acpi-intel-cml-match.c -new file mode 100644 -index 000000000000..5d08ae066738 ---- /dev/null -+++ b/sound/soc/intel/common/soc-acpi-intel-cml-match.c -@@ -0,0 +1,56 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * soc-acpi-intel-cml-match.c - tables and support for CML ACPI enumeration. -+ * -+ * Copyright (c) 2019, Intel Corporation. -+ * -+ */ -+ -+#include -+#include -+ -+static struct snd_soc_acpi_codecs cml_codecs = { -+ .num_codecs = 1, -+ .codecs = {"10EC5682"} -+}; -+ -+static struct snd_soc_acpi_codecs cml_spk_codecs = { -+ .num_codecs = 1, -+ .codecs = {"MX98357A"} -+}; -+ -+struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = { -+ { -+ .id = "DLGS7219", -+ .drv_name = "cml_da7219_max98357a", -+ .quirk_data = &cml_spk_codecs, -+ .sof_fw_filename = "sof-cml.ri", -+ .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg", -+ }, -+ { -+ .id = "MX98357A", -+ .drv_name = "sof_rt5682", -+ .quirk_data = &cml_codecs, -+ .sof_fw_filename = "sof-cml.ri", -+ .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg", -+ }, -+ { -+ .id = "10EC1011", -+ .drv_name = "cml_rt1011_rt5682", -+ .quirk_data = &cml_codecs, -+ .sof_fw_filename = "sof-cml.ri", -+ .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg", -+ }, -+ { -+ .id = "10EC5682", -+ .drv_name = "sof_rt5682", -+ .sof_fw_filename = "sof-cml.ri", -+ .sof_tplg_filename = "sof-cml-rt5682.tplg", -+ }, -+ -+ {}, -+}; -+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Intel Common ACPI Match module"); -diff --git a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c -index 16d0bae8b316..27588841c8b0 100644 ---- a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c -+++ b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c -@@ -14,16 +14,6 @@ static struct skl_machine_pdata cnl_pdata = { - .use_tplg_pcm = true, - }; - --static struct snd_soc_acpi_codecs cml_codecs = { -- .num_codecs = 1, -- .codecs = {"10EC5682"} --}; -- --static struct snd_soc_acpi_codecs cml_spk_codecs = { -- .num_codecs = 1, -- .codecs = {"MX98357A"} --}; -- - struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = { - { - .id = "INT34C2", -@@ -33,34 +23,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = { - .sof_fw_filename = "sof-cnl.ri", - .sof_tplg_filename = "sof-cnl-rt274.tplg", - }, -- { -- .id = "DLGS7219", -- .drv_name = "cml_da7219_max98357a", -- .quirk_data = &cml_spk_codecs, -- .sof_fw_filename = "sof-cnl.ri", -- .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg", -- }, -- { -- .id = "MX98357A", -- .drv_name = "sof_rt5682", -- .quirk_data = &cml_codecs, -- .sof_fw_filename = "sof-cnl.ri", -- .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg", -- }, -- { -- .id = "10EC1011", -- .drv_name = "cml_rt1011_rt5682", -- .quirk_data = &cml_codecs, -- .sof_fw_filename = "sof-cnl.ri", -- .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg", -- }, -- { -- .id = "10EC5682", -- .drv_name = "sof_rt5682", -- .sof_fw_filename = "sof-cnl.ri", -- .sof_tplg_filename = "sof-cml-rt5682.tplg", -- }, -- - {}, - }; - EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cnl_machines); --- -2.24.1 - -From b623e68eabe32651fb346bb3f1d89f3705f051df Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 22 Nov 2019 14:26:24 +0100 -Subject: [PATCH 107/109] ALSA: hda/hdmi - Clear codec->relaxed_resume flag at - unbinding - -The HDMI codec may leave codec->relaxed_resume flag set even after -unbinding. Clear it unconditionally. - -It's very unlikely that this actually matters in the real use case, -so just a fix for consistency. - -Fixes: ade49db337a9 ("ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI") -Link: https://lore.kernel.org/r/20191122132624.5482-1-tiwai@suse.de -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 10a9594563415855bd99678ea4f91dea792e5499) -Bugzilla: 1772498 ---- - sound/pci/hda/patch_hdmi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index 2044bbb830f9..1242fba0da89 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -2313,8 +2313,8 @@ static void generic_hdmi_free(struct hda_codec *codec) - snd_hdac_acomp_exit(&codec->bus->core); - } else if (codec_has_acomp(codec)) { - snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); -- codec->relaxed_resume = 0; - } -+ codec->relaxed_resume = 0; - - for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { - struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); --- -2.24.1 - -From d0b0fa3f390ed93d017767c2b562ad587ecf62d7 Mon Sep 17 00:00:00 2001 -From: Alex Deucher -Date: Fri, 22 Nov 2019 16:43:50 -0500 -Subject: [PATCH 108/109] ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD - -Only enable the vga_switcheroo logic on systems with the -ATPX ACPI method. This logic is not needed for asics -that are not part of a PX (PowerXpress)/HG (Hybrid Graphics) -platform. - -Reviewed-by: Takashi Iwai -Acked-by: Evan Quan -Signed-off-by: Alex Deucher -Link: https://lore.kernel.org/r/20191122214353.582899-2-alexander.deucher@amd.com -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 586bc4aab878efcf672536f0cdec3d04b6990c94) -Bugzilla: 1772498 ---- - sound/pci/hda/hda_intel.c | 45 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 45 insertions(+) - -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index e2c08517a24c..1803475c6cd2 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - - #ifdef CONFIG_X86 - /* for snoop control */ -@@ -1402,6 +1403,34 @@ static int azx_dev_free(struct snd_device *device) - } - - #ifdef SUPPORT_VGA_SWITCHEROO -+#ifdef CONFIG_ACPI -+/* ATPX is in the integrated GPU's namespace */ -+static bool atpx_present(void) -+{ -+ struct pci_dev *pdev = NULL; -+ acpi_handle dhandle, atpx_handle; -+ acpi_status status; -+ -+ while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) { -+ dhandle = ACPI_HANDLE(&pdev->dev); -+ if (dhandle) { -+ status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); -+ if (!ACPI_FAILURE(status)) { -+ pci_dev_put(pdev); -+ return true; -+ } -+ } -+ pci_dev_put(pdev); -+ } -+ return false; -+} -+#else -+static bool atpx_present(void) -+{ -+ return false; -+} -+#endif -+ - /* - * Check of disabled HDMI controller by vga_switcheroo - */ -@@ -1413,6 +1442,22 @@ static struct pci_dev *get_bound_vga(struct pci_dev *pci) - switch (pci->vendor) { - case PCI_VENDOR_ID_ATI: - case PCI_VENDOR_ID_AMD: -+ if (pci->devfn == 1) { -+ p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), -+ pci->bus->number, 0); -+ if (p) { -+ /* ATPX is in the integrated GPU's ACPI namespace -+ * rather than the dGPU's namespace. However, -+ * the dGPU is the one who is involved in -+ * vgaswitcheroo. -+ */ -+ if (((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) && -+ atpx_present()) -+ return p; -+ pci_dev_put(p); -+ } -+ } -+ break; - case PCI_VENDOR_ID_NVIDIA: - if (pci->devfn == 1) { - p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), --- -2.24.1 - -From 424e3c917da439f446b6398cc9e053890619eac9 Mon Sep 17 00:00:00 2001 -From: Alex Deucher -Date: Fri, 22 Nov 2019 16:43:51 -0500 -Subject: [PATCH 109/109] ALSA: hda/hdmi - Add new pci ids for AMD GPU display - audio - -These are needed so we can enable runtime pm in a subsequent -patch. - -Reviewed-by: Takashi Iwai -Signed-off-by: Alex Deucher -Link: https://lore.kernel.org/r/20191122214353.582899-3-alexander.deucher@amd.com -Signed-off-by: Takashi Iwai - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 8d68a87244a812323ce3f7d5022f9deda9db54b5) -Bugzilla: 1772498 ---- - sound/pci/hda/hda_intel.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 1803475c6cd2..91c76ef381c6 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -2604,6 +2604,20 @@ static const struct pci_device_id azx_ids[] = { - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, - { PCI_DEVICE(0x1002, 0xaaf0), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xaaf8), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xab00), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xab08), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xab10), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xab18), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xab20), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, -+ { PCI_DEVICE(0x1002, 0xab38), -+ .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, - /* VIA VT8251/VT8237A */ - { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA }, - /* VIA GFX VT7122/VX900 */ --- -2.24.1 - diff --git a/SOURCES/alsa-5.6.patch b/SOURCES/alsa-5.6.patch deleted file mode 100644 index b5436a7..0000000 --- a/SOURCES/alsa-5.6.patch +++ /dev/null @@ -1,344 +0,0 @@ -From 89be5f69889f7e9aeab05279869bba3e9e0d2002 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Dec 2019 15:15:45 -0600 -Subject: [PATCH 2/4] ASoC: Intel - use control components to describe card - config - -Use the control interface (field 'components' in the info structure) -to pass the I/O configuration details. The goal is to replace -the card long name with this. - -Signed-off-by: Jaroslav Kysela -Signed-off-by: Pierre-Louis Bossart -Cc: Mark Brown -Link: https://lore.kernel.org/r/20191204211556.12671-3-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit 0d5c8187562848b619a35f2ffc5e18ce703e9f3d) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/bytcht_es8316.c | 9 ++++++++- - sound/soc/intel/boards/bytcr_rt5640.c | 6 ++++++ - sound/soc/intel/boards/bytcr_rt5651.c | 18 +++++++++++------- - 3 files changed, 25 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c -index 46612331f5ea..efa33f30dcac 100644 ---- a/sound/soc/intel/boards/bytcht_es8316.c -+++ b/sound/soc/intel/boards/bytcht_es8316.c -@@ -361,6 +361,7 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = { - /* SoC card */ - static char codec_name[SND_ACPI_I2C_ID_LEN]; - static char long_name[50]; /* = "bytcht-es8316-*-spk-*-mic" */ -+static char components_string[32]; /* = "cfg-spk:* cfg-mic:* */ - - static int byt_cht_es8316_suspend(struct snd_soc_card *card) - { -@@ -572,11 +573,17 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) - } - } - -- /* register the soc card */ -+ snprintf(components_string, sizeof(components_string), -+ "cfg-spk:%s cfg-mic:%s", -+ (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "1" : "2", -+ mic_name[BYT_CHT_ES8316_MAP(quirk)]); -+ byt_cht_es8316_card.components = components_string; - snprintf(long_name, sizeof(long_name), "bytcht-es8316-%s-spk-%s-mic", - (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo", - mic_name[BYT_CHT_ES8316_MAP(quirk)]); - byt_cht_es8316_card.long_name = long_name; -+ -+ /* register the soc card */ - snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv); - - ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card); -diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c -index dd2b5ad08659..7bc6d3cec94c 100644 ---- a/sound/soc/intel/boards/bytcr_rt5640.c -+++ b/sound/soc/intel/boards/bytcr_rt5640.c -@@ -1083,6 +1083,7 @@ static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN]; - static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */ - static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ - static char byt_rt5640_long_name[40]; /* = "bytcr-rt5640-*-spk-*-mic" */ -+static char byt_rt5640_components[32]; /* = "cfg-spk:* cfg-mic:*" */ - - static int byt_rt5640_suspend(struct snd_soc_card *card) - { -@@ -1305,6 +1306,11 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) - } - } - -+ snprintf(byt_rt5640_components, sizeof(byt_rt5640_components), -+ "cfg-spk:%s cfg-mic:%s", -+ (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? "1" : "2", -+ map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]); -+ byt_rt5640_card.components = byt_rt5640_components; - snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name), - "bytcr-rt5640-%s-spk-%s-mic", - (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? -diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c -index 4606f6f582d6..80a5674ddb1b 100644 ---- a/sound/soc/intel/boards/bytcr_rt5651.c -+++ b/sound/soc/intel/boards/bytcr_rt5651.c -@@ -798,6 +798,7 @@ static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN]; - static char byt_rt5651_codec_aif_name[12]; /* = "rt5651-aif[1|2]" */ - static char byt_rt5651_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ - static char byt_rt5651_long_name[50]; /* = "bytcr-rt5651-*-spk-*-mic[-swapped-hp]" */ -+static char byt_rt5651_components[50]; /* = "cfg-spk:* cfg-mic:*" */ - - static int byt_rt5651_suspend(struct snd_soc_card *card) - { -@@ -876,7 +877,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) - const char *platform_name; - struct acpi_device *adev; - struct device *codec_dev; -- const char *hp_swapped; - bool is_bytcr = false; - int ret_val = 0; - int dai_index = 0; -@@ -1080,16 +1080,20 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) - } - } - -- if (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) -- hp_swapped = "-hp-swapped"; -- else -- hp_swapped = ""; -- -+ snprintf(byt_rt5651_components, sizeof(byt_rt5651_components), -+ "cfg-spk:%s cfg-mic:%s%s", -+ (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? "1" : "2", -+ mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], -+ (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ? -+ " cfg-hp:lrswap" : ""); -+ byt_rt5651_card.components = byt_rt5651_components; - snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name), - "bytcr-rt5651-%s-spk-%s-mic%s", - (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? - "mono" : "stereo", -- mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], hp_swapped); -+ mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], -+ (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ? -+ "-hp-swapped" : ""); - byt_rt5651_card.long_name = byt_rt5651_long_name; - - /* override plaform name, if required */ --- -2.20.1 - - -From 36c175e19e9cbb685708519d41e27cd803206737 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Dec 2019 15:15:46 -0600 -Subject: [PATCH 3/4] ASoC: Intel - do not describe I/O configuration in the - long card name - -The long card name might be used in GUI. This information should be hidden. - -Add CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES configuration option. - -Signed-off-by: Jaroslav Kysela -Signed-off-by: Pierre-Louis Bossart -Cc: Mark Brown -Link: https://lore.kernel.org/r/20191204211556.12671-4-pierre-louis.bossart@linux.intel.com -Signed-off-by: Mark Brown - -Signed-off-by: Jaroslav Kysela -(cherry picked from commit b5706f8ec29fb461571d25e3e813ede121fe31cd) -Bugzilla: 1772498 ---- - sound/soc/intel/boards/Kconfig | 13 +++++++++++++ - sound/soc/intel/boards/bytcht_es8316.c | 4 ++++ - sound/soc/intel/boards/bytcr_rt5640.c | 4 ++++ - sound/soc/intel/boards/bytcr_rt5651.c | 4 ++++ - 4 files changed, 25 insertions(+) - -diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig -index ef20316e83d1..145eb55bd691 100644 ---- a/sound/soc/intel/boards/Kconfig -+++ b/sound/soc/intel/boards/Kconfig -@@ -13,6 +13,19 @@ menuconfig SND_SOC_INTEL_MACH - - if SND_SOC_INTEL_MACH - -+config SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES -+ bool "Use more user friendly long card names" -+ help -+ Some drivers report the I/O configuration to userspace through the -+ soundcard's long card name in the control user space AP. An unfortunate -+ side effect is that this long name may also be used by the GUI, -+ confusing users with information they don't need. -+ This option prevents the long name from being modified, and the I/O -+ configuration will be provided through a different component interface. -+ Select Y if userspace like UCM (Use Case Manager) uses the component -+ interface. -+ If unsure select N. -+ - if SND_SOC_INTEL_HASWELL - - config SND_SOC_INTEL_HASWELL_MACH -diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c -index efa33f30dcac..12a1c5255484 100644 ---- a/sound/soc/intel/boards/bytcht_es8316.c -+++ b/sound/soc/intel/boards/bytcht_es8316.c -@@ -360,7 +360,9 @@ static struct snd_soc_dai_link byt_cht_es8316_dais[] = { - - /* SoC card */ - static char codec_name[SND_ACPI_I2C_ID_LEN]; -+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) - static char long_name[50]; /* = "bytcht-es8316-*-spk-*-mic" */ -+#endif - static char components_string[32]; /* = "cfg-spk:* cfg-mic:* */ - - static int byt_cht_es8316_suspend(struct snd_soc_card *card) -@@ -578,10 +580,12 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) - (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "1" : "2", - mic_name[BYT_CHT_ES8316_MAP(quirk)]); - byt_cht_es8316_card.components = components_string; -+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) - snprintf(long_name, sizeof(long_name), "bytcht-es8316-%s-spk-%s-mic", - (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo", - mic_name[BYT_CHT_ES8316_MAP(quirk)]); - byt_cht_es8316_card.long_name = long_name; -+#endif - - /* register the soc card */ - snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv); -diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c -index 7bc6d3cec94c..648fcc1d07b5 100644 ---- a/sound/soc/intel/boards/bytcr_rt5640.c -+++ b/sound/soc/intel/boards/bytcr_rt5640.c -@@ -1082,7 +1082,9 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { - static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN]; - static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */ - static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ -+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) - static char byt_rt5640_long_name[40]; /* = "bytcr-rt5640-*-spk-*-mic" */ -+#endif - static char byt_rt5640_components[32]; /* = "cfg-spk:* cfg-mic:*" */ - - static int byt_rt5640_suspend(struct snd_soc_card *card) -@@ -1311,12 +1313,14 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) - (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? "1" : "2", - map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]); - byt_rt5640_card.components = byt_rt5640_components; -+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) - snprintf(byt_rt5640_long_name, sizeof(byt_rt5640_long_name), - "bytcr-rt5640-%s-spk-%s-mic", - (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) ? - "mono" : "stereo", - map_name[BYT_RT5640_MAP(byt_rt5640_quirk)]); - byt_rt5640_card.long_name = byt_rt5640_long_name; -+#endif - - /* override plaform name, if required */ - platform_name = mach->mach_params.platform; -diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c -index 80a5674ddb1b..c0d322a859f7 100644 ---- a/sound/soc/intel/boards/bytcr_rt5651.c -+++ b/sound/soc/intel/boards/bytcr_rt5651.c -@@ -797,7 +797,9 @@ static struct snd_soc_dai_link byt_rt5651_dais[] = { - static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN]; - static char byt_rt5651_codec_aif_name[12]; /* = "rt5651-aif[1|2]" */ - static char byt_rt5651_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ -+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) - static char byt_rt5651_long_name[50]; /* = "bytcr-rt5651-*-spk-*-mic[-swapped-hp]" */ -+#endif - static char byt_rt5651_components[50]; /* = "cfg-spk:* cfg-mic:*" */ - - static int byt_rt5651_suspend(struct snd_soc_card *card) -@@ -1087,6 +1089,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) - (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ? - " cfg-hp:lrswap" : ""); - byt_rt5651_card.components = byt_rt5651_components; -+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES) - snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name), - "bytcr-rt5651-%s-spk-%s-mic%s", - (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? -@@ -1095,6 +1098,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) - (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ? - "-hp-swapped" : ""); - byt_rt5651_card.long_name = byt_rt5651_long_name; -+#endif - - /* override plaform name, if required */ - platform_name = mach->mach_params.platform; --- -2.20.1 - - -From 9aa9b367e35494f2d02112ca440a78908f645a04 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 22 Nov 2019 09:31:03 +0100 -Subject: [PATCH 4/4] ASoC: SOF - topology - do not change the link triger - order for old firmare - -This is patch for SOF v1.3 firmware. The DSP firmware will crash -without this patch. The 1.4.1 firmare has this issue fixed. - -BugLink: https://github.com/thesofproject/sof/issues/2102 -Signed-off-by: Jaroslav Kysela ---- - sound/soc/sof/topology.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c -index d82ab981e840..cbbbf96416ef 100644 ---- a/sound/soc/sof/topology.c -+++ b/sound/soc/sof/topology.c -@@ -2971,6 +2971,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, - struct snd_soc_tplg_private *private = &cfg->priv; - struct sof_ipc_dai_config config; - struct snd_soc_tplg_hw_config *hw_config; -+ struct sof_ipc_fw_version *v = &sdev->fw_ready.version; - int num_hw_configs; - int ret; - int i = 0; -@@ -2988,9 +2989,12 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, - if (!link->no_pcm) { - link->nonatomic = true; - -- /* set trigger order */ -- link->trigger[0] = SND_SOC_DPCM_TRIGGER_POST; -- link->trigger[1] = SND_SOC_DPCM_TRIGGER_POST; -+ /* this causes DSP panic on firmware v1.3 */ -+ if (SOF_ABI_VER(v->major, v->minor, v->micro) > SOF_ABI_VER(3, 7, 0)) { -+ /* set trigger order */ -+ link->trigger[0] = SND_SOC_DPCM_TRIGGER_POST; -+ link->trigger[1] = SND_SOC_DPCM_TRIGGER_POST; -+ } - - /* nothing more to do for FE dai links */ - return 0; --- -2.20.1 - - -From 264fe78e03d860f8bbf92f250cd22f54cabca59b Mon Sep 17 00:00:00 2001 -From: Fedora Kernel Team -Date: Tue, 21 Jan 2020 11:57:17 -0500 -Subject: [PATCH] Force the DSP driver for Intel DSP to "legacy" by default - -Signed-off-by: Fedora Kernel Team ---- - sound/hda/intel-dsp-config.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c -index be1df80..2167ae3 100644 ---- a/sound/hda/intel-dsp-config.c -+++ b/sound/hda/intel-dsp-config.c -@@ -9,7 +9,7 @@ - #include - #include - --static int dsp_driver; -+static int dsp_driver = 1; - - 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)"); --- -2.24.1 - diff --git a/SOURCES/kernel-aarch64-debug-fedora.config b/SOURCES/kernel-aarch64-debug-fedora.config index be20fe8..ed3c7e3 100644 --- a/SOURCES/kernel-aarch64-debug-fedora.config +++ b/SOURCES/kernel-aarch64-debug-fedora.config @@ -298,6 +298,7 @@ CONFIG_ARM64_ERRATUM_834220=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_ERRATUM_858921=y +CONFIG_ARM64_ERRATUM_1542419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LSE_ATOMICS=y CONFIG_ARM64_PA_BITS_48=y diff --git a/SOURCES/kernel-aarch64-fedora.config b/SOURCES/kernel-aarch64-fedora.config index 73fdea0..f0022c2 100644 --- a/SOURCES/kernel-aarch64-fedora.config +++ b/SOURCES/kernel-aarch64-fedora.config @@ -298,6 +298,7 @@ CONFIG_ARM64_ERRATUM_834220=y CONFIG_ARM64_ERRATUM_843419=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_ERRATUM_858921=y +CONFIG_ARM64_ERRATUM_1542419=y CONFIG_ARM64_HW_AFDBM=y CONFIG_ARM64_LSE_ATOMICS=y CONFIG_ARM64_PA_BITS_48=y diff --git a/SOURCES/kernel-i686-debug-fedora.config b/SOURCES/kernel-i686-debug-fedora.config index 2f3341f..22d5a57 100644 --- a/SOURCES/kernel-i686-debug-fedora.config +++ b/SOURCES/kernel-i686-debug-fedora.config @@ -5437,6 +5437,7 @@ CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set CONFIG_SND_SOC_SOF_ACPI=m CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT=y +CONFIG_SND_SOC_SOF_BAYTRAIL_SUPPORT=y CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y diff --git a/SOURCES/kernel-i686-fedora.config b/SOURCES/kernel-i686-fedora.config index 5d1f396..858d283 100644 --- a/SOURCES/kernel-i686-fedora.config +++ b/SOURCES/kernel-i686-fedora.config @@ -5416,6 +5416,7 @@ CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set CONFIG_SND_SOC_SOF_ACPI=m CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT=y +CONFIG_SND_SOC_SOF_BAYTRAIL_SUPPORT=y CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y diff --git a/SOURCES/kernel-x86_64-debug-fedora.config b/SOURCES/kernel-x86_64-debug-fedora.config index abc1788..57fe5da 100644 --- a/SOURCES/kernel-x86_64-debug-fedora.config +++ b/SOURCES/kernel-x86_64-debug-fedora.config @@ -5488,6 +5488,7 @@ CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set CONFIG_SND_SOC_SOF_ACPI=m CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT=y +CONFIG_SND_SOC_SOF_BAYTRAIL_SUPPORT=y CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y diff --git a/SOURCES/kernel-x86_64-fedora.config b/SOURCES/kernel-x86_64-fedora.config index ae386b1..dfa90f5 100644 --- a/SOURCES/kernel-x86_64-fedora.config +++ b/SOURCES/kernel-x86_64-fedora.config @@ -5467,6 +5467,7 @@ CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set CONFIG_SND_SOC_SOF_ACPI=m CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT=y +CONFIG_SND_SOC_SOF_BAYTRAIL_SUPPORT=y CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec index 98a0bde..931b674 100644 --- a/SPECS/kernel.spec +++ b/SPECS/kernel.spec @@ -89,7 +89,7 @@ Summary: The Linux kernel %if 0%{?released_kernel} # Do we have a -stable update to apply? -%define stable_update 28 +%define stable_update 38 # Set rpm version accordingly %if 0%{?stable_update} %define stablerev %{stable_update} @@ -867,12 +867,6 @@ Patch523: media-rc-prevent-memory-leak-in-cx23888_ir_probe.patch # CVE-2019-18808 rhbz 1777418 1777421 Patch527: 0001-crypto-ccp-Release-all-allocated-memory-if-sha-type-.patch -# ALSA code from v5.5 (Intel ASoC Sound Open Firmware driver support) -Patch600: alsa-5.5.patch - -# ALSA code from v5.6 (Intel ASoC Sound Open Firmware driver support) -Patch601: alsa-5.6.patch - # This is already in 5.5 rhbz 1794369 Patch603: 0001-e1000e-Add-support-for-Comet-Lake.patch @@ -2927,6 +2921,10 @@ fi # # %changelog +* Sun May 3 2020 Pablo Greco - 5.4.38-200 +- Update to 5.4.38 +- Drop ASoC patches + * Sun Mar 29 2020 Pablo Greco - 5.4.28-200 - Update to 5.4.28 - Use gcc 8 in CentOS7