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()
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 = sof_ipc_get_ops(sdev, pm); in sof_suspend()
183 const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg); in sof_suspend()
185 u32 target_state = snd_sof_dsp_power_target(sdev); 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()
196 tplg_ops->tear_down_all_pipelines(sdev, false); in sof_suspend()
198 if (sdev->fw_state != SOF_FW_BOOT_COMPLETE) in sof_suspend()
203 ret = snd_sof_dsp_hw_params_upon_resume(sdev); in sof_suspend()
205 dev_err(sdev->dev, in sof_suspend()
216 sof_fw_trace_suspend(sdev, pm_state); in sof_suspend()
218 sof_suspend_clients(sdev, pm_state); in sof_suspend()
223 sof_fw_trace_suspend(sdev, pm_state); in sof_suspend()
226 sof_suspend_clients(sdev, pm_state); in sof_suspend()
231 sof_cache_debugfs(sdev); in sof_suspend()
235 ret = pm_ops->ctx_save(sdev); in sof_suspend()
241 dev_err(sdev->dev, "ctx_save IPC error during suspend: %d\n", ret); in sof_suspend()
245 dev_warn(sdev->dev, "ctx_save IPC error: %d, proceeding with suspend\n", in sof_suspend()
253 if (sdev->fw_state == SOF_FW_BOOT_NOT_STARTED) in sof_suspend()
258 ret = snd_sof_dsp_runtime_suspend(sdev); in sof_suspend()
260 ret = snd_sof_dsp_suspend(sdev, target_state); in sof_suspend()
262 dev_err(sdev->dev, in sof_suspend()
271 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in sof_suspend()
272 sdev->enabled_cores_mask = 0; in sof_suspend()
277 int snd_sof_dsp_power_down_notify(struct snd_sof_dev *sdev) in snd_sof_dsp_power_down_notify() argument
279 const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm); in snd_sof_dsp_power_down_notify()
282 if (sof_ops(sdev)->remove && pm_ops && pm_ops->ctx_save) in snd_sof_dsp_power_down_notify()
283 return pm_ops->ctx_save(sdev); in snd_sof_dsp_power_down_notify()
296 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_runtime_idle() local
298 return snd_sof_dsp_runtime_idle(sdev); in snd_sof_runtime_idle()
322 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_prepare() local
323 const struct sof_dev_desc *desc = sdev->pdata->desc; in snd_sof_prepare()
326 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
332 if (sdev->fw_state == SOF_FW_CRASHED || in snd_sof_prepare()
333 sdev->fw_state == SOF_FW_BOOT_FAILED) in snd_sof_prepare()
342 sdev->system_suspend_target = SOF_SUSPEND_S0IX; in snd_sof_prepare()
347 sdev->system_suspend_target = SOF_SUSPEND_S3; in snd_sof_prepare()
350 sdev->system_suspend_target = SOF_SUSPEND_S4; in snd_sof_prepare()
353 sdev->system_suspend_target = SOF_SUSPEND_S5; in snd_sof_prepare()
366 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_complete() local
368 sdev->system_suspend_target = SOF_SUSPEND_NONE; in snd_sof_complete()