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()
27 /* DSP should be in D3 if the system is suspending to S3 */ in snd_sof_dsp_power_target()
32 * Currently, the only criterion for retaining the DSP in D0 in snd_sof_dsp_power_target()
34 * Additional criteria such Soundwire clock-stop mode and in snd_sof_dsp_power_target()
62 /* send ctx save ipc to dsp */ in sof_send_pm_ctx_ipc()
63 return sof_ipc_tx_message(sdev->ipc, pm_ctx.hdr.cmd, &pm_ctx, in sof_send_pm_ctx_ipc()
72 list_for_each_entry(dfse, &sdev->dfsentry_list, list) { in sof_cache_debugfs()
75 if (dfse->type == SOF_DFSENTRY_TYPE_BUF) in sof_cache_debugfs()
79 if (dfse->access_type == SOF_DEBUGFS_ACCESS_D0_ONLY) in sof_cache_debugfs()
80 memcpy_fromio(dfse->cache_buf, dfse->io_mem, in sof_cache_debugfs()
81 dfse->size); in sof_cache_debugfs()
89 u32 old_state = sdev->dsp_power_state.state; in sof_resume()
92 /* do nothing if dsp resume callbacks are not set */ in sof_resume()
93 if (!runtime_resume && !sof_ops(sdev)->resume) in sof_resume()
96 if (runtime_resume && !sof_ops(sdev)->runtime_resume) in sof_resume()
99 /* DSP was never successfully started, nothing to resume */ in sof_resume()
100 if (sdev->first_boot) in sof_resume()
112 dev_err(sdev->dev, in sof_resume()
113 "error: failed to power up DSP after resume\n"); in sof_resume()
121 if (!runtime_resume && sof_ops(sdev)->set_power_state && in sof_resume()
125 sdev->fw_state = SOF_FW_BOOT_PREPARE; in sof_resume()
130 dev_err(sdev->dev, in sof_resume()
131 "error: failed to load DSP firmware after resume %d\n", in sof_resume()
136 sdev->fw_state = SOF_FW_BOOT_IN_PROGRESS; in sof_resume()
144 dev_err(sdev->dev, in sof_resume()
145 "error: failed to boot DSP firmware after resume %d\n", in sof_resume()
154 dev_warn(sdev->dev, in sof_resume()
160 ret = sof_restore_pipelines(sdev->dev); in sof_resume()
162 dev_err(sdev->dev, in sof_resume()
168 /* notify DSP of system resume */ in sof_resume()
171 dev_err(sdev->dev, in sof_resume()
184 /* do nothing if dsp suspend callback is not set */ in sof_suspend()
185 if (!runtime_suspend && !sof_ops(sdev)->suspend) in sof_suspend()
188 if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) in sof_suspend()
191 if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) in sof_suspend()
196 ret = sof_set_hw_params_upon_resume(sdev->dev); in sof_suspend()
198 dev_err(sdev->dev, in sof_suspend()
207 /* Skip to platform-specific suspend if DSP is entering D0 */ in sof_suspend()
219 /* notify DSP of upcoming power down */ in sof_suspend()
221 if (ret == -EBUSY || ret == -EAGAIN) { in sof_suspend()
223 * runtime PM has logic to handle -EBUSY/-EAGAIN so in sof_suspend()
226 dev_err(sdev->dev, in sof_suspend()
232 dev_warn(sdev->dev, in sof_suspend()
239 /* return if the DSP was not probed successfully */ in sof_suspend()
240 if (sdev->fw_state == SOF_FW_BOOT_NOT_STARTED) in sof_suspend()
243 /* platform-specific suspend */ in sof_suspend()
249 dev_err(sdev->dev, in sof_suspend()
250 "error: failed to power down DSP during suspend %d\n", in sof_suspend()
253 /* Do not reset FW state if DSP is in D0 */ in sof_suspend()
257 /* reset FW state */ in sof_suspend()
258 sdev->fw_state = SOF_FW_BOOT_NOT_STARTED; in sof_suspend()
259 sdev->enabled_cores_mask = 0; in sof_suspend()
266 /* Notify DSP of upcoming power down */ in snd_sof_dsp_power_down_notify()
267 if (sof_ops(sdev)->remove) in snd_sof_dsp_power_down_notify()
308 const struct sof_dev_desc *desc = sdev->pdata->desc; in snd_sof_prepare()
311 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
313 if (!desc->use_acpi_target_states) in snd_sof_prepare()
318 sdev->system_suspend_target = SOF_SUSPEND_S0IX; in snd_sof_prepare()
329 sdev->system_suspend_target = SOF_SUSPEND_NONE; in snd_sof_complete()