Lines Matching refs:sdev

76 static void bdw_host_done(struct snd_sof_dev *sdev);
77 static void bdw_dsp_done(struct snd_sof_dev *sdev);
78 static void bdw_get_reply(struct snd_sof_dev *sdev);
84 static int bdw_run(struct snd_sof_dev *sdev) in bdw_run() argument
87 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_HMDC, in bdw_run()
92 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_run()
99 static int bdw_reset(struct snd_sof_dev *sdev) in bdw_reset() argument
102 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_reset()
110 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_reset()
117 static int bdw_set_dsp_D0(struct snd_sof_dev *sdev) in bdw_set_dsp_D0() argument
123 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL2, in bdw_set_dsp_D0()
128 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL0, in bdw_set_dsp_D0()
132 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_PMCS, in bdw_set_dsp_D0()
137 reg = readl(sdev->bar[BDW_PCI_BAR] + PCI_PMCS) in bdw_set_dsp_D0()
152 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR, in bdw_set_dsp_D0()
157 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, in bdw_set_dsp_D0()
164 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CLKCTL, in bdw_set_dsp_D0()
173 bdw_reset(sdev); in bdw_set_dsp_D0()
176 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL2, in bdw_set_dsp_D0()
185 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL2, in bdw_set_dsp_D0()
193 snd_sof_dsp_update_bits_unlocked(sdev, BDW_PCI_BAR, PCI_VDRTCTL0, in bdw_set_dsp_D0()
197 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR2, in bdw_set_dsp_D0()
202 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_HMDC, in bdw_set_dsp_D0()
209 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_IMRX, in bdw_set_dsp_D0()
211 snd_sof_dsp_update_bits(sdev, BDW_DSP_BAR, SHIM_IMRD, in bdw_set_dsp_D0()
216 snd_sof_dsp_write(sdev, BDW_DSP_BAR, SHIM_IPCX, 0x0); in bdw_set_dsp_D0()
217 snd_sof_dsp_write(sdev, BDW_DSP_BAR, SHIM_IPCD, 0x0); in bdw_set_dsp_D0()
218 snd_sof_dsp_write(sdev, BDW_DSP_BAR, 0x80, 0x6); in bdw_set_dsp_D0()
219 snd_sof_dsp_write(sdev, BDW_DSP_BAR, 0xe0, 0x300a); in bdw_set_dsp_D0()
224 static void bdw_get_registers(struct snd_sof_dev *sdev, in bdw_get_registers() argument
229 u32 offset = sdev->dsp_oops_offset; in bdw_get_registers()
232 sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops)); in bdw_get_registers()
238 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in bdw_get_registers()
243 sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); in bdw_get_registers()
247 sof_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32)); in bdw_get_registers()
250 static void bdw_dump(struct snd_sof_dev *sdev, u32 flags) in bdw_dump() argument
258 status = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD); in bdw_dump()
259 panic = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCX); in bdw_dump()
260 bdw_get_registers(sdev, &xoops, &panic_info, stack, in bdw_dump()
262 snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack, in bdw_dump()
266 imrx = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRX); in bdw_dump()
267 imrd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IMRD); 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()
280 dev_err(sdev->dev, in bdw_dump()
292 struct snd_sof_dev *sdev = context; in bdw_irq_handler() local
297 isr = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_ISRX); in bdw_irq_handler()
306 struct snd_sof_dev *sdev = context; in bdw_irq_thread() local
309 imrx = snd_sof_dsp_read64(sdev, BDW_DSP_BAR, SHIM_IMRX); in bdw_irq_thread()
310 ipcx = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCX); in bdw_irq_thread()
316 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, in bdw_irq_thread()
320 spin_lock_irq(&sdev->ipc_lock); in bdw_irq_thread()
329 bdw_get_reply(sdev); in bdw_irq_thread()
330 snd_sof_ipc_reply(sdev, ipcx); in bdw_irq_thread()
332 bdw_dsp_done(sdev); in bdw_irq_thread()
334 spin_unlock_irq(&sdev->ipc_lock); in bdw_irq_thread()
337 ipcd = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD); in bdw_irq_thread()
343 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, in bdw_irq_thread()
349 snd_sof_dsp_panic(sdev, BDW_PANIC_OFFSET(ipcx) + in bdw_irq_thread()
352 snd_sof_ipc_msgs_rx(sdev); in bdw_irq_thread()
355 bdw_host_done(sdev); in bdw_irq_thread()
365 static int bdw_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) in bdw_send_msg() argument
368 sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, in bdw_send_msg()
370 snd_sof_dsp_write(sdev, BDW_DSP_BAR, SHIM_IPCX, SHIM_IPCX_BUSY); in bdw_send_msg()
375 static void bdw_get_reply(struct snd_sof_dev *sdev) in bdw_get_reply() argument
377 struct snd_sof_ipc_msg *msg = sdev->msg; in bdw_get_reply()
387 dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); in bdw_get_reply()
392 sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); in bdw_get_reply()
400 dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n", in bdw_get_reply()
407 sof_mailbox_read(sdev, sdev->host_box.offset, in bdw_get_reply()
414 static int bdw_get_mailbox_offset(struct snd_sof_dev *sdev) in bdw_get_mailbox_offset() argument
419 static int bdw_get_window_offset(struct snd_sof_dev *sdev, u32 id) in bdw_get_window_offset() argument
424 static void bdw_host_done(struct snd_sof_dev *sdev) in bdw_host_done() argument
427 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IPCD, in bdw_host_done()
432 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IMRX, in bdw_host_done()
436 static void bdw_dsp_done(struct snd_sof_dev *sdev) in bdw_dsp_done() argument
439 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IPCX, in bdw_dsp_done()
443 snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_IMRX, in bdw_dsp_done()
450 static int bdw_probe(struct snd_sof_dev *sdev) in bdw_probe() argument
452 struct snd_sof_pdata *pdata = sdev->pdata; in bdw_probe()
455 container_of(sdev->dev, struct platform_device, dev); in bdw_probe()
467 dev_err(sdev->dev, "error: failed to get LPE base at idx %d\n", in bdw_probe()
472 dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); in bdw_probe()
473 sdev->bar[BDW_DSP_BAR] = devm_ioremap(sdev->dev, base, size); in bdw_probe()
474 if (!sdev->bar[BDW_DSP_BAR]) { in bdw_probe()
475 dev_err(sdev->dev, in bdw_probe()
480 dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BDW_DSP_BAR]); in bdw_probe()
483 sdev->mmio_bar = BDW_DSP_BAR; in bdw_probe()
484 sdev->mailbox_bar = BDW_DSP_BAR; in bdw_probe()
485 sdev->dsp_oops_offset = MBOX_OFFSET; in bdw_probe()
494 dev_err(sdev->dev, "error: failed to get PCI base at idx %d\n", in bdw_probe()
499 dev_dbg(sdev->dev, "PCI base at 0x%x size 0x%x", base, size); in bdw_probe()
500 sdev->bar[BDW_PCI_BAR] = devm_ioremap(sdev->dev, base, size); in bdw_probe()
501 if (!sdev->bar[BDW_PCI_BAR]) { in bdw_probe()
502 dev_err(sdev->dev, in bdw_probe()
507 dev_dbg(sdev->dev, "PCI VADDR %p\n", sdev->bar[BDW_PCI_BAR]); in bdw_probe()
510 sdev->ipc_irq = platform_get_irq(pdev, desc->irqindex_host_ipc); in bdw_probe()
511 if (sdev->ipc_irq < 0) in bdw_probe()
512 return sdev->ipc_irq; in bdw_probe()
514 dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq); in bdw_probe()
515 ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq, in bdw_probe()
517 IRQF_SHARED, "AudioDSP", sdev); in bdw_probe()
519 dev_err(sdev->dev, "error: failed to register IRQ %d\n", in bdw_probe()
520 sdev->ipc_irq); in bdw_probe()
525 ret = bdw_set_dsp_D0(sdev); in bdw_probe()
527 dev_err(sdev->dev, "error: failed to set DSP D0\n"); in bdw_probe()
532 ret = dma_coerce_mask_and_coherent(sdev->dev, DMA_BIT_MASK(31)); in bdw_probe()
534 dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret); in bdw_probe()
539 sdev->dsp_box.offset = MBOX_OFFSET; in bdw_probe()
544 static void bdw_machine_select(struct snd_sof_dev *sdev) in bdw_machine_select() argument
546 struct snd_sof_pdata *sof_pdata = sdev->pdata; in bdw_machine_select()
552 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in bdw_machine_select()
562 struct snd_sof_dev *sdev) in bdw_set_mach_params() argument
564 struct snd_sof_pdata *pdata = sdev->pdata; in bdw_set_mach_params()
569 mach_params->platform = dev_name(sdev->dev); in bdw_set_mach_params()