-
Notifications
You must be signed in to change notification settings - Fork 140
[DO NOT REVIEW YET]PM Support for BYT/CHT + module load/unload fix for BSW #1523
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
Conversation
|
@ranj063 There was a problem in test script. Will fix it now. |
plbossart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks promising @ranj063, thanks!
the last two patches are a bit odd, maybe a bit more work is needed here. the byt-specific stuff looks ok with minor cosmetic details.
| /* do nothing if dsp resume callbacks are not set */ | ||
| if (!sof_ops(sdev)->resume || !sof_ops(sdev)->runtime_resume) | ||
| return 0; | ||
| if (runtime_resume) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is a bit controversial
I can see that you could support suspend/resume but not their pm_runtime versions.
would the opposite make any sense, support pm_runtime but not system suspend?
I would reword the commit message. This is not a fix, it's allowing for more granularity in what can be supported. this allows pm_runtime to be unsupported while normal resume is supported.
But I don't know if the other way around makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart this change makes no assumption about whether runtime PM or system PM is supported. sof_resume() and sof_suspend() are called for both the runtime PM and system PM cases. So all I am doing is if we're runtime suspending, check for the platform-specific runtime-suspend callback and so on for the other cases.
I called it a fix because previously, we didnt check for the appropriate op depending on whether it was runtime callback or system PM callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 when maintainers see a commit message starting with 'fix' they think it's a real problem that needs to be handled on previous -stable versions. What you are doing is 'split checks for platform-specific callbacks', not a real fix.
sound/soc/sof/pm.c
Outdated
| if (!sof_ops(sdev)->suspend) | ||
| return 0; | ||
|
|
||
| /* remove pipelines */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this one would be a fix of your previous work, and should be bundled with it rather than the byt pm fixes, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart yes, it should have been there too but it is all the more necessary for BYT/CHT. What's happening with BYT/CHT is that when performing runtime suspend, the DSP doesnt really get powered off and if I dont destroy the pipelines, runtime resume fails because we restore the pipelines in the resume callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean to say that on BYT/CHT, the firmware still has all the context and when sending the restore pipeline IPCs you get error messages?
It seems like a case of not sending the IPC if they are not needed, instead of destroying the pipelines and having to recreate them again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart that is true. But is it acceptable that on BYT/CHT the DSP is not really going to be in D3 when we runtime suspend and will only be done during system suspend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 whether you destroy the pipelines or not, the DSP will not be power gated on BYT/CHT. That's hardware, nothing we can do. In theory clock gating is still there but the leakage can't be controlled by power switches.
I know that on some Android platforms S0ix was enabled, but there are a ton of dependencies on PMC/BIOS, at this point it's not worth it. The legacy firmware doesn't do anything either for D3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall the fix should really be to deal with the topology only at boot and system resume for BYT/CHT, and for other devices in addition for each pm_runtime resume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that on some Android platforms S0ix was enabled, but there are a ton of dependencies on PMC/BIOS, at this point it's not worth it. The legacy firmware doesn't do anything either for D3.
@plbossart OK then should we just not bother enabling runtime PM for BYT/CHT at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall the fix should really be to deal with the topology only at boot and system resume for BYT/CHT, and for other devices in addition for each pm_runtime resume
@plbossart what happens when we separate the audio client device from the core? We are going to need to take down the pipelines during suspend and restore them during resume right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that on some Android platforms S0ix was enabled, but there are a ton of dependencies on PMC/BIOS, at this point it's not worth it. The legacy firmware doesn't do anything either for D3.
@plbossart OK then should we just not bother enabling runtime PM for BYT/CHT at all?
there's really not much value indeed. No one will see the difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall the fix should really be to deal with the topology only at boot and system resume for BYT/CHT, and for other devices in addition for each pm_runtime resume
@plbossart what happens when we separate the audio client device from the core? We are going to need to take down the pipelines during suspend and restore them during resume right?
it's a good question - as in I don't know the answer.
we have a similar case with SoundWire where sometimes the parent keeps the context and sometimes it doesn't, and we pass this information to the children. So maybe on resume the child device need to be told that all context was lost and that it needs to recreate the whole shebang.
sound/soc/sof/sof-audio.c
Outdated
| return snd_sof_dsp_hw_params_upon_resume(sdev); | ||
| } | ||
|
|
||
| int sof_destroy_pipelines(struct device *dev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am still confused why this needs to be done by hand and isn't done by topology and friends?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Let me move it to topology.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart sorry I dont think it can be done by topology. When removing the SOF device, topology can handle this but when dealing with runtime PM, it has be done here.
sound/soc/sof/pm.c
Outdated
|
|
||
| /* remove pipelines */ | ||
| sof_destroy_pipelines(dev); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i still think this is controversial.
For system suspend-resume, this is not needed. The DSP will lose context and be powered off.
For pm_runtime suspend-resume, this is needed only on Baytrail.
It feels this should really be done conditionally to avoid doing unnecessary things on all platforms where this is useless.
| return 0; | ||
| else | ||
| if (!sof_ops(sdev)->suspend) | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 Do we need these checks here ? they are already checked in snd_sof_dsp_suspend and snd_sof_dsp_runtime_suspend
|
This series patches cause dsp panic. |
Add remove op that disables interrupts and reset the DSP for BYT and CHT platforms. Signed-off-by: Ranjani Sridharan <[email protected]>
Fix the sequence to enable/disable runtime PM for ACPI devices in the probe and remove callbacks. Signed-off-by: Ranjani Sridharan <[email protected]>
Add the PM callbacks for BYT/CHT platforms. Signed-off-by: Ranjani Sridharan <[email protected]>
We currently ignore the reply messages from the DSP when they are not expected but call it out as an error. Change the error message to a debug message. Signed-off-by: Ranjani Sridharan <[email protected]>
Fix the checks for the platform-specific DSP PM ops in the sof_suspend/sof_resume functions. Signed-off-by: Ranjani Sridharan <[email protected]>
|
@ranj063 can we update this PR to just have suspend-resume for BYT/CHT (no pm_runtime support) and forget about the load/unload issue with BSW? |
|
cherry-pick these five commit with linux kernel master branch, build failed. sound/soc/sof/intel/byt.c:822:13: error: initialization of ‘int (*)(struct snd_sof_dev , u32)’ {aka ‘int ()(struct snd_sof_dev , unsigned int)’} from incompatible pointer type ‘int ()(struct snd_sof_dev )’ [-Werror=incompatible-pointer-types] |
|
can you fix pm support for BYT/CHT? |
|
Fixing the above build issue is simply this: Although the patches apply on current mainline (with the above fix), suspend/resume doesn't seem to work: |
|
replaced by PR #2138 |
Needs thesofproject/sof#2137