Lines Matching refs:sdev

86 void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level,  in sof_print_oops_and_stack()  argument
96 dev_printk(level, sdev->dev, "unexpected fault %#010x trace %#010x\n", in sof_print_oops_and_stack()
105 dev_printk(level, sdev->dev, "reason: %s (%#x)\n", in sof_print_oops_and_stack()
107 dev_printk(level, sdev->dev, "trace point: %#010x\n", tracep_code); in sof_print_oops_and_stack()
113 dev_printk(level, sdev->dev, "unknown panic code: %#x\n", in sof_print_oops_and_stack()
115 dev_printk(level, sdev->dev, "trace point: %#010x\n", tracep_code); in sof_print_oops_and_stack()
118 dev_printk(level, sdev->dev, "panic at %s:%d\n", panic_info->filename, in sof_print_oops_and_stack()
120 sof_oops(sdev, level, oops); in sof_print_oops_and_stack()
121 sof_stack(sdev, level, oops, stack, stack_words); in sof_print_oops_and_stack()
126 void sof_set_fw_state(struct snd_sof_dev *sdev, enum sof_fw_state new_state) in sof_set_fw_state() argument
128 if (sdev->fw_state == new_state) in sof_set_fw_state()
131 dev_dbg(sdev->dev, "fw_state change: %d -> %d\n", sdev->fw_state, new_state); in sof_set_fw_state()
132 sdev->fw_state = new_state; in sof_set_fw_state()
138 sof_client_fw_state_dispatcher(sdev); in sof_set_fw_state()
186 static int sof_probe_continue(struct snd_sof_dev *sdev) in sof_probe_continue() argument
188 struct snd_sof_pdata *plat_data = sdev->pdata; in sof_probe_continue()
192 ret = snd_sof_probe(sdev); in sof_probe_continue()
194 dev_err(sdev->dev, "error: failed to probe DSP %d\n", ret); in sof_probe_continue()
198 sof_set_fw_state(sdev, SOF_FW_BOOT_PREPARE); in sof_probe_continue()
201 ret = sof_machine_check(sdev); in sof_probe_continue()
203 dev_err(sdev->dev, "error: failed to get machine info %d\n", in sof_probe_continue()
209 snd_sof_new_platform_drv(sdev); in sof_probe_continue()
211 if (sdev->dspless_mode_selected) { in sof_probe_continue()
212 sof_set_fw_state(sdev, SOF_DSPLESS_MODE); in sof_probe_continue()
217 ret = snd_sof_dbg_init(sdev); in sof_probe_continue()
224 dev_err(sdev->dev, "error: failed to init DSP trace/debug %d\n", in sof_probe_continue()
230 sdev->ipc = snd_sof_ipc_init(sdev); in sof_probe_continue()
231 if (!sdev->ipc) { in sof_probe_continue()
233 dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret); in sof_probe_continue()
238 ret = snd_sof_load_firmware(sdev); in sof_probe_continue()
240 dev_err(sdev->dev, "error: failed to load DSP firmware %d\n", in sof_probe_continue()
242 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_probe_continue()
246 sof_set_fw_state(sdev, SOF_FW_BOOT_IN_PROGRESS); in sof_probe_continue()
252 ret = snd_sof_run_firmware(sdev); in sof_probe_continue()
254 dev_err(sdev->dev, "error: failed to boot DSP firmware %d\n", in sof_probe_continue()
256 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_probe_continue()
261 sdev->fw_trace_is_supported = true; in sof_probe_continue()
264 ret = sof_fw_trace_init(sdev); in sof_probe_continue()
267 dev_warn(sdev->dev, "failed to initialize firmware tracing %d\n", in sof_probe_continue()
271 dev_dbg(sdev->dev, "SOF firmware trace disabled\n"); in sof_probe_continue()
276 sdev->first_boot = false; in sof_probe_continue()
279 ret = devm_snd_soc_register_component(sdev->dev, &sdev->plat_drv, in sof_probe_continue()
280 sof_ops(sdev)->drv, in sof_probe_continue()
281 sof_ops(sdev)->num_drv); in sof_probe_continue()
283 dev_err(sdev->dev, in sof_probe_continue()
288 ret = snd_sof_machine_register(sdev, plat_data); in sof_probe_continue()
290 dev_err(sdev->dev, in sof_probe_continue()
295 ret = sof_register_clients(sdev); in sof_probe_continue()
297 dev_err(sdev->dev, "failed to register clients %d\n", ret); in sof_probe_continue()
306 if (!sof_ops(sdev)->runtime_suspend || !sof_ops(sdev)->runtime_resume) in sof_probe_continue()
307 pm_runtime_get_noresume(sdev->dev); in sof_probe_continue()
310 plat_data->sof_probe_complete(sdev->dev); in sof_probe_continue()
312 sdev->probe_completed = true; in sof_probe_continue()
317 snd_sof_machine_unregister(sdev, plat_data); in sof_probe_continue()
319 sof_fw_trace_free(sdev); in sof_probe_continue()
321 snd_sof_fw_unload(sdev); in sof_probe_continue()
323 snd_sof_ipc_free(sdev); in sof_probe_continue()
326 snd_sof_free_debug(sdev); in sof_probe_continue()
328 snd_sof_remove(sdev); in sof_probe_continue()
330 sof_ops_free(sdev); in sof_probe_continue()
333 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in sof_probe_continue()
334 sdev->first_boot = true; in sof_probe_continue()
341 struct snd_sof_dev *sdev = in sof_probe_work() local
345 ret = sof_probe_continue(sdev); in sof_probe_work()
348 dev_err(sdev->dev, "error: %s failed err: %d\n", __func__, ret); in sof_probe_work()
354 struct snd_sof_dev *sdev; in snd_sof_device_probe() local
357 sdev = devm_kzalloc(dev, sizeof(*sdev), GFP_KERNEL); in snd_sof_device_probe()
358 if (!sdev) in snd_sof_device_probe()
362 sdev->dev = dev; in snd_sof_device_probe()
365 sdev->dsp_power_state.state = SOF_DSP_PM_D0; in snd_sof_device_probe()
367 sdev->pdata = plat_data; in snd_sof_device_probe()
368 sdev->first_boot = true; in snd_sof_device_probe()
369 dev_set_drvdata(dev, sdev); in snd_sof_device_probe()
377 sdev->dspless_mode_selected = true; in snd_sof_device_probe()
391 ret = sof_ops_init(sdev); in snd_sof_device_probe()
396 if (!sof_ops(sdev) || !sof_ops(sdev)->probe) { in snd_sof_device_probe()
397 sof_ops_free(sdev); in snd_sof_device_probe()
402 if (!sdev->dspless_mode_selected && in snd_sof_device_probe()
403 (!sof_ops(sdev)->run || !sof_ops(sdev)->block_read || in snd_sof_device_probe()
404 !sof_ops(sdev)->block_write || !sof_ops(sdev)->send_msg || in snd_sof_device_probe()
405 !sof_ops(sdev)->load_firmware || !sof_ops(sdev)->ipc_msg_data)) { in snd_sof_device_probe()
406 sof_ops_free(sdev); in snd_sof_device_probe()
411 INIT_LIST_HEAD(&sdev->pcm_list); in snd_sof_device_probe()
412 INIT_LIST_HEAD(&sdev->kcontrol_list); in snd_sof_device_probe()
413 INIT_LIST_HEAD(&sdev->widget_list); in snd_sof_device_probe()
414 INIT_LIST_HEAD(&sdev->pipeline_list); in snd_sof_device_probe()
415 INIT_LIST_HEAD(&sdev->dai_list); in snd_sof_device_probe()
416 INIT_LIST_HEAD(&sdev->dai_link_list); in snd_sof_device_probe()
417 INIT_LIST_HEAD(&sdev->route_list); in snd_sof_device_probe()
418 INIT_LIST_HEAD(&sdev->ipc_client_list); in snd_sof_device_probe()
419 INIT_LIST_HEAD(&sdev->ipc_rx_handler_list); in snd_sof_device_probe()
420 INIT_LIST_HEAD(&sdev->fw_state_handler_list); in snd_sof_device_probe()
421 spin_lock_init(&sdev->ipc_lock); in snd_sof_device_probe()
422 spin_lock_init(&sdev->hw_lock); in snd_sof_device_probe()
423 mutex_init(&sdev->power_state_access); in snd_sof_device_probe()
424 mutex_init(&sdev->ipc_client_mutex); in snd_sof_device_probe()
425 mutex_init(&sdev->client_event_handler_mutex); in snd_sof_device_probe()
429 sdev->ipc_timeout = TIMEOUT_DEFAULT_IPC_MS; in snd_sof_device_probe()
431 sdev->ipc_timeout = plat_data->desc->ipc_timeout; in snd_sof_device_probe()
433 sdev->boot_timeout = TIMEOUT_DEFAULT_BOOT_MS; in snd_sof_device_probe()
435 sdev->boot_timeout = plat_data->desc->boot_timeout; in snd_sof_device_probe()
437 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in snd_sof_device_probe()
440 INIT_WORK(&sdev->probe_work, sof_probe_work); in snd_sof_device_probe()
441 schedule_work(&sdev->probe_work); in snd_sof_device_probe()
445 return sof_probe_continue(sdev); in snd_sof_device_probe()
451 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_device_probe_completed() local
453 return sdev->probe_completed; in snd_sof_device_probe_completed()
459 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_device_remove() local
460 struct snd_sof_pdata *pdata = sdev->pdata; in snd_sof_device_remove()
464 cancel_work_sync(&sdev->probe_work); in snd_sof_device_remove()
470 sof_unregister_clients(sdev); in snd_sof_device_remove()
477 snd_sof_machine_unregister(sdev, pdata); in snd_sof_device_remove()
479 if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) { in snd_sof_device_remove()
480 sof_fw_trace_free(sdev); in snd_sof_device_remove()
481 ret = snd_sof_dsp_power_down_notify(sdev); in snd_sof_device_remove()
486 snd_sof_ipc_free(sdev); in snd_sof_device_remove()
487 snd_sof_free_debug(sdev); in snd_sof_device_remove()
488 snd_sof_remove(sdev); in snd_sof_device_remove()
489 sof_ops_free(sdev); in snd_sof_device_remove()
493 snd_sof_fw_unload(sdev); in snd_sof_device_remove()
501 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_device_shutdown() local
504 cancel_work_sync(&sdev->probe_work); in snd_sof_device_shutdown()
506 if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) { in snd_sof_device_shutdown()
507 sof_fw_trace_free(sdev); in snd_sof_device_shutdown()
508 return snd_sof_shutdown(sdev); in snd_sof_device_shutdown()