Lines Matching +full:dsp +full:- +full:reset
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
12 #include "sof-priv.h"
13 #include "sof-audio.h"
16 * Helper function to determine the target DSP state during
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()
28 /* DSP should be in D3 if the system is suspending to S3+ */ in snd_sof_dsp_power_target()
30 /* DSP should be in D3 if the system is suspending to S3 */ in snd_sof_dsp_power_target()
35 * Currently, the only criterion for retaining the DSP in D0 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()
78 u32 old_state = sdev->dsp_power_state.state; in sof_resume()
81 /* do nothing if dsp resume callbacks are not set */ 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()
88 /* DSP was never successfully started, nothing to 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()
106 if (sdev->dspless_mode_selected) { in sof_resume()
114 * low-power D0 substate in sof_resume()
116 if (!runtime_resume && sof_ops(sdev)->set_power_state && in sof_resume()
121 dev_warn(sdev->dev, in sof_resume()
131 dev_err(sdev->dev, in sof_resume()
132 "error: failed to load DSP firmware after resume %d\n", in sof_resume()
146 dev_err(sdev->dev, in sof_resume()
147 "error: failed to boot DSP firmware after resume %d\n", in sof_resume()
157 dev_warn(sdev->dev, in sof_resume()
163 if (tplg_ops && tplg_ops->set_up_all_pipelines) { in sof_resume()
164 ret = tplg_ops->set_up_all_pipelines(sdev, false); in sof_resume()
166 dev_err(sdev->dev, "Failed to restore pipeline after resume %d\n", ret); in sof_resume()
174 /* notify DSP of system resume */ in sof_resume()
175 if (pm_ops && pm_ops->ctx_restore) { in sof_resume()
176 ret = pm_ops->ctx_restore(sdev); in sof_resume()
178 dev_err(sdev->dev, "ctx_restore IPC error during resume: %d\n", ret); in sof_resume()
187 * possible DSP coredump information. in sof_resume()
203 u32 old_state = sdev->dsp_power_state.state; in sof_suspend()
206 /* do nothing if dsp suspend callback is not set */ in sof_suspend()
207 if (!runtime_suspend && !sof_ops(sdev)->suspend) in sof_suspend()
210 if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) in sof_suspend()
213 /* we need to tear down pipelines only if the DSP hardware is in sof_suspend()
218 if (tplg_ops && tplg_ops->tear_down_all_pipelines && (old_state == SOF_DSP_PM_D0)) in sof_suspend()
219 tplg_ops->tear_down_all_pipelines(sdev, false); in sof_suspend()
221 if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) in sof_suspend()
228 dev_err(sdev->dev, in sof_suspend()
243 /* Skip to platform-specific suspend if DSP is entering D0 */ in sof_suspend()
252 /* notify DSP of upcoming power down */ in sof_suspend()
253 if (pm_ops && pm_ops->ctx_save) { in sof_suspend()
254 ret = pm_ops->ctx_save(sdev); in sof_suspend()
255 if (ret == -EBUSY || ret == -EAGAIN) { in sof_suspend()
257 * runtime PM has logic to handle -EBUSY/-EAGAIN so in sof_suspend()
260 dev_err(sdev->dev, "ctx_save IPC error during suspend: %d\n", ret); in sof_suspend()
264 dev_warn(sdev->dev, "ctx_save IPC error: %d, proceeding with suspend\n", in sof_suspend()
271 /* return if the DSP was not probed successfully */ in sof_suspend()
272 if (sdev->fw_state == SOF_FW_BOOT_NOT_STARTED) in sof_suspend()
275 /* platform-specific suspend */ in sof_suspend()
281 dev_err(sdev->dev, in sof_suspend()
282 "error: failed to power down DSP during suspend %d\n", in sof_suspend()
285 /* Do not reset FW state if DSP is in D0 */ in sof_suspend()
289 /* reset FW state */ in sof_suspend()
291 sdev->enabled_cores_mask = 0; in sof_suspend()
300 /* Notify DSP of upcoming power down */ in snd_sof_dsp_power_down_notify()
301 if (sof_ops(sdev)->remove && pm_ops && pm_ops->ctx_save) in snd_sof_dsp_power_down_notify()
302 return pm_ops->ctx_save(sdev); in snd_sof_dsp_power_down_notify()
342 const struct sof_dev_desc *desc = sdev->pdata->desc; in snd_sof_prepare()
345 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
351 if (sdev->fw_state == SOF_FW_CRASHED || in snd_sof_prepare()
352 sdev->fw_state == SOF_FW_BOOT_FAILED) in snd_sof_prepare()
355 if (!desc->use_acpi_target_states) in snd_sof_prepare()
361 sdev->system_suspend_target = SOF_SUSPEND_S0IX; in snd_sof_prepare()
366 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
369 sdev->system_suspend_target = SOF_SUSPEND_S4; in snd_sof_prepare()
372 sdev->system_suspend_target = SOF_SUSPEND_S5; in snd_sof_prepare()
387 sdev->system_suspend_target = SOF_SUSPEND_NONE; in snd_sof_complete()