Lines Matching refs:sdev

28 void imx8_get_registers(struct snd_sof_dev *sdev,  in imx8_get_registers()  argument
33 u32 offset = sdev->dsp_oops_offset; in imx8_get_registers()
36 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); in imx8_get_registers()
40 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in imx8_get_registers()
45 sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); in imx8_get_registers()
49 sof_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32)); in imx8_get_registers()
58 void imx8_dump(struct snd_sof_dev *sdev, u32 flags) in imx8_dump() argument
68 sof_mailbox_read(sdev, sdev->debug_box.offset + 0x4, &status, 4); in imx8_dump()
73 imx8_get_registers(sdev, &xoops, &panic_info, stack, in imx8_dump()
77 sof_print_oops_and_stack(sdev, KERN_ERR, status, status, &xoops, in imx8_dump()
84 struct snd_sof_dev *sdev; in imx_handle_reply() local
87 sdev = imx_dsp_get_data(ipc); in imx_handle_reply()
89 spin_lock_irqsave(&sdev->ipc_lock, flags); in imx_handle_reply()
90 snd_sof_ipc_process_reply(sdev, 0); in imx_handle_reply()
91 spin_unlock_irqrestore(&sdev->ipc_lock, flags); in imx_handle_reply()
96 struct snd_sof_dev *sdev; in imx_handle_request() local
99 sdev = imx_dsp_get_data(ipc); in imx_handle_request()
101 if (get_chip_info(sdev)->ipc_info.has_panic_code) { in imx_handle_request()
102 sof_mailbox_read(sdev, sdev->debug_box.offset + 0x4, in imx_handle_request()
107 snd_sof_dsp_panic(sdev, panic_code, true); in imx_handle_request()
112 snd_sof_ipc_msgs_rx(sdev); in imx_handle_request()
120 static int imx_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) in imx_send_msg() argument
122 struct imx_common_data *common = sdev->pdata->hw_pdata; in imx_send_msg()
124 sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, msg->msg_size); in imx_send_msg()
130 static int imx_get_bar_index(struct snd_sof_dev *sdev, u32 type) in imx_get_bar_index() argument
141 static int imx_get_mailbox_offset(struct snd_sof_dev *sdev) in imx_get_mailbox_offset() argument
143 return get_chip_info(sdev)->ipc_info.boot_mbox_offset; in imx_get_mailbox_offset()
146 static int imx_get_window_offset(struct snd_sof_dev *sdev, u32 id) in imx_get_window_offset() argument
148 return get_chip_info(sdev)->ipc_info.window_offset; in imx_get_window_offset()
151 static int imx_set_power_state(struct snd_sof_dev *sdev, in imx_set_power_state() argument
154 sdev->dsp_power_state = *target; in imx_set_power_state()
159 static int imx_common_resume(struct snd_sof_dev *sdev) in imx_common_resume() argument
164 common = sdev->pdata->hw_pdata; in imx_common_resume()
168 dev_err(sdev->dev, "failed to enable clocks: %d\n", ret); in imx_common_resume()
177 static int imx_common_suspend(struct snd_sof_dev *sdev) in imx_common_suspend() argument
182 common = sdev->pdata->hw_pdata; in imx_common_suspend()
184 ret = imx_chip_core_shutdown(sdev); in imx_common_suspend()
186 dev_err(sdev->dev, "failed to shutdown core: %d\n", ret); in imx_common_suspend()
198 static int imx_runtime_resume(struct snd_sof_dev *sdev) in imx_runtime_resume() argument
205 ret = imx_common_resume(sdev); in imx_runtime_resume()
207 dev_err(sdev->dev, "failed to runtime common resume: %d\n", ret); in imx_runtime_resume()
211 return snd_sof_dsp_set_power_state(sdev, &target_state); in imx_runtime_resume()
214 static int imx_resume(struct snd_sof_dev *sdev) in imx_resume() argument
221 ret = imx_common_resume(sdev); in imx_resume()
223 dev_err(sdev->dev, "failed to common resume: %d\n", ret); in imx_resume()
227 if (pm_runtime_suspended(sdev->dev)) { in imx_resume()
228 pm_runtime_disable(sdev->dev); in imx_resume()
229 pm_runtime_set_active(sdev->dev); in imx_resume()
230 pm_runtime_mark_last_busy(sdev->dev); in imx_resume()
231 pm_runtime_enable(sdev->dev); in imx_resume()
232 pm_runtime_idle(sdev->dev); in imx_resume()
235 return snd_sof_dsp_set_power_state(sdev, &target_state); in imx_resume()
238 static int imx_runtime_suspend(struct snd_sof_dev *sdev) in imx_runtime_suspend() argument
245 ret = imx_common_suspend(sdev); in imx_runtime_suspend()
247 dev_err(sdev->dev, "failed to runtime common suspend: %d\n", ret); in imx_runtime_suspend()
249 return snd_sof_dsp_set_power_state(sdev, &target_state); in imx_runtime_suspend()
252 static int imx_suspend(struct snd_sof_dev *sdev, unsigned int target_state) in imx_suspend() argument
259 if (!pm_runtime_suspended(sdev->dev)) { in imx_suspend()
260 ret = imx_common_suspend(sdev); in imx_suspend()
262 dev_err(sdev->dev, "failed to common suspend: %d\n", ret); in imx_suspend()
267 return snd_sof_dsp_set_power_state(sdev, &target_power_state); in imx_suspend()
282 static int imx_parse_ioremap_memory(struct snd_sof_dev *sdev) in imx_parse_ioremap_memory() argument
289 pdev = to_platform_device(sdev->dev); in imx_parse_ioremap_memory()
290 chip_info = get_chip_info(sdev); in imx_parse_ioremap_memory()
295 return dev_err_probe(sdev->dev, blk_type, in imx_parse_ioremap_memory()
303 return dev_err_probe(sdev->dev, -ENODEV, in imx_parse_ioremap_memory()
312 return dev_err_probe(sdev->dev, ret, in imx_parse_ioremap_memory()
318 sdev->bar[blk_type] = devm_ioremap_resource(sdev->dev, res); in imx_parse_ioremap_memory()
319 if (!sdev->bar[blk_type]) in imx_parse_ioremap_memory()
320 return dev_err_probe(sdev->dev, in imx_parse_ioremap_memory()
332 struct snd_sof_dev *sdev; in imx_unregister_action() local
334 sdev = data; in imx_unregister_action()
335 common = sdev->pdata->hw_pdata; in imx_unregister_action()
337 if (get_chip_info(sdev)->has_dma_reserved) in imx_unregister_action()
338 of_reserved_mem_device_release(sdev->dev); in imx_unregister_action()
343 static int imx_probe(struct snd_sof_dev *sdev) in imx_probe() argument
353 pdev = to_platform_device(sdev->dev); in imx_probe()
355 common = devm_kzalloc(sdev->dev, sizeof(*common), GFP_KERNEL); in imx_probe()
357 return dev_err_probe(sdev->dev, -ENOMEM, in imx_probe()
359 sdev->pdata->hw_pdata = common; in imx_probe()
361 common->ipc_dev = platform_device_register_data(sdev->dev, "imx-dsp", in imx_probe()
365 return dev_err_probe(sdev->dev, PTR_ERR(common->ipc_dev), in imx_probe()
368 if (get_chip_info(sdev)->has_dma_reserved) { in imx_probe()
369 ret = of_reserved_mem_device_init_by_name(sdev->dev, in imx_probe()
375 return dev_err_probe(sdev->dev, ret, in imx_probe()
381 ret = devm_add_action_or_reset(sdev->dev, in imx_probe()
383 sdev); in imx_probe()
385 return dev_err_probe(sdev->dev, ret, "failed to add devm action\n"); in imx_probe()
389 return dev_err_probe(sdev->dev, -EPROBE_DEFER, in imx_probe()
392 ret = imx_parse_ioremap_memory(sdev); in imx_probe()
394 return dev_err_probe(sdev->dev, ret, in imx_probe()
397 if (!sdev->dev->pm_domain) { in imx_probe()
398 ret = devm_pm_domain_attach_list(sdev->dev, in imx_probe()
401 return dev_err_probe(sdev->dev, ret, "failed to attach PDs\n"); in imx_probe()
404 ret = devm_clk_bulk_get_all(sdev->dev, &common->clks); in imx_probe()
406 return dev_err_probe(sdev->dev, ret, "failed to fetch clocks\n"); in imx_probe()
411 return dev_err_probe(sdev->dev, ret, "failed to enable clocks\n"); in imx_probe()
414 imx_dsp_set_data(common->ipc_handle, sdev); in imx_probe()
416 sdev->num_cores = 1; in imx_probe()
417 sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM; in imx_probe()
418 sdev->dsp_box.offset = get_chip_info(sdev)->ipc_info.boot_mbox_offset; in imx_probe()
420 return imx_chip_probe(sdev); in imx_probe()
423 static void imx_remove(struct snd_sof_dev *sdev) in imx_remove() argument
428 common = sdev->pdata->hw_pdata; in imx_remove()
430 if (!pm_runtime_suspended(sdev->dev)) { in imx_remove()
431 ret = imx_chip_core_shutdown(sdev); in imx_remove()
433 dev_err(sdev->dev, "failed to shutdown core: %d\n", ret); in imx_remove()