Lines Matching refs:azx_dev
582 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_lpib() argument
585 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_delay_from_lpib()
587 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
595 if (delay >= azx_dev->core.delay_negative_threshold) in azx_get_delay_from_lpib()
598 delay += azx_dev->core.bufsize; in azx_get_delay_from_lpib()
601 if (delay >= azx_dev->core.period_bytes) { in azx_get_delay_from_lpib()
604 delay, azx_dev->core.period_bytes); in azx_get_delay_from_lpib()
613 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
616 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
621 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
623 azx_dev->irq_pending = 0; in azx_position_check()
627 azx_dev->irq_pending = 1; in azx_position_check()
647 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
649 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_position_ok()
656 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk; in azx_position_ok()
657 if (wallclk < (azx_dev->core.period_wallclk * 2) / 3) in azx_position_ok()
661 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
663 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
671 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
680 if (pos >= azx_dev->core.bufsize) in azx_position_ok()
683 if (WARN_ONCE(!azx_dev->core.period_bytes, in azx_position_ok()
686 if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 && in azx_position_ok()
687 pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2) in azx_position_ok()
690 azx_dev->core.start_wallclk += wallclk; in azx_position_ok()
692 if (azx_dev->core.no_period_wakeup) in azx_position_ok()
734 struct azx_dev *azx_dev = stream_to_azx_dev(s); in azx_irq_pending_work() local
735 if (!azx_dev->irq_pending || in azx_irq_pending_work()
739 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
741 azx_dev->irq_pending = 0; in azx_irq_pending_work()
765 struct azx_dev *azx_dev = stream_to_azx_dev(s); in azx_clear_irq_pending() local
766 azx_dev->irq_pending = 0; in azx_clear_irq_pending()
793 struct azx_dev *azx_dev) in azx_via_get_position() argument
799 link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); in azx_via_get_position()
800 if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in azx_via_get_position()
809 mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf); in azx_via_get_position()
810 mod_dma_pos %= azx_dev->core.period_bytes; in azx_via_get_position()
812 fifo_size = azx_stream(azx_dev)->fifo_size - 1; in azx_via_get_position()
814 if (azx_dev->insufficient) { in azx_via_get_position()
819 azx_dev->insufficient = 0; in azx_via_get_position()
823 mini_pos = azx_dev->core.bufsize + link_pos - fifo_size; in azx_via_get_position()
828 mod_mini_pos = mini_pos % azx_dev->core.period_bytes; in azx_via_get_position()
829 mod_link_pos = link_pos % azx_dev->core.period_bytes; in azx_via_get_position()
835 bound_pos = mini_pos - mod_mini_pos + azx_dev->core.period_bytes; in azx_via_get_position()
836 if (bound_pos >= azx_dev->core.bufsize) in azx_via_get_position()
847 static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev) in azx_get_pos_fifo() argument
849 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_pos_fifo()
853 pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); in azx_get_pos_fifo()
859 if (azx_dev->insufficient) { in azx_get_pos_fifo()
864 azx_dev->insufficient = 0; in azx_get_pos_fifo()
871 pos += azx_dev->core.bufsize; in azx_get_pos_fifo()
878 static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_fifo() argument
881 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_delay_from_fifo()