Lines Matching refs:sdev

72 static void bdw_host_done(struct snd_sof_dev *sdev);
73 static void bdw_dsp_done(struct snd_sof_dev *sdev);
74 static void bdw_get_reply(struct snd_sof_dev *sdev);
80 static int bdw_run(struct snd_sof_dev *sdev) in bdw_run() argument
83 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_HMDC, in bdw_run()
88 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_run()
95 static int bdw_reset(struct snd_sof_dev *sdev) in bdw_reset() argument
98 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_reset()
106 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_reset()
113 static int bdw_set_dsp_D0(struct snd_sof_dev *sdev) in bdw_set_dsp_D0() argument
119 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL2, in bdw_set_dsp_D0()
124 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL0, in bdw_set_dsp_D0()
128 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_PMCS, in bdw_set_dsp_D0()
133 reg = readl(sdev->bar[BDW_PCI_BAR] + PCI_PMCS) in bdw_set_dsp_D0()
148 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_set_dsp_D0()
153 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, in bdw_set_dsp_D0()
160 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CLKCTL, in bdw_set_dsp_D0()
169 bdw_reset(sdev); in bdw_set_dsp_D0()
172 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL2, in bdw_set_dsp_D0()
181 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL2, in bdw_set_dsp_D0()
189 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL0, in bdw_set_dsp_D0()
193 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR2, in bdw_set_dsp_D0()
198 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_HMDC, in bdw_set_dsp_D0()
205 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_IMRX, in bdw_set_dsp_D0()
207 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_IMRD, in bdw_set_dsp_D0()
212 snd_sof_dsp_write(sdev, BDW_DSP_BAR, SHIM_IPCX, 0x0); in bdw_set_dsp_D0()
213 snd_sof_dsp_write(sdev, BDW_DSP_BAR, SHIM_IPCD, 0x0); in bdw_set_dsp_D0()
214 snd_sof_dsp_write(sdev, BDW_DSP_BAR, 0x80, 0x6); in bdw_set_dsp_D0()
215 snd_sof_dsp_write(sdev, BDW_DSP_BAR, 0xe0, 0x300a); in bdw_set_dsp_D0()
220 static void bdw_get_registers(struct snd_sof_dev *sdev, in bdw_get_registers() argument
225 u32 offset = sdev->dsp_oops_offset; in bdw_get_registers()
228 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); in bdw_get_registers()
234 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in bdw_get_registers()
239 sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); in bdw_get_registers()
243 sof_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32)); in bdw_get_registers()
246 static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) in bdw_dump() argument
254 status = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD); in bdw_dump()
255 panic = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCX); in bdw_dump()
256 bdw_get_registers(sdev, &xoops, &panic_info, stack, in bdw_dump()
258 snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack, in bdw_dump()
262 imrx = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRX); in bdw_dump()
263 imrd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRD); in bdw_dump()
264 dev_err(sdev->dev, in bdw_dump()
268 dev_err(sdev->dev, in bdw_dump()
272 dev_err(sdev->dev, in bdw_dump()
276 dev_err(sdev->dev, in bdw_dump()
288 struct snd_sof_dev *sdev = context; in bdw_irq_handler() local
293 isr = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_ISRX); in bdw_irq_handler()
302 struct snd_sof_dev *sdev = context; in bdw_irq_thread() local
305 imrx = snd_sof_dsp_read64(sdev, BDW_DSP_BAR, SHIM_IMRX); in bdw_irq_thread()
306 ipcx = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCX); in bdw_irq_thread()
312 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, in bdw_irq_thread()
316 spin_lock_irq(&sdev->ipc_lock); in bdw_irq_thread()
325 bdw_get_reply(sdev); in bdw_irq_thread()
326 snd_sof_ipc_reply(sdev, ipcx); in bdw_irq_thread()
328 bdw_dsp_done(sdev); in bdw_irq_thread()
330 spin_unlock_irq(&sdev->ipc_lock); in bdw_irq_thread()
333 ipcd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD); in bdw_irq_thread()
339 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, in bdw_irq_thread()
345 snd_sof_dsp_panic(sdev, BDW_PANIC_OFFSET(ipcx) + in bdw_irq_thread()
348 snd_sof_ipc_msgs_rx(sdev); in bdw_irq_thread()
351 bdw_host_done(sdev); in bdw_irq_thread()
361 static int bdw_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) in bdw_send_msg() argument
364 sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, in bdw_send_msg()
366 snd_sof_dsp_write(sdev, BDW_DSP_BAR, SHIM_IPCX, SHIM_IPCX_BUSY); in bdw_send_msg()
371 static void bdw_get_reply(struct snd_sof_dev *sdev) in bdw_get_reply() argument
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()
396 dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n", in bdw_get_reply()
403 sof_mailbox_read(sdev, sdev->host_box.offset, in bdw_get_reply()
410 static int bdw_get_mailbox_offset(struct snd_sof_dev *sdev) in bdw_get_mailbox_offset() argument
415 static int bdw_get_window_offset(struct snd_sof_dev *sdev, u32 id) in bdw_get_window_offset() argument
420 static void bdw_host_done(struct snd_sof_dev *sdev) in bdw_host_done() argument
423 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IPCD, in bdw_host_done()
428 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IMRX, in bdw_host_done()
432 static void bdw_dsp_done(struct snd_sof_dev *sdev) in bdw_dsp_done() argument
435 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IPCX, in bdw_dsp_done()
439 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IMRX, in bdw_dsp_done()
446 static int bdw_probe(struct snd_sof_dev *sdev) in bdw_probe() argument
448 struct snd_sof_pdata *pdata = sdev->pdata; in bdw_probe()
451 container_of(sdev->dev, struct platform_device, dev); in bdw_probe()
463 dev_err(sdev->dev, "error: failed to get LPE base at idx %d\n", 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()
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()
490 dev_err(sdev->dev, "error: failed to get PCI base at idx %d\n", 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()
503 dev_dbg(sdev->dev, "PCI VADDR %p\n", sdev->bar[BDW_PCI_BAR]); 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()
513 IRQF_SHARED, "AudioDSP", sdev); 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()
521 ret = bdw_set_dsp_D0(sdev); in bdw_probe()
523 dev_err(sdev->dev, "error: failed to set DSP D0\n"); 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()
535 snd_sof_dsp_mailbox_init(sdev, MBOX_OFFSET, MBOX_SIZE, 0, 0); in bdw_probe()
540 static void bdw_machine_select(struct snd_sof_dev *sdev) in bdw_machine_select() argument
542 struct snd_sof_pdata *sof_pdata = sdev->pdata; in bdw_machine_select()
548 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in bdw_machine_select()