Lines Matching +full:power +full:- +full:managed
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
12 #include "sof-priv.h"
13 #include "sof-audio.h"
18 * D-states. Platform-specific substates, if any, should be
19 * handled by the platform-specific parts.
25 switch (sdev->system_suspend_target) { in snd_sof_dsp_power_target()
37 * Additional criteria such Soundwire clock-stop mode and in snd_sof_dsp_power_target()
59 list_for_each_entry(dfse, &sdev->dfsentry_list, list) { in sof_cache_debugfs()
62 if (dfse->type == SOF_DFSENTRY_TYPE_BUF) in sof_cache_debugfs()
66 if (dfse->access_type == SOF_DEBUGFS_ACCESS_D0_ONLY) in sof_cache_debugfs()
67 memcpy_fromio(dfse->cache_buf, dfse->io_mem, in sof_cache_debugfs()
68 dfse->size); in sof_cache_debugfs()
76 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; in sof_resume()
77 const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg; in sof_resume()
78 u32 old_state = sdev->dsp_power_state.state; in sof_resume()
82 if (!runtime_resume && !sof_ops(sdev)->resume) in sof_resume()
85 if (runtime_resume && !sof_ops(sdev)->runtime_resume) in sof_resume()
89 if (sdev->first_boot) in sof_resume()
101 dev_err(sdev->dev, in sof_resume()
102 "error: failed to power up DSP after resume\n"); in sof_resume()
107 * Nothing further to be done for platforms that support the low power in sof_resume()
109 * low-power D0 substate in sof_resume()
111 if (!runtime_resume && sof_ops(sdev)->set_power_state && in sof_resume()
116 dev_warn(sdev->dev, in sof_resume()
126 dev_err(sdev->dev, in sof_resume()
141 dev_err(sdev->dev, in sof_resume()
152 dev_warn(sdev->dev, in sof_resume()
158 if (tplg_ops->set_up_all_pipelines) { in sof_resume()
159 ret = tplg_ops->set_up_all_pipelines(sdev, false); in sof_resume()
161 dev_err(sdev->dev, "Failed to restore pipeline after resume %d\n", ret); in sof_resume()
166 /* Notify clients not managed by pm framework about core resume */ in sof_resume()
170 if (pm_ops && pm_ops->ctx_restore) { in sof_resume()
171 ret = pm_ops->ctx_restore(sdev); in sof_resume()
173 dev_err(sdev->dev, "ctx_restore IPC error during resume: %d\n", ret); in sof_resume()
182 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; in sof_suspend()
183 const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg; in sof_suspend()
189 if (!runtime_suspend && !sof_ops(sdev)->suspend) in sof_suspend()
192 if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) in sof_suspend()
195 if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) in sof_suspend()
202 dev_err(sdev->dev, in sof_suspend()
212 /* Skip to platform-specific suspend if DSP is entering D0 */ in sof_suspend()
215 /* Notify clients not managed by pm framework about core suspend */ in sof_suspend()
220 if (tplg_ops->tear_down_all_pipelines) in sof_suspend()
221 tplg_ops->tear_down_all_pipelines(sdev, false); in sof_suspend()
226 /* Notify clients not managed by pm framework about core suspend */ in sof_suspend()
234 /* notify DSP of upcoming power down */ in sof_suspend()
235 if (pm_ops && pm_ops->ctx_save) { in sof_suspend()
236 ret = pm_ops->ctx_save(sdev); in sof_suspend()
237 if (ret == -EBUSY || ret == -EAGAIN) { in sof_suspend()
239 * runtime PM has logic to handle -EBUSY/-EAGAIN so in sof_suspend()
242 dev_err(sdev->dev, "ctx_save IPC error during suspend: %d\n", ret); in sof_suspend()
245 /* FW in unexpected state, continue to power down */ in sof_suspend()
246 dev_warn(sdev->dev, "ctx_save IPC error: %d, proceeding with suspend\n", in sof_suspend()
254 if (sdev->fw_state == SOF_FW_BOOT_NOT_STARTED) in sof_suspend()
257 /* platform-specific suspend */ in sof_suspend()
263 dev_err(sdev->dev, in sof_suspend()
264 "error: failed to power down DSP during suspend %d\n", in sof_suspend()
273 sdev->enabled_cores_mask = 0; in sof_suspend()
280 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; in snd_sof_dsp_power_down_notify()
282 /* Notify DSP of upcoming power down */ in snd_sof_dsp_power_down_notify()
283 if (sof_ops(sdev)->remove && pm_ops && pm_ops->ctx_save) in snd_sof_dsp_power_down_notify()
284 return pm_ops->ctx_save(sdev); in snd_sof_dsp_power_down_notify()
324 const struct sof_dev_desc *desc = sdev->pdata->desc; in snd_sof_prepare()
327 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
333 if (sdev->fw_state == SOF_FW_CRASHED || in snd_sof_prepare()
334 sdev->fw_state == SOF_FW_BOOT_FAILED) in snd_sof_prepare()
337 if (!desc->use_acpi_target_states) in snd_sof_prepare()
343 sdev->system_suspend_target = SOF_SUSPEND_S0IX; in snd_sof_prepare()
348 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
351 sdev->system_suspend_target = SOF_SUSPEND_S4; in snd_sof_prepare()
354 sdev->system_suspend_target = SOF_SUSPEND_S5; in snd_sof_prepare()
369 sdev->system_suspend_target = SOF_SUSPEND_NONE; in snd_sof_complete()