Lines Matching full:pi
19 struct pcm_info **pi, struct pcm_info **other) in get_pcm_info() argument
22 if (pi) in get_pcm_info()
23 *pi = &i2sdev->in; in get_pcm_info()
27 if (pi) in get_pcm_info()
28 *pi = &i2sdev->out; in get_pcm_info()
74 struct pcm_info *pi, *other; in i2sbus_pcm_open() local
88 get_pcm_info(i2sdev, in, &pi, &other); in i2sbus_pcm_open()
90 hw = &pi->substream->runtime->hw; in i2sbus_pcm_open()
93 if (pi->active) { in i2sbus_pcm_open()
195 err = snd_pcm_hw_constraint_integer(pi->substream->runtime, in i2sbus_pcm_open()
203 err = cii->codec->open(cii, pi->substream); in i2sbus_pcm_open()
212 pi->substream); in i2sbus_pcm_open()
232 struct pcm_info *pi; in i2sbus_pcm_close() local
237 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_pcm_close()
241 tmp = cii->codec->close(cii, pi->substream); in i2sbus_pcm_close()
247 pi->substream = NULL; in i2sbus_pcm_close()
248 pi->active = 0; in i2sbus_pcm_close()
254 struct pcm_info *pi) in i2sbus_wait_for_stop() argument
261 if (pi->dbdma_ring.stopping) { in i2sbus_wait_for_stop()
262 pi->stop_completion = &done; in i2sbus_wait_for_stop()
266 pi->stop_completion = NULL; in i2sbus_wait_for_stop()
271 out_le32(&pi->dbdma->control, (RUN | PAUSE | 1) << 16); in i2sbus_wait_for_stop()
272 pi->dbdma_ring.stopping = 0; in i2sbus_wait_for_stop()
274 while (in_le32(&pi->dbdma->status) & ACTIVE) { in i2sbus_wait_for_stop()
287 struct pcm_info *pi; in i2sbus_wait_for_stop_both() local
289 get_pcm_info(i2sdev, 0, &pi, NULL); in i2sbus_wait_for_stop_both()
290 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_wait_for_stop_both()
291 get_pcm_info(i2sdev, 1, &pi, NULL); in i2sbus_wait_for_stop_both()
292 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_wait_for_stop_both()
299 struct pcm_info *pi; in i2sbus_hw_free() local
301 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_hw_free()
302 if (pi->dbdma_ring.stopping) in i2sbus_hw_free()
303 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_hw_free()
331 struct pcm_info *pi, *other; in i2sbus_pcm_prepare() local
338 get_pcm_info(i2sdev, in, &pi, &other); in i2sbus_pcm_prepare()
340 if (pi->dbdma_ring.running) { in i2sbus_pcm_prepare()
344 if (pi->dbdma_ring.stopping) in i2sbus_pcm_prepare()
345 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_pcm_prepare()
347 if (!pi->substream || !pi->substream->runtime) { in i2sbus_pcm_prepare()
352 runtime = pi->substream->runtime; in i2sbus_pcm_prepare()
353 pi->active = 1; in i2sbus_pcm_prepare()
364 periodsize = snd_pcm_lib_period_bytes(pi->substream); in i2sbus_pcm_prepare()
365 nperiods = pi->substream->runtime->periods; in i2sbus_pcm_prepare()
366 pi->current_period = 0; in i2sbus_pcm_prepare()
369 command = pi->dbdma_ring.cmds; in i2sbus_pcm_prepare()
386 stopaddr = pi->dbdma_ring.bus_cmd_start + in i2sbus_pcm_prepare()
397 command->cmd_dep = cpu_to_le32(pi->dbdma_ring.bus_cmd_start); in i2sbus_pcm_prepare()
459 err = cii->codec->prepare(cii, &bi, pi->substream); in i2sbus_pcm_prepare()
533 struct pcm_info *pi; in i2sbus_pcm_trigger() local
539 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_pcm_trigger()
544 if (pi->dbdma_ring.running) { in i2sbus_pcm_trigger()
550 cii->codec->start(cii, pi->substream); in i2sbus_pcm_trigger()
551 pi->dbdma_ring.running = 1; in i2sbus_pcm_trigger()
553 if (pi->dbdma_ring.stopping) { in i2sbus_pcm_trigger()
555 out_le32(&pi->dbdma->control, 1 << 16); in i2sbus_pcm_trigger()
556 if (in_le32(&pi->dbdma->status) & ACTIVE) { in i2sbus_pcm_trigger()
559 if (in_le32(&pi->dbdma->status) & ACTIVE) { in i2sbus_pcm_trigger()
560 pi->dbdma_ring.stopping = 0; in i2sbus_pcm_trigger()
567 out_le32(&pi->dbdma->control, (RUN | PAUSE | 1) << 16); in i2sbus_pcm_trigger()
570 out_le32(&pi->dbdma->br_sel, (1 << 16) | 1); in i2sbus_pcm_trigger()
573 out_le32(&pi->dbdma->cmdptr, pi->dbdma_ring.bus_cmd_start); in i2sbus_pcm_trigger()
576 pi->current_period = 0; in i2sbus_pcm_trigger()
577 pi->frame_count = in_le32(&i2sdev->intfregs->frame_count); in i2sbus_pcm_trigger()
580 out_le32(&pi->dbdma->control, (RUN << 16) | RUN); in i2sbus_pcm_trigger()
587 if (!pi->dbdma_ring.running) { in i2sbus_pcm_trigger()
591 pi->dbdma_ring.running = 0; in i2sbus_pcm_trigger()
594 out_le32(&pi->dbdma->control, (1 << 16) | 1); in i2sbus_pcm_trigger()
595 pi->dbdma_ring.stopping = 1; in i2sbus_pcm_trigger()
599 cii->codec->stop(cii, pi->substream); in i2sbus_pcm_trigger()
613 struct pcm_info *pi; in i2sbus_pcm_pointer() local
616 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_pcm_pointer()
619 fc = fc - pi->frame_count; in i2sbus_pcm_pointer()
621 if (fc >= pi->substream->runtime->buffer_size) in i2sbus_pcm_pointer()
622 fc %= pi->substream->runtime->buffer_size; in i2sbus_pcm_pointer()
628 struct pcm_info *pi; in handle_interrupt() local
636 get_pcm_info(i2sdev, in, &pi, NULL); in handle_interrupt()
637 if (!pi->dbdma_ring.running && !pi->dbdma_ring.stopping) in handle_interrupt()
640 i = pi->current_period; in handle_interrupt()
641 runtime = pi->substream->runtime; in handle_interrupt()
642 while (pi->dbdma_ring.cmds[i].xfer_status) { in handle_interrupt()
643 if (le16_to_cpu(pi->dbdma_ring.cmds[i].xfer_status) & BT) in handle_interrupt()
650 pi->dbdma_ring.cmds[i].xfer_status = 0; in handle_interrupt()
654 pi->frame_count += runtime->buffer_size; in handle_interrupt()
656 pi->current_period = i; in handle_interrupt()
664 if (fc < pi->frame_count + nframes) in handle_interrupt()
665 pi->frame_count = fc - nframes; in handle_interrupt()
671 status = in_le32(&pi->dbdma->status); in handle_interrupt()
683 out_le32(&pi->dbdma->control, (RUN | PAUSE | 1) << 16); in handle_interrupt()
685 pi->dbdma_ring.stopping = 0; in handle_interrupt()
686 if (pi->stop_completion) in handle_interrupt()
687 complete(pi->stop_completion); in handle_interrupt()
690 if (!pi->dbdma_ring.running) in handle_interrupt()
694 snd_pcm_period_elapsed(pi->substream); in handle_interrupt()