]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ASoC: SOF: Filter out unneeded core power up/downs
authorBard Liao <yung-chuan.liao@linux.intel.com>
Thu, 28 Jan 2021 09:38:49 +0000 (11:38 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 28 Jan 2021 17:11:37 +0000 (17:11 +0000)
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>
sound/soc/sof/ops.h

index 2e9a8da53d570953420da01bba5f4136df8f3cde..5099ad03df72fd1017d60279a6a3ba9d1119b005 100644 (file)
@@ -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;