diff options
author | Bard Liao <yung-chuan.liao@linux.intel.com> | 2021-01-28 11:38:49 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-01-28 17:11:37 +0000 |
commit | 30876e2a06f35b525dc71f94dfc3c6f329e55a28 (patch) | |
tree | cc2d0dccb570e2fc094a3c03422851c9b75bcb42 /sound/soc | |
parent | 42077f08b3f1ba891dca1f8f479810f16b7d6cbd (diff) | |
download | linux-30876e2a06f35b525dc71f94dfc3c6f329e55a28.tar.gz linux-30876e2a06f35b525dc71f94dfc3c6f329e55a28.tar.bz2 linux-30876e2a06f35b525dc71f94dfc3c6f329e55a28.zip |
ASoC: SOF: Filter out unneeded core power up/downs
Exclude cores that are already powered on/off correctly. This allows to
simplify dsp_power_up/down() implementations and avoid unexpected error.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210128093850.1041387-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/sof/ops.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h index 2e9a8da53d57..5099ad03df72 100644 --- a/sound/soc/sof/ops.h +++ b/sound/soc/sof/ops.h @@ -78,7 +78,8 @@ static inline int snd_sof_dsp_core_power_up(struct snd_sof_dev *sdev, { int ret = 0; - if (sof_ops(sdev)->core_power_up) { + core_mask &= ~sdev->enabled_cores_mask; + if (sof_ops(sdev)->core_power_up && core_mask) { ret = sof_ops(sdev)->core_power_up(sdev, core_mask); if (!ret) sdev->enabled_cores_mask |= core_mask; @@ -92,7 +93,8 @@ static inline int snd_sof_dsp_core_power_down(struct snd_sof_dev *sdev, { int ret = 0; - if (sof_ops(sdev)->core_power_down) { + core_mask &= sdev->enabled_cores_mask; + if (sof_ops(sdev)->core_power_down && core_mask) { ret = sof_ops(sdev)->core_power_down(sdev, core_mask); if (!ret) sdev->enabled_cores_mask &= ~core_mask; |