Lines Matching refs:sdev
26 struct snd_sof_dev *sdev = dfse->sdev; in sof_dfsentry_read() local
69 if (pm_runtime_active(sdev->dev) || in sof_dfsentry_read()
73 dev_info(sdev->dev, in sof_dfsentry_read()
79 if (!pm_runtime_active(sdev->dev) && in sof_dfsentry_read()
81 dev_err(sdev->dev, in sof_dfsentry_read()
114 static int snd_sof_debugfs_io_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_io_item() argument
121 if (!sdev) in snd_sof_debugfs_io_item()
124 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_io_item()
131 dfse->sdev = sdev; in snd_sof_debugfs_io_item()
140 dfse->cache_buf = devm_kzalloc(sdev->dev, size, GFP_KERNEL); in snd_sof_debugfs_io_item()
146 debugfs_create_file(name, 0444, sdev->debugfs_root, dfse, in snd_sof_debugfs_io_item()
150 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_io_item()
155 int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev, in snd_sof_debugfs_add_region_item_iomem() argument
160 int bar = snd_sof_dsp_get_bar_index(sdev, blk_type); in snd_sof_debugfs_add_region_item_iomem()
165 return snd_sof_debugfs_io_item(sdev, sdev->bar[bar] + offset, size, name, in snd_sof_debugfs_add_region_item_iomem()
171 int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_buf_item() argument
177 if (!sdev) in snd_sof_debugfs_buf_item()
180 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_buf_item()
187 dfse->sdev = sdev; in snd_sof_debugfs_buf_item()
189 debugfs_create_file(name, mode, sdev->debugfs_root, dfse, in snd_sof_debugfs_buf_item()
192 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_buf_item()
198 static int memory_info_update(struct snd_sof_dev *sdev, char *buf, size_t buff_size) in memory_info_update() argument
213 ret = pm_runtime_resume_and_get(sdev->dev); in memory_info_update()
215 dev_err(sdev->dev, "error: enabling device failed: %d\n", ret); in memory_info_update()
219 ret = sof_ipc_tx_message(sdev->ipc, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE); in memory_info_update()
220 pm_runtime_mark_last_busy(sdev->dev); in memory_info_update()
221 pm_runtime_put_autosuspend(sdev->dev); in memory_info_update()
224 dev_err(sdev->dev, "error: reading memory info failed, %d\n", ret); in memory_info_update()
229 dev_err(sdev->dev, "error: invalid memory info ipc struct size, %d\n", in memory_info_update()
253 struct snd_sof_dev *sdev = dfse->sdev; in memory_info_read() local
259 data_length = memory_info_update(sdev, dfse->buf, dfse->size); in memory_info_read()
271 struct snd_sof_dev *sdev = dfse->sdev; in memory_info_open() local
277 dfse->buf = devm_kmalloc(sdev->dev, PAGE_SIZE, GFP_KERNEL); in memory_info_open()
292 int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev) in snd_sof_dbg_memory_info_init() argument
296 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_dbg_memory_info_init()
302 dfse->sdev = sdev; in snd_sof_dbg_memory_info_init()
304 debugfs_create_file("memory_info", 0444, sdev->debugfs_root, dfse, &memory_info_fops); in snd_sof_dbg_memory_info_init()
307 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_dbg_memory_info_init()
312 int snd_sof_dbg_init(struct snd_sof_dev *sdev) in snd_sof_dbg_init() argument
314 const struct snd_sof_dsp_ops *ops = sof_ops(sdev); in snd_sof_dbg_init()
315 struct snd_sof_pdata *plat_data = sdev->pdata; in snd_sof_dbg_init()
322 sdev->debugfs_root = debugfs_create_dir("sof", NULL); in snd_sof_dbg_init()
325 fw_profile = debugfs_create_dir("fw_profile", sdev->debugfs_root); in snd_sof_dbg_init()
341 fw_lib_path = devm_kasprintf(sdev->dev, GFP_KERNEL, in snd_sof_dbg_init()
360 INIT_LIST_HEAD(&sdev->dfsentry_list); in snd_sof_dbg_init()
366 err = snd_sof_debugfs_io_item(sdev, sdev->bar[map->bar] + in snd_sof_dbg_init()
374 return snd_sof_debugfs_buf_item(sdev, &sdev->fw_state, in snd_sof_dbg_init()
375 sizeof(sdev->fw_state), in snd_sof_dbg_init()
380 void snd_sof_free_debug(struct snd_sof_dev *sdev) in snd_sof_free_debug() argument
382 debugfs_remove_recursive(sdev->debugfs_root); in snd_sof_free_debug()
401 static void snd_sof_dbg_print_fw_state(struct snd_sof_dev *sdev, const char *level) in snd_sof_dbg_print_fw_state() argument
406 if (sdev->fw_state == fw_state_dbg[i].state) { in snd_sof_dbg_print_fw_state()
407 dev_printk(level, sdev->dev, "fw_state: %s (%d)\n", in snd_sof_dbg_print_fw_state()
413 dev_printk(level, sdev->dev, "fw_state: UNKNOWN (%d)\n", sdev->fw_state); in snd_sof_dbg_print_fw_state()
416 void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags) in snd_sof_dsp_dbg_dump() argument
424 if (sof_ops(sdev)->dbg_dump && !sdev->dbg_dump_printed) { in snd_sof_dsp_dbg_dump()
425 dev_printk(level, sdev->dev, in snd_sof_dsp_dbg_dump()
428 dev_printk(level, sdev->dev, "%s\n", msg); in snd_sof_dsp_dbg_dump()
429 snd_sof_dbg_print_fw_state(sdev, level); in snd_sof_dsp_dbg_dump()
430 sof_ops(sdev)->dbg_dump(sdev, flags); in snd_sof_dsp_dbg_dump()
431 dev_printk(level, sdev->dev, in snd_sof_dsp_dbg_dump()
434 sdev->dbg_dump_printed = true; in snd_sof_dsp_dbg_dump()
436 dev_printk(level, sdev->dev, "%s\n", msg); in snd_sof_dsp_dbg_dump()
441 static void snd_sof_ipc_dump(struct snd_sof_dev *sdev) in snd_sof_ipc_dump() argument
443 if (sof_ops(sdev)->ipc_dump && !sdev->ipc_dump_printed) { in snd_sof_ipc_dump()
444 dev_err(sdev->dev, "------------[ IPC dump start ]------------\n"); in snd_sof_ipc_dump()
445 sof_ops(sdev)->ipc_dump(sdev); in snd_sof_ipc_dump()
446 dev_err(sdev->dev, "------------[ IPC dump end ]------------\n"); in snd_sof_ipc_dump()
448 sdev->ipc_dump_printed = true; in snd_sof_ipc_dump()
452 void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev, const char *msg) in snd_sof_handle_fw_exception() argument
455 sof_debug_check_flag(SOF_DBG_RETAIN_CTX)) && !sdev->d3_prevented) { in snd_sof_handle_fw_exception()
457 if (!sdev->ipc_dump_printed) in snd_sof_handle_fw_exception()
458 dev_info(sdev->dev, in snd_sof_handle_fw_exception()
461 if (pm_runtime_get_if_in_use(sdev->dev) == 1) in snd_sof_handle_fw_exception()
462 sdev->d3_prevented = true; in snd_sof_handle_fw_exception()
466 snd_sof_ipc_dump(sdev); in snd_sof_handle_fw_exception()
467 snd_sof_dsp_dbg_dump(sdev, msg, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX); in snd_sof_handle_fw_exception()
468 sof_fw_trace_fw_crashed(sdev); in snd_sof_handle_fw_exception()