Blob Blame History Raw
From e286472cff8a6785f6fa7950a1ab1b485cc87885 Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Date: Wed, 20 Apr 2022 10:32:40 +0800
Subject: [PATCH] soundwire: intel: disable WAKEEN in pm_runtime resume
Git-commit: e286472cff8a6785f6fa7950a1ab1b485cc87885
Patch-mainline: v5.19-rc1
References: jsc#PED-850

When the manager device is pm_runtime resumed, we see a series of
spurious wakes and attempts to resume the same device:

Soundwire_intel.link.0: intel_resume_runtime: start
Soundwire_intel.link.0: intel_link_power_up: powering up all links
Soundwire_intel.link.0: intel_link_power_up: first link up, programming SYNCPRD
Soundwire_intel.link.0: intel_shim_wake: WAKEEN disabled for link 0
Soundwire_intel.link.0: intel_link_process_wakeen_event: pm_request_resume start
Soundwire_intel.link.0: intel_link_process_wakeen_event: pm_request_resume done

This sequence does not break anything but is totally unnecessary.

Currently the wakes are only disabled after the peripheral generates a
wake, e.g. for jack detection.

If the resume is initiated by the host drivers as a result of
userspace actions (play/record typically), we need to disable wake
detection as well. Doing so prevents the spurious wakes and calls to
pm_request_resume().

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220420023241.14335-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/soundwire/intel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 32e5fdb823c4..4b458e5e7336 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1831,6 +1831,9 @@ static int __maybe_unused intel_resume_runtime(struct device *dev)
 		return 0;
 	}
 
+	/* unconditionally disable WAKEEN interrupt */
+	intel_shim_wake(sdw, false);
+
 	link_flags = md_flags >> (bus->link_id * 8);
 	multi_link = !(link_flags & SDW_INTEL_MASTER_DISABLE_MULTI_LINK);
 
-- 
2.35.3