Lines Matching +full:dsp +full:- +full:irq
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
12 * Hardware interface for audio DSP on Broadwell
20 #include "../sof-audio.h"
30 /* DSP memories for BDW */
43 /* DSP peripherals */
77 * DSP Control.
87 /* set DSP to RUN */ in bdw_run()
97 /* put DSP into reset and stall */ in bdw_reset()
105 /* take DSP out of reset and keep stalled for FW loading */ in bdw_reset()
132 while (tries--) { in bdw_set_dsp_D0()
133 reg = readl(sdev->bar[BDW_PCI_BAR] + PCI_PMCS) in bdw_set_dsp_D0()
141 return -ENODEV; in bdw_set_dsp_D0()
152 /* stall DSP core, set clk to 192/96Mhz */ in bdw_set_dsp_D0()
197 /* set on-demond mode on engine 0,1 for all channels */ in bdw_set_dsp_D0()
225 u32 offset = sdev->dsp_oops_offset; in bdw_get_registers()
233 if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { in bdw_get_registers()
234 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in bdw_get_registers()
235 xoops->arch_hdr.totalsize); in bdw_get_registers()
238 offset += xoops->arch_hdr.totalsize; in bdw_get_registers()
264 dev_err(sdev->dev, in bdw_dump()
265 "error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n", in bdw_dump()
268 dev_err(sdev->dev, in bdw_dump()
272 dev_err(sdev->dev, in bdw_dump()
273 "error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n", in bdw_dump()
276 dev_err(sdev->dev, in bdw_dump()
277 "error: mask DSP: pending %s complete %s raw 0x%8.8x\n", in bdw_dump()
283 * IPC Doorbell IRQ handler and thread.
286 static irqreturn_t bdw_irq_handler(int irq, void *context) in bdw_irq_handler() argument
300 static irqreturn_t bdw_irq_thread(int irq, void *context) in bdw_irq_thread() argument
308 /* reply message from DSP */ in bdw_irq_thread()
316 spin_lock_irq(&sdev->ipc_lock); in bdw_irq_thread()
319 * handle immediate reply from DSP core. If the msg is in bdw_irq_thread()
330 spin_unlock_irq(&sdev->ipc_lock); in bdw_irq_thread()
335 /* new message from DSP */ in bdw_irq_thread()
343 /* Handle messages from DSP Core */ in bdw_irq_thread()
364 sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, in bdw_send_msg()
365 msg->msg_size); in bdw_send_msg()
373 struct snd_sof_ipc_msg *msg = sdev->msg; in bdw_get_reply()
383 dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); in bdw_get_reply()
388 sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); in bdw_get_reply()
391 memcpy(msg->reply_data, &reply, sizeof(reply)); in bdw_get_reply()
395 if (reply.hdr.size != msg->reply_size) { in bdw_get_reply()
396 dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n", in bdw_get_reply()
397 msg->reply_size, reply.hdr.size); in bdw_get_reply()
398 ret = -EINVAL; in bdw_get_reply()
402 if (msg->reply_size > 0) in bdw_get_reply()
403 sof_mailbox_read(sdev, sdev->host_box.offset, in bdw_get_reply()
404 msg->reply_data, msg->reply_size); in bdw_get_reply()
407 msg->reply_error = ret; in bdw_get_reply()
422 /* clear BUSY bit and set DONE bit - accept new messages */ in bdw_host_done()
434 /* clear DONE bit - tell DSP we have completed */ in bdw_dsp_done()
448 struct snd_sof_pdata *pdata = sdev->pdata; in bdw_probe()
449 const struct sof_dev_desc *desc = pdata->desc; in bdw_probe()
451 container_of(sdev->dev, struct platform_device, dev); in bdw_probe()
458 desc->resindex_lpe_base); in bdw_probe()
460 base = mmio->start; in bdw_probe()
463 dev_err(sdev->dev, "error: failed to get LPE base at idx %d\n", in bdw_probe()
464 desc->resindex_lpe_base); in bdw_probe()
465 return -EINVAL; in bdw_probe()
468 dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); in bdw_probe()
469 sdev->bar[BDW_DSP_BAR] = devm_ioremap(sdev->dev, base, size); in bdw_probe()
470 if (!sdev->bar[BDW_DSP_BAR]) { in bdw_probe()
471 dev_err(sdev->dev, in bdw_probe()
474 return -ENODEV; in bdw_probe()
476 dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BDW_DSP_BAR]); in bdw_probe()
479 sdev->mmio_bar = BDW_DSP_BAR; in bdw_probe()
480 sdev->mailbox_bar = BDW_DSP_BAR; in bdw_probe()
481 sdev->dsp_oops_offset = MBOX_OFFSET; in bdw_probe()
485 desc->resindex_pcicfg_base); in bdw_probe()
487 base = mmio->start; in bdw_probe()
490 dev_err(sdev->dev, "error: failed to get PCI base at idx %d\n", in bdw_probe()
491 desc->resindex_pcicfg_base); in bdw_probe()
492 return -ENODEV; in bdw_probe()
495 dev_dbg(sdev->dev, "PCI base at 0x%x size 0x%x", base, size); in bdw_probe()
496 sdev->bar[BDW_PCI_BAR] = devm_ioremap(sdev->dev, base, size); in bdw_probe()
497 if (!sdev->bar[BDW_PCI_BAR]) { in bdw_probe()
498 dev_err(sdev->dev, in bdw_probe()
501 return -ENODEV; in bdw_probe()
503 dev_dbg(sdev->dev, "PCI VADDR %p\n", sdev->bar[BDW_PCI_BAR]); in bdw_probe()
505 /* register our IRQ */ in bdw_probe()
506 sdev->ipc_irq = platform_get_irq(pdev, desc->irqindex_host_ipc); in bdw_probe()
507 if (sdev->ipc_irq < 0) in bdw_probe()
508 return sdev->ipc_irq; in bdw_probe()
510 dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq); in bdw_probe()
511 ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq, in bdw_probe()
515 dev_err(sdev->dev, "error: failed to register IRQ %d\n", in bdw_probe()
516 sdev->ipc_irq); in bdw_probe()
520 /* enable the DSP SHIM */ in bdw_probe()
523 dev_err(sdev->dev, "error: failed to set DSP D0\n"); in bdw_probe()
527 /* DSP DMA can only access low 31 bits of host memory */ in bdw_probe()
528 ret = dma_coerce_mask_and_coherent(sdev->dev, DMA_BIT_MASK(31)); in bdw_probe()
530 dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret); in bdw_probe()
542 struct snd_sof_pdata *sof_pdata = sdev->pdata; in bdw_machine_select()
543 const struct sof_dev_desc *desc = sof_pdata->desc; in bdw_machine_select()
546 mach = snd_soc_acpi_find_machine(desc->machines); in bdw_machine_select()
548 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in bdw_machine_select()
552 sof_pdata->tplg_filename = mach->sof_tplg_filename; in bdw_machine_select()
553 mach->mach_params.acpi_ipc_irq_index = desc->irqindex_host_ipc; in bdw_machine_select()
554 sof_pdata->machine = mach; in bdw_machine_select()
562 mach_params = (struct snd_soc_acpi_mach_params *)&mach->mach_params; in bdw_set_mach_params()
563 mach_params->platform = dev_name(dev); in bdw_set_mach_params()
569 .name = "ssp0-port",
580 .name = "ssp1-port",
597 /* DSP Core Control */