All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Xiong Zhang <xiong.y.zhang@intel.com>,
	Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 3.14 12/59] ALSA: hda - Set SKL+ hda controller power at freeze() and thaw()
Date: Wed, 27 Jan 2016 10:15:00 -0800	[thread overview]
Message-ID: <20160127180736.113543773@linuxfoundation.org> (raw)
In-Reply-To: <20160127180730.588995883@linuxfoundation.org>

3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Xiong Zhang <xiong.y.zhang@intel.com>

commit 3e6db33aaf1d42a30339f831ec4850570d6cc7a3 upstream.

It takes three minutes to enter into hibernation on some OEM SKL
machines and we see many codec spurious response after thaw() opertion.
This is because HDA is still in D0 state after freeze() call and
pci_pm_freeze/pci_pm_freeze_noirq() don't set D3 hot in pci_bus driver.
It seems bios still access HDA when system enter into freeze state,
HDA will receive codec response interrupt immediately after thaw() call.
Because of this unexpected interrupt, HDA enter into a abnormal
state and slow down the system enter into hibernation.

In this patch, we put HDA into D3 hot state in azx_freeze_noirq() and
put HDA into D0 state in azx_thaw_noirq().

V2: Only apply this fix to SKL+
    Fix compile error when CONFIG_PM_SLEEP isn't defined

[Yet another fix for CONFIG_PM_SLEEP ifdef and the additional comment
 by tiwai]

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/hda_intel.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1124,6 +1124,36 @@ static unsigned int azx_get_response(str
 		return azx_rirb_get_response(bus, addr);
 }
 
+#ifdef CONFIG_PM_SLEEP
+/* put codec down to D3 at hibernation for Intel SKL+;
+ * otherwise BIOS may still access the codec and screw up the driver
+ */
+#define IS_SKL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa170)
+#define IS_SKL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d70)
+#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci))
+
+static int azx_freeze_noirq(struct device *dev)
+{
+	struct pci_dev *pci = to_pci_dev(dev);
+
+	if (IS_SKL_PLUS(pci))
+		pci_set_power_state(pci, PCI_D3hot);
+
+	return 0;
+}
+
+static int azx_thaw_noirq(struct device *dev)
+{
+	struct pci_dev *pci = to_pci_dev(dev);
+
+	if (IS_SKL_PLUS(pci))
+		pci_set_power_state(pci, PCI_D0);
+
+	return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+
 #ifdef CONFIG_PM
 static void azx_power_notify(struct hda_bus *bus, bool power_up);
 #endif
@@ -3072,6 +3102,10 @@ static int azx_runtime_idle(struct devic
 #ifdef CONFIG_PM
 static const struct dev_pm_ops azx_pm = {
 	SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
+#ifdef CONFIG_PM_SLEEP
+	.freeze_noirq = azx_freeze_noirq,
+	.thaw_noirq = azx_thaw_noirq,
+#endif
 	SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)
 };
 

  parent reply	other threads:[~2016-01-27 19:31 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 18:14 [PATCH 3.14 00/59] 3.14.60-stable review Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 01/59] x86/signal: Fix restart_syscall number for x32 tasks Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 02/59] xen/gntdev: Grant maps should not be subject to NUMA balancing Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 03/59] x86/xen: dont reset vcpu_info on a cancelled suspend Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 04/59] KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 05/59] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 06/59] x86/boot: Double BOOT_HEAP_SIZE to 64KB Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 07/59] ipmi: move timer init to before irq is setup Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 08/59] ALSA: hda - Add Intel Lewisburg device IDs Audio Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 09/59] ALSA: hda - Apply pin fixup for HP ProBook 6550b Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 10/59] ALSA: rme96: Fix unexpected volume reset after rate changes Greg Kroah-Hartman
2016-01-27 18:14 ` [PATCH 3.14 11/59] ALSA: hda - Add inverted dmic for Packard Bell DOTS Greg Kroah-Hartman
2016-01-27 18:15 ` Greg Kroah-Hartman [this message]
2016-01-27 18:15 ` [PATCH 3.14 13/59] ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2) Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 14/59] ALSA: seq: Fix missing NULL check at remove_events ioctl Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 15/59] ALSA: seq: Fix race at timer setup and close Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 16/59] ALSA: timer: Harden slave timer list handling Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 17/59] ALSA: timer: Fix race among timer ioctls Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 18/59] ALSA: timer: Fix double unlink of active_list Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 19/59] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 20/59] ALSA: pcm: Fix snd_pcm_hw_params struct copy " Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 21/59] ALSA: hrtimer: Fix stall by hrtimer_cancel() Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 22/59] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 23/59] ASoC: wm8962: correct addresses for HPF_C_0/1 Greg Kroah-Hartman
2016-01-27 18:15   ` Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 24/59] ASoC: wm8974: set cache type for regmap Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 25/59] ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 26/59] ASoC: compress: Fix compress device direction check Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 27/59] usb: xhci: fix config fail of FS hub behind a HS hub with MTT Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 28/59] USB: ipaq.c: fix a timeout loop Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 29/59] USB: cp210x: add ID for ELV Marble Sound Board 1 Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 30/59] xhci: refuse loading if nousb is used Greg Kroah-Hartman
2016-01-28 17:57   ` Luis Henriques
2016-01-28 17:57     ` Luis Henriques
2016-01-31 19:10     ` Greg Kroah-Hartman
2016-01-31 19:10       ` Greg Kroah-Hartman
2016-02-02 17:34       ` Luis Henriques
2016-02-02 17:34         ` Luis Henriques
2016-01-27 18:15 ` [PATCH 3.14 32/59] ipv6/addrlabel: fix ip6addrlbl_get() Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 33/59] sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 34/59] connector: bump skb->users before callback invocation Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 35/59] unix: properly account for FDs passed over unix sockets Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 36/59] bridge: Only call /sbin/bridge-stp for the initial network namespace Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 37/59] net: possible use after free in dst_release Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 38/59] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 39/59] tcp_yeah: dont set ssthresh below 2 Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 40/59] bonding: Prevent IPv6 link local address on enslaved devices Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 41/59] phonet: properly unshare skbs in phonet_rcv() Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 42/59] ipv6: update skb->csum when CE mark is propagated Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 43/59] isdn_ppp: Add checks for allocation failure in isdn_ppp_open() Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 45/59] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 46/59] powerpc/tm: Block signal return setting invalid MSR state Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 47/59] powerpc/tm: Check for already reclaimed tasks Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 48/59] powerpc: Make value-returning atomics fully ordered Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 49/59] powerpc: Make {cmp}xchg* and their atomic_ versions " Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 50/59] scripts/recordmcount.pl: support data in text section on powerpc Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 51/59] arm64: KVM: Fix AArch32 to AArch64 register mapping Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 52/59] arm64: fix building without CONFIG_UID16 Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 53/59] arm64: Clear out any singlestep state on a ptrace detach operation Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 54/59] arm64: mm: ensure that the zero page is visible to the page table walker Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 55/59] parisc iommu: fix panic due to trying to allocate too large region Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 56/59] HID: core: Avoid uninitialized buffer access Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 57/59] openrisc: fix CONFIG_UID16 setting Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 58/59] mn10300: Select CONFIG_HAVE_UID16 to fix build failure Greg Kroah-Hartman
2016-01-27 18:15 ` [PATCH 3.14 59/59] arm64: restore bogomips information in /proc/cpuinfo Greg Kroah-Hartman
2016-01-27 23:29 ` [PATCH 3.14 00/59] 3.14.60-stable review Shuah Khan
2016-01-28  2:01 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160127180736.113543773@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    --cc=xiong.y.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.