Commit 30876e2a authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

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: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210128093850.1041387-5-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 42077f08
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment