Lines Matching refs:azx_dev

572 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev,
575 struct snd_pcm_substream *substream = azx_dev->core.substream;
577 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev);
585 if (delay >= azx_dev->core.delay_negative_threshold)
588 delay += azx_dev->core.bufsize;
591 if (delay >= azx_dev->core.period_bytes) {
594 delay, azx_dev->core.period_bytes);
603 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
606 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev)
611 ok = azx_position_ok(chip, azx_dev);
613 azx_dev->irq_pending = 0;
617 azx_dev->irq_pending = 1;
637 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
639 struct snd_pcm_substream *substream = azx_dev->core.substream;
653 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk;
654 if (wallclk < (azx_dev->core.period_wallclk * 2) / 3)
658 pos = chip->get_position[stream](chip, azx_dev);
660 pos = azx_get_pos_posbuf(chip, azx_dev);
668 pos = azx_get_pos_lpib(chip, azx_dev);
677 if (pos >= azx_dev->core.bufsize)
680 if (WARN_ONCE(!azx_dev->core.period_bytes,
681 "hda-intel: zero azx_dev->period_bytes"))
683 if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 &&
684 pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2)
687 azx_dev->core.start_wallclk += wallclk;
689 if (azx_dev->core.no_period_wakeup)
731 struct azx_dev *azx_dev = stream_to_azx_dev(s);
732 if (!azx_dev->irq_pending ||
736 ok = azx_position_ok(chip, azx_dev);
738 azx_dev->irq_pending = 0;
762 struct azx_dev *azx_dev = stream_to_azx_dev(s);
763 azx_dev->irq_pending = 0;
790 struct azx_dev *azx_dev)
796 link_pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
797 if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
806 mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf);
807 mod_dma_pos %= azx_dev->core.period_bytes;
809 fifo_size = azx_stream(azx_dev)->fifo_size - 1;
811 if (azx_dev->insufficient) {
816 azx_dev->insufficient = 0;
820 mini_pos = azx_dev->core.bufsize + link_pos - fifo_size;
825 mod_mini_pos = mini_pos % azx_dev->core.period_bytes;
826 mod_link_pos = link_pos % azx_dev->core.period_bytes;
832 bound_pos = mini_pos - mod_mini_pos + azx_dev->core.period_bytes;
833 if (bound_pos >= azx_dev->core.bufsize)
844 static unsigned int azx_get_pos_fifo(struct azx *chip, struct azx_dev *azx_dev)
846 struct snd_pcm_substream *substream = azx_dev->core.substream;
850 pos = snd_hdac_stream_get_pos_lpib(azx_stream(azx_dev));
856 if (azx_dev->insufficient) {
861 azx_dev->insufficient = 0;
868 pos += azx_dev->core.bufsize;
875 static int azx_get_delay_from_fifo(struct azx *chip, struct azx_dev *azx_dev,
878 struct snd_pcm_substream *substream = azx_dev->core.substream;