Lines Matching refs:sdev

44 	struct snd_sof_dev *sdev = dfse->sdev;  in sof_dfsentry_read()  local
87 if (pm_runtime_active(sdev->dev) || in sof_dfsentry_read()
91 dev_info(sdev->dev, in sof_dfsentry_read()
97 if (!pm_runtime_active(sdev->dev) && in sof_dfsentry_read()
99 dev_err(sdev->dev, in sof_dfsentry_read()
133 static int snd_sof_debugfs_io_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_io_item() argument
140 if (!sdev) in snd_sof_debugfs_io_item()
143 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_io_item()
150 dfse->sdev = sdev; in snd_sof_debugfs_io_item()
159 dfse->cache_buf = devm_kzalloc(sdev->dev, size, GFP_KERNEL); in snd_sof_debugfs_io_item()
165 debugfs_create_file(name, 0444, sdev->debugfs_root, dfse, in snd_sof_debugfs_io_item()
169 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_io_item()
174 int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev, in snd_sof_debugfs_add_region_item_iomem() argument
179 int bar = snd_sof_dsp_get_bar_index(sdev, blk_type); in snd_sof_debugfs_add_region_item_iomem()
184 return snd_sof_debugfs_io_item(sdev, sdev->bar[bar] + offset, size, name, in snd_sof_debugfs_add_region_item_iomem()
190 int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_buf_item() argument
196 if (!sdev) in snd_sof_debugfs_buf_item()
199 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_buf_item()
206 dfse->sdev = sdev; in snd_sof_debugfs_buf_item()
208 debugfs_create_file(name, mode, sdev->debugfs_root, dfse, in snd_sof_debugfs_buf_item()
211 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_buf_item()
217 static int memory_info_update(struct snd_sof_dev *sdev, char *buf, size_t buff_size) in memory_info_update() argument
232 ret = pm_runtime_resume_and_get(sdev->dev); in memory_info_update()
234 dev_err(sdev->dev, "error: enabling device failed: %d\n", ret); in memory_info_update()
238 ret = sof_ipc_tx_message(sdev->ipc, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE); in memory_info_update()
239 pm_runtime_mark_last_busy(sdev->dev); in memory_info_update()
240 pm_runtime_put_autosuspend(sdev->dev); in memory_info_update()
243 dev_err(sdev->dev, "error: reading memory info failed, %d\n", ret); in memory_info_update()
248 dev_err(sdev->dev, "error: invalid memory info ipc struct size, %d\n", in memory_info_update()
272 struct snd_sof_dev *sdev = dfse->sdev; in memory_info_read() local
278 data_length = memory_info_update(sdev, dfse->buf, dfse->size); in memory_info_read()
290 struct snd_sof_dev *sdev = dfse->sdev; in memory_info_open() local
296 dfse->buf = devm_kmalloc(sdev->dev, PAGE_SIZE, GFP_KERNEL); in memory_info_open()
311 int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev) in snd_sof_dbg_memory_info_init() argument
315 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_dbg_memory_info_init()
321 dfse->sdev = sdev; in snd_sof_dbg_memory_info_init()
323 debugfs_create_file("memory_info", 0444, sdev->debugfs_root, dfse, &memory_info_fops); in snd_sof_dbg_memory_info_init()
326 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_dbg_memory_info_init()
331 int snd_sof_dbg_init(struct snd_sof_dev *sdev) in snd_sof_dbg_init() argument
333 struct snd_sof_dsp_ops *ops = sof_ops(sdev); in snd_sof_dbg_init()
339 sdev->debugfs_root = debugfs_create_dir("sof", NULL); in snd_sof_dbg_init()
342 INIT_LIST_HEAD(&sdev->dfsentry_list); in snd_sof_dbg_init()
348 err = snd_sof_debugfs_io_item(sdev, sdev->bar[map->bar] + in snd_sof_dbg_init()
356 return snd_sof_debugfs_buf_item(sdev, &sdev->fw_state, in snd_sof_dbg_init()
357 sizeof(sdev->fw_state), in snd_sof_dbg_init()
362 void snd_sof_free_debug(struct snd_sof_dev *sdev) in snd_sof_free_debug() argument
364 debugfs_remove_recursive(sdev->debugfs_root); in snd_sof_free_debug()
382 static void snd_sof_dbg_print_fw_state(struct snd_sof_dev *sdev, const char *level) in snd_sof_dbg_print_fw_state() argument
387 if (sdev->fw_state == fw_state_dbg[i].state) { in snd_sof_dbg_print_fw_state()
388 dev_printk(level, sdev->dev, "fw_state: %s (%d)\n", in snd_sof_dbg_print_fw_state()
394 dev_printk(level, sdev->dev, "fw_state: UNKNOWN (%d)\n", sdev->fw_state); in snd_sof_dbg_print_fw_state()
397 void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, const char *msg, u32 flags) in snd_sof_dsp_dbg_dump() argument
405 if (sof_ops(sdev)->dbg_dump && !sdev->dbg_dump_printed) { in snd_sof_dsp_dbg_dump()
406 dev_printk(level, sdev->dev, in snd_sof_dsp_dbg_dump()
409 dev_printk(level, sdev->dev, "%s\n", msg); in snd_sof_dsp_dbg_dump()
410 snd_sof_dbg_print_fw_state(sdev, level); in snd_sof_dsp_dbg_dump()
411 sof_ops(sdev)->dbg_dump(sdev, flags); in snd_sof_dsp_dbg_dump()
412 dev_printk(level, sdev->dev, in snd_sof_dsp_dbg_dump()
415 sdev->dbg_dump_printed = true; in snd_sof_dsp_dbg_dump()
417 dev_printk(level, sdev->dev, "%s\n", msg); in snd_sof_dsp_dbg_dump()
422 static void snd_sof_ipc_dump(struct snd_sof_dev *sdev) in snd_sof_ipc_dump() argument
424 if (sof_ops(sdev)->ipc_dump && !sdev->ipc_dump_printed) { in snd_sof_ipc_dump()
425 dev_err(sdev->dev, "------------[ IPC dump start ]------------\n"); in snd_sof_ipc_dump()
426 sof_ops(sdev)->ipc_dump(sdev); in snd_sof_ipc_dump()
427 dev_err(sdev->dev, "------------[ IPC dump end ]------------\n"); in snd_sof_ipc_dump()
429 sdev->ipc_dump_printed = true; in snd_sof_ipc_dump()
433 void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev, const char *msg) in snd_sof_handle_fw_exception() argument
438 if (!sdev->ipc_dump_printed) in snd_sof_handle_fw_exception()
439 dev_info(sdev->dev, in snd_sof_handle_fw_exception()
441 pm_runtime_get_noresume(sdev->dev); in snd_sof_handle_fw_exception()
445 snd_sof_ipc_dump(sdev); in snd_sof_handle_fw_exception()
446 snd_sof_dsp_dbg_dump(sdev, msg, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX); in snd_sof_handle_fw_exception()
447 sof_fw_trace_fw_crashed(sdev); in snd_sof_handle_fw_exception()