ASoC: SOF: Intel: only use D0i3 if needed
Subsystems (3)
cover ASoC: SOF: Intel: only use D0i3 if needed
The earlier patches for D0i3/S0ix support went one bridge too far, and forced the use of D0i3 even when it was not needed, which also had the side effect of breaking some of our s2idle suspend/resume stress tests.
Add documentation on supported transitions and only use D0i3 if necessary.
Keyon Jie (4):
ASoC: SOF: PM: add state machine to comments
ASoC: SOF: PM: add check before setting d0_substate
ASoC: SOF: add helper to check if we should enter d0i3 suspend
ASoC: SOF: PM: only suspend to D0I3 when needed
sound/soc/sof/core.c | 13 +++++++++++++ sound/soc/sof/pm.c | 39 +++++++++++++++++++++++++++++++++++++-- sound/soc/sof/sof-priv.h | 2 ++ 3 files changed, 52 insertions(+), 2 deletions(-)
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 1/4 ASoC: SOF: PM: add state machine to comments
From: Keyon Jie <[email protected]>
Add Audio DSP state machine with comments. Note that the 'D0<-->runtime D0I3' part is not implemented yet.
--- sound/soc/sof/pm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
sound/soc/sof/pm.c +32 -0
@@ -428,6 +428,38 @@ int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, }EXPORT_SYMBOL (snd_sof_set_d0_substate); +/* +* Audio DSP states may transform as below:- +* +* D0I3 compatible stream +* Runtime +---------------------+ opened only, timeout +* suspend | +--------------------+ +* +------------+ D0(active) | | +* | | <---------------+ | +* | +--------> | | | +* | |Runtime +--^--+---------^--+--+ The last | | +* | |resume | | | | opened D0I3 | | +* | | | | | | compatible | | +* | | resume| | | | stream closed | | +* | | from | | D3 | | | | +* | | D3 | |suspend | | d0i3 | | +* | | | | | |suspend | | +* | | | | | | | | +* | | | | | | | | +* +-v---+-----------+--v-------+ | | +------+----v----+ +* | | | +-----------> | +* | D3 (suspended) | | | D0I3 +-----+ +* | | +--------------+ | | +* | | resume from | | | +* +-------------------^--------+ d0i3 suspend +----------------+ | +* | | +* | D3 suspend | +* +------------------------------------------------+ +* +* d0i3_suspend = s0_suspend && D0I3 stream opened, +* D3 suspend = !d0i3_suspend, +*/ +int snd_sof_resume (struct device *dev) {struct snd_sof_dev *sdev =dev_get_drvdata (dev);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: PM: add state machine to comments" to the asoc tree
The patch
ASoC: SOF: PM: add state machine to comments
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 74b4dd04b19cc03e1cc369d9c371cf4206367df4 Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Mon, 11 Nov 2019 16:33:40 -0600
Subject: [PATCH] ASoC: SOF: PM: add state machine to comments
Add Audio DSP state machine with comments. Note that the 'D0<-->runtime D0I3' part is not implemented yet.
--- sound/soc/sof/pm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
sound/soc/sof/pm.c +32 -0
@@ -428,6 +428,38 @@ int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, }EXPORT_SYMBOL (snd_sof_set_d0_substate); +/* +* Audio DSP states may transform as below:- +* +* D0I3 compatible stream +* Runtime +---------------------+ opened only, timeout +* suspend | +--------------------+ +* +------------+ D0(active) | | +* | | <---------------+ | +* | +--------> | | | +* | |Runtime +--^--+---------^--+--+ The last | | +* | |resume | | | | opened D0I3 | | +* | | | | | | compatible | | +* | | resume| | | | stream closed | | +* | | from | | D3 | | | | +* | | D3 | |suspend | | d0i3 | | +* | | | | | |suspend | | +* | | | | | | | | +* | | | | | | | | +* +-v---+-----------+--v-------+ | | +------+----v----+ +* | | | +-----------> | +* | D3 (suspended) | | | D0I3 +-----+ +* | | +--------------+ | | +* | | resume from | | | +* +-------------------^--------+ d0i3 suspend +----------------+ | +* | | +* | D3 suspend | +* +------------------------------------------------+ +* +* d0i3_suspend = s0_suspend && D0I3 stream opened, +* D3 suspend = !d0i3_suspend, +*/ +int snd_sof_resume (struct device *dev) {struct snd_sof_dev *sdev =dev_get_drvdata (dev);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/4 ASoC: SOF: PM: add check before setting d0_substate
In reply to Pierre-Louis BossartFrom: Keyon Jie <[email protected]>
Add check before seeting d0_substate and return success if Audio DSP is already in the target substate.
--- sound/soc/sof/pm.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/sof/pm.c +3 -0
@@ -416,6 +416,9 @@ int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, {int ret; +if (sdev->d0_substate == d0_substate) +return 0 ; +/* do platform specific set_state */ ret =snd_sof_dsp_set_power_state (sdev, d0_substate);if (ret <0 )
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: PM: add check before setting d0_substate" to the asoc tree
The patch
ASoC: SOF: PM: add check before setting d0_substate
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 58a972efd21bb5adadd97f2546693ec64bfc99b9 Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Mon, 11 Nov 2019 16:33:41 -0600
Subject: [PATCH] ASoC: SOF: PM: add check before setting d0_substate
Add check before seeting d0_substate and return success if Audio DSP is already in the target substate.
--- sound/soc/sof/pm.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/sof/pm.c +3 -0
@@ -416,6 +416,9 @@ int snd_sof_set_d0_substate(struct snd_sof_dev *sdev, {int ret; +if (sdev->d0_substate == d0_substate) +return 0 ; +/* do platform specific set_state */ ret =snd_sof_dsp_set_power_state (sdev, d0_substate);if (ret <0 )
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 3/4 ASoC: SOF: add helper to check if we should enter d0i3 suspend
In reply to Pierre-Louis BossartFrom: Keyon Jie <[email protected]>
Add helper to check if the DSP should be put in D0i3. This function returns true if a stream has ignored the SUSPEND trigger to keep the pipelines running in the DSP.
--- sound/soc/sof/core.c | 13 +++++++++++++ sound/soc/sof/sof-priv.h | 2 ++ 2 files changed, 15 insertions(+)
sound/soc/sof/core.c +13 -0
@@ -132,6 +132,19 @@ struct snd_sof_dai *snd_sof_find_dai(struct snd_sof_dev *sdev,return NULL ; } +bool snd_sof_dsp_d0i3_on_suspend (struct snd_sof_dev *sdev) +{ +struct snd_sof_pcm *spcm; + +list_for_each_entry (spcm, &sdev->pcm_list, list) { +if (spcm->stream[SNDRV_PCM_STREAM_PLAYBACK ].suspend_ignored || + spcm->stream[SNDRV_PCM_STREAM_CAPTURE ].suspend_ignored) +return true; + } + +return false; +} +/* * FW Panic/fault handling. */
sound/soc/sof/sof-priv.h +2 -0
@@ -553,6 +553,8 @@ struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_sof_dev *sdev,return NULL ; } +bool snd_sof_dsp_d0i3_on_suspend (struct snd_sof_dev *sdev); +struct snd_sof_pcm *snd_sof_find_spcm_name (struct snd_sof_dev *sdev,const char *name); struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev,
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: add helper to check if we should enter d0i3 suspend" to the asoc tree
The patch
ASoC: SOF: add helper to check if we should enter d0i3 suspend
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From a77e5d573f847d2f984c38eb711351326bc55258 Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Mon, 11 Nov 2019 16:33:42 -0600
Subject: [PATCH] ASoC: SOF: add helper to check if we should enter d0i3
suspend
Add helper to check if the DSP should be put in D0i3. This function returns true if a stream has ignored the SUSPEND trigger to keep the pipelines running in the DSP.
--- sound/soc/sof/core.c | 13 +++++++++++++ sound/soc/sof/sof-priv.h | 2 ++ 2 files changed, 15 insertions(+)
sound/soc/sof/core.c +13 -0
@@ -132,6 +132,19 @@ struct snd_sof_dai *snd_sof_find_dai(struct snd_sof_dev *sdev,return NULL ; } +bool snd_sof_dsp_d0i3_on_suspend (struct snd_sof_dev *sdev) +{ +struct snd_sof_pcm *spcm; + +list_for_each_entry (spcm, &sdev->pcm_list, list) { +if (spcm->stream[SNDRV_PCM_STREAM_PLAYBACK ].suspend_ignored || + spcm->stream[SNDRV_PCM_STREAM_CAPTURE ].suspend_ignored) +return true; + } + +return false; +} +/* * FW Panic/fault handling. */
sound/soc/sof/sof-priv.h +2 -0
@@ -553,6 +553,8 @@ struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_sof_dev *sdev,return NULL ; } +bool snd_sof_dsp_d0i3_on_suspend (struct snd_sof_dev *sdev); +struct snd_sof_pcm *snd_sof_find_spcm_name (struct snd_sof_dev *sdev,const char *name); struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev,
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 4/4 ASoC: SOF: PM: only suspend to D0I3 when needed
In reply to Pierre-Louis BossartFrom: Keyon Jie <[email protected]>
We should suspend audio to D3 by default, for the sake of power saving, change the condition of D0I3 suspending here to that when there is stream with suspend_ignored specified.
--- sound/soc/sof/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/pm.c +2 -2
@@ -468,7 +468,7 @@ int snd_sof_resume(struct device *dev)struct snd_sof_dev *sdev =dev_get_drvdata (dev);int ret; -if (sdev->s0_suspend) { +if (snd_sof_dsp_d0i3_on_suspend (sdev)) {/* resume from D0I3 */ dev_dbg (sdev->dev,"DSP will exit from D0i3...\n" ); ret =snd_sof_set_d0_substate (sdev,SOF_DSP_D0I0 );
@@ -497,7 +497,7 @@ int snd_sof_suspend(struct device *dev)struct snd_sof_dev *sdev =dev_get_drvdata (dev);int ret; -if (sdev->s0_suspend) { +if (snd_sof_dsp_d0i3_on_suspend (sdev)) {/* suspend to D0i3 */ dev_dbg (sdev->dev,"DSP is trying to enter D0i3...\n" ); ret =snd_sof_set_d0_substate (sdev,SOF_DSP_D0I3 );
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainer[alsa-devel] Applied "ASoC: SOF: PM: only suspend to D0I3 when needed" to the asoc tree
The patch
ASoC: SOF: PM: only suspend to D0I3 when needed
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From 5e35d5f4224adb24c2bfa814b9fb562050aba3ea Mon Sep 17 00:00:00 2001
From: Keyon Jie <[email protected]>
Date: Mon, 11 Nov 2019 16:33:43 -0600
Subject: [PATCH] ASoC: SOF: PM: only suspend to D0I3 when needed
We should suspend audio to D3 by default, for the sake of power saving, change the condition of D0I3 suspending here to that when there is stream with suspend_ignored specified.
--- sound/soc/sof/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/pm.c +2 -2
@@ -468,7 +468,7 @@ int snd_sof_resume(struct device *dev)struct snd_sof_dev *sdev =dev_get_drvdata (dev);int ret; -if (sdev->s0_suspend) { +if (snd_sof_dsp_d0i3_on_suspend (sdev)) {/* resume from D0I3 */ dev_dbg (sdev->dev,"DSP will exit from D0i3...\n" ); ret =snd_sof_set_d0_substate (sdev,SOF_DSP_D0I0 );
@@ -497,7 +497,7 @@ int snd_sof_suspend(struct device *dev)struct snd_sof_dev *sdev =dev_get_drvdata (dev);int ret; -if (sdev->s0_suspend) { +if (snd_sof_dsp_d0i3_on_suspend (sdev)) {/* suspend to D0i3 */ dev_dbg (sdev->dev,"DSP is trying to enter D0i3...\n" ); ret =snd_sof_set_d0_substate (sdev,SOF_DSP_D0I3 );
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel