Lines Matching refs:psc_dma

32 	struct psc_dma *psc_dma = _psc_dma;  in psc_dma_status_irq()  local
33 struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; in psc_dma_status_irq()
39 if (psc_dma->playback.active && (isr & MPC52xx_PSC_IMR_TXEMP)) in psc_dma_status_irq()
40 psc_dma->stats.underrun_count++; in psc_dma_status_irq()
43 if (psc_dma->capture.active && (isr & MPC52xx_PSC_IMR_ORERR)) in psc_dma_status_irq()
44 psc_dma->stats.overrun_count++; in psc_dma_status_irq()
80 spin_lock(&s->psc_dma->lock); in psc_dma_bcom_irq()
91 spin_unlock(&s->psc_dma->lock); in psc_dma_bcom_irq()
114 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); in psc_dma_trigger() local
116 struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); in psc_dma_trigger()
117 struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; in psc_dma_trigger()
124 dev_dbg(psc_dma->dev, "START: stream=%i fbits=%u ps=%u #p=%u\n", in psc_dma_trigger()
138 spin_lock_irqsave(&psc_dma->lock, flags); in psc_dma_trigger()
150 spin_unlock_irqrestore(&psc_dma->lock, flags); in psc_dma_trigger()
157 dev_dbg(psc_dma->dev, "STOP: stream=%i periods_count=%i\n", in psc_dma_trigger()
161 spin_lock_irqsave(&psc_dma->lock, flags); in psc_dma_trigger()
167 spin_unlock_irqrestore(&psc_dma->lock, flags); in psc_dma_trigger()
172 dev_dbg(psc_dma->dev, "unhandled trigger: stream=%i cmd=%i\n", in psc_dma_trigger()
179 if (psc_dma->playback.active) in psc_dma_trigger()
181 if (psc_dma->capture.active) in psc_dma_trigger()
183 out_be16(&regs->isr_imr.imr, psc_dma->imr | imr); in psc_dma_trigger()
216 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); in psc_dma_open() local
220 dev_dbg(psc_dma->dev, "psc_dma_open(substream=%p)\n", substream); in psc_dma_open()
223 s = &psc_dma->capture; in psc_dma_open()
225 s = &psc_dma->playback; in psc_dma_open()
244 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); in psc_dma_close() local
247 dev_dbg(psc_dma->dev, "psc_dma_close(substream=%p)\n", substream); in psc_dma_close()
250 s = &psc_dma->capture; in psc_dma_close()
252 s = &psc_dma->playback; in psc_dma_close()
254 if (!psc_dma->playback.active && in psc_dma_close()
255 !psc_dma->capture.active) { in psc_dma_close()
258 out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr); in psc_dma_close()
259 out_8(&psc_dma->psc_regs->command, 4 << 4); /* reset error */ in psc_dma_close()
270 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); in psc_dma_pointer() local
275 s = &psc_dma->capture; in psc_dma_pointer()
277 s = &psc_dma->playback; in psc_dma_pointer()
316 struct psc_dma *psc_dma; in mpc5200_audio_dma_create() local
336 psc_dma = kzalloc(sizeof *psc_dma, GFP_KERNEL); in mpc5200_audio_dma_create()
337 if (!psc_dma) { in mpc5200_audio_dma_create()
349 spin_lock_init(&psc_dma->lock); in mpc5200_audio_dma_create()
350 mutex_init(&psc_dma->mutex); in mpc5200_audio_dma_create()
351 psc_dma->id = be32_to_cpu(*prop); in mpc5200_audio_dma_create()
352 psc_dma->irq = irq; in mpc5200_audio_dma_create()
353 psc_dma->psc_regs = regs; in mpc5200_audio_dma_create()
354 psc_dma->fifo_regs = regs + sizeof *psc_dma->psc_regs; in mpc5200_audio_dma_create()
355 psc_dma->dev = &op->dev; in mpc5200_audio_dma_create()
356 psc_dma->playback.psc_dma = psc_dma; in mpc5200_audio_dma_create()
357 psc_dma->capture.psc_dma = psc_dma; in mpc5200_audio_dma_create()
358 snprintf(psc_dma->name, sizeof(psc_dma->name), "PSC%d", psc_dma->id); in mpc5200_audio_dma_create()
363 psc_dma->capture.bcom_task = in mpc5200_audio_dma_create()
364 bcom_psc_gen_bd_rx_init(psc_dma->id, 10, fifo, 512); in mpc5200_audio_dma_create()
365 psc_dma->playback.bcom_task = in mpc5200_audio_dma_create()
366 bcom_psc_gen_bd_tx_init(psc_dma->id, 10, fifo); in mpc5200_audio_dma_create()
367 if (!psc_dma->capture.bcom_task || in mpc5200_audio_dma_create()
368 !psc_dma->playback.bcom_task) { in mpc5200_audio_dma_create()
375 out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr); in mpc5200_audio_dma_create()
377 out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_RST_RX); in mpc5200_audio_dma_create()
379 out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_RST_TX); in mpc5200_audio_dma_create()
381 out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_RST_ERR_STAT); in mpc5200_audio_dma_create()
383 out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_SEL_MODE_REG_1); in mpc5200_audio_dma_create()
389 out_8(&psc_dma->psc_regs->mode, 0); in mpc5200_audio_dma_create()
390 out_8(&psc_dma->psc_regs->mode, 0); in mpc5200_audio_dma_create()
393 out_be16(&psc_dma->fifo_regs->rfalarm, 0x100); in mpc5200_audio_dma_create()
394 out_8(&psc_dma->fifo_regs->rfcntl, 0x4); in mpc5200_audio_dma_create()
395 out_be16(&psc_dma->fifo_regs->tfalarm, 0x100); in mpc5200_audio_dma_create()
396 out_8(&psc_dma->fifo_regs->tfcntl, 0x7); in mpc5200_audio_dma_create()
399 psc_dma->playback.irq = in mpc5200_audio_dma_create()
400 bcom_get_task_irq(psc_dma->playback.bcom_task); in mpc5200_audio_dma_create()
401 psc_dma->capture.irq = in mpc5200_audio_dma_create()
402 bcom_get_task_irq(psc_dma->capture.bcom_task); in mpc5200_audio_dma_create()
404 rc = request_irq(psc_dma->irq, &psc_dma_status_irq, IRQF_SHARED, in mpc5200_audio_dma_create()
405 "psc-dma-status", psc_dma); in mpc5200_audio_dma_create()
406 rc |= request_irq(psc_dma->capture.irq, &psc_dma_bcom_irq, IRQF_SHARED, in mpc5200_audio_dma_create()
407 "psc-dma-capture", &psc_dma->capture); in mpc5200_audio_dma_create()
408 rc |= request_irq(psc_dma->playback.irq, &psc_dma_bcom_irq, IRQF_SHARED, in mpc5200_audio_dma_create()
409 "psc-dma-playback", &psc_dma->playback); in mpc5200_audio_dma_create()
416 dev_set_drvdata(&op->dev, psc_dma); in mpc5200_audio_dma_create()
422 free_irq(psc_dma->irq, psc_dma); in mpc5200_audio_dma_create()
423 free_irq(psc_dma->capture.irq, &psc_dma->capture); in mpc5200_audio_dma_create()
424 free_irq(psc_dma->playback.irq, &psc_dma->playback); in mpc5200_audio_dma_create()
426 kfree(psc_dma); in mpc5200_audio_dma_create()
435 struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); in mpc5200_audio_dma_destroy() local
439 bcom_gen_bd_rx_release(psc_dma->capture.bcom_task); in mpc5200_audio_dma_destroy()
440 bcom_gen_bd_tx_release(psc_dma->playback.bcom_task); in mpc5200_audio_dma_destroy()
443 free_irq(psc_dma->irq, psc_dma); in mpc5200_audio_dma_destroy()
444 free_irq(psc_dma->capture.irq, &psc_dma->capture); in mpc5200_audio_dma_destroy()
445 free_irq(psc_dma->playback.irq, &psc_dma->playback); in mpc5200_audio_dma_destroy()
447 iounmap(psc_dma->psc_regs); in mpc5200_audio_dma_destroy()
448 kfree(psc_dma); in mpc5200_audio_dma_destroy()