Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET #12

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions drivers/soundwire/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,8 @@ static int intel_resume_runtime(struct device *dev)
struct sdw_cdns *cdns = dev_get_drvdata(dev);
struct sdw_intel *sdw = cdns_to_intel(cdns);
u32 clock_stop_quirks;
bool clock_stop0;
int status;
int ret;

if (cdns->bus.prop.hw_disabled) {
Expand Down Expand Up @@ -1740,20 +1742,31 @@ static int intel_resume_runtime(struct device *dev)
return ret;
}

/*
* An exception condition occurs for the CLK_STOP_BUS_RESET
* case if one or more masters remain active. In this condition,
* all the masters are powered on for they are in the same power
* domain. Master can preserve its context for clock stop0, so
* there is no need to clear slave status and reset bus.
*/
clock_stop0 = sdw_cdns_is_clock_stop(&sdw->cdns);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang @bardliao I am not sure I get the idea.
Is it the case that when the power is removed, the IP will be reset and will not show as being in clock stop mode any longer?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart yes, it is exactly what you said. if the master is in clock stop0, it means master preserve its context, so clock stop0 can work, or it is what you said

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, can you rebase and update comments and I'll merge.

I think what you meant is this:

When all the links are suspended, the HDaudio controller may suspend and the power rails to the SoundWire IP may be disabled, requiring a complete re-initialization/enumeration on resume.
However, if one or more Masters remained active, the HDaudio controller will remain active and the power rails will remain enabled.
As a result, during the link resume step we can check if the context was preserved by verifying if the clock was stopped, and avoid doing a complete bus reset and re-enumeration.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I am working now

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw @RanderWang, if I can give a piece of advice: avoid using 'there is' in commit message or bug reports. It's always difficult to figure out what 'there' refers to. Use an explicit subject to make sure the reader knows exactly what you are referring to. Also avoid 'work' and use concepts that are related to the subsystem (for pm_runtime it's active and suspended).

e.g.

There is a exception condition for CLK_STOP_BUS_RESET
case if there is another master is working

->

An exception condition occurs for the CLK_STOP_BUS_RESET case if one or more masters remain active.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart thanks very much, I update my comments.

/*
* make sure all Slaves are tagged as UNATTACHED and
* provide reason for reinitialization
*/
sdw_clear_slave_status(&sdw->cdns.bus,
SDW_UNATTACH_REQUEST_MASTER_RESET);
if (!clock_stop0) {
status = SDW_UNATTACH_REQUEST_MASTER_RESET;
sdw_clear_slave_status(&sdw->cdns.bus, status);
}

ret = sdw_cdns_enable_interrupt(cdns, true);
if (ret < 0) {
dev_err(dev, "cannot enable interrupts during resume\n");
return ret;
}

ret = sdw_cdns_clock_restart(cdns, true);
ret = sdw_cdns_clock_restart(cdns, !clock_stop0);
if (ret < 0) {
dev_err(dev, "unable to restart clock during resume\n");
return ret;
Expand Down