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 = sof_ipc_get_ops(sdev, pm); in sof_resume()
77 const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, 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()
106 if (sdev->dspless_mode_selected) { in sof_resume()
107 sof_set_fw_state(sdev, SOF_DSPLESS_MODE); in sof_resume()
116 if (!runtime_resume && sof_ops(sdev)->set_power_state && in sof_resume()
118 ret = sof_fw_trace_resume(sdev); in sof_resume()
121 dev_warn(sdev->dev, in sof_resume()
126 sof_set_fw_state(sdev, SOF_FW_BOOT_PREPARE); in sof_resume()
129 ret = snd_sof_load_firmware(sdev); in sof_resume()
131 dev_err(sdev->dev, in sof_resume()
134 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_resume()
138 sof_set_fw_state(sdev, SOF_FW_BOOT_IN_PROGRESS); in sof_resume()
144 ret = snd_sof_run_firmware(sdev); in sof_resume()
146 dev_err(sdev->dev, in sof_resume()
149 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_resume()
154 ret = sof_fw_trace_resume(sdev); in sof_resume()
157 dev_warn(sdev->dev, 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()
172 sof_resume_clients(sdev); 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()
189 sof_cache_debugfs(sdev); in sof_resume()
198 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in sof_suspend() local
199 const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm); in sof_suspend()
200 const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); in sof_suspend()
202 u32 target_state = snd_sof_dsp_power_target(sdev); in sof_suspend()
203 u32 old_state = sdev->dsp_power_state.state; 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()
219 tplg_ops->tear_down_all_pipelines(sdev, false); in sof_suspend()
221 if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) in sof_suspend()
226 ret = snd_sof_dsp_hw_params_upon_resume(sdev); in sof_suspend()
228 dev_err(sdev->dev, in sof_suspend()
238 sof_fw_trace_suspend(sdev, pm_state); in sof_suspend()
241 sof_suspend_clients(sdev, pm_state); in sof_suspend()
250 sof_cache_debugfs(sdev); in sof_suspend()
254 ret = pm_ops->ctx_save(sdev); 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()
272 if (sdev->fw_state == SOF_FW_BOOT_NOT_STARTED) in sof_suspend()
277 ret = snd_sof_dsp_runtime_suspend(sdev); in sof_suspend()
279 ret = snd_sof_dsp_suspend(sdev, target_state); in sof_suspend()
281 dev_err(sdev->dev, in sof_suspend()
290 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in sof_suspend()
291 sdev->enabled_cores_mask = 0; in sof_suspend()
296 int snd_sof_dsp_power_down_notify(struct snd_sof_dev *sdev) in snd_sof_dsp_power_down_notify() argument
298 const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm); 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()
315 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_runtime_idle() local
317 return snd_sof_dsp_runtime_idle(sdev); in snd_sof_runtime_idle()
341 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_prepare() local
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()
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()
385 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_complete() local
387 sdev->system_suspend_target = SOF_SUSPEND_NONE; in snd_sof_complete()