add support to reorder CPU and Codec DAI suspend/resume
PATCH 1/1 add support to reorder CPU and Codec DAI suspend/resume
Due to some hardware dependence issues, some devices maybe require different suspend/resume execution order for CPU and Codec DAI to make sure the hardware can work normally after executing sleep and wakeup.
In old ALSA driver, people include all suspend/resume operations of both CPU and Codec in same entries. Then they change order according to actual require. But in ASoC, we should give a chance to users to reorder CPU/Codec DAI suspend/resume instead of defining the fixed order if there are some strange hardware dependence problems.
--- include/sound/soc.h | 4 ++++ sound/soc/soc-core.c | 48 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 12 deletions(-)
include/sound/soc.h +4 -0
@@ -494,6 +494,10 @@ struct snd_soc_card {struct snd_soc_dai_link *dai_link;int num_links; +/* CPU <--> Codec DAI suspend/resume order */ +int cpu_suspend_earlier;/* CPU DAI and platform suspend will be called earlier than Codec */ +int cpu_resume_earlier;/* CPU DAI and platform resume will be called earlier than Codec */ +struct snd_soc_device *socdev;struct snd_soc_codec *codec;
sound/soc/soc-core.c +36 -12
72 lines not on this page · raw message
Signature · 1 line
1.5.6.3
Quoted 4 lines · Barry Song
Due to some hardware dependence issues, some devices maybe require different suspend/resume execution order for CPU and Codec DAI to make sure the hardware can work normally after executing sleep and wakeup.
Are there any actual systems that this solves problems for - if so, what are the problems? I don't think this solution is general enough to be scalable, it'll work for one particular use case but if we get further reorderings needed it'll become difficult to manage.
If we're going to be doing anything with this I think it would be much better to use the pm_link infrastructure which will be appearing in 2.6.34. This should allow us to provide arbatrary ordering of device level suspend and resume.
Quoted 11 lines · Mark Brown
Quoted 4 lines · Barry Song
Due to some hardware dependence issues, some devices maybe require different suspend/resume execution order for CPU and Codec DAI to make sure the hardware can work normally after executing sleep and wakeup.
Are there any actual systems that this solves problems for - if so, what are the problems? I don't think this solution is general enough to be scalable, it'll work for one particular use case but if we get further reorderings needed it'll become difficult to manage.
Quoted 4 lines
If we're going to be doing anything with this I think it would be much better to use the
pm_linkinfrastructure which will be appearing in 2.6.34. This should allow us to provide arbatrary ordering of device level suspend and resume.
I am glad to hear there is a plan about pm_link. I think that will provide generic support for all related issues. And I also think my solution can only solve some particular cases.
Here I have a problem about blackfin TDM. After a deep sleep(all suspend to memory and most parts power-down), If codec resumes at first, clock ans sync are provided by it at onece. Then while CPU TDM interface resumes, it will fail to go back to right status for work. In the reverse orders, CPU interfaces stand there at first and wait coming sync and clocks, it can go to right status.
Do you have any idea about fixing it better?
Quoted 1 line
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 4 lines · Barry Song
Here I have a problem about blackfin TDM. After a deep sleep(all suspend to memory and most parts power-down), If codec resumes at first, clock ans sync are provided by it at onece. Then while CPU TDM interface resumes, it will fail to go back to right status for work.
What trouble does this give the TDM stuff? It sounds very fragile if things get confused like this (presumably as a result of having the clocks running).
Quoted 10 lines · Mark Brown
Quoted 4 lines · Barry Song
Here I have a problem about blackfin TDM. After a deep sleep(all suspend to memory and most parts power-down), If codec resumes at first, clock ans sync are provided by it at onece. Then while CPU TDM interface resumes, it will fail to go back to right status for work.
What trouble does this give the TDM stuff? It sounds very fragile if things get confused like this (presumably as a result of having the clocks running).
The only difference should be whether clock/sync is fired from codec before or after TDM interfaces are resumed to be ready for the different resume order of CPU and Codec DAI, as I guess. That's difficult to explain why.
Quoted 1 line
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 4 lines · Barry Song
The only difference should be whether clock/sync is fired from codec before or after TDM interfaces are resumed to be ready for the different resume order of CPU and Codec DAI, as I guess. That's difficult to explain why.
It'd really like to understand what's going wrong with the controller here - it should just sync up off the frame sync signal.
Quoted 9 lines · Mark Brown
Quoted 4 lines · Barry Song
The only difference should be whether clock/sync is fired from codec before or after TDM interfaces are resumed to be ready for the different resume order of CPU and Codec DAI, as I guess. That's difficult to explain why.
It'd really like to understand what's going wrong with the controller here - it should just sync up off the frame sync signal.
Don't know what happens exactly in hardware controllers . But I "fixed" this porblem by isolating interfaces's sync/clock pins from Codec(config them to GPIOs), then the whole system gets normal. Since you have a plan for pm-link, I will use this way to keep the fix in blackfin locally.
Quoted 1 line
Quoted 10 lines · Barry Song
On Wed, Nov 11, 2009 at 10:42 PM, Mark Brown
Quoted 2 lines
It'd really like to understand what's going wrong with the controller here - it should just sync up off the frame sync signal.
Don't know what happens exactly in hardware controllers . But I "fixed" this porblem by isolating interfaces's sync/clock pins from Codec(config them to GPIOs), then the whole system gets normal. Since you have a plan for pm-link, I will use this way to keep the fix in blackfin locally.
Thinking about this further I think you need the GPIO fix anyway. There will be some CODECs (I'm mostly thinking of fixed function ones with no software control) that won't stop generating clocks unless power is removed.