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()
212 ret = snd_sof_dbg_init(sdev); in sof_probe_continue()
219 dev_err(sdev->dev, "error: failed to init DSP trace/debug %d\n", in sof_probe_continue()
225 sdev->ipc = snd_sof_ipc_init(sdev); in sof_probe_continue()
226 if (!sdev->ipc) { in sof_probe_continue()
228 dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret); in sof_probe_continue()
233 ret = snd_sof_load_firmware(sdev); in sof_probe_continue()
235 dev_err(sdev->dev, "error: failed to load DSP firmware %d\n", in sof_probe_continue()
237 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_probe_continue()
241 sof_set_fw_state(sdev, SOF_FW_BOOT_IN_PROGRESS); in sof_probe_continue()
247 ret = snd_sof_run_firmware(sdev); in sof_probe_continue()
249 dev_err(sdev->dev, "error: failed to boot DSP firmware %d\n", in sof_probe_continue()
251 sof_set_fw_state(sdev, SOF_FW_BOOT_FAILED); in sof_probe_continue()
256 sdev->fw_trace_is_supported = true; in sof_probe_continue()
259 ret = sof_fw_trace_init(sdev); in sof_probe_continue()
262 dev_warn(sdev->dev, "failed to initialize firmware tracing %d\n", in sof_probe_continue()
266 dev_dbg(sdev->dev, "SOF firmware trace disabled\n"); in sof_probe_continue()
270 sdev->first_boot = false; in sof_probe_continue()
273 ret = devm_snd_soc_register_component(sdev->dev, &sdev->plat_drv, in sof_probe_continue()
274 sof_ops(sdev)->drv, in sof_probe_continue()
275 sof_ops(sdev)->num_drv); in sof_probe_continue()
277 dev_err(sdev->dev, in sof_probe_continue()
282 ret = snd_sof_machine_register(sdev, plat_data); in sof_probe_continue()
284 dev_err(sdev->dev, in sof_probe_continue()
289 ret = sof_register_clients(sdev); in sof_probe_continue()
291 dev_err(sdev->dev, "failed to register clients %d\n", ret); in sof_probe_continue()
300 if (!sof_ops(sdev)->runtime_suspend || !sof_ops(sdev)->runtime_resume) in sof_probe_continue()
301 pm_runtime_get_noresume(sdev->dev); in sof_probe_continue()
304 plat_data->sof_probe_complete(sdev->dev); in sof_probe_continue()
306 sdev->probe_completed = true; in sof_probe_continue()
311 snd_sof_machine_unregister(sdev, plat_data); in sof_probe_continue()
313 sof_fw_trace_free(sdev); in sof_probe_continue()
315 snd_sof_fw_unload(sdev); in sof_probe_continue()
317 snd_sof_ipc_free(sdev); in sof_probe_continue()
320 snd_sof_free_debug(sdev); in sof_probe_continue()
322 snd_sof_remove(sdev); in sof_probe_continue()
324 sof_ops_free(sdev); in sof_probe_continue()
327 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in sof_probe_continue()
328 sdev->first_boot = true; in sof_probe_continue()
335 struct snd_sof_dev *sdev = in sof_probe_work() local
339 ret = sof_probe_continue(sdev); in sof_probe_work()
342 dev_err(sdev->dev, "error: %s failed err: %d\n", __func__, ret); in sof_probe_work()
348 struct snd_sof_dev *sdev; in snd_sof_device_probe() local
351 sdev = devm_kzalloc(dev, sizeof(*sdev), GFP_KERNEL); in snd_sof_device_probe()
352 if (!sdev) in snd_sof_device_probe()
356 sdev->dev = dev; in snd_sof_device_probe()
359 sdev->dsp_power_state.state = SOF_DSP_PM_D0; in snd_sof_device_probe()
361 sdev->pdata = plat_data; in snd_sof_device_probe()
362 sdev->first_boot = true; in snd_sof_device_probe()
363 dev_set_drvdata(dev, sdev); in snd_sof_device_probe()
373 ret = sof_ops_init(sdev); in snd_sof_device_probe()
378 if (!sof_ops(sdev) || !sof_ops(sdev)->probe || !sof_ops(sdev)->run || in snd_sof_device_probe()
379 !sof_ops(sdev)->block_read || !sof_ops(sdev)->block_write || in snd_sof_device_probe()
380 !sof_ops(sdev)->send_msg || !sof_ops(sdev)->load_firmware || in snd_sof_device_probe()
381 !sof_ops(sdev)->ipc_msg_data) { in snd_sof_device_probe()
382 sof_ops_free(sdev); in snd_sof_device_probe()
387 INIT_LIST_HEAD(&sdev->pcm_list); in snd_sof_device_probe()
388 INIT_LIST_HEAD(&sdev->kcontrol_list); in snd_sof_device_probe()
389 INIT_LIST_HEAD(&sdev->widget_list); in snd_sof_device_probe()
390 INIT_LIST_HEAD(&sdev->dai_list); in snd_sof_device_probe()
391 INIT_LIST_HEAD(&sdev->dai_link_list); in snd_sof_device_probe()
392 INIT_LIST_HEAD(&sdev->route_list); in snd_sof_device_probe()
393 INIT_LIST_HEAD(&sdev->ipc_client_list); in snd_sof_device_probe()
394 INIT_LIST_HEAD(&sdev->ipc_rx_handler_list); in snd_sof_device_probe()
395 INIT_LIST_HEAD(&sdev->fw_state_handler_list); in snd_sof_device_probe()
396 spin_lock_init(&sdev->ipc_lock); in snd_sof_device_probe()
397 spin_lock_init(&sdev->hw_lock); in snd_sof_device_probe()
398 mutex_init(&sdev->power_state_access); in snd_sof_device_probe()
399 mutex_init(&sdev->ipc_client_mutex); in snd_sof_device_probe()
400 mutex_init(&sdev->client_event_handler_mutex); in snd_sof_device_probe()
404 sdev->ipc_timeout = TIMEOUT_DEFAULT_IPC_MS; in snd_sof_device_probe()
406 sdev->ipc_timeout = plat_data->desc->ipc_timeout; in snd_sof_device_probe()
408 sdev->boot_timeout = TIMEOUT_DEFAULT_BOOT_MS; in snd_sof_device_probe()
410 sdev->boot_timeout = plat_data->desc->boot_timeout; in snd_sof_device_probe()
412 sof_set_fw_state(sdev, SOF_FW_BOOT_NOT_STARTED); in snd_sof_device_probe()
415 INIT_WORK(&sdev->probe_work, sof_probe_work); in snd_sof_device_probe()
416 schedule_work(&sdev->probe_work); in snd_sof_device_probe()
420 return sof_probe_continue(sdev); in snd_sof_device_probe()
426 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_device_probe_completed() local
428 return sdev->probe_completed; in snd_sof_device_probe_completed()
434 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_device_remove() local
435 struct snd_sof_pdata *pdata = sdev->pdata; in snd_sof_device_remove()
439 cancel_work_sync(&sdev->probe_work); in snd_sof_device_remove()
445 sof_unregister_clients(sdev); in snd_sof_device_remove()
452 snd_sof_machine_unregister(sdev, pdata); in snd_sof_device_remove()
454 if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) { in snd_sof_device_remove()
455 sof_fw_trace_free(sdev); in snd_sof_device_remove()
456 ret = snd_sof_dsp_power_down_notify(sdev); in snd_sof_device_remove()
461 snd_sof_ipc_free(sdev); in snd_sof_device_remove()
462 snd_sof_free_debug(sdev); in snd_sof_device_remove()
463 snd_sof_remove(sdev); in snd_sof_device_remove()
466 sof_ops_free(sdev); in snd_sof_device_remove()
469 snd_sof_fw_unload(sdev); in snd_sof_device_remove()
477 struct snd_sof_dev *sdev = dev_get_drvdata(dev); in snd_sof_device_shutdown() local
478 struct snd_sof_pdata *pdata = sdev->pdata; in snd_sof_device_shutdown()
481 cancel_work_sync(&sdev->probe_work); in snd_sof_device_shutdown()
487 sof_unregister_clients(sdev); in snd_sof_device_shutdown()
489 snd_sof_machine_unregister(sdev, pdata); in snd_sof_device_shutdown()
491 if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) in snd_sof_device_shutdown()
492 return snd_sof_shutdown(sdev); in snd_sof_device_shutdown()