Lines Matching defs:azx_dev

579 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev,
582 struct snd_pcm_substream *substream = azx_dev->core.substream;
584 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev);
592 if (delay >= azx_dev->core.delay_negative_threshold)
595 delay += azx_dev->core.bufsize;
598 if (delay >= azx_dev->core.period_bytes) {
601 delay, azx_dev->core.period_bytes);
610 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
613 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)
618 ok = azx_position_ok(chip, azx_dev);
620 azx_dev->irq_pending = 0;
624 azx_dev->irq_pending = 1;
644 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
646 struct snd_pcm_substream *substream = azx_dev->core.substream;
660 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk;
661 if (wallclk < (azx_dev->core.period_wallclk * 2) / 3)
665 pos = chip->get_position[stream](chip, azx_dev);
667 pos = azx_get_pos_posbuf(chip, azx_dev);
675 pos = azx_get_pos_lpib(chip, azx_dev);
684 if (pos >= azx_dev->core.bufsize)
687 if (WARN_ONCE(!azx_dev->core.period_bytes,
688 "hda-intel: zero azx_dev->period_bytes"))
690 if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 &&
691 pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2)
694 azx_dev->core.start_wallclk += wallclk;
696 if (azx_dev->core.no_period_wakeup)
738 struct azx_dev *azx_dev = stream_to_azx_dev(s);
739 if (!azx_dev->irq_pending ||
743 ok = azx_position_ok(chip, azx_dev);
745 azx_dev->irq_pending = 0;
769 struct azx_dev *azx_dev = stream_to_azx_dev(s);
770 azx_dev->irq_pending = 0;
803 struct azx_dev *azx_dev)
809 link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
810 if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
819 mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf);
820 mod_dma_pos %= azx_dev->core.period_bytes;
822 fifo_size = azx_stream(azx_dev)->fifo_size;
824 if (azx_dev->insufficient) {
829 azx_dev->insufficient = 0;
833 mini_pos = azx_dev->core.bufsize + link_pos - fifo_size;
838 mod_mini_pos = mini_pos % azx_dev->core.period_bytes;
839 mod_link_pos = link_pos % azx_dev->core.period_bytes;
845 bound_pos = mini_pos - mod_mini_pos + azx_dev->core.period_bytes;
846 if (bound_pos >= azx_dev->core.bufsize)
857 static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev)
859 struct snd_pcm_substream *substream = azx_dev->core.substream;
863 pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
869 if (azx_dev->insufficient) {
874 azx_dev->insufficient = 0;
881 pos += azx_dev->core.bufsize;
888 static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev,
891 struct snd_pcm_substream *substream = azx_dev->core.substream;