Lines Matching refs:sdev
103 struct snd_sof_dev *sdev = dfse->sdev; in probe_points_read() local
109 if (sdev->extractor_stream_tag == SOF_PROBE_INVALID_NODE_ID) { in probe_points_read()
110 dev_warn(sdev->dev, "no extractor stream running\n"); in probe_points_read()
118 ret = sof_ipc_probe_points_info(sdev, &desc, &num_desc); in probe_points_read()
143 struct snd_sof_dev *sdev = dfse->sdev; in probe_points_write() local
149 if (sdev->extractor_stream_tag == SOF_PROBE_INVALID_NODE_ID) { in probe_points_write()
150 dev_warn(sdev->dev, "no extractor stream running\n"); in probe_points_write()
164 ret = sof_ipc_probe_points_add(sdev, in probe_points_write()
184 struct snd_sof_dev *sdev = dfse->sdev; in probe_points_remove_write() local
189 if (sdev->extractor_stream_tag == SOF_PROBE_INVALID_NODE_ID) { in probe_points_remove_write()
190 dev_warn(sdev->dev, "no extractor stream running\n"); in probe_points_remove_write()
202 ret = sof_ipc_probe_points_remove(sdev, tkns, num_tkns); in probe_points_remove_write()
216 static int snd_sof_debugfs_probe_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_probe_item() argument
222 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_probe_item()
227 dfse->sdev = sdev; in snd_sof_debugfs_probe_item()
229 debugfs_create_file(name, mode, sdev->debugfs_root, dfse, fops); in snd_sof_debugfs_probe_item()
231 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_probe_item()
242 static int sof_debug_ipc_flood_test(struct snd_sof_dev *sdev, in sof_debug_ipc_flood_test() argument
269 ret = sof_ipc_tx_message(sdev->ipc, hdr.cmd, &hdr, hdr.size, in sof_debug_ipc_flood_test()
296 dev_err(sdev->dev, in sof_debug_ipc_flood_test()
310 dev_dbg(sdev->dev, "IPC Flood test duration: %lums\n", in sof_debug_ipc_flood_test()
316 dev_dbg(sdev->dev, in sof_debug_ipc_flood_test()
319 dev_dbg(sdev->dev, "Max response time: %lluns\n", in sof_debug_ipc_flood_test()
321 dev_dbg(sdev->dev, "Min response time: %lluns\n", in sof_debug_ipc_flood_test()
344 struct snd_sof_dev *sdev = dfse->sdev; in sof_dfsentry_write() local
409 ret = pm_runtime_get_sync(sdev->dev); in sof_dfsentry_write()
411 dev_err_ratelimited(sdev->dev, in sof_dfsentry_write()
414 pm_runtime_put_noidle(sdev->dev); in sof_dfsentry_write()
419 ret = sof_debug_ipc_flood_test(sdev, dfse, flood_duration_test, in sof_dfsentry_write()
422 pm_runtime_mark_last_busy(sdev->dev); in sof_dfsentry_write()
423 err = pm_runtime_put_autosuspend(sdev->dev); in sof_dfsentry_write()
425 dev_err_ratelimited(sdev->dev, in sof_dfsentry_write()
442 struct snd_sof_dev *sdev = dfse->sdev; in sof_dfsentry_read() local
503 if (pm_runtime_active(sdev->dev) || in sof_dfsentry_read()
507 dev_info(sdev->dev, in sof_dfsentry_read()
513 if (!pm_runtime_active(sdev->dev) && in sof_dfsentry_read()
515 dev_err(sdev->dev, in sof_dfsentry_read()
549 static int snd_sof_debugfs_io_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_io_item() argument
556 if (!sdev) in snd_sof_debugfs_io_item()
559 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_io_item()
566 dfse->sdev = sdev; in snd_sof_debugfs_io_item()
575 dfse->cache_buf = devm_kzalloc(sdev->dev, size, GFP_KERNEL); in snd_sof_debugfs_io_item()
581 debugfs_create_file(name, 0444, sdev->debugfs_root, dfse, in snd_sof_debugfs_io_item()
585 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_io_item()
590 int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev, in snd_sof_debugfs_add_region_item_iomem() argument
595 int bar = snd_sof_dsp_get_bar_index(sdev, blk_type); in snd_sof_debugfs_add_region_item_iomem()
600 return snd_sof_debugfs_io_item(sdev, sdev->bar[bar] + offset, size, name, in snd_sof_debugfs_add_region_item_iomem()
606 int snd_sof_debugfs_buf_item(struct snd_sof_dev *sdev, in snd_sof_debugfs_buf_item() argument
612 if (!sdev) in snd_sof_debugfs_buf_item()
615 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_debugfs_buf_item()
622 dfse->sdev = sdev; in snd_sof_debugfs_buf_item()
630 dfse->cache_buf = devm_kzalloc(sdev->dev, IPC_FLOOD_TEST_RESULT_LEN, in snd_sof_debugfs_buf_item()
637 debugfs_create_file(name, mode, sdev->debugfs_root, dfse, in snd_sof_debugfs_buf_item()
640 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_debugfs_buf_item()
646 static int memory_info_update(struct snd_sof_dev *sdev, char *buf, size_t buff_size) in memory_info_update() argument
661 ret = pm_runtime_get_sync(sdev->dev); in memory_info_update()
663 pm_runtime_put_noidle(sdev->dev); in memory_info_update()
664 dev_err(sdev->dev, "error: enabling device failed: %d\n", ret); in memory_info_update()
668 ret = sof_ipc_tx_message(sdev->ipc, msg.cmd, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE); in memory_info_update()
669 pm_runtime_mark_last_busy(sdev->dev); in memory_info_update()
670 pm_runtime_put_autosuspend(sdev->dev); in memory_info_update()
673 dev_err(sdev->dev, "error: reading memory info failed, %d\n", ret); in memory_info_update()
678 dev_err(sdev->dev, "error: invalid memory info ipc struct size, %d\n", in memory_info_update()
702 struct snd_sof_dev *sdev = dfse->sdev; in memory_info_read() local
708 data_length = memory_info_update(sdev, dfse->buf, dfse->size); in memory_info_read()
720 struct snd_sof_dev *sdev = dfse->sdev; in memory_info_open() local
726 dfse->buf = devm_kmalloc(sdev->dev, PAGE_SIZE, GFP_KERNEL); in memory_info_open()
741 int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev) in snd_sof_dbg_memory_info_init() argument
745 dfse = devm_kzalloc(sdev->dev, sizeof(*dfse), GFP_KERNEL); in snd_sof_dbg_memory_info_init()
751 dfse->sdev = sdev; in snd_sof_dbg_memory_info_init()
753 debugfs_create_file("memory_info", 0444, sdev->debugfs_root, dfse, &memory_info_fops); in snd_sof_dbg_memory_info_init()
756 list_add(&dfse->list, &sdev->dfsentry_list); in snd_sof_dbg_memory_info_init()
761 int snd_sof_dbg_init(struct snd_sof_dev *sdev) in snd_sof_dbg_init() argument
763 const struct snd_sof_dsp_ops *ops = sof_ops(sdev); in snd_sof_dbg_init()
769 sdev->debugfs_root = debugfs_create_dir("sof", NULL); in snd_sof_dbg_init()
772 INIT_LIST_HEAD(&sdev->dfsentry_list); in snd_sof_dbg_init()
778 err = snd_sof_debugfs_io_item(sdev, sdev->bar[map->bar] + in snd_sof_dbg_init()
787 err = snd_sof_debugfs_probe_item(sdev, "probe_points", in snd_sof_dbg_init()
791 err = snd_sof_debugfs_probe_item(sdev, "probe_points_remove", in snd_sof_dbg_init()
799 err = snd_sof_debugfs_buf_item(sdev, NULL, 0, in snd_sof_dbg_init()
807 err = snd_sof_debugfs_buf_item(sdev, NULL, 0, in snd_sof_dbg_init()
819 void snd_sof_free_debug(struct snd_sof_dev *sdev) in snd_sof_free_debug() argument
821 debugfs_remove_recursive(sdev->debugfs_root); in snd_sof_free_debug()
837 static void snd_sof_dbg_print_fw_state(struct snd_sof_dev *sdev) in snd_sof_dbg_print_fw_state() argument
842 if (sdev->fw_state == fw_state_dbg[i].state) { in snd_sof_dbg_print_fw_state()
843 dev_err(sdev->dev, "fw_state: %s (%d)\n", fw_state_dbg[i].name, i); in snd_sof_dbg_print_fw_state()
848 dev_err(sdev->dev, "fw_state: UNKNOWN (%d)\n", sdev->fw_state); in snd_sof_dbg_print_fw_state()
851 void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, u32 flags) in snd_sof_dsp_dbg_dump() argument
858 if (sof_ops(sdev)->dbg_dump && !sdev->dbg_dump_printed) { in snd_sof_dsp_dbg_dump()
859 dev_err(sdev->dev, "------------[ DSP dump start ]------------\n"); in snd_sof_dsp_dbg_dump()
860 snd_sof_dbg_print_fw_state(sdev); in snd_sof_dsp_dbg_dump()
861 sof_ops(sdev)->dbg_dump(sdev, flags); in snd_sof_dsp_dbg_dump()
862 dev_err(sdev->dev, "------------[ DSP dump end ]------------\n"); in snd_sof_dsp_dbg_dump()
864 sdev->dbg_dump_printed = true; in snd_sof_dsp_dbg_dump()
869 static void snd_sof_ipc_dump(struct snd_sof_dev *sdev) in snd_sof_ipc_dump() argument
871 if (sof_ops(sdev)->ipc_dump && !sdev->ipc_dump_printed) { in snd_sof_ipc_dump()
872 dev_err(sdev->dev, "------------[ IPC dump start ]------------\n"); in snd_sof_ipc_dump()
873 sof_ops(sdev)->ipc_dump(sdev); in snd_sof_ipc_dump()
874 dev_err(sdev->dev, "------------[ IPC dump end ]------------\n"); in snd_sof_ipc_dump()
876 sdev->ipc_dump_printed = true; in snd_sof_ipc_dump()
880 void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev) in snd_sof_handle_fw_exception() argument
885 if (!sdev->ipc_dump_printed) in snd_sof_handle_fw_exception()
886 dev_info(sdev->dev, in snd_sof_handle_fw_exception()
888 pm_runtime_get_noresume(sdev->dev); in snd_sof_handle_fw_exception()
892 snd_sof_ipc_dump(sdev); in snd_sof_handle_fw_exception()
893 snd_sof_dsp_dbg_dump(sdev, SOF_DBG_DUMP_REGS | SOF_DBG_DUMP_MBOX); in snd_sof_handle_fw_exception()
894 snd_sof_trace_notify_for_error(sdev); in snd_sof_handle_fw_exception()