summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Leemhuis <fedora@leemhuis.info>2019-12-13 08:57:04 +0100
committerThorsten Leemhuis <fedora@leemhuis.info>2019-12-13 08:57:04 +0100
commitf833e29b73c69a5d521b2cf26a550ebc7660f909 (patch)
treedc834f0f89844195d5c8bf5b2db213dd4c0ac29d
parent15c74107487672e89f163fb42f40cc7193673bc5 (diff)
parentff218a4ef1fc7a59f77fa3f09f1b46f4629bc12d (diff)
downloadkernel-f833e29b73c69a5d521b2cf26a550ebc7660f909.tar.gz
kernel-f833e29b73c69a5d521b2cf26a550ebc7660f909.tar.xz
kernel-f833e29b73c69a5d521b2cf26a550ebc7660f909.zip
Merge remote-tracking branch 'origin/stabilization' into stabilization-user-thl-vanilla-fedora
-rw-r--r--0001-bdev-Factor-out-bdev-revalidation-into-a-common-help.patch68
-rw-r--r--0002-bdev-Refresh-bdev-size-for-disks-without-partitionin.patch61
-rw-r--r--alsa-5.5.patch12400
-rw-r--r--alsa-5.6.patch390
-rw-r--r--configs/fedora/generic/arm/CONFIG_USB_EHCI_HCD1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC2
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC~1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH2
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH~1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L11
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1~1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_LINK1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL2
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT1
-rw-r--r--configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT1
-rw-r--r--kernel-aarch64-debug-fedora.config2
-rw-r--r--kernel-aarch64-fedora.config2
-rw-r--r--kernel-armv7hl-debug-fedora.config2
-rw-r--r--kernel-armv7hl-fedora.config2
-rw-r--r--kernel-armv7hl-lpae-debug-fedora.config2
-rw-r--r--kernel-armv7hl-lpae-fedora.config2
-rw-r--r--kernel-i686-debug-fedora.config24
-rw-r--r--kernel-i686-fedora.config24
-rw-r--r--kernel-x86_64-debug-fedora.config24
-rw-r--r--kernel-x86_64-fedora.config24
-rw-r--r--kernel.spec16
41 files changed, 13055 insertions, 17 deletions
diff --git a/0001-bdev-Factor-out-bdev-revalidation-into-a-common-help.patch b/0001-bdev-Factor-out-bdev-revalidation-into-a-common-help.patch
new file mode 100644
index 000000000..1e979a1fa
--- /dev/null
+++ b/0001-bdev-Factor-out-bdev-revalidation-into-a-common-help.patch
@@ -0,0 +1,68 @@
+From aea39223667868c77936546004b84716a623a438 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Mon, 21 Oct 2019 10:37:59 +0200
+Subject: [PATCH 1/2] bdev: Factor out bdev revalidation into a common helper
+
+Factor out code handling revalidation of bdev on disk change into a
+common helper.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+---
+ fs/block_dev.c | 26 ++++++++++++++------------
+ 1 file changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/fs/block_dev.c b/fs/block_dev.c
+index 9c073dbdc1b0..88c6d35ec71d 100644
+--- a/fs/block_dev.c
++++ b/fs/block_dev.c
+@@ -1512,6 +1512,14 @@ EXPORT_SYMBOL(bd_set_size);
+
+ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
+
++static void bdev_disk_changed(struct block_device *bdev, bool invalidate)
++{
++ if (invalidate)
++ invalidate_partitions(bdev->bd_disk, bdev);
++ else
++ rescan_partitions(bdev->bd_disk, bdev);
++}
++
+ /*
+ * bd_mutex locking:
+ *
+@@ -1594,12 +1602,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
+ * The latter is necessary to prevent ghost
+ * partitions on a removed medium.
+ */
+- if (bdev->bd_invalidated) {
+- if (!ret)
+- rescan_partitions(disk, bdev);
+- else if (ret == -ENOMEDIUM)
+- invalidate_partitions(disk, bdev);
+- }
++ if (bdev->bd_invalidated &&
++ (!ret || ret == -ENOMEDIUM))
++ bdev_disk_changed(bdev, ret == -ENOMEDIUM);
+
+ if (ret)
+ goto out_clear;
+@@ -1632,12 +1637,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
+ if (bdev->bd_disk->fops->open)
+ ret = bdev->bd_disk->fops->open(bdev, mode);
+ /* the same as first opener case, read comment there */
+- if (bdev->bd_invalidated) {
+- if (!ret)
+- rescan_partitions(bdev->bd_disk, bdev);
+- else if (ret == -ENOMEDIUM)
+- invalidate_partitions(bdev->bd_disk, bdev);
+- }
++ if (bdev->bd_invalidated &&
++ (!ret || ret == -ENOMEDIUM))
++ bdev_disk_changed(bdev, ret == -ENOMEDIUM);
+ if (ret)
+ goto out_unlock_bdev;
+ }
+--
+2.21.0
+
diff --git a/0002-bdev-Refresh-bdev-size-for-disks-without-partitionin.patch b/0002-bdev-Refresh-bdev-size-for-disks-without-partitionin.patch
new file mode 100644
index 000000000..c988fa6a8
--- /dev/null
+++ b/0002-bdev-Refresh-bdev-size-for-disks-without-partitionin.patch
@@ -0,0 +1,61 @@
+From 91ee136f5e2179a0994985ea043468bbbcd400d4 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Mon, 21 Oct 2019 10:38:00 +0200
+Subject: [PATCH 2/2] bdev: Refresh bdev size for disks without partitioning
+
+Currently, block device size in not updated on second and further open
+for block devices where partition scan is disabled. This is particularly
+annoying for example for DVD drives as that means block device size does
+not get updated once the media is inserted into a drive if the device is
+already open when inserting the media. This is actually always the case
+for example when pktcdvd is in use.
+
+Fix the problem by revalidating block device size on every open even for
+devices with partition scan disabled.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+---
+ fs/block_dev.c | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/fs/block_dev.c b/fs/block_dev.c
+index 88c6d35ec71d..d612468ee66b 100644
+--- a/fs/block_dev.c
++++ b/fs/block_dev.c
+@@ -1403,11 +1403,7 @@ static void flush_disk(struct block_device *bdev, bool kill_dirty)
+ "resized disk %s\n",
+ bdev->bd_disk ? bdev->bd_disk->disk_name : "");
+ }
+-
+- if (!bdev->bd_disk)
+- return;
+- if (disk_part_scan_enabled(bdev->bd_disk))
+- bdev->bd_invalidated = 1;
++ bdev->bd_invalidated = 1;
+ }
+
+ /**
+@@ -1514,10 +1510,15 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
+
+ static void bdev_disk_changed(struct block_device *bdev, bool invalidate)
+ {
+- if (invalidate)
+- invalidate_partitions(bdev->bd_disk, bdev);
+- else
+- rescan_partitions(bdev->bd_disk, bdev);
++ if (disk_part_scan_enabled(bdev->bd_disk)) {
++ if (invalidate)
++ invalidate_partitions(bdev->bd_disk, bdev);
++ else
++ rescan_partitions(bdev->bd_disk, bdev);
++ } else {
++ check_disk_size_change(bdev->bd_disk, bdev, !invalidate);
++ bdev->bd_invalidated = 0;
++ }
+ }
+
+ /*
+--
+2.21.0
+
diff --git a/alsa-5.5.patch b/alsa-5.5.patch
new file mode 100644
index 000000000..7b2162a63
--- /dev/null
+++ b/alsa-5.5.patch
@@ -0,0 +1,12400 @@
+From 0ac6b457d6e7f945aa84c26effe306b83bcf7ddb Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Sun, 25 Nov 2018 23:12:08 +0000
+Subject: [PATCH 001/130] ALSA: usb-audio: fix spelling mistake "Frequence" ->
+ "Frequency"
+
+There are spelling mistakes in equalizer name fields, fix them.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From accf87200cc0d1411c40e577f7104c55caac01dc Mon Sep 17 00:00:00 2001
+From: Saurav Girepunje <saurav.girepunje@gmail.com>
+Date: Tue, 29 Oct 2019 23:22:00 +0530
+Subject: [PATCH 002/130] ALSA: usb-audio: sound: usb: usb true/false for bool
+ return type
+
+Use true/false for bool type return in uac_clock_source_is_valid().
+
+Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
+Link: https://lore.kernel.org/r/20191029175200.GA7320@saurav
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 1d4961d9eb1aaa498dfb44779b7e4b95d79112d0)
+Bugzilla: 1772498
+---
+ sound/usb/clock.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/sound/usb/clock.c b/sound/usb/clock.c
+index 6b8c14f9b5d4..018b1ecb5404 100644
+--- a/sound/usb/clock.c
++++ b/sound/usb/clock.c
+@@ -165,21 +165,21 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
+ snd_usb_find_clock_source_v3(chip->ctrl_intf, source_id);
+
+ if (!cs_desc)
+- return 0;
++ return false;
+ bmControls = le32_to_cpu(cs_desc->bmControls);
+ } else { /* UAC_VERSION_1/2 */
+ struct uac_clock_source_descriptor *cs_desc =
+ snd_usb_find_clock_source(chip->ctrl_intf, source_id);
+
+ if (!cs_desc)
+- return 0;
++ return false;
+ bmControls = cs_desc->bmControls;
+ }
+
+ /* If a clock source can't tell us whether it's valid, we assume it is */
+ if (!uac_v2v3_control_is_readable(bmControls,
+ UAC2_CS_CONTROL_CLOCK_VALID))
+- return 1;
++ return true;
+
+ err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
+ USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
+@@ -191,10 +191,10 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
+ dev_warn(&dev->dev,
+ "%s(): cannot get clock validity for id %d\n",
+ __func__, source_id);
+- return 0;
++ return false;
+ }
+
+- return !!data;
++ return data ? true : false;
+ }
+
+ static int __uac_clock_find_source(struct snd_usb_audio *chip, int entity_id,
+--
+2.20.1
+
+
+From 50704a502a8b9b71ca96de1bd0da70394d9576b3 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 14 Nov 2019 17:56:13 +0100
+Subject: [PATCH 003/130] 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 <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 feb30f9c1716..ff3cbf653de8 100644
+--- a/sound/usb/usbaudio.h
++++ b/sound/usb/usbaudio.h
+@@ -120,5 +120,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 389e8657434a..36ae78c3da3d 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.20.1
+
+
+From fb285eb397d32ae1edbdc4e7ad82a0e2157b2454 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Fri, 18 Oct 2019 15:38:47 +0800
+Subject: [PATCH 004/130] PCI: Add a helper to check Power Resource
+ Requirements _PR3 existence
+
+A driver may want to know the existence of _PR3, to choose different
+runtime suspend behavior. A user will be add in next patch.
+
+This is mostly the same as nouveau_pr3_present().
+
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Acked-by: Bjorn Helgaas <bhelgaas@google.com>
+Link: https://lore.kernel.org/r/20191018073848.14590-1-kai.heng.feng@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 52525b7a3cf82adec5c6cf0ecbd23ff228badc94)
+Bugzilla: 1772498
+---
+ drivers/pci/pci.c | 18 ++++++++++++++++++
+ include/linux/pci.h | 2 ++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
+index a97e2571a527..fcfaadc774ee 100644
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -5854,6 +5854,24 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
+ return 0;
+ }
+
++#ifdef CONFIG_ACPI
++bool pci_pr3_present(struct pci_dev *pdev)
++{
++ struct acpi_device *adev;
++
++ if (acpi_disabled)
++ return false;
++
++ adev = ACPI_COMPANION(&pdev->dev);
++ if (!adev)
++ return false;
++
++ return adev->power.flags.power_resources &&
++ acpi_has_method(adev->handle, "_PR3");
++}
++EXPORT_SYMBOL_GPL(pci_pr3_present);
++#endif
++
+ /**
+ * pci_add_dma_alias - Add a DMA devfn alias for a device
+ * @dev: the PCI device for which alias is added
+diff --git a/include/linux/pci.h b/include/linux/pci.h
+index f9088c89a534..1d15c5d49cdd 100644
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -2310,9 +2310,11 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus);
+
+ void
+ pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *));
++bool pci_pr3_present(struct pci_dev *pdev);
+ #else
+ static inline struct irq_domain *
+ pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; }
++static bool pci_pr3_present(struct pci_dev *pdev) { return false; }
+ #endif
+
+ #ifdef CONFIG_EEH
+--
+2.20.1
+
+
+From 7fbcfac9bf68e2ccccafb3736287e1b1e021c2f3 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 21 Oct 2019 16:25:20 +0200
+Subject: [PATCH 005/130] PCI: Fix missing inline for pci_pr3_present()
+
+The inline prefix was missing in the dummy function pci_pr3_present()
+definition. Fix it.
+
+Reported-by: kbuild test robot <lkp@intel.com>
+Fixes: 52525b7a3cf8 ("PCI: Add a helper to check Power Resource Requirements _PR3 existence")
+Link: https://lore.kernel.org/r/201910212111.qHm6OcWx%lkp@intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 46b4bff6572b0552b1ee062043621e4b252638d8)
+Bugzilla: 1772498
+---
+ include/linux/pci.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/linux/pci.h b/include/linux/pci.h
+index 1d15c5d49cdd..be529d311122 100644
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -2314,7 +2314,7 @@ bool pci_pr3_present(struct pci_dev *pdev);
+ #else
+ static inline struct irq_domain *
+ pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) { return NULL; }
+-static bool pci_pr3_present(struct pci_dev *pdev) { return false; }
++static inline bool pci_pr3_present(struct pci_dev *pdev) { return false; }
+ #endif
+
+ #ifdef CONFIG_EEH
+--
+2.20.1
+
+
+From 6e6ea1a80e8b33f3908fdfa4ce45c3fa684cda75 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Tue, 22 Oct 2019 19:43:12 +0200
+Subject: [PATCH 006/130] 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 <perex@perex.cz>
+Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191022174313.29087-1-perex@perex.cz
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <perex@perex.cz>
++ */
++
++#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 <perex@perex.cz>
++
++#include <linux/bits.h>
++#include <linux/dmi.h>
++#include <linux/module.h>
++#include <linux/pci.h>
++#include <sound/core.h>
++#include <sound/intel-dsp-config.h>
++#include <sound/intel-nhlt.h>
++
++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 c52419376c74..2e5742d095ff 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -46,7 +46,7 @@
+ #include <sound/initval.h>
+ #include <sound/hdaudio.h>
+ #include <sound/hda_i915.h>
+-#include <sound/intel-nhlt.h>
++#include <sound/intel-dsp-config.h>
+ #include <linux/vgaarb.h>
+ #include <linux/vga_switcheroo.h>
+ #include <linux/firmware.h>
+@@ -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);
+@@ -2020,25 +2021,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)
+ {
+@@ -2056,6 +2038,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) {
+@@ -2069,17 +2061,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 01c99750212a..9ad89d56092b 100644
+--- a/sound/soc/intel/Kconfig
++++ b/sound/soc/intel/Kconfig
+@@ -215,7 +215,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 <sound/hda_i915.h>
+ #include <sound/hda_codec.h>
+ #include <sound/intel-nhlt.h>
++#include <sound/intel-dsp-config.h>
+ #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 d62f51d33be1..1be28581c328 100644
+--- a/sound/soc/sof/intel/Kconfig
++++ b/sound/soc/sof/intel/Kconfig
+@@ -296,7 +296,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 <linux/module.h>
+ #include <linux/pci.h>
+ #include <linux/pm_runtime.h>
++#include <sound/intel-dsp-config.h>
+ #include <sound/soc-acpi.h>
+ #include <sound/soc-acpi-intel-match.h>
+ #include <sound/sof.h>
+@@ -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.20.1
+
+
+From 8f609dd45d5598536e5a1a7a84fe19ff7c13559a Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Tue, 22 Oct 2019 19:43:13 +0200
+Subject: [PATCH 007/130] 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 <pierre-louis.bossart@linux.intel.com>
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+Link: https://lore.kernel.org/r/20191022174313.29087-2-perex@perex.cz
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 56731f15b8cce801875906ab32fefecd7858ab1a Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Mon, 28 Oct 2019 17:46:24 +0100
+Subject: [PATCH 008/130] 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 <perex@perex.cz>
+Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Cc: Mark Brown <broonie@kernel.org>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191028164624.14334-1-perex@perex.cz
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 74dda8784f1a..d14ca327c684 100644
+--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
++++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
+@@ -623,7 +623,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.20.1
+
+
+From 63d4f97804a1ab4ad9e84843bdee307c2ab9e9b5 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 28 Oct 2019 14:06:34 +0100
+Subject: [PATCH 009/130] 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 <tiwai@suse.de>
+Link: https://lore.kernel.org/r/20191028130634.3501-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From fddf95e9cd5e5768e35aa6f60a9686f21e690dc5 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 5 Nov 2019 09:18:06 +0100
+Subject: [PATCH 010/130] 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 <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From b9f21867949f2ed530dbefed02d139c5a92e0621 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Fri, 18 Oct 2019 15:38:48 +0800
+Subject: [PATCH 011/130] ALSA: hda: Allow HDA to be runtime suspended when
+ dGPU is not bound to a driver
+
+Nvidia proprietary driver doesn't support runtime power management, so
+when a user only wants to use the integrated GPU, it's a common practice
+to let dGPU not to bind any driver, and let its upstream port to be
+runtime suspended. At the end of runtime suspension the port uses
+platform power management to disable power through _OFF method of power
+resource, which is listed by _PR3.
+
+After commit b516ea586d71 ("PCI: Enable NVIDIA HDA controllers"), when
+the dGPU comes with an HDA function, the HDA won't be suspended if the
+dGPU is unbound, so the power resource can't be turned off by its
+upstream port driver.
+
+Commit 37a3a98ef601 ("ALSA: hda - Enable runtime PM only for
+discrete GPU") only allows HDA to be runtime suspended once GPU is
+bound, to keep APU's HDA working.
+
+However, HDA on dGPU isn't that useful if dGPU is not bound to any
+driver. So let's relax the runtime suspend requirement for dGPU's HDA
+function, to disable the power source to save lots of power.
+
+BugLink: https://bugs.launchpad.net/bugs/1840835
+Fixes: b516ea586d71 ("PCI: Enable NVIDIA HDA controllers")
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Link: https://lore.kernel.org/r/20191018073848.14590-2-kai.heng.feng@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit bacd861452d2be86a4df341b12e32db7dac8021e)
+Bugzilla: 1772498
+---
+ sound/pci/hda/hda_intel.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index 2e5742d095ff..e0e9d4ee180d 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -1281,11 +1281,17 @@ static void init_vga_switcheroo(struct azx *chip)
+ {
+ struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
+ struct pci_dev *p = get_bound_vga(chip->pci);
++ struct pci_dev *parent;
+ if (p) {
+ dev_info(chip->card->dev,
+ "Handle vga_switcheroo audio client\n");
+ hda->use_vga_switcheroo = 1;
+- chip->bus.keep_power = 1; /* cleared in either gpu_bound op or codec probe */
++
++ /* cleared in either gpu_bound op or codec probe, or when its
++ * upstream port has _PR3 (i.e. dGPU).
++ */
++ parent = pci_upstream_bridge(p);
++ chip->bus.keep_power = parent ? !pci_pr3_present(parent) : 1;
+ chip->driver_caps |= AZX_DCAPS_PM_RUNTIME;
+ pci_dev_put(p);
+ }
+--
+2.20.1
+
+
+From faecd54be3265217bc7f8499c3f9e1d230ccd05d Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 28 Oct 2019 11:58:03 +0100
+Subject: [PATCH 012/130] ALSA: hda - Fix pending unsol events at shutdown
+
+This is an alternative fix attemp for the issue reported in the commit
+caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling") that was
+reverted later due to regressions. Instead of tweaking the hardware
+disablement order and the enforced irq flushing, do calling
+cancel_work_sync() of the unsol work early enough, and explicitly
+ignore the unsol events during the shutdown by checking the
+bus->shutdown flag.
+
+Fixes: caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling")
+Cc: Chris Wilson <chris@chris-wilson.co.uk>
+Link: https://lore.kernel.org/r/s5h1ruxt9cz.wl-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit ca58f55108fee41d87c9123f85ad4863e5de7f45)
+Bugzilla: 1772498
+---
+ sound/pci/hda/hda_bind.c | 4 ++++
+ sound/pci/hda/hda_intel.c | 3 +++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
+index 8272b50b8349..6a8564566375 100644
+--- a/sound/pci/hda/hda_bind.c
++++ b/sound/pci/hda/hda_bind.c
+@@ -43,6 +43,10 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev)
+ {
+ struct hda_codec *codec = container_of(dev, struct hda_codec, core);
+
++ /* ignore unsol events during shutdown */
++ if (codec->bus->shutdown)
++ return;
++
+ if (codec->patch_ops.unsol_event)
+ codec->patch_ops.unsol_event(codec, ev);
+ }
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index e0e9d4ee180d..8981109e3565 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -1389,8 +1389,11 @@ static int azx_free(struct azx *chip)
+ static int azx_dev_disconnect(struct snd_device *device)
+ {
+ struct azx *chip = device->device_data;
++ struct hdac_bus *bus = azx_bus(chip);
+
+ chip->bus.shutdown = 1;
++ cancel_work_sync(&bus->unsol_work);
++
+ return 0;
+ }
+
+--
+2.20.1
+
+
+From e3eb037a46c5b6771e9336bb493063dbffb90e04 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:09 +0200
+Subject: [PATCH 013/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-2-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 d14f6684737d..b8579cd21809 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2075,15 +2075,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.20.1
+
+
+From d396423ca770d10ab33a485f118e80a1a9f70516 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 11 Nov 2019 20:09:37 +0100
+Subject: [PATCH 014/130] 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 <kai.vehmanen@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111190937.19186-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 b8579cd21809..ee72d990cef3 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -37,25 +37,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;
+@@ -162,6 +143,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
+ */
+@@ -925,7 +907,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
+@@ -1709,7 +1691,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
+@@ -1758,7 +1740,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)
+@@ -2825,6 +2807,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.20.1
+
+
+From 3c8372547754addd020cc95c164508fd67cb53b8 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Fri, 15 Nov 2019 14:44:47 +0200
+Subject: [PATCH 015/130] 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 <xiuli.pan@linux.intel.com>
+Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Link: https://lore.kernel.org/r/20191115124449.20512-2-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 ee72d990cef3..cc35a8569439 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2664,7 +2664,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 */
+@@ -2684,9 +2684,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)
+@@ -2838,9 +2838,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));
+ }
+@@ -2849,7 +2849,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.20.1
+
+
+From 485ef81d2510635f707bec0fb461b199e0b6cb89 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Fri, 15 Nov 2019 14:44:48 +0200
+Subject: [PATCH 016/130] ALSA: hda: hdmi - remove redundant code comments
+
+Remove unnecessary comments related to pin mapping on
+Intel platforms.
+
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Link: https://lore.kernel.org/r/20191115124449.20512-3-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 cc35a8569439..71848dce0025 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2655,7 +2655,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;
+ }
+
+ /*
+@@ -2667,7 +2667,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;
+ }
+@@ -2680,7 +2679,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;
+ }
+
+@@ -2856,7 +2854,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.20.1
+
+
+From c581baec7a7479f1767335255a7b7de405bfc707 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Fri, 15 Nov 2019 14:44:49 +0200
+Subject: [PATCH 017/130] 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 <kai.vehmanen@linux.intel.com>
+Link: https://lore.kernel.org/r/20191115124449.20512-4-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 8981109e3565..e76a0bb6d3cf 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -369,8 +369,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",
+@@ -1763,10 +1761,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.20.1
+
+
+From 8de79a35aa53df66d5eec899cafff067a0908da4 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 15 Oct 2019 14:44:09 +0900
+Subject: [PATCH 018/130] 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 <types.h> 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 <kuninori.morimoto.gx@renesas.com>
+Link: https://lore.kernel.org/r/87a7a24l7r.wl-kuninori.morimoto.gx@renesas.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <linux/types.h>
+ #include <uapi/sound/sof/abi.h>
+
+ /** \addtogroup sof_uapi uAPI
+--
+2.20.1
+
+
+From eeb591355d00f4e6e077745aca5ff5a2899eca2d Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 27 Sep 2019 15:05:28 -0500
+Subject: [PATCH 019/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 81f28f7ff1a0..15167b8220ed 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
+@@ -350,12 +355,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 730f3259dd02..d5b1a4f895da 100644
+--- a/sound/soc/sof/sof-priv.h
++++ b/sound/soc/sof/sof-priv.h
+@@ -28,10 +28,14 @@
+ #include <uapi/sound/sof/fw.h>
+
+ /* 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
+@@ -434,6 +438,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.20.1
+
+
+From f1e8f5f928c09194078db704356af60ddaee6280 Mon Sep 17 00:00:00 2001
+From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
+Date: Fri, 27 Sep 2019 15:05:29 -0500
+Subject: [PATCH 020/130] 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 <liam.r.girdwood@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 086eeeab8679..3382a745ba5a 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 d5b1a4f895da..348759035dd0 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;
+@@ -580,6 +581,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.20.1
+
+
+From 9de42cad7a0c02393de0999286b1c2cc2a3ea39f Mon Sep 17 00:00:00 2001
+From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Date: Fri, 27 Sep 2019 15:05:32 -0500
+Subject: [PATCH 021/130] 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 <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-8-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 15167b8220ed..5998861a9002 100644
+--- a/sound/soc/sof/core.c
++++ b/sound/soc/sof/core.c
+@@ -466,7 +466,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 3382a745ba5a..5994e1073364 100644
+--- a/sound/soc/sof/ipc.c
++++ b/sound/soc/sof/ipc.c
+@@ -794,12 +794,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 348759035dd0..44f789bf7fb0 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.20.1
+
+
+From 63398beda87ad3d6d43cc5fc90f173540b3fd1b3 Mon Sep 17 00:00:00 2001
+From: Marcin Rajwa <marcin.rajwa@linux.intel.com>
+Date: Fri, 27 Sep 2019 15:05:33 -0500
+Subject: [PATCH 022/130] 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 <marcin.rajwa@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-9-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 0a637a33ef7f532235b1d972ee54cf8b603730e5 Mon Sep 17 00:00:00 2001
+From: Marcin Rajwa <marcin.rajwa@linux.intel.com>
+Date: Fri, 27 Sep 2019 15:05:34 -0500
+Subject: [PATCH 023/130] 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 <marcin.rajwa@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-10-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 7f89237bf642c6a090557db68be76c6d67658904 Mon Sep 17 00:00:00 2001
+From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
+Date: Fri, 27 Sep 2019 15:05:37 -0500
+Subject: [PATCH 024/130] 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 <liam.r.girdwood@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190927200538.660-13-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 a1e514f71739..b2597ecfdc1c 100644
+--- a/sound/soc/sof/intel/byt.c
++++ b/sound/soc/sof/intel/byt.c
+@@ -145,7 +145,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);
+@@ -154,6 +154,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.20.1
+
+
+From 5c2784a52e77957f4c7a677296369d1ef09413db Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:35 -0500
+Subject: [PATCH 025/130] ASoC: SOF: enable sync_write in hdac_bus
+
+Align SOF HDA implementation with snd-hda-intel driver and enable
+sync_write flag for all supported Intel platforms in SOF. When set,
+a sync is issued after each verb write.
+
+Sync after write has helped to overcome intermittent delays in
+system resume flow on Intel Coffee Lake systems, and most recently
+probe errors related to the HDMI codec on Ice Lake systems.
+
+Matches the snd-hda-intel driver change done in commit 2756d9143aa5
+("ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips").
+
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit f3416e7144f5d4ba0fc5dcef6ebfff891266c46a)
+Bugzilla: 1772498
+---
+ sound/soc/sof/intel/hda.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
+index 06e84679087b..5a5163eef2ef 100644
+--- a/sound/soc/sof/intel/hda.c
++++ b/sound/soc/sof/intel/hda.c
+@@ -268,6 +268,7 @@ static int hda_init(struct snd_sof_dev *sdev)
+
+ bus->use_posbuf = 1;
+ bus->bdl_pos_adj = 0;
++ bus->sync_write = 1;
+
+ mutex_init(&hbus->prepare_mutex);
+ hbus->pci = pci;
+--
+2.20.1
+
+
+From e1cc39fb37b304910435e08907d9bd3f29636b89 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:41 -0500
+Subject: [PATCH 026/130] 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 <jaska.uimonen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-8-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 4452594c2e17..32a70ffc149d 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.20.1
+
+
+From 7e68f35584ab3b3242a91431037bc7ed5df568dd Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:36 -0500
+Subject: [PATCH 027/130] 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 <kai.vehmanen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 5a5163eef2ef..103f4273c4d3 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.20.1
+
+
+From beea344394167f3c1f55422f06646a4faa72e697 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:37 -0500
+Subject: [PATCH 028/130] 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 <kai.vehmanen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 34cbc5daae759efa7dd448def5beacd283386cc7 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:38 -0500
+Subject: [PATCH 029/130] 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 <kai.vehmanen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 39844b2b23b8746263988926996db159a3ebbea7 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:43 -0500
+Subject: [PATCH 030/130] 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 <jaska.uimonen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-10-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <linux/pm_runtime.h>
++#include <linux/leds.h>
+ #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 44f789bf7fb0..5a11a8517fa5 100644
+--- a/sound/soc/sof/sof-priv.h
++++ b/sound/soc/sof/sof-priv.h
+@@ -15,6 +15,7 @@
+
+ #include <sound/hdaudio.h>
+ #include <sound/soc.h>
++#include <sound/control.h>
+
+ #include <sound/sof.h>
+ #include <sound/sof/stream.h> /* 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 32a70ffc149d..e150f53d2124 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.20.1
+
+
+From 151d91920fd3e9626541fe9b3d2f6af16f765f8c Mon Sep 17 00:00:00 2001
+From: Daniel Baluta <daniel.baluta@nxp.com>
+Date: Tue, 8 Oct 2019 11:44:39 -0500
+Subject: [PATCH 031/130] 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 <daniel.baluta@nxp.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-6-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <daniel.baluta@nxp.com>
++ */
++
++#ifndef __INCLUDE_SOUND_SOF_DAI_IMX_H__
++#define __INCLUDE_SOUND_SOF_DAI_IMX_H__
++
++#include <sound/sof/header.h>
++
++/* 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 <sound/sof/header.h>
+ #include <sound/sof/dai-intel.h>
++#include <sound/sof/dai-imx.h>
+
+ /*
+ * 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.20.1
+
+
+From 631932d09b78a4b8bbc939342d52631749b3e790 Mon Sep 17 00:00:00 2001
+From: Daniel Baluta <daniel.baluta@nxp.com>
+Date: Tue, 8 Oct 2019 11:44:40 -0500
+Subject: [PATCH 032/130] 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 <daniel.baluta@nxp.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-7-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 e150f53d2124..0adad3246652 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.20.1
+
+
+From 78da07e36b7ae563f64def77a72dc02cf010cd8f Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 11 Oct 2019 11:43:09 -0500
+Subject: [PATCH 033/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191011164312.7988-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 b2597ecfdc1c..07e5efe4945c 100644
+--- a/sound/soc/sof/intel/byt.c
++++ b/sound/soc/sof/intel/byt.c
+@@ -160,20 +160,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.20.1
+
+
+From c1b2c6fecd44be2baa21f763e26a2a98d06708e6 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 11 Oct 2019 11:43:10 -0500
+Subject: [PATCH 034/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191011164312.7988-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 2a49b432e13f3820663d2a6210b1782ee17b0348 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 11 Oct 2019 11:43:11 -0500
+Subject: [PATCH 035/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191011164312.7988-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 0adad3246652..b451e8df77d3 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.20.1
+
+
+From 3c7ba2805c8c4af4e61d2f40ca078fc0fdc9d17b Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 11 Oct 2019 11:43:12 -0500
+Subject: [PATCH 036/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191011164312.7988-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 b451e8df77d3..8032bb8a709c 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.20.1
+
+
+From 3450e41ea1124a2ee3a26849cc00a99ac8df8a67 Mon Sep 17 00:00:00 2001
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Mon, 14 Oct 2019 17:13:08 +0800
+Subject: [PATCH 037/130] 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 <hulkci@huawei.com>
+Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls")
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191014091308.23688-1-yuehaibing@huawei.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 46c0429ba78df9619b0c845dd0377e812cc0ceca Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Tue, 22 Oct 2019 14:28:43 -0500
+Subject: [PATCH 038/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191022192844.21022-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 65c2af3fcaab..7956dbf5be88 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;
+@@ -341,13 +347,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.20.1
+
+
+From c2f63a4a75f4bd02ec46b58dee7468acc0771576 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Tue, 22 Oct 2019 14:28:44 -0500
+Subject: [PATCH 039/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191022192844.21022-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 7956dbf5be88..b1783360fe10 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.20.1
+
+
+From ae6f9d27eca6aa21c2f47b7d22dacc72bc6ff71d Mon Sep 17 00:00:00 2001
+From: Pan Xiuli <xiuli.pan@linux.intel.com>
+Date: Tue, 22 Oct 2019 14:47:05 -0500
+Subject: [PATCH 040/130] 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 <xiuli.pan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191022194705.23347-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 1be28581c328..aac8d5deba3d 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
+@@ -244,6 +245,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.20.1
+
+
+From 7de4b3424a30b11a2ea4d63a6c6d57c9407bf771 Mon Sep 17 00:00:00 2001
+From: Pan Xiuli <xiuli.pan@linux.intel.com>
+Date: Tue, 22 Oct 2019 14:47:04 -0500
+Subject: [PATCH 041/130] 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 <xiuli.pan@linux.intel.com>
+Link: https://lore.kernel.org/r/20191022194705.23347-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <sound/soc-acpi.h>
++#include <sound/soc-acpi-intel-match.h>
++
++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.20.1
+
+
+From a8fbd7629399a706abe19bbad51f2120a60f5f56 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Thu, 24 Oct 2019 16:03:17 -0500
+Subject: [PATCH 042/130] 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 <jaska.uimonen@intel.com>
+Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191024210318.30068-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 2a22b18e5ec0..cfefcfd92798 100644
+--- a/sound/soc/sof/imx/imx8.c
++++ b/sound/soc/sof/imx/imx8.c
+@@ -388,6 +388,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 07e5efe4945c..62edb959f1fc 100644
+--- a/sound/soc/sof/intel/byt.c
++++ b/sound/soc/sof/intel/byt.c
+@@ -532,6 +532,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);
+
+@@ -693,6 +700,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);
+
+@@ -753,6 +767,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 5a11a8517fa5..2d40de5ee285 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.20.1
+
+
+From 67594879a9d4b17f5510ae384b2a7ed77e6d05cc Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Thu, 24 Oct 2019 16:03:18 -0500
+Subject: [PATCH 043/130] 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 <jaska.uimonen@intel.com>
+Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191024210318.30068-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 62edb959f1fc..2abf80b3eb52 100644
+--- a/sound/soc/sof/intel/byt.c
++++ b/sound/soc/sof/intel/byt.c
+@@ -538,7 +538,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);
+
+@@ -706,7 +706,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);
+
+@@ -773,7 +773,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.20.1
+
+
+From af01764721df770ee773faae776429901a9614fe Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Mon, 28 Oct 2019 18:33:29 +0100
+Subject: [PATCH 044/130] 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 <perex@perex.cz>
+Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Cc: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191028173329.29538-1-perex@perex.cz
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From d08a87dcaa98f79927dd564cf6313b6161e33f84 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:10 +0200
+Subject: [PATCH 045/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-3-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 4570f662fb48..6803d39e09a5 100644
+--- a/sound/soc/codecs/hdac_hda.c
++++ b/sound/soc/codecs/hdac_hda.c
+@@ -14,13 +14,11 @@
+ #include <sound/pcm_params.h>
+ #include <sound/soc.h>
+ #include <sound/hdaudio_ext.h>
++#include <sound/hda_i915.h>
+ #include <sound/hda_codec.h>
+ #include <sound/hda_register.h>
+-#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.20.1
+
+
+From 669fa4378c36f288936e3bdc52dfba7b245ea9fe Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:13 +0200
+Subject: [PATCH 046/130] ASoC: SOF: Intel: add support for snd-hda-codec-hdmi
+
+Add support to implement HDMI/DP audio by using the common
+snd-hda-codec-hdmi driver.
+
+Change of codec driver affects user-space as the two
+drivers expose different mixer controls. A new kernel
+module option "use_common_hdmi" is added to user-space
+to indicate which interface should be used. The default
+driver can be selected via a Kconfig option.
+
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-6-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 139c7febad1afa221c687f3314560284e482a1f4)
+Bugzilla: 1772498
+---
+ sound/soc/sof/intel/Kconfig | 10 ++++++++++
+ sound/soc/sof/intel/hda-codec.c | 22 ++++++++++++++++++----
+ sound/soc/sof/intel/hda.c | 6 ++++++
+ sound/soc/sof/intel/hda.h | 6 ++++--
+ 4 files changed, 38 insertions(+), 6 deletions(-)
+
+diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig
+index aac8d5deba3d..95a2d1708dd9 100644
+--- a/sound/soc/sof/intel/Kconfig
++++ b/sound/soc/sof/intel/Kconfig
+@@ -299,6 +299,16 @@ config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1
+ Say Y if you want to enable DMI Link L1
+ If unsure, select "N".
+
++config SND_SOC_SOF_HDA_COMMON_HDMI_CODEC
++ bool "SOF common HDA HDMI codec driver"
++ depends on SND_SOC_SOF_HDA_LINK
++ depends on SND_HDA_CODEC_HDMI
++ help
++ This adds support for HDMI audio by using the common HDA
++ HDMI/DisplayPort codec driver.
++ Say Y if you want to use the common codec driver with SOF.
++ If unsure select "Y".
++
+ endif ## SND_SOC_SOF_HDA_COMMON
+
+ config SND_SOC_SOF_HDA_LINK_BASELINE
+diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
+index 3ca6795a89ba..827f84a0722e 100644
+--- a/sound/soc/sof/intel/hda-codec.c
++++ b/sound/soc/sof/intel/hda-codec.c
+@@ -84,6 +84,8 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)
+ {
+ #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC)
+ struct hdac_hda_priv *hda_priv;
++ struct snd_soc_acpi_mach_params *mach_params = NULL;
++ struct snd_sof_pdata *pdata = sdev->pdata;
+ #endif
+ struct hda_bus *hbus = sof_to_hbus(sdev);
+ struct hdac_device *hdev;
+@@ -113,8 +115,19 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)
+ if (ret < 0)
+ return ret;
+
+- /* use legacy bus only for HDA codecs, idisp uses ext bus */
+- if ((resp & 0xFFFF0000) != IDISP_VID_INTEL) {
++ if (pdata->machine)
++ mach_params = (struct snd_soc_acpi_mach_params *)
++ &pdata->machine->mach_params;
++
++ if ((resp & 0xFFFF0000) == IDISP_VID_INTEL)
++ hda_priv->need_display_power = true;
++
++ /*
++ * if common HDMI codec driver is not used, codec load
++ * is skipped here and hdac_hdmi is used instead
++ */
++ if ((mach_params && mach_params->common_hdmi_codec_drv) ||
++ (resp & 0xFFFF0000) != IDISP_VID_INTEL) {
+ hdev->type = HDA_DEV_LEGACY;
+ hda_codec_load_module(&hda_priv->codec);
+ }
+@@ -155,7 +168,8 @@ int hda_codec_probe_bus(struct snd_sof_dev *sdev)
+ }
+ EXPORT_SYMBOL(hda_codec_probe_bus);
+
+-#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)
++#if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \
++ IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)
+
+ void hda_codec_i915_get(struct snd_sof_dev *sdev)
+ {
+@@ -204,6 +218,6 @@ int hda_codec_i915_exit(struct snd_sof_dev *sdev)
+ }
+ EXPORT_SYMBOL(hda_codec_i915_exit);
+
+-#endif /* CONFIG_SND_SOC_HDAC_HDMI */
++#endif
+
+ MODULE_LICENSE("Dual BSD/GPL");
+diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
+index 103f4273c4d3..7dc0018dc4c3 100644
+--- a/sound/soc/sof/intel/hda.c
++++ b/sound/soc/sof/intel/hda.c
+@@ -53,6 +53,11 @@ MODULE_PARM_DESC(use_msi, "SOF HDA use PCI MSI mode");
+ static int hda_dmic_num = -1;
+ module_param_named(dmic_num, hda_dmic_num, int, 0444);
+ MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number");
++
++static bool hda_codec_use_common_hdmi =
++ IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC);
++module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444);
++MODULE_PARM_DESC(use_common_hdmi, "SOF HDA use common HDMI codec driver");
+ #endif
+
+ static const struct hda_dsp_msg_code hda_dsp_rom_msg[] = {
+@@ -459,6 +464,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
+ &pdata->machine->mach_params;
+ mach_params->codec_mask = bus->codec_mask;
+ mach_params->platform = dev_name(sdev->dev);
++ mach_params->common_hdmi_codec_drv = hda_codec_use_common_hdmi;
+ }
+
+ /* create codec instances */
+diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
+index 8e03d876a0ac..d6ef657b8900 100644
+--- a/sound/soc/sof/intel/hda.h
++++ b/sound/soc/sof/intel/hda.h
+@@ -565,7 +565,9 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev);
+
+ #endif /* CONFIG_SND_SOC_SOF_HDA */
+
+-#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) && IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)
++#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) && \
++ (IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) || \
++ IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
+
+ void hda_codec_i915_get(struct snd_sof_dev *sdev);
+ void hda_codec_i915_put(struct snd_sof_dev *sdev);
+@@ -579,7 +581,7 @@ static inline void hda_codec_i915_put(struct snd_sof_dev *sdev) { }
+ static inline int hda_codec_i915_init(struct snd_sof_dev *sdev) { return 0; }
+ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; }
+
+-#endif /* CONFIG_SND_SOC_SOF_HDA && CONFIG_SND_SOC_HDAC_HDMI */
++#endif
+
+ /*
+ * Trace Control.
+--
+2.20.1
+
+
+From 480f07ccb82555912594c2b6d560fdeb35176b40 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:35 -0500
+Subject: [PATCH 047/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 9ad89d56092b..5fd4be74b7ea 100644
+--- a/sound/soc/intel/Kconfig
++++ b/sound/soc/intel/Kconfig
+@@ -101,6 +101,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 95a2d1708dd9..b6b509151b34 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.20.1
+
+
+From 8a391c34be3b2140c0498675df21523b8246ceb8 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:36 -0500
+Subject: [PATCH 048/130] ASoC: SOF: Intel: Broadwell: clarify mutual exclusion
+ with legacy driver
+
+Some distros select all options blindly, which leads to confusion and
+bug reports. SOF does not fully support Broadwell due to firmware
+dependencies, the machine drivers can only support one option, and
+UCM/topology files are still being propagated to downstream distros,
+so make SOF on Broadwell an opt-in option that first require distros
+to opt-out of existing defaults.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204237
+Fixes: f35bf70f61d3 ('ASoC: Intel: Make sure BDW based machine drivers build for SOF')
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit a6955fe0e2309feeab5ec71e4b0dcbe498f4f497)
+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 5fd4be74b7ea..658eff2daf4e 100644
+--- a/sound/soc/intel/Kconfig
++++ b/sound/soc/intel/Kconfig
+@@ -59,6 +59,9 @@ config SND_SOC_INTEL_HASWELL
+ If you have a Intel Haswell or Broadwell platform connected to
+ an I2S codec, then enable this option by saying Y or m. This is
+ typically used for Chromebooks. This is a recommended option.
++ This option is mutually exclusive with the SOF support on
++ Broadwell. If you want to enable SOF on Broadwell, you need to
++ deselect this option first.
+
+ config SND_SOC_INTEL_BAYTRAIL
+ tristate "Baytrail (legacy) Platforms"
+diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig
+index b6b509151b34..0db9e80b7cef 100644
+--- a/sound/soc/sof/intel/Kconfig
++++ b/sound/soc/sof/intel/Kconfig
+@@ -85,10 +85,18 @@ config SND_SOC_SOF_BAYTRAIL
+
+ config SND_SOC_SOF_BROADWELL_SUPPORT
+ bool "SOF support for Broadwell"
++ depends on SND_SOC_INTEL_HASWELL=n
+ help
+ This adds support for Sound Open Firmware for Intel(R) platforms
+ using the Broadwell processors.
+- Say Y if you have such a device.
++ This option is mutually exclusive with the Haswell/Broadwell legacy
++ driver. If you want to enable SOF on Broadwell you need to deselect
++ the legacy driver first.
++ SOF does fully support Broadwell yet, 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 Broadwell
+ If unsure select "N".
+
+ config SND_SOC_SOF_BROADWELL
+--
+2.20.1
+
+
+From 95761516cf6f36ea1e2e23ca4470c756dc0acda3 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:38 -0500
+Subject: [PATCH 049/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 34edfaf5c61574b5156daeb173476650be7b87a0 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:39 -0500
+Subject: [PATCH 050/130] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF
+ dependency
+
+updated solution to the problem reported with randconfig:
+
+CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
+turn referenced by the sof-of-dev driver. This creates a reverse
+dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
+is built-in but CONFIG_SND_SOC_SOF_IMX=m:
+
+sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
+
+use def_trisate to propagate the right settings without select.
+
+Fixes: f4df4e4042b0 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")
+Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
+Suggested-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-6-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit f9ad75468453b019b92c5296e6a04bf7c37f49e4)
+Bugzilla: 1772498
+---
+ sound/soc/sof/imx/Kconfig | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig
+index 5acae75f5750..71f318bc2c74 100644
+--- a/sound/soc/sof/imx/Kconfig
++++ b/sound/soc/sof/imx/Kconfig
+@@ -11,8 +11,8 @@ config SND_SOC_SOF_IMX_TOPLEVEL
+
+ if SND_SOC_SOF_IMX_TOPLEVEL
+
+-config SND_SOC_SOF_IMX8
+- tristate "SOF support for i.MX8"
++config SND_SOC_SOF_IMX8_SUPPORT
++ bool "SOF support for i.MX8"
+ depends on IMX_SCU
+ depends on IMX_DSP
+ help
+@@ -20,4 +20,8 @@ config SND_SOC_SOF_IMX8
+ Say Y if you have such a device.
+ If unsure select "N".
+
++config SND_SOC_SOF_IMX8
++ def_tristate SND_SOC_SOF_OF
++ depends on SND_SOC_SOF_IMX8_SUPPORT
++
+ endif ## SND_SOC_SOF_IMX_IMX_TOPLEVEL
+--
+2.20.1
+
+
+From 5efd9ba11e644ef74a0c51d543145f116a886438 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:40 -0500
+Subject: [PATCH 051/130] 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 <arnd@arndb.de>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-7-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 0db9e80b7cef..f7c30a08ffbf 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.20.1
+
+
+From 19b52530d84901fdfb1924862f3f82458ad110bc Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzk@kernel.org>
+Date: Fri, 4 Oct 2019 16:49:31 +0200
+Subject: [PATCH 052/130] 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 <krzk@kernel.org>
+Acked-by: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191004144931.3851-1-krzk@kernel.org
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 f7c30a08ffbf..b27fd3fdf335 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.20.1
+
+
+From d04677b943723aa40149b14f28e02a51cdf68080 Mon Sep 17 00:00:00 2001
+From: Sam McNally <sammc@chromium.org>
+Date: Tue, 17 Sep 2019 15:49:33 +1000
+Subject: [PATCH 053/130] ASoC: Intel: cht_bsw_rt5645: Add quirk for boards
+ using pmc_plt_clk_0
+
+As of commit 648e921888ad ("clk: x86: Stop marking clocks as
+CLK_IS_CRITICAL"), the cht_bsw_rt5645 driver needs to enable the clock
+it's using for the codec's mclk. It does this from commit 7735bce05a9c
+("ASoC: Intel: boards: use devm_clk_get() unconditionally"), enabling
+pmc_plt_clk_3. However, Strago family Chromebooks use pmc_plt_clk_0 for
+the codec mclk, resulting in white noise with some digital microphones.
+Add a DMI-based quirk for Strago family Chromebooks to use pmc_plt_clk_0
+instead - mirroring the changes made to cht_bsw_max98090_ti in
+commit a182ecd3809c ("ASoC: intel: cht_bsw_max98090_ti: Add quirk for
+boards using pmc_plt_clk_0") and making use of the existing
+dmi_check_system() call and related infrastructure added in
+commit 22af29114eb4 ("ASoC: Intel: cht-bsw-rt5645: add quirks for
+SSP0/AIF1/AIF2 routing").
+
+Signed-off-by: Sam McNally <sammc@chromium.org>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190917054933.209335-1-sammc@chromium.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit adebb11139029ddf1fba6f796c4a476f17eacddc)
+Bugzilla: 1772498
+---
+ sound/soc/intel/boards/cht_bsw_rt5645.c | 26 +++++++++++++++++++------
+ 1 file changed, 20 insertions(+), 6 deletions(-)
+
+diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
+index 8879c3be29d5..c68a5b85a4a0 100644
+--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
++++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
+@@ -48,6 +48,7 @@ struct cht_mc_private {
+ #define CHT_RT5645_SSP2_AIF2 BIT(16) /* default is using AIF1 */
+ #define CHT_RT5645_SSP0_AIF1 BIT(17)
+ #define CHT_RT5645_SSP0_AIF2 BIT(18)
++#define CHT_RT5645_PMC_PLT_CLK_0 BIT(19)
+
+ static unsigned long cht_rt5645_quirk = 0;
+
+@@ -59,6 +60,8 @@ static void log_quirks(struct device *dev)
+ dev_info(dev, "quirk SSP0_AIF1 enabled");
+ if (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)
+ dev_info(dev, "quirk SSP0_AIF2 enabled");
++ if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0)
++ dev_info(dev, "quirk PMC_PLT_CLK_0 enabled");
+ }
+
+ static int platform_clock_control(struct snd_soc_dapm_widget *w,
+@@ -226,15 +229,21 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream,
+ return 0;
+ }
+
+-/* uncomment when we have a real quirk
+ static int cht_rt5645_quirk_cb(const struct dmi_system_id *id)
+ {
+ cht_rt5645_quirk = (unsigned long)id->driver_data;
+ return 1;
+ }
+-*/
+
+ static const struct dmi_system_id cht_rt5645_quirk_table[] = {
++ {
++ /* Strago family Chromebooks */
++ .callback = cht_rt5645_quirk_cb,
++ .matches = {
++ DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"),
++ },
++ .driver_data = (void *)CHT_RT5645_PMC_PLT_CLK_0,
++ },
+ {
+ },
+ };
+@@ -526,6 +535,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
+ int dai_index = 0;
+ int ret_val = 0;
+ int i;
++ const char *mclk_name;
+
+ drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
+ if (!drv)
+@@ -662,11 +672,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
+ if (ret_val)
+ return ret_val;
+
+- drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
++ if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0)
++ mclk_name = "pmc_plt_clk_0";
++ else
++ mclk_name = "pmc_plt_clk_3";
++
++ drv->mclk = devm_clk_get(&pdev->dev, mclk_name);
+ if (IS_ERR(drv->mclk)) {
+- dev_err(&pdev->dev,
+- "Failed to get MCLK from pmc_plt_clk_3: %ld\n",
+- PTR_ERR(drv->mclk));
++ dev_err(&pdev->dev, "Failed to get MCLK from %s: %ld\n",
++ mclk_name, PTR_ERR(drv->mclk));
+ return PTR_ERR(drv->mclk);
+ }
+
+--
+2.20.1
+
+
+From 83c22d6aef225035385971716098b753ea2d145e Mon Sep 17 00:00:00 2001
+From: Naveen M <naveen.m@intel.com>
+Date: Tue, 15 Oct 2019 00:28:00 +0800
+Subject: [PATCH 054/130] 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 <naveen.m@intel.com>
+Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
+Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
+Signed-off-by: Brent Lu <brent.lu@intel.com>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/1571070480-25666-1-git-send-email-brent.lu@intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 d14ca327c684..ea0005d7d3c8 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 <linux/clk.h>
++#include <linux/clk-provider.h>
++#include <linux/clkdev.h>
+
+ #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" },
+
+@@ -643,6 +708,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)
+@@ -658,6 +724,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.20.1
+
+
+From f80cddbefe9bca88b832b053587286c56a35a6fc Mon Sep 17 00:00:00 2001
+From: Brent Lu <brent.lu@intel.com>
+Date: Fri, 25 Oct 2019 17:11:31 +0800
+Subject: [PATCH 055/130] 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 <brent.lu@intel.com>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/1571994691-20199-1-git-send-email-brent.lu@intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 ea0005d7d3c8..a1056cda3dd7 100644
+--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
++++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
+@@ -653,6 +653,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);
+@@ -692,6 +741,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.20.1
+
+
+From 1b41ab23dfde6f139695afbb1cef0846453a8070 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:11 +0200
+Subject: [PATCH 056/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-4-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <sound/pcm.h>
++#include <sound/soc.h>
++#include <sound/hda_codec.h>
++#include <sound/hda_i915.h>
++#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 <sound/hda_codec.h>
++#include <sound/hda_i915.h>
++#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 58409b6e476e..eb419e1ec42b 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 <sound/hda_codec.h>
++#include "../../codecs/hdac_hda.h"
++
+ #define NAME_SIZE 32
+
+ int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device)
+@@ -136,6 +139,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 <linux/platform_device.h>
+ #include <sound/core.h>
+ #include <sound/jack.h>
++#include <sound/hda_codec.h>
++#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.20.1
+
+
+From b07481ef39cfbbf0caadac6432121bd4d49bd69f Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:12 +0200
+Subject: [PATCH 057/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-5-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <linux/module.h>
+ #include <linux/platform_device.h>
+ #include <sound/core.h>
+--
+2.20.1
+
+
+From 33d568ce43c1a625611c9680c932607183716854 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:14 +0200
+Subject: [PATCH 058/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-7-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 555533e73e096583395ce632a80116c059ce97d5 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:15 +0200
+Subject: [PATCH 059/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-8-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <sound/soc-acpi.h>
+ #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.20.1
+
+
+From d186922c20154420654a00b8b6186df7c0a9f4f3 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:16 +0200
+Subject: [PATCH 060/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-9-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 3f4711fbc1d93be2c68d2eff99baef5d1ae7bb54 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Tue, 29 Oct 2019 15:40:17 +0200
+Subject: [PATCH 061/130] 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 <kai.vehmanen@linux.intel.com>
+Reviewed-by: Takashi Iwai <tiwai@suse.de>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191029134017.18901-10-kai.vehmanen@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <sound/pcm_params.h>
+ #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.20.1
+
+
+From 03a37d6f2b29db4c976ede85c9a605471ea405b3 Mon Sep 17 00:00:00 2001
+From: Naveen Manohar <naveen.m@intel.com>
+Date: Fri, 1 Nov 2019 12:18:46 -0500
+Subject: [PATCH 062/130] 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 <naveen.m@intel.com>
+Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r@intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101171847.26767-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 90dad5c0eeccbe941c5afaca1f60339a5bb31984 Mon Sep 17 00:00:00 2001
+From: Naveen Manohar <naveen.m@intel.com>
+Date: Fri, 1 Nov 2019 12:18:47 -0500
+Subject: [PATCH 063/130] 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 <naveen.m@intel.com>
+Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r@intel.com>
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101171847.26767-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <linux/input.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++#include <linux/clk.h>
++#include <linux/dmi.h>
++#include <linux/slab.h>
++#include <asm/cpu_device_id.h>
++#include <linux/acpi.h>
++#include <sound/core.h>
++#include <sound/jack.h>
++#include <sound/pcm.h>
++#include <sound/pcm_params.h>
++#include <sound/soc.h>
++#include <sound/rt5682.h>
++#include <sound/soc-acpi.h>
++#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 <naveen.m@intel.com>");
++MODULE_AUTHOR("Sathya Prakash M R <sathya.prakash.m.r@intel.com>");
++MODULE_AUTHOR("Shuming Fan <shumingf@realtek.com>");
++MODULE_LICENSE("GPL v2");
++MODULE_ALIAS("platform:cml_rt1011_rt5682");
+--
+2.20.1
+
+
+From 0ce85d8a56990759d10305784278be01bb32633b Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:37 -0500
+Subject: [PATCH 064/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 5626167a66bddb85e0a33735c85dfb45781f4bce Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:41 -0500
+Subject: [PATCH 065/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-8-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 61e12eb73831fdc01c8b251a41ba4851a57c0370 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:42 -0500
+Subject: [PATCH 066/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-9-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 299b13ab242eba943e1d2b54ac43e7148470d435 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:43 -0500
+Subject: [PATCH 067/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-10-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 39c98691a7108dbaeb9bab734553207553111ca5 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:44 -0500
+Subject: [PATCH 068/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-11-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 7b646af780bfa2e42b8e89856172469a540e7186 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:30:45 -0500
+Subject: [PATCH 069/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101173045.27099-12-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 02f03f3b08ed85cb5c0b1c270eb91bc714721641 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 8 Nov 2019 10:46:37 +0100
+Subject: [PATCH 070/130] 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 <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191108094641.20086-5-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 3541bd9bf269e2df13150125f7e417632967e292 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:09 -0500
+Subject: [PATCH 071/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-14-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 145c89d929bcdf53b50c6528997bfc2595883513 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:40:57 -0500
+Subject: [PATCH 072/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 2d40de5ee285..481dfe4ee2d0 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;
+@@ -387,6 +393,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;
+ u32 boot_complete;
+--
+2.20.1
+
+
+From b5d42bad1c65b0b71c7a1115a9d50f25a24c2351 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:40:58 -0500
+Subject: [PATCH 073/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 5998861a9002..8661c2cca76b 100644
+--- a/sound/soc/sof/core.c
++++ b/sound/soc/sof/core.c
+@@ -458,6 +458,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;
+ dev_set_drvdata(dev, sdev);
+diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
+index e23beaeefe00..81e623dfc7e5 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -326,6 +326,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.20.1
+
+
+From 3cf1bbbb4506efc80e8066c4d40e92264f26eec7 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:40:59 -0500
+Subject: [PATCH 074/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 481dfe4ee2d0..e9902e4e8e55 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.20.1
+
+
+From 00b28b09cc4fb52852651219ac1369041484770d Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:00 -0500
+Subject: [PATCH 075/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 d6ef657b8900..21b0e180017a 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.20.1
+
+
+From d2b397a84c59634c88d3750db429f5be2e3a77ae Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:01 -0500
+Subject: [PATCH 076/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-6-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 7cb0adf614bc8d756f22dddd17f9eda4d48d6ee7 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:02 -0500
+Subject: [PATCH 077/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-7-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From e1f3cdb3b898b881acc9465773ff534a26f37cd9 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:03 -0500
+Subject: [PATCH 078/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-8-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 e9902e4e8e55..7a21a45d3635 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.20.1
+
+
+From 84bac6cfab76bb8e71b50054d9576aacb6e4c0d2 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:04 -0500
+Subject: [PATCH 079/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-9-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 8032bb8a709c..c4bc23163497 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.20.1
+
+
+From 178524d176b58f1c218cf1ddf701cfa7fa7a9a04 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:05 -0500
+Subject: [PATCH 080/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-10-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 c4bc23163497..9e3996125d03 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.20.1
+
+
+From 99f21fd84280a7fc9a6f33f8f82b757306db97e7 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:06 -0500
+Subject: [PATCH 081/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-11-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From f672aa4a4452ca0d79a8f6b44c76c0139f6f99ec Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:07 -0500
+Subject: [PATCH 082/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-12-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 21b0e180017a..5a089efc0e4c 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.20.1
+
+
+From e21c6caf57e71006a145a73c117305e0fe2ea512 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:08 -0500
+Subject: [PATCH 083/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-13-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 81e623dfc7e5..ac900fb3379e 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;
+@@ -320,7 +320,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",
+@@ -361,7 +361,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.20.1
+
+
+From 0852a87eb392f8a9d735b60d3a151332da158519 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:10 -0500
+Subject: [PATCH 084/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-15-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From eee9b23d3c152581249c19f492cf21bd1e023a24 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:11 -0500
+Subject: [PATCH 085/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-16-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <yang.jie@linux.intel.com>
++ */
++
++#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.20.1
+
+
+From 325dfda7c31d247932c0ec20eda966bf0ca24512 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:12 -0500
+Subject: [PATCH 086/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-17-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <sound/hda_register.h>
+ #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.20.1
+
+
+From 9ade30b8b3cf0e8d73a89b9ded857c50aeb91a37 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:13 -0500
+Subject: [PATCH 087/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-18-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 ac900fb3379e..584241e9734a 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -411,6 +411,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 7a21a45d3635..2231c673c678 100644
+--- a/sound/soc/sof/sof-priv.h
++++ b/sound/soc/sof/sof-priv.h
+@@ -485,6 +485,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.20.1
+
+
+From cd303b2a36cdc4dd2228147f9a9518da71d88215 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:14 -0500
+Subject: [PATCH 088/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-19-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 5a089efc0e4c..5ad73a34b09c 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.20.1
+
+
+From 8bb4306ead5641b1f9e7d97d0db0d5705b193e79 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:15 -0500
+Subject: [PATCH 089/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-20-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 2231c673c678..e715673f20e5 100644
+--- a/sound/soc/sof/sof-priv.h
++++ b/sound/soc/sof/sof-priv.h
+@@ -398,6 +398,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.20.1
+
+
+From 8d8d925e7051604e82ef12a2dbddf5d77e02e40d Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:16 -0500
+Subject: [PATCH 090/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-21-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 e715673f20e5..c2541d020bde 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.20.1
+
+
+From 3b92b523982d92ab8944be6c739da55889e44878 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:17 -0500
+Subject: [PATCH 091/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-22-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 584241e9734a..99e4e6ffff74 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -439,3 +439,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 c2541d020bde..6408ac88a3e5 100644
+--- a/sound/soc/sof/sof-priv.h
++++ b/sound/soc/sof/sof-priv.h
+@@ -492,6 +492,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.20.1
+
+
+From a8161368f38eb802d5bfc2601420a94076b3527f Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:18 -0500
+Subject: [PATCH 092/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-23-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 9e3996125d03..ad798fb3bb32 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.20.1
+
+
+From 95a260712df9014813aaeb2e8bf3149bcf82572c Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:19 -0500
+Subject: [PATCH 093/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-24-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From fb1833ed7540f40d3c82371bea470e2802fee2a6 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:20 -0500
+Subject: [PATCH 094/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-25-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From a9ff8edc56014d193031b94c32da8d1ca4cd9181 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:21 -0500
+Subject: [PATCH 095/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-26-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 99e4e6ffff74..560a937e0484 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -430,12 +430,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.20.1
+
+
+From 57fa7b6018c8497dbc676a7ed19580ce413c1f93 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 25 Oct 2019 17:41:22 -0500
+Subject: [PATCH 096/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191025224122.7718-27-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 275c9af318fdb56701f9c336ecfdcaf8d05e7b03 Mon Sep 17 00:00:00 2001
+From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:09:16 -0500
+Subject: [PATCH 097/130] 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 <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101170916.26517-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From a547d2de50bd9993d6b1723ece45ad954c042bb5 Mon Sep 17 00:00:00 2001
+From: Jaska Uimonen <jaska.uimonen@linux.intel.com>
+Date: Tue, 8 Oct 2019 11:44:42 -0500
+Subject: [PATCH 098/130] AsoC: SOF: refactor control load code
+
+Move code around to enable token parsing in control load.
+
+Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191008164443.1358-9-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 ad798fb3bb32..d4aea5422ea8 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.20.1
+
+
+From b0ba4b0be937405c5982db296e5d9e57a9239c5a Mon Sep 17 00:00:00 2001
+From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Date: Mon, 4 Nov 2019 14:48:12 -0800
+Subject: [PATCH 099/130] ASoC: SOF: topology: set trigger order for FE DAI
+ link
+
+Set trigger order for FE DAI links to SND_SOC_DPCM_TRIGGER_POST
+to trigger the BE DAI's before the FE DAI's. This prevents the
+xruns seen on playback pipelines using the link DMA.
+
+Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191104224812.3393-3-ranjani.sridharan@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 5eee2b3f60065a2530d13f28e771be48b989eb4c)
+Bugzilla: 1772498
+---
+ sound/soc/sof/topology.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
+index d4aea5422ea8..143b8259a70a 100644
+--- a/sound/soc/sof/topology.c
++++ b/sound/soc/sof/topology.c
+@@ -2952,6 +2952,10 @@ 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;
++
+ /* nothing more to do for FE dai links */
+ return 0;
+ }
+--
+2.20.1
+
+
+From 00e0accc297d44a65b09af38a2d6813467f5b8e9 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Tue, 19 Nov 2019 18:49:32 +0100
+Subject: [PATCH 100/130] 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 <perex@perex.cz>
+Cc: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191119174933.25526-1-perex@perex.cz
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 88978a3036c4..fff910fd933e 100644
+--- a/sound/soc/soc-core.c
++++ b/sound/soc/soc-core.c
+@@ -2095,6 +2095,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.20.1
+
+
+From 15b3f8b52655f2e8eafb5c209c829cd09650ae1f Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Wed, 20 Nov 2019 18:44:34 +0100
+Subject: [PATCH 101/130] 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 <perex@perex.cz>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191120174435.30920-1-perex@perex.cz
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 fff910fd933e..2cbd9796a25f 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.20.1
+
+
+From f77607883b4040fdb1791e4e81402e452a97d1d0 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Wed, 20 Nov 2019 18:44:35 +0100
+Subject: [PATCH 102/130] 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 <perex@perex.cz>
+Link: https://lore.kernel.org/r/20191120174435.30920-2-perex@perex.cz
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 2cbd9796a25f..d42924ff13f1 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.20.1
+
+
+From acab1a3016c11ce7262f08ee5f978ba0fd650d81 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Thu, 21 Nov 2019 10:26:43 +0800
+Subject: [PATCH 103/130] ALSA: hda/realtek - Move some alc256 pintbls to
+ fallback table
+
+We have a new Dell machine which needs to apply the quirk
+ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, try to use the fallback table
+to fix it this time. And we could remove all pintbls of alc256
+for applying DELL1_MIC_NO_PRESENCE on Dell machines.
+
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Link: https://lore.kernel.org/r/20191121022644.8078-1-hui.wang@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit aed8c7f40882015aad45088256231babcbc24482)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 35 +++--------------------------------
+ 1 file changed, 3 insertions(+), 32 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 80f66ba85f87..4c83ed4b0d5c 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7608,38 +7608,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ {0x1b, 0x01011020},
+ {0x21, 0x02211010}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60130},
+- {0x14, 0x90170110},
+- {0x1b, 0x01011020},
+- {0x21, 0x0221101f}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60160},
+- {0x14, 0x90170120},
+- {0x21, 0x02211030}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60170},
+- {0x14, 0x90170120},
+- {0x21, 0x02211030}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60180},
+- {0x14, 0x90170120},
+- {0x21, 0x02211030}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0xb7a60130},
+- {0x14, 0x90170110},
+- {0x21, 0x02211020}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60130},
+- {0x14, 0x90170110},
+- {0x14, 0x01011020},
+- {0x21, 0x0221101f}),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- ALC256_STANDARD_PINS),
+- SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x14, 0x90170110},
+- {0x1b, 0x01011020},
+- {0x21, 0x0221101f}),
+ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
+ {0x14, 0x90170110},
+ {0x1b, 0x90a70130},
+@@ -7852,6 +7820,9 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
+ SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
+ {0x19, 0x40000000},
+ {0x1b, 0x40000000}),
++ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
++ {0x19, 0x40000000},
++ {0x1a, 0x40000000}),
+ {}
+ };
+
+--
+2.20.1
+
+
+From 0ea4ea7f506846d630b9c31bcc9668c34e6f0555 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Thu, 21 Nov 2019 10:26:44 +0800
+Subject: [PATCH 104/130] ALSA: hda/realtek - Move some alc236 pintbls to
+ fallback table
+
+We have a new Dell machine which needs to apply the quirk
+ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, try to use the fallback table
+to fix it this time. And we could remove all pintbls of alc236
+for applying DELL1_MIC_NO_PRESENCE on Dell machines.
+
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Link: https://lore.kernel.org/r/20191121022644.8078-2-hui.wang@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit d64ebdbfd4f71406f58210f5ccb16977b4cd31d2)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 17 +++--------------
+ 1 file changed, 3 insertions(+), 14 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 4c83ed4b0d5c..4ebe104cb592 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7512,20 +7512,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
+ {0x19, 0x02a11020},
+ {0x1a, 0x02a11030},
+ {0x21, 0x0221101f}),
+- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60140},
+- {0x14, 0x90170110},
+- {0x21, 0x02211020}),
+- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x90a60140},
+- {0x14, 0x90170150},
+- {0x21, 0x02211020}),
+- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x21, 0x02211020}),
+- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+- {0x12, 0x40000000},
+- {0x14, 0x90170110},
+- {0x21, 0x02211020}),
+ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
+ {0x14, 0x90170110},
+ {0x21, 0x02211020}),
+@@ -7823,6 +7809,9 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
+ SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+ {0x19, 0x40000000},
+ {0x1a, 0x40000000}),
++ SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
++ {0x19, 0x40000000},
++ {0x1a, 0x40000000}),
+ {}
+ };
+
+--
+2.20.1
+
+
+From 98b36775111220537b7a2c33c8c0b65c79541df7 Mon Sep 17 00:00:00 2001
+From: Hui Wang <hui.wang@canonical.com>
+Date: Thu, 21 Nov 2019 10:54:27 +0800
+Subject: [PATCH 105/130] ALSA: hda/realtek - Enable the headset-mic on a
+ Xiaomi's laptop
+
+The headset on this machine is not defined, after applying the quirk
+ALC256_FIXUP_ASUS_HEADSET_MIC, the headset-mic works well
+
+BugLink: https://bugs.launchpad.net/bugs/1846148
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Hui Wang <hui.wang@canonical.com>
+Link: https://lore.kernel.org/r/20191121025427.8856-1-hui.wang@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 695d1ec3994f9de2cefae80ee2087c95d2e5a2f3)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 4ebe104cb592..bd0c767981b1 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -7248,6 +7248,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
+ SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
+ SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
++ SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
+ SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
+
+ #if 0
+--
+2.20.1
+
+
+From 68b55950038f262d8f2675fa0ccb76bcf9ad398e Mon Sep 17 00:00:00 2001
+From: Jian-Hong Pan <jian-hong@endlessm.com>
+Date: Mon, 25 Nov 2019 17:34:06 +0800
+Subject: [PATCH 106/130] ALSA: hda/realtek - Enable internal speaker of ASUS
+ UX431FLC
+
+Laptops like ASUS UX431FLC and UX431FL can share the same audio quirks.
+But UX431FLC needs one more step to enable the internal speaker: Pull
+the GPIO from CODEC to initialize the AMP.
+
+Fixes: 60083f9e94b2 ("ALSA: hda/realtek - Enable internal speaker & headset mic of ASUS UX431FL")
+Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191125093405.5702-1-jian-hong@endlessm.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 436e25505f3458cc92c7f3c985e9cbc198a98209)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index bd0c767981b1..d2bf70a1d2fd 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5892,6 +5892,7 @@ enum {
+ ALC299_FIXUP_PREDATOR_SPK,
+ ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC,
+ ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
++ ALC294_FIXUP_ASUS_INTSPK_GPIO,
+ };
+
+ static const struct hda_fixup alc269_fixups[] = {
+@@ -6982,6 +6983,13 @@ static const struct hda_fixup alc269_fixups[] = {
+ .chained = true,
+ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
+ },
++ [ALC294_FIXUP_ASUS_INTSPK_GPIO] = {
++ .type = HDA_FIXUP_FUNC,
++ /* The GPIO must be pulled to initialize the AMP */
++ .v.func = alc_fixup_gpio4,
++ .chained = true,
++ .chain_id = ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC
++ },
+ };
+
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -7141,7 +7149,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
+ SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
+ SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+- SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC),
++ SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_GPIO),
+ SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
+ SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
+ SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
+--
+2.20.1
+
+
+From 268e8ce52ad4278f6b94792483d3f8510b435b3e Mon Sep 17 00:00:00 2001
+From: Jens Verwiebe <info@jensverwiebe.de>
+Date: Sun, 24 Nov 2019 13:35:44 +0100
+Subject: [PATCH 107/130] 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 <info@jensverwiebe.de>
+Link: https://lore.kernel.org/r/384d65cd-5e87-91eb-9fc3-e57226f534c6@jensverwiebe.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 98db14f3c44954a5da1239328f4677808d5a3acf Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:09:14 -0500
+Subject: [PATCH 108/130] 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 <keqiao.zhang@intel.com>
+Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101170916.26517-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From d00288a4c998c445288666abb202808ea2d0dd8b Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Fri, 1 Nov 2019 12:09:15 -0500
+Subject: [PATCH 109/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191101170916.26517-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 5ad73a34b09c..18d7e72bf9b7 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.20.1
+
+
+From d1475f9cebf57b062ca025e4d87ecaa8f0955f8e Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:29:01 -0600
+Subject: [PATCH 110/130] 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 <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111222901.19892-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 7dc0018dc4c3..91bd88fddac7 100644
+--- a/sound/soc/sof/intel/hda.c
++++ b/sound/soc/sof/intel/hda.c
+@@ -415,9 +415,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.20.1
+
+
+From 15f2f0826db2cd13a243fde28d9b7a6fd4b0428e Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:33:40 -0600
+Subject: [PATCH 111/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111223343.19986-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 560a937e0484..3204c92f0e7d 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -428,6 +428,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.20.1
+
+
+From a42c0c91a4bb7e180473b81bf98c56384149bd1c Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:33:41 -0600
+Subject: [PATCH 112/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111223343.19986-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 3204c92f0e7d..b89810bf3230 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -416,6 +416,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.20.1
+
+
+From bba0301fd9f218213736d2db9368bbc09346cbb5 Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:33:42 -0600
+Subject: [PATCH 113/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111223343.19986-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 8661c2cca76b..805918d3bcc0 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 6408ac88a3e5..c7c2c70ee4d0 100644
+--- a/sound/soc/sof/sof-priv.h
++++ b/sound/soc/sof/sof-priv.h
+@@ -553,6 +553,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.20.1
+
+
+From 37c30238887254ea800b5913475bd444fe0ba46d Mon Sep 17 00:00:00 2001
+From: Keyon Jie <yang.jie@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:33:43 -0600
+Subject: [PATCH 114/130] 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 <yang.jie@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111223343.19986-5-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 b89810bf3230..0fd5567237a8 100644
+--- a/sound/soc/sof/pm.c
++++ b/sound/soc/sof/pm.c
+@@ -468,7 +468,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);
+@@ -497,7 +497,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.20.1
+
+
+From 21fa58950c58b8b75e38f4cffac87e6058f0f01f Mon Sep 17 00:00:00 2001
+From: Dragos Tarcatu <dragos_tarcatu@mentor.com>
+Date: Mon, 11 Nov 2019 16:20:38 -0600
+Subject: [PATCH 115/130] 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 <paul.olaru@nxp.com>
+Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111222039.19651-1-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 165ac3fd39d420dc48ff9e05142a6e07dbc249e0 Mon Sep 17 00:00:00 2001
+From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:29:00 -0600
+Subject: [PATCH 116/130] 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 <liam.r.girdwood@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111222901.19892-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 6f3f161ac71319c1997170719e119f315a2251f6 Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzk@kernel.org>
+Date: Wed, 20 Nov 2019 21:32:52 +0800
+Subject: [PATCH 117/130] 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 <krzk@kernel.org>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191120133252.6365-1-krzk@kernel.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 b27fd3fdf335..cc09bb606f7d 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.20.1
+
+
+From 716051e31d6ac7c9c195f9f36e9b2d0bb7c1ee39 Mon Sep 17 00:00:00 2001
+From: Ben Zhang <benzh@chromium.org>
+Date: Tue, 5 Nov 2019 17:13:27 -0800
+Subject: [PATCH 118/130] 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 <benzh@chromium.org>
+Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
+Link: https://lore.kernel.org/r/20191106011335.223061-3-cujomalainey@chromium.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 0509dabb0d84b34fe4632eabc8aae3bf699dffb4 Mon Sep 17 00:00:00 2001
+From: Curtis Malainey <cujomalainey@chromium.org>
+Date: Tue, 5 Nov 2019 17:13:34 -0800
+Subject: [PATCH 119/130] 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 <cujomalainey@chromium.org>
+Link: https://lore.kernel.org/r/20191106011335.223061-10-cujomalainey@chromium.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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.20.1
+
+
+From 4ed26c72c431638378a523c30aea7842a84b48d7 Mon Sep 17 00:00:00 2001
+From: Yu-Hsuan Hsu <yuhsuan@chromium.org>
+Date: Tue, 24 Sep 2019 00:29:40 +0800
+Subject: [PATCH 120/130] ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic
+ format constraint
+
+On KBL platform, the microphone is attached to external codec(rt5514)
+instead of PCH. However, TDM slot between PCH and codec is 16 bits only.
+In order to avoid setting wrong format, we should add a constraint to
+force to use 16 bits format forever.
+
+Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20190923162940.199580-1-yuhsuan@chromium.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit e2db787bdcb4f2722ecf410168f0583764634e45)
+Bugzilla: 1772498
+---
+ sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
+index a1056cda3dd7..3e5f6bead229 100644
+--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
++++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
+@@ -465,6 +465,9 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
+ snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+ dmic_constraints);
+
++ runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
++ snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
++
+ return snd_pcm_hw_constraint_list(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
+ }
+--
+2.20.1
+
+
+From 0305b5a5db77305fc43a76efd39aed84c5561f96 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Mon, 11 Nov 2019 16:28:59 -0600
+Subject: [PATCH 121/130] 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 <ranjani.sridharan@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191111222901.19892-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <sound/soc-acpi.h>
++#include <sound/soc-acpi-intel-match.h>
++
++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 <sound/soc-acpi.h>
++#include <sound/soc-acpi-intel-match.h>
++
++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.20.1
+
+
+From 5013754204158edfa1252330c1120226af2dca7f Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Tue, 19 Nov 2019 15:51:38 +0100
+Subject: [PATCH 122/130] ASoC: Intel: bytcr_rt5640: Update quirk for Acer
+ Switch 10 SW5-012 2-in-1
+
+When the Acer Switch 10 SW5-012 quirk was added we did not have
+jack-detection support yet; and the builtin microphone selection of
+the original quirk is wrong too.
+
+Fix the microphone-input quirk and add jack-detection info so that the
+internal-microphone and headphone/set jack on the Switch 10 work properly.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20191119145138.59162-1-hdegoede@redhat.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 0bb887709eb16bdc4b5baddd8337abf3de72917f)
+Bugzilla: 1772498
+---
+ sound/soc/intel/boards/bytcr_rt5640.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
+index 9c1aa4ec9cba..dd2b5ad08659 100644
+--- a/sound/soc/intel/boards/bytcr_rt5640.c
++++ b/sound/soc/intel/boards/bytcr_rt5640.c
+@@ -405,10 +405,12 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
+ },
+- .driver_data = (void *)(BYT_RT5640_IN1_MAP |
+- BYT_RT5640_MCLK_EN |
+- BYT_RT5640_SSP0_AIF1),
+-
++ .driver_data = (void *)(BYT_RT5640_DMIC1_MAP |
++ BYT_RT5640_JD_SRC_JD2_IN4N |
++ BYT_RT5640_OVCD_TH_2000UA |
++ BYT_RT5640_OVCD_SF_0P75 |
++ BYT_RT5640_SSP0_AIF1 |
++ BYT_RT5640_MCLK_EN),
+ },
+ {
+ .matches = {
+--
+2.20.1
+
+
+From 04e4b5accb0405d3ba338dd244fc9c4510f8cd3e Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 2 Dec 2019 08:49:47 +0100
+Subject: [PATCH 123/130] ALSA: hda: Modify stream stripe mask only when needed
+
+The recent commit in HD-audio stream management for changing the
+stripe control seems causing a regression on some platforms. The
+stripe control is currently used only by HDMI codec, and applying the
+stripe mask unconditionally may lead to scratchy and static noises as
+seen on some MacBooks.
+
+For addressing the regression, this patch changes the stream
+management code to apply the stripe mask conditionally only when the
+codec driver requested.
+
+Fixes: 9b6f7e7a296e ("ALSA: hda: program stripe bits for controller")
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204477
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191202074947.1617-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit cb50445130d14a5a609d7cd88db9d0436313c881)
+Bugzilla: 1772498
+---
+ include/sound/hdaudio.h | 1 +
+ sound/hda/hdac_stream.c | 19 ++++++++++++-------
+ sound/pci/hda/patch_hdmi.c | 5 +++++
+ 3 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
+index b260c5fd2337..e05b95e83d5a 100644
+--- a/include/sound/hdaudio.h
++++ b/include/sound/hdaudio.h
+@@ -493,6 +493,7 @@ struct hdac_stream {
+ bool prepared:1;
+ bool no_period_wakeup:1;
+ bool locked:1;
++ bool stripe:1; /* apply stripe control */
+
+ /* timestamp */
+ unsigned long start_wallclk; /* start + minimum wallclk */
+diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
+index d8fe7ff0cd58..f9707fb05efe 100644
+--- a/sound/hda/hdac_stream.c
++++ b/sound/hda/hdac_stream.c
+@@ -96,12 +96,14 @@ void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start)
+ 1 << azx_dev->index,
+ 1 << azx_dev->index);
+ /* set stripe control */
+- if (azx_dev->substream)
+- stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream);
+- else
+- stripe_ctl = 0;
+- snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK,
+- stripe_ctl);
++ if (azx_dev->stripe) {
++ if (azx_dev->substream)
++ stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream);
++ else
++ stripe_ctl = 0;
++ snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK,
++ stripe_ctl);
++ }
+ /* set DMA start and interrupt mask */
+ snd_hdac_stream_updateb(azx_dev, SD_CTL,
+ 0, SD_CTL_DMA_START | SD_INT_MASK);
+@@ -118,7 +120,10 @@ void snd_hdac_stream_clear(struct hdac_stream *azx_dev)
+ snd_hdac_stream_updateb(azx_dev, SD_CTL,
+ SD_CTL_DMA_START | SD_INT_MASK, 0);
+ snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */
+- snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, 0);
++ if (azx_dev->stripe) {
++ snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK, 0);
++ azx_dev->stripe = 0;
++ }
+ azx_dev->running = false;
+ }
+ EXPORT_SYMBOL_GPL(snd_hdac_stream_clear);
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index 71848dce0025..b35652cae616 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -32,6 +32,7 @@
+ #include <sound/hda_codec.h>
+ #include "hda_local.h"
+ #include "hda_jack.h"
++#include "hda_controller.h"
+
+ static bool static_hdmi_pcm;
+ module_param(static_hdmi_pcm, bool, 0644);
+@@ -1222,6 +1223,10 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
+ per_pin->cvt_nid = per_cvt->cvt_nid;
+ hinfo->nid = per_cvt->cvt_nid;
+
++ /* flip stripe flag for the assigned stream if supported */
++ if (get_wcaps(codec, per_cvt->cvt_nid) & AC_WCAP_STRIPE)
++ azx_stream(get_azx_dev(substream))->stripe = 1;
++
+ snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id);
+ snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
+ AC_VERB_SET_CONNECT_SEL,
+--
+2.20.1
+
+
+From 418156f40c1686839ff690363a6174049cebf3e8 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Fri, 29 Nov 2019 15:40:27 +0100
+Subject: [PATCH 124/130] ALSA: hda - fixup for the bass speaker on Lenovo
+ Carbon X1 7th gen
+
+The auto-parser assigns the bass speaker to DAC3 (NID 0x06) which
+is without the volume control. I do not see a reason to use DAC2,
+because the shared output to all speakers produces the sufficient
+and well balanced sound. The stereo support is enough for this
+purpose (laptop).
+
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+Link: https://lore.kernel.org/r/20191129144027.14765-1-perex@perex.cz
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit d2cd795c4ece1a24fda170c35eeb4f17d9826cbb)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index d2bf70a1d2fd..a596790d4245 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -5544,6 +5544,16 @@ static void alc295_fixup_disable_dac3(struct hda_codec *codec,
+ }
+ }
+
++/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
++static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
++ hda_nid_t conn[1] = { 0x02 };
++ snd_hda_override_conn_list(codec, 0x17, 1, conn);
++ }
++}
++
+ /* Hook to update amp GPIO4 for automute */
+ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
+ struct hda_jack_callback *jack)
+@@ -5846,6 +5856,7 @@ enum {
+ ALC225_FIXUP_DISABLE_MIC_VREF,
+ ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
+ ALC295_FIXUP_DISABLE_DAC3,
++ ALC285_FIXUP_SPEAKER2_TO_DAC1,
+ ALC280_FIXUP_HP_HEADSET_MIC,
+ ALC221_FIXUP_HP_FRONT_MIC,
+ ALC292_FIXUP_TPT460,
+@@ -6646,6 +6657,10 @@ static const struct hda_fixup alc269_fixups[] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc295_fixup_disable_dac3,
+ },
++ [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = alc285_fixup_speaker2_to_dac1,
++ },
+ [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -7221,6 +7236,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
+ SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
++ SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
+ SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+ SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
+@@ -7405,6 +7421,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
+ {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
+ {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
+ {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
++ {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
+ {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
+ {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
+ {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
+--
+2.20.1
+
+
+From a7ff4a018897902cb76e6946162f452e99747a0b Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 22 Nov 2019 14:26:24 +0100
+Subject: [PATCH 125/130] 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 <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 b35652cae616..5393da45b250 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2311,8 +2311,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.20.1
+
+
+From 396bdfdd1a2a119b724148d1e6911c6c1f76722b Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 22 Nov 2019 16:43:50 -0500
+Subject: [PATCH 126/130] 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 <tiwai@suse.de>
+Acked-by: Evan Quan <evan.quan@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Link: https://lore.kernel.org/r/20191122214353.582899-2-alexander.deucher@amd.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 e76a0bb6d3cf..ff098957e30f 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -35,6 +35,7 @@
+ #include <linux/clocksource.h>
+ #include <linux/time.h>
+ #include <linux/completion.h>
++#include <linux/acpi.h>
+
+ #ifdef CONFIG_X86
+ /* for snoop control */
+@@ -1401,6 +1402,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
+ */
+@@ -1412,6 +1441,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.20.1
+
+
+From a7347cade76e5cf325b36b01fd40fc8471c770a4 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 22 Nov 2019 16:43:51 -0500
+Subject: [PATCH 127/130] 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 <tiwai@suse.de>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Link: https://lore.kernel.org/r/20191122214353.582899-3-alexander.deucher@amd.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 ff098957e30f..bc64d1565868 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -2599,6 +2599,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.20.1
+
+
+From 0caa4b472c884305fe9412cfbab077ad043e92c4 Mon Sep 17 00:00:00 2001
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Date: Wed, 20 Nov 2019 16:20:35 +0800
+Subject: [PATCH 128/130] ALSA: hda - Add mute led support for HP ProBook 645
+ G4
+
+Mic mute led does not work on HP ProBook 645 G4.
+We can use CXT_FIXUP_MUTE_LED_GPIO fixup to support it.
+
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191120082035.18937-1-kai.heng.feng@canonical.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit e190de6941db14813032af87873f5550ad5764fe)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_conexant.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
+index 968d3caab6ac..90aa0f400a57 100644
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -910,6 +910,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
+ SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO),
+ SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
++ SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO),
+ SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
+ SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE),
+--
+2.20.1
+
+
+From addcf5abf004336c8a1a29244a1bbcf66a08414f Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 28 Nov 2019 21:26:30 +0100
+Subject: [PATCH 129/130] ALSA: hda/realtek - Fix inverted bass GPIO pin on
+ Acer 8951G
+
+We've added the bass speaker support on Acer 8951G by the commit
+00066e9733f6 ("Add Acer Aspire Ethos 8951G model quirk"), but it seems
+that the GPIO pin was wrongly set: while the commit turns off the bit
+to power up the amp, the actual hardware reacts other way round,
+i.e. GPIO bit on = amp on.
+
+So this patch fixes the bug, turning on the GPIO bit 0x02 as default.
+Since turning on the GPIO bit can be more easily managed with
+alc_setup_gpio() call, we simplify the quirk code by integrating the
+GPIO setup into the existing alc662_fixup_aspire_ethos_hp() and
+dropping the whole ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER quirk.
+
+Fixes: 00066e9733f6 ("Add Acer Aspire Ethos 8951G model quirk")
+Reported-and-tested-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191128202630.6626-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 336820c4374bc065317f247dc2bb37c0e41b64a6)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 17 +++--------------
+ 1 file changed, 3 insertions(+), 14 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index a596790d4245..c84cabadaf69 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -8441,6 +8441,8 @@ static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
+ case HDA_FIXUP_ACT_PRE_PROBE:
+ snd_hda_jack_detect_enable_callback(codec, 0x1b,
+ alc662_aspire_ethos_mute_speakers);
++ /* subwoofer needs an extra GPIO setting to become audible */
++ alc_setup_gpio(codec, 0x02);
+ break;
+ case HDA_FIXUP_ACT_INIT:
+ /* Make sure to start in a correct state, i.e. if
+@@ -8523,7 +8525,6 @@ enum {
+ ALC662_FIXUP_USI_HEADSET_MODE,
+ ALC662_FIXUP_LENOVO_MULTI_CODECS,
+ ALC669_FIXUP_ACER_ASPIRE_ETHOS,
+- ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER,
+ ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
+ };
+
+@@ -8855,18 +8856,6 @@ static const struct hda_fixup alc662_fixups[] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc662_fixup_aspire_ethos_hp,
+ },
+- [ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER] = {
+- .type = HDA_FIXUP_VERBS,
+- /* subwoofer needs an extra GPIO setting to become audible */
+- .v.verbs = (const struct hda_verb[]) {
+- {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
+- {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
+- {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
+- { }
+- },
+- .chained = true,
+- .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
+- },
+ [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+@@ -8876,7 +8865,7 @@ static const struct hda_fixup alc662_fixups[] = {
+ { }
+ },
+ .chained = true,
+- .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_SUBWOOFER
++ .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
+ },
+ };
+
+--
+2.20.1
+
+
+From 251ba1fbf100a47f2e4599dada0bf75cc8f8f65b Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Tue, 26 Nov 2019 17:04:23 +0800
+Subject: [PATCH 130/130] ALSA: hda/realtek - Dell headphone has noise on
+ unmute for ALC236
+
+headphone have noise even the volume is very small.
+Let it fill up pcbeep hidden register to default value.
+The issue was gone.
+
+Fixes: 4344aec84bd8 ("ALSA: hda/realtek - New codec support for ALC256")
+Fixes: 736f20a70608 ("ALSA: hda/realtek - Add support for ALC236/ALC3204")
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/9ae47f23a64d4e41a9c81e263cd8a250@realtek.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit e1e8c1fdce8b00fce08784d9d738c60ebf598ebc)
+Bugzilla: 1772498
+---
+ sound/pci/hda/patch_realtek.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index c84cabadaf69..6d6e34b3b3aa 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -367,9 +367,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
+ case 0x10ec0215:
+ case 0x10ec0233:
+ case 0x10ec0235:
+- case 0x10ec0236:
+ case 0x10ec0255:
+- case 0x10ec0256:
+ case 0x10ec0257:
+ case 0x10ec0282:
+ case 0x10ec0283:
+@@ -381,6 +379,11 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
+ case 0x10ec0300:
+ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
+ break;
++ case 0x10ec0236:
++ case 0x10ec0256:
++ alc_write_coef_idx(codec, 0x36, 0x5757);
++ alc_update_coef_idx(codec, 0x10, 1<<9, 0);
++ break;
+ case 0x10ec0275:
+ alc_update_coef_idx(codec, 0xe, 0, 1<<0);
+ break;
+--
+2.20.1
+
diff --git a/alsa-5.6.patch b/alsa-5.6.patch
new file mode 100644
index 000000000..b128cc7e6
--- /dev/null
+++ b/alsa-5.6.patch
@@ -0,0 +1,390 @@
+From 4ef91c45a5a283dc8899402bc68adfe0aa9a026d Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+Date: Wed, 4 Dec 2019 15:15:44 -0600
+Subject: [PATCH 1/4] ASoC: intel/skl/hda - export number of digital
+ microphones via control components
+
+It is required for the auto-detection in the user space (for UCM).
+
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Cc: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191204211556.12671-2-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(cherry picked from commit 8cd9956f61c65022209ce6d1e55ed12aea12357d)
+Bugzilla: 1772498
+---
+ sound/soc/intel/boards/skl_hda_dsp_generic.c | 8 ++++++++
+ sound/soc/sof/intel/hda.c | 3 ++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c
+index 4e45901e3a2f..11eaee9ae41f 100644
+--- a/sound/soc/intel/boards/skl_hda_dsp_generic.c
++++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c
+@@ -100,6 +100,8 @@ static struct snd_soc_card hda_soc_card = {
+ .late_probe = skl_hda_card_late_probe,
+ };
+
++static char hda_soc_components[30];
++
+ #define IDISP_DAI_COUNT 3
+ #define HDAC_DAI_COUNT 2
+ #define DMIC_DAI_COUNT 2
+@@ -183,6 +185,12 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
+ hda_soc_card.dev = &pdev->dev;
+ snd_soc_card_set_drvdata(&hda_soc_card, ctx);
+
++ if (mach->mach_params.dmic_num > 0) {
++ snprintf(hda_soc_components, sizeof(hda_soc_components),
++ "cfg-dmics:%d", mach->mach_params.dmic_num);
++ hda_soc_card.components = hda_soc_components;
++ }
++
+ return devm_snd_soc_register_card(&pdev->dev, &hda_soc_card);
+ }
+
+diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
+index 91bd88fddac7..eea01f75d23d 100644
+--- a/sound/soc/sof/intel/hda.c
++++ b/sound/soc/sof/intel/hda.c
+@@ -351,7 +351,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
+ const char *tplg_filename;
+ const char *idisp_str;
+ const char *dmic_str;
+- int dmic_num;
++ int dmic_num = 0;
+ int codec_num = 0;
+ int i;
+ #endif
+@@ -472,6 +472,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
+ mach_params->codec_mask = bus->codec_mask;
+ mach_params->platform = dev_name(sdev->dev);
+ mach_params->common_hdmi_codec_drv = hda_codec_use_common_hdmi;
++ mach_params->dmic_num = dmic_num;
+ }
+
+ /* create codec instances */
+--
+2.20.1
+
+
+From 89be5f69889f7e9aeab05279869bba3e9e0d2002 Mon Sep 17 00:00:00 2001
+From: Jaroslav Kysela <perex@perex.cz>
+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 <perex@perex.cz>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Cc: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191204211556.12671-3-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <perex@perex.cz>
+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 <perex@perex.cz>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Cc: Mark Brown <broonie@kernel.org>
+Link: https://lore.kernel.org/r/20191204211556.12671-4-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+
+Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
+(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 <perex@perex.cz>
+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 <perex@perex.cz>
+---
+ 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
+
diff --git a/configs/fedora/generic/arm/CONFIG_USB_EHCI_HCD b/configs/fedora/generic/arm/CONFIG_USB_EHCI_HCD
deleted file mode 100644
index a2df656e0..000000000
--- a/configs/fedora/generic/arm/CONFIG_USB_EHCI_HCD
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_USB_EHCI_HCD=m
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH
new file mode 100644
index 000000000..9d675be4d
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH
@@ -0,0 +1 @@
+CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH=m
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH
new file mode 100644
index 000000000..324a48c5f
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH
@@ -0,0 +1 @@
+CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH=m
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
index e109ab25a..eb1b21982 100644
--- a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
@@ -1 +1 @@
-CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=y
+# CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC~ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC~
new file mode 100644
index 000000000..4181a1dd2
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC~
@@ -0,0 +1 @@
+CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=n
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH
new file mode 100644
index 000000000..c13580570
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH
@@ -0,0 +1,2 @@
+CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH=m
+
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH~ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH~
new file mode 100644
index 000000000..bad67ba0e
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH~
@@ -0,0 +1 @@
+# CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH is not set
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH
new file mode 100644
index 000000000..c11d5fcea
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH
@@ -0,0 +1 @@
+CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH=m
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES
new file mode 100644
index 000000000..1e007232f
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES
@@ -0,0 +1 @@
+CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT
new file mode 100644
index 000000000..fa0eee213
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_APOLLOLAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT
new file mode 100644
index 000000000..893908b7d
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_CANNONLAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT
new file mode 100644
index 000000000..711e96855
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT
new file mode 100644
index 000000000..f2d98813b
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT
new file mode 100644
index 000000000..eca28b0b2
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT
new file mode 100644
index 000000000..efe93bc3e
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT
new file mode 100644
index 000000000..9b6b0ebe3
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1
new file mode 100644
index 000000000..3d5403951
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1
@@ -0,0 +1 @@
+# CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 is not set
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1~ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1~
new file mode 100644
index 000000000..df1d44aef
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1~
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1=n
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC
new file mode 100644
index 000000000..32dfcb2bc
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC
new file mode 100644
index 000000000..432d9eb42
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_LINK b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_LINK
new file mode 100644
index 000000000..3d4aa71ce
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_HDA_LINK
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_HDA_LINK=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT
new file mode 100644
index 000000000..acd67f035
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL
index a8070bb58..93748db03 100644
--- a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL
@@ -1 +1 @@
-# CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL is not set
+CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT
new file mode 100644
index 000000000..d25aaa73d
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT
new file mode 100644
index 000000000..aa1c7a699
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT=y
diff --git a/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT
new file mode 100644
index 000000000..616056ec4
--- /dev/null
+++ b/configs/fedora/generic/x86/CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT
@@ -0,0 +1 @@
+CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT=y
diff --git a/kernel-aarch64-debug-fedora.config b/kernel-aarch64-debug-fedora.config
index d6706a037..167933e16 100644
--- a/kernel-aarch64-debug-fedora.config
+++ b/kernel-aarch64-debug-fedora.config
@@ -6698,9 +6698,9 @@ CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_EG20T is not set
CONFIG_USB_EHCI_FSL=m
-CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_ORION=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
+CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_MXC is not set
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TEGRA=m
diff --git a/kernel-aarch64-fedora.config b/kernel-aarch64-fedora.config
index 71568fc8a..0574ba3e3 100644
--- a/kernel-aarch64-fedora.config
+++ b/kernel-aarch64-fedora.config
@@ -6676,9 +6676,9 @@ CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_EG20T is not set
CONFIG_USB_EHCI_FSL=m
-CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_ORION=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
+CONFIG_USB_EHCI_HCD=y
# CONFIG_USB_EHCI_MXC is not set
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TEGRA=m
diff --git a/kernel-armv7hl-debug-fedora.config b/kernel-armv7hl-debug-fedora.config
index 08c34c836..ca2ef034c 100644
--- a/kernel-armv7hl-debug-fedora.config
+++ b/kernel-armv7hl-debug-fedora.config
@@ -6949,11 +6949,11 @@ CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_EG20T is not set
CONFIG_USB_EHCI_EXYNOS=m
# CONFIG_USB_EHCI_FSL is not set
-CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_OMAP=m
CONFIG_USB_EHCI_HCD_ORION=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
CONFIG_USB_EHCI_HCD_STI=m
+CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_MV=m
# CONFIG_USB_EHCI_MV_U2O is not set
CONFIG_USB_EHCI_MXC=m
diff --git a/kernel-armv7hl-fedora.config b/kernel-armv7hl-fedora.config
index 3440ad0a8..f00f13893 100644
--- a/kernel-armv7hl-fedora.config
+++ b/kernel-armv7hl-fedora.config
@@ -6928,11 +6928,11 @@ CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_EG20T is not set
CONFIG_USB_EHCI_EXYNOS=m
# CONFIG_USB_EHCI_FSL is not set
-CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_OMAP=m
CONFIG_USB_EHCI_HCD_ORION=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
CONFIG_USB_EHCI_HCD_STI=m
+CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_MV=m
# CONFIG_USB_EHCI_MV_U2O is not set
CONFIG_USB_EHCI_MXC=m
diff --git a/kernel-armv7hl-lpae-debug-fedora.config b/kernel-armv7hl-lpae-debug-fedora.config
index 01e72756a..59de8d9c7 100644
--- a/kernel-armv7hl-lpae-debug-fedora.config
+++ b/kernel-armv7hl-lpae-debug-fedora.config
@@ -6618,9 +6618,9 @@ CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_EG20T is not set
CONFIG_USB_EHCI_EXYNOS=m
# CONFIG_USB_EHCI_FSL is not set
-CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_ORION=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
+CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TEGRA=m
CONFIG_USB_EHCI_TT_NEWSCHED=y
diff --git a/kernel-armv7hl-lpae-fedora.config b/kernel-armv7hl-lpae-fedora.config
index 093af1efa..c9454cd33 100644
--- a/kernel-armv7hl-lpae-fedora.config
+++ b/kernel-armv7hl-lpae-fedora.config
@@ -6597,9 +6597,9 @@ CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_EG20T is not set
CONFIG_USB_EHCI_EXYNOS=m
# CONFIG_USB_EHCI_FSL is not set
-CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_HCD_ORION=m
CONFIG_USB_EHCI_HCD_PLATFORM=m
+CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TEGRA=m
CONFIG_USB_EHCI_TT_NEWSCHED=y
diff --git a/kernel-i686-debug-fedora.config b/kernel-i686-debug-fedora.config
index 8fb6ca2ff..c174b8623 100644
--- a/kernel-i686-debug-fedora.config
+++ b/kernel-i686-debug-fedora.config
@@ -5376,7 +5376,9 @@ CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m
CONFIG_SND_SOC_INTEL_CML_H=m
+CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_CML_LP=m
+CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH=m
# CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH is not set
CONFIG_SND_SOC_INTEL_HASWELL=m
CONFIG_SND_SOC_INTEL_HASWELL_MACH=m
@@ -5389,11 +5391,14 @@ CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH=m
CONFIG_SND_SOC_INTEL_SKL_RT286_MACH=m
-CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=y
+# CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
CONFIG_SND_SOC_INTEL_SKYLAKE=m
+CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH=m
+CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH=m
CONFIG_SND_SOC_INTEL_SST_ACPI=m
CONFIG_SND_SOC_INTEL_SST=m
CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y
+CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES=y
CONFIG_SND_SOC=m
CONFIG_SND_SOC_MAX9759=m
CONFIG_SND_SOC_MAX98088=m
@@ -5432,13 +5437,28 @@ CONFIG_SND_SOC_RT5660=m
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_CANNONLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT=y
# CONFIG_SND_SOC_SOF_DEBUG is not set
-# CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL is not set
+CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT=y
+# CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 is not set
+CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_LINK=y
+CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
+CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT=y
# CONFIG_SND_SOC_SOF_NOCODEC is not set
# CONFIG_SND_SOC_SOF_NOCODEC_SUPPORT is not set
# CONFIG_SND_SOC_SOF_OF is not set
CONFIG_SND_SOC_SOF_PCI=m
# CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS is not set
+CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT=y
CONFIG_SND_SOC_SOF_TOPLEVEL=y
CONFIG_SND_SOC_SPDIF=m
# CONFIG_SND_SOC_SSM2305 is not set
diff --git a/kernel-i686-fedora.config b/kernel-i686-fedora.config
index 987144b0b..e5c5bb988 100644
--- a/kernel-i686-fedora.config
+++ b/kernel-i686-fedora.config
@@ -5355,7 +5355,9 @@ CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m
CONFIG_SND_SOC_INTEL_CML_H=m
+CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_CML_LP=m
+CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH=m
# CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH is not set
CONFIG_SND_SOC_INTEL_HASWELL=m
CONFIG_SND_SOC_INTEL_HASWELL_MACH=m
@@ -5368,11 +5370,14 @@ CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH=m
CONFIG_SND_SOC_INTEL_SKL_RT286_MACH=m
-CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=y
+# CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
CONFIG_SND_SOC_INTEL_SKYLAKE=m
+CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH=m
+CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH=m
CONFIG_SND_SOC_INTEL_SST_ACPI=m
CONFIG_SND_SOC_INTEL_SST=m
CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y
+CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES=y
CONFIG_SND_SOC=m
CONFIG_SND_SOC_MAX9759=m
CONFIG_SND_SOC_MAX98088=m
@@ -5411,13 +5416,28 @@ CONFIG_SND_SOC_RT5660=m
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_CANNONLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT=y
# CONFIG_SND_SOC_SOF_DEBUG is not set
-# CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL is not set
+CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT=y
+# CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 is not set
+CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_LINK=y
+CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
+CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT=y
# CONFIG_SND_SOC_SOF_NOCODEC is not set
# CONFIG_SND_SOC_SOF_NOCODEC_SUPPORT is not set
# CONFIG_SND_SOC_SOF_OF is not set
CONFIG_SND_SOC_SOF_PCI=m
# CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS is not set
+CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT=y
CONFIG_SND_SOC_SOF_TOPLEVEL=y
CONFIG_SND_SOC_SPDIF=m
# CONFIG_SND_SOC_SSM2305 is not set
diff --git a/kernel-x86_64-debug-fedora.config b/kernel-x86_64-debug-fedora.config
index fb2a17a8f..0cf92751d 100644
--- a/kernel-x86_64-debug-fedora.config
+++ b/kernel-x86_64-debug-fedora.config
@@ -5427,7 +5427,9 @@ CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m
CONFIG_SND_SOC_INTEL_CML_H=m
+CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_CML_LP=m
+CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH=m
# CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH is not set
CONFIG_SND_SOC_INTEL_HASWELL=m
CONFIG_SND_SOC_INTEL_HASWELL_MACH=m
@@ -5440,11 +5442,14 @@ CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH=m
CONFIG_SND_SOC_INTEL_SKL_RT286_MACH=m
-CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=y
+# CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
CONFIG_SND_SOC_INTEL_SKYLAKE=m
+CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH=m
+CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH=m
CONFIG_SND_SOC_INTEL_SST_ACPI=m
CONFIG_SND_SOC_INTEL_SST=m
CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y
+CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES=y
CONFIG_SND_SOC=m
CONFIG_SND_SOC_MAX9759=m
CONFIG_SND_SOC_MAX98088=m
@@ -5483,13 +5488,28 @@ CONFIG_SND_SOC_RT5660=m
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_CANNONLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT=y
# CONFIG_SND_SOC_SOF_DEBUG is not set
-# CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL is not set
+CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT=y
+# CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 is not set
+CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_LINK=y
+CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
+CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT=y
# CONFIG_SND_SOC_SOF_NOCODEC is not set
# CONFIG_SND_SOC_SOF_NOCODEC_SUPPORT is not set
# CONFIG_SND_SOC_SOF_OF is not set
CONFIG_SND_SOC_SOF_PCI=m
# CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS is not set
+CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT=y
CONFIG_SND_SOC_SOF_TOPLEVEL=y
CONFIG_SND_SOC_SPDIF=m
# CONFIG_SND_SOC_SSM2305 is not set
diff --git a/kernel-x86_64-fedora.config b/kernel-x86_64-fedora.config
index e1c7dfd36..48513f24b 100644
--- a/kernel-x86_64-fedora.config
+++ b/kernel-x86_64-fedora.config
@@ -5406,7 +5406,9 @@ CONFIG_SND_SOC_INTEL_CHT_BSW_NAU8824_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH=m
CONFIG_SND_SOC_INTEL_CHT_BSW_RT5672_MACH=m
CONFIG_SND_SOC_INTEL_CML_H=m
+CONFIG_SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_CML_LP=m
+CONFIG_SND_SOC_INTEL_GLK_DA7219_MAX98357A_MACH=m
# CONFIG_SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH is not set
CONFIG_SND_SOC_INTEL_HASWELL=m
CONFIG_SND_SOC_INTEL_HASWELL_MACH=m
@@ -5419,11 +5421,14 @@ CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH=m
CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH=m
CONFIG_SND_SOC_INTEL_SKL_RT286_MACH=m
-CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC=y
+# CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
CONFIG_SND_SOC_INTEL_SKYLAKE=m
+CONFIG_SND_SOC_INTEL_SOF_CML_RT1011_RT5682_MACH=m
+CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH=m
CONFIG_SND_SOC_INTEL_SST_ACPI=m
CONFIG_SND_SOC_INTEL_SST=m
CONFIG_SND_SOC_INTEL_SST_TOPLEVEL=y
+CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES=y
CONFIG_SND_SOC=m
CONFIG_SND_SOC_MAX9759=m
CONFIG_SND_SOC_MAX98088=m
@@ -5462,13 +5467,28 @@ CONFIG_SND_SOC_RT5660=m
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_CANNONLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COFFEELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_H_SUPPORT=y
+CONFIG_SND_SOC_SOF_COMETLAKE_LP_SUPPORT=y
# CONFIG_SND_SOC_SOF_DEBUG is not set
-# CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL is not set
+CONFIG_SND_SOC_SOF_ELKHARTLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_GEMINILAKE_SUPPORT=y
+# CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 is not set
+CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y
+CONFIG_SND_SOC_SOF_HDA_LINK=y
+CONFIG_SND_SOC_SOF_ICELAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
+CONFIG_SND_SOC_SOF_JASPERLAKE_SUPPORT=y
+CONFIG_SND_SOC_SOF_MERRIFIELD_SUPPORT=y
# CONFIG_SND_SOC_SOF_NOCODEC is not set
# CONFIG_SND_SOC_SOF_NOCODEC_SUPPORT is not set
# CONFIG_SND_SOC_SOF_OF is not set
CONFIG_SND_SOC_SOF_PCI=m
# CONFIG_SND_SOC_SOF_STRICT_ABI_CHECKS is not set
+CONFIG_SND_SOC_SOF_TIGERLAKE_SUPPORT=y
CONFIG_SND_SOC_SOF_TOPLEVEL=y
CONFIG_SND_SOC_SPDIF=m
# CONFIG_SND_SOC_SSM2305 is not set
diff --git a/kernel.spec b/kernel.spec
index 1d5390275..374dc38e1 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -883,6 +883,16 @@ Patch535: 0001-libertas-fix-a-potential-NULL-pointer-dereference.patch
# rhbz 1769600
Patch536: powerpc-xive-skip-ioremap-of-ESB-pages-for-LSI-interrupts.patch
+# rhbz 1781762
+Patch537: 0001-bdev-Factor-out-bdev-revalidation-into-a-common-help.patch
+Patch538: 0002-bdev-Refresh-bdev-size-for-disks-without-partitionin.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)
+Patch607: alsa-5.6.patch
+
# END OF PATCH DEFINITIONS
%endif
@@ -1751,6 +1761,9 @@ BuildKernel() {
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/extra
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/internal
mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/updates
+ # CONFIG_KERNEL_HEADER_TEST generates some extra files in the process of
+ # testing so just delete
+ find . -name *.h.s -delete
# first copy everything
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
@@ -2584,6 +2597,9 @@ fi
#
#
%changelog
+* Tue Dec 10 2019 Laura Abbott <labbott@redhat.com>
+- Fix for DVD reading (rhbz 1781762)
+
* Wed Dec 04 2019 Jeremy Cline <jcline@redhat.com> - 5.4.2-300
- Linux v5.4.2