Lines Matching refs:sdev
21 static u32 snd_sof_dsp_power_target(struct snd_sof_dev *sdev) in snd_sof_dsp_power_target() argument
25 switch (sdev->system_suspend_target) { in snd_sof_dsp_power_target()
40 if (snd_sof_stream_suspend_ignored(sdev)) in snd_sof_dsp_power_target()
55 static void sof_cache_debugfs(struct snd_sof_dev *sdev) in sof_cache_debugfs() argument
59 list_for_each_entry(dfse, &sdev->dfsentry_list, list) { in sof_cache_debugfs()
75 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sof_resume() local
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()
97 ret = snd_sof_dsp_runtime_resume(sdev); in sof_resume()
99 ret = snd_sof_dsp_resume(sdev); in sof_resume()
101 dev_err(sdev->dev, in sof_resume()
111 if (!runtime_resume && sof_ops(sdev)->set_power_state && in sof_resume()
113 ret = sof_fw_trace_resume(sdev); in sof_resume()
116 dev_warn(sdev->dev, in sof_resume()
121 sof_set_fw_state(sdev, SOF_FW_BOOT_PREPARE); in sof_resume()
124 ret = snd_sof_load_firmware(sdev); in sof_resume()
126 dev_err(sdev->dev, in sof_resume()
129 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_resume()
133 sof_set_fw_state(sdev, SOF_FW_BOOT_IN_PROGRESS); in sof_resume()
139 ret = snd_sof_run_firmware(sdev); in sof_resume()
141 dev_err(sdev->dev, in sof_resume()
144 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_resume()
149 ret = sof_fw_trace_resume(sdev); in sof_resume()
152 dev_warn(sdev->dev, 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()
167 sof_resume_clients(sdev); 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()
181 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sof_suspend() local
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()
200 ret = snd_sof_dsp_hw_params_upon_resume(sdev); in sof_suspend()
202 dev_err(sdev->dev, in sof_suspend()
209 target_state = snd_sof_dsp_power_target(sdev); in sof_suspend()
214 sof_fw_trace_suspend(sdev, pm_state); in sof_suspend()
216 sof_suspend_clients(sdev, pm_state); in sof_suspend()
221 tplg_ops->tear_down_all_pipelines(sdev, false); in sof_suspend()
224 sof_fw_trace_suspend(sdev, pm_state); in sof_suspend()
227 sof_suspend_clients(sdev, pm_state); in sof_suspend()
232 sof_cache_debugfs(sdev); in sof_suspend()
236 ret = pm_ops->ctx_save(sdev); in sof_suspend()
242 dev_err(sdev->dev, "ctx_save IPC error during suspend: %d\n", ret); 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()
259 ret = snd_sof_dsp_runtime_suspend(sdev); in sof_suspend()
261 ret = snd_sof_dsp_suspend(sdev, target_state); in sof_suspend()
263 dev_err(sdev->dev, in sof_suspend()
272 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in sof_suspend()
273 sdev->enabled_cores_mask = 0; in sof_suspend()
278 int snd_sof_dsp_power_down_notify(struct snd_sof_dev *sdev) in snd_sof_dsp_power_down_notify() argument
280 const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm; 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()
297 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_runtime_idle() local
299 return snd_sof_dsp_runtime_idle(sdev); in snd_sof_runtime_idle()
323 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_prepare() local
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()
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()
367 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_complete() local
369 sdev->system_suspend_target = SOF_SUSPEND_NONE; in snd_sof_complete()