Lines Matching refs:azx_dev
585 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_lpib() argument
588 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_delay_from_lpib()
590 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
598 if (delay >= azx_dev->core.delay_negative_threshold) in azx_get_delay_from_lpib()
601 delay += azx_dev->core.bufsize; in azx_get_delay_from_lpib()
604 if (delay >= azx_dev->core.period_bytes) { in azx_get_delay_from_lpib()
607 delay, azx_dev->core.period_bytes); in azx_get_delay_from_lpib()
616 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
619 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
624 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
626 azx_dev->irq_pending = 0; in azx_position_check()
630 azx_dev->irq_pending = 1; in azx_position_check()
650 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
652 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_position_ok()
659 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk; in azx_position_ok()
660 if (wallclk < (azx_dev->core.period_wallclk * 2) / 3) in azx_position_ok()
664 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
666 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
674 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
683 if (pos >= azx_dev->core.bufsize) in azx_position_ok()
686 if (WARN_ONCE(!azx_dev->core.period_bytes, in azx_position_ok()
689 if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 && in azx_position_ok()
690 pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2) in azx_position_ok()
693 azx_dev->core.start_wallclk += wallclk; in azx_position_ok()
695 if (azx_dev->core.no_period_wakeup) in azx_position_ok()
737 struct azx_dev *azx_dev = stream_to_azx_dev(s); in azx_irq_pending_work() local
738 if (!azx_dev->irq_pending || in azx_irq_pending_work()
742 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
744 azx_dev->irq_pending = 0; in azx_irq_pending_work()
768 struct azx_dev *azx_dev = stream_to_azx_dev(s); in azx_clear_irq_pending() local
769 azx_dev->irq_pending = 0; in azx_clear_irq_pending()
796 struct azx_dev *azx_dev) in azx_via_get_position() argument
802 link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); in azx_via_get_position()
803 if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in azx_via_get_position()
812 mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf); in azx_via_get_position()
813 mod_dma_pos %= azx_dev->core.period_bytes; in azx_via_get_position()
815 fifo_size = azx_stream(azx_dev)->fifo_size - 1; in azx_via_get_position()
817 if (azx_dev->insufficient) { in azx_via_get_position()
822 azx_dev->insufficient = 0; in azx_via_get_position()
826 mini_pos = azx_dev->core.bufsize + link_pos - fifo_size; in azx_via_get_position()
831 mod_mini_pos = mini_pos % azx_dev->core.period_bytes; in azx_via_get_position()
832 mod_link_pos = link_pos % azx_dev->core.period_bytes; in azx_via_get_position()
838 bound_pos = mini_pos - mod_mini_pos + azx_dev->core.period_bytes; in azx_via_get_position()
839 if (bound_pos >= azx_dev->core.bufsize) in azx_via_get_position()
850 static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev) in azx_get_pos_fifo() argument
852 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_pos_fifo()
856 pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); in azx_get_pos_fifo()
862 if (azx_dev->insufficient) { in azx_get_pos_fifo()
867 azx_dev->insufficient = 0; in azx_get_pos_fifo()
874 pos += azx_dev->core.bufsize; in azx_get_pos_fifo()
881 static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_fifo() argument
884 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_delay_from_fifo()