Repository navigation
soundwire: intel: exit clock-stop mode before system suspend - #3006
Conversation
|
SOFCI TEST |
95238b3 to
59ffdf7
Compare
|
@plbossart copy your comments in #2606 (comment) "I have a possible explanation: this problem happens when the link is already pm_runtime suspended, so we are in clock-stop if we do a pm_runtime resume first, then we will find sdw controller is not in clock stop0 mode in intel_resume_runtime function for this case since sdw controller is powered off and clock stop0 state is not sustained. And it will go normal path like intel_resume for s3. I don't see any difference between intel_resume vs intel_resume_runtime + intel_resume |
|
@plbossart It is interesting that |
that was the case on the earlier version but that's no longer the case in the update, please double-check. |
@RanderWang the change is on the suspend path. The proposal is to bring the devices back to full power, i.e. exit the clock stop mode before doing the system suspend. |
|
@bardliao @RanderWang I am not fully happy with this PR, there's got to be a way to force the devices to resume at the bus level, maybe with a .prepare step. |
59ffdf7 to
924c989
Compare
|
@bardliao @RanderWang I think the update "should" provide a better solution, if only I found why the sdw_slave_suspend() callback doesn't seem to be called... Gah. |
@plbossart I double checked it with your latest update. I can only see |
@plbossart The reason why
|
Nice analysis @bardliao, you saved me a lot of time here. I think we can just set the NO_DIRECT_COMPLETE flag and prevent all this dev->power.direct_complete = state.event == PM_EVENT_SUSPEND &&
(ret > 0 || dev->power.no_pm_callbacks) &&
!dev_pm_test_driver_flags(dev, DPM_FLAG_NO_DIRECT_COMPLETE); if we set this flag the result is logically false. Testing this now. |
924c989 to
11ef23d
Compare
No luck @bardliao , with this change the direct_complete is false but still we don't call sdw_slave_suspend... |
@plbossart I must be wrong with my last comment. |
|
Good explanation @bardliao, I had no idea how power domains worked ;-) It seems the issue is that "rtcwake -m mem" translates to S0 state, which means no resume: linux/drivers/acpi/device_pm.c Line 999 in bf96c09 Maybe that means that instead of forcing the codec to resume to work-around the clock stop issue, we need to deal with the intel_suspend differently and keep the clock stop mode and wakes in S0. @RanderWang I wonder if what we did assumed a transition to S3. |
11ef23d to
608a8b1
Compare
|
SOFCI TEST |
|
@plbossart I like this version since all changes are in intel specific code. But we have to test |
@bardliao are you referring to this error? I don't see it in my local tests, and I don't understand why it happens either. If something disables pm_runtime(), then it's not clear to me how we would resume the device... Oh well, this needs more work obviously. |
608a8b1 to
7b4adbf
Compare
|
update with one test to discard 'ghost' codec devices and trace in case of pm_runtime_resume errors |
7b4adbf to
fb28014
Compare
|
Amazing how many bad configs this PR exposes. Now we have a case where we suspend/resume even when we are not using the SoundWire IP https://sof-ci.01.org/linuxpr/PR3006/build5945/devicetest/?model=TGLH_RVP_HDA&testcase=check-suspend-resume-5 added a test to only do PM/wake sequences if we started the link. |
@plbossart This didn't fix the issue. The problem is that the link is enabled but all of its child are 'ghost'. And pm runtime will not be enabled for the 'ghost' devices. As a result, soundwire link device will not be resumed in the prepare process. My proposal is that we can check if we can find any 'real' child device before calling |
|
Complete failure on Intel test 5283, on TGLU_SKU0A32_SDCA we see random power_down/power_up sequences leading to a bus clash. Gah. |
@plbossart I think doing the resume for the codecs in their prepare/suspend routine sychronously might be a better option. Worth trying I think |
It'd be horrible, we only need to do this when the clock-stop mode is used, and that's a property of the parent. Not to mention that we would push an Intel-specific requirement to ALL codecs, that would be problematic if a codec is also used on a non-Intel product. |
The topologies used for sof-tgl-rt711-rt1308 and sof-tgl-max98357a-rt5682 are almost equivalent. Conditionally add support for the amplifier reference dailink and BT offload, so that this topology can be used as is on Google Volteer. This will help root-cause suspend/resume issues we see only on TGL_RVP_SDW Related kernel PR: thesofproject/linux#3006 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@plbossart how about adding a flag to the child device that can be set from the parent to indicate if it should resume or not? |
|
that was my initial PR @ranj063, but it still requires codec modifications. I still want to get to the bottom of the 2 issues we found, already fixed one issue on CML and one to go on TGL |
84ac174
f2202c5 to
84ac174
Compare
|
@bardliao we still have a race condition somewhere that's exposed with the changes in this PR. See the code in the power_down sequence is weird mutex_unlock(sdw->link_res->shim_lock);
if (ret < 0) {
dev_err(sdw->cdns.dev, "%s: could not power down link\n", __func__);
return ret;
}
sdw->cdns.link_up = false;
return 0;Do you remember if this is intentional? we added this code in commit 4a17c44, Very odd sequence indeed. |
84ac174 to
52e7d41
Compare
|
@bardliao @RanderWang with the update on the last commit to protect the link_up flag, I don't see any errors any more: https://sof-ci.sh.intel.com/#/result/planresultdetail/5332 I'll run more tests over the week-end with thousands of cycles but that last commit does seem to have an effect. |
On some platforms with an external HDaudio codec, the DSDT reports the presence of SoundWire devices. Pin-mux restrictions and board reworkds usually prevent coexistence between the two types of links, let's prevent unnecessary operations from starting. In the case of a single iDISP codec being detected, we still start the links even if no SoundWire machine configuration was detected, so that we can double-check what the hardware is and add the missing configuration if applicable. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The power down sequence sets the link_up flag as false outside of the mutex_lock. This is potentially unsafe. In additional the flow in that sequence can be improved by first testing if the link was powered, setting the link_up flag as false and proceeding with the power down. In case the CPA bits cannot be cleared, we only flag an error since we cannot deal with interrupts any longer. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
On some HDaudio platforms, SoundWire devices are described in the DSDT but never used. This patch adds a boolean status flag to skip all suspend/resume/wake sequences for this configuration. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Intel validation reported an issue where the HW_RST self-clearing bit is not cleared in hardware, which as a ripple effect creates issues with the clock stop mode. This happens is a specific sequence where the Intel manager is pm_runtime suspended with the clock-stop mode enabled. During the system suspend, we currently do nothing, which can lead to potential issues on system resume and the following pm_runtime suspend, depending on the hardware state. This patch suggests a full resume (parent+child devices) if the clock-stop mode is used. This may require extra time but will make the suspend/resume flows completely symmetric. This also removes a race condition where we could not access SHIM registers if the parent was suspended as well. Resuming the link also resumes the parent by construction. BugLink: thesofproject#2606 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Since we've introduced a .prepare callback that brings all devices to full power on S state transitions if the clock-stop mode was used, we no longer need to special-case when the device was pm_runtime suspended. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
52e7d41 to
b07c6d7
Compare
The topologies used for sof-tgl-rt711-rt1308 and sof-tgl-max98357a-rt5682 are almost equivalent. Conditionally add support for the amplifier reference dailink and BT offload, so that this topology can be used as is on Google Volteer. This will help root-cause suspend/resume issues we see only on TGL_RVP_SDW Related kernel PR: thesofproject/linux#3006 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
I am not sure if it is intentional. But I think the idea was that we use mutex to protect the HW process and set |
|
@bardliao @RanderWang @ranj063 I ran a bunch of tests and don't see any regression with the last patches. Let's try and merge this with your reviews and test further. |
Intel validation reported an issue where the HW_RST self-clearing bit
is not cleared in hardware, which as a ripple effect creates issues
with the clock stop mode.
This happens is a specific sequence where the Intel manager is
pm_runtime suspended with the clock-stop mode enabled. During the
system suspend, we currently do nothing, which can lead to potential
issues on system resume and the following pm_runtime suspend,
depending on the hardware state.
This patch suggests a full resume if the clock-stop mode is used. This
may require extra time but will make the suspend/resume flows
completely symmetric. This also removes a race condition where we
could not access SHIM registers if the parent was suspended as
well. Resuming the link also resumes the parent by construction.
BugLink: #2606
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com