Lines Matching refs:azx_dev

407 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,  in mark_runtime_wc()  argument
410 if (azx_dev->wc_marked != on) { in mark_runtime_wc()
412 azx_dev->wc_marked = on; in mark_runtime_wc()
421 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
505 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_lpib() argument
508 struct snd_pcm_substream *substream = azx_dev->substream; in azx_get_delay_from_lpib()
510 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
518 if (delay >= azx_dev->delay_negative_threshold) in azx_get_delay_from_lpib()
521 delay += azx_dev->bufsize; in azx_get_delay_from_lpib()
524 if (delay >= azx_dev->period_bytes) { in azx_get_delay_from_lpib()
527 delay, azx_dev->period_bytes); in azx_get_delay_from_lpib()
536 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
539 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
544 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
546 azx_dev->irq_pending = 0; in azx_position_check()
550 azx_dev->irq_pending = 1; in azx_position_check()
565 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
567 struct snd_pcm_substream *substream = azx_dev->substream; in azx_position_ok()
572 wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk; in azx_position_ok()
573 if (wallclk < (azx_dev->period_wallclk * 2) / 3) in azx_position_ok()
577 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
579 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
584 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
593 if (pos >= azx_dev->bufsize) in azx_position_ok()
596 if (WARN_ONCE(!azx_dev->period_bytes, in azx_position_ok()
599 if (wallclk < (azx_dev->period_wallclk * 5) / 4 && in azx_position_ok()
600 pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) in azx_position_ok()
603 azx_dev->start_wallclk += wallclk; in azx_position_ok()
627 struct azx_dev *azx_dev = &chip->azx_dev[i]; in azx_irq_pending_work() local
628 if (!azx_dev->irq_pending || in azx_irq_pending_work()
629 !azx_dev->substream || in azx_irq_pending_work()
630 !azx_dev->running) in azx_irq_pending_work()
632 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
634 azx_dev->irq_pending = 0; in azx_irq_pending_work()
636 snd_pcm_period_elapsed(azx_dev->substream); in azx_irq_pending_work()
657 chip->azx_dev[i].irq_pending = 0; in azx_clear_irq_pending()
680 struct azx_dev *azx_dev) in azx_via_get_position() argument
686 link_pos = azx_sd_readl(chip, azx_dev, SD_LPIB); in azx_via_get_position()
687 if (azx_dev->substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in azx_via_get_position()
696 mod_dma_pos = le32_to_cpu(*azx_dev->posbuf); in azx_via_get_position()
697 mod_dma_pos %= azx_dev->period_bytes; in azx_via_get_position()
704 if (azx_dev->insufficient) { in azx_via_get_position()
709 azx_dev->insufficient = 0; in azx_via_get_position()
713 mini_pos = azx_dev->bufsize + link_pos - fifo_size; in azx_via_get_position()
718 mod_mini_pos = mini_pos % azx_dev->period_bytes; in azx_via_get_position()
719 mod_link_pos = link_pos % azx_dev->period_bytes; in azx_via_get_position()
725 bound_pos = mini_pos - mod_mini_pos + azx_dev->period_bytes; in azx_via_get_position()
726 if (bound_pos >= azx_dev->bufsize) in azx_via_get_position()
1133 azx_stream_stop(chip, &chip->azx_dev[i]); in azx_free()
1147 kfree(chip->azx_dev); in azx_free()
1613 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), in azx_first_init()
1615 if (!chip->azx_dev) in azx_first_init()
1757 struct azx_dev *azx_dev = get_azx_dev(substream); in substream_alloc_pages() local
1760 mark_runtime_wc(chip, azx_dev, substream, false); in substream_alloc_pages()
1761 azx_dev->bufsize = 0; in substream_alloc_pages()
1762 azx_dev->period_bytes = 0; in substream_alloc_pages()
1763 azx_dev->format_val = 0; in substream_alloc_pages()
1767 mark_runtime_wc(chip, azx_dev, substream, true); in substream_alloc_pages()
1774 struct azx_dev *azx_dev = get_azx_dev(substream); in substream_free_pages() local
1775 mark_runtime_wc(chip, azx_dev, substream, false); in substream_free_pages()