Lines Matching refs:azx_dev

616 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev,  in azx_get_delay_from_lpib()  argument
619 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_delay_from_lpib()
621 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
629 if (delay >= azx_dev->core.delay_negative_threshold) in azx_get_delay_from_lpib()
632 delay += azx_dev->core.bufsize; in azx_get_delay_from_lpib()
635 if (delay >= azx_dev->core.period_bytes) { in azx_get_delay_from_lpib()
638 delay, azx_dev->core.period_bytes); in azx_get_delay_from_lpib()
647 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
650 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
655 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
657 azx_dev->irq_pending = 0; in azx_position_check()
661 azx_dev->irq_pending = 1; in azx_position_check()
681 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
683 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_position_ok()
690 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk; in azx_position_ok()
691 if (wallclk < (azx_dev->core.period_wallclk * 2) / 3) in azx_position_ok()
695 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
697 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
705 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
714 if (pos >= azx_dev->core.bufsize) in azx_position_ok()
717 if (WARN_ONCE(!azx_dev->core.period_bytes, in azx_position_ok()
720 if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 && in azx_position_ok()
721 pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2) in azx_position_ok()
724 azx_dev->core.start_wallclk += wallclk; in azx_position_ok()
726 if (azx_dev->core.no_period_wakeup) in azx_position_ok()
768 struct azx_dev *azx_dev = stream_to_azx_dev(s); in azx_irq_pending_work() local
769 if (!azx_dev->irq_pending || in azx_irq_pending_work()
773 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
775 azx_dev->irq_pending = 0; in azx_irq_pending_work()
799 struct azx_dev *azx_dev = stream_to_azx_dev(s); in azx_clear_irq_pending() local
800 azx_dev->irq_pending = 0; in azx_clear_irq_pending()
827 struct azx_dev *azx_dev) in azx_via_get_position() argument
833 link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); in azx_via_get_position()
834 if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in azx_via_get_position()
843 mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf); in azx_via_get_position()
844 mod_dma_pos %= azx_dev->core.period_bytes; in azx_via_get_position()
846 fifo_size = azx_stream(azx_dev)->fifo_size - 1; in azx_via_get_position()
848 if (azx_dev->insufficient) { in azx_via_get_position()
853 azx_dev->insufficient = 0; in azx_via_get_position()
857 mini_pos = azx_dev->core.bufsize + link_pos - fifo_size; in azx_via_get_position()
862 mod_mini_pos = mini_pos % azx_dev->core.period_bytes; in azx_via_get_position()
863 mod_link_pos = link_pos % azx_dev->core.period_bytes; in azx_via_get_position()
869 bound_pos = mini_pos - mod_mini_pos + azx_dev->core.period_bytes; in azx_via_get_position()
870 if (bound_pos >= azx_dev->core.bufsize) in azx_via_get_position()
881 static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev) in azx_get_pos_fifo() argument
883 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_pos_fifo()
887 pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev)); in azx_get_pos_fifo()
893 if (azx_dev->insufficient) { in azx_get_pos_fifo()
898 azx_dev->insufficient = 0; in azx_get_pos_fifo()
905 pos += azx_dev->core.bufsize; in azx_get_pos_fifo()
912 static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_fifo() argument
915 struct snd_pcm_substream *substream = azx_dev->core.substream; in azx_get_delay_from_fifo()