Lines Matching refs:azx_dev
410 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
413 if (azx_dev->wc_marked != on) { in mark_runtime_wc()
415 azx_dev->wc_marked = on; in mark_runtime_wc()
424 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
508 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_lpib() argument
511 struct snd_pcm_substream *substream = azx_dev->substream; in azx_get_delay_from_lpib()
513 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
521 if (delay >= azx_dev->delay_negative_threshold) in azx_get_delay_from_lpib()
524 delay += azx_dev->bufsize; in azx_get_delay_from_lpib()
527 if (delay >= azx_dev->period_bytes) { in azx_get_delay_from_lpib()
530 delay, azx_dev->period_bytes); in azx_get_delay_from_lpib()
539 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
542 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
547 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
549 azx_dev->irq_pending = 0; in azx_position_check()
553 azx_dev->irq_pending = 1; in azx_position_check()
568 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
570 struct snd_pcm_substream *substream = azx_dev->substream; in azx_position_ok()
575 wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk; in azx_position_ok()
576 if (wallclk < (azx_dev->period_wallclk * 2) / 3) in azx_position_ok()
580 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
582 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
587 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
596 if (pos >= azx_dev->bufsize) in azx_position_ok()
599 if (WARN_ONCE(!azx_dev->period_bytes, in azx_position_ok()
602 if (wallclk < (azx_dev->period_wallclk * 5) / 4 && in azx_position_ok()
603 pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) in azx_position_ok()
606 azx_dev->start_wallclk += wallclk; in azx_position_ok()
630 struct azx_dev *azx_dev = &chip->azx_dev[i]; in azx_irq_pending_work() local
631 if (!azx_dev->irq_pending || in azx_irq_pending_work()
632 !azx_dev->substream || in azx_irq_pending_work()
633 !azx_dev->running) in azx_irq_pending_work()
635 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
637 azx_dev->irq_pending = 0; in azx_irq_pending_work()
639 snd_pcm_period_elapsed(azx_dev->substream); in azx_irq_pending_work()
660 chip->azx_dev[i].irq_pending = 0; in azx_clear_irq_pending()
683 struct azx_dev *azx_dev) in azx_via_get_position() argument
689 link_pos = azx_sd_readl(chip, azx_dev, SD_LPIB); in azx_via_get_position()
690 if (azx_dev->substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in azx_via_get_position()
699 mod_dma_pos = le32_to_cpu(*azx_dev->posbuf); in azx_via_get_position()
700 mod_dma_pos %= azx_dev->period_bytes; in azx_via_get_position()
707 if (azx_dev->insufficient) { in azx_via_get_position()
712 azx_dev->insufficient = 0; in azx_via_get_position()
716 mini_pos = azx_dev->bufsize + link_pos - fifo_size; in azx_via_get_position()
721 mod_mini_pos = mini_pos % azx_dev->period_bytes; in azx_via_get_position()
722 mod_link_pos = link_pos % azx_dev->period_bytes; in azx_via_get_position()
728 bound_pos = mini_pos - mod_mini_pos + azx_dev->period_bytes; in azx_via_get_position()
729 if (bound_pos >= azx_dev->bufsize) in azx_via_get_position()
1131 azx_stream_stop(chip, &chip->azx_dev[i]); in azx_free()
1146 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()
1768 struct azx_dev *azx_dev = get_azx_dev(substream); in substream_alloc_pages() local
1771 mark_runtime_wc(chip, azx_dev, substream, false); in substream_alloc_pages()
1772 azx_dev->bufsize = 0; in substream_alloc_pages()
1773 azx_dev->period_bytes = 0; in substream_alloc_pages()
1774 azx_dev->format_val = 0; in substream_alloc_pages()
1778 mark_runtime_wc(chip, azx_dev, substream, true); in substream_alloc_pages()
1785 struct azx_dev *azx_dev = get_azx_dev(substream); in substream_free_pages() local
1786 mark_runtime_wc(chip, azx_dev, substream, false); in substream_free_pages()