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