Commit 5aedb8d8 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: intel_bus_common: enable interrupts before exiting reset

The existing code enables the Cadence IP interrupts after the bus
reset sequence. The problem with this sequence is that it might be
pre-empted, giving SoundWire devices time to sync and report as
ATTACHED before the interrupts are enabled. In that case, the Cadence
IP will not detect a state change and will not throw an interrupt to
proceed with the enumeration of a Device0.

In our overnight stress tests, we observed that a slight
sub-millisecond delay in enabling interrupts after the reset was
correlated with detection failures. This problem is more prevalent on
the LunarLake silicon, likely due to SOC integration changes, but it
was observed on earlier generations as well.

This patch reverts the sequence, with the interrupts enabled before
performing the bus reset. This removes the race condition and makes
sure the Cadence IP is able to detect the presence of a Device0 in all
cases.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20240805115003.88035-1-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent f8c35d61
...@@ -45,15 +45,15 @@ int intel_start_bus(struct sdw_intel *sdw) ...@@ -45,15 +45,15 @@ int intel_start_bus(struct sdw_intel *sdw)
return ret; return ret;
} }
ret = sdw_cdns_exit_reset(cdns); ret = sdw_cdns_enable_interrupt(cdns, true);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "%s: unable to exit bus reset sequence: %d\n", __func__, ret); dev_err(dev, "%s: cannot enable interrupts: %d\n", __func__, ret);
return ret; return ret;
} }
ret = sdw_cdns_enable_interrupt(cdns, true); ret = sdw_cdns_exit_reset(cdns);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "%s: cannot enable interrupts: %d\n", __func__, ret); dev_err(dev, "%s: unable to exit bus reset sequence: %d\n", __func__, ret);
return ret; return ret;
} }
...@@ -139,15 +139,15 @@ int intel_start_bus_after_reset(struct sdw_intel *sdw) ...@@ -139,15 +139,15 @@ int intel_start_bus_after_reset(struct sdw_intel *sdw)
return ret; return ret;
} }
ret = sdw_cdns_exit_reset(cdns); ret = sdw_cdns_enable_interrupt(cdns, true);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "unable to exit bus reset sequence during resume\n"); dev_err(dev, "cannot enable interrupts during resume\n");
return ret; return ret;
} }
ret = sdw_cdns_enable_interrupt(cdns, true); ret = sdw_cdns_exit_reset(cdns);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "cannot enable interrupts during resume\n"); dev_err(dev, "unable to exit bus reset sequence during resume\n");
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment